mcp-local-rag 0.13.0 → 0.13.1
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/dist/index.js +0 -0
- package/dist/parser/html-parser.js +1 -1
- package/dist/parser/html-parser.js.map +1 -1
- package/package.json +14 -14
- package/dist/bin/ingest.d.ts +0 -53
- package/dist/bin/ingest.d.ts.map +0 -1
- package/dist/bin/ingest.js +0 -283
- package/dist/bin/ingest.js.map +0 -1
- package/dist/server/raw-data-utils.d.ts +0 -116
- package/dist/server/raw-data-utils.d.ts.map +0 -1
- package/dist/server/raw-data-utils.js +0 -202
- package/dist/server/raw-data-utils.js.map +0 -1
package/dist/index.js
CHANGED
|
File without changes
|
|
@@ -67,7 +67,7 @@ export async function parseHtml(html, url) {
|
|
|
67
67
|
});
|
|
68
68
|
const article = reader.parse();
|
|
69
69
|
// If Readability couldn't extract content, fall back to body text
|
|
70
|
-
if (!article
|
|
70
|
+
if (!article?.content) {
|
|
71
71
|
// Try to get body content directly
|
|
72
72
|
const bodyContent = document.body?.innerHTML || '';
|
|
73
73
|
if (!bodyContent.trim()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-parser.js","sourceRoot":"","sources":["../../src/parser/html-parser.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,2DAA2D;AAE3D,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAC7B,OAAO,eAAe,MAAM,UAAU,CAAA;AACtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAcvD,+CAA+C;AAC/C,iCAAiC;AACjC,+CAA+C;AAE/C;;GAEG;AACH,SAAS,qBAAqB;IAC5B,MAAM,eAAe,GAAG,IAAI,eAAe,CAAC;QAC1C,YAAY,EAAE,KAAK,EAAE,uBAAuB;QAC5C,cAAc,EAAE,QAAQ,EAAE,0BAA0B;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p-local-rag",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Local RAG MCP Server - Easy-to-setup document search with minimal configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -61,28 +61,28 @@
|
|
|
61
61
|
"prepare": "husky"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@huggingface/transformers": "^4.
|
|
65
|
-
"@lancedb/lancedb": "^0.
|
|
66
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
64
|
+
"@huggingface/transformers": "^4.2.0",
|
|
65
|
+
"@lancedb/lancedb": "^0.27.2",
|
|
66
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
67
67
|
"@mozilla/readability": "0.6.0",
|
|
68
|
-
"jsdom": "^
|
|
68
|
+
"jsdom": "^29.1.1",
|
|
69
69
|
"mammoth": "^1.12.0",
|
|
70
70
|
"mupdf": "^1.27.0",
|
|
71
|
-
"turndown": "7.2.
|
|
71
|
+
"turndown": "7.2.4"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@biomejs/biome": "^2.4.
|
|
75
|
-
"@types/jsdom": "^
|
|
76
|
-
"@types/node": "^25.
|
|
74
|
+
"@biomejs/biome": "^2.4.14",
|
|
75
|
+
"@types/jsdom": "^28.0.1",
|
|
76
|
+
"@types/node": "^25.6.0",
|
|
77
77
|
"@types/turndown": "5.0.6",
|
|
78
|
-
"husky": "^9.1.7",
|
|
79
|
-
"knip": "^6.1.0",
|
|
80
|
-
"lint-staged": "^16.3.2",
|
|
81
78
|
"dpdm": "^4.0.1",
|
|
82
|
-
"
|
|
79
|
+
"husky": "^9.1.7",
|
|
80
|
+
"knip": "^6.12.0",
|
|
81
|
+
"lint-staged": "^17.0.2",
|
|
82
|
+
"tsc-alias": "^1.8.17",
|
|
83
83
|
"tsx": "^4.21.0",
|
|
84
84
|
"typescript": "^5.9.3",
|
|
85
|
-
"vitest": "^4.1.
|
|
85
|
+
"vitest": "^4.1.5"
|
|
86
86
|
},
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=22"
|
package/dist/bin/ingest.d.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* MCP Local RAG CLI Ingest
|
|
3
|
-
*
|
|
4
|
-
* Ingest documents into the RAG vector database from the command line.
|
|
5
|
-
* Supports single files and directory traversal.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* npx mcp-local-rag ingest <file-or-dir> [options]
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* CLI options for ingest subcommand
|
|
12
|
-
*/
|
|
13
|
-
export interface Options {
|
|
14
|
-
/** Target path (file or directory) */
|
|
15
|
-
target: string | null;
|
|
16
|
-
/** Override DB_PATH env var */
|
|
17
|
-
dbPath: string | null;
|
|
18
|
-
/** Override MODEL_NAME env var */
|
|
19
|
-
modelName: string | null;
|
|
20
|
-
/** Override CACHE_DIR env var */
|
|
21
|
-
cacheDir: string | null;
|
|
22
|
-
/** Override BASE_DIR env var */
|
|
23
|
-
baseDir: string | null;
|
|
24
|
-
/** Override MAX_FILE_SIZE env var (bytes). Default: 104857600 (100MB) */
|
|
25
|
-
maxFileSize: number | null;
|
|
26
|
-
/** Show help */
|
|
27
|
-
help: boolean;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Summary of directory ingestion
|
|
31
|
-
*/
|
|
32
|
-
export interface DirectorySummary {
|
|
33
|
-
totalFiles: number;
|
|
34
|
-
successCount: number;
|
|
35
|
-
failureCount: number;
|
|
36
|
-
totalChunks: number;
|
|
37
|
-
elapsedMs: number;
|
|
38
|
-
results: Array<{
|
|
39
|
-
filePath: string;
|
|
40
|
-
chunkCount: number;
|
|
41
|
-
} | {
|
|
42
|
-
filePath: string;
|
|
43
|
-
error: string;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
export declare function parseArgs(args: string[]): Options;
|
|
47
|
-
export declare function printHelp(): void;
|
|
48
|
-
/**
|
|
49
|
-
* Run the ingest command with the given arguments
|
|
50
|
-
* @param args - Command line arguments (after "ingest" subcommand)
|
|
51
|
-
*/
|
|
52
|
-
export declare function run(args: string[]): Promise<void>;
|
|
53
|
-
//# sourceMappingURL=ingest.d.ts.map
|
package/dist/bin/ingest.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.d.ts","sourceRoot":"","sources":["../../src/bin/ingest.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,sCAAsC;IACtC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,+BAA+B;IAC/B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,kCAAkC;IAClC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,gCAAgC;IAChC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,yEAAyE;IACzE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,gBAAgB;IAChB,IAAI,EAAE,OAAO,CAAA;CACd;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;IACpB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,GAAG;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC/F;AAMD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAyEjD;AAMD,wBAAgB,SAAS,IAAI,IAAI,CAiChC;AAuDD;;;GAGG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CA4HvD"}
|
package/dist/bin/ingest.js
DELETED
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* MCP Local RAG CLI Ingest
|
|
4
|
-
*
|
|
5
|
-
* Ingest documents into the RAG vector database from the command line.
|
|
6
|
-
* Supports single files and directory traversal.
|
|
7
|
-
*
|
|
8
|
-
* Usage:
|
|
9
|
-
* npx mcp-local-rag ingest <file-or-dir> [options]
|
|
10
|
-
*/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.parseArgs = parseArgs;
|
|
13
|
-
exports.printHelp = printHelp;
|
|
14
|
-
exports.run = run;
|
|
15
|
-
const promises_1 = require("node:fs/promises");
|
|
16
|
-
const node_path_1 = require("node:path");
|
|
17
|
-
const index_js_1 = require("../parser/index.js");
|
|
18
|
-
const index_js_2 = require("../server/index.js");
|
|
19
|
-
// ============================================
|
|
20
|
-
// CLI Argument Parsing
|
|
21
|
-
// ============================================
|
|
22
|
-
function parseArgs(args) {
|
|
23
|
-
const options = {
|
|
24
|
-
target: null,
|
|
25
|
-
dbPath: null,
|
|
26
|
-
modelName: null,
|
|
27
|
-
cacheDir: null,
|
|
28
|
-
baseDir: null,
|
|
29
|
-
maxFileSize: null,
|
|
30
|
-
help: false,
|
|
31
|
-
};
|
|
32
|
-
for (let i = 0; i < args.length; i++) {
|
|
33
|
-
const arg = args[i];
|
|
34
|
-
switch (arg) {
|
|
35
|
-
case '--help':
|
|
36
|
-
case '-h':
|
|
37
|
-
options.help = true;
|
|
38
|
-
break;
|
|
39
|
-
case '--db-path': {
|
|
40
|
-
const value = args[i + 1];
|
|
41
|
-
if (value) {
|
|
42
|
-
options.dbPath = value;
|
|
43
|
-
i++;
|
|
44
|
-
}
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
case '--model-name': {
|
|
48
|
-
const value = args[i + 1];
|
|
49
|
-
if (value) {
|
|
50
|
-
options.modelName = value;
|
|
51
|
-
i++;
|
|
52
|
-
}
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
case '--cache-dir': {
|
|
56
|
-
const value = args[i + 1];
|
|
57
|
-
if (value) {
|
|
58
|
-
options.cacheDir = value;
|
|
59
|
-
i++;
|
|
60
|
-
}
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
case '--base-dir': {
|
|
64
|
-
const value = args[i + 1];
|
|
65
|
-
if (value) {
|
|
66
|
-
options.baseDir = value;
|
|
67
|
-
i++;
|
|
68
|
-
}
|
|
69
|
-
break;
|
|
70
|
-
}
|
|
71
|
-
case '--max-file-size': {
|
|
72
|
-
const value = args[i + 1];
|
|
73
|
-
if (value) {
|
|
74
|
-
options.maxFileSize = Number.parseInt(value, 10);
|
|
75
|
-
i++;
|
|
76
|
-
}
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
default:
|
|
80
|
-
if (arg && !arg.startsWith('-')) {
|
|
81
|
-
options.target = arg;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return options;
|
|
86
|
-
}
|
|
87
|
-
// ============================================
|
|
88
|
-
// Help Message
|
|
89
|
-
// ============================================
|
|
90
|
-
function printHelp() {
|
|
91
|
-
console.log(`
|
|
92
|
-
MCP Local RAG CLI Ingest
|
|
93
|
-
|
|
94
|
-
Usage:
|
|
95
|
-
npx mcp-local-rag ingest <file-or-dir> [options]
|
|
96
|
-
|
|
97
|
-
Options:
|
|
98
|
-
--db-path <path> Path to LanceDB database directory
|
|
99
|
-
(default: DB_PATH env var or ./lancedb/)
|
|
100
|
-
|
|
101
|
-
--model-name <name> Transformers.js model name
|
|
102
|
-
(default: MODEL_NAME env var or Xenova/all-MiniLM-L6-v2)
|
|
103
|
-
|
|
104
|
-
--cache-dir <path> Model cache directory
|
|
105
|
-
(default: CACHE_DIR env var or ./models/)
|
|
106
|
-
|
|
107
|
-
--base-dir <path> Document base directory for path validation
|
|
108
|
-
(default: BASE_DIR env var or parent of target path)
|
|
109
|
-
|
|
110
|
-
--max-file-size <bytes> Maximum file size in bytes
|
|
111
|
-
(default: MAX_FILE_SIZE env var or 104857600 (100MB))
|
|
112
|
-
|
|
113
|
-
--help, -h Show this help message
|
|
114
|
-
|
|
115
|
-
Supported file formats:
|
|
116
|
-
.pdf, .docx, .txt, .md
|
|
117
|
-
|
|
118
|
-
Examples:
|
|
119
|
-
npx mcp-local-rag ingest ./docs/guide.md
|
|
120
|
-
npx mcp-local-rag ingest ./documents/
|
|
121
|
-
npx mcp-local-rag ingest ./data --db-path ./my-db --base-dir ./data
|
|
122
|
-
`);
|
|
123
|
-
}
|
|
124
|
-
// ============================================
|
|
125
|
-
// Helper Functions
|
|
126
|
-
// ============================================
|
|
127
|
-
/**
|
|
128
|
-
* Recursively find files with supported extensions in a directory
|
|
129
|
-
* @param dirPath - Directory path to search
|
|
130
|
-
* @returns Array of absolute file paths with supported extensions
|
|
131
|
-
*/
|
|
132
|
-
async function findSupportedFiles(dirPath) {
|
|
133
|
-
const entries = await (0, promises_1.readdir)(dirPath, { recursive: true, withFileTypes: true });
|
|
134
|
-
return entries
|
|
135
|
-
.filter((entry) => entry.isFile() && index_js_1.SUPPORTED_EXTENSIONS.has((0, node_path_1.extname)(entry.name).toLowerCase()))
|
|
136
|
-
.map((entry) => {
|
|
137
|
-
// parentPath is the Node 21+ name; path is the deprecated Node 20 alias
|
|
138
|
-
// biome-ignore lint/suspicious/noExplicitAny: parentPath not yet in @types/node@20
|
|
139
|
-
const dir = entry.parentPath ?? entry.path;
|
|
140
|
-
return (0, node_path_1.join)(dir, entry.name);
|
|
141
|
-
})
|
|
142
|
-
.sort();
|
|
143
|
-
}
|
|
144
|
-
/**
|
|
145
|
-
* Ingest a single file using RAGServer and return the parsed result
|
|
146
|
-
* @param server - Initialized RAGServer instance
|
|
147
|
-
* @param filePath - Absolute file path to ingest
|
|
148
|
-
* @returns Parsed IngestResult from handleIngestFile response
|
|
149
|
-
*/
|
|
150
|
-
async function ingestSingleFile(server, filePath) {
|
|
151
|
-
const response = await server.handleIngestFile({ filePath });
|
|
152
|
-
const text = response.content[0].text;
|
|
153
|
-
return JSON.parse(text);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Format a single file ingestion result as human-readable text
|
|
157
|
-
* @param result - IngestResult from RAGServer
|
|
158
|
-
* @returns Formatted string for stdout output
|
|
159
|
-
*/
|
|
160
|
-
function formatResult(result) {
|
|
161
|
-
const lines = [` File: ${result.filePath}`, ` Chunks: ${result.chunkCount}`];
|
|
162
|
-
if (result.fileTitle) {
|
|
163
|
-
lines.push(` Title: ${result.fileTitle}`);
|
|
164
|
-
}
|
|
165
|
-
return lines.join('\n');
|
|
166
|
-
}
|
|
167
|
-
// ============================================
|
|
168
|
-
// Exported Run Function
|
|
169
|
-
// ============================================
|
|
170
|
-
/**
|
|
171
|
-
* Run the ingest command with the given arguments
|
|
172
|
-
* @param args - Command line arguments (after "ingest" subcommand)
|
|
173
|
-
*/
|
|
174
|
-
async function run(args) {
|
|
175
|
-
try {
|
|
176
|
-
const options = parseArgs(args);
|
|
177
|
-
// Handle help flag
|
|
178
|
-
if (options.help) {
|
|
179
|
-
printHelp();
|
|
180
|
-
process.exit(0);
|
|
181
|
-
}
|
|
182
|
-
// Handle no target
|
|
183
|
-
if (!options.target) {
|
|
184
|
-
printHelp();
|
|
185
|
-
process.exit(1);
|
|
186
|
-
}
|
|
187
|
-
// Resolve and validate target path
|
|
188
|
-
const targetPath = (0, node_path_1.resolve)(options.target);
|
|
189
|
-
const targetStat = await (0, promises_1.stat)(targetPath);
|
|
190
|
-
const isDirectory = targetStat.isDirectory();
|
|
191
|
-
// Build RAGServerConfig from env vars + CLI option overrides
|
|
192
|
-
const config = {
|
|
193
|
-
dbPath: options.dbPath ?? process.env['DB_PATH'] ?? './lancedb/',
|
|
194
|
-
modelName: options.modelName ?? process.env['MODEL_NAME'] ?? 'Xenova/all-MiniLM-L6-v2',
|
|
195
|
-
cacheDir: options.cacheDir ?? process.env['CACHE_DIR'] ?? './models/',
|
|
196
|
-
baseDir: options.baseDir ??
|
|
197
|
-
process.env['BASE_DIR'] ??
|
|
198
|
-
(isDirectory ? targetPath : (0, node_path_1.resolve)(targetPath, '..')),
|
|
199
|
-
maxFileSize: options.maxFileSize ?? Number.parseInt(process.env['MAX_FILE_SIZE'] ?? '104857600', 10),
|
|
200
|
-
};
|
|
201
|
-
// Initialize RAGServer
|
|
202
|
-
const ragServer = new index_js_2.RAGServer(config);
|
|
203
|
-
await ragServer.initialize();
|
|
204
|
-
if (isDirectory) {
|
|
205
|
-
// Directory ingestion flow
|
|
206
|
-
const files = await findSupportedFiles(targetPath);
|
|
207
|
-
if (files.length === 0) {
|
|
208
|
-
console.log(`No supported files found in: ${targetPath}\nSupported formats: ${[...index_js_1.SUPPORTED_EXTENSIONS].join(', ')}`);
|
|
209
|
-
process.exit(1);
|
|
210
|
-
}
|
|
211
|
-
const startTime = Date.now();
|
|
212
|
-
const summary = {
|
|
213
|
-
totalFiles: files.length,
|
|
214
|
-
successCount: 0,
|
|
215
|
-
failureCount: 0,
|
|
216
|
-
totalChunks: 0,
|
|
217
|
-
elapsedMs: 0,
|
|
218
|
-
results: [],
|
|
219
|
-
};
|
|
220
|
-
for (const filePath of files) {
|
|
221
|
-
try {
|
|
222
|
-
const result = await ingestSingleFile(ragServer, filePath);
|
|
223
|
-
summary.successCount++;
|
|
224
|
-
summary.totalChunks += result.chunkCount;
|
|
225
|
-
summary.results.push({ filePath: result.filePath, chunkCount: result.chunkCount });
|
|
226
|
-
console.log(`OK: ${filePath} (${result.chunkCount} chunks)`);
|
|
227
|
-
}
|
|
228
|
-
catch (fileError) {
|
|
229
|
-
summary.failureCount++;
|
|
230
|
-
const errorMessage = fileError instanceof Error ? fileError.message : String(fileError);
|
|
231
|
-
summary.results.push({ filePath, error: errorMessage });
|
|
232
|
-
console.error(`FAIL: ${filePath} - ${errorMessage}`);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
summary.elapsedMs = Date.now() - startTime;
|
|
236
|
-
// Print summary
|
|
237
|
-
console.log('\n--- Ingestion Summary ---');
|
|
238
|
-
console.log(`Total files: ${summary.totalFiles}`);
|
|
239
|
-
console.log(`Succeeded: ${summary.successCount}`);
|
|
240
|
-
console.log(`Failed: ${summary.failureCount}`);
|
|
241
|
-
console.log(`Total chunks: ${summary.totalChunks}`);
|
|
242
|
-
console.log(`Elapsed: ${summary.elapsedMs}ms`);
|
|
243
|
-
process.exit(summary.failureCount > 0 ? 1 : 0);
|
|
244
|
-
}
|
|
245
|
-
else {
|
|
246
|
-
// Single file ingestion flow
|
|
247
|
-
const ext = (0, node_path_1.extname)(targetPath).toLowerCase();
|
|
248
|
-
if (!index_js_1.SUPPORTED_EXTENSIONS.has(ext)) {
|
|
249
|
-
console.error(`Error: Unsupported file format: ${ext}\nSupported formats: ${[...index_js_1.SUPPORTED_EXTENSIONS].join(', ')}`);
|
|
250
|
-
process.exit(1);
|
|
251
|
-
}
|
|
252
|
-
const result = await ingestSingleFile(ragServer, targetPath);
|
|
253
|
-
console.log('Ingestion complete:');
|
|
254
|
-
console.log(formatResult(result));
|
|
255
|
-
process.exit(0);
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
catch (error) {
|
|
259
|
-
// Handle specific error types
|
|
260
|
-
if (error instanceof Error && 'code' in error) {
|
|
261
|
-
const code = error.code;
|
|
262
|
-
if (code === 'ENOENT') {
|
|
263
|
-
const path = error.path ?? '';
|
|
264
|
-
console.error(`Error: Path not found: ${path}`);
|
|
265
|
-
process.exit(1);
|
|
266
|
-
}
|
|
267
|
-
if (code === 'EACCES') {
|
|
268
|
-
const path = error.path ?? '';
|
|
269
|
-
console.error(`Error: Permission denied: ${path}`);
|
|
270
|
-
process.exit(1);
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
// Handle generic errors (including McpError)
|
|
274
|
-
if (error instanceof Error) {
|
|
275
|
-
console.error(`Error: ${error.message}`);
|
|
276
|
-
}
|
|
277
|
-
else {
|
|
278
|
-
console.error(`Error: ${String(error)}`);
|
|
279
|
-
}
|
|
280
|
-
process.exit(1);
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
//# sourceMappingURL=ingest.js.map
|
package/dist/bin/ingest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ingest.js","sourceRoot":"","sources":["../../src/bin/ingest.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAgDH,8BAyEC;AAMD,8BAiCC;AA2DD,kBA4HC;AArVD,+CAAgD;AAChD,yCAAkD;AAClD,iDAAyD;AACzD,iDAA8C;AAuC9C,+CAA+C;AAC/C,uBAAuB;AACvB,+CAA+C;AAE/C,SAAgB,SAAS,CAAC,IAAc;IACtC,MAAM,OAAO,GAAY;QACvB,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI;QACf,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,IAAI;QACb,WAAW,EAAE,IAAI;QACjB,IAAI,EAAE,KAAK;KACZ,CAAA;IAED,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QAEnB,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,QAAQ,CAAC;YACd,KAAK,IAAI;gBACP,OAAO,CAAC,IAAI,GAAG,IAAI,CAAA;gBACnB,MAAK;YAEP,KAAK,WAAW,CAAC,CAAC,CAAC;gBACjB,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;gBACzB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,EAAE,CAAC;gBACtB,MAAM,IAAI,GAAI,KAA+B,CAAC,IAAI,IAAI,EAAE,CAAA;gBACxD,OAAO,CAAC,KAAK,CAAC,6BAA6B,IAAI,EAAE,CAAC,CAAA;gBAClD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YACjB,CAAC;QACH,CAAC;QAED,6CAA6C;QAC7C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC1C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QAC1C,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC"}
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Encode string to URL-safe base64 (base64url)
|
|
3
|
-
* - Replaces + with -
|
|
4
|
-
* - Replaces / with _
|
|
5
|
-
* - Removes padding (=)
|
|
6
|
-
*
|
|
7
|
-
* @param str - String to encode
|
|
8
|
-
* @returns URL-safe base64 encoded string
|
|
9
|
-
*/
|
|
10
|
-
export declare function encodeBase64Url(str: string): string;
|
|
11
|
-
/**
|
|
12
|
-
* Decode URL-safe base64 (base64url) to string
|
|
13
|
-
*
|
|
14
|
-
* @param base64url - URL-safe base64 encoded string
|
|
15
|
-
* @returns Decoded string
|
|
16
|
-
*/
|
|
17
|
-
export declare function decodeBase64Url(base64url: string): string;
|
|
18
|
-
/**
|
|
19
|
-
* Normalize source URL by removing query string and fragment
|
|
20
|
-
* Only normalizes HTTP(S) URLs. Other sources (e.g., "clipboard://...") are returned as-is
|
|
21
|
-
*
|
|
22
|
-
* @param source - Source identifier (URL or custom ID)
|
|
23
|
-
* @returns Normalized source
|
|
24
|
-
*/
|
|
25
|
-
export declare function normalizeSource(source: string): string;
|
|
26
|
-
/**
|
|
27
|
-
* Content format type for ingest_data
|
|
28
|
-
*/
|
|
29
|
-
export type ContentFormat = 'text' | 'html' | 'markdown';
|
|
30
|
-
/**
|
|
31
|
-
* Get file extension from content format
|
|
32
|
-
*
|
|
33
|
-
* All formats return .md for consistency.
|
|
34
|
-
* This allows generating unique path from source without knowing original format,
|
|
35
|
-
* which is essential for delete_file with source parameter.
|
|
36
|
-
*
|
|
37
|
-
* @param _format - Content format (ignored, always returns 'md')
|
|
38
|
-
* @returns File extension (without dot) - always 'md'
|
|
39
|
-
*/
|
|
40
|
-
export declare function formatToExtension(_format: ContentFormat): string;
|
|
41
|
-
/**
|
|
42
|
-
* Get raw-data directory path
|
|
43
|
-
*
|
|
44
|
-
* @param dbPath - LanceDB database path
|
|
45
|
-
* @returns Raw-data directory path
|
|
46
|
-
*/
|
|
47
|
-
export declare function getRawDataDir(dbPath: string): string;
|
|
48
|
-
/**
|
|
49
|
-
* Generate raw-data file path from source and format
|
|
50
|
-
* Path format: {dbPath}/raw-data/{base64url(normalizedSource)}.{ext}
|
|
51
|
-
*
|
|
52
|
-
* @param dbPath - LanceDB database path
|
|
53
|
-
* @param source - Source identifier (URL or custom ID)
|
|
54
|
-
* @param format - Content format
|
|
55
|
-
* @returns Generated file path
|
|
56
|
-
*/
|
|
57
|
-
export declare function generateRawDataPath(dbPath: string, source: string, format: ContentFormat): string;
|
|
58
|
-
/**
|
|
59
|
-
* Save content to raw-data directory
|
|
60
|
-
* Creates directory if it doesn't exist
|
|
61
|
-
*
|
|
62
|
-
* @param dbPath - LanceDB database path
|
|
63
|
-
* @param source - Source identifier (URL or custom ID)
|
|
64
|
-
* @param content - Content to save
|
|
65
|
-
* @param format - Content format
|
|
66
|
-
* @returns Saved file path
|
|
67
|
-
*/
|
|
68
|
-
export declare function saveRawData(dbPath: string, source: string, content: string, format: ContentFormat): Promise<string>;
|
|
69
|
-
/**
|
|
70
|
-
* Check if file path is in raw-data directory
|
|
71
|
-
*
|
|
72
|
-
* @param filePath - File path to check
|
|
73
|
-
* @returns True if path is in raw-data directory
|
|
74
|
-
*/
|
|
75
|
-
export declare function isRawDataPath(filePath: string): boolean;
|
|
76
|
-
/**
|
|
77
|
-
* Extract original source from raw-data file path
|
|
78
|
-
* Returns null if not a raw-data path
|
|
79
|
-
*
|
|
80
|
-
* @param filePath - Raw-data file path
|
|
81
|
-
* @returns Original source or null
|
|
82
|
-
*/
|
|
83
|
-
export declare function extractSourceFromPath(filePath: string): string | null;
|
|
84
|
-
/**
|
|
85
|
-
* Metadata stored alongside each raw-data .md file as a .meta.json sidecar
|
|
86
|
-
*/
|
|
87
|
-
export interface RawDataMeta {
|
|
88
|
-
title: string | null;
|
|
89
|
-
source: string;
|
|
90
|
-
format: ContentFormat;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Generate the .meta.json sidecar path for a given .md file path
|
|
94
|
-
* Replaces the trailing `.md` extension with `.meta.json`
|
|
95
|
-
*
|
|
96
|
-
* @param mdPath - Path to the .md raw-data file
|
|
97
|
-
* @returns Path to the corresponding .meta.json file
|
|
98
|
-
*/
|
|
99
|
-
export declare function generateMetaJsonPath(mdPath: string): string;
|
|
100
|
-
/**
|
|
101
|
-
* Save metadata as a JSON sidecar file alongside a raw-data .md file
|
|
102
|
-
*
|
|
103
|
-
* @param mdPath - Path to the .md raw-data file
|
|
104
|
-
* @param meta - Metadata to persist
|
|
105
|
-
*/
|
|
106
|
-
export declare function saveMetaJson(mdPath: string, meta: RawDataMeta): Promise<void>;
|
|
107
|
-
/**
|
|
108
|
-
* Load metadata from a .meta.json sidecar file
|
|
109
|
-
* Returns null when the sidecar file does not exist (ENOENT).
|
|
110
|
-
* All other read errors are re-thrown (fail-fast).
|
|
111
|
-
*
|
|
112
|
-
* @param mdPath - Path to the .md raw-data file
|
|
113
|
-
* @returns Parsed metadata or null if file does not exist
|
|
114
|
-
*/
|
|
115
|
-
export declare function loadMetaJson(mdPath: string): Promise<RawDataMeta | null>;
|
|
116
|
-
//# sourceMappingURL=raw-data-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw-data-utils.d.ts","sourceRoot":"","sources":["../../src/server/raw-data-utils.ts"],"names":[],"mappings":"AAUA;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAMnD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAUzD;AAMD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAatD;AAMD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,CAAA;AAExD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CAEhE;AAMD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,CAMjG;AAMD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAMD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEvD;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiBrE;AAMD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,aAAa,CAAA;CACtB;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE3D;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAGnF;AAED;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAe9E"}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
// Raw Data Utilities for ingest_data tool
|
|
2
|
-
// Handles: base64url encoding, source normalization, file saving, source extraction
|
|
3
|
-
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
4
|
-
import { dirname, join, resolve } from 'node:path';
|
|
5
|
-
// ============================================
|
|
6
|
-
// Base64URL Encoding/Decoding
|
|
7
|
-
// ============================================
|
|
8
|
-
/**
|
|
9
|
-
* Encode string to URL-safe base64 (base64url)
|
|
10
|
-
* - Replaces + with -
|
|
11
|
-
* - Replaces / with _
|
|
12
|
-
* - Removes padding (=)
|
|
13
|
-
*
|
|
14
|
-
* @param str - String to encode
|
|
15
|
-
* @returns URL-safe base64 encoded string
|
|
16
|
-
*/
|
|
17
|
-
export function encodeBase64Url(str) {
|
|
18
|
-
return Buffer.from(str, 'utf-8')
|
|
19
|
-
.toString('base64')
|
|
20
|
-
.replace(/\+/g, '-')
|
|
21
|
-
.replace(/\//g, '_')
|
|
22
|
-
.replace(/=+$/, '');
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Decode URL-safe base64 (base64url) to string
|
|
26
|
-
*
|
|
27
|
-
* @param base64url - URL-safe base64 encoded string
|
|
28
|
-
* @returns Decoded string
|
|
29
|
-
*/
|
|
30
|
-
export function decodeBase64Url(base64url) {
|
|
31
|
-
// Convert base64url to standard base64
|
|
32
|
-
let base64 = base64url.replace(/-/g, '+').replace(/_/g, '/');
|
|
33
|
-
// Add padding if needed
|
|
34
|
-
while (base64.length % 4 !== 0) {
|
|
35
|
-
base64 += '=';
|
|
36
|
-
}
|
|
37
|
-
return Buffer.from(base64, 'base64').toString('utf-8');
|
|
38
|
-
}
|
|
39
|
-
// ============================================
|
|
40
|
-
// Source Normalization
|
|
41
|
-
// ============================================
|
|
42
|
-
/**
|
|
43
|
-
* Normalize source URL by removing query string and fragment
|
|
44
|
-
* Only normalizes HTTP(S) URLs. Other sources (e.g., "clipboard://...") are returned as-is
|
|
45
|
-
*
|
|
46
|
-
* @param source - Source identifier (URL or custom ID)
|
|
47
|
-
* @returns Normalized source
|
|
48
|
-
*/
|
|
49
|
-
export function normalizeSource(source) {
|
|
50
|
-
try {
|
|
51
|
-
const parsed = new URL(source);
|
|
52
|
-
// Only normalize HTTP(S) URLs
|
|
53
|
-
if (parsed.protocol === 'http:' || parsed.protocol === 'https:') {
|
|
54
|
-
return `${parsed.origin}${parsed.pathname}`;
|
|
55
|
-
}
|
|
56
|
-
// Non-HTTP URLs (clipboard://, etc.) are returned as-is
|
|
57
|
-
return source;
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
// Not a valid URL, return as-is
|
|
61
|
-
return source;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get file extension from content format
|
|
66
|
-
*
|
|
67
|
-
* All formats return .md for consistency.
|
|
68
|
-
* This allows generating unique path from source without knowing original format,
|
|
69
|
-
* which is essential for delete_file with source parameter.
|
|
70
|
-
*
|
|
71
|
-
* @param _format - Content format (ignored, always returns 'md')
|
|
72
|
-
* @returns File extension (without dot) - always 'md'
|
|
73
|
-
*/
|
|
74
|
-
export function formatToExtension(_format) {
|
|
75
|
-
return 'md';
|
|
76
|
-
}
|
|
77
|
-
// ============================================
|
|
78
|
-
// Path Generation
|
|
79
|
-
// ============================================
|
|
80
|
-
/**
|
|
81
|
-
* Get raw-data directory path
|
|
82
|
-
*
|
|
83
|
-
* @param dbPath - LanceDB database path
|
|
84
|
-
* @returns Raw-data directory path
|
|
85
|
-
*/
|
|
86
|
-
export function getRawDataDir(dbPath) {
|
|
87
|
-
return join(dbPath, 'raw-data');
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* Generate raw-data file path from source and format
|
|
91
|
-
* Path format: {dbPath}/raw-data/{base64url(normalizedSource)}.{ext}
|
|
92
|
-
*
|
|
93
|
-
* @param dbPath - LanceDB database path
|
|
94
|
-
* @param source - Source identifier (URL or custom ID)
|
|
95
|
-
* @param format - Content format
|
|
96
|
-
* @returns Generated file path
|
|
97
|
-
*/
|
|
98
|
-
export function generateRawDataPath(dbPath, source, format) {
|
|
99
|
-
const normalizedSource = normalizeSource(source);
|
|
100
|
-
const encoded = encodeBase64Url(normalizedSource);
|
|
101
|
-
const extension = formatToExtension(format);
|
|
102
|
-
// Use resolve to ensure absolute path (required by validateFilePath)
|
|
103
|
-
return resolve(getRawDataDir(dbPath), `${encoded}.${extension}`);
|
|
104
|
-
}
|
|
105
|
-
// ============================================
|
|
106
|
-
// File Operations
|
|
107
|
-
// ============================================
|
|
108
|
-
/**
|
|
109
|
-
* Save content to raw-data directory
|
|
110
|
-
* Creates directory if it doesn't exist
|
|
111
|
-
*
|
|
112
|
-
* @param dbPath - LanceDB database path
|
|
113
|
-
* @param source - Source identifier (URL or custom ID)
|
|
114
|
-
* @param content - Content to save
|
|
115
|
-
* @param format - Content format
|
|
116
|
-
* @returns Saved file path
|
|
117
|
-
*/
|
|
118
|
-
export async function saveRawData(dbPath, source, content, format) {
|
|
119
|
-
const filePath = generateRawDataPath(dbPath, source, format);
|
|
120
|
-
// Ensure directory exists
|
|
121
|
-
await mkdir(dirname(filePath), { recursive: true });
|
|
122
|
-
// Write content to file
|
|
123
|
-
await writeFile(filePath, content, 'utf-8');
|
|
124
|
-
return filePath;
|
|
125
|
-
}
|
|
126
|
-
// ============================================
|
|
127
|
-
// Path Detection and Source Extraction
|
|
128
|
-
// ============================================
|
|
129
|
-
/**
|
|
130
|
-
* Check if file path is in raw-data directory
|
|
131
|
-
*
|
|
132
|
-
* @param filePath - File path to check
|
|
133
|
-
* @returns True if path is in raw-data directory
|
|
134
|
-
*/
|
|
135
|
-
export function isRawDataPath(filePath) {
|
|
136
|
-
return filePath.includes('/raw-data/');
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Extract original source from raw-data file path
|
|
140
|
-
* Returns null if not a raw-data path
|
|
141
|
-
*
|
|
142
|
-
* @param filePath - Raw-data file path
|
|
143
|
-
* @returns Original source or null
|
|
144
|
-
*/
|
|
145
|
-
export function extractSourceFromPath(filePath) {
|
|
146
|
-
const rawDataMarker = '/raw-data/';
|
|
147
|
-
const rawDataIndex = filePath.indexOf(rawDataMarker);
|
|
148
|
-
if (rawDataIndex === -1) {
|
|
149
|
-
return null;
|
|
150
|
-
}
|
|
151
|
-
const fileName = filePath.slice(rawDataIndex + rawDataMarker.length);
|
|
152
|
-
const dotIndex = fileName.lastIndexOf('.');
|
|
153
|
-
if (dotIndex === -1) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
const encoded = fileName.slice(0, dotIndex);
|
|
157
|
-
return decodeBase64Url(encoded);
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Generate the .meta.json sidecar path for a given .md file path
|
|
161
|
-
* Replaces the trailing `.md` extension with `.meta.json`
|
|
162
|
-
*
|
|
163
|
-
* @param mdPath - Path to the .md raw-data file
|
|
164
|
-
* @returns Path to the corresponding .meta.json file
|
|
165
|
-
*/
|
|
166
|
-
export function generateMetaJsonPath(mdPath) {
|
|
167
|
-
return mdPath.replace(/\.md$/, '.meta.json');
|
|
168
|
-
}
|
|
169
|
-
/**
|
|
170
|
-
* Save metadata as a JSON sidecar file alongside a raw-data .md file
|
|
171
|
-
*
|
|
172
|
-
* @param mdPath - Path to the .md raw-data file
|
|
173
|
-
* @param meta - Metadata to persist
|
|
174
|
-
*/
|
|
175
|
-
export async function saveMetaJson(mdPath, meta) {
|
|
176
|
-
const metaPath = generateMetaJsonPath(mdPath);
|
|
177
|
-
await writeFile(metaPath, JSON.stringify(meta, null, 2), 'utf-8');
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Load metadata from a .meta.json sidecar file
|
|
181
|
-
* Returns null when the sidecar file does not exist (ENOENT).
|
|
182
|
-
* All other read errors are re-thrown (fail-fast).
|
|
183
|
-
*
|
|
184
|
-
* @param mdPath - Path to the .md raw-data file
|
|
185
|
-
* @returns Parsed metadata or null if file does not exist
|
|
186
|
-
*/
|
|
187
|
-
export async function loadMetaJson(mdPath) {
|
|
188
|
-
const metaPath = generateMetaJsonPath(mdPath);
|
|
189
|
-
try {
|
|
190
|
-
const content = await readFile(metaPath, 'utf-8');
|
|
191
|
-
return JSON.parse(content);
|
|
192
|
-
}
|
|
193
|
-
catch (error) {
|
|
194
|
-
if (error instanceof Error &&
|
|
195
|
-
'code' in error &&
|
|
196
|
-
error.code === 'ENOENT') {
|
|
197
|
-
return null;
|
|
198
|
-
}
|
|
199
|
-
throw error;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
//# sourceMappingURL=raw-data-utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"raw-data-utils.js","sourceRoot":"","sources":["../../src/server/raw-data-utils.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,oFAAoF;AAEpF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAElD,+CAA+C;AAC/C,8BAA8B;AAC9B,+CAA+C;AAE/C;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC;SAC7B,QAAQ,CAAC,QAAQ,CAAC;SAClB,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