dsh-mnemon-strategy-default-three-tier 0.5.12 → 0.5.13
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/lib/index.d.ts +3 -3
- package/lib/index.js +9 -4
- package/package.json +3 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as projectionSDK from "dsh-mnemon/extension-sdk";
|
|
2
2
|
import { Context } from "@deepseek-ai/cordis";
|
|
3
3
|
//#region src/strategy.d.ts
|
|
4
4
|
/** Pure View composition; no dependency on any Source implementation. */
|
|
5
5
|
declare const DEFAULT_THREE_TIER_VIEW_STRATEGY: {
|
|
6
|
-
createTurn: (view:
|
|
6
|
+
createTurn: (view: projectionSDK.ComposableMemoryView) => projectionSDK.MemoryStrategyTurn;
|
|
7
7
|
manifest: {
|
|
8
8
|
apiVersion: "dsh-mnemon/v1";
|
|
9
9
|
kind: "strategy";
|
|
@@ -17,7 +17,7 @@ declare const DEFAULT_THREE_TIER_VIEW_STRATEGY: {
|
|
|
17
17
|
extensionSlots: string[];
|
|
18
18
|
workflows: ("idle-review" | "runtime-capacity")[];
|
|
19
19
|
};
|
|
20
|
-
compose(request: MemoryViewRequest, sources: readonly MemoryAvailableSource[], contributions?: readonly
|
|
20
|
+
compose(request: projectionSDK.MemoryViewRequest, sources: readonly projectionSDK.MemoryAvailableSource[], contributions?: readonly projectionSDK.MemoryStrategyContribution[] | undefined): projectionSDK.MemoryViewSpec;
|
|
21
21
|
};
|
|
22
22
|
//#endregion
|
|
23
23
|
//#region src/index.d.ts
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { threeTierContributions } from "./extension-sdk.js";
|
|
2
|
+
import * as projectionSDK from "dsh-mnemon/extension-sdk";
|
|
2
3
|
import { defineMemoryPlugin, defineMemoryStrategy, defineMemoryStrategyConfiguration, installMemory, memoryInputRecord, truncateMemoryText } from "dsh-mnemon/extension-sdk";
|
|
3
4
|
import { COMPOSABLE_MEMORY_API_VERSION } from "dsh-mnemon/contracts";
|
|
4
5
|
import { createHash, randomUUID } from "node:crypto";
|
|
@@ -556,9 +557,13 @@ const DEFAULT_THREE_TIER_VIEW_STRATEGY = defineMemoryStrategy({
|
|
|
556
557
|
},
|
|
557
558
|
compose(request, sources, contributions = []) {
|
|
558
559
|
const diagnostics = unsupportedRoleDiagnostics(sources);
|
|
559
|
-
const explained = (spec
|
|
560
|
-
|
|
561
|
-
|
|
560
|
+
const explained = (spec, budget = request.budget.maxProjectionCharacters) => {
|
|
561
|
+
if (typeof projectionSDK.reserveMemoryProjection !== "function" && sources.some((source) => source.hints && typeof source.hints === "object" && !Array.isArray(source.hints) && Number(source.hints.minimumProjectionCharacters) > 0)) throw new Error("Pinned Runtime requires a newer dsh-mnemon Host; update the Host and official Strategies together.");
|
|
562
|
+
const reserved = projectionSDK.reserveMemoryProjection?.(spec, sources, budget) ?? spec;
|
|
563
|
+
return diagnostics.length === 0 ? reserved : {
|
|
564
|
+
...reserved,
|
|
565
|
+
diagnostics
|
|
566
|
+
};
|
|
562
567
|
};
|
|
563
568
|
if (contributions.length === 0) return explained(composeThreeTier(request, sources));
|
|
564
569
|
const policies = threeTierContributions(contributions);
|
|
@@ -569,7 +574,7 @@ const DEFAULT_THREE_TIER_VIEW_STRATEGY = defineMemoryStrategy({
|
|
|
569
574
|
maxProjectionCharacters: Math.min(request.budget.maxProjectionCharacters, policies.projection.maxProjectionCharacters)
|
|
570
575
|
}
|
|
571
576
|
};
|
|
572
|
-
const spec = explained(policies.selection === void 0 ? composeThreeTier(boundedRequest, sources) : composeSelected(boundedRequest, sources, policies.selection));
|
|
577
|
+
const spec = explained(policies.selection === void 0 ? composeThreeTier(boundedRequest, sources) : composeSelected(boundedRequest, sources, policies.selection), boundedRequest.budget.maxProjectionCharacters);
|
|
573
578
|
if (policies.capture !== void 0) {
|
|
574
579
|
const targets = spec.sources.filter((selected) => (policies.capture.sourceKeys === void 0 || policies.capture.sourceKeys.includes(selected.sourceInstanceKey)) && sources.some((source) => source.sourceInstanceKey === selected.sourceInstanceKey && source.actions.some((action) => selected.actionIds?.includes(action.id) && policies.capture.actionIds.includes(action.id) && action.authority === void 0 && ["write", "maintain"].includes(action.capability))));
|
|
575
580
|
if (targets.length > 0) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mnemon-strategy-default-three-tier",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.13",
|
|
4
4
|
"description": "Explicit three-tier View Strategy for Composable View Memory.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -32,11 +32,11 @@
|
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
35
|
-
"dsh-mnemon": "^0.5.
|
|
35
|
+
"dsh-mnemon": "^0.5.43"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^22.0.0",
|
|
39
|
-
"dsh-mnemon": "^0.5.
|
|
39
|
+
"dsh-mnemon": "^0.5.43",
|
|
40
40
|
"tsdown": "^0.22.0",
|
|
41
41
|
"typescript": "^5.9.0",
|
|
42
42
|
"vitest": "^3.2.0"
|