dsh-mnemon 0.5.5 → 0.5.7
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 -1
- package/README.zh-CN.md +3 -1
- package/bin/repair-legacy-session.mjs +220 -0
- package/cordis.patch.yml +5 -0
- package/lib/client.js +111 -45
- package/lib/extension-sdk.js +2 -71
- package/lib/index.js +579 -244
- package/lib/{strategy-configuration-B_DsZRQG.js → strategy-configuration-BTXIWooc.js} +70 -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 +2 -1
- package/package.json +55 -34
|
@@ -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 };
|
|
@@ -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;
|
|
@@ -131,7 +131,8 @@ export type SettingsOperation = {
|
|
|
131
131
|
op: 'unset';
|
|
132
132
|
path: string[];
|
|
133
133
|
};
|
|
134
|
-
export type StorageScopeKind = 'global' | 'workspace' | 'custom';
|
|
134
|
+
export type StorageScopeKind = 'global' | 'workspace' | 'custom' | 'workspaces';
|
|
135
|
+
export declare function isWorkspaceStorageScope(scope: string | undefined): boolean;
|
|
135
136
|
export interface MemoryLayerConfig {
|
|
136
137
|
enabled?: boolean;
|
|
137
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.7",
|
|
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",
|
|
@@ -92,6 +92,7 @@
|
|
|
92
92
|
},
|
|
93
93
|
"files": [
|
|
94
94
|
"lib",
|
|
95
|
+
"bin/repair-legacy-session.mjs",
|
|
95
96
|
"cordis.patch.yml",
|
|
96
97
|
"README.md",
|
|
97
98
|
"README.zh-CN.md",
|
|
@@ -143,15 +144,15 @@
|
|
|
143
144
|
"dsh-mnemon-provider-holographic": "0.5.4",
|
|
144
145
|
"dsh-mnemon-provider-honcho": "0.5.4",
|
|
145
146
|
"dsh-mnemon-provider-mem0": "0.5.4",
|
|
146
|
-
"dsh-mnemon-provider-mnemon-native": "0.5.
|
|
147
|
+
"dsh-mnemon-provider-mnemon-native": "0.5.5",
|
|
147
148
|
"dsh-mnemon-provider-openviking": "0.5.4",
|
|
148
149
|
"dsh-mnemon-provider-retaindb": "0.5.4",
|
|
149
150
|
"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.
|
|
151
|
+
"dsh-mnemon-source-documents": "0.5.6",
|
|
152
|
+
"dsh-mnemon-source-memory-spaces": "0.5.6",
|
|
153
|
+
"dsh-mnemon-source-runtime": "0.5.6",
|
|
153
154
|
"dsh-mnemon-strategy-auto-capture": "0.5.4",
|
|
154
|
-
"dsh-mnemon-strategy-default-three-tier": "0.5.
|
|
155
|
+
"dsh-mnemon-strategy-default-three-tier": "0.5.5",
|
|
155
156
|
"dsh-mnemon-strategy-light-context": "0.5.4",
|
|
156
157
|
"dsh-mnemon-strategy-scoped": "0.5.4",
|
|
157
158
|
"fflate": "^0.8.3",
|
|
@@ -160,8 +161,8 @@
|
|
|
160
161
|
},
|
|
161
162
|
"peerDependencies": {
|
|
162
163
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
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
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1 || ^0.1.5-rc.1",
|
|
165
|
+
"@deepseek-ai/dsh-typert-protocol": "^0.1.0-rc.6 || ^0.1.1-rc.1 || ^0.1.2-alpha.1 || ^0.1.5-rc.1",
|
|
165
166
|
"react": "^18.2.0",
|
|
166
167
|
"react-dom": "^18.2.0"
|
|
167
168
|
},
|
|
@@ -169,45 +170,65 @@
|
|
|
169
170
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
170
171
|
"@changesets/cli": "^2.31.1",
|
|
171
172
|
"@deepseek-ai/cordis": "^4.0.2",
|
|
172
|
-
"@deepseek-ai/dsh": "0.1.
|
|
173
|
-
"@deepseek-ai/dsh-agent": "0.1.
|
|
174
|
-
"@deepseek-ai/dsh-agent-loop": "0.1.
|
|
175
|
-
"@deepseek-ai/dsh-api-gateway": "0.1.
|
|
176
|
-
"@deepseek-ai/dsh-client-connection": "0.1.
|
|
177
|
-
"@deepseek-ai/dsh-client-locale": "0.1.
|
|
178
|
-
"@deepseek-ai/dsh-client-store": "0.1.
|
|
179
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.1.
|
|
180
|
-
"@deepseek-ai/dsh-client-ui-layout": "0.1.
|
|
181
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.1.
|
|
182
|
-
"@deepseek-ai/dsh-client-ui-renderer": "0.1.
|
|
183
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.1.
|
|
184
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.
|
|
185
|
-
"@deepseek-ai/dsh-client-ui-tool": "0.1.
|
|
186
|
-
"@deepseek-ai/dsh-invariants": "0.1.
|
|
187
|
-
"@deepseek-ai/dsh-llm": "0.1.
|
|
188
|
-
"@deepseek-ai/dsh-session": "0.1.
|
|
189
|
-
"@deepseek-ai/dsh-session-
|
|
190
|
-
"@deepseek-ai/dsh-session-
|
|
173
|
+
"@deepseek-ai/dsh": "0.1.5-rc.1",
|
|
174
|
+
"@deepseek-ai/dsh-agent": "0.1.5-rc.1",
|
|
175
|
+
"@deepseek-ai/dsh-agent-loop": "0.1.5-rc.1",
|
|
176
|
+
"@deepseek-ai/dsh-api-gateway": "0.1.5-rc.1",
|
|
177
|
+
"@deepseek-ai/dsh-client-connection": "0.1.5-rc.1",
|
|
178
|
+
"@deepseek-ai/dsh-client-locale": "0.1.5-rc.1",
|
|
179
|
+
"@deepseek-ai/dsh-client-store": "0.1.5-rc.1",
|
|
180
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.5-rc.1",
|
|
181
|
+
"@deepseek-ai/dsh-client-ui-layout": "0.1.5-rc.1",
|
|
182
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.5-rc.1",
|
|
183
|
+
"@deepseek-ai/dsh-client-ui-renderer": "0.1.5-rc.1",
|
|
184
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.5-rc.1",
|
|
185
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.5-rc.1",
|
|
186
|
+
"@deepseek-ai/dsh-client-ui-tool": "0.1.5-rc.1",
|
|
187
|
+
"@deepseek-ai/dsh-invariants": "0.1.5-rc.1",
|
|
188
|
+
"@deepseek-ai/dsh-llm": "0.1.5-rc.1",
|
|
189
|
+
"@deepseek-ai/dsh-session": "0.1.5-rc.1",
|
|
190
|
+
"@deepseek-ai/dsh-session-format-v0-to-v1": "0.1.5-rc.1",
|
|
191
|
+
"@deepseek-ai/dsh-session-persistence-jsonl": "0.1.5-rc.1",
|
|
192
|
+
"@deepseek-ai/dsh-session-projection": "0.1.5-rc.1",
|
|
191
193
|
"@deepseek-ai/dsh-session-projection-legacy": "npm:@deepseek-ai/dsh-session-projection@0.1.0-rc.8",
|
|
192
|
-
"@deepseek-ai/dsh-session-query": "0.1.
|
|
193
|
-
"@deepseek-ai/dsh-subagent": "0.1.
|
|
194
|
-
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.
|
|
195
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.
|
|
196
|
-
"@deepseek-ai/dsh-tools": "0.1.
|
|
197
|
-
"@deepseek-ai/dsh-typert-protocol": "0.1.
|
|
198
|
-
"@deepseek-ai/dsh-typert-registry": "0.1.
|
|
194
|
+
"@deepseek-ai/dsh-session-query": "0.1.5-rc.1",
|
|
195
|
+
"@deepseek-ai/dsh-subagent": "0.1.5-rc.1",
|
|
196
|
+
"@deepseek-ai/dsh-subagent-spawn-in-process": "0.1.5-rc.1",
|
|
197
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.5-rc.1",
|
|
198
|
+
"@deepseek-ai/dsh-tools": "0.1.5-rc.1",
|
|
199
|
+
"@deepseek-ai/dsh-typert-protocol": "0.1.5-rc.1",
|
|
200
|
+
"@deepseek-ai/dsh-typert-registry": "0.1.5-rc.1",
|
|
201
|
+
"@shikijs/langs": "^4.3.1",
|
|
199
202
|
"@testing-library/react": "^16.3.0",
|
|
200
203
|
"@types/node": "^22.0.0",
|
|
201
204
|
"@types/react": "^18.3.0",
|
|
202
205
|
"@types/react-dom": "^18.3.0",
|
|
206
|
+
"anser": "^2.3.5",
|
|
207
|
+
"clsx": "^2.1.1",
|
|
203
208
|
"jsdom": "^26.1.0",
|
|
209
|
+
"katex": "^0.16.47",
|
|
204
210
|
"lightningcss": "^1.29.0",
|
|
211
|
+
"mdast-util-from-markdown": "^2.0.3",
|
|
212
|
+
"mdast-util-gfm": "^3.1.0",
|
|
213
|
+
"mdast-util-math": "^3.0.0",
|
|
214
|
+
"micromark-core-commonmark": "^2.0.3",
|
|
215
|
+
"micromark-extension-gfm": "^3.0.0",
|
|
216
|
+
"micromark-extension-math": "^3.1.0",
|
|
217
|
+
"micromark-factory-space": "^2.0.1",
|
|
218
|
+
"micromark-util-character": "^2.1.1",
|
|
219
|
+
"micromark-util-classify-character": "^2.0.1",
|
|
220
|
+
"micromark-util-sanitize-uri": "^2.0.1",
|
|
221
|
+
"micromark-util-symbol": "^2.0.1",
|
|
205
222
|
"publint": "^0.3.23",
|
|
206
223
|
"react": "^18.2.0",
|
|
207
224
|
"react-dom": "^18.2.0",
|
|
208
225
|
"semver": "^7.8.5",
|
|
226
|
+
"shiki": "^4.3.1",
|
|
209
227
|
"tsdown": "^0.22.0",
|
|
210
228
|
"typescript": "^5.9.0",
|
|
211
229
|
"vitest": "^3.2.0"
|
|
230
|
+
},
|
|
231
|
+
"bin": {
|
|
232
|
+
"dsh-mnemon-repair-session": "bin/repair-legacy-session.mjs"
|
|
212
233
|
}
|
|
213
234
|
}
|