dsh-mnemon 0.5.39 → 0.5.41
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 +1 -1
- package/README.zh-CN.md +1 -1
- package/lib/bundle.js +1 -1
- package/lib/client.js +99 -2
- package/lib/core.js +1 -1
- package/lib/index.js +434 -61
- package/lib/{runtime-0u6dOiF9.js → runtime-DmL0It3P.js} +43 -11
- package/lib/{starter-resolution-C3yJawlA.js → starter-resolution-xVjONc6g.js} +3 -3
- package/lib/starter.js +1 -1
- package/lib/testing.js +1 -1
- package/lib/types/src/client/locales.d.ts +9 -0
- package/lib/types/src/core/contracts/view.d.ts +12 -1
- package/lib/types/src/host/protocol.d.ts +12 -0
- package/package.json +4 -4
|
@@ -325,11 +325,29 @@ function normalizeViewSpec(value, strategy, facts, budget) {
|
|
|
325
325
|
]) if (input.reminders[key] !== void 0) guidance.reminders[key] = requiredText(input.reminders[key], "Strategy reminder " + key, 16384);
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
+
const diagnostics = value.diagnostics === void 0 ? void 0 : normalizeSpecDiagnostics(value.diagnostics);
|
|
328
329
|
return deepFreeze({
|
|
329
330
|
strategyTypeId: value.strategyTypeId,
|
|
330
331
|
sources: normalizedSources,
|
|
331
332
|
explanation: requiredText(value.explanation, "memory ViewSpec explanation", 4e3),
|
|
332
|
-
...guidance === void 0 ? {} : { guidance }
|
|
333
|
+
...guidance === void 0 ? {} : { guidance },
|
|
334
|
+
...diagnostics === void 0 ? {} : { diagnostics }
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
const MAX_SPEC_DIAGNOSTICS = 32;
|
|
338
|
+
function normalizeSpecDiagnostics(value) {
|
|
339
|
+
if (!Array.isArray(value)) throw new Error("memory ViewSpec diagnostics must be an array");
|
|
340
|
+
if (value.length > MAX_SPEC_DIAGNOSTICS) throw new Error(`memory ViewSpec diagnostics must be at most ${MAX_SPEC_DIAGNOSTICS} entries`);
|
|
341
|
+
return value.map((diagnostic) => {
|
|
342
|
+
const input = jsonClone(diagnostic, "memory ViewSpec diagnostic");
|
|
343
|
+
if (input === null || typeof input !== "object" || Array.isArray(input)) throw new Error("memory ViewSpec diagnostic must be an object");
|
|
344
|
+
const entry = input;
|
|
345
|
+
const contributionInstanceKey = entry.contributionInstanceKey === void 0 ? void 0 : requiredText(entry.contributionInstanceKey, "memory ViewSpec diagnostic contributionInstanceKey", 300);
|
|
346
|
+
return deepFreeze({
|
|
347
|
+
code: id(entry.code, "memory ViewSpec diagnostic code"),
|
|
348
|
+
message: requiredText(entry.message, "memory ViewSpec diagnostic message", 1e3),
|
|
349
|
+
...contributionInstanceKey === void 0 ? {} : { contributionInstanceKey }
|
|
350
|
+
});
|
|
333
351
|
});
|
|
334
352
|
}
|
|
335
353
|
function normalizeContribution(source, spec, facts, value) {
|
|
@@ -483,6 +501,7 @@ var MemoryCompositionGeneration = class {
|
|
|
483
501
|
now;
|
|
484
502
|
routeCalls = /* @__PURE__ */ new WeakMap();
|
|
485
503
|
strategyTurns = /* @__PURE__ */ new WeakMap();
|
|
504
|
+
sourceContexts = /* @__PURE__ */ new WeakMap();
|
|
486
505
|
sourceTimeoutMs;
|
|
487
506
|
disposed = false;
|
|
488
507
|
constructor(snapshotValue, options = {}) {
|
|
@@ -702,6 +721,7 @@ var MemoryCompositionGeneration = class {
|
|
|
702
721
|
mode: modes.size === 1 ? [...modes][0] : "mixed",
|
|
703
722
|
sourceRevisions
|
|
704
723
|
};
|
|
724
|
+
const allDiagnostics = [...diagnostics, ...spec.diagnostics ?? []];
|
|
705
725
|
const body = {
|
|
706
726
|
runtimeGeneration: this.id,
|
|
707
727
|
strategyInstanceKey: this.strategy.instanceKey,
|
|
@@ -719,7 +739,7 @@ var MemoryCompositionGeneration = class {
|
|
|
719
739
|
consistency,
|
|
720
740
|
explanation: spec.explanation,
|
|
721
741
|
...spec.guidance === void 0 ? {} : { guidance: spec.guidance },
|
|
722
|
-
...
|
|
742
|
+
...allDiagnostics.length === 0 ? {} : { diagnostics: allDiagnostics.sort((a, b) => (a.contributionInstanceKey ?? "").localeCompare(b.contributionInstanceKey ?? "") || a.code.localeCompare(b.code)) }
|
|
723
743
|
};
|
|
724
744
|
const viewDigest = digest(body);
|
|
725
745
|
return deepFreeze({
|
|
@@ -873,10 +893,7 @@ var MemoryCompositionGeneration = class {
|
|
|
873
893
|
if (calls >= route.maxCalls) throw new Error(`memory View Route call budget is exhausted: ${route.id}`);
|
|
874
894
|
ledger.set(counter, calls + 1);
|
|
875
895
|
return normalizeEvidence(await source.runtime.query({
|
|
876
|
-
view:
|
|
877
|
-
id: view.id,
|
|
878
|
-
scope: view.scope
|
|
879
|
-
}),
|
|
896
|
+
view: this.sourceView(view, route.sourceInstanceKey, execution),
|
|
880
897
|
route: selectedRoute,
|
|
881
898
|
grant,
|
|
882
899
|
input: jsonClone(selectedInput, "memory Route input"),
|
|
@@ -901,7 +918,24 @@ var MemoryCompositionGeneration = class {
|
|
|
901
918
|
active = false;
|
|
902
919
|
}
|
|
903
920
|
}
|
|
904
|
-
|
|
921
|
+
sourceView(view, sourceInstanceKey, execution) {
|
|
922
|
+
let contexts = this.sourceContexts.get(execution);
|
|
923
|
+
if (contexts === void 0) {
|
|
924
|
+
contexts = /* @__PURE__ */ new Map();
|
|
925
|
+
this.sourceContexts.set(execution, contexts);
|
|
926
|
+
}
|
|
927
|
+
const key = `${view.id}\u0000${sourceInstanceKey}`;
|
|
928
|
+
let context = contexts.get(key);
|
|
929
|
+
if (context === void 0) {
|
|
930
|
+
context = deepFreeze({
|
|
931
|
+
id: view.id,
|
|
932
|
+
scope: view.scope
|
|
933
|
+
});
|
|
934
|
+
contexts.set(key, context);
|
|
935
|
+
}
|
|
936
|
+
return context;
|
|
937
|
+
}
|
|
938
|
+
async executeAction(view, offerId, input, authorize, signal, execution = view) {
|
|
905
939
|
this.assertOpen();
|
|
906
940
|
if (view.runtimeGeneration !== this.id) throw new Error("memory View belongs to a different runtime generation");
|
|
907
941
|
const offer = view.actionOffers.find((candidate) => candidate.id === offerId);
|
|
@@ -913,10 +947,7 @@ var MemoryCompositionGeneration = class {
|
|
|
913
947
|
signal?.throwIfAborted();
|
|
914
948
|
const grant = view.readGrants.find((candidate) => candidate.sourceInstanceKey === offer.sourceInstanceKey);
|
|
915
949
|
const receipt = await source.runtime.mutate({
|
|
916
|
-
view:
|
|
917
|
-
id: view.id,
|
|
918
|
-
scope: view.scope
|
|
919
|
-
}),
|
|
950
|
+
view: this.sourceView(view, offer.sourceInstanceKey, execution),
|
|
920
951
|
offer,
|
|
921
952
|
...grant === void 0 ? {} : { grant },
|
|
922
953
|
input: jsonClone(input, "memory Action input"),
|
|
@@ -951,6 +982,7 @@ var MemoryCompositionGeneration = class {
|
|
|
951
982
|
this.disposed = true;
|
|
952
983
|
this.routeCalls = /* @__PURE__ */ new WeakMap();
|
|
953
984
|
this.strategyTurns = /* @__PURE__ */ new WeakMap();
|
|
985
|
+
this.sourceContexts = /* @__PURE__ */ new WeakMap();
|
|
954
986
|
const failures = [];
|
|
955
987
|
for (const source of [...this.sources.values()].reverse()) try {
|
|
956
988
|
await source.runtime.dispose?.();
|
|
@@ -14,12 +14,12 @@ var dependencies = {
|
|
|
14
14
|
"dsh-mnemon-provider-openviking": "0.5.10",
|
|
15
15
|
"dsh-mnemon-provider-retaindb": "0.5.6",
|
|
16
16
|
"dsh-mnemon-provider-supermemory": "0.5.5",
|
|
17
|
-
"dsh-mnemon-source-documents": "0.5.
|
|
17
|
+
"dsh-mnemon-source-documents": "0.5.13",
|
|
18
18
|
"dsh-mnemon-source-memory-spaces": "0.5.25",
|
|
19
19
|
"dsh-mnemon-source-runtime": "0.5.17",
|
|
20
|
-
"dsh-mnemon-source-skills": "0.5.
|
|
20
|
+
"dsh-mnemon-source-skills": "0.5.8",
|
|
21
21
|
"dsh-mnemon-strategy-auto-capture": "0.5.5",
|
|
22
|
-
"dsh-mnemon-strategy-default-three-tier": "0.5.
|
|
22
|
+
"dsh-mnemon-strategy-default-three-tier": "0.5.12",
|
|
23
23
|
"dsh-mnemon-strategy-general": "0.5.1",
|
|
24
24
|
"dsh-mnemon-strategy-light-context": "0.5.6",
|
|
25
25
|
"dsh-mnemon-strategy-scoped": "0.5.5",
|
package/lib/starter.js
CHANGED
package/lib/testing.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as provideMemoryRuntime } from "./runtime-
|
|
1
|
+
import { t as provideMemoryRuntime } from "./runtime-DmL0It3P.js";
|
|
2
2
|
import { DEFAULT_MEMORY_VIEW_BUDGET } from "./contracts.js";
|
|
3
3
|
import { c as jsonClone } from "./definitions-DU7MLBhu.js";
|
|
4
4
|
import { Context } from "@deepseek-ai/cordis";
|
|
@@ -129,6 +129,10 @@ export declare const zh: {
|
|
|
129
129
|
'status.title': string;
|
|
130
130
|
'status.description': string;
|
|
131
131
|
'status.nominal': string;
|
|
132
|
+
'status.workflowUnavailable': string;
|
|
133
|
+
'status.workflowIdleReview': string;
|
|
134
|
+
'status.workflowRuntimeCapacity': string;
|
|
135
|
+
'status.workflowUnsupported': string;
|
|
132
136
|
'status.reviewFailed': string;
|
|
133
137
|
'status.reviewFailedDetail': string;
|
|
134
138
|
'status.reviewPartial': string;
|
|
@@ -421,6 +425,7 @@ export declare const zh: {
|
|
|
421
425
|
'details.currentMain': string;
|
|
422
426
|
'details.useMain': string;
|
|
423
427
|
'details.back': string;
|
|
428
|
+
'config.strategyWorkflowNote': string;
|
|
424
429
|
'threeTier.offNote': string;
|
|
425
430
|
'board.otherEnhancements': string;
|
|
426
431
|
'board.more': string;
|
|
@@ -788,6 +793,10 @@ export declare const zh: {
|
|
|
788
793
|
'skills.autoBacktest': string;
|
|
789
794
|
'skills.autoBacktestHint': string;
|
|
790
795
|
'skills.parameters': string;
|
|
796
|
+
'skills.draftGeneration': string;
|
|
797
|
+
'skills.draftMaxTokens': string;
|
|
798
|
+
'skills.draftRetryMaxTokens': string;
|
|
799
|
+
'skills.draftBudgetHint': string;
|
|
791
800
|
'skills.reviewThreshold': string;
|
|
792
801
|
'skills.idleSeconds': string;
|
|
793
802
|
'skills.cooldownSeconds': string;
|
|
@@ -230,6 +230,12 @@ export interface MemoryViewSpec {
|
|
|
230
230
|
explanation: string;
|
|
231
231
|
/** Trusted Strategy instructions, separate from quoted Source data. */
|
|
232
232
|
guidance?: MemoryViewGuidance;
|
|
233
|
+
/**
|
|
234
|
+
* Why this composition deliberately left an installed Source out (#504).
|
|
235
|
+
* The Host validates each entry and merges it into `view.diagnostics`; a
|
|
236
|
+
* diagnostic explains an absence, never grants a Source projection or routes.
|
|
237
|
+
*/
|
|
238
|
+
diagnostics?: MemoryCompositionDiagnostic[];
|
|
233
239
|
}
|
|
234
240
|
export interface MemoryViewGuidance {
|
|
235
241
|
system?: string;
|
|
@@ -388,7 +394,12 @@ export interface MemorySourceRuntimeContext {
|
|
|
388
394
|
/** Immutable, JSON-only Host/scope defaults; never business objects or clients. */
|
|
389
395
|
configuration?: Readonly<Record<string, MemoryJsonValue>>;
|
|
390
396
|
}
|
|
391
|
-
/**
|
|
397
|
+
/**
|
|
398
|
+
* Operation identity only; never the complete View or another Source's data.
|
|
399
|
+
* The object is stable for this Source within one execution, and can key weak
|
|
400
|
+
* execution-local state. Independent executions never share it, even when they
|
|
401
|
+
* pin the exact same immutable View. Requires dsh-mnemon 0.5.40 or later.
|
|
402
|
+
*/
|
|
392
403
|
export interface MemorySourceViewContext {
|
|
393
404
|
id: string;
|
|
394
405
|
scope: MemoryOperationScope;
|
|
@@ -16,6 +16,11 @@ export interface MemoryCompositionStatus {
|
|
|
16
16
|
serving: boolean;
|
|
17
17
|
/** The main Strategy composing the serving composition, which a fallback can make differ from the selected one. */
|
|
18
18
|
strategyTypeId?: string;
|
|
19
|
+
/** Strategy support only; session policy and review settings can still prevent a run. */
|
|
20
|
+
workflows?: {
|
|
21
|
+
idleReview: boolean;
|
|
22
|
+
runtimeCapacity: boolean;
|
|
23
|
+
};
|
|
19
24
|
evaluation: import('../core/contracts/index.ts').MemoryCompositionEvaluationReport;
|
|
20
25
|
sources: MemorySourceManagementInstance[];
|
|
21
26
|
configuration: ResolvedMemoryTopologyConfig;
|
|
@@ -302,6 +307,8 @@ export interface Config {
|
|
|
302
307
|
persistenceStrategy?: MemoryPersistenceStrategy;
|
|
303
308
|
/** Model route used by clean, session-independent maintenance Agents. */
|
|
304
309
|
taskAgentModel?: TaskAgentModelConfig;
|
|
310
|
+
/** Additional provider names for Hosts without enumeration and opaque provider plugins. */
|
|
311
|
+
subagentProviderNames?: string[];
|
|
305
312
|
/**
|
|
306
313
|
* Whether this profile runs Git repository sync at all. It lives here rather than
|
|
307
314
|
* in the data directory because the settings page has to draw the block without
|
|
@@ -362,6 +369,7 @@ export interface ResolvedConfig {
|
|
|
362
369
|
};
|
|
363
370
|
persistenceStrategy: ResolvedMemoryPersistenceStrategy;
|
|
364
371
|
taskAgentModel: ResolvedTaskAgentModelConfig;
|
|
372
|
+
subagentProviderNames: string[];
|
|
365
373
|
syncEnabled: boolean;
|
|
366
374
|
}
|
|
367
375
|
export interface ResolvedInteractionConfig {
|
|
@@ -381,6 +389,10 @@ export interface ResolvedSkillsConfig {
|
|
|
381
389
|
targetScope: 'storage' | 'user' | 'project';
|
|
382
390
|
/** Backtest a draft against the current version as soon as it is written. */
|
|
383
391
|
autoBacktest: boolean;
|
|
392
|
+
/** Output budget for a complete skill draft, including model reasoning. */
|
|
393
|
+
draftMaxTokens: number;
|
|
394
|
+
/** One fresh attempt after truncation, only when larger than draftMaxTokens. */
|
|
395
|
+
draftRetryMaxTokens: number;
|
|
384
396
|
/** The one-line skills bar under a finished turn. */
|
|
385
397
|
hints: boolean;
|
|
386
398
|
/** 技能管理 as a sidebar entry of its own instead of a Memory System page. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.41",
|
|
4
4
|
"description": "Composable, view-based context for DeepSeek Harness. Pluggable sources and strategies, with layered memory and self-evolving skills out of the box.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"deepseek-harness",
|
|
@@ -164,12 +164,12 @@
|
|
|
164
164
|
"dsh-mnemon-provider-openviking": "0.5.10",
|
|
165
165
|
"dsh-mnemon-provider-retaindb": "0.5.6",
|
|
166
166
|
"dsh-mnemon-provider-supermemory": "0.5.5",
|
|
167
|
-
"dsh-mnemon-source-documents": "0.5.
|
|
167
|
+
"dsh-mnemon-source-documents": "0.5.13",
|
|
168
168
|
"dsh-mnemon-source-memory-spaces": "0.5.25",
|
|
169
169
|
"dsh-mnemon-source-runtime": "0.5.17",
|
|
170
|
-
"dsh-mnemon-source-skills": "0.5.
|
|
170
|
+
"dsh-mnemon-source-skills": "0.5.8",
|
|
171
171
|
"dsh-mnemon-strategy-auto-capture": "0.5.5",
|
|
172
|
-
"dsh-mnemon-strategy-default-three-tier": "0.5.
|
|
172
|
+
"dsh-mnemon-strategy-default-three-tier": "0.5.12",
|
|
173
173
|
"dsh-mnemon-strategy-general": "0.5.1",
|
|
174
174
|
"dsh-mnemon-strategy-light-context": "0.5.6",
|
|
175
175
|
"dsh-mnemon-strategy-scoped": "0.5.5",
|