@chenhw7/dsh-memory 0.7.0 → 0.9.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 (92) hide show
  1. package/README.i18n.yaml +2 -0
  2. package/README.md +9 -8
  3. package/{README.zh-CN.md → README.zh.md} +8 -7
  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 +75 -11
  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 +45 -1
  15. package/lib/context/index.d.ts.map +1 -1
  16. package/lib/context/index.js +153 -9
  17. package/lib/context/index.js.map +1 -1
  18. package/lib/context/policy.d.ts +12 -0
  19. package/lib/context/policy.d.ts.map +1 -1
  20. package/lib/context/policy.js +22 -4
  21. package/lib/context/policy.js.map +1 -1
  22. package/lib/index.d.ts +50 -2
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +46 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib/notes/cleanup.d.ts +7 -1
  27. package/lib/notes/cleanup.d.ts.map +1 -1
  28. package/lib/notes/cleanup.js +17 -12
  29. package/lib/notes/cleanup.js.map +1 -1
  30. package/lib/notes/index.d.ts +3 -1
  31. package/lib/notes/index.d.ts.map +1 -1
  32. package/lib/notes/index.js +8 -3
  33. package/lib/notes/index.js.map +1 -1
  34. package/lib/notes/scope.d.ts +5 -5
  35. package/lib/notes/scope.js +5 -5
  36. package/lib/remote/index.d.ts +67 -6
  37. package/lib/remote/index.d.ts.map +1 -1
  38. package/lib/remote/index.js +94 -9
  39. package/lib/remote/index.js.map +1 -1
  40. package/lib/remote/typert.remote-client.d.ts +8 -1
  41. package/lib/remote/typert.remote-client.js +6 -0
  42. package/lib/remote/types.d.ts +1 -1
  43. package/lib/remote/types.d.ts.map +1 -1
  44. package/lib/review/accumulator.d.ts +1 -1
  45. package/lib/review/accumulator.js +1 -1
  46. package/lib/review/consolidate.d.ts +230 -0
  47. package/lib/review/consolidate.d.ts.map +1 -0
  48. package/lib/review/consolidate.js +435 -0
  49. package/lib/review/consolidate.js.map +1 -0
  50. package/lib/review/dedup.d.ts +23 -15
  51. package/lib/review/dedup.d.ts.map +1 -1
  52. package/lib/review/dedup.js +34 -83
  53. package/lib/review/dedup.js.map +1 -1
  54. package/lib/review/extract.d.ts +63 -12
  55. package/lib/review/extract.d.ts.map +1 -1
  56. package/lib/review/extract.js +168 -31
  57. package/lib/review/extract.js.map +1 -1
  58. package/lib/review/index.d.ts +20 -0
  59. package/lib/review/index.d.ts.map +1 -1
  60. package/lib/review/index.js +68 -16
  61. package/lib/review/index.js.map +1 -1
  62. package/lib/review/sweep.d.ts +171 -0
  63. package/lib/review/sweep.d.ts.map +1 -0
  64. package/lib/review/sweep.js +310 -0
  65. package/lib/review/sweep.js.map +1 -0
  66. package/lib/scanner.d.ts +2 -0
  67. package/lib/scanner.d.ts.map +1 -1
  68. package/lib/scanner.js +22 -0
  69. package/lib/scanner.js.map +1 -1
  70. package/lib/store/bm25.d.ts +75 -1
  71. package/lib/store/bm25.d.ts.map +1 -1
  72. package/lib/store/bm25.js +162 -17
  73. package/lib/store/bm25.js.map +1 -1
  74. package/lib/store/cross-process.d.ts +155 -0
  75. package/lib/store/cross-process.d.ts.map +1 -0
  76. package/lib/store/cross-process.js +254 -0
  77. package/lib/store/cross-process.js.map +1 -0
  78. package/lib/store/index.d.ts +199 -9
  79. package/lib/store/index.d.ts.map +1 -1
  80. package/lib/store/index.js +652 -92
  81. package/lib/store/index.js.map +1 -1
  82. package/lib/store/sqlite.d.ts +126 -0
  83. package/lib/store/sqlite.d.ts.map +1 -0
  84. package/lib/store/sqlite.js +653 -0
  85. package/lib/store/sqlite.js.map +1 -0
  86. package/lib/tool/index.d.ts +17 -5
  87. package/lib/tool/index.d.ts.map +1 -1
  88. package/lib/tool/index.js +253 -21
  89. package/lib/tool/index.js.map +1 -1
  90. package/lib/types.d.ts +81 -2
  91. package/lib/types.d.ts.map +1 -1
  92. package/package.json +18 -3
@@ -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,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CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAA;QAC9D,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uEAAuE;YACvE,qEAAqE;YACrE,oBAAoB;YACpB,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,CAAA;QACrC,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACK,KAAK,CAAC,KAAc;QAC1B,MAAM,MAAM,GAAG,gBAAgB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;QAChD,IAAI,CAAC,MAAM,CAAC,OAAO;YAAE,OAAM;QAC3B,MAAM,KAAK,GAAG,MAAM,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"}
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * storage-domain provider for the long-term memory store. Opens a `memory`
3
- * domain with one table (`entries`) keyed by `MemoryId` and implements the
4
- * {@link MemoryStore} abstract service against it. Reads are synchronous from
3
+ * domain with four tables (`entries` keyed by `MemoryId`, `audit`, and
4
+ * `suggestions` for the review queue, `meta` for subsystem state rows) and
5
+ * implements the {@link MemoryStore} abstract service against them. Reads are
6
+ * synchronous from
5
7
  * the domain's authoritative in-memory state; writes serialize on the domain's
6
8
  * write chain and reach the backend before updating memory.
7
9
  *
@@ -12,24 +14,119 @@
12
14
  */
13
15
  import type { Context } from '@deepseek-ai/cordis';
14
16
  import type { KvTable } from '@deepseek-ai/dsh-storage-domain';
17
+ import z from '@deepseek-ai/schemastery';
18
+ import { z as zod } from 'zod';
15
19
  import { MemoryStore, MemoryId, AuditId, SuggestionId } from '../index.ts';
16
20
  import type { AddMemoryInput, AddMemoryResult, AddSuggestionInput, AdoptSuggestionOverride, AuditEntry, MemoryEntry, MemoryHealth, MemorySearchQuery, MemorySuggestion, SearchMemoryResult, UpdateMemoryInput } from '../types.ts';
21
+ /**
22
+ * One record of the domain's fourth table (`meta`): durable state that is not
23
+ * a memory entry, an audit record, or a suggestion — consolidation progress
24
+ * (lastRun/cooldown under the `'consolidation'` key), medium-level migration
25
+ * markers (`'medium'`, e.g. `migratedToSqlite`), and schema-version markers
26
+ * (`'schema'`). The row is keyed by its `key` in the table plus any caller
27
+ * suffix; the carrier fields are permissive-on-read by design (zero
28
+ * migration): unknown keys and unknown fields re-read without error.
29
+ */
30
+ export interface MemoryMetaRecord {
31
+ /** Which subsystem owns this row. */
32
+ readonly key: 'consolidation' | 'medium' | 'schema';
33
+ /** Opaque string payload (timestamps, markers, version stamps as text). */
34
+ readonly value?: string | undefined;
35
+ /** Unix epoch ms of the last write to this record. */
36
+ readonly updatedAt?: number | undefined;
37
+ }
38
+ /**
39
+ * The memory domain spec: `entries` (memory records keyed by id) plus `audit`
40
+ * (mutation audit trail) plus `suggestions` (P1-1 pending-review queue) plus
41
+ * `meta` (subsystem state rows: consolidation progress, migration markers),
42
+ * plus a global singleton carrying the single-writer owner stamp (P3
43
+ * cross-process detection). Domain version stays at 0 — all four later
44
+ * additions are forward-compatible: storage-json reads only declared tables
45
+ * and initializes any absent table as an empty map, and a medium whose global
46
+ * slot was never written reads as `null`, which the domain replaces with the
47
+ * spec's `initial` without materializing it, so existing v0 media reopen
48
+ * without migration.
49
+ *
50
+ * The stamp and meta-record schemas accept extra keys on purpose
51
+ * (`looseObject`): the medium holds both as opaque JSON, and a future
52
+ * extension of their shapes must reopen cleanly on today's readers.
53
+ */
54
+ /** The memory domain spec, exported for the SQLite backend's migration path. */
55
+ export declare const memoryDomainSpec: {
56
+ name: string;
57
+ version: number;
58
+ global: {
59
+ schema: zod.ZodType<import("./cross-process.ts").OwnerStamp, unknown, zod.core.$ZodTypeInternals<import("./cross-process.ts").OwnerStamp, unknown>>;
60
+ initial: import("./cross-process.ts").OwnerStamp;
61
+ };
62
+ tables: {
63
+ entries: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<MemoryId, MemoryEntry>;
64
+ audit: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<AuditId, AuditEntry>;
65
+ suggestions: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<SuggestionId, MemorySuggestion>;
66
+ meta: import("@deepseek-ai/dsh-storage-domain").DomainTableSpec<string, MemoryMetaRecord>;
67
+ };
68
+ };
17
69
  /** The entries table from the opened domain. */
18
70
  type EntriesTable = KvTable<MemoryId, MemoryEntry>;
19
71
  /** The audit table from the opened domain. */
20
72
  type AuditTable = KvTable<AuditId, AuditEntry>;
21
73
  /** The suggestions table from the opened domain (P1-1 review queue). */
22
74
  type SuggestionsTable = KvTable<SuggestionId, MemorySuggestion>;
75
+ /** The meta table from the opened domain (subsystem state rows). */
76
+ type MetaTable = KvTable<string, MemoryMetaRecord>;
23
77
  /** Cordis plugin name. */
24
78
  export declare const name = "memory-store-domain";
25
79
  /** Services required before this provider can mount. */
26
80
  export declare const inject: string[];
81
+ /**
82
+ * Configuration for the memory store provider, settable from a `config:`
83
+ * entry on the `memory-store` composition row.
84
+ */
85
+ export interface StoreConfig {
86
+ /**
87
+ * Which storage backend mounts (write-path rework Step 3.2): `host-medium`
88
+ * (default) keeps everything in the host's `memory.json`; `sqlite` moves
89
+ * the store into the plugin-owned `$DSH_HOME/storages/memory.db` (WAL
90
+ * mode) with a one-time import from a non-empty medium. Misconfiguration
91
+ * fails loud. Defaults to `host-medium` this release.
92
+ */
93
+ storage: 'host-medium' | 'sqlite';
94
+ /**
95
+ * Maximum entries retained in the `entries` table; write paths trim back
96
+ * to it (pinned entries exempt, lowest use signal evicted first). Default
97
+ * {@link DEFAULT_ENTRIES_CAP}. Settable from `cordis.patch.yml` under the
98
+ * "no hardcoded tunables" rule.
99
+ */
100
+ entriesCap: number;
101
+ /**
102
+ * Interval in milliseconds between medium owner-stamp read-backs for
103
+ * cross-process single-writer detection; `0` disables the periodic probe
104
+ * (the startup check and the dispose goodbye still run). Default
105
+ * {@link DEFAULT_CROSS_PROCESS_PROBE_MS}. Settable from `cordis.patch.yml`
106
+ * under the "no hardcoded tunables" rule.
107
+ */
108
+ crossProcessProbeMs: number;
109
+ }
110
+ /** Schemastery configuration for the `memory-store` composition row. */
111
+ export declare const Config: z<Schemastery.ObjectS<{
112
+ storage: z<"host-medium" | "sqlite", "host-medium" | "sqlite">;
113
+ entriesCap: z<number, number>;
114
+ crossProcessProbeMs: z<number, number>;
115
+ }>, Schemastery.ObjectT<{
116
+ storage: z<"host-medium" | "sqlite", "host-medium" | "sqlite">;
117
+ entriesCap: z<number, number>;
118
+ crossProcessProbeMs: z<number, number>;
119
+ }>>;
27
120
  /**
28
121
  * Mount the storage-domain memory store provider. Opens the `memory` domain
29
- * and registers a {@link MemoryStore} subclass on `ctx.memory`.
122
+ * and registers a {@link MemoryStore} subclass on `ctx.memory`. On open, a
123
+ * {@link CrossProcessGuard} claims the medium's owner stamp (the domain's
124
+ * global slot) and starts the configured read-back probe; the dispose path
125
+ * stamps `closedAt` so the next boot does not warn about this one.
30
126
  * @param ctx - Cordis context with `storageDomain` injected.
127
+ * @param config - row config; `entriesCap` and `crossProcessProbeMs` are read here.
31
128
  */
32
- export declare function apply(ctx: Context): Promise<void>;
129
+ export declare function apply(ctx: Context, config?: StoreConfig): Promise<void>;
33
130
  /**
34
131
  * MemoryStore implementation backed by a storage-domain KV table. Reads are
35
132
  * synchronous from memory; writes serialize on the domain chain. Every
@@ -40,11 +137,46 @@ export declare class DomainMemoryStore extends MemoryStore {
40
137
  private readonly entries;
41
138
  private readonly audit;
42
139
  private readonly suggestions;
140
+ private readonly meta;
43
141
  private readonly auditCap;
44
142
  private readonly suggestionCap;
143
+ private readonly entriesCap;
144
+ /** Warn channel for swallowed background-path failures; the host `ctx.logger`. */
145
+ private readonly failureLogger;
146
+ /** Per-site counts of swallowed failures, surfaced through `health()`. */
147
+ private readonly failureCounts;
45
148
  /** Last audit `seq` handed out; lazily initialized from the medium on first append. */
46
149
  private auditSeq;
47
- constructor(entries: EntriesTable, audit: AuditTable, suggestions: SuggestionsTable, auditCap?: number, suggestionCap?: number);
150
+ constructor(entries: EntriesTable, audit: AuditTable, suggestions: SuggestionsTable, meta: MetaTable, auditCap?: number, suggestionCap?: number, failureLogger?: {
151
+ warn(message: string): void;
152
+ }, entriesCap?: number);
153
+ /**
154
+ * One-time startup scale judgment. Fires a warn when the entry count
155
+ * loaded from the medium already sits at or above
156
+ * {@link SCALE_SELFCHECK_FRACTION} of {@link entriesCap}. The warn carries
157
+ * the concrete numbers and the documented migration threshold, and goes
158
+ * through the same best-effort logger channel as every background-path
159
+ * failure — a missing logger (unit tests, headless constructions) stays
160
+ * silent rather than throwing out of the constructor.
161
+ */
162
+ private selfcheckScale;
163
+ reportFailure(site: string, error?: unknown): void;
164
+ /**
165
+ * Read one meta record, synchronously from the domain's in-memory state.
166
+ * @param key - the record's table key (the owning subsystem's `key` plus
167
+ * any caller suffix, e.g. `'consolidation:lastRun'`).
168
+ * @returns the record, or `undefined` when never written.
169
+ */
170
+ getMeta(key: string): MemoryMetaRecord | undefined;
171
+ /**
172
+ * Write one meta record durably (insert or full replace — the table's `put`
173
+ * contract, no partial merge). Best-effort on failure: a meta write never
174
+ * breaks the caller's primary path, mirroring the audit-append discipline.
175
+ * @param key - the record's table key.
176
+ * @param record - the full new record; `updatedAt` is stamped here when the
177
+ * caller leaves it off.
178
+ */
179
+ setMeta(key: string, record: MemoryMetaRecord): Promise<void>;
48
180
  /** Next monotonic audit sequence number (survives reopen via the medium). */
49
181
  private nextAuditSeq;
50
182
  add(input: AddMemoryInput): Promise<AddMemoryResult>;
@@ -54,9 +186,15 @@ export declare class DomainMemoryStore extends MemoryStore {
54
186
  remove(id: MemoryId): Promise<boolean>;
55
187
  search(query: MemorySearchQuery): SearchMemoryResult;
56
188
  /**
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.
189
+ * Stamp entries with a recall timestamp (fire-and-forget). Each entry is
190
+ * stamped through the table's atomic read-modify-write, so the transform
191
+ * reads the record current at its write-chain slot — a concurrent
192
+ * `memory_replace` that lands first is never rolled back by the stamp, and
193
+ * the stamp never rolls one back. One stamp pass enqueues one job per
194
+ * changed entry; entries already carrying this pass's timestamp and no
195
+ * decay stamp are skipped without touching the chain. `updatedAt` is
196
+ * intentionally left untouched: recalling is not mutating.
197
+ * @param ids - the ids of the entries the caller surfaced to the model.
60
198
  */
61
199
  private stampRecalled;
62
200
  /**
@@ -66,6 +204,18 @@ export declare class DomainMemoryStore extends MemoryStore {
66
204
  * without recall tracking stay contract-conformant.
67
205
  */
68
206
  markRecalled(ids: readonly string[]): void;
207
+ /**
208
+ * Record usage hits on the given entries (write-path rework Step 2):
209
+ * bump `hitCount` and stamp `lastHitAt` through the table's atomic
210
+ * read-modify-write — the same discipline as {@link stampRecalled}, so a
211
+ * concurrent content edit is never rolled back by a hit and vice versa.
212
+ * `updatedAt` is intentionally left untouched: a hit is a reading signal,
213
+ * not a mutation. Idempotent per call batch (one call adds exactly one
214
+ * hit per entry, regardless of duplicates inside `ids`); unknown ids and
215
+ * entries removed mid-pass are skipped like a stale recall stamp.
216
+ * @param ids - the ids of the entries the assistant's answer echoed.
217
+ */
218
+ markHits(ids: readonly MemoryId[]): Promise<void>;
69
219
  /**
70
220
  * Record one extraction/model proposal in the pending-review queue.
71
221
  *
@@ -78,7 +228,7 @@ export declare class DomainMemoryStore extends MemoryStore {
78
228
  * `hits: 1`.
79
229
  * @param input - the proposal to record.
80
230
  * @returns the stored suggestion (existing row updated, or newly created).
81
- * @throws when the proposed content fails validation or the scanner.
231
+ * @throws when the proposed content or summary fails validation or the scanner.
82
232
  */
83
233
  observeSuggestion(input: AddSuggestionInput): Promise<MemorySuggestion>;
84
234
  /**
@@ -107,6 +257,25 @@ export declare class DomainMemoryStore extends MemoryStore {
107
257
  rejectSuggestion(id: SuggestionId): Promise<boolean>;
108
258
  /** Trim the suggestion queue to its cap, evicting the lowest-signal rows. */
109
259
  private trimSuggestions;
260
+ /**
261
+ * Trim the entries table to {@link DEFAULT_ENTRIES_CAP} / the configured
262
+ * `entriesCap` after a successful write. Awaited inline like
263
+ * {@link trimSuggestions} (not failure-shielded like {@link trimAudit}):
264
+ * an eviction failure propagates to the add caller even though the added
265
+ * row landed. Eviction runs in one pass down TO the cap (not one per add),
266
+ * ordered by the use signal — pinned entries are exempt; the rest go by
267
+ * ascending `accessCount` (never-recalled reads as 0), then ascending
268
+ * `lastRecalledAt` ?? `createdAt` (longest-unrecalled first). When every
269
+ * remaining candidate is protected (e.g. all pinned), the table is allowed
270
+ * to exceed the cap — the cap is a soft target, eviction never deletes a
271
+ * protected entry to reach it.
272
+ *
273
+ * Audit trail: the eviction records `op: 'remove'`, `source: 'janitor'`.
274
+ * The janitor source names system-initiated lifecycle writes (decay,
275
+ * dormancy), and `AuditSource` is a fixed schema enum — extending it would
276
+ * change the durable record shape — so the store's own eviction reuses it.
277
+ */
278
+ private trimEntries;
110
279
  pin(id: MemoryId): Promise<MemoryEntry | undefined>;
111
280
  unpin(id: MemoryId): Promise<MemoryEntry | undefined>;
112
281
  /**
@@ -117,6 +286,22 @@ export declare class DomainMemoryStore extends MemoryStore {
117
286
  archiveEntry(id: MemoryId): Promise<MemoryEntry | undefined>;
118
287
  /** Lift a manual or janitor dormancy stamp without counting it as a recall. */
119
288
  unarchiveEntry(id: MemoryId): Promise<MemoryEntry | undefined>;
289
+ /**
290
+ * Supersede one entry (batch-consolidation seam, Step 1.3): flip `status`
291
+ * to `'superseded'`, stamp `supersededBy`, and append the caller's visible
292
+ * annotation to the content in one atomic write. Idempotent on an already
293
+ * superseded entry (returned unchanged, no audit). The audit trail records
294
+ * source `'janitor'` — the `AuditSource` enum has no consolidation member,
295
+ * and extending the durable enum shape is not this seam's business (the
296
+ * same rationale as {@link trimEntries}'s eviction records).
297
+ * @param id - the entry being superseded.
298
+ * @param supersededBy - the id of the newer, contradicting entry.
299
+ * @param annotate - optional content annotation (receives the pre-stamp
300
+ * entry, returns the new content); called before the write so the
301
+ * annotation lands atomically with the status flip.
302
+ * @returns the superseded entry, or `undefined` when the id does not exist.
303
+ */
304
+ supersedeEntry(id: MemoryId, supersededBy: MemoryId, annotate?: (entry: MemoryEntry) => string): Promise<MemoryEntry | undefined>;
120
305
  /**
121
306
  * Run the janitor pass with the lifecycle's two-tier policy:
122
307
  * - `project` entries overdue by `decayDays` (pinned exempt) are REMOVED
@@ -124,6 +309,10 @@ export declare class DomainMemoryStore extends MemoryStore {
124
309
  * - `global`/`user` entries overdue (pinned exempt) are soft-decayed: the
125
310
  * first overdue pass stamps `staleSince`, which hides them from injection
126
311
  * surfaces while keeping them searchable; a later recall clears the stamp.
312
+ * The snapshot iteration is only a pre-filter: every delete and stamp
313
+ * re-decides on the record current at its write-chain slot (the same
314
+ * atomic RMW discipline as `stampRecalled`), so a pin landing between the
315
+ * snapshot and the write is honored.
127
316
  * @param decayDays - days without recall before the policy applies.
128
317
  * @param now - evaluation clock; defaults to wall time (tests inject fixed clocks).
129
318
  * @returns the number of project entries removed.
@@ -135,6 +324,7 @@ export declare class DomainMemoryStore extends MemoryStore {
135
324
  */
136
325
  listAudit(): readonly AuditEntry[];
137
326
  health(): MemoryHealth;
327
+ getRaw(id: MemoryId): Promise<MemoryEntry | undefined>;
138
328
  exportAuditLog(): readonly AuditEntry[];
139
329
  /**
140
330
  * 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;AACxD,eAAO,MAAM,MAAM,UAAoB,CAAA;AAEvC;;;;GAIG;AACH,wBAAsB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CASvD;AAED;;;;;GAKG;AACH,qBAAa,iBAAkB,SAAQ,WAAW;IAChD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAY;IAClC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkB;IAC9C,OAA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