bluera-knowledge 0.18.1 → 0.19.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/CHANGELOG.md +20 -0
- package/README.md +19 -28
- package/dist/{brands-3EYIYV6T.js → brands-XDTIHFNU.js} +2 -1
- package/dist/{chunk-EZXJ3W5X.js → chunk-27Y4ENUD.js} +2 -2
- package/dist/chunk-DGUM43GV.js +11 -0
- package/dist/{chunk-VUGQ7HAR.js → chunk-EQYSYRQJ.js} +129 -50
- package/dist/chunk-EQYSYRQJ.js.map +1 -0
- package/dist/{chunk-RDDGZIDL.js → chunk-KQLTWB4T.js} +44 -120
- package/dist/chunk-KQLTWB4T.js.map +1 -0
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +0 -29
- package/dist/mcp/server.js +3 -2
- package/dist/{watch.service-VDSUQ72Z.js → watch.service-NXRWLJG6.js} +2 -1
- package/dist/watch.service-NXRWLJG6.js.map +1 -0
- package/dist/workers/background-worker-cli.js +3 -2
- package/dist/workers/background-worker-cli.js.map +1 -1
- package/package.json +7 -5
- package/python/ast_worker.py +209 -0
- package/dist/chunk-RDDGZIDL.js.map +0 -1
- package/dist/chunk-VUGQ7HAR.js.map +0 -1
- package/python/crawl_worker.py +0 -280
- /package/dist/{brands-3EYIYV6T.js.map → brands-XDTIHFNU.js.map} +0 -0
- /package/dist/{chunk-EZXJ3W5X.js.map → chunk-27Y4ENUD.js.map} +0 -0
- /package/dist/{watch.service-VDSUQ72Z.js.map → chunk-DGUM43GV.js.map} +0 -0
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
parseIgnorePatternsForScanning
|
|
7
7
|
} from "./chunk-HXBIIMYL.js";
|
|
8
|
+
import {
|
|
9
|
+
__require
|
|
10
|
+
} from "./chunk-DGUM43GV.js";
|
|
8
11
|
|
|
9
12
|
// src/analysis/adapter-registry.ts
|
|
10
13
|
var AdapterRegistry = class _AdapterRegistry {
|
|
@@ -949,30 +952,58 @@ var CodeGraph = class {
|
|
|
949
952
|
};
|
|
950
953
|
|
|
951
954
|
// src/analysis/tree-sitter-parser.ts
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
+
var TreeSitterParser = null;
|
|
956
|
+
var GoLanguage = null;
|
|
957
|
+
var RustLanguage = null;
|
|
958
|
+
var _initialized = false;
|
|
959
|
+
var _available = false;
|
|
960
|
+
function isTreeSitterAvailable() {
|
|
961
|
+
if (!_initialized) {
|
|
962
|
+
try {
|
|
963
|
+
TreeSitterParser = __require("tree-sitter");
|
|
964
|
+
GoLanguage = __require("tree-sitter-go");
|
|
965
|
+
RustLanguage = __require("tree-sitter-rust");
|
|
966
|
+
_available = true;
|
|
967
|
+
} catch {
|
|
968
|
+
_available = false;
|
|
969
|
+
}
|
|
970
|
+
_initialized = true;
|
|
971
|
+
}
|
|
972
|
+
return _available;
|
|
973
|
+
}
|
|
955
974
|
function createRustParser() {
|
|
956
|
-
|
|
957
|
-
|
|
975
|
+
if (!isTreeSitterAvailable() || TreeSitterParser === null || RustLanguage === null) {
|
|
976
|
+
return null;
|
|
977
|
+
}
|
|
978
|
+
const parser = new TreeSitterParser();
|
|
979
|
+
parser.setLanguage(RustLanguage);
|
|
958
980
|
return parser;
|
|
959
981
|
}
|
|
960
982
|
function parseRustCode(code) {
|
|
961
983
|
try {
|
|
962
984
|
const parser = createRustParser();
|
|
985
|
+
if (parser === null) {
|
|
986
|
+
return null;
|
|
987
|
+
}
|
|
963
988
|
return parser.parse(code);
|
|
964
989
|
} catch {
|
|
965
990
|
return null;
|
|
966
991
|
}
|
|
967
992
|
}
|
|
968
993
|
function createGoParser() {
|
|
969
|
-
|
|
970
|
-
|
|
994
|
+
if (!isTreeSitterAvailable() || TreeSitterParser === null || GoLanguage === null) {
|
|
995
|
+
return null;
|
|
996
|
+
}
|
|
997
|
+
const parser = new TreeSitterParser();
|
|
998
|
+
parser.setLanguage(GoLanguage);
|
|
971
999
|
return parser;
|
|
972
1000
|
}
|
|
973
1001
|
function parseGoCode(code) {
|
|
974
1002
|
try {
|
|
975
1003
|
const parser = createGoParser();
|
|
1004
|
+
if (parser === null) {
|
|
1005
|
+
return null;
|
|
1006
|
+
}
|
|
976
1007
|
return parser.parse(code);
|
|
977
1008
|
} catch {
|
|
978
1009
|
return null;
|
|
@@ -2628,7 +2659,7 @@ var DriftService = class {
|
|
|
2628
2659
|
const stats = await stat(path4);
|
|
2629
2660
|
const content = await readFile4(path4);
|
|
2630
2661
|
const hash = createHash2("md5").update(content).digest("hex");
|
|
2631
|
-
const { createDocumentId: createDocumentId2 } = await import("./brands-
|
|
2662
|
+
const { createDocumentId: createDocumentId2 } = await import("./brands-XDTIHFNU.js");
|
|
2632
2663
|
return {
|
|
2633
2664
|
state: {
|
|
2634
2665
|
mtime: stats.mtimeMs,
|
|
@@ -5153,39 +5184,6 @@ import { ZodError } from "zod";
|
|
|
5153
5184
|
|
|
5154
5185
|
// src/crawl/schemas.ts
|
|
5155
5186
|
import { z as z4 } from "zod";
|
|
5156
|
-
var CrawledLinkSchema = z4.object({
|
|
5157
|
-
href: z4.string(),
|
|
5158
|
-
text: z4.string(),
|
|
5159
|
-
title: z4.string().optional(),
|
|
5160
|
-
base_domain: z4.string().optional(),
|
|
5161
|
-
head_data: z4.unknown().optional(),
|
|
5162
|
-
head_extraction_status: z4.unknown().optional(),
|
|
5163
|
-
head_extraction_error: z4.unknown().optional(),
|
|
5164
|
-
intrinsic_score: z4.number().optional(),
|
|
5165
|
-
contextual_score: z4.unknown().optional(),
|
|
5166
|
-
total_score: z4.unknown().optional()
|
|
5167
|
-
});
|
|
5168
|
-
var CrawlPageSchema = z4.object({
|
|
5169
|
-
url: z4.string(),
|
|
5170
|
-
title: z4.string(),
|
|
5171
|
-
content: z4.string(),
|
|
5172
|
-
links: z4.array(z4.string()),
|
|
5173
|
-
crawledAt: z4.string()
|
|
5174
|
-
});
|
|
5175
|
-
var CrawlResultSchema = z4.object({
|
|
5176
|
-
pages: z4.array(CrawlPageSchema)
|
|
5177
|
-
});
|
|
5178
|
-
var HeadlessResultSchema = z4.object({
|
|
5179
|
-
html: z4.string(),
|
|
5180
|
-
markdown: z4.string(),
|
|
5181
|
-
links: z4.array(z4.union([CrawledLinkSchema, z4.string()]))
|
|
5182
|
-
});
|
|
5183
|
-
function validateHeadlessResult(data) {
|
|
5184
|
-
return HeadlessResultSchema.parse(data);
|
|
5185
|
-
}
|
|
5186
|
-
function validateCrawlResult(data) {
|
|
5187
|
-
return CrawlResultSchema.parse(data);
|
|
5188
|
-
}
|
|
5189
5187
|
var MethodInfoSchema = z4.object({
|
|
5190
5188
|
name: z4.string(),
|
|
5191
5189
|
async: z4.boolean(),
|
|
@@ -5245,13 +5243,13 @@ var PythonBridge = class {
|
|
|
5245
5243
|
if (isProduction) {
|
|
5246
5244
|
const distIndex = currentFilePath.indexOf(distPattern);
|
|
5247
5245
|
const pluginRoot = currentFilePath.substring(0, distIndex);
|
|
5248
|
-
pythonWorkerPath = path3.join(pluginRoot, "python", "
|
|
5246
|
+
pythonWorkerPath = path3.join(pluginRoot, "python", "ast_worker.py");
|
|
5249
5247
|
const venvPython = getVenvPythonPath(pluginRoot);
|
|
5250
5248
|
pythonPath = existsSync4(venvPython) ? venvPython : getPythonExecutable();
|
|
5251
5249
|
} else {
|
|
5252
5250
|
const srcDir = path3.dirname(path3.dirname(currentFilePath));
|
|
5253
5251
|
const projectRoot = path3.dirname(srcDir);
|
|
5254
|
-
pythonWorkerPath = path3.join(projectRoot, "python", "
|
|
5252
|
+
pythonWorkerPath = path3.join(projectRoot, "python", "ast_worker.py");
|
|
5255
5253
|
pythonPath = getPythonExecutable();
|
|
5256
5254
|
}
|
|
5257
5255
|
logger3.debug(
|
|
@@ -5304,14 +5302,7 @@ var PythonBridge = class {
|
|
|
5304
5302
|
clearTimeout(pending.timeout);
|
|
5305
5303
|
this.pending.delete(response.id);
|
|
5306
5304
|
try {
|
|
5307
|
-
|
|
5308
|
-
if (pending.method === "crawl") {
|
|
5309
|
-
validated = validateCrawlResult(response.result);
|
|
5310
|
-
} else if (pending.method === "fetch_headless") {
|
|
5311
|
-
validated = validateHeadlessResult(response.result);
|
|
5312
|
-
} else {
|
|
5313
|
-
validated = validateParsePythonResult(response.result);
|
|
5314
|
-
}
|
|
5305
|
+
const validated = validateParsePythonResult(response.result);
|
|
5315
5306
|
pending.resolve(validated);
|
|
5316
5307
|
} catch (error) {
|
|
5317
5308
|
if (error instanceof ZodError) {
|
|
@@ -5345,70 +5336,6 @@ var PythonBridge = class {
|
|
|
5345
5336
|
});
|
|
5346
5337
|
return Promise.resolve();
|
|
5347
5338
|
}
|
|
5348
|
-
async crawl(url, timeoutMs = 3e4) {
|
|
5349
|
-
if (!this.process) await this.start();
|
|
5350
|
-
const id = randomUUID3();
|
|
5351
|
-
const request = {
|
|
5352
|
-
jsonrpc: "2.0",
|
|
5353
|
-
id,
|
|
5354
|
-
method: "crawl",
|
|
5355
|
-
params: { url }
|
|
5356
|
-
};
|
|
5357
|
-
return new Promise((resolve4, reject) => {
|
|
5358
|
-
const timeout = setTimeout(() => {
|
|
5359
|
-
const pending = this.pending.get(id);
|
|
5360
|
-
if (pending) {
|
|
5361
|
-
this.pending.delete(id);
|
|
5362
|
-
reject(new Error(`Crawl timeout after ${String(timeoutMs)}ms for URL: ${url}`));
|
|
5363
|
-
}
|
|
5364
|
-
}, timeoutMs);
|
|
5365
|
-
this.pending.set(id, {
|
|
5366
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Promise resolve type narrowing
|
|
5367
|
-
resolve: resolve4,
|
|
5368
|
-
reject,
|
|
5369
|
-
timeout,
|
|
5370
|
-
method: "crawl"
|
|
5371
|
-
});
|
|
5372
|
-
if (!this.process?.stdin) {
|
|
5373
|
-
reject(new Error("Python bridge process not available"));
|
|
5374
|
-
return;
|
|
5375
|
-
}
|
|
5376
|
-
this.process.stdin.write(`${JSON.stringify(request)}
|
|
5377
|
-
`);
|
|
5378
|
-
});
|
|
5379
|
-
}
|
|
5380
|
-
async fetchHeadless(url, timeoutMs = 6e4) {
|
|
5381
|
-
if (!this.process) await this.start();
|
|
5382
|
-
const id = randomUUID3();
|
|
5383
|
-
const request = {
|
|
5384
|
-
jsonrpc: "2.0",
|
|
5385
|
-
id,
|
|
5386
|
-
method: "fetch_headless",
|
|
5387
|
-
params: { url }
|
|
5388
|
-
};
|
|
5389
|
-
return new Promise((resolve4, reject) => {
|
|
5390
|
-
const timeout = setTimeout(() => {
|
|
5391
|
-
const pending = this.pending.get(id);
|
|
5392
|
-
if (pending) {
|
|
5393
|
-
this.pending.delete(id);
|
|
5394
|
-
reject(new Error(`Headless fetch timeout after ${String(timeoutMs)}ms for URL: ${url}`));
|
|
5395
|
-
}
|
|
5396
|
-
}, timeoutMs);
|
|
5397
|
-
this.pending.set(id, {
|
|
5398
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Promise resolve type narrowing
|
|
5399
|
-
resolve: resolve4,
|
|
5400
|
-
reject,
|
|
5401
|
-
timeout,
|
|
5402
|
-
method: "fetch_headless"
|
|
5403
|
-
});
|
|
5404
|
-
if (!this.process?.stdin) {
|
|
5405
|
-
reject(new Error("Python bridge process not available"));
|
|
5406
|
-
return;
|
|
5407
|
-
}
|
|
5408
|
-
this.process.stdin.write(`${JSON.stringify(request)}
|
|
5409
|
-
`);
|
|
5410
|
-
});
|
|
5411
|
-
}
|
|
5412
5339
|
async parsePython(code, filePath, timeoutMs = 1e4) {
|
|
5413
5340
|
if (!this.process) await this.start();
|
|
5414
5341
|
const id = randomUUID3();
|
|
@@ -5429,11 +5356,9 @@ var PythonBridge = class {
|
|
|
5429
5356
|
}
|
|
5430
5357
|
}, timeoutMs);
|
|
5431
5358
|
this.pending.set(id, {
|
|
5432
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- Promise resolve type narrowing
|
|
5433
5359
|
resolve: resolve4,
|
|
5434
5360
|
reject,
|
|
5435
|
-
timeout
|
|
5436
|
-
method: "parse_python"
|
|
5361
|
+
timeout
|
|
5437
5362
|
});
|
|
5438
5363
|
if (!this.process?.stdin) {
|
|
5439
5364
|
reject(new Error("Python bridge process not available"));
|
|
@@ -5959,7 +5884,6 @@ export {
|
|
|
5959
5884
|
shutdownLogger,
|
|
5960
5885
|
summarizePayload,
|
|
5961
5886
|
truncateForLog,
|
|
5962
|
-
PythonBridge,
|
|
5963
5887
|
ChunkingService,
|
|
5964
5888
|
ASTParser,
|
|
5965
5889
|
ok,
|
|
@@ -5976,4 +5900,4 @@ export {
|
|
|
5976
5900
|
createServices,
|
|
5977
5901
|
destroyServices
|
|
5978
5902
|
};
|
|
5979
|
-
//# sourceMappingURL=chunk-
|
|
5903
|
+
//# sourceMappingURL=chunk-KQLTWB4T.js.map
|