@bubstack/moe-memory 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mcp.json +18 -0
- package/README.md +47 -0
- package/agents/search-conversations.md +171 -0
- package/dist/LICENSE +25 -0
- package/dist/cli.d.ts +25 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +125 -0
- package/dist/cli.js.map +1 -0
- package/dist/codex-hook-trust.d.ts +4 -0
- package/dist/codex-hook-trust.d.ts.map +1 -0
- package/dist/codex-hook-trust.js +114 -0
- package/dist/codex-hook-trust.js.map +1 -0
- package/dist/codex-support.d.ts +6 -0
- package/dist/codex-support.d.ts.map +1 -0
- package/dist/codex-support.js +29 -0
- package/dist/codex-support.js.map +1 -0
- package/dist/constants.d.ts +14 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +14 -0
- package/dist/constants.js.map +1 -0
- package/dist/db.d.ts +103 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/db.js +430 -0
- package/dist/db.js.map +1 -0
- package/dist/doctor-cli.d.ts +3 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +43 -0
- package/dist/doctor-cli.js.map +1 -0
- package/dist/doctor.d.ts +17 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/doctor.js +98 -0
- package/dist/doctor.js.map +1 -0
- package/dist/embedding-migration.d.ts +73 -0
- package/dist/embedding-migration.d.ts.map +1 -0
- package/dist/embedding-migration.js +120 -0
- package/dist/embedding-migration.js.map +1 -0
- package/dist/embeddings.d.ts +78 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +180 -0
- package/dist/embeddings.js.map +1 -0
- package/dist/file-lock.d.ts +39 -0
- package/dist/file-lock.d.ts.map +1 -0
- package/dist/file-lock.js +91 -0
- package/dist/file-lock.js.map +1 -0
- package/dist/index-cli.d.ts +10 -0
- package/dist/index-cli.d.ts.map +1 -0
- package/dist/index-cli.js +195 -0
- package/dist/index-cli.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer.d.ts +4 -0
- package/dist/indexer.d.ts.map +1 -0
- package/dist/indexer.js +318 -0
- package/dist/indexer.js.map +1 -0
- package/dist/install-check.d.ts +48 -0
- package/dist/install-check.d.ts.map +1 -0
- package/dist/install-check.js +82 -0
- package/dist/install-check.js.map +1 -0
- package/dist/journal/index.d.ts +5 -0
- package/dist/journal/index.d.ts.map +1 -0
- package/dist/journal/index.js +5 -0
- package/dist/journal/index.js.map +1 -0
- package/dist/journal/legacy-sidecars.d.ts +74 -0
- package/dist/journal/legacy-sidecars.d.ts.map +1 -0
- package/dist/journal/legacy-sidecars.js +151 -0
- package/dist/journal/legacy-sidecars.js.map +1 -0
- package/dist/journal/markdown.d.ts +91 -0
- package/dist/journal/markdown.d.ts.map +1 -0
- package/dist/journal/markdown.js +234 -0
- package/dist/journal/markdown.js.map +1 -0
- package/dist/journal/search.d.ts +91 -0
- package/dist/journal/search.d.ts.map +1 -0
- package/dist/journal/search.js +203 -0
- package/dist/journal/search.js.map +1 -0
- package/dist/journal/store.d.ts +96 -0
- package/dist/journal/store.d.ts.map +1 -0
- package/dist/journal/store.js +270 -0
- package/dist/journal/store.js.map +1 -0
- package/dist/journal-cli.d.ts +19 -0
- package/dist/journal-cli.d.ts.map +1 -0
- package/dist/journal-cli.js +153 -0
- package/dist/journal-cli.js.map +1 -0
- package/dist/logging.d.ts +6 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/logging.js +20 -0
- package/dist/logging.js.map +1 -0
- package/dist/mcp-server.d.ts +34 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mcp-server.js +607 -0
- package/dist/mcp-server.js.map +1 -0
- package/dist/parser.d.ts +11 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +445 -0
- package/dist/parser.js.map +1 -0
- package/dist/paths.d.ts +103 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +258 -0
- package/dist/paths.js.map +1 -0
- package/dist/search-cli.d.ts +3 -0
- package/dist/search-cli.d.ts.map +1 -0
- package/dist/search-cli.js +138 -0
- package/dist/search-cli.js.map +1 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/search.js +371 -0
- package/dist/search.js.map +1 -0
- package/dist/show-cli.d.ts +3 -0
- package/dist/show-cli.d.ts.map +1 -0
- package/dist/show-cli.js +60 -0
- package/dist/show-cli.js.map +1 -0
- package/dist/show.d.ts +3 -0
- package/dist/show.d.ts.map +1 -0
- package/dist/show.js +984 -0
- package/dist/show.js.map +1 -0
- package/dist/stats-cli.d.ts +3 -0
- package/dist/stats-cli.d.ts.map +1 -0
- package/dist/stats-cli.js +51 -0
- package/dist/stats-cli.js.map +1 -0
- package/dist/stats.d.ts +19 -0
- package/dist/stats.d.ts.map +1 -0
- package/dist/stats.js +116 -0
- package/dist/stats.js.map +1 -0
- package/dist/summarizer.d.ts +83 -0
- package/dist/summarizer.d.ts.map +1 -0
- package/dist/summarizer.js +526 -0
- package/dist/summarizer.js.map +1 -0
- package/dist/summary-sentinel.d.ts +31 -0
- package/dist/summary-sentinel.d.ts.map +1 -0
- package/dist/summary-sentinel.js +80 -0
- package/dist/summary-sentinel.js.map +1 -0
- package/dist/sync-cli.d.ts +15 -0
- package/dist/sync-cli.d.ts.map +1 -0
- package/dist/sync-cli.js +202 -0
- package/dist/sync-cli.js.map +1 -0
- package/dist/sync.d.ts +35 -0
- package/dist/sync.d.ts.map +1 -0
- package/dist/sync.js +204 -0
- package/dist/sync.js.map +1 -0
- package/dist/types.d.ts +125 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +32 -0
- package/dist/types.js.map +1 -0
- package/dist/verify.d.ts +30 -0
- package/dist/verify.d.ts.map +1 -0
- package/dist/verify.js +174 -0
- package/dist/verify.js.map +1 -0
- package/dist/version.d.ts +13 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +13 -0
- package/dist/version.js.map +1 -0
- package/hooks/hooks.json +15 -0
- package/package.json +71 -0
- package/prompts/search-agent.md +160 -0
- package/skills/remembering-conversations/MCP-TOOLS.md +147 -0
- package/skills/remembering-conversations/SKILL.md +97 -0
package/dist/indexer.js
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { initDatabase, insertExchange } from "./db.js";
|
|
4
|
+
import { generateExchangeEmbedding, initEmbeddings } from "./embeddings.js";
|
|
5
|
+
import { parseConversation } from "./parser.js";
|
|
6
|
+
import { findJsonlFiles, getArchiveDir, getConversationSourceDirs, getExcludedProjects, } from "./paths.js";
|
|
7
|
+
import { summarizeConversation } from "./summarizer.js";
|
|
8
|
+
import { formatErrorSentinel, shouldQueueForSummary } from "./summary-sentinel.js";
|
|
9
|
+
// Set max output tokens for Claude SDK (used by summarizer)
|
|
10
|
+
process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS = "20000";
|
|
11
|
+
// Increase max listeners for concurrent API calls
|
|
12
|
+
import { EventEmitter } from "node:events";
|
|
13
|
+
EventEmitter.defaultMaxListeners = 20;
|
|
14
|
+
// Process items in batches with limited concurrency
|
|
15
|
+
async function processBatch(items, processor, concurrency) {
|
|
16
|
+
const results = [];
|
|
17
|
+
for (let i = 0; i < items.length; i += concurrency) {
|
|
18
|
+
const batch = items.slice(i, i + concurrency);
|
|
19
|
+
const batchResults = await Promise.all(batch.map(processor));
|
|
20
|
+
results.push(...batchResults);
|
|
21
|
+
}
|
|
22
|
+
return results;
|
|
23
|
+
}
|
|
24
|
+
function sessionIdForSummary(exchanges) {
|
|
25
|
+
return exchanges.find((exchange) => exchange.sessionId)?.sessionId;
|
|
26
|
+
}
|
|
27
|
+
export async function indexConversations(limitToProject, maxConversations, concurrency = 1, noSummaries = false) {
|
|
28
|
+
console.log("Initializing database...");
|
|
29
|
+
const db = initDatabase();
|
|
30
|
+
console.log("Loading embedding model...");
|
|
31
|
+
await initEmbeddings();
|
|
32
|
+
if (noSummaries) {
|
|
33
|
+
console.log("⚠️ Running in no-summaries mode (skipping AI summaries)");
|
|
34
|
+
}
|
|
35
|
+
console.log("Scanning for conversation files...");
|
|
36
|
+
const sourceDirs = getConversationSourceDirs();
|
|
37
|
+
const ARCHIVE_DIR = getArchiveDir();
|
|
38
|
+
let totalExchanges = 0;
|
|
39
|
+
let conversationsProcessed = 0;
|
|
40
|
+
const excludedProjects = getExcludedProjects();
|
|
41
|
+
const excludedDirSet = new Set(excludedProjects);
|
|
42
|
+
for (const sourceDir of sourceDirs) {
|
|
43
|
+
const projects = fs.readdirSync(sourceDir);
|
|
44
|
+
for (const project of projects) {
|
|
45
|
+
// Skip excluded projects
|
|
46
|
+
if (excludedProjects.includes(project)) {
|
|
47
|
+
console.log(`\nSkipping excluded project: ${project}`);
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
// Skip if limiting to specific project
|
|
51
|
+
if (limitToProject && project !== limitToProject)
|
|
52
|
+
continue;
|
|
53
|
+
const projectPath = path.join(sourceDir, project);
|
|
54
|
+
const stat = fs.statSync(projectPath);
|
|
55
|
+
if (!stat.isDirectory())
|
|
56
|
+
continue;
|
|
57
|
+
const files = findJsonlFiles(projectPath, excludedDirSet);
|
|
58
|
+
if (files.length === 0)
|
|
59
|
+
continue;
|
|
60
|
+
console.log(`\nProcessing project: ${project} (${files.length} conversations)`);
|
|
61
|
+
if (concurrency > 1)
|
|
62
|
+
console.log(` Concurrency: ${concurrency}`);
|
|
63
|
+
// Create archive directory for this project
|
|
64
|
+
const projectArchive = path.join(ARCHIVE_DIR, project);
|
|
65
|
+
fs.mkdirSync(projectArchive, { recursive: true });
|
|
66
|
+
const toProcess = [];
|
|
67
|
+
for (const file of files) {
|
|
68
|
+
const sourcePath = path.join(projectPath, file);
|
|
69
|
+
const archivePath = path.join(projectArchive, file);
|
|
70
|
+
// Copy to archive (ensure parent dirs exist for subagent files)
|
|
71
|
+
if (!fs.existsSync(archivePath)) {
|
|
72
|
+
fs.mkdirSync(path.dirname(archivePath), { recursive: true });
|
|
73
|
+
fs.copyFileSync(sourcePath, archivePath);
|
|
74
|
+
console.log(` Archived: ${file}`);
|
|
75
|
+
}
|
|
76
|
+
// Parse conversation
|
|
77
|
+
const exchanges = await parseConversation(sourcePath, project, archivePath);
|
|
78
|
+
if (exchanges.length === 0) {
|
|
79
|
+
console.log(` Skipped ${file} (no exchanges)`);
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
toProcess.push({
|
|
83
|
+
file,
|
|
84
|
+
sourcePath,
|
|
85
|
+
archivePath,
|
|
86
|
+
summaryPath: archivePath.replace(".jsonl", "-summary.txt"),
|
|
87
|
+
exchanges,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
// Batch summarize conversations in parallel (unless --no-summaries)
|
|
91
|
+
if (!noSummaries) {
|
|
92
|
+
const needsSummary = toProcess.filter((c) => shouldQueueForSummary(c.summaryPath));
|
|
93
|
+
if (needsSummary.length > 0) {
|
|
94
|
+
console.log(` Generating ${needsSummary.length} summaries (concurrency: ${concurrency})...`);
|
|
95
|
+
await processBatch(needsSummary, async (conv) => {
|
|
96
|
+
try {
|
|
97
|
+
const summary = await summarizeConversation(conv.exchanges, sessionIdForSummary(conv.exchanges));
|
|
98
|
+
fs.writeFileSync(conv.summaryPath, summary, "utf-8");
|
|
99
|
+
const wordCount = summary.split(/\s+/).length;
|
|
100
|
+
console.log(` ✓ ${conv.file}: ${wordCount} words`);
|
|
101
|
+
return summary;
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
// Write an error sentinel so the failure is retryable on a later run (#96).
|
|
105
|
+
try {
|
|
106
|
+
fs.writeFileSync(conv.summaryPath, formatErrorSentinel(error), "utf-8");
|
|
107
|
+
}
|
|
108
|
+
catch { }
|
|
109
|
+
console.log(` ✗ ${conv.file}: ${error}`);
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}, concurrency);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
console.log(` Skipping ${toProcess.length} summaries (--no-summaries mode)`);
|
|
117
|
+
}
|
|
118
|
+
// Now process embeddings and DB inserts (fast, sequential is fine)
|
|
119
|
+
for (const conv of toProcess) {
|
|
120
|
+
for (const exchange of conv.exchanges) {
|
|
121
|
+
const toolNames = exchange.toolCalls?.map((tc) => tc.toolName);
|
|
122
|
+
const embedding = await generateExchangeEmbedding(exchange.userMessage, exchange.assistantMessage, toolNames);
|
|
123
|
+
insertExchange(db, exchange, embedding, toolNames);
|
|
124
|
+
}
|
|
125
|
+
totalExchanges += conv.exchanges.length;
|
|
126
|
+
conversationsProcessed++;
|
|
127
|
+
// Check if we hit the limit
|
|
128
|
+
if (maxConversations && conversationsProcessed >= maxConversations) {
|
|
129
|
+
console.log(`\nReached limit of ${maxConversations} conversations`);
|
|
130
|
+
db.close();
|
|
131
|
+
console.log(`✅ Indexing complete! Conversations: ${conversationsProcessed}, Exchanges: ${totalExchanges}`);
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
} // end sourceDir loop
|
|
137
|
+
db.close();
|
|
138
|
+
console.log(`\n✅ Indexing complete! Conversations: ${conversationsProcessed}, Exchanges: ${totalExchanges}`);
|
|
139
|
+
}
|
|
140
|
+
export async function indexSession(sessionId,
|
|
141
|
+
// Accepted for symmetry with indexConversations/indexUnprocessed; this path
|
|
142
|
+
// handles exactly one session, so there is nothing to parallelise.
|
|
143
|
+
_concurrency = 1, noSummaries = false) {
|
|
144
|
+
console.log(`Indexing session: ${sessionId}`);
|
|
145
|
+
// Find the conversation file for this session
|
|
146
|
+
const sourceDirs = getConversationSourceDirs();
|
|
147
|
+
const ARCHIVE_DIR = getArchiveDir();
|
|
148
|
+
const excludedProjects = getExcludedProjects();
|
|
149
|
+
const excludedDirSet = new Set(excludedProjects);
|
|
150
|
+
let found = false;
|
|
151
|
+
for (const sourceDir of sourceDirs) {
|
|
152
|
+
const projects = fs.readdirSync(sourceDir);
|
|
153
|
+
for (const project of projects) {
|
|
154
|
+
if (excludedProjects.includes(project))
|
|
155
|
+
continue;
|
|
156
|
+
const projectPath = path.join(sourceDir, project);
|
|
157
|
+
if (!fs.statSync(projectPath).isDirectory())
|
|
158
|
+
continue;
|
|
159
|
+
const files = findJsonlFiles(projectPath, excludedDirSet).filter((f) => f.includes(sessionId));
|
|
160
|
+
if (files.length > 0) {
|
|
161
|
+
const file = files[0];
|
|
162
|
+
if (!file)
|
|
163
|
+
continue;
|
|
164
|
+
found = true;
|
|
165
|
+
const sourcePath = path.join(projectPath, file);
|
|
166
|
+
const db = initDatabase();
|
|
167
|
+
await initEmbeddings();
|
|
168
|
+
const projectArchive = path.join(ARCHIVE_DIR, project);
|
|
169
|
+
fs.mkdirSync(projectArchive, { recursive: true });
|
|
170
|
+
const archivePath = path.join(projectArchive, file);
|
|
171
|
+
// Archive (ensure parent dirs exist for subagent files)
|
|
172
|
+
if (!fs.existsSync(archivePath)) {
|
|
173
|
+
fs.mkdirSync(path.dirname(archivePath), { recursive: true });
|
|
174
|
+
fs.copyFileSync(sourcePath, archivePath);
|
|
175
|
+
}
|
|
176
|
+
// Parse and summarize
|
|
177
|
+
const exchanges = await parseConversation(sourcePath, project, archivePath);
|
|
178
|
+
if (exchanges.length > 0) {
|
|
179
|
+
// Generate summary (unless --no-summaries)
|
|
180
|
+
const summaryPath = archivePath.replace(".jsonl", "-summary.txt");
|
|
181
|
+
if (!noSummaries && shouldQueueForSummary(summaryPath)) {
|
|
182
|
+
fs.mkdirSync(path.dirname(summaryPath), { recursive: true });
|
|
183
|
+
try {
|
|
184
|
+
const summary = await summarizeConversation(exchanges, sessionIdForSummary(exchanges));
|
|
185
|
+
fs.writeFileSync(summaryPath, summary, "utf-8");
|
|
186
|
+
console.log(`Summary: ${summary.split(/\s+/).length} words`);
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
// Write an error sentinel so the failure is retryable on a later run (#96).
|
|
190
|
+
try {
|
|
191
|
+
fs.writeFileSync(summaryPath, formatErrorSentinel(error), "utf-8");
|
|
192
|
+
}
|
|
193
|
+
catch { }
|
|
194
|
+
console.log(`Summary failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
// Index
|
|
198
|
+
for (const exchange of exchanges) {
|
|
199
|
+
const toolNames = exchange.toolCalls?.map((tc) => tc.toolName);
|
|
200
|
+
const embedding = await generateExchangeEmbedding(exchange.userMessage, exchange.assistantMessage, toolNames);
|
|
201
|
+
insertExchange(db, exchange, embedding, toolNames);
|
|
202
|
+
}
|
|
203
|
+
console.log(`✅ Indexed session ${sessionId}: ${exchanges.length} exchanges`);
|
|
204
|
+
}
|
|
205
|
+
db.close();
|
|
206
|
+
break;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (found)
|
|
210
|
+
break;
|
|
211
|
+
} // end sourceDir loop
|
|
212
|
+
if (!found) {
|
|
213
|
+
console.log(`Session ${sessionId} not found`);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
export async function indexUnprocessed(concurrency = 1, noSummaries = false) {
|
|
217
|
+
console.log("Finding unprocessed conversations...");
|
|
218
|
+
if (concurrency > 1)
|
|
219
|
+
console.log(`Concurrency: ${concurrency}`);
|
|
220
|
+
if (noSummaries)
|
|
221
|
+
console.log("⚠️ Running in no-summaries mode (skipping AI summaries)");
|
|
222
|
+
const db = initDatabase();
|
|
223
|
+
await initEmbeddings();
|
|
224
|
+
const sourceDirs = getConversationSourceDirs();
|
|
225
|
+
const ARCHIVE_DIR = getArchiveDir();
|
|
226
|
+
const excludedProjects = getExcludedProjects();
|
|
227
|
+
const excludedDirSet = new Set(excludedProjects);
|
|
228
|
+
const unprocessed = [];
|
|
229
|
+
// Collect all unprocessed conversations from all source dirs
|
|
230
|
+
for (const sourceDir of sourceDirs) {
|
|
231
|
+
const projects = fs.readdirSync(sourceDir);
|
|
232
|
+
for (const project of projects) {
|
|
233
|
+
if (excludedProjects.includes(project))
|
|
234
|
+
continue;
|
|
235
|
+
const projectPath = path.join(sourceDir, project);
|
|
236
|
+
if (!fs.statSync(projectPath).isDirectory())
|
|
237
|
+
continue;
|
|
238
|
+
const files = findJsonlFiles(projectPath, excludedDirSet);
|
|
239
|
+
for (const file of files) {
|
|
240
|
+
const sourcePath = path.join(projectPath, file);
|
|
241
|
+
const projectArchive = path.join(ARCHIVE_DIR, project);
|
|
242
|
+
const archivePath = path.join(projectArchive, file);
|
|
243
|
+
const summaryPath = archivePath.replace(".jsonl", "-summary.txt");
|
|
244
|
+
// High-water mark: index exchanges past the last line we've already covered.
|
|
245
|
+
// Transcript JSONLs are append-only, so MAX(line_end) tells us where to resume.
|
|
246
|
+
const hw = db
|
|
247
|
+
.prepare("SELECT COALESCE(MAX(line_end), 0) as maxLine FROM exchanges WHERE archive_path = ?")
|
|
248
|
+
.get(archivePath);
|
|
249
|
+
const maxIndexedLine = hw.maxLine;
|
|
250
|
+
// Ensure parent dirs exist for subagent files
|
|
251
|
+
fs.mkdirSync(path.dirname(archivePath), { recursive: true });
|
|
252
|
+
// Refresh the archive when the source may have grown beyond what we've seen.
|
|
253
|
+
if (!fs.existsSync(archivePath) || maxIndexedLine > 0) {
|
|
254
|
+
fs.copyFileSync(sourcePath, archivePath);
|
|
255
|
+
}
|
|
256
|
+
// Parse and filter to exchanges past the high-water mark
|
|
257
|
+
const exchanges = await parseConversation(sourcePath, project, archivePath);
|
|
258
|
+
const newExchanges = maxIndexedLine > 0 ? exchanges.filter((e) => e.lineStart > maxIndexedLine) : exchanges;
|
|
259
|
+
if (newExchanges.length === 0)
|
|
260
|
+
continue;
|
|
261
|
+
unprocessed.push({
|
|
262
|
+
project,
|
|
263
|
+
file,
|
|
264
|
+
sourcePath,
|
|
265
|
+
archivePath,
|
|
266
|
+
summaryPath,
|
|
267
|
+
exchanges: newExchanges,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
} // end sourceDir loop
|
|
272
|
+
if (unprocessed.length === 0) {
|
|
273
|
+
console.log("✅ All conversations are already processed!");
|
|
274
|
+
db.close();
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
console.log(`Found ${unprocessed.length} unprocessed conversations`);
|
|
278
|
+
// Batch process summaries (unless --no-summaries)
|
|
279
|
+
if (!noSummaries) {
|
|
280
|
+
const needsSummary = unprocessed.filter((c) => shouldQueueForSummary(c.summaryPath));
|
|
281
|
+
if (needsSummary.length > 0) {
|
|
282
|
+
console.log(`Generating ${needsSummary.length} summaries (concurrency: ${concurrency})...\n`);
|
|
283
|
+
await processBatch(needsSummary, async (conv) => {
|
|
284
|
+
try {
|
|
285
|
+
const summary = await summarizeConversation(conv.exchanges, sessionIdForSummary(conv.exchanges));
|
|
286
|
+
fs.writeFileSync(conv.summaryPath, summary, "utf-8");
|
|
287
|
+
const wordCount = summary.split(/\s+/).length;
|
|
288
|
+
console.log(` ✓ ${conv.project}/${conv.file}: ${wordCount} words`);
|
|
289
|
+
return summary;
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
// Write an error sentinel so the failure is retryable on a later run (#96).
|
|
293
|
+
try {
|
|
294
|
+
fs.writeFileSync(conv.summaryPath, formatErrorSentinel(error), "utf-8");
|
|
295
|
+
}
|
|
296
|
+
catch { }
|
|
297
|
+
console.log(` ✗ ${conv.project}/${conv.file}: ${error}`);
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
}, concurrency);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
else {
|
|
304
|
+
console.log(`Skipping summaries for ${unprocessed.length} conversations (--no-summaries mode)\n`);
|
|
305
|
+
}
|
|
306
|
+
// Now index embeddings
|
|
307
|
+
console.log(`\nIndexing embeddings...`);
|
|
308
|
+
for (const conv of unprocessed) {
|
|
309
|
+
for (const exchange of conv.exchanges) {
|
|
310
|
+
const toolNames = exchange.toolCalls?.map((tc) => tc.toolName);
|
|
311
|
+
const embedding = await generateExchangeEmbedding(exchange.userMessage, exchange.assistantMessage, toolNames);
|
|
312
|
+
insertExchange(db, exchange, embedding, toolNames);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
db.close();
|
|
316
|
+
console.log(`\n✅ Processed ${unprocessed.length} conversations`);
|
|
317
|
+
}
|
|
318
|
+
//# sourceMappingURL=indexer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexer.js","sourceRoot":"","sources":["../src/indexer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EACL,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAGnF,4DAA4D;AAC5D,OAAO,CAAC,GAAG,CAAC,6BAA6B,GAAG,OAAO,CAAC;AAEpD,kDAAkD;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,YAAY,CAAC,mBAAmB,GAAG,EAAE,CAAC;AAEtC,oDAAoD;AACpD,KAAK,UAAU,YAAY,CACzB,KAAU,EACV,SAAkC,EAClC,WAAmB;IAEnB,MAAM,OAAO,GAAQ,EAAE,CAAC;IAExB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,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AAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACtC,MAAM,SAAS,GAAG,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC;YAC/D,MAAM,SAAS,GAAG,MAAM,yBAAyB,CAC/C,QAAQ,CAAC,WAAW,EACpB,QAAQ,CAAC,gBAAgB,EACzB,SAAS,CACV,CAAC;YACF,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,EAAE,CAAC,KAAK,EAAE,CAAC;IACX,OAAO,CAAC,GAAG,CAAC,iBAAiB,WAAW,CAAC,MAAM,gBAAgB,CAAC,CAAC;AACnE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime dependency health check.
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ This module used to be able to run `npm install`. It cannot any more, and
|
|
5
|
+
* that is the point.
|
|
6
|
+
*
|
|
7
|
+
* Upstream, `cli/mcp-server-wrapper.js` probed `<pluginRoot>/node_modules/<pkg>/package.json`
|
|
8
|
+
* for six packages and, if any were missing, shelled out to
|
|
9
|
+
* `npm install --no-audit --no-fund` with `cwd: pluginRoot`. Two things break
|
|
10
|
+
* that here:
|
|
11
|
+
*
|
|
12
|
+
* 1. **pnpm's node_modules is not flat.** A workspace package's dependencies are
|
|
13
|
+
* symlinks into `.pnpm/`, and a transitive dependency is not present at the
|
|
14
|
+
* package root at all. The path probe therefore reports missing packages that
|
|
15
|
+
* are perfectly resolvable.
|
|
16
|
+
* 2. **`onnxruntime-node` was on the required list and is not a declared
|
|
17
|
+
* dependency.** It arrives as an optional dependency of
|
|
18
|
+
* `@huggingface/transformers`, which resolves it from its own tree. Probing
|
|
19
|
+
* for it at our root returns a false positive on EVERY server start — which,
|
|
20
|
+
* upstream, meant every start shelled out to npm inside a pnpm workspace.
|
|
21
|
+
*
|
|
22
|
+
* So: resolve, don't path-probe; and diagnose, don't install. If something is
|
|
23
|
+
* genuinely unresolvable the operator gets one clear line telling them to run
|
|
24
|
+
* `pnpm install`, and the server exits rather than mutating the tree underneath
|
|
25
|
+
* itself.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* Declared runtime dependencies the server cannot start without.
|
|
29
|
+
*
|
|
30
|
+
* Excludes `onnxruntime-node` and `sharp`: both are transitive, optional and
|
|
31
|
+
* platform-specific, resolved by `@huggingface/transformers` from its own tree,
|
|
32
|
+
* and it reports its own error if a backend is unavailable.
|
|
33
|
+
*/
|
|
34
|
+
export declare const REQUIRED_PACKAGES: readonly ["@anthropic-ai/claude-agent-sdk", "@huggingface/transformers", "@modelcontextprotocol/sdk", "better-sqlite3", "marked", "proper-lockfile", "sqlite-vec", "zod"];
|
|
35
|
+
export type PackageResolver = (specifier: string) => boolean;
|
|
36
|
+
/** Default resolver: can Node resolve this package from this module? */
|
|
37
|
+
export declare const defaultResolver: PackageResolver;
|
|
38
|
+
/**
|
|
39
|
+
* Return the required packages that cannot be resolved. An empty array means the
|
|
40
|
+
* install looks complete.
|
|
41
|
+
*/
|
|
42
|
+
export declare function findMissingDeps(resolver?: PackageResolver): string[];
|
|
43
|
+
/**
|
|
44
|
+
* Print a diagnostic and return false when a required package is unresolvable.
|
|
45
|
+
* Never installs anything.
|
|
46
|
+
*/
|
|
47
|
+
export declare function reportMissingDeps(resolver?: PackageResolver): boolean;
|
|
48
|
+
//# sourceMappingURL=install-check.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-check.d.ts","sourceRoot":"","sources":["../src/install-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,2KASpB,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;AAI7D,wEAAwE;AACxE,eAAO,MAAM,eAAe,EAAE,eAa7B,CAAC;AAEF;;;GAGG;AACH,wBAAgB,eAAe,CAAC,QAAQ,GAAE,eAAiC,GAAG,MAAM,EAAE,CAErF;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,GAAE,eAAiC,GAAG,OAAO,CAMtF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime dependency health check.
|
|
3
|
+
*
|
|
4
|
+
* ⚠️ This module used to be able to run `npm install`. It cannot any more, and
|
|
5
|
+
* that is the point.
|
|
6
|
+
*
|
|
7
|
+
* Upstream, `cli/mcp-server-wrapper.js` probed `<pluginRoot>/node_modules/<pkg>/package.json`
|
|
8
|
+
* for six packages and, if any were missing, shelled out to
|
|
9
|
+
* `npm install --no-audit --no-fund` with `cwd: pluginRoot`. Two things break
|
|
10
|
+
* that here:
|
|
11
|
+
*
|
|
12
|
+
* 1. **pnpm's node_modules is not flat.** A workspace package's dependencies are
|
|
13
|
+
* symlinks into `.pnpm/`, and a transitive dependency is not present at the
|
|
14
|
+
* package root at all. The path probe therefore reports missing packages that
|
|
15
|
+
* are perfectly resolvable.
|
|
16
|
+
* 2. **`onnxruntime-node` was on the required list and is not a declared
|
|
17
|
+
* dependency.** It arrives as an optional dependency of
|
|
18
|
+
* `@huggingface/transformers`, which resolves it from its own tree. Probing
|
|
19
|
+
* for it at our root returns a false positive on EVERY server start — which,
|
|
20
|
+
* upstream, meant every start shelled out to npm inside a pnpm workspace.
|
|
21
|
+
*
|
|
22
|
+
* So: resolve, don't path-probe; and diagnose, don't install. If something is
|
|
23
|
+
* genuinely unresolvable the operator gets one clear line telling them to run
|
|
24
|
+
* `pnpm install`, and the server exits rather than mutating the tree underneath
|
|
25
|
+
* itself.
|
|
26
|
+
*/
|
|
27
|
+
import { createRequire } from "node:module";
|
|
28
|
+
/**
|
|
29
|
+
* Declared runtime dependencies the server cannot start without.
|
|
30
|
+
*
|
|
31
|
+
* Excludes `onnxruntime-node` and `sharp`: both are transitive, optional and
|
|
32
|
+
* platform-specific, resolved by `@huggingface/transformers` from its own tree,
|
|
33
|
+
* and it reports its own error if a backend is unavailable.
|
|
34
|
+
*/
|
|
35
|
+
export const REQUIRED_PACKAGES = [
|
|
36
|
+
"@anthropic-ai/claude-agent-sdk",
|
|
37
|
+
"@huggingface/transformers",
|
|
38
|
+
"@modelcontextprotocol/sdk",
|
|
39
|
+
"better-sqlite3",
|
|
40
|
+
"marked",
|
|
41
|
+
"proper-lockfile",
|
|
42
|
+
"sqlite-vec",
|
|
43
|
+
"zod",
|
|
44
|
+
];
|
|
45
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
46
|
+
/** Default resolver: can Node resolve this package from this module? */
|
|
47
|
+
export const defaultResolver = (specifier) => {
|
|
48
|
+
try {
|
|
49
|
+
requireFromHere.resolve(specifier);
|
|
50
|
+
return true;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// A package with no CJS entry point still resolves through its manifest.
|
|
54
|
+
try {
|
|
55
|
+
requireFromHere.resolve(`${specifier}/package.json`);
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
catch {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Return the required packages that cannot be resolved. An empty array means the
|
|
65
|
+
* install looks complete.
|
|
66
|
+
*/
|
|
67
|
+
export function findMissingDeps(resolver = defaultResolver) {
|
|
68
|
+
return REQUIRED_PACKAGES.filter((pkg) => !resolver(pkg));
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Print a diagnostic and return false when a required package is unresolvable.
|
|
72
|
+
* Never installs anything.
|
|
73
|
+
*/
|
|
74
|
+
export function reportMissingDeps(resolver = defaultResolver) {
|
|
75
|
+
const missing = findMissingDeps(resolver);
|
|
76
|
+
if (missing.length === 0)
|
|
77
|
+
return true;
|
|
78
|
+
console.error(`moe-memory: cannot resolve required packages: ${missing.join(", ")}`);
|
|
79
|
+
console.error("moe-memory: run `pnpm install` at the workspace root and retry.");
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=install-check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-check.js","sourceRoot":"","sources":["../src/install-check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gCAAgC;IAChC,2BAA2B;IAC3B,2BAA2B;IAC3B,gBAAgB;IAChB,QAAQ;IACR,iBAAiB;IACjB,YAAY;IACZ,KAAK;CACG,CAAC;AAIX,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAEvD,wEAAwE;AACxE,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,SAAS,EAAE,EAAE;IAC5D,IAAI,CAAC;QACH,eAAe,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,yEAAyE;QACzE,IAAI,CAAC;YACH,eAAe,CAAC,OAAO,CAAC,GAAG,SAAS,eAAe,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,WAA4B,eAAe;IACzE,OAAO,iBAAiB,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,WAA4B,eAAe;IAC3E,MAAM,OAAO,GAAG,eAAe,CAAC,QAAQ,CAAC,CAAC;IAC1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACtC,OAAO,CAAC,KAAK,CAAC,iDAAiD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrF,OAAO,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACjF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/journal/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/journal/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-way importer for private-journal-mcp's `.embedding` sidecars.
|
|
3
|
+
*
|
|
4
|
+
* Upstream wrote, beside every `<entry>.md`, an `<entry>.embedding` JSON file:
|
|
5
|
+
*
|
|
6
|
+
* { embedding: number[], text: string, sections: string[], timestamp: number, path: string }
|
|
7
|
+
*
|
|
8
|
+
* Two reasons that data cannot simply be loaded into the new index:
|
|
9
|
+
*
|
|
10
|
+
* 1. **The vectors are from a different encoder.** Sidecars were produced by
|
|
11
|
+
* `Xenova/all-MiniLM-L6-v2`; this package embeds with `Xenova/bge-small-en-v1.5`
|
|
12
|
+
* at dtype q8 and an asymmetric query prefix. Both are 384-dimensional, so a
|
|
13
|
+
* vec0 column accepts either without complaint and a mixed corpus ranks
|
|
14
|
+
* wrongly with no error. So the sidecar's `embedding` array is DISCARDED and
|
|
15
|
+
* the entry is re-embedded from its markdown.
|
|
16
|
+
* 2. **`path` was baked in absolute.** Upstream's search returned the path stored
|
|
17
|
+
* inside the JSON rather than the path it had just walked, so renaming the
|
|
18
|
+
* journal directory produced results that `read_journal_entry` then refused.
|
|
19
|
+
* So the sidecar's `path` is DISCARDED too, and the walk decides.
|
|
20
|
+
*
|
|
21
|
+
* Which leaves nothing worth importing from the sidecar itself. What this
|
|
22
|
+
* function actually does is find the orphans — `.md` files with a sidecar whose
|
|
23
|
+
* day-directory is not where the new layout expects it — and, mainly, delete the
|
|
24
|
+
* sidecars once the entry is indexed, so the old and new indexes cannot drift.
|
|
25
|
+
*
|
|
26
|
+
* It is opt-in (`moe-memory journal import-legacy`) and never runs on its own:
|
|
27
|
+
* deleting a file the user might still want read by an upstream install is not
|
|
28
|
+
* something to do silently.
|
|
29
|
+
*
|
|
30
|
+
* FIXED: it searched only the CURRENT roots. The command exists because the
|
|
31
|
+
* paths moved on import — `<project>/.private-journal` → `<project>/.moe-journal`
|
|
32
|
+
* and `~/.private-journal` → `<data dir>/journal` — so on any install that had
|
|
33
|
+
* not already hand-copied its journal across, it walked exactly the two
|
|
34
|
+
* directories the sidecars provably are not in, found nothing, and printed
|
|
35
|
+
* "Legacy .embedding sidecars found: 0". Indistinguishable from success. It now
|
|
36
|
+
* also surveys the upstream directories (`findLegacyJournalRoots`) and reports
|
|
37
|
+
* them in `legacy`, so the caller can tell the user their data is over there.
|
|
38
|
+
*
|
|
39
|
+
* It reports rather than migrates, deliberately, matching `findLegacyDataDir`.
|
|
40
|
+
* Journal entries are private reflections; quietly relocating them is worse
|
|
41
|
+
* than quietly relocating a conversation archive, and that was already judged
|
|
42
|
+
* too much to do behind someone's back.
|
|
43
|
+
*/
|
|
44
|
+
import type Database from "better-sqlite3";
|
|
45
|
+
import type { JournalStore } from "./store.js";
|
|
46
|
+
export interface LegacyImportResult {
|
|
47
|
+
/** Sidecars found on disk. */
|
|
48
|
+
found: number;
|
|
49
|
+
/** Sidecars whose entry is now present in the SQLite index. */
|
|
50
|
+
indexed: number;
|
|
51
|
+
/** Sidecars deleted (only when `remove` is set and the entry is indexed). */
|
|
52
|
+
removed: number;
|
|
53
|
+
/** Sidecars with no surviving `.md` beside them. */
|
|
54
|
+
orphaned: string[];
|
|
55
|
+
/**
|
|
56
|
+
* Upstream journal directories that exist but are NOT being walked, with what
|
|
57
|
+
* is sitting in them.
|
|
58
|
+
*
|
|
59
|
+
* Empty is the normal case. Non-empty means this command cannot do its job
|
|
60
|
+
* yet: the paths moved on import (`.private-journal` → `.moe-journal`,
|
|
61
|
+
* `~/.private-journal` → `<data dir>/journal`), so the sidecars are still
|
|
62
|
+
* over there and nothing here can see them. Reported rather than migrated —
|
|
63
|
+
* see `findLegacyJournalRoots`.
|
|
64
|
+
*/
|
|
65
|
+
legacy: Array<{
|
|
66
|
+
root: string;
|
|
67
|
+
entries: number;
|
|
68
|
+
sidecars: number;
|
|
69
|
+
}>;
|
|
70
|
+
}
|
|
71
|
+
export declare function importLegacyJournalSidecars(db: Database.Database, store: JournalStore, options?: {
|
|
72
|
+
remove?: boolean;
|
|
73
|
+
}): Promise<LegacyImportResult>;
|
|
74
|
+
//# sourceMappingURL=legacy-sidecars.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-sidecars.d.ts","sourceRoot":"","sources":["../../src/journal/legacy-sidecars.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAIH,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAI3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,6EAA6E;IAC7E,OAAO,EAAE,MAAM,CAAC;IAChB,oDAAoD;IACpD,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;;;;OASG;IACH,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACpE;AA4BD,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,KAAK,EAAE,YAAY,EACnB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAO,GACjC,OAAO,CAAC,kBAAkB,CAAC,CA2E7B"}
|