dsh-mnemon 0.5.4 → 0.5.6
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 +4 -4
- package/README.zh-CN.md +4 -4
- package/lib/client.js +162 -46
- package/lib/extension-sdk.js +2 -71
- package/lib/index.js +686 -100
- package/lib/{strategy-configuration-B_DsZRQG.js → strategy-configuration-BTXIWooc.js} +70 -1
- package/lib/testing.js +1 -1
- package/lib/types/src/client/locales.d.ts +14 -0
- package/lib/types/src/core/contracts/index.d.ts +1 -1
- package/lib/types/src/host/protocol.d.ts +12 -1
- package/package.json +10 -6
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as deepFreeze, t as canonicalMemoryJson } from "./definitions-j0FLgE0-.js";
|
|
2
2
|
import { resolve } from "node:path";
|
|
3
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
3
4
|
//#region src/sdk/storage-lock.ts
|
|
4
5
|
const queues = /* @__PURE__ */ new Map();
|
|
5
6
|
/**
|
|
@@ -18,6 +19,74 @@ function withMemoryStorageLock(directory, operation) {
|
|
|
18
19
|
return result;
|
|
19
20
|
}
|
|
20
21
|
//#endregion
|
|
22
|
+
//#region src/sdk/input.ts
|
|
23
|
+
/** Stable digest of validated configuration; raw values never enter diagnostics. */
|
|
24
|
+
function memoryConfigurationDigest(value) {
|
|
25
|
+
return `config:${createHash("sha256").update(canonicalMemoryJson(value, "memory configuration")).digest("hex")}`;
|
|
26
|
+
}
|
|
27
|
+
function record(value, label) {
|
|
28
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) throw new Error(`${label} must be an object`);
|
|
29
|
+
return value;
|
|
30
|
+
}
|
|
31
|
+
function text(value, label, maximum, required = true) {
|
|
32
|
+
if (value === void 0 && !required) return void 0;
|
|
33
|
+
if (typeof value !== "string") throw new Error(`${label} must be a string`);
|
|
34
|
+
const normalized = value.trim();
|
|
35
|
+
if (required && normalized === "") throw new Error(`${label} is required`);
|
|
36
|
+
if (normalized.length > maximum) throw new Error(`${label} is too long (max ${maximum} characters)`);
|
|
37
|
+
return normalized === "" ? void 0 : normalized;
|
|
38
|
+
}
|
|
39
|
+
function integer(value, fallback, minimum, maximum) {
|
|
40
|
+
if (value === void 0) return fallback;
|
|
41
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < minimum || value > maximum) throw new Error(`value must be an integer within ${minimum}..${maximum}`);
|
|
42
|
+
return value;
|
|
43
|
+
}
|
|
44
|
+
function stringArray(value, label, maximum = 50) {
|
|
45
|
+
if (value === void 0) return void 0;
|
|
46
|
+
if (!Array.isArray(value) || value.length > maximum || value.some((item) => typeof item !== "string")) throw new Error(`${label} must be a string array`);
|
|
47
|
+
return value.map((item) => item.trim()).filter(Boolean);
|
|
48
|
+
}
|
|
49
|
+
function truncate(value, maximum) {
|
|
50
|
+
if (maximum <= 0) return "";
|
|
51
|
+
if (value.length <= maximum) return value;
|
|
52
|
+
let end = maximum - 1;
|
|
53
|
+
if (end > 0 && /[\uD800-\uDBFF]/u.test(value[end - 1])) end--;
|
|
54
|
+
return `${value.slice(0, end)}…`;
|
|
55
|
+
}
|
|
56
|
+
function receipt(viewId, offerId, sourceInstanceKey, revision, details, completion = "unknown") {
|
|
57
|
+
return {
|
|
58
|
+
id: `receipt:${randomUUID()}`,
|
|
59
|
+
viewId,
|
|
60
|
+
offerId,
|
|
61
|
+
sourceInstanceKey,
|
|
62
|
+
status: completion === "failed" ? "failed" : completion === "partial" || completion === "unknown" ? "partial" : "succeeded",
|
|
63
|
+
completion,
|
|
64
|
+
...completion === "committed" ? { committedAt: (/* @__PURE__ */ new Date()).toISOString() } : {},
|
|
65
|
+
...revision === void 0 ? {} : { revision },
|
|
66
|
+
details
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/** Validate migration proof supplied by an authorized Source management caller. */
|
|
70
|
+
function migrationLineage(value) {
|
|
71
|
+
if (value === void 0) return [];
|
|
72
|
+
if (!Array.isArray(value) || value.length > 1e3) throw new Error("lineage must be an array of at most 1000 entries");
|
|
73
|
+
return value.map((item) => {
|
|
74
|
+
const entry = record(item, "lineage");
|
|
75
|
+
const endpoint = (value) => {
|
|
76
|
+
const fields = record(value, "lineage endpoint");
|
|
77
|
+
return {
|
|
78
|
+
layerId: text(fields.layerId, "lineage layerId", 300),
|
|
79
|
+
reference: text(fields.reference, "lineage reference", 2e3),
|
|
80
|
+
digest: text(fields.digest, "lineage digest", 300)
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
return {
|
|
84
|
+
source: endpoint(entry.source),
|
|
85
|
+
destination: endpoint(entry.destination)
|
|
86
|
+
};
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
21
90
|
//#region src/sdk/strategy-configuration.ts
|
|
22
91
|
function defineMemoryStrategyConfiguration(value) {
|
|
23
92
|
return readMemoryStrategyConfiguration({
|
|
@@ -87,4 +156,4 @@ function memoryStrategyConfigurationValues(definition, input) {
|
|
|
87
156
|
return config;
|
|
88
157
|
}
|
|
89
158
|
//#endregion
|
|
90
|
-
export { withMemoryStorageLock as i, memoryStrategyConfigurationValues as n, readMemoryStrategyConfiguration as r, defineMemoryStrategyConfiguration as t };
|
|
159
|
+
export { memoryConfigurationDigest as a, record as c, truncate as d, withMemoryStorageLock as f, integer as i, stringArray as l, memoryStrategyConfigurationValues as n, migrationLineage as o, readMemoryStrategyConfiguration as r, receipt as s, defineMemoryStrategyConfiguration as t, text as u };
|
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
|
|
@@ -245,6 +245,7 @@ export declare const zh: {
|
|
|
245
245
|
'status.storageScopeAria': string;
|
|
246
246
|
'status.storageGlobal': string;
|
|
247
247
|
'status.storageWorkspace': string;
|
|
248
|
+
'status.storageWorkspaces': string;
|
|
248
249
|
'status.storageCustom': string;
|
|
249
250
|
'status.storageCurrent': string;
|
|
250
251
|
'status.storageWaiting': string;
|
|
@@ -293,6 +294,12 @@ export declare const zh: {
|
|
|
293
294
|
'config.scopeAria': string;
|
|
294
295
|
'config.global': string;
|
|
295
296
|
'config.workspace': string;
|
|
297
|
+
'config.workspaces': string;
|
|
298
|
+
'config.workspacesHint': string;
|
|
299
|
+
'config.workspacesRoot': string;
|
|
300
|
+
'config.workspacesRootHint': string;
|
|
301
|
+
'config.workspacesDefault': string;
|
|
302
|
+
'config.workspacesIdentityHint': string;
|
|
296
303
|
'config.custom': string;
|
|
297
304
|
'config.customHintShort': string;
|
|
298
305
|
'config.customSelected': string;
|
|
@@ -1218,6 +1225,7 @@ export declare const en: {
|
|
|
1218
1225
|
'status.storageScopeAria': string;
|
|
1219
1226
|
'status.storageGlobal': string;
|
|
1220
1227
|
'status.storageWorkspace': string;
|
|
1228
|
+
'status.storageWorkspaces': string;
|
|
1221
1229
|
'status.storageCustom': string;
|
|
1222
1230
|
'status.storageCurrent': string;
|
|
1223
1231
|
'status.storageWaiting': string;
|
|
@@ -1266,6 +1274,12 @@ export declare const en: {
|
|
|
1266
1274
|
'config.scopeAria': string;
|
|
1267
1275
|
'config.global': string;
|
|
1268
1276
|
'config.workspace': string;
|
|
1277
|
+
'config.workspaces': string;
|
|
1278
|
+
'config.workspacesHint': string;
|
|
1279
|
+
'config.workspacesRoot': string;
|
|
1280
|
+
'config.workspacesRootHint': string;
|
|
1281
|
+
'config.workspacesDefault': string;
|
|
1282
|
+
'config.workspacesIdentityHint': string;
|
|
1269
1283
|
'config.custom': string;
|
|
1270
1284
|
'config.customHintShort': string;
|
|
1271
1285
|
'config.customSelected': string;
|
|
@@ -6,7 +6,7 @@ export type MemoryJsonValue = MemoryJsonPrimitive | MemoryJsonValue[] | {
|
|
|
6
6
|
export declare const MEMORY_CAPABILITIES: readonly ["status", "project", "recall", "search", "read", "browse", "write", "archive", "graph", "related", "link", "forget", "maintain", "export", "import"];
|
|
7
7
|
export type MemoryCapability = typeof MEMORY_CAPABILITIES[number];
|
|
8
8
|
export interface MemoryOperationScope {
|
|
9
|
-
storage: 'global' | 'workspace' | 'custom';
|
|
9
|
+
storage: 'global' | 'workspace' | 'custom' | 'workspaces';
|
|
10
10
|
workspaceId?: string;
|
|
11
11
|
sessionId?: string;
|
|
12
12
|
agentId?: string;
|
|
@@ -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';
|
|
@@ -121,7 +131,8 @@ export type SettingsOperation = {
|
|
|
121
131
|
op: 'unset';
|
|
122
132
|
path: string[];
|
|
123
133
|
};
|
|
124
|
-
export type StorageScopeKind = 'global' | 'workspace' | 'custom';
|
|
134
|
+
export type StorageScopeKind = 'global' | 'workspace' | 'custom' | 'workspaces';
|
|
135
|
+
export declare function isWorkspaceStorageScope(scope: string | undefined): boolean;
|
|
125
136
|
export interface MemoryLayerConfig {
|
|
126
137
|
enabled?: boolean;
|
|
127
138
|
participation?: Partial<MemoryLayerParticipation>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.6",
|
|
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",
|
|
@@ -143,15 +143,15 @@
|
|
|
143
143
|
"dsh-mnemon-provider-holographic": "0.5.4",
|
|
144
144
|
"dsh-mnemon-provider-honcho": "0.5.4",
|
|
145
145
|
"dsh-mnemon-provider-mem0": "0.5.4",
|
|
146
|
-
"dsh-mnemon-provider-mnemon-native": "0.5.
|
|
146
|
+
"dsh-mnemon-provider-mnemon-native": "0.5.5",
|
|
147
147
|
"dsh-mnemon-provider-openviking": "0.5.4",
|
|
148
148
|
"dsh-mnemon-provider-retaindb": "0.5.4",
|
|
149
149
|
"dsh-mnemon-provider-supermemory": "0.5.4",
|
|
150
|
-
"dsh-mnemon-source-documents": "0.5.
|
|
151
|
-
"dsh-mnemon-source-memory-spaces": "0.5.
|
|
152
|
-
"dsh-mnemon-source-runtime": "0.5.
|
|
150
|
+
"dsh-mnemon-source-documents": "0.5.5",
|
|
151
|
+
"dsh-mnemon-source-memory-spaces": "0.5.5",
|
|
152
|
+
"dsh-mnemon-source-runtime": "0.5.5",
|
|
153
153
|
"dsh-mnemon-strategy-auto-capture": "0.5.4",
|
|
154
|
-
"dsh-mnemon-strategy-default-three-tier": "0.5.
|
|
154
|
+
"dsh-mnemon-strategy-default-three-tier": "0.5.5",
|
|
155
155
|
"dsh-mnemon-strategy-light-context": "0.5.4",
|
|
156
156
|
"dsh-mnemon-strategy-scoped": "0.5.4",
|
|
157
157
|
"fflate": "^0.8.3",
|
|
@@ -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",
|