dsh-mnemon 0.5.4 → 0.5.5
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 +3 -3
- package/README.zh-CN.md +3 -3
- package/lib/client.js +53 -3
- package/lib/index.js +250 -10
- package/lib/testing.js +1 -1
- package/lib/types/src/host/protocol.d.ts +10 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
19
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/guides/ui-guide.md">
|
|
20
|
-
<img src="https://raw.githubusercontent.com/omdsh-dev/dsh-mnemon/main/docs/assets/
|
|
20
|
+
<img src="https://raw.githubusercontent.com/omdsh-dev/dsh-mnemon/main/docs/assets/webui-v0.5.4/en/spaces.jpg" alt="Memory Spaces in the Light DSH Sidebar after importing a Mnemon Pack" width="1180" />
|
|
21
21
|
</a>
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
25
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/guides/getting-started.md"><strong>Get started</strong></a> ·
|
|
26
|
-
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/
|
|
26
|
+
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/assets/webui-v0.5.4/en/demo.mp4">Watch the v0.5.4 Light demo</a> ·
|
|
27
27
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/development/extensions.md">Build a plugin</a> ·
|
|
28
28
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/README.md">Documentation</a>
|
|
29
29
|
</p>
|
|
@@ -119,4 +119,4 @@ pnpm verify
|
|
|
119
119
|
pnpm verify:plugins
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
Use Node.js `^22.19.0 || >=24.0.0` and pnpm 10.13.1. Package-level checks run independently; WebUI captures use disposable data and a real DSH Host. Tests of mechanics are not claims of LLM accuracy or live cloud-Provider conformance. [Development](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/development/README.md) · [Media provenance](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/assets/
|
|
122
|
+
Use Node.js `^22.19.0 || >=24.0.0` and pnpm 10.13.1. Package-level checks run independently; WebUI captures use disposable data and a real DSH Host. Tests of mechanics are not claims of LLM accuracy or live cloud-Provider conformance. [Development](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/en/development/README.md) · [Media provenance](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/assets/webui-v0.5.4/README.md).
|
package/README.zh-CN.md
CHANGED
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
<p align="center">
|
|
19
19
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/guides/ui-guide.md">
|
|
20
|
-
<img src="https://raw.githubusercontent.com/omdsh-dev/dsh-mnemon/main/docs/assets/
|
|
20
|
+
<img src="https://raw.githubusercontent.com/omdsh-dev/dsh-mnemon/main/docs/assets/webui-v0.5.4/zh-CN/spaces.jpg" alt="导入 Mnemon Pack 后的浅色 DSH 记忆空间界面" width="1180" />
|
|
21
21
|
</a>
|
|
22
22
|
</p>
|
|
23
23
|
|
|
24
24
|
<p align="center">
|
|
25
25
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/guides/getting-started.md"><strong>快速开始</strong></a> ·
|
|
26
|
-
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/
|
|
26
|
+
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/assets/webui-v0.5.4/zh-CN/demo.mp4">观看 v0.5.4 浅色演示(中文界面)</a> ·
|
|
27
27
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/development/extensions.md">制作插件</a> ·
|
|
28
28
|
<a href="https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/README.md">文档中心</a>
|
|
29
29
|
</p>
|
|
@@ -119,4 +119,4 @@ pnpm verify
|
|
|
119
119
|
pnpm verify:plugins
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
使用 Node.js `^22.19.0 || >=24.0.0` 与 pnpm 10.13.1。各包可以独立验证;WebUI 素材来自临时数据和真实 DSH Host。机制测试不等于 LLM 准确度或真实云 Provider 一致性验证。[开发指南](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/development/README.md) · [素材来源](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/assets/
|
|
122
|
+
使用 Node.js `^22.19.0 || >=24.0.0` 与 pnpm 10.13.1。各包可以独立验证;WebUI 素材来自临时数据和真实 DSH Host。机制测试不等于 LLM 准确度或真实云 Provider 一致性验证。[开发指南](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/zh-CN/development/README.md) · [素材来源](https://github.com/omdsh-dev/dsh-mnemon/blob/main/docs/assets/webui-v0.5.4/README.md)。
|
package/lib/client.js
CHANGED
|
@@ -30,6 +30,16 @@ window.__ModuleLoader__.load({
|
|
|
30
30
|
const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
|
|
31
31
|
const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack";
|
|
32
32
|
const MNEMON_SETTINGS_CHANNEL = "/dsh-mnemon-settings";
|
|
33
|
+
/** DSH API Gateway endpoints used by paired remote Web clients. */
|
|
34
|
+
const MNEMON_REMOTE_CHANNEL = "/api";
|
|
35
|
+
const MNEMON_REMOTE_NAMESPACE = "dshMnemon";
|
|
36
|
+
const MNEMON_REMOTE_READ_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/read`;
|
|
37
|
+
const MNEMON_REMOTE_ACTIVATION_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/activation`;
|
|
38
|
+
const MNEMON_REMOTE_WRITE_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/write`;
|
|
39
|
+
const MNEMON_REMOTE_PACK_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/pack`;
|
|
40
|
+
const MNEMON_REMOTE_SETTINGS_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/settings`;
|
|
41
|
+
const MNEMON_REMOTE_VIEW_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/view`;
|
|
42
|
+
const MNEMON_REMOTE_VIEW_WRITE_ENDPOINT = `${MNEMON_REMOTE_NAMESPACE}/viewWrite`;
|
|
33
43
|
const MNEMON_SETTINGS_NAMESPACE = "mnemon";
|
|
34
44
|
const MNEMON_UI_SETTINGS_NAMESPACE = "mnemon-ui";
|
|
35
45
|
const DEFAULT_EMBEDDING_ENDPOINT = "http://localhost:11434";
|
|
@@ -40,6 +50,46 @@ window.__ModuleLoader__.load({
|
|
|
40
50
|
"openai"
|
|
41
51
|
];
|
|
42
52
|
//#endregion
|
|
53
|
+
//#region src/client/remote-rpc.ts
|
|
54
|
+
const REMOTE_ENDPOINT = /* @__PURE__ */ new Map([
|
|
55
|
+
[MNEMON_READ_CHANNEL, MNEMON_REMOTE_READ_ENDPOINT],
|
|
56
|
+
[MNEMON_ACTIVATION_CHANNEL, MNEMON_REMOTE_ACTIVATION_ENDPOINT],
|
|
57
|
+
[MNEMON_WRITE_CHANNEL, MNEMON_REMOTE_WRITE_ENDPOINT],
|
|
58
|
+
[MNEMON_PACK_CHANNEL, MNEMON_REMOTE_PACK_ENDPOINT],
|
|
59
|
+
[MNEMON_SETTINGS_CHANNEL, MNEMON_REMOTE_SETTINGS_ENDPOINT],
|
|
60
|
+
[MNEMON_VIEW_CHANNEL, MNEMON_REMOTE_VIEW_ENDPOINT],
|
|
61
|
+
[MNEMON_VIEW_WRITE_CHANNEL, MNEMON_REMOTE_VIEW_WRITE_ENDPOINT]
|
|
62
|
+
]);
|
|
63
|
+
function isClientRpcResult(value) {
|
|
64
|
+
if (typeof value !== "object" || value === null || !Object.hasOwn(value, "ok")) return false;
|
|
65
|
+
const candidate = value;
|
|
66
|
+
if (candidate.ok === true) return Object.hasOwn(candidate, "value");
|
|
67
|
+
if (candidate.ok !== false || typeof candidate.error !== "object" || candidate.error === null) return false;
|
|
68
|
+
return typeof candidate.error.message === "string";
|
|
69
|
+
}
|
|
70
|
+
function isLoopbackHostname(hostname) {
|
|
71
|
+
if (hostname === "localhost" || hostname === "[::1]") return true;
|
|
72
|
+
const parts = hostname.split(".");
|
|
73
|
+
return parts.length === 4 && parts[0] === "127" && parts.every((part) => /^\d{1,3}$/.test(part) && Number(part) <= 255);
|
|
74
|
+
}
|
|
75
|
+
function isRemoteConnection(connection) {
|
|
76
|
+
const hostname = globalThis.location?.hostname;
|
|
77
|
+
return typeof hostname === "string" && hostname !== "" && !isLoopbackHostname(hostname) || connection.isLoopback === false;
|
|
78
|
+
}
|
|
79
|
+
/** Route only paired remote pages through API Gateway; local clients retain legacy channels. */
|
|
80
|
+
async function callMnemonRpc(connection, channel, endpoint, payload, signal) {
|
|
81
|
+
const remoteEndpoint = REMOTE_ENDPOINT.get(channel);
|
|
82
|
+
if (!isRemoteConnection(connection) || remoteEndpoint === void 0) return signal === void 0 ? connection.rpc.call(channel, endpoint, payload) : connection.rpc.call(channel, endpoint, payload, signal);
|
|
83
|
+
const remotePayload = { args: {
|
|
84
|
+
endpoint,
|
|
85
|
+
payload
|
|
86
|
+
} };
|
|
87
|
+
const response = await (signal === void 0 ? connection.rpc.call(MNEMON_REMOTE_CHANNEL, remoteEndpoint, remotePayload) : connection.rpc.call(MNEMON_REMOTE_CHANNEL, remoteEndpoint, remotePayload, signal));
|
|
88
|
+
if (!response.ok) return response;
|
|
89
|
+
if (!isClientRpcResult(response.value)) throw new Error("DSH API Gateway returned an invalid Mnemon response");
|
|
90
|
+
return response.value;
|
|
91
|
+
}
|
|
92
|
+
//#endregion
|
|
43
93
|
//#region src/client/api.ts
|
|
44
94
|
const turnActivityCache = /* @__PURE__ */ new WeakMap();
|
|
45
95
|
async function loadTurnActivities(connection, sessionId, requiredCursor) {
|
|
@@ -65,7 +115,7 @@ window.__ModuleLoader__.load({
|
|
|
65
115
|
const snapshot = await entry.inFlight;
|
|
66
116
|
return snapshot.cursor >= requiredCursor ? snapshot : loadTurnActivities(connection, sessionId, requiredCursor);
|
|
67
117
|
}
|
|
68
|
-
const request = connection
|
|
118
|
+
const request = callMnemonRpc(connection, MNEMON_READ_CHANNEL, "turn-activities", sessionId === void 0 ? {} : { sessionId }).then((response) => {
|
|
69
119
|
if (!response.ok) throw new Error(response.error.message);
|
|
70
120
|
const snapshot = response.value;
|
|
71
121
|
entry.cursor = snapshot.cursor;
|
|
@@ -87,7 +137,7 @@ window.__ModuleLoader__.load({
|
|
|
87
137
|
this.workspaceId = workspaceId;
|
|
88
138
|
}
|
|
89
139
|
async call(channel, endpoint, payload) {
|
|
90
|
-
const response = await this.connection
|
|
140
|
+
const response = await callMnemonRpc(this.connection, channel, endpoint, payload);
|
|
91
141
|
if (!response.ok) throw new Error(response.error.message);
|
|
92
142
|
return response.value;
|
|
93
143
|
}
|
|
@@ -4960,7 +5010,7 @@ window.__ModuleLoader__.load({
|
|
|
4960
5010
|
const controller = new AbortController();
|
|
4961
5011
|
const timeout = setTimeout(() => controller.abort(), Math.max(1, this.requestTimeoutMs));
|
|
4962
5012
|
try {
|
|
4963
|
-
return await this.connection
|
|
5013
|
+
return await callMnemonRpc(this.connection, MNEMON_SETTINGS_CHANNEL, endpoint, payload, controller.signal);
|
|
4964
5014
|
} catch (error) {
|
|
4965
5015
|
if (controller.signal.aborted) throw new Error("Mnemon settings request timed out");
|
|
4966
5016
|
throw error;
|
package/lib/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { i as withMemoryStorageLock, n as memoryStrategyConfigurationValues, r a
|
|
|
2
2
|
import { a as prepareMemoryContributions, i as validateMemoryPluginGraph, n as MemoryCompositionGeneration, r as captureMemoryContributionSnapshot, t as provideMemoryRuntime } from "./runtime-AtIOTeP1.js";
|
|
3
3
|
import { DEFAULT_MEMORY_VIEW_BUDGET, MEMORY_CAPABILITIES } from "./contracts.js";
|
|
4
4
|
import { r as defineMemoryPlugin, t as canonicalMemoryJson } from "./definitions-j0FLgE0-.js";
|
|
5
|
+
import { Context } from "@deepseek-ai/cordis";
|
|
5
6
|
import z from "schemastery";
|
|
6
7
|
import { basename, delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
|
|
7
8
|
import { resolveEmbedding, resolvePersistenceStrategy, resolveRecallQuality } from "dsh-mnemon-source-memory-spaces";
|
|
@@ -15,6 +16,7 @@ import { fileURLToPath } from "node:url";
|
|
|
15
16
|
import { findMnemonCommand, mnemonNpmLauncher } from "dsh-mnemon-source-memory-spaces/native-cli";
|
|
16
17
|
import { spawn } from "node:child_process";
|
|
17
18
|
import { z as z$1 } from "zod";
|
|
19
|
+
import { Remote, TypertRemoteService } from "@deepseek-ai/dsh-typert-protocol";
|
|
18
20
|
//#region src/host/display-mode.ts
|
|
19
21
|
/** Keep the historical misspelling at input boundaries, never in UI or runtime state. */
|
|
20
22
|
function normalizeDisplayMode(value) {
|
|
@@ -38,6 +40,7 @@ const MNEMON_ACTIVATION_CHANNEL = "/dsh-mnemon-activation";
|
|
|
38
40
|
const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
|
|
39
41
|
const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack";
|
|
40
42
|
const MNEMON_SETTINGS_CHANNEL = "/dsh-mnemon-settings";
|
|
43
|
+
const MNEMON_REMOTE_NAMESPACE = "dshMnemon";
|
|
41
44
|
const MNEMON_SETTINGS_NAMESPACE = "mnemon";
|
|
42
45
|
const CATEGORIES = [
|
|
43
46
|
"preference",
|
|
@@ -6508,10 +6511,20 @@ function createPackHandler(input) {
|
|
|
6508
6511
|
}
|
|
6509
6512
|
function registerRpc(connection, input, lifecycle, versions, managementAuthority = "loopback") {
|
|
6510
6513
|
const versionManager = versions ?? new VersionUpdateManager({ mnemonCliPath: () => input.config.cliPath });
|
|
6511
|
-
|
|
6512
|
-
|
|
6513
|
-
|
|
6514
|
-
|
|
6514
|
+
const readHandler = createReadHandler(input, lifecycle, versionManager);
|
|
6515
|
+
const activationHandler = createActivationHandler(input);
|
|
6516
|
+
const writeHandler = createWriteHandler(input, lifecycle, versionManager);
|
|
6517
|
+
const packHandler = createPackHandler(input);
|
|
6518
|
+
connection.rpc.handle(MNEMON_READ_CHANNEL, readHandler, { authority: "trusted-host" });
|
|
6519
|
+
connection.rpc.handle(MNEMON_ACTIVATION_CHANNEL, activationHandler, { authority: "trusted-host" });
|
|
6520
|
+
connection.rpc.handle(MNEMON_WRITE_CHANNEL, writeHandler, { authority: managementAuthority });
|
|
6521
|
+
connection.rpc.handle(MNEMON_PACK_CHANNEL, packHandler, { authority: managementAuthority });
|
|
6522
|
+
return {
|
|
6523
|
+
read: readHandler,
|
|
6524
|
+
activation: activationHandler,
|
|
6525
|
+
write: writeHandler,
|
|
6526
|
+
pack: packHandler
|
|
6527
|
+
};
|
|
6515
6528
|
}
|
|
6516
6529
|
//#endregion
|
|
6517
6530
|
//#region src/host/settings.ts
|
|
@@ -6660,7 +6673,9 @@ function createSettingsHandler(settings) {
|
|
|
6660
6673
|
};
|
|
6661
6674
|
}
|
|
6662
6675
|
function registerSettingsRpc(connection, settings, authority = "loopback") {
|
|
6663
|
-
|
|
6676
|
+
const handler = createSettingsHandler(settings);
|
|
6677
|
+
connection.rpc.handle(MNEMON_SETTINGS_CHANNEL, handler, { authority });
|
|
6678
|
+
return handler;
|
|
6664
6679
|
}
|
|
6665
6680
|
//#endregion
|
|
6666
6681
|
//#region src/host/tools.ts
|
|
@@ -8243,8 +8258,14 @@ function createViewHandler(runtime, engine, management, access, lifecycle, insta
|
|
|
8243
8258
|
};
|
|
8244
8259
|
}
|
|
8245
8260
|
function registerViewRpc(connection, runtime, engine, management, lifecycle, authority, installation) {
|
|
8246
|
-
|
|
8247
|
-
|
|
8261
|
+
const readHandler = createViewHandler(runtime, engine, management, "read", lifecycle, installation);
|
|
8262
|
+
const writeHandler = createViewHandler(runtime, engine, management, "write", lifecycle, installation);
|
|
8263
|
+
connection.rpc.handle(MNEMON_VIEW_CHANNEL, readHandler, { authority: "trusted-host" });
|
|
8264
|
+
connection.rpc.handle(MNEMON_VIEW_WRITE_CHANNEL, writeHandler, { authority });
|
|
8265
|
+
return {
|
|
8266
|
+
read: readHandler,
|
|
8267
|
+
write: writeHandler
|
|
8268
|
+
};
|
|
8248
8269
|
}
|
|
8249
8270
|
//#endregion
|
|
8250
8271
|
//#region src/host/plugin-installation.ts
|
|
@@ -8461,6 +8482,218 @@ var MemoryPluginInstallation = class {
|
|
|
8461
8482
|
}
|
|
8462
8483
|
};
|
|
8463
8484
|
//#endregion
|
|
8485
|
+
//#region src/host/remote-rpc.ts
|
|
8486
|
+
var __runInitializers = function(thisArg, initializers, value) {
|
|
8487
|
+
var useValue = arguments.length > 2;
|
|
8488
|
+
for (var i = 0; i < initializers.length; i++) value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
8489
|
+
return useValue ? value : void 0;
|
|
8490
|
+
};
|
|
8491
|
+
var __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
8492
|
+
function accept(f) {
|
|
8493
|
+
if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected");
|
|
8494
|
+
return f;
|
|
8495
|
+
}
|
|
8496
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
8497
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
8498
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
8499
|
+
var _, done = false;
|
|
8500
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
8501
|
+
var context = {};
|
|
8502
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
8503
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
8504
|
+
context.addInitializer = function(f) {
|
|
8505
|
+
if (done) throw new TypeError("Cannot add initializers after decoration has completed");
|
|
8506
|
+
extraInitializers.push(accept(f || null));
|
|
8507
|
+
};
|
|
8508
|
+
var result = (0, decorators[i])(kind === "accessor" ? {
|
|
8509
|
+
get: descriptor.get,
|
|
8510
|
+
set: descriptor.set
|
|
8511
|
+
} : descriptor[key], context);
|
|
8512
|
+
if (kind === "accessor") {
|
|
8513
|
+
if (result === void 0) continue;
|
|
8514
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
8515
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
8516
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
8517
|
+
if (_ = accept(result.init)) initializers.unshift(_);
|
|
8518
|
+
} else if (_ = accept(result)) {
|
|
8519
|
+
if (kind === "field") initializers.unshift(_);
|
|
8520
|
+
else descriptor[key] = _;
|
|
8521
|
+
}
|
|
8522
|
+
}
|
|
8523
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
8524
|
+
done = true;
|
|
8525
|
+
};
|
|
8526
|
+
function denied() {
|
|
8527
|
+
return {
|
|
8528
|
+
ok: false,
|
|
8529
|
+
error: {
|
|
8530
|
+
code: "bad-request",
|
|
8531
|
+
message: "remote Mnemon management requires remoteAccess: trusted-host",
|
|
8532
|
+
details: { issues: [] }
|
|
8533
|
+
}
|
|
8534
|
+
};
|
|
8535
|
+
}
|
|
8536
|
+
function unknownSettingsEndpoint(endpoint) {
|
|
8537
|
+
return {
|
|
8538
|
+
ok: false,
|
|
8539
|
+
error: {
|
|
8540
|
+
code: "bad-request",
|
|
8541
|
+
message: `unknown remote Mnemon settings endpoint: ${endpoint}`,
|
|
8542
|
+
details: { issues: [] }
|
|
8543
|
+
}
|
|
8544
|
+
};
|
|
8545
|
+
}
|
|
8546
|
+
/**
|
|
8547
|
+
* Project Mnemon's existing handlers through DSH API Gateway. The Gateway owns
|
|
8548
|
+
* `/api`, Host/Origin validation, browser pairing, and response envelopes;
|
|
8549
|
+
* this Service retains Mnemon's narrower management grant.
|
|
8550
|
+
*/
|
|
8551
|
+
let MnemonRemoteService = (() => {
|
|
8552
|
+
let _classSuper = TypertRemoteService;
|
|
8553
|
+
let _instanceExtraInitializers = [];
|
|
8554
|
+
let _read_decorators;
|
|
8555
|
+
let _activation_decorators;
|
|
8556
|
+
let _write_decorators;
|
|
8557
|
+
let _pack_decorators;
|
|
8558
|
+
let _settings_decorators;
|
|
8559
|
+
let _view_decorators;
|
|
8560
|
+
let _viewWrite_decorators;
|
|
8561
|
+
return class MnemonRemoteService extends _classSuper {
|
|
8562
|
+
static {
|
|
8563
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
8564
|
+
_read_decorators = [Remote("read")];
|
|
8565
|
+
_activation_decorators = [Remote("activation")];
|
|
8566
|
+
_write_decorators = [Remote("write")];
|
|
8567
|
+
_pack_decorators = [Remote("pack")];
|
|
8568
|
+
_settings_decorators = [Remote("settings")];
|
|
8569
|
+
_view_decorators = [Remote("view")];
|
|
8570
|
+
_viewWrite_decorators = [Remote("viewWrite")];
|
|
8571
|
+
__esDecorate(this, null, _read_decorators, {
|
|
8572
|
+
kind: "method",
|
|
8573
|
+
name: "read",
|
|
8574
|
+
static: false,
|
|
8575
|
+
private: false,
|
|
8576
|
+
access: {
|
|
8577
|
+
has: (obj) => "read" in obj,
|
|
8578
|
+
get: (obj) => obj.read
|
|
8579
|
+
},
|
|
8580
|
+
metadata: _metadata
|
|
8581
|
+
}, null, _instanceExtraInitializers);
|
|
8582
|
+
__esDecorate(this, null, _activation_decorators, {
|
|
8583
|
+
kind: "method",
|
|
8584
|
+
name: "activation",
|
|
8585
|
+
static: false,
|
|
8586
|
+
private: false,
|
|
8587
|
+
access: {
|
|
8588
|
+
has: (obj) => "activation" in obj,
|
|
8589
|
+
get: (obj) => obj.activation
|
|
8590
|
+
},
|
|
8591
|
+
metadata: _metadata
|
|
8592
|
+
}, null, _instanceExtraInitializers);
|
|
8593
|
+
__esDecorate(this, null, _write_decorators, {
|
|
8594
|
+
kind: "method",
|
|
8595
|
+
name: "write",
|
|
8596
|
+
static: false,
|
|
8597
|
+
private: false,
|
|
8598
|
+
access: {
|
|
8599
|
+
has: (obj) => "write" in obj,
|
|
8600
|
+
get: (obj) => obj.write
|
|
8601
|
+
},
|
|
8602
|
+
metadata: _metadata
|
|
8603
|
+
}, null, _instanceExtraInitializers);
|
|
8604
|
+
__esDecorate(this, null, _pack_decorators, {
|
|
8605
|
+
kind: "method",
|
|
8606
|
+
name: "pack",
|
|
8607
|
+
static: false,
|
|
8608
|
+
private: false,
|
|
8609
|
+
access: {
|
|
8610
|
+
has: (obj) => "pack" in obj,
|
|
8611
|
+
get: (obj) => obj.pack
|
|
8612
|
+
},
|
|
8613
|
+
metadata: _metadata
|
|
8614
|
+
}, null, _instanceExtraInitializers);
|
|
8615
|
+
__esDecorate(this, null, _settings_decorators, {
|
|
8616
|
+
kind: "method",
|
|
8617
|
+
name: "settings",
|
|
8618
|
+
static: false,
|
|
8619
|
+
private: false,
|
|
8620
|
+
access: {
|
|
8621
|
+
has: (obj) => "settings" in obj,
|
|
8622
|
+
get: (obj) => obj.settings
|
|
8623
|
+
},
|
|
8624
|
+
metadata: _metadata
|
|
8625
|
+
}, null, _instanceExtraInitializers);
|
|
8626
|
+
__esDecorate(this, null, _view_decorators, {
|
|
8627
|
+
kind: "method",
|
|
8628
|
+
name: "view",
|
|
8629
|
+
static: false,
|
|
8630
|
+
private: false,
|
|
8631
|
+
access: {
|
|
8632
|
+
has: (obj) => "view" in obj,
|
|
8633
|
+
get: (obj) => obj.view
|
|
8634
|
+
},
|
|
8635
|
+
metadata: _metadata
|
|
8636
|
+
}, null, _instanceExtraInitializers);
|
|
8637
|
+
__esDecorate(this, null, _viewWrite_decorators, {
|
|
8638
|
+
kind: "method",
|
|
8639
|
+
name: "viewWrite",
|
|
8640
|
+
static: false,
|
|
8641
|
+
private: false,
|
|
8642
|
+
access: {
|
|
8643
|
+
has: (obj) => "viewWrite" in obj,
|
|
8644
|
+
get: (obj) => obj.viewWrite
|
|
8645
|
+
},
|
|
8646
|
+
metadata: _metadata
|
|
8647
|
+
}, null, _instanceExtraInitializers);
|
|
8648
|
+
if (_metadata) Object.defineProperty(this, Symbol.metadata, {
|
|
8649
|
+
enumerable: true,
|
|
8650
|
+
configurable: true,
|
|
8651
|
+
writable: true,
|
|
8652
|
+
value: _metadata
|
|
8653
|
+
});
|
|
8654
|
+
}
|
|
8655
|
+
handlers = __runInitializers(this, _instanceExtraInitializers);
|
|
8656
|
+
constructor(ctx, handlers) {
|
|
8657
|
+
super(ctx, "mnemonRemote", { namespace: MNEMON_REMOTE_NAMESPACE });
|
|
8658
|
+
this.handlers = handlers;
|
|
8659
|
+
}
|
|
8660
|
+
read(endpoint, payload, signal) {
|
|
8661
|
+
return this.handlers.read(endpoint, payload, signal);
|
|
8662
|
+
}
|
|
8663
|
+
activation(endpoint, payload, signal) {
|
|
8664
|
+
return this.handlers.activation(endpoint, payload, signal);
|
|
8665
|
+
}
|
|
8666
|
+
write(endpoint, payload, signal) {
|
|
8667
|
+
if (!this.handlers.management) return Promise.resolve(denied());
|
|
8668
|
+
return this.handlers.write(endpoint, payload, signal);
|
|
8669
|
+
}
|
|
8670
|
+
pack(endpoint, payload, signal) {
|
|
8671
|
+
if (!this.handlers.management) return Promise.resolve(denied());
|
|
8672
|
+
return this.handlers.pack(endpoint, payload, signal);
|
|
8673
|
+
}
|
|
8674
|
+
async settings(endpoint, payload, signal) {
|
|
8675
|
+
if (endpoint === "mutate" && !this.handlers.management) return denied();
|
|
8676
|
+
if (endpoint !== "get" && endpoint !== "mutate") return unknownSettingsEndpoint(endpoint);
|
|
8677
|
+
const response = await this.handlers.settings(endpoint, payload, signal);
|
|
8678
|
+
if (endpoint !== "get" || this.handlers.management || !response.ok || typeof response.value !== "object" || response.value === null || Array.isArray(response.value)) return response;
|
|
8679
|
+
return {
|
|
8680
|
+
...response,
|
|
8681
|
+
value: {
|
|
8682
|
+
...response.value,
|
|
8683
|
+
writable: false
|
|
8684
|
+
}
|
|
8685
|
+
};
|
|
8686
|
+
}
|
|
8687
|
+
view(endpoint, payload, signal) {
|
|
8688
|
+
return this.handlers.view(endpoint, payload, signal);
|
|
8689
|
+
}
|
|
8690
|
+
viewWrite(endpoint, payload, signal) {
|
|
8691
|
+
if (!this.handlers.management) return Promise.resolve(denied());
|
|
8692
|
+
return this.handlers.viewWrite(endpoint, payload, signal);
|
|
8693
|
+
}
|
|
8694
|
+
};
|
|
8695
|
+
})();
|
|
8696
|
+
//#endregion
|
|
8464
8697
|
//#region src/host/plugin.ts
|
|
8465
8698
|
const name = "dsh-mnemon";
|
|
8466
8699
|
const provide = ["mnemonMemory"];
|
|
@@ -8573,9 +8806,16 @@ function apply(rawContext, config = {}) {
|
|
|
8573
8806
|
ctx.inject(["connection"], (webContext) => {
|
|
8574
8807
|
if (webContext.connection === void 0) return;
|
|
8575
8808
|
const managementAuthority = resolved.remoteAccess === "trusted-host" ? "trusted-host" : "loopback";
|
|
8576
|
-
registerRpc(webContext.connection, runtime, lifecycle, void 0, managementAuthority);
|
|
8577
|
-
registerSettingsRpc(webContext.connection, ctx.settings, managementAuthority);
|
|
8578
|
-
registerViewRpc(webContext.connection, runtime, extensions, memoryPlugins, lifecycle, managementAuthority, pluginInstallation);
|
|
8809
|
+
const rpc = registerRpc(webContext.connection, runtime, lifecycle, void 0, managementAuthority);
|
|
8810
|
+
const settings = registerSettingsRpc(webContext.connection, ctx.settings, managementAuthority);
|
|
8811
|
+
const view = registerViewRpc(webContext.connection, runtime, extensions, memoryPlugins, lifecycle, managementAuthority, pluginInstallation);
|
|
8812
|
+
if (Context.is(webContext)) new MnemonRemoteService(webContext, {
|
|
8813
|
+
...rpc,
|
|
8814
|
+
settings,
|
|
8815
|
+
view: view.read,
|
|
8816
|
+
viewWrite: view.write,
|
|
8817
|
+
management: managementAuthority === "trusted-host"
|
|
8818
|
+
});
|
|
8579
8819
|
});
|
|
8580
8820
|
}
|
|
8581
8821
|
//#endregion
|
package/lib/testing.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { t as provideMemoryRuntime } from "./runtime-AtIOTeP1.js";
|
|
2
2
|
import { DEFAULT_MEMORY_VIEW_BUDGET } from "./contracts.js";
|
|
3
3
|
import { c as jsonClone } from "./definitions-j0FLgE0-.js";
|
|
4
|
-
import { readFileSync } from "node:fs";
|
|
5
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
5
|
+
import { readFileSync } from "node:fs";
|
|
6
6
|
//#region src/sdk/testing.ts
|
|
7
7
|
/**
|
|
8
8
|
* A test fixture, not a production service or a second Loader. It mounts real
|
|
@@ -24,6 +24,16 @@ export declare const MNEMON_ACTIVATION_CHANNEL = "/dsh-mnemon-activation";
|
|
|
24
24
|
export declare const MNEMON_WRITE_CHANNEL = "/dsh-mnemon-write";
|
|
25
25
|
export declare const MNEMON_PACK_CHANNEL = "/dsh-mnemon-pack";
|
|
26
26
|
export declare const MNEMON_SETTINGS_CHANNEL = "/dsh-mnemon-settings";
|
|
27
|
+
/** DSH API Gateway endpoints used by paired remote Web clients. */
|
|
28
|
+
export declare const MNEMON_REMOTE_CHANNEL = "/api";
|
|
29
|
+
export declare const MNEMON_REMOTE_NAMESPACE = "dshMnemon";
|
|
30
|
+
export declare const MNEMON_REMOTE_READ_ENDPOINT = "dshMnemon/read";
|
|
31
|
+
export declare const MNEMON_REMOTE_ACTIVATION_ENDPOINT = "dshMnemon/activation";
|
|
32
|
+
export declare const MNEMON_REMOTE_WRITE_ENDPOINT = "dshMnemon/write";
|
|
33
|
+
export declare const MNEMON_REMOTE_PACK_ENDPOINT = "dshMnemon/pack";
|
|
34
|
+
export declare const MNEMON_REMOTE_SETTINGS_ENDPOINT = "dshMnemon/settings";
|
|
35
|
+
export declare const MNEMON_REMOTE_VIEW_ENDPOINT = "dshMnemon/view";
|
|
36
|
+
export declare const MNEMON_REMOTE_VIEW_WRITE_ENDPOINT = "dshMnemon/viewWrite";
|
|
27
37
|
export declare const MNEMON_SETTINGS_NAMESPACE = "mnemon";
|
|
28
38
|
export declare const MNEMON_UI_SETTINGS_NAMESPACE = "mnemon-ui";
|
|
29
39
|
export * from './view-protocol.ts';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.5",
|
|
4
4
|
"description": "Composable three-tier memory control plane for DeepSeek Harness: persistent runtime context, searchable project documents, pluggable long-term memory, guarded strategies, WebUI, and headless tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -161,6 +161,7 @@
|
|
|
161
161
|
"peerDependencies": {
|
|
162
162
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
163
163
|
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
|
|
164
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1",
|
|
164
165
|
"react": "^18.2.0",
|
|
165
166
|
"react-dom": "^18.2.0"
|
|
166
167
|
},
|
|
@@ -171,6 +172,7 @@
|
|
|
171
172
|
"@deepseek-ai/dsh": "0.1.2-rc.1",
|
|
172
173
|
"@deepseek-ai/dsh-agent": "0.1.2-rc.1",
|
|
173
174
|
"@deepseek-ai/dsh-agent-loop": "0.1.2-rc.1",
|
|
175
|
+
"@deepseek-ai/dsh-api-gateway": "0.1.2-rc.1",
|
|
174
176
|
"@deepseek-ai/dsh-client-connection": "0.1.2-rc.1",
|
|
175
177
|
"@deepseek-ai/dsh-client-locale": "0.1.2-rc.1",
|
|
176
178
|
"@deepseek-ai/dsh-client-store": "0.1.2-rc.1",
|
|
@@ -192,6 +194,8 @@
|
|
|
192
194
|
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.2-rc.1",
|
|
193
195
|
"@deepseek-ai/dsh-system-prompt": "0.1.2-rc.1",
|
|
194
196
|
"@deepseek-ai/dsh-tools": "0.1.2-rc.1",
|
|
197
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.2-rc.1",
|
|
198
|
+
"@deepseek-ai/dsh-typert-registry": "0.1.2-rc.1",
|
|
195
199
|
"@testing-library/react": "^16.3.0",
|
|
196
200
|
"@types/node": "^22.0.0",
|
|
197
201
|
"@types/react": "^18.3.0",
|