@roackb2/heddle 1.6.0 → 1.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 (193) hide show
  1. package/README.md +5 -0
  2. package/dist/examples/repo-investigator.js +2 -2
  3. package/dist/examples/repo-investigator.js.map +1 -1
  4. package/dist/src/cli/ask.d.ts.map +1 -1
  5. package/dist/src/cli/ask.js +4 -4
  6. package/dist/src/cli/ask.js.map +1 -1
  7. package/dist/src/cli/chat/commands/debug-snapshot-command.js +2 -2
  8. package/dist/src/cli/chat/commands/debug-snapshot-command.js.map +1 -1
  9. package/dist/src/cli/chat/state/local-commands.js +6 -6
  10. package/dist/src/cli/chat/state/local-commands.js.map +1 -1
  11. package/dist/src/cli/chat/utils/runtime.d.ts.map +1 -1
  12. package/dist/src/cli/chat/utils/runtime.js +3 -3
  13. package/dist/src/cli/chat/utils/runtime.js.map +1 -1
  14. package/dist/src/cli/main.js +22 -20
  15. package/dist/src/cli/main.js.map +1 -1
  16. package/dist/src/cli/remote/control-plane-client.d.ts +1 -1
  17. package/dist/src/core/agent/budget/index.d.ts +2 -0
  18. package/dist/src/core/agent/budget/index.d.ts.map +1 -0
  19. package/dist/src/core/agent/budget/index.js +2 -0
  20. package/dist/src/core/agent/budget/index.js.map +1 -0
  21. package/dist/src/core/agent/budget/step-budget.d.ts +12 -0
  22. package/dist/src/core/agent/budget/step-budget.d.ts.map +1 -0
  23. package/dist/src/core/agent/budget/step-budget.js +21 -0
  24. package/dist/src/core/agent/budget/step-budget.js.map +1 -0
  25. package/dist/src/core/agent/context/run-context-builder.js +6 -6
  26. package/dist/src/core/agent/context/run-context-builder.js.map +1 -1
  27. package/dist/src/core/agent/tools/tool-dispatcher.d.ts +3 -4
  28. package/dist/src/core/agent/tools/tool-dispatcher.d.ts.map +1 -1
  29. package/dist/src/core/agent/tools/tool-dispatcher.js +2 -2
  30. package/dist/src/core/agent/tools/tool-dispatcher.js.map +1 -1
  31. package/dist/src/core/agent/types.d.ts +5 -5
  32. package/dist/src/core/agent/types.d.ts.map +1 -1
  33. package/dist/src/core/chat/engine/turns/memory/turn-memory-maintenance.d.ts.map +1 -1
  34. package/dist/src/core/chat/engine/turns/memory/turn-memory-maintenance.js +9 -5
  35. package/dist/src/core/chat/engine/turns/memory/turn-memory-maintenance.js.map +1 -1
  36. package/dist/src/core/chat/engine/turns/runtime/runtime-resolver.d.ts.map +1 -1
  37. package/dist/src/core/chat/engine/turns/runtime/runtime-resolver.js +2 -3
  38. package/dist/src/core/chat/engine/turns/runtime/runtime-resolver.js.map +1 -1
  39. package/dist/src/core/commands/slash/autocomplete.d.ts +9 -4
  40. package/dist/src/core/commands/slash/autocomplete.d.ts.map +1 -1
  41. package/dist/src/core/commands/slash/autocomplete.js +53 -48
  42. package/dist/src/core/commands/slash/autocomplete.js.map +1 -1
  43. package/dist/src/core/commands/slash/modules/auth/auth-commands.js +4 -4
  44. package/dist/src/core/commands/slash/modules/auth/auth-commands.js.map +1 -1
  45. package/dist/src/core/commands/slash/modules/compaction/compaction-commands.js +2 -2
  46. package/dist/src/core/commands/slash/modules/compaction/compaction-commands.js.map +1 -1
  47. package/dist/src/core/commands/slash/modules/drift/drift-commands.js +4 -4
  48. package/dist/src/core/commands/slash/modules/drift/drift-commands.js.map +1 -1
  49. package/dist/src/core/commands/slash/modules/heartbeat/heartbeat-commands.js +3 -3
  50. package/dist/src/core/commands/slash/modules/heartbeat/heartbeat-commands.js.map +1 -1
  51. package/dist/src/core/commands/slash/modules/model/model-commands.js +8 -8
  52. package/dist/src/core/commands/slash/modules/model/model-commands.js.map +1 -1
  53. package/dist/src/core/commands/slash/modules/session/session-commands.js +6 -6
  54. package/dist/src/core/commands/slash/modules/session/session-commands.js.map +1 -1
  55. package/dist/src/core/commands/slash/parser.d.ts +10 -5
  56. package/dist/src/core/commands/slash/parser.d.ts.map +1 -1
  57. package/dist/src/core/commands/slash/parser.js +42 -37
  58. package/dist/src/core/commands/slash/parser.js.map +1 -1
  59. package/dist/src/core/commands/slash/registry.d.ts +12 -3
  60. package/dist/src/core/commands/slash/registry.d.ts.map +1 -1
  61. package/dist/src/core/commands/slash/registry.js +50 -45
  62. package/dist/src/core/commands/slash/registry.js.map +1 -1
  63. package/dist/src/core/heartbeat/wake/service.d.ts.map +1 -1
  64. package/dist/src/core/heartbeat/wake/service.js +2 -3
  65. package/dist/src/core/heartbeat/wake/service.js.map +1 -1
  66. package/dist/src/core/memory/catalog.d.ts +22 -40
  67. package/dist/src/core/memory/catalog.d.ts.map +1 -1
  68. package/dist/src/core/memory/catalog.js +166 -155
  69. package/dist/src/core/memory/catalog.js.map +1 -1
  70. package/dist/src/core/memory/index.d.ts +14 -0
  71. package/dist/src/core/memory/index.d.ts.map +1 -0
  72. package/dist/src/core/memory/index.js +13 -0
  73. package/dist/src/core/memory/index.js.map +1 -0
  74. package/dist/src/core/memory/maintainer-prompt.d.ts +14 -0
  75. package/dist/src/core/memory/maintainer-prompt.d.ts.map +1 -0
  76. package/dist/src/core/memory/maintainer-prompt.js +58 -0
  77. package/dist/src/core/memory/maintainer-prompt.js.map +1 -0
  78. package/dist/src/core/memory/maintainer.d.ts +20 -44
  79. package/dist/src/core/memory/maintainer.d.ts.map +1 -1
  80. package/dist/src/core/memory/maintainer.js +124 -184
  81. package/dist/src/core/memory/maintainer.js.map +1 -1
  82. package/dist/src/core/memory/maintenance-integration.d.ts +22 -19
  83. package/dist/src/core/memory/maintenance-integration.d.ts.map +1 -1
  84. package/dist/src/core/memory/maintenance-integration.js +158 -163
  85. package/dist/src/core/memory/maintenance-integration.js.map +1 -1
  86. package/dist/src/core/memory/maintenance-repository.d.ts +27 -0
  87. package/dist/src/core/memory/maintenance-repository.d.ts.map +1 -0
  88. package/dist/src/core/memory/maintenance-repository.js +134 -0
  89. package/dist/src/core/memory/maintenance-repository.js.map +1 -0
  90. package/dist/src/core/memory/note-service.d.ts +23 -0
  91. package/dist/src/core/memory/note-service.d.ts.map +1 -0
  92. package/dist/src/core/memory/note-service.js +165 -0
  93. package/dist/src/core/memory/note-service.js.map +1 -0
  94. package/dist/src/core/memory/path-utils.d.ts +15 -0
  95. package/dist/src/core/memory/path-utils.d.ts.map +1 -0
  96. package/dist/src/core/memory/path-utils.js +31 -0
  97. package/dist/src/core/memory/path-utils.js.map +1 -0
  98. package/dist/src/core/memory/schemas.d.ts +116 -0
  99. package/dist/src/core/memory/schemas.d.ts.map +1 -0
  100. package/dist/src/core/memory/schemas.js +53 -0
  101. package/dist/src/core/memory/schemas.js.map +1 -0
  102. package/dist/src/core/memory/types.d.ts +149 -0
  103. package/dist/src/core/memory/types.d.ts.map +1 -0
  104. package/dist/src/core/memory/types.js +2 -0
  105. package/dist/src/core/memory/types.js.map +1 -0
  106. package/dist/src/core/memory/validation.d.ts +20 -38
  107. package/dist/src/core/memory/validation.d.ts.map +1 -1
  108. package/dist/src/core/memory/validation.js +98 -83
  109. package/dist/src/core/memory/validation.js.map +1 -1
  110. package/dist/src/core/memory/visibility.d.ts +19 -41
  111. package/dist/src/core/memory/visibility.d.ts.map +1 -1
  112. package/dist/src/core/memory/visibility.js +53 -153
  113. package/dist/src/core/memory/visibility.js.map +1 -1
  114. package/dist/src/core/review/index.d.ts +3 -0
  115. package/dist/src/core/review/index.d.ts.map +1 -0
  116. package/dist/src/core/review/index.js +2 -0
  117. package/dist/src/core/review/index.js.map +1 -0
  118. package/dist/src/core/review/service.d.ts +22 -0
  119. package/dist/src/core/review/service.d.ts.map +1 -0
  120. package/dist/src/core/review/service.js +143 -0
  121. package/dist/src/core/review/service.js.map +1 -0
  122. package/dist/src/core/review/{diff-domain.d.ts → types.d.ts} +1 -3
  123. package/dist/src/core/review/types.d.ts.map +1 -0
  124. package/dist/src/core/review/types.js +2 -0
  125. package/dist/src/core/review/types.js.map +1 -0
  126. package/dist/src/core/runtime/tools/service.js +2 -2
  127. package/dist/src/core/runtime/tools/service.js.map +1 -1
  128. package/dist/src/core/tools/execute-tool.d.ts +5 -4
  129. package/dist/src/core/tools/execute-tool.d.ts.map +1 -1
  130. package/dist/src/core/tools/execute-tool.js +23 -25
  131. package/dist/src/core/tools/execute-tool.js.map +1 -1
  132. package/dist/src/core/tools/index.d.ts +5 -0
  133. package/dist/src/core/tools/index.d.ts.map +1 -0
  134. package/dist/src/core/tools/index.js +4 -0
  135. package/dist/src/core/tools/index.js.map +1 -0
  136. package/dist/src/core/tools/registry.d.ts +8 -7
  137. package/dist/src/core/tools/registry.d.ts.map +1 -1
  138. package/dist/src/core/tools/registry.js +18 -21
  139. package/dist/src/core/tools/registry.js.map +1 -1
  140. package/dist/src/core/tools/toolkit.d.ts +9 -4
  141. package/dist/src/core/tools/toolkit.d.ts.map +1 -1
  142. package/dist/src/core/tools/toolkit.js +21 -16
  143. package/dist/src/core/tools/toolkit.js.map +1 -1
  144. package/dist/src/core/tools/toolkits/knowledge/memory-notes.d.ts +1 -1
  145. package/dist/src/core/tools/toolkits/knowledge/memory-notes.d.ts.map +1 -1
  146. package/dist/src/core/tools/toolkits/knowledge/memory-notes.js +48 -238
  147. package/dist/src/core/tools/toolkits/knowledge/memory-notes.js.map +1 -1
  148. package/dist/src/core/tools/toolkits/knowledge/record-knowledge.d.ts.map +1 -1
  149. package/dist/src/core/tools/toolkits/knowledge/record-knowledge.js +75 -105
  150. package/dist/src/core/tools/toolkits/knowledge/record-knowledge.js.map +1 -1
  151. package/dist/src/core/trace/format.d.ts +9 -3
  152. package/dist/src/core/trace/format.d.ts.map +1 -1
  153. package/dist/src/core/trace/format.js +106 -107
  154. package/dist/src/core/trace/format.js.map +1 -1
  155. package/dist/src/core/trace/index.d.ts +4 -0
  156. package/dist/src/core/trace/index.d.ts.map +1 -0
  157. package/dist/src/core/trace/index.js +3 -0
  158. package/dist/src/core/trace/index.js.map +1 -0
  159. package/dist/src/core/trace/recorder.d.ts +10 -7
  160. package/dist/src/core/trace/recorder.d.ts.map +1 -1
  161. package/dist/src/core/trace/recorder.js +15 -17
  162. package/dist/src/core/trace/recorder.js.map +1 -1
  163. package/dist/src/core/trace/types.d.ts +7 -0
  164. package/dist/src/core/trace/types.d.ts.map +1 -0
  165. package/dist/src/core/trace/types.js +2 -0
  166. package/dist/src/core/trace/types.js.map +1 -0
  167. package/dist/src/index.d.ts +15 -14
  168. package/dist/src/index.d.ts.map +1 -1
  169. package/dist/src/index.js +11 -8
  170. package/dist/src/index.js.map +1 -1
  171. package/dist/src/server/features/control-plane/controllers/ask.d.ts.map +1 -1
  172. package/dist/src/server/features/control-plane/controllers/ask.js +6 -7
  173. package/dist/src/server/features/control-plane/controllers/ask.js.map +1 -1
  174. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.js +3 -3
  175. package/dist/src/server/features/control-plane/controllers/chat-turn-review-presenter.js.map +1 -1
  176. package/dist/src/server/features/control-plane/controllers/memory.d.ts +2 -1
  177. package/dist/src/server/features/control-plane/controllers/memory.d.ts.map +1 -1
  178. package/dist/src/server/features/control-plane/controllers/memory.js +8 -7
  179. package/dist/src/server/features/control-plane/controllers/memory.js.map +1 -1
  180. package/dist/src/server/features/control-plane/controllers/workspace-diff.js +2 -2
  181. package/dist/src/server/features/control-plane/controllers/workspace-diff.js.map +1 -1
  182. package/dist/src/server/features/control-plane/router.d.ts +1 -1
  183. package/dist/src/server/features/control-plane/types.d.ts +2 -2
  184. package/dist/src/server/features/control-plane/types.d.ts.map +1 -1
  185. package/dist/src/server/router.d.ts +1 -1
  186. package/package.json +11 -4
  187. package/dist/src/core/review/diff-domain.d.ts.map +0 -1
  188. package/dist/src/core/review/diff-domain.js +0 -134
  189. package/dist/src/core/review/diff-domain.js.map +0 -1
  190. package/dist/src/core/utils/budget.d.ts +0 -13
  191. package/dist/src/core/utils/budget.d.ts.map +0 -1
  192. package/dist/src/core/utils/budget.js +0 -22
  193. package/dist/src/core/utils/budget.js.map +0 -1
@@ -49,25 +49,91 @@ export const DEFAULT_MEMORY_CATEGORIES = [
49
49
  readWhen: 'Use when current behavior has historical causes or the task resembles a past incident or decision.',
50
50
  },
51
51
  ];
52
- export function bootstrapMemoryWorkspace(options) {
53
- const memoryRoot = resolve(options.memoryRoot);
54
- const createdPaths = [];
55
- mkdirSync(memoryRoot, { recursive: true });
56
- writeIfMissing(join(memoryRoot, 'README.md'), createRootCatalogTemplate(), createdPaths, memoryRoot);
57
- for (const category of DEFAULT_MEMORY_CATEGORIES) {
58
- const categoryRoot = join(memoryRoot, category.path);
59
- mkdirSync(categoryRoot, { recursive: true });
60
- writeIfMissing(join(categoryRoot, 'README.md'), createFolderCatalogTemplate(category), createdPaths, memoryRoot);
52
+ /**
53
+ * Owns the cataloged memory workspace shape and the startup memory context.
54
+ */
55
+ export class MemoryCatalogService {
56
+ memoryRoot;
57
+ constructor(memoryRoot) {
58
+ this.memoryRoot = memoryRoot;
61
59
  }
62
- mkdirSync(join(memoryRoot, '_maintenance'), { recursive: true });
63
- writeIfMissing(join(memoryRoot, '_maintenance', 'runs.jsonl'), '', createdPaths, memoryRoot);
64
- return { memoryRoot, createdPaths };
65
- }
66
- export function loadMemoryRootCatalog(options) {
67
- const memoryRoot = resolve(options.memoryRoot);
68
- const maxBytes = options.maxBytes ?? DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES;
69
- const catalogPath = join(memoryRoot, 'README.md');
70
- if (!existsSync(catalogPath)) {
60
+ bootstrap() {
61
+ const memoryRoot = this.resolveRoot();
62
+ const createdPaths = [];
63
+ mkdirSync(memoryRoot, { recursive: true });
64
+ MemoryCatalogService.writeIfMissing(join(memoryRoot, 'README.md'), MemoryCatalogService.createRootCatalogTemplate(), createdPaths, memoryRoot);
65
+ for (const category of DEFAULT_MEMORY_CATEGORIES) {
66
+ const categoryRoot = join(memoryRoot, category.path);
67
+ mkdirSync(categoryRoot, { recursive: true });
68
+ MemoryCatalogService.writeIfMissing(join(categoryRoot, 'README.md'), MemoryCatalogService.createFolderCatalogTemplate(category), createdPaths, memoryRoot);
69
+ }
70
+ mkdirSync(join(memoryRoot, '_maintenance'), { recursive: true });
71
+ MemoryCatalogService.writeIfMissing(join(memoryRoot, '_maintenance', 'runs.jsonl'), '', createdPaths, memoryRoot);
72
+ return { memoryRoot, createdPaths };
73
+ }
74
+ loadRootCatalog(maxBytes = DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES) {
75
+ const memoryRoot = this.resolveRoot();
76
+ const catalogPath = join(memoryRoot, 'README.md');
77
+ if (!existsSync(catalogPath)) {
78
+ return MemoryCatalogService.missingRootCatalog(memoryRoot, catalogPath, maxBytes);
79
+ }
80
+ const original = readFileSync(catalogPath, 'utf8').trim();
81
+ const originalBytes = Buffer.byteLength(original, 'utf8');
82
+ const truncatedContent = MemoryCatalogService.truncateUtf8(original, maxBytes);
83
+ const truncated = originalBytes > Buffer.byteLength(truncatedContent, 'utf8');
84
+ const content = truncated ?
85
+ [
86
+ truncatedContent,
87
+ '',
88
+ `[Memory catalog truncated to ${maxBytes} bytes from ${originalBytes} bytes. Use read_memory_note on README.md for the full catalog.]`,
89
+ ].join('\n')
90
+ : original;
91
+ return {
92
+ memoryRoot,
93
+ catalogPath,
94
+ exists: true,
95
+ content,
96
+ truncated,
97
+ originalBytes,
98
+ maxBytes,
99
+ };
100
+ }
101
+ formatCatalogSystemContext(catalog) {
102
+ const header = catalog.exists ? '## Workspace Memory Catalog' : '## Workspace Memory Catalog Missing';
103
+ return [
104
+ header,
105
+ '',
106
+ `Source: ${catalog.catalogPath}`,
107
+ '',
108
+ catalog.content,
109
+ '',
110
+ 'Startup memory policy: this is the only memory document loaded automatically. Use memory tools to read relevant folder catalogs or notes before relying on deeper memory.',
111
+ ].join('\n');
112
+ }
113
+ appendCatalogSystemContext(options) {
114
+ const catalog = this.loadRootCatalog(options.maxBytes);
115
+ const memoryContext = this.formatCatalogSystemContext(catalog);
116
+ const domainContext = buildMemoryDomainSystemContext();
117
+ const context = `${domainContext}\n\n${memoryContext}`;
118
+ return options.systemContext ? `${context}\n\n${options.systemContext}` : context;
119
+ }
120
+ validateShape() {
121
+ const memoryRoot = this.resolveRoot();
122
+ const requiredPaths = [
123
+ 'README.md',
124
+ ...DEFAULT_MEMORY_CATEGORIES.map((category) => join(category.path, 'README.md')),
125
+ ];
126
+ const missing = requiredPaths.filter((relativePath) => !existsSync(join(memoryRoot, relativePath)));
127
+ return {
128
+ ok: missing.length === 0,
129
+ memoryRoot,
130
+ missing,
131
+ };
132
+ }
133
+ resolveRoot() {
134
+ return resolve(this.memoryRoot);
135
+ }
136
+ static missingRootCatalog(memoryRoot, catalogPath, maxBytes) {
71
137
  const content = [
72
138
  'No workspace memory catalog exists yet.',
73
139
  '',
@@ -86,145 +152,90 @@ export function loadMemoryRootCatalog(options) {
86
152
  maxBytes,
87
153
  };
88
154
  }
89
- const original = readFileSync(catalogPath, 'utf8').trim();
90
- const originalBytes = Buffer.byteLength(original, 'utf8');
91
- const truncatedContent = truncateUtf8(original, maxBytes);
92
- const truncated = originalBytes > Buffer.byteLength(truncatedContent, 'utf8');
93
- const content = truncated ?
94
- [
95
- truncatedContent,
96
- '',
97
- `[Memory catalog truncated to ${maxBytes} bytes from ${originalBytes} bytes. Use read_memory_note on README.md for the full catalog.]`,
98
- ].join('\n')
99
- : original;
100
- return {
101
- memoryRoot,
102
- catalogPath,
103
- exists: true,
104
- content,
105
- truncated,
106
- originalBytes,
107
- maxBytes,
108
- };
109
- }
110
- export function formatMemoryCatalogSystemContext(catalog) {
111
- const header = catalog.exists ? '## Workspace Memory Catalog' : '## Workspace Memory Catalog Missing';
112
- return [
113
- header,
114
- '',
115
- `Source: ${catalog.catalogPath}`,
116
- '',
117
- catalog.content,
118
- '',
119
- 'Startup memory policy: this is the only memory document loaded automatically. Use memory tools to read relevant folder catalogs or notes before relying on deeper memory.',
120
- ].join('\n');
121
- }
122
- export function appendMemoryCatalogSystemContext(options) {
123
- const catalog = loadMemoryRootCatalog({ memoryRoot: options.memoryRoot, maxBytes: options.maxBytes });
124
- const memoryContext = formatMemoryCatalogSystemContext(catalog);
125
- const domainContext = buildMemoryDomainSystemContext();
126
- const context = `${domainContext}\n\n${memoryContext}`;
127
- return options.systemContext ? `${context}\n\n${options.systemContext}` : context;
128
- }
129
- export function validateMemoryCatalogShape(options) {
130
- const memoryRoot = resolve(options.memoryRoot);
131
- const requiredPaths = [
132
- 'README.md',
133
- ...DEFAULT_MEMORY_CATEGORIES.map((category) => join(category.path, 'README.md')),
134
- ];
135
- const missing = requiredPaths.filter((relativePath) => !existsSync(join(memoryRoot, relativePath)));
136
- return {
137
- ok: missing.length === 0,
138
- memoryRoot,
139
- missing,
140
- };
141
- }
142
- function writeIfMissing(path, content, createdPaths, memoryRoot) {
143
- if (existsSync(path)) {
144
- return;
155
+ static writeIfMissing(path, content, createdPaths, memoryRoot) {
156
+ if (existsSync(path)) {
157
+ return;
158
+ }
159
+ mkdirSync(dirname(path), { recursive: true });
160
+ writeFileSync(path, content, 'utf8');
161
+ createdPaths.push(path.slice(memoryRoot.length).replace(/^\/+/, '') || '.');
145
162
  }
146
- mkdirSync(dirname(path), { recursive: true });
147
- writeFileSync(path, content, 'utf8');
148
- createdPaths.push(toMemoryRelativePath(memoryRoot, path));
149
- }
150
- function createRootCatalogTemplate() {
151
- return [
152
- '# Workspace Memory',
153
- '',
154
- 'Purpose: durable workspace knowledge that helps future agents become operational quickly.',
155
- '',
156
- '## Authority And Freshness',
157
- '',
158
- '- Live workspace evidence wins over memory when they disagree.',
159
- '- Current-state notes with recent verification are stronger than older focused notes.',
160
- '- Historical notes explain decisions and incidents but may be stale.',
161
- '- Important stale, disputed, or superseded facts should be marked rather than silently removed.',
162
- '',
163
- '## Fast Reading Path',
164
- '',
165
- '- New non-trivial task: read `current-state/README.md`, then the category that matches the task.',
166
- '- Coding or architecture task: read `domain/README.md`, `operations/README.md`, and relevant preferences.',
167
- '- Workflow, release, PR, or incident task: read `workflows/README.md`, `operations/README.md`, and relevant history.',
168
- '- Coordination-heavy task: read `relationships/README.md`.',
169
- '',
170
- '## Category Index',
171
- '',
172
- ...DEFAULT_MEMORY_CATEGORIES.map((category) => `- [${category.title}](${category.path}/README.md): ${category.purpose}`),
173
- '',
174
- '## High-Value Notes',
175
- '',
176
- '- Add links here when notes become important enough for every fresh agent to notice.',
177
- '',
178
- '## Stale Or Disputed Notes',
179
- '',
180
- '- Add links here when a note should be treated with caution.',
181
- '',
182
- '## Maintenance Instructions',
183
- '',
184
- '- Keep this catalog short and navigable.',
185
- '- Every folder that contains memory notes needs its own `README.md` catalog.',
186
- '- Every durable note should be discoverable through this catalog or a folder catalog.',
187
- '- Prefer updating existing notes over scattering small one-off notes.',
188
- '- Do not store secrets.',
189
- '',
190
- ].join('\n');
191
- }
192
- function createFolderCatalogTemplate(category) {
193
- return [
194
- `# ${category.title}`,
195
- '',
196
- `Purpose: ${category.purpose}`,
197
- '',
198
- `When to read: ${category.readWhen}`,
199
- '',
200
- '## Notes Index',
201
- '',
202
- '- Add note links here as this folder grows.',
203
- '',
204
- '## Related Folders',
205
- '',
206
- '- `../README.md`: root memory catalog.',
207
- '',
208
- '## Maintenance Rules',
209
- '',
210
- '- Keep this catalog short enough to scan quickly.',
211
- '- Add notes only when they preserve durable context for future work.',
212
- '- Update this catalog whenever adding, renaming, or retiring notes in this folder.',
213
- '- Mark stale, disputed, or superseded knowledge explicitly.',
214
- '',
215
- ].join('\n');
216
- }
217
- function truncateUtf8(value, maxBytes) {
218
- if (maxBytes <= 0) {
219
- return '';
163
+ static createRootCatalogTemplate() {
164
+ return [
165
+ '# Workspace Memory',
166
+ '',
167
+ 'Purpose: durable workspace knowledge that helps future agents become operational quickly.',
168
+ '',
169
+ '## Authority And Freshness',
170
+ '',
171
+ '- Live workspace evidence wins over memory when they disagree.',
172
+ '- Current-state notes with recent verification are stronger than older focused notes.',
173
+ '- Historical notes explain decisions and incidents but may be stale.',
174
+ '- Important stale, disputed, or superseded facts should be marked rather than silently removed.',
175
+ '',
176
+ '## Fast Reading Path',
177
+ '',
178
+ '- New non-trivial task: read `current-state/README.md`, then the category that matches the task.',
179
+ '- Coding or architecture task: read `domain/README.md`, `operations/README.md`, and relevant preferences.',
180
+ '- Workflow, release, PR, or incident task: read `workflows/README.md`, `operations/README.md`, and relevant history.',
181
+ '- Coordination-heavy task: read `relationships/README.md`.',
182
+ '',
183
+ '## Category Index',
184
+ '',
185
+ ...DEFAULT_MEMORY_CATEGORIES.map((category) => `- [${category.title}](${category.path}/README.md): ${category.purpose}`),
186
+ '',
187
+ '## High-Value Notes',
188
+ '',
189
+ '- Add links here when notes become important enough for every fresh agent to notice.',
190
+ '',
191
+ '## Stale Or Disputed Notes',
192
+ '',
193
+ '- Add links here when a note should be treated with caution.',
194
+ '',
195
+ '## Maintenance Instructions',
196
+ '',
197
+ '- Keep this catalog short and navigable.',
198
+ '- Every folder that contains memory notes needs its own `README.md` catalog.',
199
+ '- Every durable note should be discoverable through this catalog or a folder catalog.',
200
+ '- Prefer updating existing notes over scattering small one-off notes.',
201
+ '- Do not store secrets.',
202
+ '',
203
+ ].join('\n');
220
204
  }
221
- const bytes = Buffer.from(value, 'utf8');
222
- if (bytes.length <= maxBytes) {
223
- return value;
205
+ static createFolderCatalogTemplate(category) {
206
+ return [
207
+ `# ${category.title}`,
208
+ '',
209
+ `Purpose: ${category.purpose}`,
210
+ '',
211
+ `When to read: ${category.readWhen}`,
212
+ '',
213
+ '## Notes Index',
214
+ '',
215
+ '- Add note links here as this folder grows.',
216
+ '',
217
+ '## Related Folders',
218
+ '',
219
+ '- `../README.md`: root memory catalog.',
220
+ '',
221
+ '## Maintenance Rules',
222
+ '',
223
+ '- Keep this catalog short enough to scan quickly.',
224
+ '- Add notes only when they preserve durable context for future work.',
225
+ '- Update this catalog whenever adding, renaming, or retiring a note in this folder.',
226
+ '- Mark stale, disputed, or superseded knowledge explicitly.',
227
+ '',
228
+ ].join('\n');
229
+ }
230
+ static truncateUtf8(value, maxBytes) {
231
+ if (maxBytes <= 0) {
232
+ return '';
233
+ }
234
+ const bytes = Buffer.from(value, 'utf8');
235
+ if (bytes.length <= maxBytes) {
236
+ return value;
237
+ }
238
+ return bytes.subarray(0, maxBytes).toString('utf8').replace(/\uFFFD+$/u, '').trimEnd();
224
239
  }
225
- return bytes.subarray(0, maxBytes).toString('utf8').replace(/\uFFFD+$/u, '').trimEnd();
226
- }
227
- function toMemoryRelativePath(memoryRoot, path) {
228
- return path.slice(memoryRoot.length).replace(/^\/+/, '') || '.';
229
240
  }
230
241
  //# sourceMappingURL=catalog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../../src/core/memory/catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AAEpE,MAAM,CAAC,MAAM,qCAAqC,GAAG,EAAE,GAAG,IAAI,CAAC;AAC/D,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,GAAG,IAAI,CAAC;AACjE,MAAM,CAAC,MAAM,uCAAuC,GAAG,CAAC,GAAG,IAAI,CAAC;AAChE,MAAM,CAAC,MAAM,0CAA0C,GAAG,CAAC,GAAG,IAAI,CAAC;AA8BnE,MAAM,CAAC,MAAM,yBAAyB,GAAqB;IACzD;QACE,IAAI,EAAE,eAAe;QACrB,KAAK,EAAE,eAAe;QACtB,OAAO,EAAE,mFAAmF;QAC5F,QAAQ,EAAE,8EAA8E;KACzF;IACD;QACE,IAAI,EAAE,WAAW;QACjB,KAAK,EAAE,WAAW;QAClB,OAAO,EAAE,uFAAuF;QAChG,QAAQ,EAAE,4FAA4F;KACvG;IACD;QACE,IAAI,EAAE,aAAa;QACnB,KAAK,EAAE,aAAa;QACpB,OAAO,EAAE,4GAA4G;QACrH,QAAQ,EAAE,mFAAmF;KAC9F;IACD;QACE,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,QAAQ;Q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, DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES, DEFAULT_MEMORY_ROOT_CATALOG_TARGET_BYTES, MemoryCatalogService, } from './catalog.js';
2
+ export { buildMemoryDomainSystemContext } from './domain-prompt.js';
3
+ export { MemoryMaintenanceRepository } from './maintenance-repository.js';
4
+ export { MemoryMaintainerPrompt } from './maintainer-prompt.js';
5
+ export { MemoryMaintenanceService } from './maintainer.js';
6
+ export { MemoryMaintenanceIntegrationService } from './maintenance-integration.js';
7
+ export { createMemoryMaintainerTools } from './maintainer-tools.js';
8
+ export { MemoryNoteService } from './note-service.js';
9
+ export { MemorySchemas } from './schemas.js';
10
+ export { createMemoryNoteTemplate, slugifyMemoryTitle } from './templates.js';
11
+ export { MemoryValidationService } from './validation.js';
12
+ export { MemoryVisibilityService } from './visibility.js';
13
+ export type { BootstrapMemoryWorkspaceResult, KnowledgeCandidate, KnowledgeCandidateStatusRecord, KnowledgeMaintenanceRunRecord, ListMemoryNotesInput, MemoryCatalogLoadResult, MemoryCatalogShapeValidation, MemoryCategory, MemoryMaintenanceLockRecord, MemoryStatusView, MemoryValidationIssue, MemoryValidationResult, ReadMemoryNoteInput, RunKnowledgeMaintenanceOptions, RunKnowledgeMaintenanceResult, RunMaintenanceForRecordedCandidatesOptions, RunMaintenanceForRecordedCandidatesResult, SearchMemoryNotesInput, } from './types.js';
14
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uCAAuC,EACvC,0CAA0C,EAC1C,qCAAqC,EACrC,wCAAwC,EACxC,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,mCAAmC,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,YAAY,EACV,8BAA8B,EAC9B,kBAAkB,EAClB,8BAA8B,EAC9B,6BAA6B,EAC7B,oBAAoB,EACpB,uBAAuB,EACvB,4BAA4B,EAC5B,cAAc,EACd,2BAA2B,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,sBAAsB,EACtB,mBAAmB,EACnB,8BAA8B,EAC9B,6BAA6B,EAC7B,0CAA0C,EAC1C,yCAAyC,EACzC,sBAAsB,GACvB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ export { DEFAULT_MEMORY_CATEGORIES, DEFAULT_MEMORY_FOLDER_CATALOG_MAX_BYTES, DEFAULT_MEMORY_FOLDER_CATALOG_TARGET_BYTES, DEFAULT_MEMORY_ROOT_CATALOG_MAX_BYTES, DEFAULT_MEMORY_ROOT_CATALOG_TARGET_BYTES, MemoryCatalogService, } from './catalog.js';
2
+ export { buildMemoryDomainSystemContext } from './domain-prompt.js';
3
+ export { MemoryMaintenanceRepository } from './maintenance-repository.js';
4
+ export { MemoryMaintainerPrompt } from './maintainer-prompt.js';
5
+ export { MemoryMaintenanceService } from './maintainer.js';
6
+ export { MemoryMaintenanceIntegrationService } from './maintenance-integration.js';
7
+ export { createMemoryMaintainerTools } from './maintainer-tools.js';
8
+ export { MemoryNoteService } from './note-service.js';
9
+ export { MemorySchemas } from './schemas.js';
10
+ export { createMemoryNoteTemplate, slugifyMemoryTitle } from './templates.js';
11
+ export { MemoryValidationService } from './validation.js';
12
+ export { MemoryVisibilityService } from './visibility.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/memory/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,uCAAuC,EACvC,0CAA0C,EAC1C,qCAAqC,EACrC,wCAAwC,EACxC,oBAAoB,GACrB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,8BAA8B,EAAE,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,mCAAmC,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { KnowledgeCandidate } from './types.js';
2
+ /**
3
+ * Owns the memory maintainer prompt text.
4
+ *
5
+ * Keep static instructions before dynamic catalog/candidate content so model
6
+ * providers can reuse token cache across maintenance runs.
7
+ */
8
+ export declare class MemoryMaintainerPrompt {
9
+ private static readonly staticSystemContext;
10
+ static buildSystemContext(rootCatalog: string): string;
11
+ static buildMaintenanceGoal(observations: KnowledgeCandidate[]): string;
12
+ private static formatCandidates;
13
+ }
14
+ //# sourceMappingURL=maintainer-prompt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maintainer-prompt.d.ts","sourceRoot":"","sources":["../../../../src/core/memory/maintainer-prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;GAKG;AACH,qBAAa,sBAAsB;IACjC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,mBAAmB,CAcgC;IAE3E,MAAM,CAAC,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IAQtD,MAAM,CAAC,oBAAoB,CAAC,YAAY,EAAE,kBAAkB,EAAE,GAAG,MAAM;IAUvE,OAAO,CAAC,MAAM,CAAC,gBAAgB;CAmBhC"}
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Owns the memory maintainer prompt text.
3
+ *
4
+ * Keep static instructions before dynamic catalog/candidate content so model
5
+ * providers can reuse token cache across maintenance runs.
6
+ */
7
+ export class MemoryMaintainerPrompt {
8
+ static staticSystemContext = `## Memory Maintainer Mode
9
+
10
+ You maintain Heddle workspace memory. You are not doing general coding work.
11
+ Use only memory tools. Do not ask for shell, code edit, web, or external tools.
12
+
13
+ ### Hard Invariants
14
+
15
+ - Every durable note must be discoverable through the root catalog or a folder catalog.
16
+ - Read the root catalog first, then read the relevant folder catalog before writing.
17
+ - Search existing notes before creating a new note.
18
+ - Prefer updating existing notes over creating duplicates.
19
+ - Update folder catalogs whenever you create, rename, or retire a note.
20
+ - Update the root catalog only when a new high-value note or discovery path matters globally.
21
+ - Do not store secrets, credentials, private keys, tokens, or passwords.
22
+ - Skip low-value, duplicate, speculative, or one-turn scratch observations.`;
23
+ static buildSystemContext(rootCatalog) {
24
+ return `${MemoryMaintainerPrompt.staticSystemContext}
25
+
26
+ ## Loaded Root Catalog
27
+
28
+ ${rootCatalog}`;
29
+ }
30
+ static buildMaintenanceGoal(observations) {
31
+ return `# Memory Maintenance Task
32
+
33
+ Process these pending memory candidates into maintained cataloged memory.
34
+
35
+ ${MemoryMaintainerPrompt.formatCandidates(observations)}
36
+
37
+ End with a concise summary of what memory notes or catalogs changed, or why candidates were skipped.`;
38
+ }
39
+ static formatCandidates(observations) {
40
+ return observations
41
+ .map((candidate, index) => {
42
+ const evidence = candidate.evidence?.length
43
+ ? `\n\n### Evidence\n\n${candidate.evidence.map((item) => `- ${item}`).join('\n')}`
44
+ : '';
45
+ const sourceRefs = candidate.sourceRefs?.length
46
+ ? `\n\n### Source Refs\n\n${candidate.sourceRefs.map((ref) => `- ${ref}`).join('\n')}`
47
+ : '';
48
+ const categoryHint = candidate.categoryHint ? `\n- Category hint: ${candidate.categoryHint}` : '';
49
+ const importance = candidate.importance ? `\n- Importance: ${candidate.importance}` : '';
50
+ const confidence = candidate.confidence ? `\n- Confidence: ${candidate.confidence}` : '';
51
+ return `## Candidate ${index + 1}: ${candidate.id}
52
+
53
+ - Summary: ${candidate.summary}${categoryHint}${importance}${confidence}${evidence}${sourceRefs}`;
54
+ })
55
+ .join('\n\n');
56
+ }
57
+ }
58
+ //# sourceMappingURL=maintainer-prompt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"maintainer-prompt.js","sourceRoot":"","sources":["../../../../src/core/memory/maintainer-prompt.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,OAAO,sBAAsB;IACzB,MAAM,CAAU,mBAAmB,GAAG;;;;;;;;;;;;;;4EAc4B,CAAC;IAE3E,MAAM,CAAC,kBAAkB,CAAC,WAAmB;QAC3C,OAAO,GAAG,sBAAsB,CAAC,mBAAmB;;;;EAItD,WAAW,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,YAAkC;QAC5D,OAAO;;;;EAIT,sBAAsB,CAAC,gBAAgB,CAAC,YAAY,CAAC;;qGAE8C,CAAC;IACpG,CAAC;IA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m/types.js';
2
- import type { RunResult } from '../types.js';
3
- export type KnowledgeCandidate = {
4
- id: string;
5
- recordedAt: string;
6
- status: 'pending';
7
- summary: string;
8
- evidence?: string[];
9
- categoryHint?: string;
10
- importance?: 'low' | 'medium' | 'high';
11
- confidence?: 'user-stated' | 'tool-verified' | 'inferred' | 'historical';
12
- sourceRefs?: string[];
13
- };
14
- export type KnowledgeMaintenanceRunRecord = {
15
- id: string;
16
- startedAt: string;
17
- finishedAt: string;
18
- source: string;
19
- outcome: RunResult['outcome'] | 'skipped';
20
- summary: string;
21
- candidateIds: string[];
22
- processedCandidateIds: string[];
23
- failedCandidateIds: string[];
24
- catalogValid: boolean;
25
- catalogMissing: string[];
26
- };
27
- export type RunKnowledgeMaintenanceOptions = {
28
- memoryRoot: string;
29
- observations: KnowledgeCandidate[];
30
- llm: LlmAdapter;
31
- source: string;
32
- maxSteps?: number;
33
- now?: () => Date;
34
- nextRunId?: () => string;
35
- };
36
- export type RunKnowledgeMaintenanceResult = {
37
- run: KnowledgeMaintenanceRunRecord;
38
- result?: RunResult;
39
- };
40
- export declare function readPendingKnowledgeCandidates(options: {
41
- memoryRoot: string;
42
- }): Promise<KnowledgeCandidate[]>;
43
- export declare function runKnowledgeMaintenance(options: RunKnowledgeMaintenanceOptions): Promise<RunKnowledgeMaintenanceResult>;
44
- export declare function runKnowledgeMaintenanceForBacklog(options: Omit<RunKnowledgeMaintenanceOptions, 'observations'>): Promise<RunKnowledgeMaintenanceResult>;
1
+ import { MemoryCatalogService } from './catalog.js';
2
+ import { MemoryMaintenanceRepository } from './maintenance-repository.js';
3
+ import type { KnowledgeCandidate, RunKnowledgeMaintenanceOptions, RunKnowledgeMaintenanceResult } from './types.js';
4
+ /**
5
+ * Owns the agent-backed memory maintenance workflow over pending candidates.
6
+ */
7
+ export declare class MemoryMaintenanceService {
8
+ private readonly memoryRoot;
9
+ private readonly repository;
10
+ private readonly catalog;
11
+ constructor(memoryRoot: string, repository?: MemoryMaintenanceRepository, catalog?: MemoryCatalogService);
12
+ readPendingCandidates(): Promise<KnowledgeCandidate[]>;
13
+ run(options: Omit<RunKnowledgeMaintenanceOptions, 'memoryRoot'>): Promise<RunKnowledgeMaintenanceResult>;
14
+ runBacklog(options: Omit<RunKnowledgeMaintenanceOptions, 'memoryRoot' | 'observations'>): Promise<RunKnowledgeMaintenanceResult>;
15
+ static isRecordableCandidateText(value: string): boolean;
16
+ static isSafeSourceRef(value: string, memoryRoot: string): boolean;
17
+ private static skippedRun;
18
+ private static isMaintainerCandidateAllowed;
19
+ private static containsSecretLikeText;
20
+ }
45
21
  //# sourceMappingURL=maintainer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"maintainer.d.ts","sourceRoot":"","sources":["../../../../src/core/memory/maintainer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,UAAU,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IACvC,UAAU,CAAC,EAAE,aAAa,GAAG,eAAe,GAAG,UAAU,GAAG,YAAY,CAAC;IACzE,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,SAAS,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC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