dsh-mnemon-source-memory-spaces 0.5.1 → 0.5.3
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/README.md +9 -15
- package/lib/client.js +1128 -235
- package/lib/index.d.ts +16 -1
- package/lib/index.js +11 -75
- package/lib/native-cli.d.ts +15 -0
- package/lib/native-cli.js +108 -0
- package/lib/types/client/presentation.d.ts +6 -0
- package/package.json +23 -14
- package/presentation/locales.json +696 -0
- package/presentation/page.module.css +486 -0
- package/presentation/sidebar.module.css +281 -0
package/lib/index.d.ts
CHANGED
|
@@ -14,7 +14,22 @@ interface MemorySpacesConfig {
|
|
|
14
14
|
recallQuality?: RecallQualityConfig;
|
|
15
15
|
persistenceStrategy?: MemoryPersistenceStrategy;
|
|
16
16
|
}
|
|
17
|
+
interface ResolvedMemorySpacesConfig {
|
|
18
|
+
storageScope: 'global' | 'workspace' | 'custom';
|
|
19
|
+
dataDir?: string;
|
|
20
|
+
cliPath?: string;
|
|
21
|
+
store?: string;
|
|
22
|
+
timeoutMs: number;
|
|
23
|
+
defaultRecallLimit: number;
|
|
24
|
+
writeEnabled: boolean;
|
|
25
|
+
embedding: ResolvedMnemonEmbeddingConfig;
|
|
26
|
+
recallQuality: ResolvedRecallQualityConfig;
|
|
27
|
+
persistenceStrategy: ResolvedMemoryPersistenceStrategy;
|
|
28
|
+
}
|
|
17
29
|
declare const MemorySpacesConfig: z<MemorySpacesConfig>;
|
|
30
|
+
declare function resolvePersistenceStrategy(value: MemoryPersistenceStrategy | undefined): ResolvedMemorySpacesConfig['persistenceStrategy'];
|
|
31
|
+
declare function resolveEmbedding(value: MemorySpacesConfig['embedding']): ResolvedMemorySpacesConfig['embedding'];
|
|
32
|
+
declare function resolveRecallQuality(value: RecallQualityConfig | undefined): ResolvedMemorySpacesConfig['recallQuality'];
|
|
18
33
|
//#endregion
|
|
19
34
|
//#region src/index.d.ts
|
|
20
35
|
declare const name = "dsh-mnemon-source-memory-spaces";
|
|
@@ -44,4 +59,4 @@ declare function resolveMemorySpaceProviderEntries(ctx: Context, declarations: r
|
|
|
44
59
|
declare function installMemorySpaces(ctx: Context, entries: readonly MemorySpaceProviderEntry[], options?: InstallMemorySpacesOptions): Promise<void>;
|
|
45
60
|
declare function apply(ctx: Context, config?: Config): Promise<void>;
|
|
46
61
|
//#endregion
|
|
47
|
-
export { type AutomaticMemoryPlacementRequest, type CATEGORIES, type Category, Config, type CreateMemoryBodyRequest, type DEFAULT_EMBEDDING_ENDPOINT, type DEFAULT_EMBEDDING_MODEL, type DEFAULT_EMBEDDING_PROTOCOL, type EDGE_TYPES, type EMBEDDING_PROTOCOL_AUTO, type EMBEDDING_PROTOCOL_OLLAMA, type EMBEDDING_PROTOCOL_OPENAI, type EdgeType, type EntityView, type INTENTS, type Insight, InstallMemorySpacesOptions, type Intent, type JsonValue, type LlmMemoryPlacementSelection, type MNEMON_EMBEDDING_PROTOCOLS, type MemoryBody, type MemoryBodyCatalog, type MemoryBodyMetadataMaintenanceResult, type MemoryBodyMetadataSample, type MemoryBodyMetadataUpdate, type MemoryBodyProvider, type MemoryBodyStats, type MemoryBodyView, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphSnapshot, type MemoryListRequest, type MemoryListView, type MemoryPersistenceStrategy, type MemoryPlacementCandidate, type MemoryPlacementCapability, type MemoryPlacementDecision, type MemoryPlacementPreference, type MemoryPlacementRules, type MemoryProviderCapabilities, type MemoryProviderConfigField, type MemoryProviderConfigOption, type MemoryProviderConnection, type MemoryProviderConnectionValue, type MemoryProviderDescriptor, type MemoryProviderIcon, type MemoryProviderId, type MemoryProviderRuntimeStatus, type MemoryProviderServiceCatalog, type MemoryProviderServiceView, type MemoryReadMode, type MemoryReadSource, type MemoryReadStatus, MemorySpaceProviderDeclaration, MemorySpaceProviderDeclarationSchema, type MemorySpacesStatus, type MnemonEmbeddingConfig, type MnemonEmbeddingProtocol, type MnemonEmbeddingStatus, type OpenVikingBodyConnection, type PreparedMemoryPlacement, type RecallQualityConfig, type RecallQualityStats, type RecallRelevanceTier, type RememberRequest, type ResolvedMemoryPersistenceStrategy, type ResolvedMnemonEmbeddingConfig, type ResolvedRecallQualityConfig, type SOURCES, type SearchRequest, type Source, type UpdateMemoryBodyRequest, type UpdateMemoryProviderServiceRequest, apply, inject, installMemorySpaces, memoryPlugin, name, resolveMemorySpaceProviderEntries };
|
|
62
|
+
export { type AutomaticMemoryPlacementRequest, type CATEGORIES, type Category, Config, type CreateMemoryBodyRequest, type DEFAULT_EMBEDDING_ENDPOINT, type DEFAULT_EMBEDDING_MODEL, type DEFAULT_EMBEDDING_PROTOCOL, type EDGE_TYPES, type EMBEDDING_PROTOCOL_AUTO, type EMBEDDING_PROTOCOL_OLLAMA, type EMBEDDING_PROTOCOL_OPENAI, type EdgeType, type EntityView, type INTENTS, type Insight, InstallMemorySpacesOptions, type Intent, type JsonValue, type LlmMemoryPlacementSelection, type MNEMON_EMBEDDING_PROTOCOLS, type MemoryBody, type MemoryBodyCatalog, type MemoryBodyMetadataMaintenanceResult, type MemoryBodyMetadataSample, type MemoryBodyMetadataUpdate, type MemoryBodyProvider, type MemoryBodyStats, type MemoryBodyView, type MemoryGraphEdge, type MemoryGraphNode, type MemoryGraphSnapshot, type MemoryListRequest, type MemoryListView, type MemoryPersistenceStrategy, type MemoryPlacementCandidate, type MemoryPlacementCapability, type MemoryPlacementDecision, type MemoryPlacementPreference, type MemoryPlacementRules, type MemoryProviderCapabilities, type MemoryProviderConfigField, type MemoryProviderConfigOption, type MemoryProviderConnection, type MemoryProviderConnectionValue, type MemoryProviderDescriptor, type MemoryProviderIcon, type MemoryProviderId, type MemoryProviderRuntimeStatus, type MemoryProviderServiceCatalog, type MemoryProviderServiceView, type MemoryReadMode, type MemoryReadSource, type MemoryReadStatus, MemorySpaceProviderDeclaration, MemorySpaceProviderDeclarationSchema, type MemorySpacesStatus, type MnemonEmbeddingConfig, type MnemonEmbeddingProtocol, type MnemonEmbeddingStatus, type OpenVikingBodyConnection, type PreparedMemoryPlacement, type RecallQualityConfig, type RecallQualityStats, type RecallRelevanceTier, type RememberRequest, type ResolvedMemoryPersistenceStrategy, type ResolvedMnemonEmbeddingConfig, type ResolvedRecallQualityConfig, type SOURCES, type SearchRequest, type Source, type UpdateMemoryBodyRequest, type UpdateMemoryProviderServiceRequest, apply, inject, installMemorySpaces, memoryPlugin, name, resolveEmbedding, resolveMemorySpaceProviderEntries, resolvePersistenceStrategy, resolveRecallQuality };
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { findMnemonCommand, isMnemonExecutable, mnemonNpmLauncher } from "./native-cli.js";
|
|
1
2
|
import { CATEGORIES as CATEGORIES$1, EDGE_TYPES, INTENTS as INTENTS$1, MNEMON_EMBEDDING_PROTOCOLS, SOURCES as SOURCES$1 } from "./contracts.js";
|
|
2
3
|
import { a as MemoryProviderCatalog, i as EMPTY_MEMORY_PROVIDER_CATALOG, n as PrivateMemorySpaceProviderHost, r as MemoryProviderAdapterRegistry, t as createMemorySpaceProviderPlugin } from "./plugin-DlsNeZbQ.js";
|
|
3
4
|
import { t as runProcess } from "./process-B-t3UflO.js";
|
|
4
5
|
import { r as defineMemorySpaceProvider } from "./definitions-DfmOqJjR.js";
|
|
6
|
+
import { existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
7
|
+
import { homedir, tmpdir } from "node:os";
|
|
8
|
+
import { basename, dirname, isAbsolute, join, resolve } from "node:path";
|
|
5
9
|
import z from "schemastery";
|
|
6
10
|
import { createMemoryMutationReceipt, defineMemoryPlugin, defineMemorySource, installMemory, memoryConfigurationDigest, memoryInputInteger, memoryInputRecord, memoryInputStringArray, memoryInputText, truncateMemoryText, withMemoryStorageLock } from "dsh-mnemon/extension-sdk";
|
|
7
11
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
12
|
import { COMPOSABLE_MEMORY_API_VERSION } from "dsh-mnemon/contracts";
|
|
9
|
-
import { accessSync, constants, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
10
|
-
import { homedir, tmpdir } from "node:os";
|
|
11
|
-
import { basename, dirname, isAbsolute, join, posix, resolve, win32 } from "node:path";
|
|
12
13
|
//#region src/view-model.ts
|
|
13
14
|
const MODEL_MEMORY_BODY_LIMIT = 16;
|
|
14
15
|
function boundedToolText(value, maximum) {
|
|
@@ -2335,75 +2336,8 @@ var MemorySpacesService = class {
|
|
|
2335
2336
|
};
|
|
2336
2337
|
//#endregion
|
|
2337
2338
|
//#region src/runner.ts
|
|
2338
|
-
|
|
2339
|
-
"
|
|
2340
|
-
"/opt/homebrew/bin/mnemon",
|
|
2341
|
-
"/usr/local/bin/mnemon",
|
|
2342
|
-
"/usr/bin/mnemon"
|
|
2343
|
-
];
|
|
2344
|
-
function pathApi(platform) {
|
|
2345
|
-
return platform === "win32" ? win32 : posix;
|
|
2346
|
-
}
|
|
2347
|
-
function expandHome(path, home = homedir(), platform = process.platform) {
|
|
2348
|
-
if (path === "~") return home;
|
|
2349
|
-
return path.startsWith("~/") || path.startsWith("~\\") ? pathApi(platform).join(home, path.slice(2)) : path;
|
|
2350
|
-
}
|
|
2351
|
-
function envValue(env, name, platform) {
|
|
2352
|
-
if (platform !== "win32") return env[name];
|
|
2353
|
-
const key = Object.keys(env).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
2354
|
-
return key === void 0 ? void 0 : env[key];
|
|
2355
|
-
}
|
|
2356
|
-
function executable(path, platform = process.platform) {
|
|
2357
|
-
if (platform === "win32" && win32.extname(path).toLowerCase() !== ".exe") return false;
|
|
2358
|
-
try {
|
|
2359
|
-
accessSync(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
2360
|
-
return statSync(path).isFile();
|
|
2361
|
-
} catch {
|
|
2362
|
-
return false;
|
|
2363
|
-
}
|
|
2364
|
-
}
|
|
2365
|
-
function windowsCommonCliPaths(env, home) {
|
|
2366
|
-
const candidates = [];
|
|
2367
|
-
const goBin = envValue(env, "GOBIN", "win32")?.trim();
|
|
2368
|
-
if (goBin !== void 0 && win32.isAbsolute(goBin)) candidates.push(win32.join(goBin, "mnemon.exe"));
|
|
2369
|
-
const goInstallRoot = (envValue(env, "GOPATH", "win32")?.trim())?.split(win32.delimiter).map((candidate) => candidate.trim()).find((candidate) => candidate !== "" && win32.isAbsolute(candidate)) ?? win32.join(home, "go");
|
|
2370
|
-
candidates.push(win32.join(goInstallRoot, "bin", "mnemon.exe"));
|
|
2371
|
-
const localAppData = envValue(env, "LOCALAPPDATA", "win32")?.trim();
|
|
2372
|
-
if (localAppData !== void 0 && win32.isAbsolute(localAppData)) candidates.push(win32.join(localAppData, "Programs", "mnemon", "mnemon.exe"));
|
|
2373
|
-
const programFiles = envValue(env, "ProgramFiles", "win32")?.trim();
|
|
2374
|
-
if (programFiles !== void 0 && win32.isAbsolute(programFiles)) candidates.push(win32.join(programFiles, "mnemon", "mnemon.exe"));
|
|
2375
|
-
return [...new Set(candidates)];
|
|
2376
|
-
}
|
|
2377
|
-
function commonCliPaths(platform, env, home) {
|
|
2378
|
-
if (platform === "win32") return windowsCommonCliPaths(env, home);
|
|
2379
|
-
return UNIX_COMMON_CLI_PATHS.map((candidate) => expandHome(candidate, home, platform));
|
|
2380
|
-
}
|
|
2381
|
-
/** Locate the local Mnemon binary without invoking a shell. */
|
|
2382
|
-
function findMnemonCommand(config, options = {}) {
|
|
2383
|
-
const platform = options.platform ?? process.platform;
|
|
2384
|
-
const env = options.env ?? process.env;
|
|
2385
|
-
const home = options.home ?? homedir();
|
|
2386
|
-
const isExecutable = options.isExecutable ?? ((path) => executable(path, platform));
|
|
2387
|
-
const paths = pathApi(platform);
|
|
2388
|
-
const resolveCommand = (command) => {
|
|
2389
|
-
const expanded = expandHome(command, home, platform);
|
|
2390
|
-
if (expanded.includes("/") || expanded.includes("\\")) return expanded;
|
|
2391
|
-
const name = platform === "win32" && paths.extname(expanded) === "" ? `${expanded}.exe` : expanded;
|
|
2392
|
-
for (const directory of (envValue(env, "PATH", platform) ?? "").split(paths.delimiter)) {
|
|
2393
|
-
if (directory === "") continue;
|
|
2394
|
-
const path = paths.join(directory, name);
|
|
2395
|
-
if (isExecutable(path)) return path;
|
|
2396
|
-
}
|
|
2397
|
-
};
|
|
2398
|
-
if (config.cliPath !== void 0) return resolveCommand(config.cliPath);
|
|
2399
|
-
const envPath = envValue(env, "MNEMON_CLI_PATH", platform)?.trim();
|
|
2400
|
-
if (envPath !== void 0 && envPath !== "") {
|
|
2401
|
-
const path = resolveCommand(envPath);
|
|
2402
|
-
if (path !== void 0 && isExecutable(path)) return path;
|
|
2403
|
-
}
|
|
2404
|
-
const fromPath = resolveCommand("mnemon");
|
|
2405
|
-
if (fromPath !== void 0) return fromPath;
|
|
2406
|
-
for (const path of commonCliPaths(platform, env, home)) if (isExecutable(path)) return path;
|
|
2339
|
+
function expandHome(path) {
|
|
2340
|
+
return path === "~" ? homedir() : path.startsWith("~/") || path.startsWith("~\\") ? join(homedir(), path.slice(2)) : path;
|
|
2407
2341
|
}
|
|
2408
2342
|
var MnemonCliError = class extends Error {
|
|
2409
2343
|
exitCode;
|
|
@@ -2465,7 +2399,9 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
|
|
|
2465
2399
|
};
|
|
2466
2400
|
let result;
|
|
2467
2401
|
try {
|
|
2468
|
-
|
|
2402
|
+
const command = currentCommand();
|
|
2403
|
+
const launcher = mnemonNpmLauncher(command);
|
|
2404
|
+
result = await processRunner(launcher === void 0 ? command : process.execPath, launcher === void 0 ? argv : [launcher, ...argv], processOptions);
|
|
2469
2405
|
} catch (error) {
|
|
2470
2406
|
throw new MnemonCliError(`${error instanceof Error ? error.message : String(error)}. ${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."}`);
|
|
2471
2407
|
}
|
|
@@ -2484,7 +2420,7 @@ function createRunner(config, processRunner = runProcess, workspaceRoot) {
|
|
|
2484
2420
|
},
|
|
2485
2421
|
get commandFound() {
|
|
2486
2422
|
const found = findMnemonCommand(config);
|
|
2487
|
-
return found !== void 0 &&
|
|
2423
|
+
return found !== void 0 && isMnemonExecutable(found);
|
|
2488
2424
|
},
|
|
2489
2425
|
config,
|
|
2490
2426
|
async runJson(args, options) {
|
|
@@ -3453,4 +3389,4 @@ async function apply(ctx, config = { providers: [] }) {
|
|
|
3453
3389
|
await installMemorySpaces(ctx, await resolveMemorySpaceProviderEntries(ctx, providers), { config: sourceConfig });
|
|
3454
3390
|
}
|
|
3455
3391
|
//#endregion
|
|
3456
|
-
export { Config, MemorySpaceProviderDeclarationSchema, apply, inject, installMemorySpaces, memoryPlugin, name, resolveMemorySpaceProviderEntries };
|
|
3392
|
+
export { Config, MemorySpaceProviderDeclarationSchema, apply, inject, installMemorySpaces, memoryPlugin, name, resolveEmbedding, resolveMemorySpaceProviderEntries, resolvePersistenceStrategy, resolveRecallQuality };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/native-cli.d.ts
|
|
2
|
+
declare function mnemonNpmLauncher(command: string): string | undefined;
|
|
3
|
+
interface CommandDiscoveryOptions {
|
|
4
|
+
platform?: NodeJS.Platform;
|
|
5
|
+
env?: NodeJS.ProcessEnv;
|
|
6
|
+
home?: string;
|
|
7
|
+
isExecutable?: (path: string) => boolean;
|
|
8
|
+
}
|
|
9
|
+
declare function isMnemonExecutable(path: string, platform?: NodeJS.Platform): boolean;
|
|
10
|
+
/** Locate the local Mnemon binary without invoking a shell. */
|
|
11
|
+
declare function findMnemonCommand(config: {
|
|
12
|
+
cliPath?: string | undefined;
|
|
13
|
+
}, options?: CommandDiscoveryOptions): string | undefined;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { CommandDiscoveryOptions, findMnemonCommand, isMnemonExecutable, mnemonNpmLauncher };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { accessSync, constants, existsSync, readFileSync, realpathSync, statSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { dirname, join, posix, win32 } from "node:path";
|
|
4
|
+
//#region src/native-cli.ts
|
|
5
|
+
function manifest(path) {
|
|
6
|
+
try {
|
|
7
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
8
|
+
} catch {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function samePath(left, right) {
|
|
13
|
+
try {
|
|
14
|
+
return realpathSync(left) === realpathSync(right);
|
|
15
|
+
} catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
const MNEMON_NPM_PACKAGE = "@mnemon-dev/mnemon";
|
|
20
|
+
function mnemonNpmLauncher(command) {
|
|
21
|
+
let realCommand = command;
|
|
22
|
+
try {
|
|
23
|
+
realCommand = realpathSync(command);
|
|
24
|
+
} catch {}
|
|
25
|
+
const root = dirname(dirname(realCommand));
|
|
26
|
+
if (manifest(join(root, "package.json"))?.name === MNEMON_NPM_PACKAGE && samePath(realCommand, join(root, "bin/mnemon.js"))) return realCommand;
|
|
27
|
+
if (/\.cmd$/i.test(command)) {
|
|
28
|
+
const launcher = join(dirname(command), "node_modules", MNEMON_NPM_PACKAGE, "bin/mnemon.js");
|
|
29
|
+
try {
|
|
30
|
+
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;
|
|
31
|
+
} catch {}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const UNIX_COMMON_CLI_PATHS = [
|
|
35
|
+
"~/.local/bin/mnemon",
|
|
36
|
+
"/opt/homebrew/bin/mnemon",
|
|
37
|
+
"/usr/local/bin/mnemon",
|
|
38
|
+
"/usr/bin/mnemon"
|
|
39
|
+
];
|
|
40
|
+
function pathApi(platform) {
|
|
41
|
+
return platform === "win32" ? win32 : posix;
|
|
42
|
+
}
|
|
43
|
+
function expandHome(path, home = homedir(), platform = process.platform) {
|
|
44
|
+
if (path === "~") return home;
|
|
45
|
+
return path.startsWith("~/") || path.startsWith("~\\") ? pathApi(platform).join(home, path.slice(2)) : path;
|
|
46
|
+
}
|
|
47
|
+
function envValue(env, name, platform) {
|
|
48
|
+
if (platform !== "win32") return env[name];
|
|
49
|
+
const key = Object.keys(env).find((candidate) => candidate.toLowerCase() === name.toLowerCase());
|
|
50
|
+
return key === void 0 ? void 0 : env[key];
|
|
51
|
+
}
|
|
52
|
+
function isMnemonExecutable(path, platform = process.platform) {
|
|
53
|
+
if (platform === "win32" && win32.extname(path).toLowerCase() !== ".exe" && mnemonNpmLauncher(path) === void 0) return false;
|
|
54
|
+
try {
|
|
55
|
+
accessSync(path, platform === "win32" ? constants.F_OK : constants.X_OK);
|
|
56
|
+
return statSync(path).isFile();
|
|
57
|
+
} catch {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function windowsCommonCliPaths(env, home) {
|
|
62
|
+
const candidates = [];
|
|
63
|
+
const goBin = envValue(env, "GOBIN", "win32")?.trim();
|
|
64
|
+
if (goBin !== void 0 && win32.isAbsolute(goBin)) candidates.push(win32.join(goBin, "mnemon.exe"));
|
|
65
|
+
const goInstallRoot = (envValue(env, "GOPATH", "win32")?.trim())?.split(win32.delimiter).map((candidate) => candidate.trim()).find((candidate) => candidate !== "" && win32.isAbsolute(candidate)) ?? win32.join(home, "go");
|
|
66
|
+
candidates.push(win32.join(goInstallRoot, "bin", "mnemon.exe"));
|
|
67
|
+
const localAppData = envValue(env, "LOCALAPPDATA", "win32")?.trim();
|
|
68
|
+
if (localAppData !== void 0 && win32.isAbsolute(localAppData)) candidates.push(win32.join(localAppData, "Programs", "mnemon", "mnemon.exe"));
|
|
69
|
+
const programFiles = envValue(env, "ProgramFiles", "win32")?.trim();
|
|
70
|
+
if (programFiles !== void 0 && win32.isAbsolute(programFiles)) candidates.push(win32.join(programFiles, "mnemon", "mnemon.exe"));
|
|
71
|
+
return [...new Set(candidates)];
|
|
72
|
+
}
|
|
73
|
+
function commonCliPaths(platform, env, home) {
|
|
74
|
+
if (platform === "win32") return windowsCommonCliPaths(env, home);
|
|
75
|
+
return UNIX_COMMON_CLI_PATHS.map((candidate) => expandHome(candidate, home, platform));
|
|
76
|
+
}
|
|
77
|
+
/** Locate the local Mnemon binary without invoking a shell. */
|
|
78
|
+
function findMnemonCommand(config, options = {}) {
|
|
79
|
+
const platform = options.platform ?? process.platform;
|
|
80
|
+
const env = options.env ?? process.env;
|
|
81
|
+
const home = options.home ?? homedir();
|
|
82
|
+
const isExecutable = options.isExecutable ?? ((path) => isMnemonExecutable(path, platform));
|
|
83
|
+
const paths = pathApi(platform);
|
|
84
|
+
const resolveCommand = (command) => {
|
|
85
|
+
const expanded = expandHome(command, home, platform);
|
|
86
|
+
if (expanded.includes("/") || expanded.includes("\\")) return expanded;
|
|
87
|
+
const names = platform === "win32" && paths.extname(expanded) === "" ? [`${expanded}.exe`, `${expanded}.cmd`] : [expanded];
|
|
88
|
+
for (const directory of (envValue(env, "PATH", platform) ?? "").split(paths.delimiter)) {
|
|
89
|
+
if (directory === "") continue;
|
|
90
|
+
for (const name of names) {
|
|
91
|
+
const path = paths.join(directory, name);
|
|
92
|
+
if (/\.cmd$/i.test(name) && mnemonNpmLauncher(path) === void 0) continue;
|
|
93
|
+
if (isExecutable(path)) return path;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
if (config.cliPath !== void 0) return resolveCommand(config.cliPath);
|
|
98
|
+
const envPath = envValue(env, "MNEMON_CLI_PATH", platform)?.trim();
|
|
99
|
+
if (envPath !== void 0 && envPath !== "") {
|
|
100
|
+
const path = resolveCommand(envPath);
|
|
101
|
+
if (path !== void 0 && isExecutable(path)) return path;
|
|
102
|
+
}
|
|
103
|
+
const fromPath = resolveCommand("mnemon");
|
|
104
|
+
if (fromPath !== void 0) return fromPath;
|
|
105
|
+
for (const path of commonCliPaths(platform, env, home)) if (isExecutable(path)) return path;
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
108
|
+
export { findMnemonCommand, isMnemonExecutable, mnemonNpmLauncher };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type MnemonKey } from 'dsh-mnemon/client';
|
|
2
|
+
import type labels from 'dsh-mnemon-source-memory-spaces/presentation/locales.json';
|
|
3
|
+
export type SourceKey = keyof typeof labels.zh;
|
|
4
|
+
export declare const css: Readonly<Record<string, string>>;
|
|
5
|
+
export declare const sidebarCss: Readonly<Record<string, string>>;
|
|
6
|
+
export declare function useT(): (key: SourceKey | MnemonKey, params?: Record<string, unknown>) => string;
|
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.3",
|
|
4
4
|
"description": "Memory Spaces Source and its private Provider SDK.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -28,11 +28,19 @@
|
|
|
28
28
|
"./contracts": {
|
|
29
29
|
"types": "./lib/contracts.d.ts",
|
|
30
30
|
"default": "./lib/contracts.js"
|
|
31
|
+
},
|
|
32
|
+
"./presentation/locales.json": "./presentation/locales.json",
|
|
33
|
+
"./presentation/page.module.css": "./presentation/page.module.css",
|
|
34
|
+
"./presentation/sidebar.module.css": "./presentation/sidebar.module.css",
|
|
35
|
+
"./native-cli": {
|
|
36
|
+
"types": "./lib/native-cli.d.ts",
|
|
37
|
+
"default": "./lib/native-cli.js"
|
|
31
38
|
}
|
|
32
39
|
},
|
|
33
40
|
"files": [
|
|
34
41
|
"lib",
|
|
35
|
-
"README.md"
|
|
42
|
+
"README.md",
|
|
43
|
+
"presentation"
|
|
36
44
|
],
|
|
37
45
|
"scripts": {
|
|
38
46
|
"typecheck": "tsc --noEmit",
|
|
@@ -45,7 +53,7 @@
|
|
|
45
53
|
},
|
|
46
54
|
"peerDependencies": {
|
|
47
55
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
48
|
-
"dsh-mnemon": "0.5.1",
|
|
56
|
+
"dsh-mnemon": "^0.5.1",
|
|
49
57
|
"react": "^18.2.0"
|
|
50
58
|
},
|
|
51
59
|
"devDependencies": {
|
|
@@ -54,22 +62,23 @@
|
|
|
54
62
|
"@types/node": "^22.0.0",
|
|
55
63
|
"@types/react": "^18.3.0",
|
|
56
64
|
"@types/react-dom": "^18.3.0",
|
|
57
|
-
"dsh-mnemon": "0.5.
|
|
58
|
-
"dsh-mnemon-provider-byterover": "0.5.
|
|
59
|
-
"dsh-mnemon-provider-hindsight": "0.5.
|
|
60
|
-
"dsh-mnemon-provider-holographic": "0.5.
|
|
61
|
-
"dsh-mnemon-provider-honcho": "0.5.
|
|
62
|
-
"dsh-mnemon-provider-mem0": "0.5.
|
|
63
|
-
"dsh-mnemon-provider-mnemon-native": "0.5.
|
|
64
|
-
"dsh-mnemon-provider-openviking": "0.5.
|
|
65
|
-
"dsh-mnemon-provider-retaindb": "0.5.
|
|
66
|
-
"dsh-mnemon-provider-supermemory": "0.5.
|
|
65
|
+
"dsh-mnemon": "^0.5.3",
|
|
66
|
+
"dsh-mnemon-provider-byterover": "^0.5.3",
|
|
67
|
+
"dsh-mnemon-provider-hindsight": "^0.5.3",
|
|
68
|
+
"dsh-mnemon-provider-holographic": "^0.5.3",
|
|
69
|
+
"dsh-mnemon-provider-honcho": "^0.5.3",
|
|
70
|
+
"dsh-mnemon-provider-mem0": "^0.5.3",
|
|
71
|
+
"dsh-mnemon-provider-mnemon-native": "^0.5.3",
|
|
72
|
+
"dsh-mnemon-provider-openviking": "^0.5.3",
|
|
73
|
+
"dsh-mnemon-provider-retaindb": "^0.5.3",
|
|
74
|
+
"dsh-mnemon-provider-supermemory": "^0.5.3",
|
|
67
75
|
"jsdom": "^26.0.0",
|
|
68
76
|
"react": "^18.2.0",
|
|
69
77
|
"react-dom": "^18.2.0",
|
|
70
78
|
"tsdown": "^0.22.0",
|
|
71
79
|
"typescript": "^5.9.0",
|
|
72
|
-
"vitest": "^3.2.0"
|
|
80
|
+
"vitest": "^3.2.0",
|
|
81
|
+
"lightningcss": "^1.33.0"
|
|
73
82
|
},
|
|
74
83
|
"peerDependenciesMeta": {
|
|
75
84
|
"react": {
|