dsh-mnemon-source-memory-spaces 0.5.24 → 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/client.js CHANGED
@@ -2538,15 +2538,16 @@ window.__ModuleLoader__.load({
2538
2538
  props.catalogKnown
2539
2539
  ]);
2540
2540
  (0, react.useEffect)(() => {
2541
+ if (props.active === false) return;
2541
2542
  const timer = window.setInterval(() => setSyncClock(Date.now()), 1e3);
2542
2543
  return () => window.clearInterval(timer);
2543
- }, []);
2544
+ }, [props.active]);
2544
2545
  (0, react.useEffect)(() => {
2545
2546
  setSpaceProviderId((current) => readyProviderId(catalog?.providers ?? [], current) ?? current);
2546
2547
  }, [catalog]);
2547
2548
  const hostRediscovering = catalog?.rediscovery?.running === true && !rediscovering;
2548
2549
  (0, react.useEffect)(() => {
2549
- if (!hostRediscovering) return;
2550
+ if (!hostRediscovering || props.active === false) return;
2550
2551
  let active = true;
2551
2552
  const timer = window.setInterval(() => {
2552
2553
  props.client.bodyDirectory().then((next) => {
@@ -2564,6 +2565,7 @@ window.__ModuleLoader__.load({
2564
2565
  }, [
2565
2566
  hostRediscovering,
2566
2567
  load,
2568
+ props.active,
2567
2569
  props.client,
2568
2570
  props.onMutate
2569
2571
  ]);
@@ -6064,10 +6066,10 @@ window.__ModuleLoader__.load({
6064
6066
  const input = (value) => JSON.parse(JSON.stringify(value));
6065
6067
  return {
6066
6068
  canAssist: client.canAssist,
6067
- status: () => client.read("status-summary"),
6068
- bodies: () => client.read("bodies"),
6069
- bodyDirectory: () => client.read("body-directory"),
6070
- graph: (memoryBodyIds) => client.read("graph", input({ memoryBodyIds })),
6069
+ status: () => client.read("status-summary", null, { coalesce: true }),
6070
+ bodies: () => client.read("bodies", null, { coalesce: true }),
6071
+ bodyDirectory: () => client.read("body-directory", null, { coalesce: true }),
6072
+ graph: (memoryBodyIds) => client.read("graph", input({ memoryBodyIds }), { coalesce: true }),
6071
6073
  list: (request) => client.read("list", input(request ?? {})),
6072
6074
  entities: (entity, limit) => client.read("entities", input({
6073
6075
  entity,
@@ -6248,6 +6250,7 @@ window.__ModuleLoader__.load({
6248
6250
  })]
6249
6251
  }),
6250
6252
  page === "spaces" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(OverviewPage, {
6253
+ active: props.active ?? true,
6251
6254
  client,
6252
6255
  metadataClient: client,
6253
6256
  revision,
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 Mnemon Windows release, ensure mnemon.exe is on PATH or under %LOCALAPPDATA%\\Programs\\mnemon, 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."}`;
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 root = dirname(dirname(realCommand));
34
- if (manifest(join(root, "package.json"))?.name === MNEMON_NPM_PACKAGE && samePath(realCommand, join(root, "bin/mnemon.js"))) return realCommand;
35
- if (/\.cmd$/i.test(command)) {
36
- const launcher = join(dirname(command), "node_modules", MNEMON_NPM_PACKAGE, "bin/mnemon.js");
37
- try {
38
- if (manifest(join(dirname(dirname(launcher)), "package.json"))?.name === MNEMON_NPM_PACKAGE && existsSync(launcher) && readFileSync(command, "utf8").replaceAll("\\", "/").includes("node_modules/@mnemon-dev/mnemon/bin/mnemon.js")) return launcher;
39
- } catch {}
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)) if (isExecutable(path)) return path;
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 };
@@ -3,6 +3,7 @@ import { type MemorySpaceMetadataUpdate, type MemorySpaceView } from '../contrac
3
3
  import type { MemorySpacesPageClient } from './api.ts';
4
4
  export declare function OverviewPage(props: {
5
5
  client: MemorySpacesPageClient;
6
+ active?: boolean;
6
7
  metadataClient: MemorySpacesPageClient;
7
8
  revision: number;
8
9
  reloadKey?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mnemon-source-memory-spaces",
3
- "version": "0.5.24",
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.2",
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.37",
72
- "dsh-mnemon-provider-byterover": "^0.5.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.10",
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.2",
105
- "@deepseek-ai/dsh-util-code-language": "0.2.1-rc.2",
106
- "@deepseek-ai/dsh-util-workspace-path": "0.2.1-rc.2",
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",