@chenhw7/dsh-memory 0.5.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.i18n.yaml +2 -0
- package/README.md +24 -15
- package/{README.zh-CN.md → README.zh.md} +22 -14
- package/cordis.patch.yml +10 -4
- 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 +47 -31
- 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 +2 -6
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +29 -25
- package/lib/context/index.js.map +1 -1
- package/lib/context/policy.d.ts +17 -5
- package/lib/context/policy.d.ts.map +1 -1
- package/lib/context/policy.js +27 -9
- package/lib/context/policy.js.map +1 -1
- package/lib/index.d.ts +23 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +20 -0
- package/lib/index.js.map +1 -1
- package/lib/notes/cleanup.d.ts +48 -0
- package/lib/notes/cleanup.d.ts.map +1 -0
- package/lib/notes/cleanup.js +98 -0
- package/lib/notes/cleanup.js.map +1 -0
- package/lib/notes/index.d.ts +23 -23
- package/lib/notes/index.d.ts.map +1 -1
- package/lib/notes/index.js +38 -131
- package/lib/notes/index.js.map +1 -1
- package/lib/notes/render.d.ts +13 -13
- package/lib/notes/render.d.ts.map +1 -1
- package/lib/notes/render.js +13 -13
- package/lib/notes/render.js.map +1 -1
- package/lib/notes/scope.d.ts +11 -10
- package/lib/notes/scope.d.ts.map +1 -1
- package/lib/notes/scope.js +11 -10
- package/lib/notes/scope.js.map +1 -1
- package/lib/notes/settings.d.ts +9 -20
- package/lib/notes/settings.d.ts.map +1 -1
- package/lib/notes/settings.js +9 -27
- package/lib/notes/settings.js.map +1 -1
- 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 +5 -5
- package/lib/review/accumulator.d.ts.map +1 -1
- package/lib/review/accumulator.js +3 -3
- package/lib/review/accumulator.js.map +1 -1
- 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.map +1 -1
- package/lib/review/extract.js +5 -2
- package/lib/review/extract.js.map +1 -1
- package/lib/review/index.d.ts.map +1 -1
- package/lib/review/index.js +28 -21
- package/lib/review/index.js.map +1 -1
- 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 +89 -7
- package/lib/store/index.d.ts.map +1 -1
- package/lib/store/index.js +466 -89
- package/lib/store/index.js.map +1 -1
- package/lib/tool/index.d.ts +17 -5
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +237 -24
- package/lib/tool/index.js.map +1 -1
- package/lib/types.d.ts +31 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +40 -31
- package/lib/notes/writer.d.ts +0 -65
- package/lib/notes/writer.d.ts.map +0 -1
- package/lib/notes/writer.js +0 -131
- package/lib/notes/writer.js.map +0 -1
package/lib/context/policy.d.ts
CHANGED
|
@@ -7,6 +7,18 @@
|
|
|
7
7
|
import type { MemoryEntry } from '../types.ts';
|
|
8
8
|
/** How recalled memory reaches the system prompt. */
|
|
9
9
|
export type MemoryMode = 'full' | 'policy-only' | 'custom' | 'off' | 'index';
|
|
10
|
+
/** Fence tag names owned by this plugin's injection surfaces. */
|
|
11
|
+
export declare const PROMPT_FENCE_TAGS: readonly ['memory-context', 'memory-index', 'recalled-memory', 'project-notes', 'memory-policy'];
|
|
12
|
+
/**
|
|
13
|
+
* Neutralize forged fence closers before stored content enters an injection
|
|
14
|
+
* fence: `</memory-context>` becomes `<\/memory-context>` so a stored entry
|
|
15
|
+
* cannot close the plugin's own fence and speak outside it. Opening tags are
|
|
16
|
+
* left intact — they cannot terminate a fence — and the escaping applies to
|
|
17
|
+
* stored content only; the fences this builder itself emits stay untouched.
|
|
18
|
+
* @param text - store-sourced text about to be wrapped in a plugin fence.
|
|
19
|
+
* @returns the same text with every plugin-owned closer neutralized.
|
|
20
|
+
*/
|
|
21
|
+
export declare function neutralizeFenceBreaks(text: string): string;
|
|
10
22
|
/**
|
|
11
23
|
* The fixed `<memory-policy>` guidance block injected verbatim by the `full`
|
|
12
24
|
* and `policy-only` modes.
|
|
@@ -21,14 +33,14 @@ export declare const MEMORY_CONTEXT_NOTE: string;
|
|
|
21
33
|
*/
|
|
22
34
|
export declare const MEMORY_INDEX_NOTE: string;
|
|
23
35
|
/**
|
|
24
|
-
* The note that frames injected project notes (
|
|
25
|
-
* where they come from and how conflicting entries resolve.
|
|
36
|
+
* The note that frames the injected project notes (conventions + pitfall
|
|
37
|
+
* log): where they come from and how conflicting entries resolve.
|
|
26
38
|
*/
|
|
27
|
-
export declare const PROJECT_NOTES_NOTE = "The following project notes are maintained by memory (
|
|
39
|
+
export declare const PROJECT_NOTES_NOTE = "The following project notes are maintained by memory (a conventions list and a pitfall log). On conflicts between entries, the nearer scope wins: project > global > personal.";
|
|
28
40
|
/**
|
|
29
41
|
* Build the `project-notes` system-prompt section text for one assembly.
|
|
30
|
-
* @param conventions - the frozen
|
|
31
|
-
* @param pitfalls - the frozen
|
|
42
|
+
* @param conventions - the frozen conventions content (possibly empty).
|
|
43
|
+
* @param pitfalls - the frozen pitfalls content (possibly empty).
|
|
32
44
|
* @param charLimit - character budget for the combined section (`0` → empty).
|
|
33
45
|
* @returns the section text; an empty string drops the section at render.
|
|
34
46
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/context/policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;AAE5E;;;GAGG;AACH,eAAO,MAAM,kBAAkB,+3CAad,CAAA;AAEjB;;GAEG;AACH,eAAO,MAAM,mBAAmB,QAGkH,CAAA;AAElJ;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAGoH,CAAA;AAElJ;;;GAGG;AACH,eAAO,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../src/context/policy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9C,qDAAqD;AACrD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,GAAG,KAAK,GAAG,OAAO,CAAA;AAE5E,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,YAAI,gBAAgB,EAAE,cAAc,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,CAAU,CAAA;AAEjI;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED;;;GAGG;AACH,eAAO,MAAM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GAAG,MAAM,CAmBxH"}
|
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.
|
|
@@ -36,14 +54,14 @@ export const MEMORY_INDEX_NOTE = 'The following is an index of stored memories.
|
|
|
36
54
|
+ ' The index is ordered by relevance (current project first, then user, then global).'
|
|
37
55
|
+ ' Entries reflect what was known at the time they were written — verify against the current repository and tool output before acting on them.';
|
|
38
56
|
/**
|
|
39
|
-
* The note that frames injected project notes (
|
|
40
|
-
* where they come from and how conflicting entries resolve.
|
|
57
|
+
* The note that frames the injected project notes (conventions + pitfall
|
|
58
|
+
* log): where they come from and how conflicting entries resolve.
|
|
41
59
|
*/
|
|
42
|
-
export const PROJECT_NOTES_NOTE = 'The following project notes are maintained by memory (
|
|
60
|
+
export const PROJECT_NOTES_NOTE = 'The following project notes are maintained by memory (a conventions list and a pitfall log). On conflicts between entries, the nearer scope wins: project > global > personal.';
|
|
43
61
|
/**
|
|
44
62
|
* Build the `project-notes` system-prompt section text for one assembly.
|
|
45
|
-
* @param conventions - the frozen
|
|
46
|
-
* @param pitfalls - the frozen
|
|
63
|
+
* @param conventions - the frozen conventions content (possibly empty).
|
|
64
|
+
* @param pitfalls - the frozen pitfalls content (possibly empty).
|
|
47
65
|
* @param charLimit - character budget for the combined section (`0` → empty).
|
|
48
66
|
* @returns the section text; an empty string drops the section at render.
|
|
49
67
|
*/
|
|
@@ -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"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAM7C;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;iBAajB,CAAA;AAEjB;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAC9B,yGAAyG;MACvG,kFAAkF;MAClF,8IAA8I,CAAA;AAElJ;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAC5B,6HAA6H;MAC3H,qFAAqF;MACrF,8IAA8I,CAAA;AAElJ;;;GAGG;AACH,MAAM,CA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,MAAM,gBAAgB,mBAAmB,CAAC,KAAK,CAAC,UAAU,CAAA;AAC9G,CAAC"}
|
package/lib/index.d.ts
CHANGED
|
@@ -65,7 +65,9 @@ export declare abstract class MemoryStore {
|
|
|
65
65
|
*/
|
|
66
66
|
abstract remove(id: MemoryId): Promise<boolean>;
|
|
67
67
|
/**
|
|
68
|
-
* Search entries by scope, category, project, and
|
|
68
|
+
* Search entries by scope, category, project, and a text query. The text
|
|
69
|
+
* matching algorithm is implementation-defined; `DomainMemoryStore` ranks by
|
|
70
|
+
* BM25 relevance over whole tokens.
|
|
69
71
|
* @param query - The search parameters. When `query.recordRecall` is false
|
|
70
72
|
* the read must not count as a recall: no `lastRecalledAt` stamping and no
|
|
71
73
|
* dormant revival (the management UI browses through this flag).
|
|
@@ -103,6 +105,16 @@ export declare abstract class MemoryStore {
|
|
|
103
105
|
* @param ids - The entry ids that were recalled.
|
|
104
106
|
*/
|
|
105
107
|
markRecalled(ids: readonly string[]): void;
|
|
108
|
+
/**
|
|
109
|
+
* Record one failure swallowed by a best-effort background path (flush,
|
|
110
|
+
* janitor, curator, judge, per-row rewrite, ...) so it stays observable
|
|
111
|
+
* instead of silently vanishing. Fire-and-forget like {@link markRecalled}:
|
|
112
|
+
* the default implementation is a no-op, so providers without failure
|
|
113
|
+
* tracking remain contract-conformant and callers never handle failures.
|
|
114
|
+
* @param site - stable identifier of the failing path; doubles as the counter key.
|
|
115
|
+
* @param error - the swallowed error, when one was caught.
|
|
116
|
+
*/
|
|
117
|
+
reportFailure(_site: string, _error?: unknown): void;
|
|
106
118
|
/**
|
|
107
119
|
* Record one model/extraction proposal in the pending-review queue.
|
|
108
120
|
* @param input - the proposal to record.
|
|
@@ -151,6 +163,16 @@ export declare abstract class MemoryStore {
|
|
|
151
163
|
* @returns all audit entries, oldest first.
|
|
152
164
|
*/
|
|
153
165
|
abstract exportAuditLog(): readonly AuditEntry[];
|
|
166
|
+
/**
|
|
167
|
+
* Read one entry's unredacted content — the deliberate break-glass path for
|
|
168
|
+
* human review and repair (memory_replace) after the display layers redact
|
|
169
|
+
* scanner-blocked payloads to `[BLOCKED: …]`. Every call appends a
|
|
170
|
+
* `readRaw` audit record (best-effort, source `'ui'`), so raw reads are as
|
|
171
|
+
* observable as mutations. Returns `undefined` when the id does not exist.
|
|
172
|
+
* The default is a no-op returning `undefined`, so providers without raw
|
|
173
|
+
* support stay contract-conformant.
|
|
174
|
+
*/
|
|
175
|
+
getRaw(_id: MemoryId): Promise<MemoryEntry | undefined>;
|
|
154
176
|
}
|
|
155
177
|
/**
|
|
156
178
|
* 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;;;;;;;;;;;GAWG;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,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAA;AAEvD,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,OAAO;QACf,MAAM,EAAE,WAAW,CAAA;KACpB;CACF;A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AoB,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
|
@@ -49,6 +49,16 @@ export class MemoryStore {
|
|
|
49
49
|
* @param ids - The entry ids that were recalled.
|
|
50
50
|
*/
|
|
51
51
|
markRecalled(ids) { }
|
|
52
|
+
/**
|
|
53
|
+
* Record one failure swallowed by a best-effort background path (flush,
|
|
54
|
+
* janitor, curator, judge, per-row rewrite, ...) so it stays observable
|
|
55
|
+
* instead of silently vanishing. Fire-and-forget like {@link markRecalled}:
|
|
56
|
+
* the default implementation is a no-op, so providers without failure
|
|
57
|
+
* tracking remain contract-conformant and callers never handle failures.
|
|
58
|
+
* @param site - stable identifier of the failing path; doubles as the counter key.
|
|
59
|
+
* @param error - the swallowed error, when one was caught.
|
|
60
|
+
*/
|
|
61
|
+
reportFailure(_site, _error) { }
|
|
52
62
|
// ─── Suggestion queue (P1-1 optional human-confirm mode) ──────────────────
|
|
53
63
|
//
|
|
54
64
|
// Default implementations follow the `markRecalled` precedent: providers
|
|
@@ -83,6 +93,16 @@ export class MemoryStore {
|
|
|
83
93
|
* @returns whether the suggestion existed and was removed.
|
|
84
94
|
*/
|
|
85
95
|
rejectSuggestion(_id) { return Promise.resolve(false); }
|
|
96
|
+
/**
|
|
97
|
+
* Read one entry's unredacted content — the deliberate break-glass path for
|
|
98
|
+
* human review and repair (memory_replace) after the display layers redact
|
|
99
|
+
* scanner-blocked payloads to `[BLOCKED: …]`. Every call appends a
|
|
100
|
+
* `readRaw` audit record (best-effort, source `'ui'`), so raw reads are as
|
|
101
|
+
* observable as mutations. Returns `undefined` when the id does not exist.
|
|
102
|
+
* The default is a no-op returning `undefined`, so providers without raw
|
|
103
|
+
* support stay contract-conformant.
|
|
104
|
+
*/
|
|
105
|
+
getRaw(_id) { return Promise.resolve(undefined); }
|
|
86
106
|
}
|
|
87
107
|
/**
|
|
88
108
|
* 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;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAmC1C,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;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAmC1C,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,CA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H,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"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-time cleanup of legacy on-repo artifacts from the file-export era
|
|
3
|
+
* (≤ 0.5.x): the rendered notes files and the managed AGENTS.md pointer
|
|
4
|
+
* block. dsh-memory 0.6+ never writes into the user's project; this module
|
|
5
|
+
* only REMOVES what earlier versions left behind, under conservative rules:
|
|
6
|
+
*
|
|
7
|
+
* - AGENTS.md: only the managed marker block is stripped — every byte outside
|
|
8
|
+
* the markers is preserved. When nothing but the block (plus whitespace)
|
|
9
|
+
* remains, the file is deleted: it was the pointer-only file we created.
|
|
10
|
+
* - Notes directory (≤0.5.x default `docs/agent-memory`): only the files we
|
|
11
|
+
* generated — `CONVENTIONS.md`, `PITFALLS.md`, and their `.bak.<ts>` drift
|
|
12
|
+
* backups — are deleted; foreign files keep the directory alive.
|
|
13
|
+
*
|
|
14
|
+
* Best-effort by design: every failure is swallowed, every action is logged
|
|
15
|
+
* once. Idempotent — a second run finds nothing to do. The user's
|
|
16
|
+
* `.gitignore` is never touched.
|
|
17
|
+
*
|
|
18
|
+
* @module @chenhw7/dsh-memory/notes/cleanup
|
|
19
|
+
*/
|
|
20
|
+
/** Marker opening the managed pointer block a ≤0.5.x install wrote into AGENTS.md. */
|
|
21
|
+
export declare const AGENTS_POINTER_BEGIN = "<!-- dsh-memory:begin -->";
|
|
22
|
+
/** Marker closing the managed pointer block. */
|
|
23
|
+
export declare const AGENTS_POINTER_END = "<!-- dsh-memory:end -->";
|
|
24
|
+
/** The default notes dir location ≤0.5.x exported to (custom notesDir values are not recoverable here). */
|
|
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
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Strip the managed pointer block from AGENTS.md content. Everything outside
|
|
33
|
+
* the markers is returned untouched; content without a complete marker pair
|
|
34
|
+
* is returned unchanged.
|
|
35
|
+
* @param content - the AGENTS.md text.
|
|
36
|
+
* @returns the text without the managed block.
|
|
37
|
+
*/
|
|
38
|
+
export declare function stripAgentsPointerBlock(content: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* Remove the repo artifacts a ≤0.5.x install left in one project: the managed
|
|
41
|
+
* AGENTS.md pointer block and the generated files under the default notes
|
|
42
|
+
* dir. Idempotent, best-effort, and chatty (one log line per action) — see
|
|
43
|
+
* the module docs for the exact safety rules.
|
|
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.
|
|
46
|
+
*/
|
|
47
|
+
export declare function cleanupLegacyNotesArtifacts(projectRoot: string, logger?: LegacyCleanupLogger): Promise<void>;
|
|
48
|
+
//# sourceMappingURL=cleanup.d.ts.map
|
|
@@ -0,0 +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,+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"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-time cleanup of legacy on-repo artifacts from the file-export era
|
|
3
|
+
* (≤ 0.5.x): the rendered notes files and the managed AGENTS.md pointer
|
|
4
|
+
* block. dsh-memory 0.6+ never writes into the user's project; this module
|
|
5
|
+
* only REMOVES what earlier versions left behind, under conservative rules:
|
|
6
|
+
*
|
|
7
|
+
* - AGENTS.md: only the managed marker block is stripped — every byte outside
|
|
8
|
+
* the markers is preserved. When nothing but the block (plus whitespace)
|
|
9
|
+
* remains, the file is deleted: it was the pointer-only file we created.
|
|
10
|
+
* - Notes directory (≤0.5.x default `docs/agent-memory`): only the files we
|
|
11
|
+
* generated — `CONVENTIONS.md`, `PITFALLS.md`, and their `.bak.<ts>` drift
|
|
12
|
+
* backups — are deleted; foreign files keep the directory alive.
|
|
13
|
+
*
|
|
14
|
+
* Best-effort by design: every failure is swallowed, every action is logged
|
|
15
|
+
* once. Idempotent — a second run finds nothing to do. The user's
|
|
16
|
+
* `.gitignore` is never touched.
|
|
17
|
+
*
|
|
18
|
+
* @module @chenhw7/dsh-memory/notes/cleanup
|
|
19
|
+
*/
|
|
20
|
+
import { readdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
21
|
+
import path from 'node:path';
|
|
22
|
+
/** Marker opening the managed pointer block a ≤0.5.x install wrote into AGENTS.md. */
|
|
23
|
+
export const AGENTS_POINTER_BEGIN = '<!-- dsh-memory:begin -->';
|
|
24
|
+
/** Marker closing the managed pointer block. */
|
|
25
|
+
export const AGENTS_POINTER_END = '<!-- dsh-memory:end -->';
|
|
26
|
+
/** The default notes dir location ≤0.5.x exported to (custom notesDir values are not recoverable here). */
|
|
27
|
+
export const LEGACY_NOTES_DIR = path.join('docs', 'agent-memory');
|
|
28
|
+
/** Files a ≤0.5.x install generated into the notes dir (name, not path). */
|
|
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
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Strip the managed pointer block from AGENTS.md content. Everything outside
|
|
36
|
+
* the markers is returned untouched; content without a complete marker pair
|
|
37
|
+
* is returned unchanged.
|
|
38
|
+
* @param content - the AGENTS.md text.
|
|
39
|
+
* @returns the text without the managed block.
|
|
40
|
+
*/
|
|
41
|
+
export function stripAgentsPointerBlock(content) {
|
|
42
|
+
const begin = content.indexOf(AGENTS_POINTER_BEGIN);
|
|
43
|
+
if (begin < 0)
|
|
44
|
+
return content;
|
|
45
|
+
const end = content.indexOf(AGENTS_POINTER_END, begin);
|
|
46
|
+
if (end < 0)
|
|
47
|
+
return content;
|
|
48
|
+
return content.slice(0, begin) + content.slice(end + AGENTS_POINTER_END.length);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Remove the repo artifacts a ≤0.5.x install left in one project: the managed
|
|
52
|
+
* AGENTS.md pointer block and the generated files under the default notes
|
|
53
|
+
* dir. Idempotent, best-effort, and chatty (one log line per action) — see
|
|
54
|
+
* the module docs for the exact safety rules.
|
|
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.
|
|
57
|
+
*/
|
|
58
|
+
export async function cleanupLegacyNotesArtifacts(projectRoot, logger) {
|
|
59
|
+
await cleanupAgentsPointer(projectRoot, logger);
|
|
60
|
+
await cleanupNotesDir(projectRoot, logger);
|
|
61
|
+
}
|
|
62
|
+
/** Strip (or delete) the legacy AGENTS.md pointer block in one project root. */
|
|
63
|
+
async function cleanupAgentsPointer(projectRoot, logger) {
|
|
64
|
+
const agentsPath = path.join(projectRoot, 'AGENTS.md');
|
|
65
|
+
const existing = await readFile(agentsPath, 'utf8').catch(() => undefined);
|
|
66
|
+
if (existing === undefined || !existing.includes(AGENTS_POINTER_BEGIN))
|
|
67
|
+
return;
|
|
68
|
+
const stripped = stripAgentsPointerBlock(existing);
|
|
69
|
+
if (stripped.trim().length === 0) {
|
|
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).');
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
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).');
|
|
76
|
+
}
|
|
77
|
+
/** Delete the generated files (only those) under the legacy notes dir. */
|
|
78
|
+
async function cleanupNotesDir(projectRoot, logger) {
|
|
79
|
+
const notesDir = path.join(projectRoot, LEGACY_NOTES_DIR);
|
|
80
|
+
const names = await readdir(notesDir).catch(() => undefined);
|
|
81
|
+
if (names === undefined)
|
|
82
|
+
return;
|
|
83
|
+
let removed = 0;
|
|
84
|
+
for (const name of names) {
|
|
85
|
+
if (!GENERATED_FILE.test(name))
|
|
86
|
+
continue;
|
|
87
|
+
await rm(path.join(notesDir, name), { force: true }).catch((error) => { warnOpFailure(logger, path.join(notesDir, name), error); });
|
|
88
|
+
removed++;
|
|
89
|
+
}
|
|
90
|
+
const rest = await readdir(notesDir).catch(() => []);
|
|
91
|
+
if (rest.length === 0) {
|
|
92
|
+
await rm(notesDir, { recursive: true, force: true }).catch((error) => { warnOpFailure(logger, notesDir, error); });
|
|
93
|
+
}
|
|
94
|
+
if (removed > 0) {
|
|
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).`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=cleanup.js.map
|
|
@@ -0,0 +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;AAQlE,0EAA0E;AAC1E,SAAS,aAAa,CAAC,MAAuC,EAAE,MAAc,EAAE,KAAc;IAC5F,MAAM,EAAE,IAAI,CAAC,wCAAwC,MAAM,KAAK,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAClF,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,OAAe;IACrD,MAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAA;IACnD,IAAI,KAAK,GAAG,CAAC;QAAE,OAA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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,51 +1,51 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `@chenhw7/dsh-memory/notes`: the project-notes
|
|
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
|
-
* memory store into
|
|
5
|
-
*
|
|
6
|
+
* memory store into the `project-notes` system-prompt section. Since 0.6 it
|
|
7
|
+
* writes NOTHING into the user's project — the store is the sole source of
|
|
8
|
+
* truth, the Memory settings UI is the management surface, and the one-time
|
|
9
|
+
* `cleanup` pass removes artifacts left by ≤0.5.x file exports.
|
|
6
10
|
*
|
|
7
|
-
* The store is the source of truth; the files are a read-only rendered view.
|
|
8
11
|
* Rendering is synchronous from the store's in-memory state — the same text
|
|
9
|
-
*
|
|
10
|
-
* into its per-session prompt snapshot, so prompt and files can never drift.
|
|
11
|
-
* Persistence is skipped when nothing changed since the last render.
|
|
12
|
+
* `memory-context` freezes into its per-session prompt snapshot.
|
|
12
13
|
*
|
|
13
14
|
* @module @chenhw7/dsh-memory/notes
|
|
14
15
|
*/
|
|
15
16
|
import type { Context } from '@deepseek-ai/cordis';
|
|
16
17
|
export { isRenderedEntry } from './scope.ts';
|
|
17
18
|
export { renderConventions, renderPitfalls } from './render.ts';
|
|
18
|
-
export {
|
|
19
|
-
export { resolveNotesSettings, DEFAULT_NOTES_ENABLED,
|
|
19
|
+
export { cleanupLegacyNotesArtifacts, stripAgentsPointerBlock, AGENTS_POINTER_BEGIN, AGENTS_POINTER_END, LEGACY_NOTES_DIR } from './cleanup.ts';
|
|
20
|
+
export { resolveNotesSettings, DEFAULT_NOTES_ENABLED, DEFAULT_NOTES_CHAR_LIMIT, DEFAULT_NOTES_MAX_ENTRIES_PER_FILE } from './settings.ts';
|
|
20
21
|
export type { NotesSettings } from './settings.ts';
|
|
21
22
|
/** Cordis plugin name. */
|
|
22
23
|
export declare const name = "memory-notes";
|
|
23
24
|
/** Nothing is required: `memory` and `settings` are accessed optionally. */
|
|
24
25
|
export declare const inject: string[];
|
|
25
26
|
/**
|
|
26
|
-
* Frozen project-notes content for one project root: the rendered
|
|
27
|
-
* Empty strings mean "nothing to
|
|
28
|
-
*
|
|
27
|
+
* Frozen project-notes content for one project root: the rendered section
|
|
28
|
+
* texts, injected into the system prompt. Empty strings mean "nothing to
|
|
29
|
+
* inject" (disabled or no store); without a cwd the project-scope slice is
|
|
30
|
+
* absent but the global/user slices still render.
|
|
29
31
|
*/
|
|
30
32
|
export interface ProjectNotesSnapshot {
|
|
31
|
-
/** Rendered
|
|
33
|
+
/** Rendered conventions section (possibly only the header). */
|
|
32
34
|
readonly conventions: string;
|
|
33
|
-
/** Rendered
|
|
35
|
+
/** Rendered pitfalls section (possibly only the header). */
|
|
34
36
|
readonly pitfalls: string;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* The project-notes service, registered on `ctx.projectNotes` by this plugin.
|
|
38
|
-
* Consumers (memory-context and
|
|
39
|
-
* read through it.
|
|
40
|
+
* Consumers (memory-context) render and read through it. Pure — no I/O.
|
|
40
41
|
*/
|
|
41
42
|
export declare abstract class ProjectNotesService {
|
|
42
43
|
constructor();
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* nothing is persisted, but the global/user slices still render.
|
|
45
|
+
* Render and return the notes snapshot for a project root from the store.
|
|
46
|
+
* Idempotent and side-effect free. An undefined `cwd` means "no current
|
|
47
|
+
* project": project-scope entries drop out of the snapshot, but the
|
|
48
|
+
* global/user slices still render.
|
|
49
49
|
* @param cwd - the session working directory (project root), or undefined.
|
|
50
50
|
* @returns the rendered snapshot; empty strings when disabled or unavailable.
|
|
51
51
|
*/
|
|
@@ -58,8 +58,8 @@ declare module '@deepseek-ai/cordis' {
|
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Install the memory-notes plugin: register the `projectNotes` service and
|
|
61
|
-
* the
|
|
62
|
-
*
|
|
61
|
+
* the one-time legacy-artifact cleanup on `session/created` (≤0.5.x wrote
|
|
62
|
+
* rendered files + an AGENTS.md pointer into the repo; 0.6 removes them).
|
|
63
63
|
* @param ctx - Cordis context.
|
|
64
64
|
*/
|
|
65
65
|
export declare function apply(ctx: Context): void;
|
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"}
|