dsh-cross-memory 0.2.8 → 0.2.9
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 +12 -2
- package/docs/DETAIL.md +1 -0
- package/docs/DETAIL.zh.md +1 -0
- package/lib/bm25.js +100 -0
- package/lib/cards.js +188 -0
- package/lib/client.js +195 -1
- package/lib/config.js +7 -4
- package/lib/index.js +131 -42
- package/lib/render.js +71 -18
- package/lib/search.js +33 -53
- package/lib/test/injection.test.js +18 -2
- package/lib/test/proposal-card.test.js +353 -0
- package/lib/tokenize.js +68 -0
- package/lib/types/bm25.d.ts +66 -0
- package/lib/types/cards.d.ts +186 -0
- package/lib/types/config.d.ts +7 -4
- package/lib/types/index.d.ts +24 -8
- package/lib/types/render.d.ts +1 -0
- package/lib/types/search.d.ts +1 -21
- package/lib/types/test/proposal-card.test.d.ts +1 -0
- package/lib/types/tokenize.d.ts +39 -0
- package/package.json +8 -4
package/lib/types/config.d.ts
CHANGED
|
@@ -281,13 +281,16 @@ export declare const DEFAULT_EXTRACT_TIMEOUT_MS = 120000;
|
|
|
281
281
|
/**
|
|
282
282
|
* Default max drafts one extraction may produce.
|
|
283
283
|
*
|
|
284
|
-
*
|
|
284
|
+
* 12 rather than 5, then 8: on a real production session, an audit of 50 Mubea
|
|
285
285
|
* Invoice-Insight conversations found 247 durable facts, and the cap of 5 was
|
|
286
286
|
* the single biggest cause of missed material on long sessions (one audit
|
|
287
|
-
* session held 16 facts and kept 5).
|
|
288
|
-
*
|
|
287
|
+
* session held 16 facts and kept 5). The real-session bench then measured a
|
|
288
|
+
* clean dose-response on one fixed corpus: 5 → 19/33, 10 → 22/33, 20 → 24/33,
|
|
289
|
+
* so the curve is still rising at 20 but flattening. Twelve is where the next
|
|
290
|
+
* step buys about one more answered question per extra pass, before the entry
|
|
291
|
+
* count (and the consolidation load it creates) starts to dominate.
|
|
289
292
|
*/
|
|
290
|
-
export declare const DEFAULT_EXTRACT_MAX_MEMORIES =
|
|
293
|
+
export declare const DEFAULT_EXTRACT_MAX_MEMORIES = 12;
|
|
291
294
|
/**
|
|
292
295
|
* What the extractor is allowed to keep, by default.
|
|
293
296
|
*
|
package/lib/types/index.d.ts
CHANGED
|
@@ -356,9 +356,20 @@ export declare class MemoriesRuntime {
|
|
|
356
356
|
* Apply every waiting decision.
|
|
357
357
|
*
|
|
358
358
|
* @param _parent - the agent asking; the stored rows carry their own scope.
|
|
359
|
-
* @returns
|
|
359
|
+
* @returns the command's report plus the counts the action-card decision
|
|
360
|
+
* records, or `undefined` when nothing is staged.
|
|
361
|
+
*/
|
|
362
|
+
applyPendingPlan(_parent: Agent): Promise<{
|
|
363
|
+
text: string;
|
|
364
|
+
written: number;
|
|
365
|
+
retired: number;
|
|
366
|
+
} | undefined>;
|
|
367
|
+
/**
|
|
368
|
+
* Discard every waiting decision, leaving the store untouched.
|
|
369
|
+
*
|
|
370
|
+
* @returns how many decisions were dropped, or `undefined` when nothing was staged.
|
|
360
371
|
*/
|
|
361
|
-
|
|
372
|
+
rejectPendingPlan(): Promise<number | undefined>;
|
|
362
373
|
/**
|
|
363
374
|
* A warning when this workspace's memory directory is shared with another
|
|
364
375
|
* repository of the same name.
|
|
@@ -927,12 +938,17 @@ export declare class MemoriesRuntime {
|
|
|
927
938
|
/**
|
|
928
939
|
* Speak without being asked, when there is something to say.
|
|
929
940
|
*
|
|
930
|
-
* Two deterministic triggers
|
|
931
|
-
*
|
|
932
|
-
*
|
|
933
|
-
*
|
|
934
|
-
*
|
|
935
|
-
*
|
|
941
|
+
* Two deterministic triggers: a daily line about what the plugin maintained,
|
|
942
|
+
* and a promise whose deadline has passed. Both are judgements a rule can
|
|
943
|
+
* make, which is why they are the ones allowed to interrupt. Everything
|
|
944
|
+
* smarter (reflections) enters here later through the same queue, and the
|
|
945
|
+
* same rules apply: evidence or silence, and never the same subject twice.
|
|
946
|
+
*
|
|
947
|
+
* A staged consolidation proposal no longer comes through this pump: its
|
|
948
|
+
* backlog branch could not reach the user in this deployment (macOS
|
|
949
|
+
* `osascript` is unavailable, so every delivery logged `no channel for notice
|
|
950
|
+
* backlog`), and the answer card plus the injected draft note are the
|
|
951
|
+
* confirmation path now.
|
|
936
952
|
*
|
|
937
953
|
* Called from the once-per-conversation hook and from the maintenance sweep. A
|
|
938
954
|
* failure is logged and swallowed: speaking is never allowed to break a turn.
|
package/lib/types/render.d.ts
CHANGED
|
@@ -137,6 +137,7 @@ export declare function selectForSummary(entries: readonly MemoryEntry[], perSco
|
|
|
137
137
|
freshSlots?: number;
|
|
138
138
|
now?: number;
|
|
139
139
|
query?: string;
|
|
140
|
+
ranked?: readonly MemoryEntry[];
|
|
140
141
|
}): MemoryEntry[];
|
|
141
142
|
/** One scope's contribution to the injected summary. */
|
|
142
143
|
export interface SummaryScope {
|
package/lib/types/search.d.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import type { MemoryEntry, MemoryHit, MemoryKind, MemoryScope } from './types.js';
|
|
19
19
|
import { type TimeRange } from './time.js';
|
|
20
|
+
export { tokenize, termWeight } from './tokenize.js';
|
|
20
21
|
/** Score added when the whole query appears verbatim in one field. */
|
|
21
22
|
export declare const FIELD_WEIGHTS: {
|
|
22
23
|
readonly title: 40;
|
|
@@ -75,27 +76,6 @@ export interface MatchEvidence {
|
|
|
75
76
|
}
|
|
76
77
|
/** Most body occurrences of one term that still earn score. */
|
|
77
78
|
export declare const BODY_TERM_CAP = 4;
|
|
78
|
-
/** Split text into searchable terms: ASCII words and CJK character bigrams.
|
|
79
|
-
*
|
|
80
|
-
* A CJK run also contributes bigrams of its neighbours, so "该插件是否有日志"
|
|
81
|
-
* yields "该插","插件","件是","是否","否有","有日","日志". A one-character run
|
|
82
|
-
* contributes itself, since a lone ideograph has no bigram.
|
|
83
|
-
*
|
|
84
|
-
* @param text - raw text.
|
|
85
|
-
* @returns lowercase terms; a run that yields nothing contributes nothing.
|
|
86
|
-
*/
|
|
87
|
-
export declare function tokenize(text: string): string[];
|
|
88
|
-
/**
|
|
89
|
-
* A term's weight for scoring purposes.
|
|
90
|
-
*
|
|
91
|
-
* One CJK bigram is a much weaker claim than one Latin word — "日志" occurs in
|
|
92
|
-
* countless texts where "logging" does not — so a bigram earns less. Without
|
|
93
|
-
* this every Chinese question would clear the recall gate on noise alone.
|
|
94
|
-
*
|
|
95
|
-
* @param term - one term from {@link tokenize}.
|
|
96
|
-
* @returns a multiplier in `(0, 1]`.
|
|
97
|
-
*/
|
|
98
|
-
export declare function termWeight(term: string): number;
|
|
99
79
|
/**
|
|
100
80
|
* Build (or reuse) the term index for one entry array.
|
|
101
81
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The tokenizer shared by every lexical path in the plugin.
|
|
3
|
+
*
|
|
4
|
+
* Split out of `search.ts` so the BM25 ranker can use the exact same terms as
|
|
5
|
+
* the hand-weighted scorer without a circular import: the two rankers are
|
|
6
|
+
* supposed to agree on what a "term" is, and a copy of this file would be the
|
|
7
|
+
* first thing to drift.
|
|
8
|
+
*
|
|
9
|
+
* Chinese is the reason this module exists. A query with no spaces
|
|
10
|
+
* ("该插件是否有日志") tokenizes to one indivisible run under any whitespace
|
|
11
|
+
* splitter, so a whole-run substring test is the only thing that could match —
|
|
12
|
+
* and a memory almost never contains a whole question verbatim. Every
|
|
13
|
+
* comparison therefore runs over CJK character bigrams as well.
|
|
14
|
+
*
|
|
15
|
+
* @module dsh-cross-memory/tokenize
|
|
16
|
+
*/
|
|
17
|
+
/** Split text into searchable terms: ASCII words and CJK character bigrams.
|
|
18
|
+
*
|
|
19
|
+
* A CJK run also contributes bigrams of its neighbours, so "该插件是否有日志"
|
|
20
|
+
* yields "该插","插件","件是","是否","否有","有日","日志". A one-character run
|
|
21
|
+
* contributes itself, since a lone ideograph has no bigram.
|
|
22
|
+
*
|
|
23
|
+
* @param text - raw text.
|
|
24
|
+
* @returns lowercase terms; a run that yields nothing contributes nothing.
|
|
25
|
+
*/
|
|
26
|
+
export declare function tokenize(text: string): string[];
|
|
27
|
+
/**
|
|
28
|
+
* A term's weight for scoring purposes.
|
|
29
|
+
*
|
|
30
|
+
* One CJK bigram is a much weaker claim than one Latin word — "日志" occurs in
|
|
31
|
+
* countless texts where "logging" does not — so a bigram earns less. Without
|
|
32
|
+
* this every Chinese question would clear the recall gate on noise alone.
|
|
33
|
+
*
|
|
34
|
+
* @param term - one term from {@link tokenize}.
|
|
35
|
+
* @returns a multiplier in `(0, 1]`.
|
|
36
|
+
*/
|
|
37
|
+
export declare function termWeight(term: string): number;
|
|
38
|
+
/** A short token carries little signal and is skipped as a query term. */
|
|
39
|
+
export declare function isNoise(token: string): boolean;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-cross-memory",
|
|
3
3
|
"description": "Cross-session memory for the DeepSeek Harness: project-scoped and global memories with an explicit memory tool, idle-time background extraction, consolidation, and layered summary injection",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.9",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
},
|
|
55
55
|
"engines": {
|
|
56
56
|
"node": ">=24",
|
|
57
|
-
"dsh": "^0.2.1-rc.2 || ^0.2.2-alpha.2"
|
|
57
|
+
"dsh": "^0.2.1-rc.2 || ^0.2.2-alpha.2 || ^0.2.3-alpha.1"
|
|
58
58
|
},
|
|
59
59
|
"dsh": {
|
|
60
60
|
"manifestVersion": 1,
|
|
@@ -64,7 +64,8 @@
|
|
|
64
64
|
"client": {
|
|
65
65
|
"inject": [
|
|
66
66
|
"@deepseek-ai/dsh-client-ui-settings",
|
|
67
|
-
"@deepseek-ai/dsh-client-ui-slots"
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-slots",
|
|
68
|
+
"@deepseek-ai/dsh-client-ui-action-cards"
|
|
68
69
|
],
|
|
69
70
|
"external": [
|
|
70
71
|
"@deepseek-ai/dsh-client-ui-settings/client"
|
|
@@ -105,6 +106,7 @@
|
|
|
105
106
|
"devDependencies": {
|
|
106
107
|
"@deepseek-ai/cordis": "4.1.0",
|
|
107
108
|
"@deepseek-ai/cordis-plugin-loader": "^1.1.0",
|
|
109
|
+
"@deepseek-ai/dsh-action-cards": "0.2.3-alpha.2",
|
|
108
110
|
"@deepseek-ai/dsh-agent": "0.2.2-rc.1",
|
|
109
111
|
"@deepseek-ai/dsh-attachment": "0.2.2-rc.1",
|
|
110
112
|
"@deepseek-ai/dsh-commands": "0.2.2-rc.1",
|
|
@@ -113,6 +115,7 @@
|
|
|
113
115
|
"@deepseek-ai/dsh-scope": "0.2.2-rc.1",
|
|
114
116
|
"@deepseek-ai/dsh-session": "0.2.2-rc.1",
|
|
115
117
|
"@deepseek-ai/dsh-session-projection": "0.2.2-rc.1",
|
|
118
|
+
"@deepseek-ai/dsh-skill": "0.2.3-alpha.2",
|
|
116
119
|
"@deepseek-ai/dsh-system-prompt": "0.2.2-rc.1",
|
|
117
120
|
"@deepseek-ai/dsh-tools": "0.2.2-rc.1",
|
|
118
121
|
"@deepseek-ai/dsh-user-approval": "0.2.2-rc.1",
|
|
@@ -122,7 +125,8 @@
|
|
|
122
125
|
"typescript": "^7.0.2"
|
|
123
126
|
},
|
|
124
127
|
"dependencies": {
|
|
125
|
-
"@deepseek-ai/cosmokit": "^1.9.0"
|
|
128
|
+
"@deepseek-ai/cosmokit": "^1.9.0",
|
|
129
|
+
"zod": "^4.6.7"
|
|
126
130
|
},
|
|
127
131
|
"icon": "./icon.svg"
|
|
128
132
|
}
|