bluera-knowledge 0.25.1 → 0.27.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 +23 -0
- package/dist/{chunk-L6P43FR7.js → chunk-GB5WKUBX.js} +147 -38
- package/dist/{chunk-L6P43FR7.js.map → chunk-GB5WKUBX.js.map} +1 -1
- package/dist/{chunk-HGKR2EHA.js → chunk-LBE2PTSB.js} +107 -3
- package/dist/chunk-LBE2PTSB.js.map +1 -0
- package/dist/{chunk-PY2JIYNJ.js → chunk-S3DJUNUG.js} +2 -2
- package/dist/index.js +156 -4
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.d.ts +35 -0
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +5 -2
- package/dist/workers/background-worker-cli.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-HGKR2EHA.js.map +0 -1
- /package/dist/{chunk-PY2JIYNJ.js.map → chunk-S3DJUNUG.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,29 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [0.27.0](https://github.com/blueraai/bluera-knowledge/compare/v0.26.0...v0.27.0) (2026-02-05)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **hooks:** conditional BK enforcement on library reads ([1d7ff96](https://github.com/blueraai/bluera-knowledge/commit/1d7ff96ea38c1afda970c1cbaae3b3edb2b1bd0f))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* **lance:** remove .lance directory on store deletion ([08cccef](https://github.com/blueraai/bluera-knowledge/commit/08cccef8dae943abf4f71b0f65a6a21b1a8b5110))
|
|
16
|
+
|
|
17
|
+
## [0.26.0](https://github.com/blueraai/bluera-knowledge/compare/v0.25.1...v0.26.0) (2026-02-04)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* **cli:** add store health command ([1321522](https://github.com/blueraai/bluera-knowledge/commit/13215227f02d8e791cb5b2a4d61a4e509fe001f4))
|
|
23
|
+
* **index:** add web store re-indexing via crawl jobs ([cf3d4cd](https://github.com/blueraai/bluera-knowledge/commit/cf3d4cda084973eaf0dbd4a17c9ba916669f9fa1))
|
|
24
|
+
* **mcp:** add stores:health command ([6e342f8](https://github.com/blueraai/bluera-knowledge/commit/6e342f827474a3c84ff82fad15bfcf7764ae9c80))
|
|
25
|
+
* **store:** add path resolution for portable store paths ([cf451db](https://github.com/blueraai/bluera-knowledge/commit/cf451db6c368ca82ee1c72fe0b6b69a9544e7aba))
|
|
26
|
+
* **types:** add pathType for portable store paths (schema v3) ([519b3c6](https://github.com/blueraai/bluera-knowledge/commit/519b3c6541b792d955a5b90a237b03622f1c18be))
|
|
27
|
+
|
|
5
28
|
## [0.25.1](https://github.com/blueraai/bluera-knowledge/compare/v0.25.0...v0.25.1) (2026-02-04)
|
|
6
29
|
|
|
7
30
|
## [0.25.0](https://github.com/blueraai/bluera-knowledge/compare/v0.22.4...v0.25.0) (2026-02-04)
|
|
@@ -4753,6 +4753,7 @@ var IngestConfigSchema = z3.object({
|
|
|
4753
4753
|
var FileStoreDefinitionSchema = BaseStoreDefinitionSchema.extend({
|
|
4754
4754
|
type: z3.literal("file"),
|
|
4755
4755
|
path: z3.string().min(1, "Path is required for file stores"),
|
|
4756
|
+
pathType: z3.enum(["relative", "absolute"]).optional(),
|
|
4756
4757
|
ingest: IngestConfigSchema.optional()
|
|
4757
4758
|
});
|
|
4758
4759
|
var GitUrlSchema = z3.string().refine(
|
|
@@ -4958,7 +4959,7 @@ var StoreDefinitionService = class {
|
|
|
4958
4959
|
// src/services/store.service.ts
|
|
4959
4960
|
import { randomUUID as randomUUID2 } from "crypto";
|
|
4960
4961
|
import { readFile as readFile8, mkdir as mkdir5, stat as stat3, access as access5 } from "fs/promises";
|
|
4961
|
-
import { join as join10, resolve as resolve3 } from "path";
|
|
4962
|
+
import { join as join10, resolve as resolve3, relative as relative2, isAbsolute as isAbsolute3 } from "path";
|
|
4962
4963
|
|
|
4963
4964
|
// src/plugin/git-clone.ts
|
|
4964
4965
|
import { spawn } from "child_process";
|
|
@@ -5054,9 +5055,10 @@ function extractRepoName(url) {
|
|
|
5054
5055
|
}
|
|
5055
5056
|
|
|
5056
5057
|
// src/types/store.ts
|
|
5057
|
-
var CURRENT_SCHEMA_VERSION =
|
|
5058
|
+
var CURRENT_SCHEMA_VERSION = 3;
|
|
5058
5059
|
|
|
5059
5060
|
// src/services/store.service.ts
|
|
5061
|
+
var logger4 = createLogger("store-service");
|
|
5060
5062
|
async function fileExists4(path4) {
|
|
5061
5063
|
try {
|
|
5062
5064
|
await access5(path4);
|
|
@@ -5073,6 +5075,8 @@ var StoreService = class {
|
|
|
5073
5075
|
embeddingModelId;
|
|
5074
5076
|
registry = { stores: [] };
|
|
5075
5077
|
registryMtime = 0;
|
|
5078
|
+
/** Flag for lazy schema migration - bump to v3 on next save */
|
|
5079
|
+
needsMigration = false;
|
|
5076
5080
|
constructor(dataDir, options) {
|
|
5077
5081
|
this.dataDir = dataDir;
|
|
5078
5082
|
this.definitionService = options.definitionService ?? void 0;
|
|
@@ -5087,6 +5091,47 @@ var StoreService = class {
|
|
|
5087
5091
|
getCurrentModelId() {
|
|
5088
5092
|
return this.embeddingModelId;
|
|
5089
5093
|
}
|
|
5094
|
+
/**
|
|
5095
|
+
* Convert an absolute path to stored format.
|
|
5096
|
+
* Returns relative path + pathType if inside projectRoot, otherwise absolute.
|
|
5097
|
+
*
|
|
5098
|
+
* @param absolutePath - The absolute path to convert
|
|
5099
|
+
* @param isClonedRepo - If true, always store absolute (managed by BK under dataDir)
|
|
5100
|
+
*/
|
|
5101
|
+
toStoredPath(absolutePath, isClonedRepo = false) {
|
|
5102
|
+
if (isClonedRepo) {
|
|
5103
|
+
return { path: absolutePath, pathType: "absolute" };
|
|
5104
|
+
}
|
|
5105
|
+
if (this.projectRoot === void 0) {
|
|
5106
|
+
return { path: absolutePath, pathType: "absolute" };
|
|
5107
|
+
}
|
|
5108
|
+
const relativePath = relative2(this.projectRoot, absolutePath);
|
|
5109
|
+
if (relativePath.startsWith("..") || isAbsolute3(relativePath)) {
|
|
5110
|
+
logger4.info(`Path outside projectRoot, storing absolute: ${absolutePath}`);
|
|
5111
|
+
return { path: absolutePath, pathType: "absolute" };
|
|
5112
|
+
}
|
|
5113
|
+
logger4.debug(`Storing relative path: ${relativePath} (resolved from ${absolutePath})`);
|
|
5114
|
+
return { path: relativePath, pathType: "relative" };
|
|
5115
|
+
}
|
|
5116
|
+
/**
|
|
5117
|
+
* Resolve a stored path to absolute runtime path.
|
|
5118
|
+
* Handles both relative (v3+) and absolute (v2 and earlier) paths.
|
|
5119
|
+
*
|
|
5120
|
+
* @param storedPath - The path as stored in stores.json
|
|
5121
|
+
* @param pathType - The path type (undefined for pre-v3 stores, treated as absolute)
|
|
5122
|
+
*/
|
|
5123
|
+
resolveStoredPath(storedPath, pathType) {
|
|
5124
|
+
if (pathType === void 0 || pathType === "absolute") {
|
|
5125
|
+
return storedPath;
|
|
5126
|
+
}
|
|
5127
|
+
if (this.projectRoot === void 0) {
|
|
5128
|
+
logger4.error(`Store has relative path but no projectRoot: ${storedPath}`);
|
|
5129
|
+
return storedPath;
|
|
5130
|
+
}
|
|
5131
|
+
const resolved = resolve3(this.projectRoot, storedPath);
|
|
5132
|
+
logger4.debug(`Resolved relative path: ${storedPath} \u2192 ${resolved}`);
|
|
5133
|
+
return resolved;
|
|
5134
|
+
}
|
|
5090
5135
|
async initialize() {
|
|
5091
5136
|
await mkdir5(this.dataDir, { recursive: true });
|
|
5092
5137
|
await this.loadRegistry();
|
|
@@ -5123,7 +5168,8 @@ var StoreService = class {
|
|
|
5123
5168
|
...base,
|
|
5124
5169
|
type: "file",
|
|
5125
5170
|
// Use original input path if provided (may be relative), otherwise use normalized
|
|
5126
|
-
path: input.path ?? fileStore.path
|
|
5171
|
+
path: input.path ?? fileStore.path,
|
|
5172
|
+
pathType: fileStore.pathType
|
|
5127
5173
|
};
|
|
5128
5174
|
return fileDef;
|
|
5129
5175
|
}
|
|
@@ -5173,7 +5219,8 @@ var StoreService = class {
|
|
|
5173
5219
|
const fileDef = {
|
|
5174
5220
|
...base,
|
|
5175
5221
|
type: "file",
|
|
5176
|
-
path: store.path
|
|
5222
|
+
path: store.path,
|
|
5223
|
+
pathType: store.pathType
|
|
5177
5224
|
};
|
|
5178
5225
|
return fileDef;
|
|
5179
5226
|
}
|
|
@@ -5229,11 +5276,13 @@ var StoreService = class {
|
|
|
5229
5276
|
} catch {
|
|
5230
5277
|
return err(new Error(`Directory does not exist: ${normalizedPath}`));
|
|
5231
5278
|
}
|
|
5279
|
+
const { pathType } = this.toStoredPath(normalizedPath, false);
|
|
5232
5280
|
store = {
|
|
5233
5281
|
type: "file",
|
|
5234
5282
|
id,
|
|
5235
5283
|
name: input.name,
|
|
5236
5284
|
path: normalizedPath,
|
|
5285
|
+
pathType,
|
|
5237
5286
|
ingest: input.ingest,
|
|
5238
5287
|
description: input.description,
|
|
5239
5288
|
tags: input.tags,
|
|
@@ -5275,11 +5324,14 @@ var StoreService = class {
|
|
|
5275
5324
|
return err(new Error(`Repository path does not exist: ${normalizedRepoPath}`));
|
|
5276
5325
|
}
|
|
5277
5326
|
}
|
|
5327
|
+
const isClonedRepo = input.url !== void 0;
|
|
5328
|
+
const { pathType: repoPathType } = this.toStoredPath(normalizedRepoPath, isClonedRepo);
|
|
5278
5329
|
store = {
|
|
5279
5330
|
type: "repo",
|
|
5280
5331
|
id,
|
|
5281
5332
|
name: input.name,
|
|
5282
5333
|
path: normalizedRepoPath,
|
|
5334
|
+
pathType: repoPathType,
|
|
5283
5335
|
url: input.url,
|
|
5284
5336
|
branch: input.branch,
|
|
5285
5337
|
depth: input.depth ?? 1,
|
|
@@ -5458,14 +5510,32 @@ var StoreService = class {
|
|
|
5458
5510
|
const content = await readFile8(registryPath, "utf-8");
|
|
5459
5511
|
try {
|
|
5460
5512
|
const data = JSON.parse(content);
|
|
5513
|
+
let migrationNeeded = false;
|
|
5461
5514
|
this.registry = {
|
|
5462
|
-
stores: data.stores.filter((s) => s !== null).map((s) =>
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5515
|
+
stores: data.stores.filter((s) => s !== null).map((s) => {
|
|
5516
|
+
if (s.schemaVersion === void 0 || s.schemaVersion < CURRENT_SCHEMA_VERSION) {
|
|
5517
|
+
migrationNeeded = true;
|
|
5518
|
+
}
|
|
5519
|
+
let store = {
|
|
5520
|
+
...s,
|
|
5521
|
+
id: createStoreId(s.id),
|
|
5522
|
+
createdAt: new Date(s.createdAt),
|
|
5523
|
+
updatedAt: new Date(s.updatedAt)
|
|
5524
|
+
};
|
|
5525
|
+
if (store.type === "file") {
|
|
5526
|
+
const resolvedPath = this.resolveStoredPath(store.path, store.pathType);
|
|
5527
|
+
store = { ...store, path: resolvedPath };
|
|
5528
|
+
} else if (store.type === "repo") {
|
|
5529
|
+
const resolvedPath = this.resolveStoredPath(store.path, store.pathType);
|
|
5530
|
+
store = { ...store, path: resolvedPath };
|
|
5531
|
+
}
|
|
5532
|
+
return store;
|
|
5533
|
+
})
|
|
5468
5534
|
};
|
|
5535
|
+
if (migrationNeeded) {
|
|
5536
|
+
logger4.debug("Schema migration needed - will upgrade on next save");
|
|
5537
|
+
this.needsMigration = true;
|
|
5538
|
+
}
|
|
5469
5539
|
} catch (error) {
|
|
5470
5540
|
throw new Error(
|
|
5471
5541
|
`Failed to parse store registry at ${registryPath}: ${error instanceof Error ? error.message : String(error)}`
|
|
@@ -5476,7 +5546,37 @@ var StoreService = class {
|
|
|
5476
5546
|
}
|
|
5477
5547
|
async saveRegistry() {
|
|
5478
5548
|
const registryPath = join10(this.dataDir, "stores.json");
|
|
5479
|
-
|
|
5549
|
+
const storedStores = this.registry.stores.map((store) => {
|
|
5550
|
+
const schemaVersion = this.needsMigration ? CURRENT_SCHEMA_VERSION : store.schemaVersion;
|
|
5551
|
+
if (store.type === "file") {
|
|
5552
|
+
const { path: storedPath, pathType } = this.toStoredPath(store.path, false);
|
|
5553
|
+
return {
|
|
5554
|
+
...store,
|
|
5555
|
+
path: storedPath,
|
|
5556
|
+
pathType,
|
|
5557
|
+
schemaVersion
|
|
5558
|
+
};
|
|
5559
|
+
} else if (store.type === "repo") {
|
|
5560
|
+
const isClonedRepo = store.url !== void 0;
|
|
5561
|
+
const { path: storedPath, pathType } = this.toStoredPath(store.path, isClonedRepo);
|
|
5562
|
+
return {
|
|
5563
|
+
...store,
|
|
5564
|
+
path: storedPath,
|
|
5565
|
+
pathType,
|
|
5566
|
+
schemaVersion
|
|
5567
|
+
};
|
|
5568
|
+
} else {
|
|
5569
|
+
return {
|
|
5570
|
+
...store,
|
|
5571
|
+
schemaVersion
|
|
5572
|
+
};
|
|
5573
|
+
}
|
|
5574
|
+
});
|
|
5575
|
+
if (this.needsMigration) {
|
|
5576
|
+
logger4.info("Schema migration complete - upgraded to v3");
|
|
5577
|
+
this.needsMigration = false;
|
|
5578
|
+
}
|
|
5579
|
+
await atomicWriteFile(registryPath, JSON.stringify({ stores: storedStores }, null, 2));
|
|
5480
5580
|
}
|
|
5481
5581
|
};
|
|
5482
5582
|
|
|
@@ -5524,7 +5624,7 @@ function validateParsePythonResult(data) {
|
|
|
5524
5624
|
}
|
|
5525
5625
|
|
|
5526
5626
|
// src/crawl/bridge.ts
|
|
5527
|
-
var
|
|
5627
|
+
var logger5 = createLogger("python-bridge");
|
|
5528
5628
|
function getPythonExecutable() {
|
|
5529
5629
|
return process.platform === "win32" ? "python" : "python3";
|
|
5530
5630
|
}
|
|
@@ -5559,7 +5659,7 @@ var PythonBridge = class {
|
|
|
5559
5659
|
pythonWorkerPath = path3.join(projectRoot, "python", "ast_worker.py");
|
|
5560
5660
|
pythonPath = getPythonExecutable();
|
|
5561
5661
|
}
|
|
5562
|
-
|
|
5662
|
+
logger5.debug(
|
|
5563
5663
|
{ pythonWorkerPath, pythonPath, currentFilePath, isProduction },
|
|
5564
5664
|
"Starting Python bridge process"
|
|
5565
5665
|
);
|
|
@@ -5567,15 +5667,15 @@ var PythonBridge = class {
|
|
|
5567
5667
|
stdio: ["pipe", "pipe", "pipe"]
|
|
5568
5668
|
});
|
|
5569
5669
|
this.process.on("error", (err2) => {
|
|
5570
|
-
|
|
5670
|
+
logger5.error({ error: err2.message, stack: err2.stack }, "Python bridge process error");
|
|
5571
5671
|
this.rejectAllPending(new Error(`Process error: ${err2.message}`));
|
|
5572
5672
|
});
|
|
5573
5673
|
this.process.on("exit", (code, signal) => {
|
|
5574
5674
|
if (code !== 0 && code !== null) {
|
|
5575
|
-
|
|
5675
|
+
logger5.error({ code }, "Python bridge process exited with non-zero code");
|
|
5576
5676
|
this.rejectAllPending(new Error(`Process exited with code ${String(code)}`));
|
|
5577
5677
|
} else if (signal && !this.stoppingIntentionally) {
|
|
5578
|
-
|
|
5678
|
+
logger5.error({ signal }, "Python bridge process killed with signal");
|
|
5579
5679
|
this.rejectAllPending(new Error(`Process killed with signal ${signal}`));
|
|
5580
5680
|
}
|
|
5581
5681
|
this.process = null;
|
|
@@ -5584,7 +5684,7 @@ var PythonBridge = class {
|
|
|
5584
5684
|
if (this.process.stderr) {
|
|
5585
5685
|
this.stderrReadline = createInterface({ input: this.process.stderr });
|
|
5586
5686
|
this.stderrReadline.on("line", (line) => {
|
|
5587
|
-
|
|
5687
|
+
logger5.warn({ stderr: line }, "Python bridge stderr output");
|
|
5588
5688
|
});
|
|
5589
5689
|
}
|
|
5590
5690
|
if (this.process.stdout === null) {
|
|
@@ -5613,7 +5713,7 @@ var PythonBridge = class {
|
|
|
5613
5713
|
pending.resolve(validated);
|
|
5614
5714
|
} catch (error) {
|
|
5615
5715
|
if (error instanceof ZodError) {
|
|
5616
|
-
|
|
5716
|
+
logger5.error(
|
|
5617
5717
|
{
|
|
5618
5718
|
issues: error.issues,
|
|
5619
5719
|
response: JSON.stringify(response.result)
|
|
@@ -5625,14 +5725,14 @@ var PythonBridge = class {
|
|
|
5625
5725
|
);
|
|
5626
5726
|
} else {
|
|
5627
5727
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
5628
|
-
|
|
5728
|
+
logger5.error({ error: errorMessage }, "Response validation error");
|
|
5629
5729
|
pending.reject(new Error(`Response validation error: ${errorMessage}`));
|
|
5630
5730
|
}
|
|
5631
5731
|
}
|
|
5632
5732
|
}
|
|
5633
5733
|
}
|
|
5634
5734
|
} catch (err2) {
|
|
5635
|
-
|
|
5735
|
+
logger5.error(
|
|
5636
5736
|
{
|
|
5637
5737
|
error: err2 instanceof Error ? err2.message : String(err2),
|
|
5638
5738
|
line
|
|
@@ -5962,6 +6062,8 @@ var EmbeddingEngine = class {
|
|
|
5962
6062
|
};
|
|
5963
6063
|
|
|
5964
6064
|
// src/db/lance.ts
|
|
6065
|
+
import { rm as rm2 } from "fs/promises";
|
|
6066
|
+
import { join as join12 } from "path";
|
|
5965
6067
|
import * as lancedb from "@lancedb/lancedb";
|
|
5966
6068
|
import { LanceSchema } from "@lancedb/lancedb/embedding";
|
|
5967
6069
|
import { Utf8 } from "apache-arrow";
|
|
@@ -6062,6 +6164,7 @@ var DocumentMetadataSchema = z5.object({
|
|
|
6062
6164
|
}).loose();
|
|
6063
6165
|
|
|
6064
6166
|
// src/db/lance.ts
|
|
6167
|
+
var logger6 = createLogger("lance");
|
|
6065
6168
|
function isSearchHit(value) {
|
|
6066
6169
|
if (typeof value !== "object" || value === null) return false;
|
|
6067
6170
|
return "id" in value && "content" in value && "metadata" in value && "_distance" in value && typeof value.id === "string" && typeof value.content === "string" && typeof value.metadata === "string" && typeof value._distance === "number";
|
|
@@ -6239,7 +6342,13 @@ var LanceStore = class {
|
|
|
6239
6342
|
const tableNames = await this.connection.tableNames();
|
|
6240
6343
|
if (tableNames.includes(tableName)) {
|
|
6241
6344
|
await this.connection.dropTable(tableName);
|
|
6242
|
-
|
|
6345
|
+
}
|
|
6346
|
+
this.tables.delete(tableName);
|
|
6347
|
+
const lanceDir = join12(this.dataDir, `${tableName}.lance`);
|
|
6348
|
+
try {
|
|
6349
|
+
await rm2(lanceDir, { recursive: true, force: true });
|
|
6350
|
+
} catch (error) {
|
|
6351
|
+
logger6.warn({ lanceDir, error }, "Failed to remove .lance directory");
|
|
6243
6352
|
}
|
|
6244
6353
|
}
|
|
6245
6354
|
close() {
|
|
@@ -6276,7 +6385,7 @@ var LanceStore = class {
|
|
|
6276
6385
|
};
|
|
6277
6386
|
|
|
6278
6387
|
// src/services/index.ts
|
|
6279
|
-
var
|
|
6388
|
+
var logger7 = createLogger("services");
|
|
6280
6389
|
var LazyServiceContainer = class {
|
|
6281
6390
|
// Eagerly initialized (lightweight)
|
|
6282
6391
|
config;
|
|
@@ -6307,7 +6416,7 @@ var LazyServiceContainer = class {
|
|
|
6307
6416
|
*/
|
|
6308
6417
|
get embeddings() {
|
|
6309
6418
|
if (this._embeddings === null) {
|
|
6310
|
-
|
|
6419
|
+
logger7.debug("Lazy-initializing EmbeddingEngine");
|
|
6311
6420
|
this._embeddings = new EmbeddingEngine(this.appConfig.embedding);
|
|
6312
6421
|
}
|
|
6313
6422
|
return this._embeddings;
|
|
@@ -6317,7 +6426,7 @@ var LazyServiceContainer = class {
|
|
|
6317
6426
|
*/
|
|
6318
6427
|
get codeGraph() {
|
|
6319
6428
|
if (this._codeGraph === null) {
|
|
6320
|
-
|
|
6429
|
+
logger7.debug("Lazy-initializing CodeGraphService");
|
|
6321
6430
|
this._codeGraph = new CodeGraphService(this.dataDir, this.pythonBridge);
|
|
6322
6431
|
}
|
|
6323
6432
|
return this._codeGraph;
|
|
@@ -6327,7 +6436,7 @@ var LazyServiceContainer = class {
|
|
|
6327
6436
|
*/
|
|
6328
6437
|
get search() {
|
|
6329
6438
|
if (this._search === null) {
|
|
6330
|
-
|
|
6439
|
+
logger7.debug("Lazy-initializing SearchService");
|
|
6331
6440
|
this._search = new SearchService(this.lance, this.codeGraph, this.appConfig.search);
|
|
6332
6441
|
}
|
|
6333
6442
|
return this._search;
|
|
@@ -6337,7 +6446,7 @@ var LazyServiceContainer = class {
|
|
|
6337
6446
|
*/
|
|
6338
6447
|
get index() {
|
|
6339
6448
|
if (this._index === null) {
|
|
6340
|
-
|
|
6449
|
+
logger7.debug("Lazy-initializing IndexService");
|
|
6341
6450
|
this._index = new IndexService(this.lance, this.embeddings, {
|
|
6342
6451
|
codeGraphService: this.codeGraph,
|
|
6343
6452
|
manifestService: this.manifest,
|
|
@@ -6354,7 +6463,7 @@ var LazyServiceContainer = class {
|
|
|
6354
6463
|
*/
|
|
6355
6464
|
get manifest() {
|
|
6356
6465
|
if (this._manifest === null) {
|
|
6357
|
-
|
|
6466
|
+
logger7.debug("Lazy-initializing ManifestService");
|
|
6358
6467
|
this._manifest = new ManifestService(this.dataDir);
|
|
6359
6468
|
}
|
|
6360
6469
|
return this._manifest;
|
|
@@ -6373,7 +6482,7 @@ var LazyServiceContainer = class {
|
|
|
6373
6482
|
}
|
|
6374
6483
|
};
|
|
6375
6484
|
async function createLazyServices(configPath, dataDir, projectRoot) {
|
|
6376
|
-
|
|
6485
|
+
logger7.info({ configPath, dataDir, projectRoot }, "Initializing lazy services");
|
|
6377
6486
|
const startTime = Date.now();
|
|
6378
6487
|
const config = new ConfigService(configPath, dataDir, projectRoot);
|
|
6379
6488
|
const appConfig = await config.load();
|
|
@@ -6394,14 +6503,14 @@ async function createLazyServices(configPath, dataDir, projectRoot) {
|
|
|
6394
6503
|
await store.initialize();
|
|
6395
6504
|
await lance.setEmbeddingFunction(appConfig.embedding);
|
|
6396
6505
|
const durationMs = Date.now() - startTime;
|
|
6397
|
-
|
|
6506
|
+
logger7.info(
|
|
6398
6507
|
{ dataDir: resolvedDataDir, projectRoot: resolvedProjectRoot, durationMs },
|
|
6399
6508
|
"Lazy services initialized"
|
|
6400
6509
|
);
|
|
6401
6510
|
return new LazyServiceContainer(config, appConfig, resolvedDataDir, store, lance, pythonBridge);
|
|
6402
6511
|
}
|
|
6403
6512
|
async function createServices(configPath, dataDir, projectRoot) {
|
|
6404
|
-
|
|
6513
|
+
logger7.info({ configPath, dataDir, projectRoot }, "Initializing services");
|
|
6405
6514
|
const config = new ConfigService(configPath, dataDir, projectRoot);
|
|
6406
6515
|
const appConfig = await config.load();
|
|
6407
6516
|
const resolvedDataDir = config.resolveDataDir();
|
|
@@ -6433,7 +6542,7 @@ async function createServices(configPath, dataDir, projectRoot) {
|
|
|
6433
6542
|
concurrency: appConfig.indexing.concurrency,
|
|
6434
6543
|
ignorePatterns: appConfig.indexing.ignorePatterns
|
|
6435
6544
|
});
|
|
6436
|
-
|
|
6545
|
+
logger7.info(
|
|
6437
6546
|
{ dataDir: resolvedDataDir, projectRoot: resolvedProjectRoot },
|
|
6438
6547
|
"Services initialized successfully"
|
|
6439
6548
|
);
|
|
@@ -6450,20 +6559,20 @@ async function createServices(configPath, dataDir, projectRoot) {
|
|
|
6450
6559
|
};
|
|
6451
6560
|
}
|
|
6452
6561
|
async function destroyServices(services) {
|
|
6453
|
-
|
|
6562
|
+
logger7.info("Shutting down services");
|
|
6454
6563
|
const errors = [];
|
|
6455
6564
|
const isLazyContainer = services instanceof LazyServiceContainer;
|
|
6456
6565
|
const shouldCleanupSearch = !isLazyContainer || services.hasSearch;
|
|
6457
6566
|
if (shouldCleanupSearch) {
|
|
6458
6567
|
services.search.cleanup();
|
|
6459
6568
|
} else {
|
|
6460
|
-
|
|
6569
|
+
logger7.debug("Skipping search cleanup (not initialized)");
|
|
6461
6570
|
}
|
|
6462
6571
|
try {
|
|
6463
6572
|
await services.pythonBridge.stop();
|
|
6464
6573
|
} catch (e) {
|
|
6465
6574
|
const error = e instanceof Error ? e : new Error(String(e));
|
|
6466
|
-
|
|
6575
|
+
logger7.error({ error }, "Error stopping Python bridge");
|
|
6467
6576
|
errors.push(error);
|
|
6468
6577
|
}
|
|
6469
6578
|
const shouldDisposeEmbeddings = !isLazyContainer || services.hasEmbeddings;
|
|
@@ -6472,17 +6581,17 @@ async function destroyServices(services) {
|
|
|
6472
6581
|
await services.embeddings.dispose();
|
|
6473
6582
|
} catch (e) {
|
|
6474
6583
|
const error = e instanceof Error ? e : new Error(String(e));
|
|
6475
|
-
|
|
6584
|
+
logger7.error({ error }, "Error disposing EmbeddingEngine");
|
|
6476
6585
|
errors.push(error);
|
|
6477
6586
|
}
|
|
6478
6587
|
} else {
|
|
6479
|
-
|
|
6588
|
+
logger7.debug("Skipping embeddings disposal (not initialized)");
|
|
6480
6589
|
}
|
|
6481
6590
|
try {
|
|
6482
6591
|
await services.lance.closeAsync();
|
|
6483
6592
|
} catch (e) {
|
|
6484
6593
|
const error = e instanceof Error ? e : new Error(String(e));
|
|
6485
|
-
|
|
6594
|
+
logger7.error({ error }, "Error closing LanceStore");
|
|
6486
6595
|
errors.push(error);
|
|
6487
6596
|
}
|
|
6488
6597
|
await shutdownLogger();
|
|
@@ -6516,4 +6625,4 @@ export {
|
|
|
6516
6625
|
createServices,
|
|
6517
6626
|
destroyServices
|
|
6518
6627
|
};
|
|
6519
|
-
//# sourceMappingURL=chunk-
|
|
6628
|
+
//# sourceMappingURL=chunk-GB5WKUBX.js.map
|