dsh-mnemon 0.2.13 → 0.2.15
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 +29 -22
- package/README.zh-CN.md +29 -22
- package/lib/client.js +14 -11
- package/lib/index.js +33 -13
- package/lib/types/client/dsh-compat.d.ts +1 -1
- package/lib/types/client/locales.d.ts +2 -0
- package/lib/types/contracts.d.ts +29 -5
- package/lib/types/shared/contracts.d.ts +2 -0
- package/lib/types/subagent.d.ts +5 -1
- package/package.json +15 -15
package/lib/index.js
CHANGED
|
@@ -7817,6 +7817,7 @@ var MnemonSubagentCoordinator = class {
|
|
|
7817
7817
|
runtimeMemoryOrSource;
|
|
7818
7818
|
documents;
|
|
7819
7819
|
resultRuntime;
|
|
7820
|
+
taskAgentModelResolver;
|
|
7820
7821
|
counters = {
|
|
7821
7822
|
recalls: 0,
|
|
7822
7823
|
writes: 0,
|
|
@@ -7831,11 +7832,12 @@ var MnemonSubagentCoordinator = class {
|
|
|
7831
7832
|
};
|
|
7832
7833
|
runtimeQueue = Promise.resolve();
|
|
7833
7834
|
documentQueue = Promise.resolve();
|
|
7834
|
-
constructor(subagents, runtimeMemoryOrSource, documents, resultRuntime) {
|
|
7835
|
+
constructor(subagents, runtimeMemoryOrSource, documents, resultRuntime, taskAgentModelResolver) {
|
|
7835
7836
|
this.subagents = subagents;
|
|
7836
7837
|
this.runtimeMemoryOrSource = runtimeMemoryOrSource;
|
|
7837
7838
|
this.documents = documents;
|
|
7838
7839
|
this.resultRuntime = resultRuntime;
|
|
7840
|
+
this.taskAgentModelResolver = taskAgentModelResolver;
|
|
7839
7841
|
}
|
|
7840
7842
|
snapshot() {
|
|
7841
7843
|
return { ...this.counters };
|
|
@@ -7907,22 +7909,21 @@ Traversal depth: 2`;
|
|
|
7907
7909
|
if (!Array.isArray(value.updates)) throw new Error("metadata subagent returned no updates");
|
|
7908
7910
|
const allowed = new Set(selected);
|
|
7909
7911
|
const seen = /* @__PURE__ */ new Set();
|
|
7910
|
-
const updates =
|
|
7912
|
+
const updates = [];
|
|
7913
|
+
for (const entry of value.updates) {
|
|
7911
7914
|
const item = object$2(entry);
|
|
7912
7915
|
const memoryBodyId = typeof item.memoryBodyId === "string" ? item.memoryBodyId.trim() : "";
|
|
7913
7916
|
const title = typeof item.title === "string" ? item.title.trim() : "";
|
|
7914
7917
|
const description = typeof item.description === "string" ? item.description.trim() : "";
|
|
7915
7918
|
if (!allowed.has(memoryBodyId) || seen.has(memoryBodyId)) throw new Error("metadata subagent returned an unexpected or duplicate Memory Space");
|
|
7916
|
-
if (title.length < 2 || title.length > 48) throw new Error(`metadata title for ${memoryBodyId} must contain 2 through 48 characters`);
|
|
7917
|
-
if (description.length < 12 || description.length > 200) throw new Error(`metadata description for ${memoryBodyId} must contain 12 through 200 characters`);
|
|
7918
7919
|
seen.add(memoryBodyId);
|
|
7919
|
-
|
|
7920
|
+
if (title.length < 2 || title.length > 48 || description.length < 12 || description.length > 200) continue;
|
|
7921
|
+
updates.push({
|
|
7920
7922
|
memoryBodyId,
|
|
7921
7923
|
title,
|
|
7922
7924
|
description
|
|
7923
|
-
};
|
|
7924
|
-
}
|
|
7925
|
-
if (seen.size !== allowed.size) throw new Error("metadata subagent omitted a selected Memory Space");
|
|
7925
|
+
});
|
|
7926
|
+
}
|
|
7926
7927
|
return {
|
|
7927
7928
|
delegated: true,
|
|
7928
7929
|
runId,
|
|
@@ -8282,6 +8283,14 @@ ${runtimeSnapshotContext("user", targetEntries)}`;
|
|
|
8282
8283
|
const completionPersona = `${persona}
|
|
8283
8284
|
|
|
8284
8285
|
Completion protocol: call \`${resultToolName}\` exactly once with the final result matching its parameter schema. This is the only completion channel for this run. Do not finish with a plain-text answer.`;
|
|
8286
|
+
const perOpMaxTokens = operation === "migration" ? 16384 : operation === "compaction" || operation === "document-archive" ? 8192 : operation === "metadata-maintenance" ? 4096 : void 0;
|
|
8287
|
+
const fixed = this.taskAgentModelResolver?.();
|
|
8288
|
+
const baseAgentOptions = perOpMaxTokens === void 0 ? void 0 : { maxTokens: perOpMaxTokens };
|
|
8289
|
+
const resolvedAgentOptions = fixed === void 0 ? baseAgentOptions : {
|
|
8290
|
+
...baseAgentOptions ?? {},
|
|
8291
|
+
provider: fixed.provider,
|
|
8292
|
+
model: fixed.model
|
|
8293
|
+
};
|
|
8285
8294
|
run = await this.subagents.start(provider, {
|
|
8286
8295
|
label,
|
|
8287
8296
|
prompt: [{
|
|
@@ -8290,7 +8299,7 @@ Completion protocol: call \`${resultToolName}\` exactly once with the final resu
|
|
|
8290
8299
|
}],
|
|
8291
8300
|
parent,
|
|
8292
8301
|
signal,
|
|
8293
|
-
...
|
|
8302
|
+
...resolvedAgentOptions === void 0 ? {} : { agentOptions: resolvedAgentOptions },
|
|
8294
8303
|
maxDepth: 1,
|
|
8295
8304
|
toolFilter: { allow: [...tools, resultToolName] },
|
|
8296
8305
|
persona: completionPersona
|
|
@@ -8545,7 +8554,7 @@ function memoryToolCalls(events, turn) {
|
|
|
8545
8554
|
return events.filter((event) => event.type === "tool/call" && (turn === void 0 || eventTurn(event) === turn) && typeof event.data.name === "string" && event.data.name.startsWith("mnemon_")).length;
|
|
8546
8555
|
}
|
|
8547
8556
|
function textLength(messages) {
|
|
8548
|
-
return messages.filter((message) => message.source.kind === "user").map((message) => message.content.map((block) => block.text).join("\n").trim().length).reduce((total, length) => total + length, 0);
|
|
8557
|
+
return messages.filter((message) => message.source.kind === "user").map((message) => message.content.filter((block) => block.type === "text" && "text" in block && typeof block.text === "string").map((block) => block.text).join("\n").trim().length).reduce((total, length) => total + length, 0);
|
|
8549
8558
|
}
|
|
8550
8559
|
function completedToolActivity(events, turn) {
|
|
8551
8560
|
return {
|
|
@@ -8890,7 +8899,8 @@ var MnemonLifecycle = class {
|
|
|
8890
8899
|
models: models.map((model) => ({
|
|
8891
8900
|
id: model.id,
|
|
8892
8901
|
name: model.name,
|
|
8893
|
-
...model.description === void 0 ? {} : { description: model.description }
|
|
8902
|
+
...model.description === void 0 ? {} : { description: model.description },
|
|
8903
|
+
...model.inputModalities === void 0 ? {} : { inputModalities: [...model.inputModalities] }
|
|
8894
8904
|
}))
|
|
8895
8905
|
}
|
|
8896
8906
|
};
|
|
@@ -10017,7 +10027,7 @@ function createWriteHandler(input, lifecycle, runtimeMemory, versions) {
|
|
|
10017
10027
|
if (!body.active || body.providerEnabled === false) throw new Error(`metadata maintenance requires an active Memory Space: ${id}`);
|
|
10018
10028
|
}
|
|
10019
10029
|
const maintained = await lifecycle.maintainMetadata(String(payload.sessionId ?? ""), memoryBodyIds, selectedWorkspace?.path);
|
|
10020
|
-
service.updateBodyMetadata(maintained.updates);
|
|
10030
|
+
if (maintained.updates.length > 0) service.updateBodyMetadata(maintained.updates);
|
|
10021
10031
|
return success$1(maintained);
|
|
10022
10032
|
}
|
|
10023
10033
|
case "body-reconnect": return success$1(await service.reconnectBody(String(payload.memoryBodyId ?? "")));
|
|
@@ -10873,7 +10883,17 @@ function apply(rawContext, config = {}) {
|
|
|
10873
10883
|
base: resolveInteractionConfig(resolved.conversationInteraction),
|
|
10874
10884
|
applies: "live"
|
|
10875
10885
|
});
|
|
10876
|
-
const coordinator = new MnemonSubagentCoordinator(ctx.subagents, runtime, void 0, ctx)
|
|
10886
|
+
const coordinator = new MnemonSubagentCoordinator(ctx.subagents, runtime, void 0, ctx, () => {
|
|
10887
|
+
const taskAgentModel = runtime.config.taskAgentModel;
|
|
10888
|
+
if (taskAgentModel.mode !== "fixed") return void 0;
|
|
10889
|
+
const provider = taskAgentModel.provider?.trim();
|
|
10890
|
+
const model = taskAgentModel.model?.trim();
|
|
10891
|
+
if (provider === void 0 || provider === "" || model === void 0 || model === "") return void 0;
|
|
10892
|
+
return {
|
|
10893
|
+
provider,
|
|
10894
|
+
model
|
|
10895
|
+
};
|
|
10896
|
+
});
|
|
10877
10897
|
const lifecycle = new MnemonLifecycle(ctx, coordinator, runtime.config, runtime);
|
|
10878
10898
|
ctx.effect(() => lifecycle.start(), "dsh-mnemon.lifecycle-root()");
|
|
10879
10899
|
registerTools(ctx, runtime, coordinator);
|
|
@@ -13,7 +13,7 @@ declare module '@deepseek-ai/dsh-client-ui-slots' {
|
|
|
13
13
|
mnemon: MnemonKey;
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
|
-
/** DSH 0.1.
|
|
16
|
+
/** DSH 0.1.1-rc.2 client context plus the two injected feature services. */
|
|
17
17
|
export type MnemonClientContext = ClientContext & {
|
|
18
18
|
connection: ConnectionHandle;
|
|
19
19
|
locale: LocaleRuntime;
|
|
@@ -765,6 +765,7 @@ export declare const zh: {
|
|
|
765
765
|
'config.taskAgentModelHint': string;
|
|
766
766
|
'config.taskAgentChooseProvider': string;
|
|
767
767
|
'config.taskAgentChooseModel': string;
|
|
768
|
+
'config.taskAgentImageInput': string;
|
|
768
769
|
'config.taskAgentEffective': string;
|
|
769
770
|
'config.taskAgentLoading': string;
|
|
770
771
|
'config.taskAgentUnavailable': string;
|
|
@@ -1623,6 +1624,7 @@ export declare const en: {
|
|
|
1623
1624
|
'config.taskAgentModelHint': string;
|
|
1624
1625
|
'config.taskAgentChooseProvider': string;
|
|
1625
1626
|
'config.taskAgentChooseModel': string;
|
|
1627
|
+
'config.taskAgentImageInput': string;
|
|
1626
1628
|
'config.taskAgentEffective': string;
|
|
1627
1629
|
'config.taskAgentLoading': string;
|
|
1628
1630
|
'config.taskAgentUnavailable': string;
|
package/lib/types/contracts.d.ts
CHANGED
|
@@ -86,13 +86,35 @@ export interface HostMessageSource {
|
|
|
86
86
|
form?: string;
|
|
87
87
|
summary?: string;
|
|
88
88
|
}
|
|
89
|
+
/** Minimum shape shared by DSH content blocks, including merge-added blocks. */
|
|
90
|
+
export interface HostOpaqueContentBlock {
|
|
91
|
+
type: string;
|
|
92
|
+
/** Present on text-like blocks; omitted by images and other merge-added blocks. */
|
|
93
|
+
text?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface HostTextContentBlock extends HostOpaqueContentBlock {
|
|
96
|
+
type: 'text';
|
|
97
|
+
text: string;
|
|
98
|
+
}
|
|
99
|
+
/** Durable image metadata used by the DSH 0.1.1 prerelease line. */
|
|
100
|
+
export interface HostImageAttachmentRef {
|
|
101
|
+
attachmentId: string;
|
|
102
|
+
mediaType: 'image/png' | 'image/jpeg' | 'image/webp' | 'image/gif';
|
|
103
|
+
bytes: number;
|
|
104
|
+
width: number;
|
|
105
|
+
height: number;
|
|
106
|
+
name?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface HostImageContentBlock extends HostOpaqueContentBlock {
|
|
109
|
+
type: 'image';
|
|
110
|
+
attachment: HostImageAttachmentRef;
|
|
111
|
+
}
|
|
112
|
+
/** User content is open to DSH/plugin blocks while documenting first-party text and image shapes. */
|
|
113
|
+
export type HostUserContentBlock = HostTextContentBlock | HostImageContentBlock | HostOpaqueContentBlock;
|
|
89
114
|
export interface HostUserMessage {
|
|
90
115
|
id: string;
|
|
91
116
|
role: 'user';
|
|
92
|
-
content:
|
|
93
|
-
type: 'text';
|
|
94
|
-
text: string;
|
|
95
|
-
}>;
|
|
117
|
+
content: HostUserContentBlock[];
|
|
96
118
|
source: HostMessageSource;
|
|
97
119
|
}
|
|
98
120
|
export interface HostSessionEvent {
|
|
@@ -174,7 +196,7 @@ export interface HostSubagentResult {
|
|
|
174
196
|
[key: string]: unknown;
|
|
175
197
|
}>;
|
|
176
198
|
structured?: unknown;
|
|
177
|
-
/** DSH rc.8 provider-authored failure detail, including for remote children. */
|
|
199
|
+
/** DSH rc.8+ provider-authored failure detail, including for remote children. */
|
|
178
200
|
diagnostic?: string;
|
|
179
201
|
stopReason: string;
|
|
180
202
|
}
|
|
@@ -227,6 +249,8 @@ export interface HostLlmService {
|
|
|
227
249
|
id: string;
|
|
228
250
|
name: string;
|
|
229
251
|
description?: string;
|
|
252
|
+
/** Absent means unknown; an explicit list declares the accepted request modalities. */
|
|
253
|
+
inputModalities?: readonly string[];
|
|
230
254
|
}>>;
|
|
231
255
|
}
|
|
232
256
|
export interface HostContextShape {
|
|
@@ -132,6 +132,8 @@ export interface TaskAgentModelCatalogModel {
|
|
|
132
132
|
id: string;
|
|
133
133
|
name: string;
|
|
134
134
|
description?: string;
|
|
135
|
+
/** DSH's merge-extensible model modality ids; absent means capability is unknown. */
|
|
136
|
+
inputModalities?: string[];
|
|
135
137
|
}
|
|
136
138
|
export interface TaskAgentModelCatalogGroup {
|
|
137
139
|
id: string;
|
package/lib/types/subagent.d.ts
CHANGED
|
@@ -74,10 +74,14 @@ export declare class MnemonSubagentCoordinator {
|
|
|
74
74
|
private readonly runtimeMemoryOrSource?;
|
|
75
75
|
private readonly documents?;
|
|
76
76
|
private readonly resultRuntime?;
|
|
77
|
+
private readonly taskAgentModelResolver?;
|
|
77
78
|
private readonly counters;
|
|
78
79
|
private runtimeQueue;
|
|
79
80
|
private documentQueue;
|
|
80
|
-
constructor(subagents: HostSubagentsService, runtimeMemoryOrSource?: (RuntimeMemoryController | AgentRuntimeSource) | undefined, documents?: DocumentManager | undefined, resultRuntime?: HostResultToolRuntime | undefined)
|
|
81
|
+
constructor(subagents: HostSubagentsService, runtimeMemoryOrSource?: (RuntimeMemoryController | AgentRuntimeSource) | undefined, documents?: DocumentManager | undefined, resultRuntime?: HostResultToolRuntime | undefined, taskAgentModelResolver?: (() => {
|
|
82
|
+
provider: string;
|
|
83
|
+
model: string;
|
|
84
|
+
} | undefined) | undefined);
|
|
81
85
|
snapshot(): SubagentCounters;
|
|
82
86
|
documentsSnapshot(parent: HostAgent): import("./documents.ts").DocumentSnapshot;
|
|
83
87
|
documentGet(parent: HostAgent, id: string): DocumentView;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.15",
|
|
4
4
|
"description": "Three-tier memory control plane for DeepSeek Harness: persistent runtime context, searchable project documents, pluggable long-term memory, smart routing, supervised agent workflows, WebUI, and headless tools.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
],
|
|
37
37
|
"repository": {
|
|
38
38
|
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/
|
|
39
|
+
"url": "git+https://github.com/Grivn/dsh-mnemon.git"
|
|
40
40
|
},
|
|
41
|
-
"homepage": "https://github.com/
|
|
41
|
+
"homepage": "https://github.com/Grivn/dsh-mnemon#readme",
|
|
42
42
|
"bugs": {
|
|
43
|
-
"url": "https://github.com/
|
|
43
|
+
"url": "https://github.com/Grivn/dsh-mnemon/issues"
|
|
44
44
|
},
|
|
45
45
|
"license": "MIT",
|
|
46
46
|
"publishConfig": {
|
|
@@ -105,23 +105,23 @@
|
|
|
105
105
|
"schemastery": "^3.18.0"
|
|
106
106
|
},
|
|
107
107
|
"peerDependencies": {
|
|
108
|
-
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6",
|
|
108
|
+
"@deepseek-ai/dsh-client-ui-primitives": "^0.1.0-rc.6 || ^0.1.1-rc.1",
|
|
109
109
|
"react": "^18.2.0",
|
|
110
110
|
"react-dom": "^18.2.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
113
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
114
114
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
115
|
-
"@deepseek-ai/dsh": "0.1.
|
|
116
|
-
"@deepseek-ai/dsh-client-connection": "0.1.
|
|
117
|
-
"@deepseek-ai/dsh-client-locale": "0.1.
|
|
118
|
-
"@deepseek-ai/dsh-client-runtime": "0.1.
|
|
119
|
-
"@deepseek-ai/dsh-client-ui-conversation": "0.1.
|
|
120
|
-
"@deepseek-ai/dsh-client-ui-primitives": "0.1.
|
|
121
|
-
"@deepseek-ai/dsh-client-ui-settings": "0.1.
|
|
122
|
-
"@deepseek-ai/dsh-client-ui-slots": "0.1.
|
|
123
|
-
"@deepseek-ai/dsh-client-ui-tool": "0.1.
|
|
124
|
-
"@deepseek-ai/dsh-system-prompt": "0.1.
|
|
115
|
+
"@deepseek-ai/dsh": "0.1.1-rc.2",
|
|
116
|
+
"@deepseek-ai/dsh-client-connection": "0.1.1-rc.2",
|
|
117
|
+
"@deepseek-ai/dsh-client-locale": "0.1.1-rc.2",
|
|
118
|
+
"@deepseek-ai/dsh-client-runtime": "0.1.1-rc.2",
|
|
119
|
+
"@deepseek-ai/dsh-client-ui-conversation": "0.1.1-rc.2",
|
|
120
|
+
"@deepseek-ai/dsh-client-ui-primitives": "0.1.1-rc.2",
|
|
121
|
+
"@deepseek-ai/dsh-client-ui-settings": "0.1.1-rc.2",
|
|
122
|
+
"@deepseek-ai/dsh-client-ui-slots": "0.1.1-rc.2",
|
|
123
|
+
"@deepseek-ai/dsh-client-ui-tool": "0.1.1-rc.2",
|
|
124
|
+
"@deepseek-ai/dsh-system-prompt": "0.1.1-rc.2",
|
|
125
125
|
"@testing-library/react": "^16.3.0",
|
|
126
126
|
"@types/node": "^22.0.0",
|
|
127
127
|
"@types/react": "^18.3.0",
|