@chenhw7/dsh-memory 0.3.0 → 0.5.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.
- package/README.md +7 -4
- package/README.zh-CN.md +7 -4
- package/lib/benchmark/index.d.ts +125 -0
- package/lib/benchmark/index.d.ts.map +1 -0
- package/lib/benchmark/index.js +150 -0
- package/lib/benchmark/index.js.map +1 -0
- package/lib/brand.d.ts +11 -0
- package/lib/brand.d.ts.map +1 -1
- package/lib/brand.js +7 -0
- package/lib/brand.js.map +1 -1
- package/lib/client/index.js +1666 -42
- package/lib/context/index.d.ts +22 -3
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +59 -13
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +6 -0
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +26 -9
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +44 -5
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +48 -2
- package/lib/index.js.map +1 -1
- package/lib/notes/index.d.ts +1 -1
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +37 -7
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/writer.d.ts +33 -0
- package/lib/notes/writer.d.ts.map +1 -1
- package/lib/notes/writer.js +61 -1
- package/lib/notes/writer.js.map +1 -1
- package/lib/remote/index.d.ts +102 -5
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +138 -8
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +38 -5
- package/lib/remote/typert.remote-client.js +8 -2
- package/lib/review/extract.d.ts +48 -4
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +164 -11
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts +6 -0
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +12 -10
- package/lib/review/index.js.map +1 -1
- package/lib/store/index.d.ts +56 -3
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +238 -9
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +156 -25
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +83 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +14 -1
package/lib/notes/index.js
CHANGED
|
@@ -17,11 +17,11 @@ import path from 'node:path';
|
|
|
17
17
|
import { scanContent } from '../scanner.js';
|
|
18
18
|
import { isRenderedEntry } from './scope.js';
|
|
19
19
|
import { renderConventions, renderPitfalls } from './render.js';
|
|
20
|
-
import { ensureAgentsPointer,
|
|
20
|
+
import { ensureAgentsPointer, writeNotesFile, DriftError } from './writer.js';
|
|
21
21
|
import { resolveNotesSettings } from './settings.js';
|
|
22
22
|
export { isRenderedEntry } from './scope.js';
|
|
23
23
|
export { renderConventions, renderPitfalls } from './render.js';
|
|
24
|
-
export { ensureAgentsPointer, writeFileAtomic, agentsPointerBlock, AGENTS_POINTER_BEGIN, AGENTS_POINTER_END } from './writer.js';
|
|
24
|
+
export { ensureAgentsPointer, writeFileAtomic, writeNotesFile, DriftError, agentsPointerBlock, AGENTS_POINTER_BEGIN, AGENTS_POINTER_END } from './writer.js';
|
|
25
25
|
export { resolveNotesSettings, DEFAULT_NOTES_ENABLED, DEFAULT_NOTES_DIR, DEFAULT_NOTES_CHAR_LIMIT, DEFAULT_NOTES_AGENTS_POINTER, DEFAULT_NOTES_MAX_ENTRIES_PER_FILE } from './settings.js';
|
|
26
26
|
/** Cordis plugin name. */
|
|
27
27
|
export const name = 'memory-notes';
|
|
@@ -54,8 +54,10 @@ function projectNameOf(cwd) {
|
|
|
54
54
|
class ProjectNotesServiceImpl extends ProjectNotesService {
|
|
55
55
|
ctx;
|
|
56
56
|
settings;
|
|
57
|
-
/** Last persisted file texts per notes dir, for skip-if-unchanged. */
|
|
57
|
+
/** Last persisted file texts per notes dir, for skip-if-unchanged and drift detection. */
|
|
58
58
|
persisted = new Map();
|
|
59
|
+
/** Set to true when a drift error was already reported for this dir (log-once). */
|
|
60
|
+
driftReported = new Set();
|
|
59
61
|
/** Last store health timestamp already rendered, for the dirty check. */
|
|
60
62
|
renderedHealthTs;
|
|
61
63
|
/** Debounce timer for activity-triggered re-renders. */
|
|
@@ -135,16 +137,44 @@ class ProjectNotesServiceImpl extends ProjectNotesService {
|
|
|
135
137
|
if (previous !== undefined && previous.conventions === snapshot.conventions && previous.pitfalls === snapshot.pitfalls) {
|
|
136
138
|
return;
|
|
137
139
|
}
|
|
138
|
-
this.persisted.set(dir, snapshot);
|
|
139
140
|
void (async () => {
|
|
140
141
|
try {
|
|
141
|
-
await
|
|
142
|
-
await
|
|
142
|
+
await writeNotesFile(path.join(dir, 'CONVENTIONS.md'), snapshot.conventions, previous?.conventions);
|
|
143
|
+
await writeNotesFile(path.join(dir, 'PITFALLS.md'), snapshot.pitfalls, previous?.pitfalls);
|
|
143
144
|
if (settings.notesAgentsPointer) {
|
|
144
145
|
await ensureAgentsPointer(path.join(cwd, 'AGENTS.md'), settings.notesDir);
|
|
145
146
|
}
|
|
147
|
+
// Only after a successful write: record this snapshot as the drift
|
|
148
|
+
// baseline so the next write can detect external modifications.
|
|
149
|
+
this.persisted.set(dir, snapshot);
|
|
146
150
|
}
|
|
147
|
-
catch {
|
|
151
|
+
catch (error) {
|
|
152
|
+
if (error instanceof DriftError) {
|
|
153
|
+
// Drift: external modification was backed up to `.bak.<ts>`;
|
|
154
|
+
// the store remains the source of truth and the in-memory
|
|
155
|
+
// snapshot continues to be served. Update the baseline to the
|
|
156
|
+
// drifted on-disk content so the NEXT persist attempt can write
|
|
157
|
+
// fresh content (the drift has been "absorbed" as the new base).
|
|
158
|
+
try {
|
|
159
|
+
const { readFile } = await import('node:fs/promises');
|
|
160
|
+
const driftedConventions = await readFile(path.join(dir, 'CONVENTIONS.md'), 'utf8').catch(() => undefined);
|
|
161
|
+
const driftedPitfalls = await readFile(path.join(dir, 'PITFALLS.md'), 'utf8').catch(() => undefined);
|
|
162
|
+
if (driftedConventions !== undefined || driftedPitfalls !== undefined) {
|
|
163
|
+
this.persisted.set(dir, {
|
|
164
|
+
conventions: driftedConventions ?? previous?.conventions ?? '',
|
|
165
|
+
pitfalls: driftedPitfalls ?? previous?.pitfalls ?? '',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
catch { /* best-effort */ }
|
|
170
|
+
// Report once per notes dir so the log is not spammed on every
|
|
171
|
+
// reconcile cycle; the user should reconcile the .bak file.
|
|
172
|
+
if (!this.driftReported.has(dir)) {
|
|
173
|
+
this.driftReported.add(dir);
|
|
174
|
+
console.warn(`[dsh-memory] ${error.message}. The in-memory snapshot continues to be served; resolve the drift by reviewing the .bak file and re-saving via memory tools.`);
|
|
175
|
+
}
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
148
178
|
// Best-effort: persistence failures never surface to the session.
|
|
149
179
|
}
|
|
150
180
|
})();
|
package/lib/notes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,OAAO,EAAE,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.
|
|
7
7
|
*
|
|
8
|
+
* Drift guard (P0-5): before overwriting a managed notes file the writer
|
|
9
|
+
* re-reads the current on-disk content and compares it to the last content
|
|
10
|
+
* this process wrote. When the file has been externally modified (hand edit,
|
|
11
|
+
* merge conflict resolution, another tool), the write is refused and the
|
|
12
|
+
* externally modified file is preserved as `<file>.bak.<ts>` so the user can
|
|
13
|
+
* reconcile manually. The marker-based AGENTS.md pointer block is exempt:
|
|
14
|
+
* it is already drift-safe (content outside the markers is never touched).
|
|
15
|
+
*
|
|
8
16
|
* @module @chenhw7/dsh-memory/notes/writer
|
|
9
17
|
*/
|
|
10
18
|
/**
|
|
@@ -14,6 +22,31 @@
|
|
|
14
22
|
* @param content - the full file content.
|
|
15
23
|
*/
|
|
16
24
|
export declare function writeFileAtomic(filePath: string, content: string): Promise<void>;
|
|
25
|
+
/** Thrown by {@link writeNotesFile} when the target file has drifted from the last write. */
|
|
26
|
+
export declare class DriftError extends Error {
|
|
27
|
+
/** Absolute path of the backup copy holding the externally modified content. */
|
|
28
|
+
readonly backupPath: string;
|
|
29
|
+
constructor(filePath: string, backupPath: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Write a managed notes file atomically with drift guard. Re-reads the
|
|
33
|
+
* current on-disk content before writing; when the file differs from both
|
|
34
|
+
* the previous content this process wrote (`previousContent`) AND the new
|
|
35
|
+
* content (i.e. someone/something else modified the file), the write is
|
|
36
|
+
* refused: the drifted file is copied to `<filePath>.bak.<ts>` and a
|
|
37
|
+
* {@link DriftError} is thrown so the caller can decide what to do.
|
|
38
|
+
*
|
|
39
|
+
* The first write (file absent) is always allowed. A write that is a no-op
|
|
40
|
+
* (new content equals what's on disk) is skipped silently.
|
|
41
|
+
*
|
|
42
|
+
* @param filePath - absolute path of the target file.
|
|
43
|
+
* @param content - the full file content to write.
|
|
44
|
+
* @param previousContent - the content this process last wrote to the file,
|
|
45
|
+
* or `undefined` when this is the first write in this process lifetime.
|
|
46
|
+
* @throws {DriftError} when the on-disk content matches neither
|
|
47
|
+
* `previousContent` nor `content`.
|
|
48
|
+
*/
|
|
49
|
+
export declare function writeNotesFile(filePath: string, content: string, previousContent: string | undefined): Promise<void>;
|
|
17
50
|
/** Marker opening the managed pointer block in AGENTS.md. */
|
|
18
51
|
export declare const AGENTS_POINTER_BEGIN = "<!-- dsh-memory:begin -->";
|
|
19
52
|
/** Marker closing the managed pointer block in AGENTS.md. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH;;;;;GAKG;AACH,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAUtF;AAED,6FAA6F;AAC7F,qBAAa,UAAW,SAAQ,KAAK;IACnC,gFAAgF;IAChF,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAE3B,YAAY,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAI/C;CACF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,eAAe,EAAE,MAAM,GAAG,SAAS,GAClC,OAAO,CAAC,IAAI,CAAC,CAoBf;AAED,6DAA6D;AAC7D,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,4BAA4B,CAAA;AAE3D,kFAAkF;AAClF,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAqB7F"}
|
package/lib/notes/writer.js
CHANGED
|
@@ -5,9 +5,17 @@
|
|
|
5
5
|
* (and concurrent sessions rendering the same truth) from ever seeing a torn
|
|
6
6
|
* file.
|
|
7
7
|
*
|
|
8
|
+
* Drift guard (P0-5): before overwriting a managed notes file the writer
|
|
9
|
+
* re-reads the current on-disk content and compares it to the last content
|
|
10
|
+
* this process wrote. When the file has been externally modified (hand edit,
|
|
11
|
+
* merge conflict resolution, another tool), the write is refused and the
|
|
12
|
+
* externally modified file is preserved as `<file>.bak.<ts>` so the user can
|
|
13
|
+
* reconcile manually. The marker-based AGENTS.md pointer block is exempt:
|
|
14
|
+
* it is already drift-safe (content outside the markers is never touched).
|
|
15
|
+
*
|
|
8
16
|
* @module @chenhw7/dsh-memory/notes/writer
|
|
9
17
|
*/
|
|
10
|
-
import { mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
|
18
|
+
import { copyFile, mkdir, readFile, rename, unlink, writeFile } from 'node:fs/promises';
|
|
11
19
|
import path from 'node:path';
|
|
12
20
|
/**
|
|
13
21
|
* Write a file atomically: write to a sibling temp file, then rename.
|
|
@@ -27,6 +35,58 @@ export async function writeFileAtomic(filePath, content) {
|
|
|
27
35
|
throw error;
|
|
28
36
|
}
|
|
29
37
|
}
|
|
38
|
+
/** Thrown by {@link writeNotesFile} when the target file has drifted from the last write. */
|
|
39
|
+
export class DriftError extends Error {
|
|
40
|
+
/** Absolute path of the backup copy holding the externally modified content. */
|
|
41
|
+
backupPath;
|
|
42
|
+
constructor(filePath, backupPath) {
|
|
43
|
+
super(`notes file drifted: external modification detected at ${filePath}; backup saved to ${backupPath}`);
|
|
44
|
+
this.name = 'DriftError';
|
|
45
|
+
this.backupPath = backupPath;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Write a managed notes file atomically with drift guard. Re-reads the
|
|
50
|
+
* current on-disk content before writing; when the file differs from both
|
|
51
|
+
* the previous content this process wrote (`previousContent`) AND the new
|
|
52
|
+
* content (i.e. someone/something else modified the file), the write is
|
|
53
|
+
* refused: the drifted file is copied to `<filePath>.bak.<ts>` and a
|
|
54
|
+
* {@link DriftError} is thrown so the caller can decide what to do.
|
|
55
|
+
*
|
|
56
|
+
* The first write (file absent) is always allowed. A write that is a no-op
|
|
57
|
+
* (new content equals what's on disk) is skipped silently.
|
|
58
|
+
*
|
|
59
|
+
* @param filePath - absolute path of the target file.
|
|
60
|
+
* @param content - the full file content to write.
|
|
61
|
+
* @param previousContent - the content this process last wrote to the file,
|
|
62
|
+
* or `undefined` when this is the first write in this process lifetime.
|
|
63
|
+
* @throws {DriftError} when the on-disk content matches neither
|
|
64
|
+
* `previousContent` nor `content`.
|
|
65
|
+
*/
|
|
66
|
+
export async function writeNotesFile(filePath, content, previousContent) {
|
|
67
|
+
let onDisk;
|
|
68
|
+
try {
|
|
69
|
+
onDisk = await readFile(filePath, 'utf8');
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (error.code !== 'ENOENT')
|
|
73
|
+
throw error;
|
|
74
|
+
}
|
|
75
|
+
if (onDisk !== undefined) {
|
|
76
|
+
// No-op: content already on disk matches what we want to write.
|
|
77
|
+
if (onDisk === content)
|
|
78
|
+
return;
|
|
79
|
+
// Drift: the on-disk content does not match our last write — someone
|
|
80
|
+
// else (hand edit, merge tool, another process) modified the file.
|
|
81
|
+
const drifted = previousContent === undefined || onDisk !== previousContent;
|
|
82
|
+
if (drifted) {
|
|
83
|
+
const backupPath = `${filePath}.bak.${Date.now()}`;
|
|
84
|
+
await copyFile(filePath, backupPath);
|
|
85
|
+
throw new DriftError(filePath, backupPath);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
await writeFileAtomic(filePath, content);
|
|
89
|
+
}
|
|
30
90
|
/** Marker opening the managed pointer block in AGENTS.md. */
|
|
31
91
|
export const AGENTS_POINTER_BEGIN = '<!-- dsh-memory:begin -->';
|
|
32
92
|
/** Marker closing the managed pointer block in AGENTS.md. */
|
package/lib/notes/writer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/notes/writer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACvF,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,QAAgB,EAAE,OAAe;IACrE,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;IACxD,MAAM,GAAG,GAAG,GAAG,QAAQ,IAAI,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,MAAM,CAAA;IAC1D,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,CAAC,CAAA;QACrC,MAAM,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAA;IAC7B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;QACjC,MAAM,KAAK,CAAA;IACb,CAAC;AACH,CAAC;AAED,6FAA6F;AAC7F,MAAM,OAAO,UAAW,SAAQ,KAAK;IACnC,gFAAgF;IACvE,UAAU,CAAQ;IAE3B,YAAY,QAAgB,EAAE,UAAkB;QAC9C,KAAK,CAAC,yDAAyD,QAAQ,qBAAqB,UAAU,EAAE,CAAC,CAAA;QACzG,IAAI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
|
@@ -6,15 +6,24 @@
|
|
|
6
6
|
* write-serialized through the existing store contract. The service delegates to
|
|
7
7
|
* `ctx.memory` — it does not duplicate the store.
|
|
8
8
|
*
|
|
9
|
-
* Host integration: the `./remote` subpath
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* Host integration: the `./remote-service` subpath is mounted as the
|
|
10
|
+
* `memory-remote` composition entry (cordis.patch.yml); the browser half mounts
|
|
11
|
+
* the matching client contribution itself (`src/typert.remote-client.js`).
|
|
12
|
+
*
|
|
13
|
+
* Deployment security (verified against the harness sources, 2026-08): there is
|
|
14
|
+
* NO per-method `PRIVILEGED_METHODS` registry — the trust fence is transport
|
|
15
|
+
* level. Every `/api` request passes `api-request-trust`
|
|
16
|
+
* (`packages/client/connection/src/api-request-trust.ts`), which admits
|
|
17
|
+
* loopback / deployment-derived LAN literals / declared `trustedHosts` hosts
|
|
18
|
+
* and rejects DNS-rebinding and cross-site requests before any RPC runs. So a
|
|
19
|
+
* non-loopback caller cannot reach `add`/`update`/`remove` at all; nothing to
|
|
20
|
+
* pin per method.
|
|
12
21
|
*
|
|
13
22
|
* @module @chenhw7/dsh-memory/remote
|
|
14
23
|
*/
|
|
15
24
|
import type { Context } from '@deepseek-ai/cordis';
|
|
16
25
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
17
|
-
import type { AuditEntry } from '../types.ts';
|
|
26
|
+
import type { AuditEntry, AuditSource } from '../types.ts';
|
|
18
27
|
/** Cordis plugin name. */
|
|
19
28
|
export declare const name = "memory-remote";
|
|
20
29
|
/** The memory service is required. */
|
|
@@ -37,11 +46,13 @@ export interface MemoryEntryJson {
|
|
|
37
46
|
readonly scope: 'global' | 'project' | 'user';
|
|
38
47
|
readonly category?: string;
|
|
39
48
|
readonly content: string;
|
|
49
|
+
readonly summary?: string;
|
|
40
50
|
readonly projectName?: string;
|
|
41
51
|
readonly createdAt: number;
|
|
42
52
|
readonly updatedAt: number;
|
|
43
53
|
readonly pinned?: boolean;
|
|
44
54
|
readonly lastRecalledAt?: number;
|
|
55
|
+
readonly staleSince?: number;
|
|
45
56
|
}
|
|
46
57
|
export interface MemoryListRequest {
|
|
47
58
|
readonly scope?: 'global' | 'project' | 'user';
|
|
@@ -81,6 +92,7 @@ export interface MemoryUpdateRequest {
|
|
|
81
92
|
readonly id: string;
|
|
82
93
|
readonly content?: string;
|
|
83
94
|
readonly category?: string;
|
|
95
|
+
readonly summary?: string;
|
|
84
96
|
}
|
|
85
97
|
export interface MemoryUpdateResult {
|
|
86
98
|
readonly entry?: MemoryEntryJson;
|
|
@@ -110,15 +122,68 @@ export interface MemoryHealthResult {
|
|
|
110
122
|
};
|
|
111
123
|
pinned: number;
|
|
112
124
|
auditRecords: number;
|
|
125
|
+
stale?: number;
|
|
113
126
|
lastActivityTs?: number;
|
|
114
127
|
lastExtractionTs?: number;
|
|
115
128
|
}
|
|
129
|
+
/** Distinct `projectName` values across all `project`-scoped entries. */
|
|
130
|
+
export interface MemoryProjectsResult {
|
|
131
|
+
readonly projects: readonly string[];
|
|
132
|
+
}
|
|
116
133
|
export interface MemoryAuditRequest {
|
|
117
134
|
readonly limit?: number;
|
|
118
135
|
}
|
|
119
136
|
export interface MemoryAuditResult {
|
|
120
137
|
readonly entries: readonly AuditEntry[];
|
|
121
138
|
}
|
|
139
|
+
/** Wire-safe suggestion projection for the pending-review list. */
|
|
140
|
+
export interface MemorySuggestionJson {
|
|
141
|
+
readonly id: string;
|
|
142
|
+
readonly scope: 'global' | 'project' | 'user';
|
|
143
|
+
readonly category?: string;
|
|
144
|
+
readonly content: string;
|
|
145
|
+
readonly summary?: string;
|
|
146
|
+
readonly projectName?: string;
|
|
147
|
+
/** Times this same proposal was re-observed; the list sorts highest first. */
|
|
148
|
+
readonly hits: number;
|
|
149
|
+
readonly firstSeenAt: number;
|
|
150
|
+
readonly lastSeenAt: number;
|
|
151
|
+
/** When set, adoption rewrites this entry instead of creating a new one. */
|
|
152
|
+
readonly targetEntryId?: string;
|
|
153
|
+
readonly source: AuditSource;
|
|
154
|
+
readonly sessionId?: string;
|
|
155
|
+
}
|
|
156
|
+
export interface MemorySuggestListResult {
|
|
157
|
+
readonly suggestions: readonly MemorySuggestionJson[];
|
|
158
|
+
}
|
|
159
|
+
export interface MemorySuggestAdoptRequest {
|
|
160
|
+
readonly id: string;
|
|
161
|
+
/** "Edit before adopt" overrides applied on top of the proposal. */
|
|
162
|
+
readonly content?: string;
|
|
163
|
+
readonly category?: string;
|
|
164
|
+
readonly summary?: string;
|
|
165
|
+
}
|
|
166
|
+
export interface MemorySuggestAdoptResult {
|
|
167
|
+
readonly entry?: MemoryEntryJson;
|
|
168
|
+
readonly found: boolean;
|
|
169
|
+
readonly error?: string;
|
|
170
|
+
}
|
|
171
|
+
export interface MemorySuggestRejectRequest {
|
|
172
|
+
readonly id: string;
|
|
173
|
+
}
|
|
174
|
+
export interface MemorySuggestRejectResult {
|
|
175
|
+
readonly rejected: boolean;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Manual dormancy toggle (P1-7 archive semantics): setting `archived` stamps
|
|
179
|
+
* `staleSince`, hiding the entry from injection surfaces while keeping it
|
|
180
|
+
* searchable; clearing lifts the stamp. Same mechanism as soft decay — the
|
|
181
|
+
* human just drives it directly instead of waiting for the janitor.
|
|
182
|
+
*/
|
|
183
|
+
export interface MemoryArchiveRequest {
|
|
184
|
+
readonly id: string;
|
|
185
|
+
readonly archived: boolean;
|
|
186
|
+
}
|
|
122
187
|
/**
|
|
123
188
|
* Remote service exposing the memory store to the client UI. Extends
|
|
124
189
|
* `TypertRemoteService` so the host Typert generator discovers the `@Remote`
|
|
@@ -137,9 +202,41 @@ export declare class MemoryRemoteService extends TypertRemoteService {
|
|
|
137
202
|
get(request: MemoryGetRequest): MemoryGetResult;
|
|
138
203
|
add(request: MemoryAddRequest): Promise<MemoryAddResult>;
|
|
139
204
|
update(request: MemoryUpdateRequest): Promise<MemoryUpdateResult>;
|
|
140
|
-
|
|
205
|
+
/**
|
|
206
|
+
* Delete one entry. Named `removeEntry` rather than `remove`: the gateway's
|
|
207
|
+
* client-side namespace service reserves a handful of member names
|
|
208
|
+
* (`remove` among them — its internal uninstall method), and a contribution
|
|
209
|
+
* descriptor carrying one of those names fails validation at mount time.
|
|
210
|
+
*/
|
|
211
|
+
removeEntry(request: MemoryRemoveRequest): Promise<MemoryRemoveResult>;
|
|
141
212
|
pin(request: MemoryPinRequest): Promise<MemoryPinResult>;
|
|
213
|
+
/**
|
|
214
|
+
* Pending-review queue for the Memory section's review tab (P1-1). Highest
|
|
215
|
+
* `hits` first — the store's ordering already encodes "frequency is signal".
|
|
216
|
+
*/
|
|
217
|
+
suggestList(): MemorySuggestListResult;
|
|
218
|
+
/**
|
|
219
|
+
* Adopt one pending proposal, optionally with human edits. The write goes
|
|
220
|
+
* through the store contract (scanner, audit with source `'ui'`), so the
|
|
221
|
+
* human decision lands exactly like a hand-made edit.
|
|
222
|
+
*/
|
|
223
|
+
suggestAdopt(request: MemorySuggestAdoptRequest): Promise<MemorySuggestAdoptResult>;
|
|
224
|
+
/** Reject one pending proposal: the row leaves the queue, nothing is written. */
|
|
225
|
+
suggestReject(request: MemorySuggestRejectRequest): Promise<MemorySuggestRejectResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Manual dormancy toggle (P1-7 archive): `archived: true` stamps
|
|
228
|
+
* `staleSince` (hidden from injection, still searchable); false lifts it.
|
|
229
|
+
* Directly reuses the soft-decay representation so every existing surface
|
|
230
|
+
* (injection filters, stale badges, recall-revival) behaves consistently.
|
|
231
|
+
*/
|
|
232
|
+
archive(request: MemoryArchiveRequest): Promise<MemoryPinResult>;
|
|
142
233
|
health(): MemoryHealthResult;
|
|
234
|
+
/**
|
|
235
|
+
* Distinct project names across all `project`-scoped entries — the data
|
|
236
|
+
* source for the management UI's workspace selector. Aggregated here from
|
|
237
|
+
* `store.list('project')` so the store contract stays untouched.
|
|
238
|
+
*/
|
|
239
|
+
projects(): MemoryProjectsResult;
|
|
143
240
|
auditLog(request: MemoryAuditRequest): MemoryAuditResult;
|
|
144
241
|
}
|
|
145
242
|
export type * from './types.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/remote/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/remote/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,EAAE,mBAAmB,EAAU,MAAM,kCAAkC,CAAA;AAE9E,OAAO,KAAK,EAEV,UAAU,EACV,WAAW,EAOZ,MAAM,aAAa,CAAA;AAEpB,0BAA0B;AAC1B,eAAO,MAAM,IAAI,kBAAkB,CAAA;AAEnC,sCAAsC;AACtC,eAAO,MAAM,MAAM,UAAa,CAAA;AAEhC,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,YAAY,EAAE,mBAAmB,CAAA;KAClC;CACF;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAExC;AAID,+DAA+D;AAC/D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,MAAM,CAAC,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