agent-recall-core 3.3.4

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 (165) hide show
  1. package/dist/helpers/journal-files.d.ts +30 -0
  2. package/dist/helpers/journal-files.d.ts.map +1 -0
  3. package/dist/helpers/journal-files.js +96 -0
  4. package/dist/helpers/journal-files.js.map +1 -0
  5. package/dist/helpers/rollup.d.ts +35 -0
  6. package/dist/helpers/rollup.d.ts.map +1 -0
  7. package/dist/helpers/rollup.js +78 -0
  8. package/dist/helpers/rollup.js.map +1 -0
  9. package/dist/helpers/sections.d.ts +12 -0
  10. package/dist/helpers/sections.d.ts.map +1 -0
  11. package/dist/helpers/sections.js +84 -0
  12. package/dist/helpers/sections.js.map +1 -0
  13. package/dist/index.d.ts +52 -0
  14. package/dist/index.d.ts.map +1 -0
  15. package/dist/index.js +63 -0
  16. package/dist/index.js.map +1 -0
  17. package/dist/palace/awareness.d.ts +67 -0
  18. package/dist/palace/awareness.d.ts.map +1 -0
  19. package/dist/palace/awareness.js +231 -0
  20. package/dist/palace/awareness.js.map +1 -0
  21. package/dist/palace/consolidate.d.ts +28 -0
  22. package/dist/palace/consolidate.d.ts.map +1 -0
  23. package/dist/palace/consolidate.js +129 -0
  24. package/dist/palace/consolidate.js.map +1 -0
  25. package/dist/palace/fan-out.d.ts +15 -0
  26. package/dist/palace/fan-out.d.ts.map +1 -0
  27. package/dist/palace/fan-out.js +78 -0
  28. package/dist/palace/fan-out.js.map +1 -0
  29. package/dist/palace/graph.d.ts +11 -0
  30. package/dist/palace/graph.d.ts.map +1 -0
  31. package/dist/palace/graph.js +59 -0
  32. package/dist/palace/graph.js.map +1 -0
  33. package/dist/palace/identity.d.ts +6 -0
  34. package/dist/palace/identity.d.ts.map +1 -0
  35. package/dist/palace/identity.js +18 -0
  36. package/dist/palace/identity.js.map +1 -0
  37. package/dist/palace/index-manager.d.ts +7 -0
  38. package/dist/palace/index-manager.d.ts.map +1 -0
  39. package/dist/palace/index-manager.js +46 -0
  40. package/dist/palace/index-manager.js.map +1 -0
  41. package/dist/palace/insights-index.d.ts +39 -0
  42. package/dist/palace/insights-index.d.ts.map +1 -0
  43. package/dist/palace/insights-index.js +101 -0
  44. package/dist/palace/insights-index.js.map +1 -0
  45. package/dist/palace/log.d.ts +9 -0
  46. package/dist/palace/log.d.ts.map +1 -0
  47. package/dist/palace/log.js +28 -0
  48. package/dist/palace/log.js.map +1 -0
  49. package/dist/palace/obsidian.d.ts +12 -0
  50. package/dist/palace/obsidian.d.ts.map +1 -0
  51. package/dist/palace/obsidian.js +76 -0
  52. package/dist/palace/obsidian.js.map +1 -0
  53. package/dist/palace/rooms.d.ts +14 -0
  54. package/dist/palace/rooms.d.ts.map +1 -0
  55. package/dist/palace/rooms.js +117 -0
  56. package/dist/palace/rooms.js.map +1 -0
  57. package/dist/palace/salience.d.ts +15 -0
  58. package/dist/palace/salience.d.ts.map +1 -0
  59. package/dist/palace/salience.js +33 -0
  60. package/dist/palace/salience.js.map +1 -0
  61. package/dist/storage/fs-utils.d.ts +8 -0
  62. package/dist/storage/fs-utils.d.ts.map +1 -0
  63. package/dist/storage/fs-utils.js +28 -0
  64. package/dist/storage/fs-utils.js.map +1 -0
  65. package/dist/storage/paths.d.ts +21 -0
  66. package/dist/storage/paths.d.ts.map +1 -0
  67. package/dist/storage/paths.js +71 -0
  68. package/dist/storage/paths.js.map +1 -0
  69. package/dist/storage/project.d.ts +17 -0
  70. package/dist/storage/project.d.ts.map +1 -0
  71. package/dist/storage/project.js +131 -0
  72. package/dist/storage/project.js.map +1 -0
  73. package/dist/tools-logic/alignment-check.d.ts +19 -0
  74. package/dist/tools-logic/alignment-check.d.ts.map +1 -0
  75. package/dist/tools-logic/alignment-check.js +54 -0
  76. package/dist/tools-logic/alignment-check.js.map +1 -0
  77. package/dist/tools-logic/awareness-update.d.ts +23 -0
  78. package/dist/tools-logic/awareness-update.d.ts.map +1 -0
  79. package/dist/tools-logic/awareness-update.js +47 -0
  80. package/dist/tools-logic/awareness-update.js.map +1 -0
  81. package/dist/tools-logic/context-synthesize.d.ts +17 -0
  82. package/dist/tools-logic/context-synthesize.d.ts.map +1 -0
  83. package/dist/tools-logic/context-synthesize.js +174 -0
  84. package/dist/tools-logic/context-synthesize.js.map +1 -0
  85. package/dist/tools-logic/journal-archive.d.ts +11 -0
  86. package/dist/tools-logic/journal-archive.d.ts.map +1 -0
  87. package/dist/tools-logic/journal-archive.js +47 -0
  88. package/dist/tools-logic/journal-archive.js.map +1 -0
  89. package/dist/tools-logic/journal-capture.d.ts +16 -0
  90. package/dist/tools-logic/journal-capture.d.ts.map +1 -0
  91. package/dist/tools-logic/journal-capture.js +57 -0
  92. package/dist/tools-logic/journal-capture.js.map +1 -0
  93. package/dist/tools-logic/journal-cold-start.d.ts +37 -0
  94. package/dist/tools-logic/journal-cold-start.d.ts.map +1 -0
  95. package/dist/tools-logic/journal-cold-start.js +78 -0
  96. package/dist/tools-logic/journal-cold-start.js.map +1 -0
  97. package/dist/tools-logic/journal-list.d.ts +14 -0
  98. package/dist/tools-logic/journal-list.d.ts.map +1 -0
  99. package/dist/tools-logic/journal-list.js +18 -0
  100. package/dist/tools-logic/journal-list.js.map +1 -0
  101. package/dist/tools-logic/journal-projects.d.ts +10 -0
  102. package/dist/tools-logic/journal-projects.d.ts.map +1 -0
  103. package/dist/tools-logic/journal-projects.js +10 -0
  104. package/dist/tools-logic/journal-projects.js.map +1 -0
  105. package/dist/tools-logic/journal-read.d.ts +13 -0
  106. package/dist/tools-logic/journal-read.d.ts.map +1 -0
  107. package/dist/tools-logic/journal-read.js +22 -0
  108. package/dist/tools-logic/journal-read.js.map +1 -0
  109. package/dist/tools-logic/journal-rollup.d.ts +16 -0
  110. package/dist/tools-logic/journal-rollup.d.ts.map +1 -0
  111. package/dist/tools-logic/journal-rollup.js +79 -0
  112. package/dist/tools-logic/journal-rollup.js.map +1 -0
  113. package/dist/tools-logic/journal-search.d.ts +16 -0
  114. package/dist/tools-logic/journal-search.d.ts.map +1 -0
  115. package/dist/tools-logic/journal-search.js +80 -0
  116. package/dist/tools-logic/journal-search.js.map +1 -0
  117. package/dist/tools-logic/journal-state.d.ts +26 -0
  118. package/dist/tools-logic/journal-state.d.ts.map +1 -0
  119. package/dist/tools-logic/journal-state.js +80 -0
  120. package/dist/tools-logic/journal-state.js.map +1 -0
  121. package/dist/tools-logic/journal-write.d.ts +18 -0
  122. package/dist/tools-logic/journal-write.d.ts.map +1 -0
  123. package/dist/tools-logic/journal-write.js +54 -0
  124. package/dist/tools-logic/journal-write.js.map +1 -0
  125. package/dist/tools-logic/knowledge-read.d.ts +7 -0
  126. package/dist/tools-logic/knowledge-read.d.ts.map +1 -0
  127. package/dist/tools-logic/knowledge-read.js +88 -0
  128. package/dist/tools-logic/knowledge-read.js.map +1 -0
  129. package/dist/tools-logic/knowledge-write.d.ts +23 -0
  130. package/dist/tools-logic/knowledge-write.d.ts.map +1 -0
  131. package/dist/tools-logic/knowledge-write.js +58 -0
  132. package/dist/tools-logic/knowledge-write.js.map +1 -0
  133. package/dist/tools-logic/nudge.d.ts +15 -0
  134. package/dist/tools-logic/nudge.d.ts.map +1 -0
  135. package/dist/tools-logic/nudge.js +27 -0
  136. package/dist/tools-logic/nudge.js.map +1 -0
  137. package/dist/tools-logic/palace-lint.d.ts +20 -0
  138. package/dist/tools-logic/palace-lint.d.ts.map +1 -0
  139. package/dist/tools-logic/palace-lint.js +87 -0
  140. package/dist/tools-logic/palace-lint.js.map +1 -0
  141. package/dist/tools-logic/palace-read.d.ts +24 -0
  142. package/dist/tools-logic/palace-read.d.ts.map +1 -0
  143. package/dist/tools-logic/palace-read.js +45 -0
  144. package/dist/tools-logic/palace-read.js.map +1 -0
  145. package/dist/tools-logic/palace-search.d.ts +19 -0
  146. package/dist/tools-logic/palace-search.d.ts.map +1 -0
  147. package/dist/tools-logic/palace-search.js +46 -0
  148. package/dist/tools-logic/palace-search.js.map +1 -0
  149. package/dist/tools-logic/palace-walk.d.ts +18 -0
  150. package/dist/tools-logic/palace-walk.d.ts.map +1 -0
  151. package/dist/tools-logic/palace-walk.js +89 -0
  152. package/dist/tools-logic/palace-walk.js.map +1 -0
  153. package/dist/tools-logic/palace-write.d.ts +22 -0
  154. package/dist/tools-logic/palace-write.d.ts.map +1 -0
  155. package/dist/tools-logic/palace-write.js +60 -0
  156. package/dist/tools-logic/palace-write.js.map +1 -0
  157. package/dist/tools-logic/recall-insight.d.ts +20 -0
  158. package/dist/tools-logic/recall-insight.d.ts.map +1 -0
  159. package/dist/tools-logic/recall-insight.js +27 -0
  160. package/dist/tools-logic/recall-insight.js.map +1 -0
  161. package/dist/types.d.ts +123 -0
  162. package/dist/types.d.ts.map +1 -0
  163. package/dist/types.js +54 -0
  164. package/dist/types.js.map +1 -0
  165. package/package.json +36 -0
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Journal file listing, reading, and index maintenance.
3
+ */
4
+ import type { JournalEntry } from "../types.js";
5
+ /**
6
+ * List all .md journal files across all directories for a project.
7
+ * Returns sorted array with most recent first.
8
+ */
9
+ export declare function listJournalFiles(project: string): JournalEntry[];
10
+ /**
11
+ * Read a journal file. Checks primary dir first, then legacy.
12
+ */
13
+ export declare function readJournalFile(project: string, date: string): string | null;
14
+ /**
15
+ * Extract title from journal file content.
16
+ */
17
+ export declare function extractTitle(content: string): string;
18
+ /**
19
+ * Extract momentum indicator from journal content.
20
+ */
21
+ export declare function extractMomentum(content: string): string;
22
+ /**
23
+ * Count entries in a log file (for journal_capture entry numbering).
24
+ */
25
+ export declare function countLogEntries(logPath: string): number;
26
+ /**
27
+ * Update the index.md for a project.
28
+ */
29
+ export declare function updateIndex(project: string): void;
30
+ //# sourceMappingURL=journal-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal-files.d.ts","sourceRoot":"","sources":["../../src/helpers/journal-files.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,YAAY,EAAE,CAmBhE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAa5E;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAOvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAuBjD"}
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Journal file listing, reading, and index maintenance.
3
+ */
4
+ import * as fs from "node:fs";
5
+ import * as path from "node:path";
6
+ import { journalDir, journalDirs } from "../storage/paths.js";
7
+ import { ensureDir } from "../storage/fs-utils.js";
8
+ /**
9
+ * List all .md journal files across all directories for a project.
10
+ * Returns sorted array with most recent first.
11
+ */
12
+ export function listJournalFiles(project) {
13
+ const dirs = journalDirs(project);
14
+ const entries = [];
15
+ const seen = new Set();
16
+ for (const dir of dirs) {
17
+ if (!fs.existsSync(dir))
18
+ continue;
19
+ const files = fs.readdirSync(dir);
20
+ for (const file of files) {
21
+ const match = file.match(/^(\d{4}-\d{2}-\d{2})\.md$/);
22
+ if (match && !seen.has(match[1])) {
23
+ seen.add(match[1]);
24
+ entries.push({ date: match[1], file, dir });
25
+ }
26
+ }
27
+ }
28
+ entries.sort((a, b) => b.date.localeCompare(a.date));
29
+ return entries;
30
+ }
31
+ /**
32
+ * Read a journal file. Checks primary dir first, then legacy.
33
+ */
34
+ export function readJournalFile(project, date) {
35
+ const filename = `${date}.md`;
36
+ const dirs = journalDirs(project);
37
+ const primaryDir = journalDir(project);
38
+ const allDirs = [primaryDir, ...dirs.filter((d) => d !== primaryDir)];
39
+ for (const dir of allDirs) {
40
+ const filePath = path.join(dir, filename);
41
+ if (fs.existsSync(filePath)) {
42
+ return fs.readFileSync(filePath, "utf-8");
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+ /**
48
+ * Extract title from journal file content.
49
+ */
50
+ export function extractTitle(content) {
51
+ const match = content.match(/^# (.+)$/m);
52
+ return match ? match[1].trim() : "(untitled)";
53
+ }
54
+ /**
55
+ * Extract momentum indicator from journal content.
56
+ */
57
+ export function extractMomentum(content) {
58
+ const patterns = [/[🟢🟡🔴⚪]\s*\S+/];
59
+ for (const pattern of patterns) {
60
+ const match = content.match(pattern);
61
+ if (match)
62
+ return match[0];
63
+ }
64
+ return "";
65
+ }
66
+ /**
67
+ * Count entries in a log file (for journal_capture entry numbering).
68
+ */
69
+ export function countLogEntries(logPath) {
70
+ if (!fs.existsSync(logPath))
71
+ return 0;
72
+ const content = fs.readFileSync(logPath, "utf-8");
73
+ const matches = content.match(/^### Q\d+/gm);
74
+ return matches ? matches.length : 0;
75
+ }
76
+ /**
77
+ * Update the index.md for a project.
78
+ */
79
+ export function updateIndex(project) {
80
+ const dir = journalDir(project);
81
+ ensureDir(dir);
82
+ const indexPath = path.join(dir, "index.md");
83
+ const entries = listJournalFiles(project);
84
+ let index = `# ${project} — Journal Index\n\n`;
85
+ index += `> Auto-generated. ${entries.length} entries.\n\n`;
86
+ index += `| Date | Title | Momentum |\n`;
87
+ index += `|------|-------|----------|\n`;
88
+ for (const entry of entries) {
89
+ const content = fs.readFileSync(path.join(entry.dir, entry.file), "utf-8");
90
+ const title = extractTitle(content);
91
+ const momentum = extractMomentum(content);
92
+ index += `| ${entry.date} | ${title} | ${momentum} |\n`;
93
+ }
94
+ fs.writeFileSync(indexPath, index, "utf-8");
95
+ }
96
+ //# sourceMappingURL=journal-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"journal-files.js","sourceRoot":"","sources":["../../src/helpers/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AAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Weekly journal roll-up helpers.
3
+ *
4
+ * Pure functions for grouping journal entries by ISO week and synthesizing
5
+ * weekly summaries. No MCP or framework dependencies.
6
+ */
7
+ /** Get ISO week number and year for a date string. */
8
+ export declare function isoWeek(dateStr: string): {
9
+ year: number;
10
+ week: number;
11
+ };
12
+ /** Format week key: "2026-W14" */
13
+ export declare function weekKey(dateStr: string): string;
14
+ /**
15
+ * Group journal entries by ISO week.
16
+ * Returns a map of weekKey -> entries, sorted by date within each week.
17
+ */
18
+ export declare function groupByWeek(entries: Array<{
19
+ date: string;
20
+ file: string;
21
+ dir: string;
22
+ }>): Map<string, Array<{
23
+ date: string;
24
+ file: string;
25
+ dir: string;
26
+ }>>;
27
+ /**
28
+ * Synthesize a week of journal entries into a summary.
29
+ */
30
+ export declare function synthesizeWeek(wk: string, entries: Array<{
31
+ date: string;
32
+ file: string;
33
+ dir: string;
34
+ }>): string;
35
+ //# sourceMappingURL=rollup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/helpers/rollup.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,sDAAsD;AACtD,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAMvE;AAED,kCAAkC;AAClC,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG/C;AAED;;;GAGG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAC1D,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAYjE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC,GAC1D,MAAM,CAiCR"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Weekly journal roll-up helpers.
3
+ *
4
+ * Pure functions for grouping journal entries by ISO week and synthesizing
5
+ * weekly summaries. No MCP or framework dependencies.
6
+ */
7
+ import * as fs from "node:fs";
8
+ import * as path from "node:path";
9
+ import { extractSection } from "./sections.js";
10
+ /** Get ISO week number and year for a date string. */
11
+ export function isoWeek(dateStr) {
12
+ const d = new Date(dateStr + "T12:00:00Z"); // noon UTC to avoid timezone issues
13
+ d.setUTCDate(d.getUTCDate() + 4 - (d.getUTCDay() || 7));
14
+ const yearStart = new Date(Date.UTC(d.getUTCFullYear(), 0, 1));
15
+ const week = Math.ceil(((d.getTime() - yearStart.getTime()) / 86400000 + 1) / 7);
16
+ return { year: d.getUTCFullYear(), week };
17
+ }
18
+ /** Format week key: "2026-W14" */
19
+ export function weekKey(dateStr) {
20
+ const { year, week } = isoWeek(dateStr);
21
+ return `${year}-W${String(week).padStart(2, "0")}`;
22
+ }
23
+ /**
24
+ * Group journal entries by ISO week.
25
+ * Returns a map of weekKey -> entries, sorted by date within each week.
26
+ */
27
+ export function groupByWeek(entries) {
28
+ const groups = new Map();
29
+ for (const entry of entries) {
30
+ const key = weekKey(entry.date);
31
+ if (!groups.has(key))
32
+ groups.set(key, []);
33
+ groups.get(key).push(entry);
34
+ }
35
+ // Sort entries within each week by date ascending
36
+ for (const [, group] of groups) {
37
+ group.sort((a, b) => a.date.localeCompare(b.date));
38
+ }
39
+ return groups;
40
+ }
41
+ /**
42
+ * Synthesize a week of journal entries into a summary.
43
+ */
44
+ export function synthesizeWeek(wk, entries) {
45
+ const briefs = [];
46
+ const decisions = [];
47
+ const blockers = [];
48
+ const completed = [];
49
+ const next = [];
50
+ for (const entry of entries) {
51
+ const content = fs.readFileSync(path.join(entry.dir, entry.file), "utf-8");
52
+ const brief = extractSection(content, "brief");
53
+ const decision = extractSection(content, "decisions");
54
+ const blocker = extractSection(content, "blockers");
55
+ const comp = extractSection(content, "completed");
56
+ const nxt = extractSection(content, "next");
57
+ if (brief)
58
+ briefs.push(`**${entry.date}**: ${brief.split("\n").find(l => l.trim()) || ""}`);
59
+ if (decision)
60
+ decisions.push(`**${entry.date}**: ${decision.split("\n").filter(l => l.trim()).slice(0, 3).join(" | ")}`);
61
+ if (blocker)
62
+ blockers.push(`**${entry.date}**: ${blocker.split("\n").find(l => l.trim()) || ""}`);
63
+ if (comp)
64
+ completed.push(`**${entry.date}**: ${comp.split("\n").filter(l => l.trim()).slice(0, 3).join(", ")}`);
65
+ if (nxt)
66
+ next.push(`**${entry.date}**: ${nxt.split("\n").find(l => l.trim()) || ""}`);
67
+ }
68
+ let summary = `# ${wk} Weekly Summary\n\n`;
69
+ summary += `> Condensed from ${entries.length} daily entries: ${entries[0].date} → ${entries[entries.length - 1].date}\n`;
70
+ summary += `> Auto-generated by journal_rollup. Originals in archive/.\n\n`;
71
+ summary += `## Briefs\n\n${briefs.join("\n") || "(none)"}\n\n`;
72
+ summary += `## Completed\n\n${completed.join("\n") || "(none)"}\n\n`;
73
+ summary += `## Decisions\n\n${decisions.join("\n") || "(none)"}\n\n`;
74
+ summary += `## Blockers\n\n${blockers.join("\n") || "(none)"}\n\n`;
75
+ summary += `## Next Actions (end of week)\n\n${next.length > 0 ? next[next.length - 1] : "(none)"}\n`;
76
+ return summary;
77
+ }
78
+ //# sourceMappingURL=rollup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.js","sourceRoot":"","sources":["../../src/helpers/rollup.ts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AAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACxF,CAAC;IAED,IAAI,OAAO,GAAG,KAAK,EAAE,qBAAqB,CAAC;IAC3C,OAAO,IAAI,oBAAoB,OAAO,CAAC,MAAM,mBAAmB,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;IAC1H,OAAO,IAAI,gEAAgE,CAAC;IAE5E,OAAO,IAAI,gBAAgB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,CAAC;IAC/D,OAAO,IAAI,mBAAmB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,CAAC;IACrE,OAAO,IAAI,mBAAmB,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,CAAC;IACrE,OAAO,IAAI,kBAAkB,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,MAAM,CAAC;IACnE,OAAO,IAAI,oCAAoC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC;IAEtG,OAAO,OAAO,CAAC;AACjB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Markdown section extraction and manipulation.
3
+ */
4
+ /**
5
+ * Extract a section from a markdown journal entry.
6
+ */
7
+ export declare function extractSection(content: string, section: string): string | null;
8
+ /**
9
+ * Append content to a specific section in a journal file, or to end of file.
10
+ */
11
+ export declare function appendToSection(existingContent: string, newContent: string, section: string | null): string;
12
+ //# sourceMappingURL=sections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.d.ts","sourceRoot":"","sources":["../../src/helpers/sections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;GAEG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAsC9E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,GAAG,IAAI,GACrB,MAAM,CA0CR"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Markdown section extraction and manipulation.
3
+ */
4
+ import { SECTION_HEADERS } from "../types.js";
5
+ /**
6
+ * Extract a section from a markdown journal entry.
7
+ */
8
+ export function extractSection(content, section) {
9
+ if (section === "all")
10
+ return content;
11
+ if (section === "brief") {
12
+ const lines = content.split("\n");
13
+ const nonEmpty = [];
14
+ let pastTitle = false;
15
+ for (const line of lines) {
16
+ if (line.startsWith("# ")) {
17
+ pastTitle = true;
18
+ continue;
19
+ }
20
+ if (!pastTitle)
21
+ continue;
22
+ const trimmed = line.trim();
23
+ if (trimmed === "")
24
+ continue;
25
+ nonEmpty.push(trimmed);
26
+ if (nonEmpty.length >= 4)
27
+ break;
28
+ }
29
+ return nonEmpty.join("\n") || null;
30
+ }
31
+ const header = SECTION_HEADERS[section];
32
+ if (!header)
33
+ return null;
34
+ const idx = content.indexOf(header);
35
+ if (idx === -1)
36
+ return null;
37
+ const afterHeader = content.slice(idx);
38
+ const lines = afterHeader.split("\n");
39
+ const result = [lines[0]];
40
+ let inCodeFence = false;
41
+ for (let i = 1; i < lines.length; i++) {
42
+ if (lines[i].startsWith("```"))
43
+ inCodeFence = !inCodeFence;
44
+ if (!inCodeFence && lines[i].startsWith("## "))
45
+ break;
46
+ result.push(lines[i]);
47
+ }
48
+ return result.join("\n").trimEnd();
49
+ }
50
+ /**
51
+ * Append content to a specific section in a journal file, or to end of file.
52
+ */
53
+ export function appendToSection(existingContent, newContent, section) {
54
+ if (section === "replace_all") {
55
+ return newContent;
56
+ }
57
+ if (!section) {
58
+ return existingContent.trimEnd() + "\n\n" + newContent + "\n";
59
+ }
60
+ const header = SECTION_HEADERS[section];
61
+ if (!header) {
62
+ return existingContent.trimEnd() + "\n\n" + newContent + "\n";
63
+ }
64
+ const idx = existingContent.indexOf(header);
65
+ if (idx === -1) {
66
+ return (existingContent.trimEnd() + "\n\n" + header + "\n\n" + newContent + "\n");
67
+ }
68
+ const afterHeader = existingContent.slice(idx);
69
+ const lines = afterHeader.split("\n");
70
+ let insertAt = lines.length;
71
+ let inCodeFence = false;
72
+ for (let i = 1; i < lines.length; i++) {
73
+ if (lines[i].startsWith("```"))
74
+ inCodeFence = !inCodeFence;
75
+ if (!inCodeFence && lines[i].startsWith("## ")) {
76
+ insertAt = i;
77
+ break;
78
+ }
79
+ }
80
+ const before = existingContent.slice(0, idx + lines.slice(0, insertAt).join("\n").length);
81
+ const after = existingContent.slice(idx + lines.slice(0, insertAt).join("\n").length);
82
+ return before.trimEnd() + "\n\n" + newContent + "\n" + after;
83
+ }
84
+ //# sourceMappingURL=sections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sections.js","sourceRoot":"","sources":["../../src/helpers/sections.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,EAAE,OAAe;IAC7D,IAAI,OAAO,KAAK,KAAK;QAAE,OAAO,OAAO,CAAC;IAEtC,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC1B,SAAS,GAAG,IAAI,CAAC;gB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UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,QAAQ,GAAG,CAAC,CAAC;YACb,MAAM;QACR,CAAC;IACH,CAAC;IAED,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAClC,CAAC,EACD,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CACjD,CAAC;IACF,MAAM,KAAK,GAAG,eAAe,CAAC,KAAK,CACjC,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CACjD,CAAC;IAEF,OAAO,MAAM,CAAC,OAAO,EAAE,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,GAAG,KAAK,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * agent-recall-core — shared business logic for AgentRecall.
3
+ *
4
+ * All types, palace operations, storage utilities, and helper functions
5
+ * are re-exported from this barrel.
6
+ */
7
+ export { VERSION, SECTION_HEADERS, DEFAULT_PALACE_ROOMS, setRoot, resetRoot, getRoot, getLegacyRoot, } from "./types.js";
8
+ export type { JournalEntry, ProjectInfo, SessionState, RoomMeta, PalaceIndex, GraphEdge, PalaceGraph, Importance, Confidence, WalkDepth, } from "./types.js";
9
+ export { createRoom, getRoomMeta, updateRoomMeta, listRooms, roomExists, ensurePalaceInitialized, recordAccess, } from "./palace/rooms.js";
10
+ export { readGraph, writeGraph, addEdge, removeEdgesFor, getConnectionCount, getConnectedRooms, } from "./palace/graph.js";
11
+ export { fanOut } from "./palace/fan-out.js";
12
+ export type { FanOutResult } from "./palace/fan-out.js";
13
+ export { readAwareness, writeAwareness, readAwarenessState, writeAwarenessState, initAwareness, addInsight, detectCompoundInsights, renderAwareness, } from "./palace/awareness.js";
14
+ export type { Insight, CompoundInsight, AwarenessState, } from "./palace/awareness.js";
15
+ export { computeSalience, ARCHIVE_THRESHOLD, AUTO_ARCHIVE_THRESHOLD, } from "./palace/salience.js";
16
+ export { readInsightsIndex, writeInsightsIndex, addIndexedInsight, recallInsights, } from "./palace/insights-index.js";
17
+ export type { IndexedInsight, InsightsIndex, } from "./palace/insights-index.js";
18
+ export { readIdentity, writeIdentity } from "./palace/identity.js";
19
+ export { readPalaceIndex, updatePalaceIndex } from "./palace/index-manager.js";
20
+ export { extractWikilinks, addBackReference, generateFrontmatter, roomReadmeContent, } from "./palace/obsidian.js";
21
+ export { appendToLog } from "./palace/log.js";
22
+ export { consolidateJournalToPalace } from "./palace/consolidate.js";
23
+ export type { ConsolidationResult } from "./palace/consolidate.js";
24
+ export { journalDir, journalDirs, palaceDir, roomDir } from "./storage/paths.js";
25
+ export { ensureDir, todayISO, readJsonSafe, writeJsonAtomic } from "./storage/fs-utils.js";
26
+ export { detectProject, resolveProject, listAllProjects } from "./storage/project.js";
27
+ export { listJournalFiles, readJournalFile, extractTitle, extractMomentum, countLogEntries, updateIndex, } from "./helpers/journal-files.js";
28
+ export { extractSection, appendToSection } from "./helpers/sections.js";
29
+ export { isoWeek, weekKey, groupByWeek, synthesizeWeek } from "./helpers/rollup.js";
30
+ export { journalRead, type JournalReadInput, type JournalReadResult } from "./tools-logic/journal-read.js";
31
+ export { journalWrite, type JournalWriteInput, type JournalWriteResult } from "./tools-logic/journal-write.js";
32
+ export { journalCapture, type JournalCaptureInput, type JournalCaptureResult } from "./tools-logic/journal-capture.js";
33
+ export { journalList, type JournalListInput, type JournalListResult } from "./tools-logic/journal-list.js";
34
+ export { journalProjects, type JournalProjectsResult } from "./tools-logic/journal-projects.js";
35
+ export { journalSearch, type JournalSearchInput, type JournalSearchResult } from "./tools-logic/journal-search.js";
36
+ export { journalState, stateFilePath, readState, type JournalStateInput, type JournalStateResult } from "./tools-logic/journal-state.js";
37
+ export { journalColdStart, type JournalColdStartInput, type JournalColdStartResult } from "./tools-logic/journal-cold-start.js";
38
+ export { journalArchive, type JournalArchiveInput, type JournalArchiveResult } from "./tools-logic/journal-archive.js";
39
+ export { journalRollup, type JournalRollupInput, type JournalRollupResult } from "./tools-logic/journal-rollup.js";
40
+ export { alignmentCheck, type AlignmentCheckInput, type AlignmentCheckResult } from "./tools-logic/alignment-check.js";
41
+ export { nudge, type NudgeInput, type NudgeResult } from "./tools-logic/nudge.js";
42
+ export { contextSynthesize, type ContextSynthesizeInput, type ContextSynthesizeResult } from "./tools-logic/context-synthesize.js";
43
+ export { knowledgeWrite, type KnowledgeWriteInput, type KnowledgeWriteResult } from "./tools-logic/knowledge-write.js";
44
+ export { knowledgeRead, type KnowledgeReadInput } from "./tools-logic/knowledge-read.js";
45
+ export { palaceRead, type PalaceReadInput, type PalaceReadResult } from "./tools-logic/palace-read.js";
46
+ export { palaceWrite, type PalaceWriteInput, type PalaceWriteResult } from "./tools-logic/palace-write.js";
47
+ export { palaceWalk, roomSummary, readRoomContent, type PalaceWalkInput, type PalaceWalkResult } from "./tools-logic/palace-walk.js";
48
+ export { palaceLint, type PalaceLintInput, type PalaceLintResult, type LintIssue } from "./tools-logic/palace-lint.js";
49
+ export { palaceSearch, type PalaceSearchInput, type PalaceSearchResult } from "./tools-logic/palace-search.js";
50
+ export { awarenessUpdate, type AwarenessUpdateInput, type AwarenessUpdateResult } from "./tools-logic/awareness-update.js";
51
+ export { recallInsight, type RecallInsightInput, type RecallInsightResult } from "./tools-logic/recall-insight.js";
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,OAAO,EACP,eAAe,EACf,oBAAoB,EACpB,OAAO,EACP,SAAS,EACT,OAAO,EACP,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,WAAW,EACX,UAAU,EACV,U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EAAE,KAAK,mBAAmB,EAAE,MAAM,iCAAiC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,63 @@
1
+ /**
2
+ * agent-recall-core — shared business logic for AgentRecall.
3
+ *
4
+ * All types, palace operations, storage utilities, and helper functions
5
+ * are re-exported from this barrel.
6
+ */
7
+ // Types & constants
8
+ export { VERSION, SECTION_HEADERS, DEFAULT_PALACE_ROOMS, setRoot, resetRoot, getRoot, getLegacyRoot, } from "./types.js";
9
+ // Palace — rooms
10
+ export { createRoom, getRoomMeta, updateRoomMeta, listRooms, roomExists, ensurePalaceInitialized, recordAccess, } from "./palace/rooms.js";
11
+ // Palace — graph
12
+ export { readGraph, writeGraph, addEdge, removeEdgesFor, getConnectionCount, getConnectedRooms, } from "./palace/graph.js";
13
+ // Palace — fan-out
14
+ export { fanOut } from "./palace/fan-out.js";
15
+ // Palace — awareness
16
+ export { readAwareness, writeAwareness, readAwarenessState, writeAwarenessState, initAwareness, addInsight, detectCompoundInsights, renderAwareness, } from "./palace/awareness.js";
17
+ // Palace — salience
18
+ export { computeSalience, ARCHIVE_THRESHOLD, AUTO_ARCHIVE_THRESHOLD, } from "./palace/salience.js";
19
+ // Palace — insights index
20
+ export { readInsightsIndex, writeInsightsIndex, addIndexedInsight, recallInsights, } from "./palace/insights-index.js";
21
+ // Palace — identity
22
+ export { readIdentity, writeIdentity } from "./palace/identity.js";
23
+ // Palace — index manager
24
+ export { readPalaceIndex, updatePalaceIndex } from "./palace/index-manager.js";
25
+ // Palace — obsidian
26
+ export { extractWikilinks, addBackReference, generateFrontmatter, roomReadmeContent, } from "./palace/obsidian.js";
27
+ // Palace — log
28
+ export { appendToLog } from "./palace/log.js";
29
+ // Palace — consolidate
30
+ export { consolidateJournalToPalace } from "./palace/consolidate.js";
31
+ // Storage
32
+ export { journalDir, journalDirs, palaceDir, roomDir } from "./storage/paths.js";
33
+ export { ensureDir, todayISO, readJsonSafe, writeJsonAtomic } from "./storage/fs-utils.js";
34
+ export { detectProject, resolveProject, listAllProjects } from "./storage/project.js";
35
+ // Helpers
36
+ export { listJournalFiles, readJournalFile, extractTitle, extractMomentum, countLogEntries, updateIndex, } from "./helpers/journal-files.js";
37
+ export { extractSection, appendToSection } from "./helpers/sections.js";
38
+ // Helpers — rollup
39
+ export { isoWeek, weekKey, groupByWeek, synthesizeWeek } from "./helpers/rollup.js";
40
+ // Tool logic functions (extracted from MCP tool handlers)
41
+ export { journalRead } from "./tools-logic/journal-read.js";
42
+ export { journalWrite } from "./tools-logic/journal-write.js";
43
+ export { journalCapture } from "./tools-logic/journal-capture.js";
44
+ export { journalList } from "./tools-logic/journal-list.js";
45
+ export { journalProjects } from "./tools-logic/journal-projects.js";
46
+ export { journalSearch } from "./tools-logic/journal-search.js";
47
+ export { journalState, stateFilePath, readState } from "./tools-logic/journal-state.js";
48
+ export { journalColdStart } from "./tools-logic/journal-cold-start.js";
49
+ export { journalArchive } from "./tools-logic/journal-archive.js";
50
+ export { journalRollup } from "./tools-logic/journal-rollup.js";
51
+ export { alignmentCheck } from "./tools-logic/alignment-check.js";
52
+ export { nudge } from "./tools-logic/nudge.js";
53
+ export { contextSynthesize } from "./tools-logic/context-synthesize.js";
54
+ export { knowledgeWrite } from "./tools-logic/knowledge-write.js";
55
+ export { knowledgeRead } from "./tools-logic/knowledge-read.js";
56
+ export { palaceRead } from "./tools-logic/palace-read.js";
57
+ export { palaceWrite } from "./tools-logic/palace-write.js";
58
+ export { palaceWalk, roomSummary, readRoomContent } from "./tools-logic/palace-walk.js";
59
+ export { palaceLint } from "./tools-logic/palace-lint.js";
60
+ export { palaceSearch } from "./tools-logic/palace-search.js";
61
+ export { awarenessUpdate } from "./tools-logic/awareness-update.js";
62
+ export { recallInsight } from "./tools-logic/recall-insight.js";
63
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,oBAAoB;AACpB,OAAO,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,cAAc,EAAuD,MAAM,kCAAkC,CAAC;AACvH,OAAO,EAAE,aAAa,EAA2B,MAAM,iCAAiC,CAAC;AACzF,OAAO,EAAE,UAAU,EAA+C,MAAM,8BAA8B,CAAC;AACvG,OAAO,EAAE,WAAW,EAAiD,MAAM,+BAA+B,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,eAAe,EAA+C,MAAM,8BAA8B,CAAC;AACrI,OAAO,EAAE,UAAU,EAA+D,MAAM,8BAA8B,CAAC;AACvH,OAAO,EAAE,YAAY,EAAmD,MAAM,gCAAgC,CAAC;AAC/G,OAAO,EAAE,eAAe,EAAyD,MAAM,mCAAmC,CAAC;AAC3H,OAAO,EAAE,aAAa,EAAqD,MAAM,iCAAiC,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Awareness system — a living 200-line document that compounds insights.
3
+ *
4
+ * Unlike the palace (room-based storage) or journal (temporal log),
5
+ * awareness.md is a SELF-REWRITING document. Every update forces the
6
+ * system to merge, compress, or demote — creating compounding knowledge.
7
+ *
8
+ * Structure:
9
+ * ## Identity (5 lines) — who is the user, what matters
10
+ * ## Top Insights (10 items) — ranked by relevance + confirmation count
11
+ * ## Compound Insights (5 max) — patterns spanning 3+ individual insights
12
+ * ## Trajectory (3 lines) — where is the work heading
13
+ * ## Blind Spots (3 lines) — what the system suspects matters but hasn't confirmed
14
+ *
15
+ * Max 200 lines enforced. Overflow triggers merge/demote.
16
+ */
17
+ export declare function readAwareness(): string;
18
+ export declare function writeAwareness(content: string): void;
19
+ export interface Insight {
20
+ id: string;
21
+ title: string;
22
+ evidence: string;
23
+ confirmations: number;
24
+ lastConfirmed: string;
25
+ appliesWhen: string[];
26
+ source: string;
27
+ }
28
+ export interface CompoundInsight {
29
+ id: string;
30
+ title: string;
31
+ sourceInsights: string[];
32
+ pattern: string;
33
+ confidence: number;
34
+ }
35
+ export interface AwarenessState {
36
+ identity: string;
37
+ topInsights: Insight[];
38
+ compoundInsights: CompoundInsight[];
39
+ trajectory: string;
40
+ blindSpots: string[];
41
+ lastUpdated: string;
42
+ }
43
+ export declare function readAwarenessState(): AwarenessState | null;
44
+ export declare function writeAwarenessState(state: AwarenessState): void;
45
+ /**
46
+ * Initialize awareness from scratch.
47
+ */
48
+ export declare function initAwareness(identity: string): AwarenessState;
49
+ /**
50
+ * Add or merge an insight into the awareness state.
51
+ * If similar insight exists (by title keyword overlap), merge and strengthen.
52
+ * If new, add and demote lowest if over 10.
53
+ */
54
+ export declare function addInsight(newInsight: Omit<Insight, "id" | "confirmations" | "lastConfirmed">): {
55
+ action: "merged" | "added" | "replaced";
56
+ insight: Insight;
57
+ };
58
+ /**
59
+ * Detect compound insights — patterns spanning 3+ individual insights.
60
+ * Looks for shared appliesWhen keywords across insights.
61
+ */
62
+ export declare function detectCompoundInsights(): CompoundInsight[];
63
+ /**
64
+ * Render awareness state into the 200-line markdown document.
65
+ */
66
+ export declare function renderAwareness(state: AwarenessState): void;
67
+ //# sourceMappingURL=awareness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awareness.d.ts","sourceRoot":"","sources":["../../src/palace/awareness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAaH,wBAAgB,aAAa,IAAI,MAAM,CAItC;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAYpD;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE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