@chenhw7/dsh-memory 0.7.0 → 0.8.0

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.
Files changed (77) hide show
  1. package/README.i18n.yaml +2 -0
  2. package/README.md +8 -7
  3. package/{README.zh-CN.md → README.zh.md} +7 -6
  4. package/cordis.patch.yml +5 -1
  5. package/lib/benchmark/index.d.ts +24 -7
  6. package/lib/benchmark/index.d.ts.map +1 -1
  7. package/lib/benchmark/index.js +55 -7
  8. package/lib/benchmark/index.js.map +1 -1
  9. package/lib/client/index.js +37 -9
  10. package/lib/context/conflict.d.ts +23 -10
  11. package/lib/context/conflict.d.ts.map +1 -1
  12. package/lib/context/conflict.js +59 -20
  13. package/lib/context/conflict.js.map +1 -1
  14. package/lib/context/index.d.ts.map +1 -1
  15. package/lib/context/index.js +12 -5
  16. package/lib/context/index.js.map +1 -1
  17. package/lib/context/policy.d.ts +12 -0
  18. package/lib/context/policy.d.ts.map +1 -1
  19. package/lib/context/policy.js +22 -4
  20. package/lib/context/policy.js.map +1 -1
  21. package/lib/index.d.ts +23 -1
  22. package/lib/index.d.ts.map +1 -1
  23. package/lib/index.js +20 -0
  24. package/lib/index.js.map +1 -1
  25. package/lib/notes/cleanup.d.ts +7 -1
  26. package/lib/notes/cleanup.d.ts.map +1 -1
  27. package/lib/notes/cleanup.js +17 -12
  28. package/lib/notes/cleanup.js.map +1 -1
  29. package/lib/notes/index.d.ts +3 -1
  30. package/lib/notes/index.d.ts.map +1 -1
  31. package/lib/notes/index.js +8 -3
  32. package/lib/notes/index.js.map +1 -1
  33. package/lib/notes/scope.d.ts +5 -5
  34. package/lib/notes/scope.js +5 -5
  35. package/lib/remote/index.d.ts +67 -6
  36. package/lib/remote/index.d.ts.map +1 -1
  37. package/lib/remote/index.js +94 -9
  38. package/lib/remote/index.js.map +1 -1
  39. package/lib/remote/typert.remote-client.d.ts +8 -1
  40. package/lib/remote/typert.remote-client.js +6 -0
  41. package/lib/remote/types.d.ts +1 -1
  42. package/lib/remote/types.d.ts.map +1 -1
  43. package/lib/review/accumulator.d.ts +1 -1
  44. package/lib/review/accumulator.js +1 -1
  45. package/lib/review/dedup.d.ts +23 -15
  46. package/lib/review/dedup.d.ts.map +1 -1
  47. package/lib/review/dedup.js +34 -83
  48. package/lib/review/dedup.js.map +1 -1
  49. package/lib/review/extract.d.ts.map +1 -1
  50. package/lib/review/extract.js +5 -2
  51. package/lib/review/extract.js.map +1 -1
  52. package/lib/review/index.d.ts.map +1 -1
  53. package/lib/review/index.js +14 -9
  54. package/lib/review/index.js.map +1 -1
  55. package/lib/scanner.d.ts +2 -0
  56. package/lib/scanner.d.ts.map +1 -1
  57. package/lib/scanner.js +22 -0
  58. package/lib/scanner.js.map +1 -1
  59. package/lib/store/bm25.d.ts +75 -1
  60. package/lib/store/bm25.d.ts.map +1 -1
  61. package/lib/store/bm25.js +162 -17
  62. package/lib/store/bm25.js.map +1 -1
  63. package/lib/store/cross-process.d.ts +155 -0
  64. package/lib/store/cross-process.d.ts.map +1 -0
  65. package/lib/store/cross-process.js +254 -0
  66. package/lib/store/cross-process.js.map +1 -0
  67. package/lib/store/index.d.ts +89 -7
  68. package/lib/store/index.d.ts.map +1 -1
  69. package/lib/store/index.js +466 -89
  70. package/lib/store/index.js.map +1 -1
  71. package/lib/tool/index.d.ts +17 -5
  72. package/lib/tool/index.d.ts.map +1 -1
  73. package/lib/tool/index.js +235 -21
  74. package/lib/tool/index.js.map +1 -1
  75. package/lib/types.d.ts +31 -2
  76. package/lib/types.d.ts.map +1 -1
  77. package/package.json +11 -2
@@ -0,0 +1,254 @@
1
+ /**
2
+ * Cross-process single-writer detection for the memory medium.
3
+ *
4
+ * The host storage-json backend declares a single-writer assumption per
5
+ * process: two DSH processes sharing one storage root each hold their own
6
+ * in-memory authoritative state and republish the whole unit file on every
7
+ * write, silently clobbering each other (last publisher wins). The backend's
8
+ * double-open guard is a per-process map, so the second process opens the
9
+ * same unit without any error — nothing in the host detects the overlap.
10
+ *
11
+ * This module adds detection, not locking: each boot stamps an owner record
12
+ * into the domain's global slot and re-reads the medium periodically. A stamp
13
+ * this boot just wrote that reads back as someone else's proves a concurrent
14
+ * publisher; a foreign stamp seen at startup proves an earlier writer the
15
+ * medium still remembers. Detection needs both sides to stamp — a writer
16
+ * running a version without this guard overwrites the slot with `null` and
17
+ * is invisible here. A foreign stamp is only a live threat when its pid is
18
+ * still alive: `closedAt` marks a clean exit, and a dead pid marks a crashed
19
+ * predecessor — both restart cases stay silent.
20
+ *
21
+ * @module @chenhw7/dsh-memory/store/cross-process
22
+ */
23
+ import { randomUUID } from 'node:crypto';
24
+ import { readFile, writeFile } from 'node:fs/promises';
25
+ import zod from 'zod';
26
+ /** Zod schema validating a stamp at the durable boundary (rejects `null`, the "never written" sentinel). */
27
+ export const ownerStampSchema = zod.looseObject({
28
+ pid: zod.number(),
29
+ startedAt: zod.number(),
30
+ bootId: zod.string(),
31
+ });
32
+ /**
33
+ * Spec-level `initial` for the global slot: what {@link CrossProcessGuard.startup}
34
+ * sees when the medium has never been claimed (empty `bootId`). Never written
35
+ * as-is — the guard's first act replaces it with a real stamp.
36
+ */
37
+ export const EMPTY_OWNER = { pid: 0, startedAt: 0, bootId: '' };
38
+ /**
39
+ * Default cadence for the medium read-back probe. Lightweight by design —
40
+ * one file read per interval, off the write path; `0` disables probing.
41
+ */
42
+ export const DEFAULT_CROSS_PROCESS_PROBE_MS = 60_000;
43
+ /** Identity of the current process boot: fresh per construction, so a restart never reads as itself. */
44
+ export function currentBootOwner() {
45
+ return { pid: process.pid, startedAt: Date.now(), bootId: randomUUID() };
46
+ }
47
+ /**
48
+ * Production read seam: the unit file's global slot, read straight from the
49
+ * medium. The domain serves reads from in-memory state, which never observes
50
+ * another process's publish — the file is the only cross-process witness.
51
+ * @param path - Absolute path of the unit file.
52
+ * @returns an async reader yielding the stored global, `undefined` when the
53
+ * file is not materialized yet.
54
+ */
55
+ export function mediumOwnerReader(path) {
56
+ return async () => {
57
+ let text;
58
+ try {
59
+ text = await readFile(path, 'utf8');
60
+ }
61
+ catch (error) {
62
+ // Absence before the first publish is the normal empty-medium state.
63
+ if (error.code === 'ENOENT')
64
+ return undefined;
65
+ throw error;
66
+ }
67
+ // The unit file is always a complete document (atomic whole-file publish),
68
+ // and the stamp schema validates whatever this extracts.
69
+ const document = JSON.parse(text);
70
+ return document.global;
71
+ };
72
+ }
73
+ /**
74
+ * Production goodbye seam: stamp `closedAt` onto the unit file's global slot
75
+ * directly on the medium. The domain write seam (`global.set`) rejects with
76
+ * `closed` once the storage facility's unmount races our disposer — the
77
+ * medium file is the only write path that stays valid through teardown.
78
+ * The whole-file replacement mirrors the backend's own publish protocol
79
+ * (temp file + rename is unnecessary here: a partial goodbye is a torn
80
+ * stamp at worst, and the pid-dead rule already forgives a lost goodbye;
81
+ * the atomic rename without a directory fsync keeps this free of host
82
+ * internals).
83
+ * @param path - Absolute path of the unit file.
84
+ * @param bootId - This boot's stamp; the write is skipped when the medium's
85
+ * current owner is someone else (we were already overwritten — nothing to
86
+ * say goodbye to).
87
+ * @returns an async writer, or `undefined` when the file is not materialized.
88
+ */
89
+ export function mediumGoodbyeWriter(path, bootId) {
90
+ return async () => {
91
+ let text;
92
+ try {
93
+ text = await readFile(path, 'utf8');
94
+ }
95
+ catch (error) {
96
+ // Nothing materialized = nobody can read our stamp; a no-op goodbye.
97
+ if (error.code === 'ENOENT')
98
+ return;
99
+ throw error;
100
+ }
101
+ const document = JSON.parse(text);
102
+ if (document.global?.bootId !== bootId || document.global.closedAt !== undefined)
103
+ return;
104
+ document.global.closedAt = Date.now();
105
+ await writeFile(path, JSON.stringify(document, null, 2) + '\n', 'utf8');
106
+ };
107
+ }
108
+ /**
109
+ * Default pid-liveness seam: a live process with that pid means a genuine
110
+ * concurrent writer; only `ESRCH` proves absence. `EPERM` (exists, not
111
+ * signallable) and any other probe error alert — fail toward warning, since
112
+ * an undetected concurrent publisher is the expensive side.
113
+ * @param pid - The foreign stamp's pid.
114
+ * @returns whether a process with that pid is alive.
115
+ */
116
+ export function pidAlive(pid) {
117
+ if (!Number.isInteger(pid) || pid <= 0)
118
+ return false;
119
+ try {
120
+ process.kill(pid, 0);
121
+ return true;
122
+ }
123
+ catch (error) {
124
+ // Only confirmed absence stays silent: ESRCH is Node's "no such process".
125
+ return !(error.code === 'ESRCH');
126
+ }
127
+ }
128
+ /**
129
+ * One boot's cross-process detector. Watches the owner stamp on the medium:
130
+ * claims it at startup, re-reads it on probes, and closes it with a goodbye
131
+ * stamp on clean dispose. Reports a foreign live stamp at most once per boot
132
+ * — restarts reset the flag, matching the `backgroundFailures` in-process
133
+ * semantics.
134
+ *
135
+ * Misfire semantics: a foreign stamp carrying `closedAt` is a writer that
136
+ * exited cleanly, and one whose pid is gone is a crashed predecessor —
137
+ * neither is a concurrent publisher, so both stay silent. A live pid is a
138
+ * genuine concurrent writer and alerts; pid reuse by an unrelated process
139
+ * can forge this signal, which the one-warn-per-boot bound contains.
140
+ */
141
+ export class CrossProcessGuard {
142
+ own;
143
+ readOwner;
144
+ writeOwner;
145
+ report;
146
+ isAlive;
147
+ goodbyeWriter;
148
+ /** Set on the first foreign-live observation; one alert per boot. */
149
+ alerted = false;
150
+ constructor(
151
+ /** This boot's identity, written as the claim and compared against read-backs. */
152
+ own,
153
+ /** Medium read-back seam, or `undefined` when the medium path is unresolvable (probes off). */
154
+ readOwner,
155
+ /** Durable write seam for the global slot (the domain's `global.set`). */
156
+ writeOwner,
157
+ /** Swallowed-failure channel (store `reportFailure`). */
158
+ report,
159
+ /** Liveness seam for foreign pids; defaults to the platform `kill(pid, 0)` check. */
160
+ isAlive = pidAlive,
161
+ /** Direct medium-file goodbye writer, or `undefined` (see {@link sayGoodbye}). */
162
+ goodbyeWriter = undefined) {
163
+ this.own = own;
164
+ this.readOwner = readOwner;
165
+ this.writeOwner = writeOwner;
166
+ this.report = report;
167
+ this.isAlive = isAlive;
168
+ this.goodbyeWriter = goodbyeWriter;
169
+ }
170
+ /**
171
+ * Startup check + claim: judge the open-time global (the medium snapshot
172
+ * the domain loaded), then stamp this boot as owner so later starters see
173
+ * us. A failed claim propagates — an unwritable medium fails loud at mount.
174
+ * @param storedGlobal - the domain's global value at open (`EMPTY_OWNER` reference when never written).
175
+ */
176
+ async startup(storedGlobal) {
177
+ if (storedGlobal !== EMPTY_OWNER)
178
+ this.judge(storedGlobal);
179
+ await this.writeOwner({ ...this.own });
180
+ }
181
+ /**
182
+ * Periodic medium read-back. Never throws; a broken read reports under
183
+ * `owner-probe` and waits for the next tick. No-op without a reader.
184
+ */
185
+ async probe() {
186
+ if (this.readOwner === undefined)
187
+ return;
188
+ let value;
189
+ try {
190
+ value = await this.readOwner();
191
+ }
192
+ catch (error) {
193
+ this.report('owner-probe', error);
194
+ return;
195
+ }
196
+ this.judge(value);
197
+ }
198
+ /**
199
+ * Stamp `closedAt` on clean dispose so the next boot reads this writer as
200
+ * gone instead of live. The goodbye prefers the direct medium-file writer:
201
+ * at dispose time the storage facility's own unmount may have already
202
+ * closed the domain (sibling fibers dispose concurrently), which would
203
+ * reject the global-slot write with `closed`. The direct write is the
204
+ * always-valid path. Best-effort: a failing goodbye is reported and
205
+ * teardown continues (the pid-dead rule already keeps crashed/restarted
206
+ * boots silent, so a lost goodbye costs nothing).
207
+ */
208
+ async sayGoodbye() {
209
+ if (this.goodbyeWriter !== undefined) {
210
+ try {
211
+ await this.goodbyeWriter();
212
+ return;
213
+ }
214
+ catch (error) {
215
+ this.report('owner-goodbye', error);
216
+ return;
217
+ }
218
+ }
219
+ try {
220
+ await this.writeOwner({ ...this.own, closedAt: Date.now() });
221
+ }
222
+ catch (error) {
223
+ // Fallback: without a medium path, the domain write is the only seam —
224
+ // it may already be closed by the facility's unmount; report and let
225
+ // teardown proceed.
226
+ this.report('owner-goodbye', error);
227
+ }
228
+ }
229
+ /**
230
+ * Judge one medium-read value. Only a valid stamp with a foreign `bootId`,
231
+ * no `closedAt`, and a still-alive pid is a live concurrent writer; own
232
+ * stamps, closed writers, dead pids, and unreadable values stay silent.
233
+ * Reports at most once per boot.
234
+ */
235
+ judge(value) {
236
+ const parsed = ownerStampSchema.safeParse(value);
237
+ if (!parsed.success)
238
+ return;
239
+ const owner = parsed.data;
240
+ if (owner.bootId === this.own.bootId)
241
+ return;
242
+ if (owner.closedAt !== undefined)
243
+ return;
244
+ if (!this.isAlive(owner.pid))
245
+ return;
246
+ if (this.alerted)
247
+ return;
248
+ this.alerted = true;
249
+ this.report('cross-process', new Error(`another live writer (pid ${owner.pid}, booted ${new Date(owner.startedAt).toISOString()})`
250
+ + ' holds the memory medium; storage-json publishes are last-writer-wins across'
251
+ + ' processes — stop one of the two DSH processes'));
252
+ }
253
+ }
254
+ //# sourceMappingURL=cross-process.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cross-process.js","sourceRoot":"","sources":["../../src/store/cross-process.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACtD,OAAO,GAAG,MAAM,KAAK,CAAA;AAUrB,4GAA4G;AAC5G,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAC,WAAW,CAAC;IAC9C,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE;IACjB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE;IACvB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;CACrB,CAAuC,CAAA;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAe,EAAE,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAA;AAE3E;;;GAGG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,MAAM,CAAA;AAEpD,wGAAwG;AACxG,MAAM,UAAU,gBAAgB;IAC9B,OAAO,EAAE,GAA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CAAC,IAAI,CAAA;QACzB,IAAI,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,GAAG,CAAC,MAAM;YAAE,OAAM;QAC5C,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;YAAE,OAAM;QACxC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC;YAAE,OAAM;QACpC,IAAI,IAAI,CAAC,OAAO;YAAE,OAAM;QACxB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QACnB,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,IAAI,KAAK,CACpC,4BAA4B,KAAK,CAAC,GAAG,YAAY,IAAI,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,WAAW,EAAE,GAAG;cACzF,8EAA8E;cAC9E,gDAAgD,CACnD,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import type { Context } from '@deepseek-ai/cordis';
14
14
  import type { KvTable } from '@deepseek-ai/dsh-storage-domain';
15
+ import z from '@deepseek-ai/schemastery';
15
16
  import { MemoryStore, MemoryId, AuditId, SuggestionId } from '../index.ts';
16
17
  import type { AddMemoryInput, AddMemoryResult, AddSuggestionInput, AdoptSuggestionOverride, AuditEntry, MemoryEntry, MemoryHealth, MemorySearchQuery, MemorySuggestion, SearchMemoryResult, UpdateMemoryInput } from '../types.ts';
17
18
  /** The entries table from the opened domain. */
@@ -24,12 +25,45 @@ type SuggestionsTable = KvTable<SuggestionId, MemorySuggestion>;
24
25
  export declare const name = "memory-store-domain";
25
26
  /** Services required before this provider can mount. */
26
27
  export declare const inject: string[];
28
+ /**
29
+ * Configuration for the memory store provider, settable from a `config:`
30
+ * entry on the `memory-store` composition row.
31
+ */
32
+ export interface StoreConfig {
33
+ /**
34
+ * Maximum entries retained in the `entries` table; write paths trim back
35
+ * to it (pinned entries exempt, lowest use signal evicted first). Default
36
+ * {@link DEFAULT_ENTRIES_CAP}. Settable from `cordis.patch.yml` under the
37
+ * "no hardcoded tunables" rule.
38
+ */
39
+ entriesCap: number;
40
+ /**
41
+ * Interval in milliseconds between medium owner-stamp read-backs for
42
+ * cross-process single-writer detection; `0` disables the periodic probe
43
+ * (the startup check and the dispose goodbye still run). Default
44
+ * {@link DEFAULT_CROSS_PROCESS_PROBE_MS}. Settable from `cordis.patch.yml`
45
+ * under the "no hardcoded tunables" rule.
46
+ */
47
+ crossProcessProbeMs: number;
48
+ }
49
+ /** Schemastery configuration for the `memory-store` composition row. */
50
+ export declare const Config: z<Schemastery.ObjectS<{
51
+ entriesCap: z<number, number>;
52
+ crossProcessProbeMs: z<number, number>;
53
+ }>, Schemastery.ObjectT<{
54
+ entriesCap: z<number, number>;
55
+ crossProcessProbeMs: z<number, number>;
56
+ }>>;
27
57
  /**
28
58
  * Mount the storage-domain memory store provider. Opens the `memory` domain
29
- * and registers a {@link MemoryStore} subclass on `ctx.memory`.
59
+ * and registers a {@link MemoryStore} subclass on `ctx.memory`. On open, a
60
+ * {@link CrossProcessGuard} claims the medium's owner stamp (the domain's
61
+ * global slot) and starts the configured read-back probe; the dispose path
62
+ * stamps `closedAt` so the next boot does not warn about this one.
30
63
  * @param ctx - Cordis context with `storageDomain` injected.
64
+ * @param config - row config; `entriesCap` and `crossProcessProbeMs` are read here.
31
65
  */
32
- export declare function apply(ctx: Context): Promise<void>;
66
+ export declare function apply(ctx: Context, config?: StoreConfig): Promise<void>;
33
67
  /**
34
68
  * MemoryStore implementation backed by a storage-domain KV table. Reads are
35
69
  * synchronous from memory; writes serialize on the domain chain. Every
@@ -42,9 +76,27 @@ export declare class DomainMemoryStore extends MemoryStore {
42
76
  private readonly suggestions;
43
77
  private readonly auditCap;
44
78
  private readonly suggestionCap;
79
+ private readonly entriesCap;
80
+ /** Warn channel for swallowed background-path failures; the host `ctx.logger`. */
81
+ private readonly failureLogger;
82
+ /** Per-site counts of swallowed failures, surfaced through `health()`. */
83
+ private readonly failureCounts;
45
84
  /** Last audit `seq` handed out; lazily initialized from the medium on first append. */
46
85
  private auditSeq;
47
- constructor(entries: EntriesTable, audit: AuditTable, suggestions: SuggestionsTable, auditCap?: number, suggestionCap?: number);
86
+ constructor(entries: EntriesTable, audit: AuditTable, suggestions: SuggestionsTable, auditCap?: number, suggestionCap?: number, failureLogger?: {
87
+ warn(message: string): void;
88
+ }, entriesCap?: number);
89
+ /**
90
+ * One-time startup scale judgment. Fires a warn when the entry count
91
+ * loaded from the medium already sits at or above
92
+ * {@link SCALE_SELFCHECK_FRACTION} of {@link entriesCap}. The warn carries
93
+ * the concrete numbers and the documented migration threshold, and goes
94
+ * through the same best-effort logger channel as every background-path
95
+ * failure — a missing logger (unit tests, headless constructions) stays
96
+ * silent rather than throwing out of the constructor.
97
+ */
98
+ private selfcheckScale;
99
+ reportFailure(site: string, error?: unknown): void;
48
100
  /** Next monotonic audit sequence number (survives reopen via the medium). */
49
101
  private nextAuditSeq;
50
102
  add(input: AddMemoryInput): Promise<AddMemoryResult>;
@@ -54,9 +106,15 @@ export declare class DomainMemoryStore extends MemoryStore {
54
106
  remove(id: MemoryId): Promise<boolean>;
55
107
  search(query: MemorySearchQuery): SearchMemoryResult;
56
108
  /**
57
- * Stamp entries with a recall timestamp (fire-and-forget). Updates
58
- * `lastRecalledAt` on each entry so the janitor can track staleness.
59
- * `updatedAt` is intentionally left untouched: recalling is not mutating.
109
+ * Stamp entries with a recall timestamp (fire-and-forget). Each entry is
110
+ * stamped through the table's atomic read-modify-write, so the transform
111
+ * reads the record current at its write-chain slot — a concurrent
112
+ * `memory_replace` that lands first is never rolled back by the stamp, and
113
+ * the stamp never rolls one back. One stamp pass enqueues one job per
114
+ * changed entry; entries already carrying this pass's timestamp and no
115
+ * decay stamp are skipped without touching the chain. `updatedAt` is
116
+ * intentionally left untouched: recalling is not mutating.
117
+ * @param ids - the ids of the entries the caller surfaced to the model.
60
118
  */
61
119
  private stampRecalled;
62
120
  /**
@@ -78,7 +136,7 @@ export declare class DomainMemoryStore extends MemoryStore {
78
136
  * `hits: 1`.
79
137
  * @param input - the proposal to record.
80
138
  * @returns the stored suggestion (existing row updated, or newly created).
81
- * @throws when the proposed content fails validation or the scanner.
139
+ * @throws when the proposed content or summary fails validation or the scanner.
82
140
  */
83
141
  observeSuggestion(input: AddSuggestionInput): Promise<MemorySuggestion>;
84
142
  /**
@@ -107,6 +165,25 @@ export declare class DomainMemoryStore extends MemoryStore {
107
165
  rejectSuggestion(id: SuggestionId): Promise<boolean>;
108
166
  /** Trim the suggestion queue to its cap, evicting the lowest-signal rows. */
109
167
  private trimSuggestions;
168
+ /**
169
+ * Trim the entries table to {@link DEFAULT_ENTRIES_CAP} / the configured
170
+ * `entriesCap` after a successful write. Awaited inline like
171
+ * {@link trimSuggestions} (not failure-shielded like {@link trimAudit}):
172
+ * an eviction failure propagates to the add caller even though the added
173
+ * row landed. Eviction runs in one pass down TO the cap (not one per add),
174
+ * ordered by the use signal — pinned entries are exempt; the rest go by
175
+ * ascending `accessCount` (never-recalled reads as 0), then ascending
176
+ * `lastRecalledAt` ?? `createdAt` (longest-unrecalled first). When every
177
+ * remaining candidate is protected (e.g. all pinned), the table is allowed
178
+ * to exceed the cap — the cap is a soft target, eviction never deletes a
179
+ * protected entry to reach it.
180
+ *
181
+ * Audit trail: the eviction records `op: 'remove'`, `source: 'janitor'`.
182
+ * The janitor source names system-initiated lifecycle writes (decay,
183
+ * dormancy), and `AuditSource` is a fixed schema enum — extending it would
184
+ * change the durable record shape — so the store's own eviction reuses it.
185
+ */
186
+ private trimEntries;
110
187
  pin(id: MemoryId): Promise<MemoryEntry | undefined>;
111
188
  unpin(id: MemoryId): Promise<MemoryEntry | undefined>;
112
189
  /**
@@ -124,6 +201,10 @@ export declare class DomainMemoryStore extends MemoryStore {
124
201
  * - `global`/`user` entries overdue (pinned exempt) are soft-decayed: the
125
202
  * first overdue pass stamps `staleSince`, which hides them from injection
126
203
  * surfaces while keeping them searchable; a later recall clears the stamp.
204
+ * The snapshot iteration is only a pre-filter: every delete and stamp
205
+ * re-decides on the record current at its write-chain slot (the same
206
+ * atomic RMW discipline as `stampRecalled`), so a pin landing between the
207
+ * snapshot and the write is honored.
127
208
  * @param decayDays - days without recall before the policy applies.
128
209
  * @param now - evaluation clock; defaults to wall time (tests inject fixed clocks).
129
210
  * @returns the number of project entries removed.
@@ -135,6 +216,7 @@ export declare class DomainMemoryStore extends MemoryStore {
135
216
  */
136
217
  listAudit(): readonly AuditEntry[];
137
218
  health(): MemoryHealth;
219
+ getRaw(id: MemoryId): Promise<MemoryEntry | undefined>;
138
220
  exportAuditLog(): readonly AuditEntry[];
139
221
  /**
140
222
  * Append one audit record after a successful mutation, then trim the table
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAElD,OAAO,KAAK,EAAU,OAAO,EAAE,MAAM,iCAAiC,CAAA;AAEtE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAsD,MAAM,aAAa,CAAA;AAG9H,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EAGV,WAAW,EACX,YAAY,EACZ,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,aAAa,CAAA;AAmEpB,gDAAgD;AAChD,KAAK,YAAY,GAAG,OAAO,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAA;AAElD,8CAA8C;AAC9C,KAAK,UAAU,GAAG,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAA;AAE9C,wEAAwE;AACxE,KAAK,gBAAgB,GAAG,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAA;AAkC/D,0BAA0B;AAC1B,eAAO,MAAM,IAAI,wBAAwB,CAAA;AAEzC,wDAAwD;AACx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