@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.
Files changed (94) hide show
  1. package/README.i18n.yaml +2 -0
  2. package/README.md +24 -15
  3. package/{README.zh-CN.md → README.zh.md} +22 -14
  4. package/cordis.patch.yml +10 -4
  5. package/lib/benchmark/index.d.ts +24 -7
  6. package/lib/benchmark/index.d.ts.map +1 -1
  7. package/lib/benchmark/index.js +55 -7
  8. package/lib/benchmark/index.js.map +1 -1
  9. package/lib/client/index.js +47 -31
  10. package/lib/context/conflict.d.ts +23 -10
  11. package/lib/context/conflict.d.ts.map +1 -1
  12. package/lib/context/conflict.js +59 -20
  13. package/lib/context/conflict.js.map +1 -1
  14. package/lib/context/index.d.ts +2 -6
  15. package/lib/context/index.d.ts.map +1 -1
  16. package/lib/context/index.js +29 -25
  17. package/lib/context/index.js.map +1 -1
  18. package/lib/context/policy.d.ts +17 -5
  19. package/lib/context/policy.d.ts.map +1 -1
  20. package/lib/context/policy.js +27 -9
  21. package/lib/context/policy.js.map +1 -1
  22. package/lib/index.d.ts +23 -1
  23. package/lib/index.d.ts.map +1 -1
  24. package/lib/index.js +20 -0
  25. package/lib/index.js.map +1 -1
  26. package/lib/notes/cleanup.d.ts +48 -0
  27. package/lib/notes/cleanup.d.ts.map +1 -0
  28. package/lib/notes/cleanup.js +98 -0
  29. package/lib/notes/cleanup.js.map +1 -0
  30. package/lib/notes/index.d.ts +23 -23
  31. package/lib/notes/index.d.ts.map +1 -1
  32. package/lib/notes/index.js +38 -131
  33. package/lib/notes/index.js.map +1 -1
  34. package/lib/notes/render.d.ts +13 -13
  35. package/lib/notes/render.d.ts.map +1 -1
  36. package/lib/notes/render.js +13 -13
  37. package/lib/notes/render.js.map +1 -1
  38. package/lib/notes/scope.d.ts +11 -10
  39. package/lib/notes/scope.d.ts.map +1 -1
  40. package/lib/notes/scope.js +11 -10
  41. package/lib/notes/scope.js.map +1 -1
  42. package/lib/notes/settings.d.ts +9 -20
  43. package/lib/notes/settings.d.ts.map +1 -1
  44. package/lib/notes/settings.js +9 -27
  45. package/lib/notes/settings.js.map +1 -1
  46. package/lib/remote/index.d.ts +67 -6
  47. package/lib/remote/index.d.ts.map +1 -1
  48. package/lib/remote/index.js +94 -9
  49. package/lib/remote/index.js.map +1 -1
  50. package/lib/remote/typert.remote-client.d.ts +8 -1
  51. package/lib/remote/typert.remote-client.js +6 -0
  52. package/lib/remote/types.d.ts +1 -1
  53. package/lib/remote/types.d.ts.map +1 -1
  54. package/lib/review/accumulator.d.ts +5 -5
  55. package/lib/review/accumulator.d.ts.map +1 -1
  56. package/lib/review/accumulator.js +3 -3
  57. package/lib/review/accumulator.js.map +1 -1
  58. package/lib/review/dedup.d.ts +23 -15
  59. package/lib/review/dedup.d.ts.map +1 -1
  60. package/lib/review/dedup.js +34 -83
  61. package/lib/review/dedup.js.map +1 -1
  62. package/lib/review/extract.d.ts.map +1 -1
  63. package/lib/review/extract.js +5 -2
  64. package/lib/review/extract.js.map +1 -1
  65. package/lib/review/index.d.ts.map +1 -1
  66. package/lib/review/index.js +28 -21
  67. package/lib/review/index.js.map +1 -1
  68. package/lib/scanner.d.ts +2 -0
  69. package/lib/scanner.d.ts.map +1 -1
  70. package/lib/scanner.js +22 -0
  71. package/lib/scanner.js.map +1 -1
  72. package/lib/store/bm25.d.ts +75 -1
  73. package/lib/store/bm25.d.ts.map +1 -1
  74. package/lib/store/bm25.js +162 -17
  75. package/lib/store/bm25.js.map +1 -1
  76. package/lib/store/cross-process.d.ts +155 -0
  77. package/lib/store/cross-process.d.ts.map +1 -0
  78. package/lib/store/cross-process.js +254 -0
  79. package/lib/store/cross-process.js.map +1 -0
  80. package/lib/store/index.d.ts +89 -7
  81. package/lib/store/index.d.ts.map +1 -1
  82. package/lib/store/index.js +466 -89
  83. package/lib/store/index.js.map +1 -1
  84. package/lib/tool/index.d.ts +17 -5
  85. package/lib/tool/index.d.ts.map +1 -1
  86. package/lib/tool/index.js +237 -24
  87. package/lib/tool/index.js.map +1 -1
  88. package/lib/types.d.ts +31 -2
  89. package/lib/types.d.ts.map +1 -1
  90. package/package.json +40 -31
  91. package/lib/notes/writer.d.ts +0 -65
  92. package/lib/notes/writer.d.ts.map +0 -1
  93. package/lib/notes/writer.js +0 -131
  94. package/lib/notes/writer.js.map +0 -1
@@ -1,42 +1,38 @@
1
1
  /**
2
- * `@chenhw7/dsh-memory/notes`: the project-notes exporter (docs/PROJECT_NOTES.zh-CN.md).
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 in-repo markdown files (`docs/agent-memory/` by default)
5
- * and maintains an AGENTS.md pointer block.
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
- * that is persisted (async, atomic) is also what `memory-context` freezes
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
- import { settingsNamespace } from '@deepseek-ai/dsh-settings';
16
- import path from 'node:path';
17
16
  import { scanContent } from '../scanner.js';
18
17
  import { isRenderedEntry } from './scope.js';
19
18
  import { renderConventions, renderPitfalls } from './render.js';
20
- import { ensureAgentsPointer, writeNotesFile, DriftError } from './writer.js';
21
- import { resolveNotesSettings, resolveNotesDir } from './settings.js';
19
+ import { cleanupLegacyNotesArtifacts } from './cleanup.js';
20
+ import { resolveNotesSettings } from './settings.js';
22
21
  export { isRenderedEntry } from './scope.js';
23
22
  export { renderConventions, renderPitfalls } from './render.js';
24
- export { ensureAgentsPointer, writeFileAtomic, writeNotesFile, DriftError, agentsPointerBlock, AGENTS_POINTER_BEGIN, AGENTS_POINTER_END } from './writer.js';
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';
23
+ export { cleanupLegacyNotesArtifacts, stripAgentsPointerBlock, AGENTS_POINTER_BEGIN, AGENTS_POINTER_END, LEGACY_NOTES_DIR } from './cleanup.js';
24
+ export { resolveNotesSettings, DEFAULT_NOTES_ENABLED, DEFAULT_NOTES_CHAR_LIMIT, DEFAULT_NOTES_MAX_ENTRIES_PER_FILE } from './settings.js';
26
25
  /** Cordis plugin name. */
27
26
  export const name = 'memory-notes';
28
27
  /** Nothing is required: `memory` and `settings` are accessed optionally. */
29
28
  export const inject = [];
30
29
  /** The settings namespace owned by `memory-context`, read here defensively. */
31
- const MEMORY_NS = settingsNamespace('memory');
32
- /** Debounce window for activity-triggered re-renders, in milliseconds. */
33
- const RENDER_DEBOUNCE_MS = 2_000;
30
+ const MEMORY_NS = 'memory';
34
31
  /** The empty snapshot. */
35
32
  const EMPTY_SNAPSHOT = { conventions: '', pitfalls: '' };
36
33
  /**
37
34
  * The project-notes service, registered on `ctx.projectNotes` by this plugin.
38
- * Consumers (memory-context and this plugin's own handlers) reconcile and
39
- * read through it.
35
+ * Consumers (memory-context) render and read through it. Pure — no I/O.
40
36
  */
41
37
  export class ProjectNotesService {
42
38
  constructor() {
@@ -54,16 +50,6 @@ function projectNameOf(cwd) {
54
50
  class ProjectNotesServiceImpl extends ProjectNotesService {
55
51
  ctx;
56
52
  settings;
57
- /** Last persisted file texts per notes dir, for skip-if-unchanged and drift detection. */
58
- persisted = new Map();
59
- /** Set to true when a drift error was already reported for this dir (log-once). */
60
- driftReported = new Set();
61
- /** Last store health timestamp already rendered, for the dirty check. */
62
- renderedHealthTs;
63
- /** notesDir values already reported as escaping the project root (log-once). */
64
- traversalReported = new Set();
65
- /** Debounce timer for activity-triggered re-renders. */
66
- timer;
67
53
  constructor(ctx, settings) {
68
54
  super();
69
55
  this.ctx = ctx;
@@ -77,20 +63,19 @@ class ProjectNotesServiceImpl extends ProjectNotesService {
77
63
  return EMPTY_SNAPSHOT;
78
64
  }
79
65
  // No cwd → there is no current project, so project-scope entries drop
80
- // out, but the global/user slices still render; persistence is skipped
81
- // (there is no project root to write the files into).
66
+ // out, but the global/user slices still render.
82
67
  const projectName = cwd === undefined || cwd.length === 0 ? undefined : projectNameOf(cwd);
83
68
  const conventions = [];
84
69
  const pitfalls = [];
85
70
  for (const entry of memory.list()) {
86
71
  // Load-time guard: entries that fail the scanner never reach the
87
- // exported files (which feed both git and future injections). Unlike
88
- // the prompt surfaces there is no placeholder here — an omitted
89
- // section entry is simply absent; the store keeps the original for
90
- // user inspection and removal.
72
+ // exported section (which feeds future injections). Unlike the prompt
73
+ // surfaces there is no placeholder here — an omitted section entry is
74
+ // simply absent; the store keeps the original for user inspection and
75
+ // removal.
91
76
  if (!scanContent(entry.content).allowed)
92
77
  continue;
93
- // Soft-decayed entries drop out of every standing view, files included.
78
+ // Soft-decayed entries drop out of every standing view, this one included.
94
79
  if (entry.staleSince !== undefined)
95
80
  continue;
96
81
  const kind = isRenderedEntry(entry, projectName);
@@ -99,103 +84,21 @@ class ProjectNotesServiceImpl extends ProjectNotesService {
99
84
  else if (kind === 'pitfalls')
100
85
  pitfalls.push(entry);
101
86
  }
102
- const snapshot = {
87
+ return {
103
88
  conventions: renderConventions(conventions, settings.notesMaxEntriesPerFile),
104
89
  pitfalls: renderPitfalls(pitfalls, settings.notesMaxEntriesPerFile),
105
90
  };
106
- if (cwd !== undefined && cwd.length > 0)
107
- this.persist(cwd, snapshot, settings);
108
- this.renderedHealthTs = memory.health().lastActivityTs;
109
- return snapshot;
110
91
  }
111
- catch {
92
+ catch (error) {
93
+ this.ctx.get('memory')?.reportFailure('notes-snapshot', error);
112
94
  return EMPTY_SNAPSHOT;
113
95
  }
114
96
  }
115
- /** Render + persist only when the store changed since the last render. */
116
- reconcileIfStale(cwd) {
117
- const memory = this.ctx.get('memory');
118
- if (memory === undefined)
119
- return;
120
- const ts = memory.health().lastActivityTs;
121
- if (ts === undefined || ts === this.renderedHealthTs)
122
- return;
123
- if (this.timer !== undefined)
124
- clearTimeout(this.timer);
125
- this.timer = setTimeout(() => {
126
- this.timer = undefined;
127
- try {
128
- this.snapshotFor(cwd);
129
- }
130
- catch {
131
- // Best-effort: a re-render failure never propagates.
132
- }
133
- }, RENDER_DEBOUNCE_MS);
134
- }
135
- /** Persist the snapshot atomically when it differs from the last write. */
136
- persist(cwd, snapshot, settings) {
137
- const dir = resolveNotesDir(cwd, settings.notesDir);
138
- if (dir === undefined) {
139
- // Containment: an escaping notesDir must never direct writes outside
140
- // the project. Rendered snapshots keep flowing to the prompt; only the
141
- // file persistence is skipped.
142
- if (!this.traversalReported.has(settings.notesDir)) {
143
- this.traversalReported.add(settings.notesDir);
144
- console.warn(`[dsh-memory] notesDir "${settings.notesDir}" resolves outside the project root; skipping notes persistence for it.`);
145
- }
146
- return;
147
- }
148
- const previous = this.persisted.get(dir);
149
- if (previous !== undefined && previous.conventions === snapshot.conventions && previous.pitfalls === snapshot.pitfalls) {
150
- return;
151
- }
152
- void (async () => {
153
- try {
154
- await writeNotesFile(path.join(dir, 'CONVENTIONS.md'), snapshot.conventions, previous?.conventions);
155
- await writeNotesFile(path.join(dir, 'PITFALLS.md'), snapshot.pitfalls, previous?.pitfalls);
156
- if (settings.notesAgentsPointer) {
157
- await ensureAgentsPointer(path.join(cwd, 'AGENTS.md'), settings.notesDir);
158
- }
159
- // Only after a successful write: record this snapshot as the drift
160
- // baseline so the next write can detect external modifications.
161
- this.persisted.set(dir, snapshot);
162
- }
163
- catch (error) {
164
- if (error instanceof DriftError) {
165
- // Drift: external modification was backed up to `.bak.<ts>`;
166
- // the store remains the source of truth and the in-memory
167
- // snapshot continues to be served. Update the baseline to the
168
- // drifted on-disk content so the NEXT persist attempt can write
169
- // fresh content (the drift has been "absorbed" as the new base).
170
- try {
171
- const { readFile } = await import('node:fs/promises');
172
- const driftedConventions = await readFile(path.join(dir, 'CONVENTIONS.md'), 'utf8').catch(() => undefined);
173
- const driftedPitfalls = await readFile(path.join(dir, 'PITFALLS.md'), 'utf8').catch(() => undefined);
174
- if (driftedConventions !== undefined || driftedPitfalls !== undefined) {
175
- this.persisted.set(dir, {
176
- conventions: driftedConventions ?? previous?.conventions ?? '',
177
- pitfalls: driftedPitfalls ?? previous?.pitfalls ?? '',
178
- });
179
- }
180
- }
181
- catch { /* best-effort */ }
182
- // Report once per notes dir so the log is not spammed on every
183
- // reconcile cycle; the user should reconcile the .bak file.
184
- if (!this.driftReported.has(dir)) {
185
- this.driftReported.add(dir);
186
- 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.`);
187
- }
188
- return;
189
- }
190
- // Best-effort: persistence failures never surface to the session.
191
- }
192
- })();
193
- }
194
97
  }
195
98
  /**
196
99
  * Install the memory-notes plugin: register the `projectNotes` service and
197
- * the reconcile triggers (`agent/pre-step` dirty check; `memory-context`
198
- * additionally reconciles on `session/created` via the service itself).
100
+ * the one-time legacy-artifact cleanup on `session/created` (≤0.5.x wrote
101
+ * rendered files + an AGENTS.md pointer into the repo; 0.6 removes them).
199
102
  * @param ctx - Cordis context.
200
103
  */
201
104
  export function apply(ctx) {
@@ -209,14 +112,18 @@ export function apply(ctx) {
209
112
  };
210
113
  const service = new ProjectNotesServiceImpl(ctx, settings);
211
114
  ctx.provide('projectNotes', service);
212
- ctx.on('agent/pre-step', async ({ agent }, next) => {
213
- try {
214
- service.reconcileIfStale(agent.session.header?.cwd);
215
- }
216
- catch {
217
- // Best-effort: never block the step.
218
- }
219
- return next();
220
- });
115
+ // One-time migration: strip the file-export artifacts a ≤0.5.x install
116
+ // left in this project (marker-managed AGENTS.md block, generated notes
117
+ // files). Once per project root per process; idempotent, best-effort.
118
+ const cleanedRoots = new Set();
119
+ ctx.on('session/created', (session) => {
120
+ const cwd = session.header?.cwd;
121
+ if (cwd === undefined || cwd.length === 0 || cleanedRoots.has(cwd))
122
+ return;
123
+ cleanedRoots.add(cwd);
124
+ void cleanupLegacyNotesArtifacts(cwd, ctx.logger).catch((error) => {
125
+ ctx.get('memory')?.reportFailure('legacy-cleanup', error);
126
+ });
127
+ }, { global: true });
221
128
  }
222
129
  //# sourceMappingURL=index.js.map
@@ -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,EAAmB,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAsB,MAAM,eAAe,CAAA;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC/D,OAAO,EAAE,mBAAmB,EAAE,eAAe,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAC5J,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,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AG,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"}
@@ -1,32 +1,32 @@
1
1
  /**
2
- * Markdown renderers for the project-notes files: store entries (pre-filtered
3
- * through {@link isRenderedEntry}) become CONVENTIONS.md / PITFALLS.md
4
- * documents. Pure functions.
2
+ * Markdown renderers for the project-notes prompt section: store entries
3
+ * (pre-filtered through {@link isRenderedEntry}) become the conventions /
4
+ * pitfalls texts injected into the system prompt. Pure functions — no I/O.
5
5
  *
6
6
  * Section order doubles as the precedence hint (project > global > personal);
7
7
  * the injected system-prompt wrapper states it explicitly. Section headings
8
- * are English regardless of entry language — the files are repo artifacts.
8
+ * are English regardless of entry language — the notes surface is English.
9
9
  *
10
10
  * @module @chenhw7/dsh-memory/notes/render
11
11
  */
12
12
  import type { MemoryEntry } from '../types.ts';
13
- /** The header stamped at the top of every generated notes file. */
14
- export declare const AUTO_HEADER = "<!-- AUTO-GENERATED by dsh-memory \u2014 do not edit by hand; manage via conversation or the memory UI. -->";
13
+ /** The provenance line stamped under every rendered section title. */
14
+ export declare const AUTO_HEADER = "Managed by dsh-memory (auto-generated from the memory store) \u2014 correct outdated entries via the memory tools or the Memory UI.";
15
15
  /**
16
- * Render CONVENTIONS.md: `## Project conventions` / `## Global practices` /
17
- * `## Personal habits` (empty sections omitted).
16
+ * Render the conventions text: `## Project conventions` / `## Global
17
+ * practices` / `## Personal habits` (empty sections omitted).
18
18
  * @param entries - convention-kind entries (already filtered).
19
19
  * @param cap - max total entries (`notesMaxEntriesPerFile`); `0` = unlimited.
20
- * @returns the full file text.
20
+ * @returns the full section text.
21
21
  */
22
22
  export declare function renderConventions(entries: readonly MemoryEntry[], cap: number): string;
23
23
  /**
24
- * Render PITFALLS.md: `## Project pitfalls` / `## Environment & cross-project
25
- * pitfalls` (empty sections omitted). Entry content is emitted verbatim — the
26
- * pitfall extraction prompt guarantees the structured wording.
24
+ * Render the pitfalls text: `## Project pitfalls` / `## Environment &
25
+ * cross-project pitfalls` (empty sections omitted). Entry content is emitted
26
+ * verbatim — the pitfall extraction prompt guarantees the structured wording.
27
27
  * @param entries - pitfall-kind entries (already filtered).
28
28
  * @param cap - max total entries (`notesMaxEntriesPerFile`); `0` = unlimited.
29
- * @returns the full file text.
29
+ * @returns the full section text.
30
30
  */
31
31
  export declare function renderPitfalls(entries: readonly MemoryEntry[], cap: number): string;
32
32
  //# sourceMappingURL=render.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/notes/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,aAAa,CAAA;AAE3D,mEAAmE;AACnE,eAAO,MAAM,WAAW,gHAA2G,CAAA;AA4BnI;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQtF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAOnF"}
1
+ {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/notes/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAe,MAAM,aAAa,CAAA;AAE3D,sEAAsE;AACtE,eAAO,MAAM,WAAW,wIAAmI,CAAA;AA4B3J;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQtF;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAOnF"}
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Markdown renderers for the project-notes files: store entries (pre-filtered
3
- * through {@link isRenderedEntry}) become CONVENTIONS.md / PITFALLS.md
4
- * documents. Pure functions.
2
+ * Markdown renderers for the project-notes prompt section: store entries
3
+ * (pre-filtered through {@link isRenderedEntry}) become the conventions /
4
+ * pitfalls texts injected into the system prompt. Pure functions — no I/O.
5
5
  *
6
6
  * Section order doubles as the precedence hint (project > global > personal);
7
7
  * the injected system-prompt wrapper states it explicitly. Section headings
8
- * are English regardless of entry language — the files are repo artifacts.
8
+ * are English regardless of entry language — the notes surface is English.
9
9
  *
10
10
  * @module @chenhw7/dsh-memory/notes/render
11
11
  */
12
- /** The header stamped at the top of every generated notes file. */
13
- export const AUTO_HEADER = '<!-- AUTO-GENERATED by dsh-memory — do not edit by hand; manage via conversation or the memory UI. -->';
12
+ /** The provenance line stamped under every rendered section title. */
13
+ export const AUTO_HEADER = 'Managed by dsh-memory (auto-generated from the memory store) — correct outdated entries via the memory tools or the Memory UI.';
14
14
  /** Format an epoch-ms timestamp as `YYYY-MM-DD`. */
15
15
  function isoDate(ts) {
16
16
  return new Date(ts).toISOString().slice(0, 10);
@@ -34,11 +34,11 @@ function byScope(entries, scope) {
34
34
  return entries.filter(entry => entry.scope === scope);
35
35
  }
36
36
  /**
37
- * Render CONVENTIONS.md: `## Project conventions` / `## Global practices` /
38
- * `## Personal habits` (empty sections omitted).
37
+ * Render the conventions text: `## Project conventions` / `## Global
38
+ * practices` / `## Personal habits` (empty sections omitted).
39
39
  * @param entries - convention-kind entries (already filtered).
40
40
  * @param cap - max total entries (`notesMaxEntriesPerFile`); `0` = unlimited.
41
- * @returns the full file text.
41
+ * @returns the full section text.
42
42
  */
43
43
  export function renderConventions(entries, cap) {
44
44
  const capped = capEntries(entries, cap);
@@ -50,12 +50,12 @@ export function renderConventions(entries, cap) {
50
50
  return `# Conventions\n\n${AUTO_HEADER}\n\n${parts.join('\n\n')}\n`;
51
51
  }
52
52
  /**
53
- * Render PITFALLS.md: `## Project pitfalls` / `## Environment & cross-project
54
- * pitfalls` (empty sections omitted). Entry content is emitted verbatim — the
55
- * pitfall extraction prompt guarantees the structured wording.
53
+ * Render the pitfalls text: `## Project pitfalls` / `## Environment &
54
+ * cross-project pitfalls` (empty sections omitted). Entry content is emitted
55
+ * verbatim — the pitfall extraction prompt guarantees the structured wording.
56
56
  * @param entries - pitfall-kind entries (already filtered).
57
57
  * @param cap - max total entries (`notesMaxEntriesPerFile`); `0` = unlimited.
58
- * @returns the full file text.
58
+ * @returns the full section text.
59
59
  */
60
60
  export function renderPitfalls(entries, cap) {
61
61
  const capped = capEntries(entries, cap);
@@ -1 +1 @@
1
- {"version":3,"file":"render.js","sourceRoot":"","sources":["../../src/notes/render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,mEAAmE;AACnE,MAAM,CAAC,MAAM,WAAW,GAAG,wGAAwG,CAAA;AAEnI,oDAAoD;AACpD,SAAS,OAAO,CAAC,EAAU;IACzB,OAAO,IAAI,IAAI,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;AAChD,CAAC;AAED,0CAA0C;AAC1C,SAAS,MAAM,CAAC,KAAkB;IAChC,OAAO,MAAM,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAA;AAC3D,CAAC;AAED,sEAAsE;AACtE,SAAS,OAAO,CAAC,KAAa,EAAE,OAA+B;IAC7D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACnC,OAAO,MAAM,K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,CAAC,CAAC;QACvD,OAAO,CAAC,sCAAsC,EAAE,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;KAC3E,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACjC,OAAO,iBAAiB,WAAW,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;AAClE,CAAC"}
@@ -1,24 +1,25 @@
1
1
  /**
2
- * The scope×category render matrix for project notes (§4 of
3
- * docs/PROJECT_NOTES.zh-CN.md): which store entries land in the notes files.
4
- * Pure functions, zero host imports — shared by the notes renderer and by
5
- * `memory-context` (which excludes the same set from its own snapshot/index
6
- * injection so content never appears twice in the prompt).
2
+ * The scope×category render matrix for project notes (TECH_DESIGN §7.4):
3
+ * which store entries land in the
4
+ * `project-notes` prompt section. Pure functions, zero host imports — shared
5
+ * by the notes renderer and by `memory-context` (which excludes the same set
6
+ * from its own snapshot/index injection so content never appears twice in
7
+ * the prompt).
7
8
  *
8
9
  * @module @chenhw7/dsh-memory/notes/scope
9
10
  */
10
11
  import type { MemoryCategory, MemoryEntry } from '../types.ts';
11
- /** Categories rendered into CONVENTIONS.md. */
12
+ /** Categories rendered as conventions. */
12
13
  export declare const NOTES_CONVENTION_CATEGORIES: readonly MemoryCategory[];
13
- /** Categories rendered into PITFALLS.md (project- and global-scoped only). */
14
+ /** Categories rendered as pitfalls (project- and global-scoped only). */
14
15
  export declare const NOTES_PITFALL_CATEGORIES: readonly MemoryCategory[];
15
16
  /** The minimal entry shape the matrix needs. */
16
17
  export type RenderableEntry = Pick<MemoryEntry, 'scope' | 'category' | 'projectName'>;
17
18
  /** Which notes file an entry renders into, when any. */
18
19
  export type NotesKind = 'conventions' | 'pitfalls';
19
20
  /**
20
- * Decide whether an entry is rendered into the notes files, and into which
21
- * one. Rules (docs/PROJECT_NOTES.zh-CN.md §4):
21
+ * Decide whether an entry is rendered into the `project-notes` section, and
22
+ * into which half (conventions or pitfalls). Rules:
22
23
  * - `project`-scoped entries must match the current project name; an unknown
23
24
  * project (no cwd) excludes them.
24
25
  * - Conventions come from all three scopes (project > global > personal is
@@ -29,7 +30,7 @@ export type NotesKind = 'conventions' | 'pitfalls';
29
30
  *
30
31
  * @param entry - the entry to classify.
31
32
  * @param projectName - the current project name (cwd basename), or undefined.
32
- * @returns the target notes file kind, or `undefined` when not rendered.
33
+ * @returns the target render half, or `undefined` when not rendered.
33
34
  */
34
35
  export declare function isRenderedEntry(entry: RenderableEntry, projectName: string | undefined): NotesKind | undefined;
35
36
  //# sourceMappingURL=scope.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/notes/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9D,+CAA+C;AAC/C,eAAO,MAAM,2BAA2B,EAAE,SAAS,cAAc,EAAiC,CAAA;AAElG,8EAA8E;AAC9E,eAAO,MAAM,wBAAwB,EAAE,SAAS,cAAc,EAA2C,CAAA;AAEzG,gDAAgD;AAChD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC,CAAA;AAErF,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,CAAA;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAY9G"}
1
+ {"version":3,"file":"scope.d.ts","sourceRoot":"","sources":["../../src/notes/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAE9D,0CAA0C;AAC1C,eAAO,MAAM,2BAA2B,EAAE,SAAS,cAAc,EAAiC,CAAA;AAElG,yEAAyE;AACzE,eAAO,MAAM,wBAAwB,EAAE,SAAS,cAAc,EAA2C,CAAA;AAEzG,gDAAgD;AAChD,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,UAAU,GAAG,aAAa,CAAC,CAAA;AAErF,wDAAwD;AACxD,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,CAAA;AAElD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAY9G"}
@@ -1,19 +1,20 @@
1
1
  /**
2
- * The scope×category render matrix for project notes (§4 of
3
- * docs/PROJECT_NOTES.zh-CN.md): which store entries land in the notes files.
4
- * Pure functions, zero host imports — shared by the notes renderer and by
5
- * `memory-context` (which excludes the same set from its own snapshot/index
6
- * injection so content never appears twice in the prompt).
2
+ * The scope×category render matrix for project notes (TECH_DESIGN §7.4):
3
+ * which store entries land in the
4
+ * `project-notes` prompt section. Pure functions, zero host imports — shared
5
+ * by the notes renderer and by `memory-context` (which excludes the same set
6
+ * from its own snapshot/index injection so content never appears twice in
7
+ * the prompt).
7
8
  *
8
9
  * @module @chenhw7/dsh-memory/notes/scope
9
10
  */
10
- /** Categories rendered into CONVENTIONS.md. */
11
+ /** Categories rendered as conventions. */
11
12
  export const NOTES_CONVENTION_CATEGORIES = ['convention', 'preference'];
12
- /** Categories rendered into PITFALLS.md (project- and global-scoped only). */
13
+ /** Categories rendered as pitfalls (project- and global-scoped only). */
13
14
  export const NOTES_PITFALL_CATEGORIES = ['failure', 'procedure', 'tool-quirk'];
14
15
  /**
15
- * Decide whether an entry is rendered into the notes files, and into which
16
- * one. Rules (docs/PROJECT_NOTES.zh-CN.md §4):
16
+ * Decide whether an entry is rendered into the `project-notes` section, and
17
+ * into which half (conventions or pitfalls). Rules:
17
18
  * - `project`-scoped entries must match the current project name; an unknown
18
19
  * project (no cwd) excludes them.
19
20
  * - Conventions come from all three scopes (project > global > personal is
@@ -24,7 +25,7 @@ export const NOTES_PITFALL_CATEGORIES = ['failure', 'procedure', 'tool-quirk'];
24
25
  *
25
26
  * @param entry - the entry to classify.
26
27
  * @param projectName - the current project name (cwd basename), or undefined.
27
- * @returns the target notes file kind, or `undefined` when not rendered.
28
+ * @returns the target render half, or `undefined` when not rendered.
28
29
  */
29
30
  export function isRenderedEntry(entry, projectName) {
30
31
  const category = entry.category;
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","sourceRoot":"","sources":["../../src/notes/scope.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,+CAA+C;AAC/C,MAAM,CAAC,MAAM,2BAA2B,GAA8B,CAAC,YAAY,EAAE,YAAY,CAAC,CAAA;AAElG,8EAA8E;AAC9E,MAAM,CAAC,MAAM,wBAAwB,GAA8B,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,CAAC,CAAA;AAQzG;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,eAAe,CAAC,KAAsB,EAAE,WAA+B;IACrF,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAA;IAC/B,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,SAAS,CAAA;IAC5C,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,KAAK,SAAS,CAAA;IAC3C,IAAI,SAAS,IAAI,CAAC,WAAW,KAAK,SAAS,IAAI,KAAK,CAAC,WAAW,KAAK,WAAW,CAAC;QAAE,OAAO,SAAS,CAAA;IACnG,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,MAAM,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,IAAI,2BAA2B,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QACxH,OAAO,aAAa,CAAA;IACtB,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,KAA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5
  * ownership) and the `memory-notes` plugin (defensive reads of the raw
6
6
  * namespace value via `ctx.settings.get`).
7
7
  *
8
+ * Since 0.6 the notes surface is prompt-only (no repo files), so there is no
9
+ * directory or AGENTS.md knob anymore — `notesEnabled` gates the injected
10
+ * `project-notes` section and the two budget keys cap its render.
11
+ *
8
12
  * @module @chenhw7/dsh-memory/notes/settings
9
13
  */
10
- /** Whether notes export + injection are enabled. */
14
+ /** Whether the project-notes prompt section is injected. */
11
15
  export declare const DEFAULT_NOTES_ENABLED = true;
12
- /** Repo-relative directory holding the generated notes files. */
13
- export declare const DEFAULT_NOTES_DIR = "docs/agent-memory";
14
- /** Total character budget for the injected notes section. */
16
+ /** Character budget for the injected project-notes section. */
15
17
  export declare const DEFAULT_NOTES_CHAR_LIMIT = 4000;
16
- /** Whether the AGENTS.md pointer block is maintained. */
17
- export declare const DEFAULT_NOTES_AGENTS_POINTER = true;
18
- /** Max entries per generated file (oldest by updatedAt are truncated). */
18
+ /** Max entries rendered into the project-notes section (oldest by updatedAt are truncated). */
19
19
  export declare const DEFAULT_NOTES_MAX_ENTRIES_PER_FILE = 100;
20
20
  /** The notes slice of the `memory` settings namespace, fully resolved. */
21
21
  export interface NotesSettings {
22
22
  readonly notesEnabled: boolean;
23
- readonly notesDir: string;
24
23
  readonly notesCharLimit: number;
25
- readonly notesAgentsPointer: boolean;
26
24
  readonly notesMaxEntriesPerFile: number;
27
25
  }
28
26
  /**
29
27
  * Resolve the notes settings from an untyped namespace value (defaults for
30
- * anything absent or mistyped).
28
+ * anything absent or mistyped). Unknown keys — including the pre-0.6
29
+ * `notesDir` / `notesAgentsPointer` — are ignored.
31
30
  * @param value - the raw `memory` namespace value (`ctx.settings.get` returns `unknown`).
32
31
  * @returns the fully-resolved notes settings.
33
32
  */
34
33
  export declare function resolveNotesSettings(value: unknown): NotesSettings;
35
- /**
36
- * Resolve `notesDir` against the project root, requiring containment: absolute
37
- * values and `../`-style escapes resolve outside the root and are rejected, so
38
- * a mistyped or hostile settings value cannot direct notes writes out of the
39
- * project. Lexical check only — symlinks are not resolved.
40
- * @param cwd - the project root (session working directory).
41
- * @param notesDir - the settings value (repo-relative by convention).
42
- * @returns the absolute contained directory, or undefined when rejected.
43
- */
44
- export declare function resolveNotesDir(cwd: string, notesDir: string): string | undefined;
45
34
  //# sourceMappingURL=settings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/notes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,oDAAoD;AACpD,eAAO,MAAM,qBAAqB,OAAO,CAAA;AACzC,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,sBAAsB,CAAA;AACpD,6DAA6D;AAC7D,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C,yDAAyD;AACzD,eAAO,MAAM,4BAA4B,OAAO,CAAA;AAChD,0EAA0E;AAC1E,eAAO,MAAM,kCAAkC,MAAM,CAAA;AAErD,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,kBAAkB,EAAE,OAAO,CAAA;IACpC,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAA;CACxC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CASlE;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKjF"}
1
+ {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/notes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,4DAA4D;AAC5D,eAAO,MAAM,qBAAqB,OAAO,CAAA;AACzC,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,OAAO,CAAA;AAC5C,+FAA+F;AAC/F,eAAO,MAAM,kCAAkC,MAAM,CAAA;AAErD,0EAA0E;AAC1E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAA;CACxC;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAOlE"}
@@ -5,22 +5,22 @@
5
5
  * ownership) and the `memory-notes` plugin (defensive reads of the raw
6
6
  * namespace value via `ctx.settings.get`).
7
7
  *
8
+ * Since 0.6 the notes surface is prompt-only (no repo files), so there is no
9
+ * directory or AGENTS.md knob anymore — `notesEnabled` gates the injected
10
+ * `project-notes` section and the two budget keys cap its render.
11
+ *
8
12
  * @module @chenhw7/dsh-memory/notes/settings
9
13
  */
10
- import path from 'node:path';
11
- /** Whether notes export + injection are enabled. */
14
+ /** Whether the project-notes prompt section is injected. */
12
15
  export const DEFAULT_NOTES_ENABLED = true;
13
- /** Repo-relative directory holding the generated notes files. */
14
- export const DEFAULT_NOTES_DIR = 'docs/agent-memory';
15
- /** Total character budget for the injected notes section. */
16
+ /** Character budget for the injected project-notes section. */
16
17
  export const DEFAULT_NOTES_CHAR_LIMIT = 4000;
17
- /** Whether the AGENTS.md pointer block is maintained. */
18
- export const DEFAULT_NOTES_AGENTS_POINTER = true;
19
- /** Max entries per generated file (oldest by updatedAt are truncated). */
18
+ /** Max entries rendered into the project-notes section (oldest by updatedAt are truncated). */
20
19
  export const DEFAULT_NOTES_MAX_ENTRIES_PER_FILE = 100;
21
20
  /**
22
21
  * Resolve the notes settings from an untyped namespace value (defaults for
23
- * anything absent or mistyped).
22
+ * anything absent or mistyped). Unknown keys — including the pre-0.6
23
+ * `notesDir` / `notesAgentsPointer` — are ignored.
24
24
  * @param value - the raw `memory` namespace value (`ctx.settings.get` returns `unknown`).
25
25
  * @returns the fully-resolved notes settings.
26
26
  */
@@ -28,26 +28,8 @@ export function resolveNotesSettings(value) {
28
28
  const v = (typeof value === 'object' && value !== null ? value : {});
29
29
  return {
30
30
  notesEnabled: typeof v.notesEnabled === 'boolean' ? v.notesEnabled : DEFAULT_NOTES_ENABLED,
31
- notesDir: typeof v.notesDir === 'string' && v.notesDir.trim().length > 0 ? v.notesDir.trim() : DEFAULT_NOTES_DIR,
32
31
  notesCharLimit: typeof v.notesCharLimit === 'number' && v.notesCharLimit >= 0 ? Math.trunc(v.notesCharLimit) : DEFAULT_NOTES_CHAR_LIMIT,
33
- notesAgentsPointer: typeof v.notesAgentsPointer === 'boolean' ? v.notesAgentsPointer : DEFAULT_NOTES_AGENTS_POINTER,
34
32
  notesMaxEntriesPerFile: typeof v.notesMaxEntriesPerFile === 'number' && v.notesMaxEntriesPerFile >= 0 ? Math.trunc(v.notesMaxEntriesPerFile) : DEFAULT_NOTES_MAX_ENTRIES_PER_FILE,
35
33
  };
36
34
  }
37
- /**
38
- * Resolve `notesDir` against the project root, requiring containment: absolute
39
- * values and `../`-style escapes resolve outside the root and are rejected, so
40
- * a mistyped or hostile settings value cannot direct notes writes out of the
41
- * project. Lexical check only — symlinks are not resolved.
42
- * @param cwd - the project root (session working directory).
43
- * @param notesDir - the settings value (repo-relative by convention).
44
- * @returns the absolute contained directory, or undefined when rejected.
45
- */
46
- export function resolveNotesDir(cwd, notesDir) {
47
- const root = path.resolve(cwd);
48
- const dir = path.resolve(root, notesDir);
49
- if (dir !== root && !dir.startsWith(root + path.sep))
50
- return undefined;
51
- return dir;
52
- }
53
35
  //# sourceMappingURL=settings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/notes/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,oDAAoD;AACpD,MAAM,CA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