@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.
- package/README.i18n.yaml +2 -0
- package/README.md +9 -8
- package/{README.zh-CN.md → README.zh.md} +8 -7
- package/cordis.patch.yml +5 -1
- package/lib/benchmark/index.d.ts +24 -7
- package/lib/benchmark/index.d.ts.map +1 -1
- package/lib/benchmark/index.js +55 -7
- package/lib/benchmark/index.js.map +1 -1
- package/lib/client/index.js +75 -11
- package/lib/context/conflict.d.ts +23 -10
- package/lib/context/conflict.d.ts.map +1 -1
- package/lib/context/conflict.js +59 -20
- package/lib/context/conflict.js.map +1 -1
- package/lib/context/index.d.ts +45 -1
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +153 -9
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +12 -0
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +22 -4
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +50 -2
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +46 -1
- package/lib/index.js.map +1 -1
- package/lib/notes/cleanup.d.ts +7 -1
- package/lib/notes/cleanup.d.ts.map +1 -1
- package/lib/notes/cleanup.js +17 -12
- package/lib/notes/cleanup.js.map +1 -1
- package/lib/notes/index.d.ts +3 -1
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +8 -3
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/scope.d.ts +5 -5
- package/lib/notes/scope.js +5 -5
- package/lib/remote/index.d.ts +67 -6
- package/lib/remote/index.d.ts.map +1 -1
- package/lib/remote/index.js +94 -9
- package/lib/remote/index.js.map +1 -1
- package/lib/remote/typert.remote-client.d.ts +8 -1
- package/lib/remote/typert.remote-client.js +6 -0
- package/lib/remote/types.d.ts +1 -1
- package/lib/remote/types.d.ts.map +1 -1
- package/lib/review/accumulator.d.ts +1 -1
- package/lib/review/accumulator.js +1 -1
- package/lib/review/consolidate.d.ts +230 -0
- package/lib/review/consolidate.d.ts.map +1 -0
- package/lib/review/consolidate.js +435 -0
- package/lib/review/consolidate.js.map +1 -0
- package/lib/review/dedup.d.ts +23 -15
- package/lib/review/dedup.d.ts.map +1 -1
- package/lib/review/dedup.js +34 -83
- package/lib/review/dedup.js.map +1 -1
- package/lib/review/extract.d.ts +63 -12
- package/lib/review/extract.d.ts.map +1 -1
- package/lib/review/extract.js +168 -31
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts +20 -0
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +68 -16
- package/lib/review/index.js.map +1 -1
- package/lib/review/sweep.d.ts +171 -0
- package/lib/review/sweep.d.ts.map +1 -0
- package/lib/review/sweep.js +310 -0
- package/lib/review/sweep.js.map +1 -0
- package/lib/scanner.d.ts +2 -0
- package/lib/scanner.d.ts.map +1 -1
- package/lib/scanner.js +22 -0
- package/lib/scanner.js.map +1 -1
- package/lib/store/bm25.d.ts +75 -1
- package/lib/store/bm25.d.ts.map +1 -1
- package/lib/store/bm25.js +162 -17
- package/lib/store/bm25.js.map +1 -1
- package/lib/store/cross-process.d.ts +155 -0
- package/lib/store/cross-process.d.ts.map +1 -0
- package/lib/store/cross-process.js +254 -0
- package/lib/store/cross-process.js.map +1 -0
- package/lib/store/index.d.ts +199 -9
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +652 -92
- package/lib/store/index.js.map +1 -1
- package/lib/store/sqlite.d.ts +126 -0
- package/lib/store/sqlite.d.ts.map +1 -0
- package/lib/store/sqlite.js +653 -0
- package/lib/store/sqlite.js.map +1 -0
- package/lib/tool/index.d.ts +17 -5
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +253 -21
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +81 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +18 -3
package/lib/context/policy.js
CHANGED
|
@@ -5,6 +5,24 @@
|
|
|
5
5
|
* @module @chenhw7/dsh-memory/context/policy
|
|
6
6
|
*/
|
|
7
7
|
import { redactBlocked } from '../scanner.js';
|
|
8
|
+
/** Fence tag names owned by this plugin's injection surfaces. */
|
|
9
|
+
export const PROMPT_FENCE_TAGS = ['memory-context', 'memory-index', 'recalled-memory', 'project-notes', 'memory-policy'];
|
|
10
|
+
/**
|
|
11
|
+
* Neutralize forged fence closers before stored content enters an injection
|
|
12
|
+
* fence: `</memory-context>` becomes `<\/memory-context>` so a stored entry
|
|
13
|
+
* cannot close the plugin's own fence and speak outside it. Opening tags are
|
|
14
|
+
* left intact — they cannot terminate a fence — and the escaping applies to
|
|
15
|
+
* stored content only; the fences this builder itself emits stay untouched.
|
|
16
|
+
* @param text - store-sourced text about to be wrapped in a plugin fence.
|
|
17
|
+
* @returns the same text with every plugin-owned closer neutralized.
|
|
18
|
+
*/
|
|
19
|
+
export function neutralizeFenceBreaks(text) {
|
|
20
|
+
let out = text;
|
|
21
|
+
for (const tag of PROMPT_FENCE_TAGS) {
|
|
22
|
+
out = out.split(`</${tag}>`).join(`<\\/${tag}>`);
|
|
23
|
+
}
|
|
24
|
+
return out;
|
|
25
|
+
}
|
|
8
26
|
/**
|
|
9
27
|
* The fixed `<memory-policy>` guidance block injected verbatim by the `full`
|
|
10
28
|
* and `policy-only` modes.
|
|
@@ -53,7 +71,7 @@ export function buildNotesSectionText(conventions, pitfalls, charLimit) {
|
|
|
53
71
|
const body = [conventions, pitfalls].filter(text => text.trim().length > 0).join('\n\n');
|
|
54
72
|
if (body.length === 0)
|
|
55
73
|
return '';
|
|
56
|
-
let text = `<project-notes>\n${PROJECT_NOTES_NOTE}\n\n${body}\n</project-notes>`;
|
|
74
|
+
let text = `<project-notes>\n${PROJECT_NOTES_NOTE}\n\n${neutralizeFenceBreaks(body)}\n</project-notes>`;
|
|
57
75
|
if (text.length > charLimit) {
|
|
58
76
|
text = `${text.slice(0, charLimit)}\n…(project notes truncated at ${charLimit} characters)`;
|
|
59
77
|
}
|
|
@@ -149,12 +167,12 @@ export function buildMemorySectionText(mode, customText, memoryContent, indexCon
|
|
|
149
167
|
case 'full': {
|
|
150
168
|
if (memoryContent.length === 0)
|
|
151
169
|
return MEMORY_POLICY_TEXT;
|
|
152
|
-
return `<memory-context>\n${MEMORY_CONTEXT_NOTE}\n\n${memoryContent}\n</memory-context>\n\n${MEMORY_POLICY_TEXT}`;
|
|
170
|
+
return `<memory-context>\n${MEMORY_CONTEXT_NOTE}\n\n${neutralizeFenceBreaks(memoryContent)}\n</memory-context>\n\n${MEMORY_POLICY_TEXT}`;
|
|
153
171
|
}
|
|
154
172
|
case 'index': {
|
|
155
173
|
if (indexContent.length === 0)
|
|
156
174
|
return MEMORY_POLICY_TEXT;
|
|
157
|
-
return `<memory-index>\n${MEMORY_INDEX_NOTE}\n\n${indexContent}\n</memory-index>\n\n${MEMORY_POLICY_TEXT}`;
|
|
175
|
+
return `<memory-index>\n${MEMORY_INDEX_NOTE}\n\n${neutralizeFenceBreaks(indexContent)}\n</memory-index>\n\n${MEMORY_POLICY_TEXT}`;
|
|
158
176
|
}
|
|
159
177
|
}
|
|
160
178
|
}
|
|
@@ -196,7 +214,7 @@ export function buildAutoRecallBlock(entries, charLimit = AUTO_RECALL_CHAR_LIMIT
|
|
|
196
214
|
}
|
|
197
215
|
if (lines.length === 0)
|
|
198
216
|
return '';
|
|
199
|
-
const fence = `<recalled-memory>\n${AUTO_RECALL_NOTE}\n\n${lines.join('\n')}\n</recalled-memory>`;
|
|
217
|
+
const fence = `<recalled-memory>\n${AUTO_RECALL_NOTE}\n\n${neutralizeFenceBreaks(lines.join('\n'))}\n</recalled-memory>`;
|
|
200
218
|
return `${fence}\n[recalled-memory fence: ${fence.length} characters ≈${estimateFenceTokens(fence)} tokens]`;
|
|
201
219
|
}
|
|
202
220
|
//# sourceMappingURL=policy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../src/context/policy.ts"],"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AAK,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAA;QAC7F,qEAAqE;QACrE,kEAAkE;QAClE,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;YAClE,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YAC5C,CAAC,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAA;QAC9C,MAAM,IAAI,GAAG,MAAM,KAAK,KAAK,IAAI,EAAE,CAAA;QACnC,IAAI,IAAI,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,SAAS;YAAE,MAAK;QAC7C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAChB,IAAI,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAA;IACzB,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACjC,MAAM,KAAK,GAAG,sBAAsB,gBAAgB,OAAO,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,sBAAsB,CAAA;IACxH,OAAO,GAAG,KAAK,6BAA6B,KAAK,CAAC,MAAM,gBAAgB,mBAAmB,CAAC,KAAK,CAAC,UAAU,CAAA;AAC9G,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* the automatic extraction, and the system-prompt context injection.
|
|
7
7
|
*
|
|
8
8
|
* The root entry re-exports the shared vocabulary (types, MemoryStore,
|
|
9
|
-
* scanContent) so internal modules and
|
|
9
|
+
* scanContent, the store's meta-record type) so internal modules and
|
|
10
|
+
* downstream consumers share one surface.
|
|
10
11
|
*
|
|
11
12
|
* @module @chenhw7/dsh-memory
|
|
12
13
|
*/
|
|
@@ -14,6 +15,7 @@ import { MemoryId, AuditId, SuggestionId } from './brand.ts';
|
|
|
14
15
|
import { scanContent } from './scanner.ts';
|
|
15
16
|
import type { AddMemoryInput, AddMemoryResult, AddSuggestionInput, AdoptSuggestionOverride, AuditEntry, MemoryEntry, MemoryHealth, MemorySearchQuery, MemorySuggestion, SearchMemoryResult, UpdateMemoryInput } from './types.ts';
|
|
16
17
|
export type { AddMemoryInput, AddMemoryResult, AddSuggestionInput, AdoptSuggestionOverride, AuditEntry, AuditOp, AuditSource, MemoryCategory, MemoryEntry, MemoryHealth, MemoryScope, MemorySearchQuery, MemorySuggestion, ScanResult, SearchMemoryResult, UpdateMemoryInput, } from './types.ts';
|
|
18
|
+
export type { MemoryMetaRecord } from './store/index.ts';
|
|
17
19
|
export { MemoryId, AuditId, SuggestionId, scanContent };
|
|
18
20
|
declare module '@deepseek-ai/cordis' {
|
|
19
21
|
interface Context {
|
|
@@ -65,7 +67,9 @@ export declare abstract class MemoryStore {
|
|
|
65
67
|
*/
|
|
66
68
|
abstract remove(id: MemoryId): Promise<boolean>;
|
|
67
69
|
/**
|
|
68
|
-
* Search entries by scope, category, project, and
|
|
70
|
+
* Search entries by scope, category, project, and a text query. The text
|
|
71
|
+
* matching algorithm is implementation-defined; `DomainMemoryStore` ranks by
|
|
72
|
+
* BM25 relevance over whole tokens.
|
|
69
73
|
* @param query - The search parameters. When `query.recordRecall` is false
|
|
70
74
|
* the read must not count as a recall: no `lastRecalledAt` stamping and no
|
|
71
75
|
* dormant revival (the management UI browses through this flag).
|
|
@@ -103,6 +107,16 @@ export declare abstract class MemoryStore {
|
|
|
103
107
|
* @param ids - The entry ids that were recalled.
|
|
104
108
|
*/
|
|
105
109
|
markRecalled(ids: readonly string[]): void;
|
|
110
|
+
/**
|
|
111
|
+
* Record one failure swallowed by a best-effort background path (flush,
|
|
112
|
+
* janitor, curator, judge, per-row rewrite, ...) so it stays observable
|
|
113
|
+
* instead of silently vanishing. Fire-and-forget like {@link markRecalled}:
|
|
114
|
+
* the default implementation is a no-op, so providers without failure
|
|
115
|
+
* tracking remain contract-conformant and callers never handle failures.
|
|
116
|
+
* @param site - stable identifier of the failing path; doubles as the counter key.
|
|
117
|
+
* @param error - the swallowed error, when one was caught.
|
|
118
|
+
*/
|
|
119
|
+
reportFailure(_site: string, _error?: unknown): void;
|
|
106
120
|
/**
|
|
107
121
|
* Record one model/extraction proposal in the pending-review queue.
|
|
108
122
|
* @param input - the proposal to record.
|
|
@@ -151,6 +165,40 @@ export declare abstract class MemoryStore {
|
|
|
151
165
|
* @returns all audit entries, oldest first.
|
|
152
166
|
*/
|
|
153
167
|
abstract exportAuditLog(): readonly AuditEntry[];
|
|
168
|
+
/**
|
|
169
|
+
* Read one entry's unredacted content — the deliberate break-glass path for
|
|
170
|
+
* human review and repair (memory_replace) after the display layers redact
|
|
171
|
+
* scanner-blocked payloads to `[BLOCKED: …]`. Every call appends a
|
|
172
|
+
* `readRaw` audit record (best-effort, source `'ui'`), so raw reads are as
|
|
173
|
+
* observable as mutations. Returns `undefined` when the id does not exist.
|
|
174
|
+
* The default is a no-op returning `undefined`, so providers without raw
|
|
175
|
+
* support stay contract-conformant.
|
|
176
|
+
*/
|
|
177
|
+
getRaw(_id: MemoryId): Promise<MemoryEntry | undefined>;
|
|
178
|
+
/**
|
|
179
|
+
* Supersede one entry through the batch-consolidation path (write-path
|
|
180
|
+
* rework): flips `status` to `'superseded'`, stamps `supersededBy`, and
|
|
181
|
+
* appends a visible supersession annotation to the content — the ONLY
|
|
182
|
+
* write path allowed to flip an entry's status (`update` deliberately does
|
|
183
|
+
* not accept it). Returns the superseded entry, or `undefined` when the id
|
|
184
|
+
* does not exist or the provider has no supersession support. The default
|
|
185
|
+
* is a no-op returning `undefined`, so providers without the seam stay
|
|
186
|
+
* contract-conformant and the consolidation path degrades to a plain add.
|
|
187
|
+
* @param _id - The entry being superseded.
|
|
188
|
+
* @param _supersededBy - The id of the newer, contradicting entry.
|
|
189
|
+
*/
|
|
190
|
+
supersedeEntry(_id: MemoryId, _supersededBy: MemoryId): Promise<MemoryEntry | undefined>;
|
|
191
|
+
/**
|
|
192
|
+
* Record usage hits on the given entries (write-path rework Step 2):
|
|
193
|
+
* the assistant's answer echoed these entries' tokens/anchors after they
|
|
194
|
+
* were injected. Bumps `hitCount` and stamps `lastHitAt`; fire-and-forget
|
|
195
|
+
* and never throws into the caller. The default is a no-op so providers
|
|
196
|
+
* without usage tracking stay contract-conformant. `hitCount` feeds only
|
|
197
|
+
* the periodic sweep's selection — it never drives deletion (`decayDays`
|
|
198
|
+
* remains the only forgetting knob).
|
|
199
|
+
* @param _ids - The ids of the entries the answer echoed.
|
|
200
|
+
*/
|
|
201
|
+
markHits(_ids: readonly MemoryId[]): Promise<void>;
|
|
154
202
|
}
|
|
155
203
|
/**
|
|
156
204
|
* Validate that project-scoped entries carry a projectName.
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,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,YAAY,CAAA;AAEnB,YAAY,EACV,cAAc,EACd,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,UAAU,EACV,OAAO,EACP,WAAW,EACX,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,gBAAg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SAAS,CAAC,CAAsC;IAE7F;;;;;;;;;;;OAWG;IACH,cAAc,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,GAAG,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAAsC;IAE9H;;;;;;;;;OASG;IACG,QAAQ,CAAC,IAAI,EAAE,SAAS,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAmF;CAC5I;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,cAAc,GAAG,IAAI,CAIhE;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAIjE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,IAAI,oBAAoB,CAAA;AACrC,wBAAgB,KAAK,IAAI,IAAI,CAA8C"}
|
package/lib/index.js
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* the automatic extraction, and the system-prompt context injection.
|
|
7
7
|
*
|
|
8
8
|
* The root entry re-exports the shared vocabulary (types, MemoryStore,
|
|
9
|
-
* scanContent) so internal modules and
|
|
9
|
+
* scanContent, the store's meta-record type) so internal modules and
|
|
10
|
+
* downstream consumers share one surface.
|
|
10
11
|
*
|
|
11
12
|
* @module @chenhw7/dsh-memory
|
|
12
13
|
*/
|
|
@@ -49,6 +50,16 @@ export class MemoryStore {
|
|
|
49
50
|
* @param ids - The entry ids that were recalled.
|
|
50
51
|
*/
|
|
51
52
|
markRecalled(ids) { }
|
|
53
|
+
/**
|
|
54
|
+
* Record one failure swallowed by a best-effort background path (flush,
|
|
55
|
+
* janitor, curator, judge, per-row rewrite, ...) so it stays observable
|
|
56
|
+
* instead of silently vanishing. Fire-and-forget like {@link markRecalled}:
|
|
57
|
+
* the default implementation is a no-op, so providers without failure
|
|
58
|
+
* tracking remain contract-conformant and callers never handle failures.
|
|
59
|
+
* @param site - stable identifier of the failing path; doubles as the counter key.
|
|
60
|
+
* @param error - the swallowed error, when one was caught.
|
|
61
|
+
*/
|
|
62
|
+
reportFailure(_site, _error) { }
|
|
52
63
|
// ─── Suggestion queue (P1-1 optional human-confirm mode) ──────────────────
|
|
53
64
|
//
|
|
54
65
|
// Default implementations follow the `markRecalled` precedent: providers
|
|
@@ -83,6 +94,40 @@ export class MemoryStore {
|
|
|
83
94
|
* @returns whether the suggestion existed and was removed.
|
|
84
95
|
*/
|
|
85
96
|
rejectSuggestion(_id) { return Promise.resolve(false); }
|
|
97
|
+
/**
|
|
98
|
+
* Read one entry's unredacted content — the deliberate break-glass path for
|
|
99
|
+
* human review and repair (memory_replace) after the display layers redact
|
|
100
|
+
* scanner-blocked payloads to `[BLOCKED: …]`. Every call appends a
|
|
101
|
+
* `readRaw` audit record (best-effort, source `'ui'`), so raw reads are as
|
|
102
|
+
* observable as mutations. Returns `undefined` when the id does not exist.
|
|
103
|
+
* The default is a no-op returning `undefined`, so providers without raw
|
|
104
|
+
* support stay contract-conformant.
|
|
105
|
+
*/
|
|
106
|
+
getRaw(_id) { return Promise.resolve(undefined); }
|
|
107
|
+
/**
|
|
108
|
+
* Supersede one entry through the batch-consolidation path (write-path
|
|
109
|
+
* rework): flips `status` to `'superseded'`, stamps `supersededBy`, and
|
|
110
|
+
* appends a visible supersession annotation to the content — the ONLY
|
|
111
|
+
* write path allowed to flip an entry's status (`update` deliberately does
|
|
112
|
+
* not accept it). Returns the superseded entry, or `undefined` when the id
|
|
113
|
+
* does not exist or the provider has no supersession support. The default
|
|
114
|
+
* is a no-op returning `undefined`, so providers without the seam stay
|
|
115
|
+
* contract-conformant and the consolidation path degrades to a plain add.
|
|
116
|
+
* @param _id - The entry being superseded.
|
|
117
|
+
* @param _supersededBy - The id of the newer, contradicting entry.
|
|
118
|
+
*/
|
|
119
|
+
supersedeEntry(_id, _supersededBy) { return Promise.resolve(undefined); }
|
|
120
|
+
/**
|
|
121
|
+
* Record usage hits on the given entries (write-path rework Step 2):
|
|
122
|
+
* the assistant's answer echoed these entries' tokens/anchors after they
|
|
123
|
+
* were injected. Bumps `hitCount` and stamps `lastHitAt`; fire-and-forget
|
|
124
|
+
* and never throws into the caller. The default is a no-op so providers
|
|
125
|
+
* without usage tracking stay contract-conformant. `hitCount` feeds only
|
|
126
|
+
* the periodic sweep's selection — it never drives deletion (`decayDays`
|
|
127
|
+
* remains the only forgetting knob).
|
|
128
|
+
* @param _ids - The ids of the entries the answer echoed.
|
|
129
|
+
*/
|
|
130
|
+
async markHits(_ids) { }
|
|
86
131
|
}
|
|
87
132
|
/**
|
|
88
133
|
* Validate that project-scoped entries carry a projectName.
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAoC1C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AAQvD;;;;GAIG;AACH,MAAM,OAAgB,WAAW;IAC/B;;;OAGG;IACH;QACE,IAAI,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;YAC/B,MAAM,IAAI,SAAS,CAAC,6DAA6D,CAAC,CAAA;QACpF,CAAC;IACH,CAAC;IA+DD;;;;;OAKG;IACH,YAAY,CAAC,GAAa,IAAsC,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA,CAAC,CAAC;IAEnG;;;OAGG;IACH,cAAc,CAAC,GAAa,IAAsC,OAAO,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA,CAAC,CAAC;IAErG;;;;;;;OAOG;IACH,YAAY,CAAC,GAAsB,IAA8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AAC,CAAA;IACjE,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,OAA2B;IACzD,IAAI,OAAO,KAAK,SAAS,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzD,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAA;IAC9D,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,iBAAiB,CAAA;AACrC,MAAM,UAAU,KAAK,KAAqD,CAAC"}
|
package/lib/notes/cleanup.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export declare const AGENTS_POINTER_BEGIN = "<!-- dsh-memory:begin -->";
|
|
|
23
23
|
export declare const AGENTS_POINTER_END = "<!-- dsh-memory:end -->";
|
|
24
24
|
/** The default notes dir location ≤0.5.x exported to (custom notesDir values are not recoverable here). */
|
|
25
25
|
export declare const LEGACY_NOTES_DIR: string;
|
|
26
|
+
/** Host logger channel; structural subset so tests can pass a plain object. */
|
|
27
|
+
export interface LegacyCleanupLogger {
|
|
28
|
+
info(message: string): void;
|
|
29
|
+
warn(message: string): void;
|
|
30
|
+
}
|
|
26
31
|
/**
|
|
27
32
|
* Strip the managed pointer block from AGENTS.md content. Everything outside
|
|
28
33
|
* the markers is returned untouched; content without a complete marker pair
|
|
@@ -37,6 +42,7 @@ export declare function stripAgentsPointerBlock(content: string): string;
|
|
|
37
42
|
* dir. Idempotent, best-effort, and chatty (one log line per action) — see
|
|
38
43
|
* the module docs for the exact safety rules.
|
|
39
44
|
* @param projectRoot - absolute path of the project root (session cwd).
|
|
45
|
+
* @param logger - host logger channel for the per-action log lines and op failures.
|
|
40
46
|
*/
|
|
41
|
-
export declare function cleanupLegacyNotesArtifacts(projectRoot: string): Promise<void>;
|
|
47
|
+
export declare function cleanupLegacyNotesArtifacts(projectRoot: string, logger?: LegacyCleanupLogger): Promise<void>;
|
|
42
48
|
//# sourceMappingURL=cleanup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/notes/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,4BAA4B,CAAA;AAE3D,2GAA2G;AAC3G,eAAO,MAAM,gBAAgB,QAAoC,CAAA;AAKjE;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED
|
|
1
|
+
{"version":3,"file":"cleanup.d.ts","sourceRoot":"","sources":["../../src/notes/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAKH,sFAAsF;AACtF,eAAO,MAAM,oBAAoB,8BAA8B,CAAA;AAC/D,gDAAgD;AAChD,eAAO,MAAM,kBAAkB,4BAA4B,CAAA;AAE3D,2GAA2G;AAC3G,eAAO,MAAM,gBAAgB,QAAoC,CAAA;AAKjE,+EAA+E;AAC/E,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;CAC5B;AAOD;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED;;;;;;;GAOG;AACH,wBAAsB,2BAA2B,CAAC,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGlH"}
|
package/lib/notes/cleanup.js
CHANGED
|
@@ -27,6 +27,10 @@ export const AGENTS_POINTER_END = '<!-- dsh-memory:end -->';
|
|
|
27
27
|
export const LEGACY_NOTES_DIR = path.join('docs', 'agent-memory');
|
|
28
28
|
/** Files a ≤0.5.x install generated into the notes dir (name, not path). */
|
|
29
29
|
const GENERATED_FILE = /^(CONVENTIONS|PITFALLS)\.md(\.bak\.\d+)?$/;
|
|
30
|
+
/** Warn through the host logger when one best-effort cleanup op fails. */
|
|
31
|
+
function warnOpFailure(logger, target, error) {
|
|
32
|
+
logger?.warn(`dsh-memory: legacy cleanup failed on ${target}: ${String(error)}`);
|
|
33
|
+
}
|
|
30
34
|
/**
|
|
31
35
|
* Strip the managed pointer block from AGENTS.md content. Everything outside
|
|
32
36
|
* the markers is returned untouched; content without a complete marker pair
|
|
@@ -49,28 +53,29 @@ export function stripAgentsPointerBlock(content) {
|
|
|
49
53
|
* dir. Idempotent, best-effort, and chatty (one log line per action) — see
|
|
50
54
|
* the module docs for the exact safety rules.
|
|
51
55
|
* @param projectRoot - absolute path of the project root (session cwd).
|
|
56
|
+
* @param logger - host logger channel for the per-action log lines and op failures.
|
|
52
57
|
*/
|
|
53
|
-
export async function cleanupLegacyNotesArtifacts(projectRoot) {
|
|
54
|
-
await cleanupAgentsPointer(projectRoot);
|
|
55
|
-
await cleanupNotesDir(projectRoot);
|
|
58
|
+
export async function cleanupLegacyNotesArtifacts(projectRoot, logger) {
|
|
59
|
+
await cleanupAgentsPointer(projectRoot, logger);
|
|
60
|
+
await cleanupNotesDir(projectRoot, logger);
|
|
56
61
|
}
|
|
57
62
|
/** Strip (or delete) the legacy AGENTS.md pointer block in one project root. */
|
|
58
|
-
async function cleanupAgentsPointer(projectRoot) {
|
|
63
|
+
async function cleanupAgentsPointer(projectRoot, logger) {
|
|
59
64
|
const agentsPath = path.join(projectRoot, 'AGENTS.md');
|
|
60
65
|
const existing = await readFile(agentsPath, 'utf8').catch(() => undefined);
|
|
61
66
|
if (existing === undefined || !existing.includes(AGENTS_POINTER_BEGIN))
|
|
62
67
|
return;
|
|
63
68
|
const stripped = stripAgentsPointerBlock(existing);
|
|
64
69
|
if (stripped.trim().length === 0) {
|
|
65
|
-
await rm(agentsPath).catch(() => { });
|
|
66
|
-
|
|
70
|
+
await rm(agentsPath).catch((error) => { warnOpFailure(logger, agentsPath, error); });
|
|
71
|
+
logger?.info('[dsh-memory] removed the pointer-only AGENTS.md left by ≤0.5.x in this project (memory is now managed in the host store + Memory UI only).');
|
|
67
72
|
return;
|
|
68
73
|
}
|
|
69
|
-
await writeFile(agentsPath, stripped, 'utf8').catch(() => { });
|
|
70
|
-
|
|
74
|
+
await writeFile(agentsPath, stripped, 'utf8').catch((error) => { warnOpFailure(logger, agentsPath, error); });
|
|
75
|
+
logger?.info('[dsh-memory] stripped the managed dsh-memory pointer block from AGENTS.md (other content untouched).');
|
|
71
76
|
}
|
|
72
77
|
/** Delete the generated files (only those) under the legacy notes dir. */
|
|
73
|
-
async function cleanupNotesDir(projectRoot) {
|
|
78
|
+
async function cleanupNotesDir(projectRoot, logger) {
|
|
74
79
|
const notesDir = path.join(projectRoot, LEGACY_NOTES_DIR);
|
|
75
80
|
const names = await readdir(notesDir).catch(() => undefined);
|
|
76
81
|
if (names === undefined)
|
|
@@ -79,15 +84,15 @@ async function cleanupNotesDir(projectRoot) {
|
|
|
79
84
|
for (const name of names) {
|
|
80
85
|
if (!GENERATED_FILE.test(name))
|
|
81
86
|
continue;
|
|
82
|
-
await rm(path.join(notesDir, name), { force: true }).catch(() => { });
|
|
87
|
+
await rm(path.join(notesDir, name), { force: true }).catch((error) => { warnOpFailure(logger, path.join(notesDir, name), error); });
|
|
83
88
|
removed++;
|
|
84
89
|
}
|
|
85
90
|
const rest = await readdir(notesDir).catch(() => []);
|
|
86
91
|
if (rest.length === 0) {
|
|
87
|
-
await rm(notesDir, { recursive: true, force: true }).catch(() => { });
|
|
92
|
+
await rm(notesDir, { recursive: true, force: true }).catch((error) => { warnOpFailure(logger, notesDir, error); });
|
|
88
93
|
}
|
|
89
94
|
if (removed > 0) {
|
|
90
|
-
|
|
95
|
+
logger?.info(`[dsh-memory] removed ${removed} generated notes file(s) under ${LEGACY_NOTES_DIR}/ left by ≤0.5.x (the memory store remains the source of truth).`);
|
|
91
96
|
}
|
|
92
97
|
}
|
|
93
98
|
//# sourceMappingURL=cleanup.js.map
|
package/lib/notes/cleanup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../src/notes/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,sFAAsF;AACtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAA;AAC/D,gDAAgD;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAA;AAE3D,2GAA2G;AAC3G,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAEjE,4EAA4E;AAC5E,MAAM,cAAc,GAAG,2CAA2C,CAAA;
|
|
1
|
+
{"version":3,"file":"cleanup.js","sourceRoot":"","sources":["../../src/notes/cleanup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACnE,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,sFAAsF;AACtF,MAAM,CAAC,MAAM,oBAAoB,GAAG,2BAA2B,CAAA;AAC/D,gDAAgD;AAChD,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAA;AAE3D,2GAA2G;AAC3G,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAEjE,4EAA4E;AAC5E,MAAM,cAAc,GAAG,2CAA2C,CAAA;AAQlE,0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AAI,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;QAC3I,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;IACpD,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE,GAAG,aAAa,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;IAC5H,CAAC;IACD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,MAAM,EAAE,IAAI,CAAC,wBAAwB,OAAO,kCAAkC,gBAAgB,kEAAkE,CAAC,CAAA;IACnK,CAAC;AACH,CAAC"}
|
package/lib/notes/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@chenhw7/dsh-memory/notes`: the project-notes projection
|
|
2
|
+
* `@chenhw7/dsh-memory/notes`: the project-notes projection
|
|
3
|
+
* (TECH_DESIGN §7.4; rationale: the prompt-only Agent Note
|
|
4
|
+
* .agents/notes/implemented/architecture/2026-08-31-project-notes-writes-no-repository-files.md).
|
|
3
5
|
* A function plugin that renders habit/convention/pitfall entries from the
|
|
4
6
|
* memory store into the `project-notes` system-prompt section. Since 0.6 it
|
|
5
7
|
* writes NOTHING into the user's project — the store is the sole source of
|
package/lib/notes/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAYlD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAC/I,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,kCAAkC,EAAE,MAAM,eAAe,CAAA;AACzI,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD,0BAA0B;AAC1B,eAAO,MAAM,IAAI,iBAAiB,CAAA;AAElC,4EAA4E;AAC5E,eAAO,MAAM,MAAM,EAAE,MAAM,EAAO,CAAA;AAKlC;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAKD;;;GAGG;AACH,8BAAsB,mBAAmB;IACvC,cAIC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,oBAAoB,CAAA;CACpE;AAED,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,YAAY,EAAE,mBAAmB,CAAA;KAClC;CACF;AAuDD;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAuBxC"}
|
package/lib/notes/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@chenhw7/dsh-memory/notes`: the project-notes projection
|
|
2
|
+
* `@chenhw7/dsh-memory/notes`: the project-notes projection
|
|
3
|
+
* (TECH_DESIGN §7.4; rationale: the prompt-only Agent Note
|
|
4
|
+
* .agents/notes/implemented/architecture/2026-08-31-project-notes-writes-no-repository-files.md).
|
|
3
5
|
* A function plugin that renders habit/convention/pitfall entries from the
|
|
4
6
|
* memory store into the `project-notes` system-prompt section. Since 0.6 it
|
|
5
7
|
* writes NOTHING into the user's project — the store is the sole source of
|
|
@@ -87,7 +89,8 @@ class ProjectNotesServiceImpl extends ProjectNotesService {
|
|
|
87
89
|
pitfalls: renderPitfalls(pitfalls, settings.notesMaxEntriesPerFile),
|
|
88
90
|
};
|
|
89
91
|
}
|
|
90
|
-
catch {
|
|
92
|
+
catch (error) {
|
|
93
|
+
this.ctx.get('memory')?.reportFailure('notes-snapshot', error);
|
|
91
94
|
return EMPTY_SNAPSHOT;
|
|
92
95
|
}
|
|
93
96
|
}
|
|
@@ -118,7 +121,9 @@ export function apply(ctx) {
|
|
|
118
121
|
if (cwd === undefined || cwd.length === 0 || cleanedRoots.has(cwd))
|
|
119
122
|
return;
|
|
120
123
|
cleanedRoots.add(cwd);
|
|
121
|
-
void cleanupLegacyNotesArtifacts(cwd).catch(() => {
|
|
124
|
+
void cleanupLegacyNotesArtifacts(cwd, ctx.logger).catch((error) => {
|
|
125
|
+
ctx.get('memory')?.reportFailure('legacy-cleanup', error);
|
|
126
|
+
});
|
|
122
127
|
}, { global: true });
|
|
123
128
|
}
|
|
124
129
|
//# sourceMappingURL=index.js.map
|
package/lib/notes/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/notes/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAE3C,O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CAAC,MAAM,KAAK,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,OAAM;QAC1E,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QACrB,KAAK,2BAA2B,CAAC,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YACzE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAA;QAC3D,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAA;AACtB,CAAC"}
|
package/lib/notes/scope.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The scope×category render matrix for project notes (§4
|
|
3
|
-
*
|
|
2
|
+
* The scope×category render matrix for project notes (TECH_DESIGN §7.4):
|
|
3
|
+
* which store entries land in the
|
|
4
4
|
* `project-notes` prompt section. Pure functions, zero host imports — shared
|
|
5
5
|
* by the notes renderer and by `memory-context` (which excludes the same set
|
|
6
6
|
* from its own snapshot/index injection so content never appears twice in
|
|
@@ -18,8 +18,8 @@ export type RenderableEntry = Pick<MemoryEntry, 'scope' | 'category' | 'projectN
|
|
|
18
18
|
/** Which notes file an entry renders into, when any. */
|
|
19
19
|
export type NotesKind = 'conventions' | 'pitfalls';
|
|
20
20
|
/**
|
|
21
|
-
* Decide whether an entry is rendered into the notes
|
|
22
|
-
*
|
|
21
|
+
* Decide whether an entry is rendered into the `project-notes` section, and
|
|
22
|
+
* into which half (conventions or pitfalls). Rules:
|
|
23
23
|
* - `project`-scoped entries must match the current project name; an unknown
|
|
24
24
|
* project (no cwd) excludes them.
|
|
25
25
|
* - Conventions come from all three scopes (project > global > personal is
|
|
@@ -30,7 +30,7 @@ export type NotesKind = 'conventions' | 'pitfalls';
|
|
|
30
30
|
*
|
|
31
31
|
* @param entry - the entry to classify.
|
|
32
32
|
* @param projectName - the current project name (cwd basename), or undefined.
|
|
33
|
-
* @returns the target
|
|
33
|
+
* @returns the target render half, or `undefined` when not rendered.
|
|
34
34
|
*/
|
|
35
35
|
export declare function isRenderedEntry(entry: RenderableEntry, projectName: string | undefined): NotesKind | undefined;
|
|
36
36
|
//# sourceMappingURL=scope.d.ts.map
|
package/lib/notes/scope.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The scope×category render matrix for project notes (§4
|
|
3
|
-
*
|
|
2
|
+
* The scope×category render matrix for project notes (TECH_DESIGN §7.4):
|
|
3
|
+
* which store entries land in the
|
|
4
4
|
* `project-notes` prompt section. Pure functions, zero host imports — shared
|
|
5
5
|
* by the notes renderer and by `memory-context` (which excludes the same set
|
|
6
6
|
* from its own snapshot/index injection so content never appears twice in
|
|
@@ -13,8 +13,8 @@ export const NOTES_CONVENTION_CATEGORIES = ['convention', 'preference'];
|
|
|
13
13
|
/** Categories rendered as pitfalls (project- and global-scoped only). */
|
|
14
14
|
export const NOTES_PITFALL_CATEGORIES = ['failure', 'procedure', 'tool-quirk'];
|
|
15
15
|
/**
|
|
16
|
-
* Decide whether an entry is rendered into the notes
|
|
17
|
-
*
|
|
16
|
+
* Decide whether an entry is rendered into the `project-notes` section, and
|
|
17
|
+
* into which half (conventions or pitfalls). Rules:
|
|
18
18
|
* - `project`-scoped entries must match the current project name; an unknown
|
|
19
19
|
* project (no cwd) excludes them.
|
|
20
20
|
* - Conventions come from all three scopes (project > global > personal is
|
|
@@ -25,7 +25,7 @@ export const NOTES_PITFALL_CATEGORIES = ['failure', 'procedure', 'tool-quirk'];
|
|
|
25
25
|
*
|
|
26
26
|
* @param entry - the entry to classify.
|
|
27
27
|
* @param projectName - the current project name (cwd basename), or undefined.
|
|
28
|
-
* @returns the target
|
|
28
|
+
* @returns the target render half, or `undefined` when not rendered.
|
|
29
29
|
*/
|
|
30
30
|
export function isRenderedEntry(entry, projectName) {
|
|
31
31
|
const category = entry.category;
|