dsh-cross-memory 0.2.2 → 0.2.4
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 +92 -94
- package/docs/DETAIL.md +75 -10
- package/docs/DETAIL.zh.md +74 -13
- package/lib/backfill.js +1 -0
- package/lib/client.js +6 -1
- package/lib/config.js +50 -18
- package/lib/consolidate.js +123 -35
- package/lib/extract.js +133 -25
- package/lib/index.js +210 -45
- package/lib/loops.js +9 -4
- package/lib/render.js +2 -2
- package/lib/search.js +141 -18
- package/lib/storage.js +8 -0
- package/lib/sync.js +96 -1
- package/lib/test/consolidate.test.js +102 -2
- package/lib/test/extract.test.js +59 -2
- package/lib/test/recall.test.js +59 -26
- package/lib/test/retrieval.test.js +46 -1
- package/lib/test/rotation.test.js +5 -2
- package/lib/test/subagent-contract.test.js +8 -0
- package/lib/test/sync.test.js +46 -1
- package/lib/tool.js +9 -1
- package/lib/types/backfill.d.ts +10 -0
- package/lib/types/config.d.ts +49 -15
- package/lib/types/consolidate.d.ts +44 -14
- package/lib/types/extract.d.ts +95 -3
- package/lib/types/index.d.ts +52 -4
- package/lib/types/search.d.ts +68 -0
- package/lib/types/sync.d.ts +12 -0
- package/lib/types/types.d.ts +8 -0
- package/package.json +1 -1
package/lib/types/extract.d.ts
CHANGED
|
@@ -22,7 +22,46 @@ export interface ExtractWindow {
|
|
|
22
22
|
readonly seq: number;
|
|
23
23
|
readonly text: string;
|
|
24
24
|
}[];
|
|
25
|
+
/**
|
|
26
|
+
* Unmined prose messages this window left out.
|
|
27
|
+
*
|
|
28
|
+
* Non-zero means the transcript grew faster than the window cap: the newest
|
|
29
|
+
* window would then step over everything in the middle, and the watermark
|
|
30
|
+
* would skip it forever. The caller reads this as "there is a backlog" and
|
|
31
|
+
* mines the oldest contiguous window instead, so no message is ever skipped.
|
|
32
|
+
*/
|
|
33
|
+
readonly skipped: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* One stored title offered to the extractor for deduplication.
|
|
37
|
+
*
|
|
38
|
+
* `updatedAt` is only the tie-break: when the window shares no vocabulary with
|
|
39
|
+
* any stored title, the newest titles are still the ones most likely to be
|
|
40
|
+
* re-derived.
|
|
41
|
+
*/
|
|
42
|
+
export interface KnownTitleCandidate {
|
|
43
|
+
/** The stored title, exactly as it will be shown to the extractor. */
|
|
44
|
+
readonly title: string;
|
|
45
|
+
/** When the entry it belongs to was last written. */
|
|
46
|
+
readonly updatedAt: number;
|
|
25
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Pick the known titles most worth showing one extraction window.
|
|
50
|
+
*
|
|
51
|
+
* The list used to be taken in time order and cut at a fixed cap, which on a
|
|
52
|
+
* store larger than the cap hid every older title from the extractor: it could
|
|
53
|
+
* not recognise a fact it had already recorded, and wrote a second entry under
|
|
54
|
+
* a re-worded title. Ranking by overlap with the window fixes that within the
|
|
55
|
+
* same budget — the titles the window is actually about are the ones it might
|
|
56
|
+
* re-derive — while the recency tie-break keeps a representative sample when
|
|
57
|
+
* nothing overlaps.
|
|
58
|
+
*
|
|
59
|
+
* @param candidates - every title in the scopes this pass may write to.
|
|
60
|
+
* @param windowText - the transcript window about to be mined.
|
|
61
|
+
* @param limit - most titles to return; `0` returns none.
|
|
62
|
+
* @returns the selected titles, most relevant first.
|
|
63
|
+
*/
|
|
64
|
+
export declare function selectKnownTitles(candidates: readonly KnownTitleCandidate[], windowText: string, limit: number): string[];
|
|
26
65
|
/**
|
|
27
66
|
* The system instruction for the extraction call.
|
|
28
67
|
*
|
|
@@ -85,6 +124,12 @@ export declare const EXTRACT_JSON_SCHEMA: {
|
|
|
85
124
|
readonly type: 'string';
|
|
86
125
|
};
|
|
87
126
|
};
|
|
127
|
+
readonly entities: {
|
|
128
|
+
readonly type: 'array';
|
|
129
|
+
readonly items: {
|
|
130
|
+
readonly type: 'string';
|
|
131
|
+
};
|
|
132
|
+
};
|
|
88
133
|
readonly appliesTo: {
|
|
89
134
|
readonly type: 'string';
|
|
90
135
|
};
|
|
@@ -143,10 +188,31 @@ export declare function redactSecrets(text: string): string;
|
|
|
143
188
|
* @param session - session to read.
|
|
144
189
|
* @param afterSeq - last surface seq already mined (exclusive).
|
|
145
190
|
* @param maxMessages - message cap.
|
|
146
|
-
* @param maxChars - transcript character cap
|
|
147
|
-
* @
|
|
191
|
+
* @param maxChars - transcript character cap.
|
|
192
|
+
* @param order - which end of the backlog to keep. `newest` (the default) is
|
|
193
|
+
* the right window for a session that is nearly caught up; `oldest` is the
|
|
194
|
+
* contiguous one, and it is the only order that cannot skip a message.
|
|
195
|
+
* @returns the rendered window, the highest included seq, and how much it left out.
|
|
196
|
+
*/
|
|
197
|
+
export declare function collectWindow(session: Session, afterSeq: number, maxMessages: number, maxChars: number, order?: 'newest' | 'oldest'): ExtractWindow;
|
|
198
|
+
/**
|
|
199
|
+
* The window one extraction pass should mine, preferring contiguity.
|
|
200
|
+
*
|
|
201
|
+
* The newest window is what a session that is nearly caught up wants: it is the
|
|
202
|
+
* most recent material. It cannot be the only order, because the message cap
|
|
203
|
+
* silently drops everything between the watermark and the tail — measured on a
|
|
204
|
+
* long session, one 400-message gap left 340 messages never mined while the
|
|
205
|
+
* watermark stepped over all of them. So: take the newest window, and when it
|
|
206
|
+
* reports a backlog, take the oldest contiguous one instead. The pass cadence
|
|
207
|
+
* then drains the backlog chunk by chunk and nothing is skipped.
|
|
208
|
+
*
|
|
209
|
+
* @param session - session to read.
|
|
210
|
+
* @param afterSeq - last surface seq already mined (exclusive).
|
|
211
|
+
* @param maxMessages - message cap per window.
|
|
212
|
+
* @param maxChars - character cap per window.
|
|
213
|
+
* @returns the window to mine.
|
|
148
214
|
*/
|
|
149
|
-
export declare function
|
|
215
|
+
export declare function collectExtractionWindow(session: Session, afterSeq: number, maxMessages: number, maxChars: number): ExtractWindow;
|
|
150
216
|
/**
|
|
151
217
|
* Resolve the provider/model route for a model call.
|
|
152
218
|
*
|
|
@@ -191,12 +257,30 @@ export declare function parseExtraction(text: string, maxMemories: number, sessi
|
|
|
191
257
|
summary: string;
|
|
192
258
|
dropped: number;
|
|
193
259
|
};
|
|
260
|
+
/**
|
|
261
|
+
* One candidate the evidence check threw away, kept so the loss is readable.
|
|
262
|
+
*
|
|
263
|
+
* The count alone was the only trace of this path, and a count cannot answer
|
|
264
|
+
* the question a reader actually has: was the model paraphrasing (a prompt or
|
|
265
|
+
* route problem) or did it invent a plausible sentence? The title says what was
|
|
266
|
+
* lost; the quote preview says why.
|
|
267
|
+
*/
|
|
268
|
+
export interface DroppedDraft {
|
|
269
|
+
/** Title the model proposed. */
|
|
270
|
+
readonly title: string;
|
|
271
|
+
/** First characters of the quote, or empty when none was offered. */
|
|
272
|
+
readonly quotePreview: string;
|
|
273
|
+
/** Why it failed: no quote at all, a quote too short, or one the transcript lacks. */
|
|
274
|
+
readonly reason: 'no-quote' | 'quote-too-short' | 'not-in-transcript';
|
|
275
|
+
}
|
|
194
276
|
/** What {@link bindEvidence} made of one reply. */
|
|
195
277
|
export interface EvidenceBinding {
|
|
196
278
|
/** Drafts that carry a quote found verbatim in the window's messages. */
|
|
197
279
|
readonly drafts: readonly MemoryDraft[];
|
|
198
280
|
/** Drafts dropped because the quote was missing, too short, or not in the transcript. */
|
|
199
281
|
readonly unsupported: number;
|
|
282
|
+
/** The dropped candidates, described well enough to log and diagnose. */
|
|
283
|
+
readonly dropped: readonly DroppedDraft[];
|
|
200
284
|
}
|
|
201
285
|
/**
|
|
202
286
|
* Check every draft's quote against the transcript it claims to come from.
|
|
@@ -288,6 +372,14 @@ export type ExtractionOutcome = {
|
|
|
288
372
|
* an unusually quiet extractor.
|
|
289
373
|
*/
|
|
290
374
|
readonly unsupported: number;
|
|
375
|
+
/**
|
|
376
|
+
* The candidates that check rejected, when there were any.
|
|
377
|
+
*
|
|
378
|
+
* Carried out of the call so the caller can log what was lost instead of
|
|
379
|
+
* only how much: a bare count cannot distinguish a paraphrasing model from
|
|
380
|
+
* an inventive one.
|
|
381
|
+
*/
|
|
382
|
+
readonly droppedEvidence?: readonly DroppedDraft[];
|
|
291
383
|
readonly route: ExtractionRoute;
|
|
292
384
|
/**
|
|
293
385
|
* Whether the reply was cut short by the output cap and salvaged.
|
package/lib/types/index.d.ts
CHANGED
|
@@ -96,6 +96,10 @@ export declare class MemoriesRuntime {
|
|
|
96
96
|
private consolidateSkip;
|
|
97
97
|
/** Hub-term predicates by store signature; see `hubFor`. */
|
|
98
98
|
private readonly hubCache;
|
|
99
|
+
/** Last project-slug conflict scan, with the time it ran. */
|
|
100
|
+
private conflictScan;
|
|
101
|
+
/** Whether the conflict scan has already logged its findings once. */
|
|
102
|
+
private conflictLogged;
|
|
99
103
|
/** Sessions whose conversation already carries the memory block. */
|
|
100
104
|
private readonly injected;
|
|
101
105
|
/** Recall deltas already injected into each conversation. */
|
|
@@ -217,6 +221,25 @@ export declare class MemoriesRuntime {
|
|
|
217
221
|
kinds?: readonly MemoryKind[];
|
|
218
222
|
limit?: number;
|
|
219
223
|
}): Promise<import("./types.js").MemoryHit[]>;
|
|
224
|
+
/**
|
|
225
|
+
* The vocabulary this store files memories under, for a query that found
|
|
226
|
+
* nothing.
|
|
227
|
+
*
|
|
228
|
+
* Search is lexical, so a query phrased in the user's words cannot reach a
|
|
229
|
+
* memory filed under the product's words. Returning the aliases and tags that
|
|
230
|
+
* share characters with the query is what lets the caller try again with the
|
|
231
|
+
* store's own terms instead of concluding the fact was never recorded.
|
|
232
|
+
*
|
|
233
|
+
* @param session - conversation asking.
|
|
234
|
+
* @param query - the query that returned nothing.
|
|
235
|
+
* @param limit - most terms to return.
|
|
236
|
+
* @returns shared terms first, then the most widely used ones.
|
|
237
|
+
*/
|
|
238
|
+
aliasHints(session: Session, query: string, limit?: number): Promise<{
|
|
239
|
+
term: string;
|
|
240
|
+
carriers: number;
|
|
241
|
+
matched: number;
|
|
242
|
+
}[]>;
|
|
220
243
|
/** Read one entry by scope and id, recording the hit. */
|
|
221
244
|
read(session: Session, scope: MemoryScope, id: string, record?: boolean): Promise<MemoryEntry | undefined>;
|
|
222
245
|
/**
|
|
@@ -265,10 +288,16 @@ export declare class MemoriesRuntime {
|
|
|
265
288
|
* cap. Extraction is otherwise blind to what is already known, which is how one
|
|
266
289
|
* session's lesson ended up stored twice — once in Chinese, once in English.
|
|
267
290
|
*
|
|
291
|
+
* The whole scope is returned, uncapped; the caller ranks it against the
|
|
292
|
+
* window with {@link selectKnownTitles} and only then cuts. Cutting here was
|
|
293
|
+
* the bug: on a store larger than the cap, every title past the cut was
|
|
294
|
+
* invisible to the extractor, which then re-derived those facts under new
|
|
295
|
+
* titles.
|
|
296
|
+
*
|
|
268
297
|
* @param root - the session's project root, when it has one.
|
|
269
|
-
* @returns
|
|
298
|
+
* @returns every candidate title with its write time.
|
|
270
299
|
*/
|
|
271
|
-
private
|
|
300
|
+
private knownTitleCandidates;
|
|
272
301
|
/** Delete one entry. */
|
|
273
302
|
forget(session: Session, scope: MemoryScope, id: string): Promise<boolean>;
|
|
274
303
|
/**
|
|
@@ -330,6 +359,23 @@ export declare class MemoriesRuntime {
|
|
|
330
359
|
* @returns a human-readable summary, or `undefined` when nothing is staged.
|
|
331
360
|
*/
|
|
332
361
|
applyPendingPlan(_parent: Agent): Promise<string | undefined>;
|
|
362
|
+
/**
|
|
363
|
+
* A warning when this workspace's memory directory is shared with another
|
|
364
|
+
* repository of the same name.
|
|
365
|
+
*
|
|
366
|
+
* `projectSlug` keys a project by its basename, which is what lets one
|
|
367
|
+
* repository checked out at two paths on two machines share one memory
|
|
368
|
+
* directory. The accepted cost is that two unrelated repositories called
|
|
369
|
+
* `backend` also share one — and the failure is silent and confusing: each
|
|
370
|
+
* project's memories are injected into the other's sessions, with nothing
|
|
371
|
+
* saying why. The store already records every host's git origin; two
|
|
372
|
+
* different origins for one slug is the proof. This surfaces it once per
|
|
373
|
+
* injected conversation, in the block the model actually reads.
|
|
374
|
+
*
|
|
375
|
+
* @param root - the session's project root, when it has one.
|
|
376
|
+
* @returns the warning line, or `undefined` when there is no collision.
|
|
377
|
+
*/
|
|
378
|
+
private conflictNote;
|
|
333
379
|
/**
|
|
334
380
|
* The one line this plugin wants in the summary but cannot express as a memory.
|
|
335
381
|
*
|
|
@@ -489,8 +535,8 @@ export declare class MemoriesRuntime {
|
|
|
489
535
|
* later is invisible until the model thinks to search for it. This path names
|
|
490
536
|
* only entries whose `updated` stamp is newer than the last injection, and
|
|
491
537
|
* only those the conversation has not already been shown, so it is a short
|
|
492
|
-
* paragraph rather than a second summary. Two per conversation,
|
|
493
|
-
* each: the block is a nudge, not a channel.
|
|
538
|
+
* paragraph rather than a second summary. Two per conversation, at
|
|
539
|
+
* `deltaMaxBytes` each: the block is a nudge, not a channel.
|
|
494
540
|
*
|
|
495
541
|
* @param agent - the agent whose next step is being prepared.
|
|
496
542
|
* @returns the message to append, or `undefined` when nothing new is worth it.
|
|
@@ -1200,6 +1246,7 @@ export declare const Config: import("@deepseek-ai/schemastery").default<Schemast
|
|
|
1200
1246
|
recallMinQueryChars: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1201
1247
|
recallMinTerms: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1202
1248
|
injectDelta: import("@deepseek-ai/schemastery").default<boolean, boolean, "volatile-defined">;
|
|
1249
|
+
deltaMaxBytes: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1203
1250
|
rotationEntries: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1204
1251
|
rotationEveryTurns: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1205
1252
|
maxEntriesPerScope: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
@@ -1269,6 +1316,7 @@ export declare const Config: import("@deepseek-ai/schemastery").default<Schemast
|
|
|
1269
1316
|
recallMinQueryChars: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1270
1317
|
recallMinTerms: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1271
1318
|
injectDelta: import("@deepseek-ai/schemastery").default<boolean, boolean, "volatile-defined">;
|
|
1319
|
+
deltaMaxBytes: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1272
1320
|
rotationEntries: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1273
1321
|
rotationEveryTurns: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
|
1274
1322
|
maxEntriesPerScope: import("@deepseek-ai/schemastery").default<number, number, "volatile-defined">;
|
package/lib/types/search.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { type TimeRange } from './time.js';
|
|
|
21
21
|
export declare const FIELD_WEIGHTS: {
|
|
22
22
|
readonly title: 40;
|
|
23
23
|
readonly keys: 26;
|
|
24
|
+
readonly entities: 24;
|
|
24
25
|
readonly tags: 20;
|
|
25
26
|
readonly appliesTo: 18;
|
|
26
27
|
readonly body: 12;
|
|
@@ -35,6 +36,7 @@ export declare const FIELD_WEIGHTS: {
|
|
|
35
36
|
export declare const TERM_WEIGHTS: {
|
|
36
37
|
readonly title: 8;
|
|
37
38
|
readonly keys: 7;
|
|
39
|
+
readonly entities: 7;
|
|
38
40
|
readonly tags: 6;
|
|
39
41
|
readonly appliesTo: 5;
|
|
40
42
|
readonly body: 2;
|
|
@@ -370,6 +372,8 @@ export interface MatchCredit {
|
|
|
370
372
|
/** The structural evidence behind the score. */
|
|
371
373
|
readonly evidence: MatchEvidence;
|
|
372
374
|
}
|
|
375
|
+
/** One field a match may be scored against. */
|
|
376
|
+
export type ScoreField = 'title' | 'keys' | 'entities' | 'tags' | 'appliesTo' | 'body';
|
|
373
377
|
/** How strictly {@link matchCredit} applies its structural gate. */
|
|
374
378
|
export interface CreditOptions {
|
|
375
379
|
/**
|
|
@@ -407,6 +411,16 @@ export interface CreditOptions {
|
|
|
407
411
|
* hatch untouched — this only changes what "two terms" means.
|
|
408
412
|
*/
|
|
409
413
|
readonly hub?: (term: string) => boolean;
|
|
414
|
+
/**
|
|
415
|
+
* Which fields may produce score and evidence; omitted means every field.
|
|
416
|
+
*
|
|
417
|
+
* The alias fallback passes `['keys', 'appliesTo']` so a relaxed single-term
|
|
418
|
+
* pass cannot be carried by a body word. A body mention is the weakest claim
|
|
419
|
+
* in the store — a long memory mentions many things — while a `keys` entry is
|
|
420
|
+
* a deliberate statement that this is another name for the memory. Widening
|
|
421
|
+
* the gate for the latter must not widen it for the former.
|
|
422
|
+
*/
|
|
423
|
+
readonly fields?: readonly ScoreField[];
|
|
410
424
|
}
|
|
411
425
|
/**
|
|
412
426
|
* Whether one entry is genuinely about one turn — the single decision behind
|
|
@@ -439,6 +453,37 @@ export interface CreditOptions {
|
|
|
439
453
|
* @returns the verdict with the evidence behind it.
|
|
440
454
|
*/
|
|
441
455
|
export declare function matchCredit(entry: MemoryEntry, query: string, minScore: number, minTerms: number, options?: CreditOptions): MatchCredit;
|
|
456
|
+
/**
|
|
457
|
+
* Whether the query names one of the entry's entities.
|
|
458
|
+
*
|
|
459
|
+
* Entities are exact names, so the test is a substring match on each query term
|
|
460
|
+
* (a CJK bigram or a Latin word) against the entity list. A single shared
|
|
461
|
+
* character is not enough: 「票」 alone would make every receipt memory answer
|
|
462
|
+
* every question about tickets.
|
|
463
|
+
*
|
|
464
|
+
* @param entry - the memory whose entity list is tested.
|
|
465
|
+
* @param query - the turn.
|
|
466
|
+
* @returns true when at least one query term appears in the entity list.
|
|
467
|
+
*/
|
|
468
|
+
export declare function sharesEntity(entry: MemoryEntry, query: string): boolean;
|
|
469
|
+
/**
|
|
470
|
+
* The relevance floor an alias-only match must clear, as a share of the normal one.
|
|
471
|
+
*
|
|
472
|
+
* An alias pass scores `keys` and `appliesTo` only, so the full floor is
|
|
473
|
+
* unreachable by construction. Measured with `recallMinScore` 9 against this
|
|
474
|
+
* scorer: one CJK alias term scores 6 at most (7×0.5 in `keys` plus 5×0.5 in
|
|
475
|
+
* `appliesTo`) and one Latin word 12, while the strict gate needs 9 — so keeping
|
|
476
|
+
* the same number would have let the fallback fire for English turns and never
|
|
477
|
+
* for Chinese ones, the language most of this store is written in. That is the
|
|
478
|
+
* same "dead in practice" failure a keys-only search had, one layer down.
|
|
479
|
+
*
|
|
480
|
+
* Half the floor, and deliberately no lower: with one CJK term in `keys` alone
|
|
481
|
+
* the pass scores 3.5 and stays refused, so an alias has to be filed in two of
|
|
482
|
+
* the scored fields before it can carry a recall. The structural rule (a
|
|
483
|
+
* substantive term, meaning a CJK pair inside a shared run of three characters,
|
|
484
|
+
* or a Latin word of three) and the hub discount are unchanged.
|
|
485
|
+
*/
|
|
486
|
+
export declare const ALIAS_FLOOR_SHARE = 0.5;
|
|
442
487
|
/**
|
|
443
488
|
* Query terms too common in one scope to count as evidence.
|
|
444
489
|
*
|
|
@@ -573,6 +618,29 @@ export interface ScopeEntries {
|
|
|
573
618
|
* @returns hits ordered by descending relevance, the attention score breaking ties.
|
|
574
619
|
*/
|
|
575
620
|
export declare function searchMemories(groups: readonly ScopeEntries[], query: string, options?: SearchOptions): MemoryHit[];
|
|
621
|
+
/**
|
|
622
|
+
* The aliases and tags a store files memories under, ranked against one query.
|
|
623
|
+
*
|
|
624
|
+
* The main search is lexical, so a query written in the user's words finds
|
|
625
|
+
* nothing when the store was filed under the product's words: the model then
|
|
626
|
+
* reports "no memories match" and stops, although the memory exists under a
|
|
627
|
+
* name it did not guess. Re-running the search with different words is the
|
|
628
|
+
* only fix, and this is what makes that possible without a model call —
|
|
629
|
+
* `keys` and `tags` already hold every other name for every memory.
|
|
630
|
+
*
|
|
631
|
+
* A hint, never a result: the terms it returns are vocabulary, not claims, so
|
|
632
|
+
* a caller must not present them as matches.
|
|
633
|
+
*
|
|
634
|
+
* @param groups - per-scope entry lists.
|
|
635
|
+
* @param query - the query that found nothing.
|
|
636
|
+
* @param limit - most terms to return.
|
|
637
|
+
* @returns shared terms first, then the most widely used ones.
|
|
638
|
+
*/
|
|
639
|
+
export declare function suggestAliases(groups: readonly ScopeEntries[], query: string, limit?: number): {
|
|
640
|
+
term: string;
|
|
641
|
+
carriers: number;
|
|
642
|
+
matched: number;
|
|
643
|
+
}[];
|
|
576
644
|
/**
|
|
577
645
|
* Select entries without a text query — used by `memory_search`'s browse mode
|
|
578
646
|
* and by the injector.
|
package/lib/types/sync.d.ts
CHANGED
|
@@ -90,6 +90,18 @@ export declare function newerEntry(ours: string, theirs: string): {
|
|
|
90
90
|
export declare function isSessionNotePath(path: string): boolean;
|
|
91
91
|
/** The `at` stamp of one session note, or 0 when it cannot be parsed. */
|
|
92
92
|
export declare function sessionNoteStamp(text: string): number;
|
|
93
|
+
/** Whether one path is a persona file: prose the assistant maintains for the user. */
|
|
94
|
+
export declare function isPersonaPath(path: string): boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Merge two versions of a persona file as a bullet union.
|
|
97
|
+
*
|
|
98
|
+
* A persona file is headings plus bullet lists; both machines append their own
|
|
99
|
+
* observations, so a line-level union keeps every rule either machine recorded.
|
|
100
|
+
* Bullets are matched on their trimmed text (duplicates are dropped), inserted
|
|
101
|
+
* after the last bullet of the same section, and a whole section that only
|
|
102
|
+
* `theirs` has is appended at the end. Non-bullet lines come from `ours`.
|
|
103
|
+
*/
|
|
104
|
+
export declare function mergePersona(ours: string, theirs: string): string;
|
|
93
105
|
/**
|
|
94
106
|
* Resolve one conflicting session note by keeping the later `at:` stamp.
|
|
95
107
|
*
|
package/lib/types/types.d.ts
CHANGED
|
@@ -73,6 +73,12 @@ export interface MemoryEntry {
|
|
|
73
73
|
* buys most of the recall a vector index would, without an index.
|
|
74
74
|
*/
|
|
75
75
|
readonly keys: readonly string[];
|
|
76
|
+
/**
|
|
77
|
+
* Named entities the memory is about: people, places, organisations, objects,
|
|
78
|
+
* dates. Used by recall to match a turn that names one of them even when it
|
|
79
|
+
* shares no other word with the memory (「北街南街」 against 「南街文具店」).
|
|
80
|
+
*/
|
|
81
|
+
readonly entities?: readonly string[];
|
|
76
82
|
/** When this memory is worth recalling, in the author's words. */
|
|
77
83
|
readonly appliesTo?: string;
|
|
78
84
|
/**
|
|
@@ -291,6 +297,8 @@ export interface MemoryDraft {
|
|
|
291
297
|
readonly derivedFrom?: readonly string[];
|
|
292
298
|
/** Extra search keys (aliases, keyphrases) that should also find this memory. */
|
|
293
299
|
readonly keys?: readonly string[];
|
|
300
|
+
/** Named entities (people, places, organisations, objects) this memory is about. */
|
|
301
|
+
readonly entities?: readonly string[];
|
|
294
302
|
}
|
|
295
303
|
/** The outcome of persisting one draft. */
|
|
296
304
|
export interface UpsertResult {
|
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.4",
|
|
5
5
|
"private": false,
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|