ctxloom-pro 1.0.28 → 1.0.29

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.
@@ -145,10 +145,12 @@ function collectFiles(dir, results = []) {
145
145
  }
146
146
  return results;
147
147
  }
148
+ var MIN_MODEL_BYTES;
148
149
  var init_embedder = __esm({
149
150
  "../../packages/core/src/indexer/embedder.ts"() {
150
151
  "use strict";
151
152
  init_logger();
153
+ MIN_MODEL_BYTES = 80 * 1024 * 1024;
152
154
  }
153
155
  });
154
156
 
@@ -9,6 +9,7 @@ import path from "path";
9
9
  var EMBEDDING_DIMENSION = 384;
10
10
  var MODEL_ID = "sentence-transformers/all-MiniLM-L6-v2";
11
11
  var CHUNK_SIZE = 4096;
12
+ var MIN_MODEL_BYTES = 80 * 1024 * 1024;
12
13
  var embedder = null;
13
14
  var embedderInitInFlight = null;
14
15
  async function loadEmbedder() {
@@ -16,6 +17,29 @@ async function loadEmbedder() {
16
17
  dtype: "fp32"
17
18
  });
18
19
  }
20
+ function extractModelPathFromProtobufError(message) {
21
+ const match = /Load model from (.+) failed:Protobuf parsing failed/i.exec(message);
22
+ return match ? match[1] : null;
23
+ }
24
+ function tryRemoveTruncatedModel(modelPath) {
25
+ try {
26
+ const stat = fs.statSync(modelPath);
27
+ if (stat.size >= MIN_MODEL_BYTES) return false;
28
+ fs.unlinkSync(modelPath);
29
+ logger.warn("Removed truncated embedding model; next attempt will re-download", {
30
+ path: modelPath,
31
+ sizeBytes: stat.size,
32
+ minBytes: MIN_MODEL_BYTES
33
+ });
34
+ return true;
35
+ } catch (err) {
36
+ logger.warn("Could not inspect/remove suspected truncated model", {
37
+ path: modelPath,
38
+ detail: err instanceof Error ? err.message : String(err)
39
+ });
40
+ return false;
41
+ }
42
+ }
19
43
  async function getEmbedder() {
20
44
  if (embedder) return embedder;
21
45
  if (embedderInitInFlight) return embedderInitInFlight;
@@ -32,6 +56,13 @@ async function getEmbedder() {
32
56
  const msg = err instanceof Error ? err.message : String(err);
33
57
  const isProtobufRace = /protobuf parsing failed/i.test(msg);
34
58
  if (!isProtobufRace || attempt === MAX_ATTEMPTS) break;
59
+ const modelPath = extractModelPathFromProtobufError(msg);
60
+ if (modelPath && tryRemoveTruncatedModel(modelPath)) {
61
+ logger.warn("Retrying embedding model load after truncated-cache removal", {
62
+ attempt
63
+ });
64
+ continue;
65
+ }
35
66
  const delay = attempt * 1e3;
36
67
  logger.warn("Embedding model load failed; retrying after FS settle", {
37
68
  attempt,
@@ -180,4 +211,4 @@ export {
180
211
  collectFiles,
181
212
  indexDirectory
182
213
  };
183
- //# sourceMappingURL=chunk-NYBVAPM3.js.map
214
+ //# sourceMappingURL=chunk-VR6PNQYH.js.map
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  collectFiles,
6
6
  generateEmbedding
7
- } from "./chunk-NYBVAPM3.js";
7
+ } from "./chunk-VR6PNQYH.js";
8
8
  import {
9
9
  logger
10
10
  } from "./chunk-TYDMSHV7.js";
@@ -6637,7 +6637,7 @@ function registerFullTextSearchTool(registry, ctx) {
6637
6637
  const { query, mode, case_sensitive, limit, context_lines } = Schema22.parse(args);
6638
6638
  if (mode === "semantic") {
6639
6639
  try {
6640
- const { generateEmbedding: generateEmbedding2 } = await import("./embedder-ZGEKFHHK.js");
6640
+ const { generateEmbedding: generateEmbedding2 } = await import("./embedder-MPDEA6P7.js");
6641
6641
  const store = await ctx.getStore();
6642
6642
  const embedding = await generateEmbedding2(query);
6643
6643
  const results = await store.search(embedding, limit);
@@ -6674,7 +6674,7 @@ function registerFullTextSearchTool(registry, ctx) {
6674
6674
  let merged = keywordResults.slice(0, limit);
6675
6675
  if (mode === "hybrid") {
6676
6676
  try {
6677
- const { generateEmbedding: generateEmbedding2 } = await import("./embedder-ZGEKFHHK.js");
6677
+ const { generateEmbedding: generateEmbedding2 } = await import("./embedder-MPDEA6P7.js");
6678
6678
  const store = await ctx.getStore();
6679
6679
  const embedding = await generateEmbedding2(query);
6680
6680
  const vectorResults = await store.search(embedding, Math.ceil(limit / 2));
@@ -8795,4 +8795,4 @@ export {
8795
8795
  track,
8796
8796
  captureError
8797
8797
  };
8798
- //# sourceMappingURL=chunk-3AF7Z7DD.js.map
8798
+ //# sourceMappingURL=chunk-WQMLQTFY.js.map
@@ -3,7 +3,7 @@ import {
3
3
  collectFiles,
4
4
  generateEmbedding,
5
5
  indexDirectory
6
- } from "./chunk-NYBVAPM3.js";
6
+ } from "./chunk-VR6PNQYH.js";
7
7
  import "./chunk-TYDMSHV7.js";
8
8
  export {
9
9
  EMBEDDING_DIMENSION,
@@ -11,4 +11,4 @@ export {
11
11
  generateEmbedding,
12
12
  indexDirectory
13
13
  };
14
- //# sourceMappingURL=embedder-ZGEKFHHK.js.map
14
+ //# sourceMappingURL=embedder-MPDEA6P7.js.map
package/dist/index.js CHANGED
@@ -34,14 +34,14 @@ import {
34
34
  startTrial,
35
35
  track,
36
36
  writeCODEOWNERS
37
- } from "./chunk-3AF7Z7DD.js";
37
+ } from "./chunk-WQMLQTFY.js";
38
38
  import {
39
39
  VectorStore
40
40
  } from "./chunk-NEHYSE2Y.js";
41
41
  import {
42
42
  generateEmbedding,
43
43
  indexDirectory
44
- } from "./chunk-NYBVAPM3.js";
44
+ } from "./chunk-VR6PNQYH.js";
45
45
  import {
46
46
  logger
47
47
  } from "./chunk-TYDMSHV7.js";
@@ -616,7 +616,7 @@ try {
616
616
  } catch {
617
617
  }
618
618
  var args = process.argv.slice(2);
619
- var ctxloomVersion = "1.0.28".length > 0 ? "1.0.28" : "dev";
619
+ var ctxloomVersion = "1.0.29".length > 0 ? "1.0.29" : "dev";
620
620
  if (args.includes("--version") || args.includes("-v")) {
621
621
  process.stdout.write(`ctxloom ${ctxloomVersion}
622
622
  `);
@@ -689,7 +689,7 @@ async function checkLicense() {
689
689
  if (command !== void 0 && LICENSE_GATE_BYPASS_COMMANDS.has(command)) return;
690
690
  const ciKey = process.env["CTXLOOM_LICENSE_KEY"];
691
691
  if (ciKey) {
692
- const { ApiClient } = await import("./src-DZ5Z7KVU.js");
692
+ const { ApiClient } = await import("./src-YPSOSNW5.js");
693
693
  const client = new ApiClient(process.env["CTXLOOM_API_BASE"]);
694
694
  try {
695
695
  const result = await client.validate(ciKey, "ci-ephemeral");
@@ -1251,7 +1251,7 @@ Suggested reviewers for ${files.length} file(s):`);
1251
1251
  process.stderr.write("[ctxloom] --limit must be a non-negative integer (0 for unlimited)\n");
1252
1252
  process.exit(2);
1253
1253
  }
1254
- const { loadRulesConfig, RulesChecker, formatText, formatJson, RulesConfigError } = await import("./src-DZ5Z7KVU.js");
1254
+ const { loadRulesConfig, RulesChecker, formatText, formatJson, RulesConfigError } = await import("./src-YPSOSNW5.js");
1255
1255
  let config;
1256
1256
  try {
1257
1257
  config = await loadRulesConfig(root);
@@ -1275,7 +1275,7 @@ Suggested reviewers for ${files.length} file(s):`);
1275
1275
  }
1276
1276
  let graph;
1277
1277
  if (useSnapshot) {
1278
- const { DependencyGraph: DG } = await import("./src-DZ5Z7KVU.js");
1278
+ const { DependencyGraph: DG } = await import("./src-YPSOSNW5.js");
1279
1279
  graph = new DG();
1280
1280
  const loaded = await graph.loadSnapshotOnly(root);
1281
1281
  if (!loaded) {
@@ -1284,7 +1284,7 @@ Suggested reviewers for ${files.length} file(s):`);
1284
1284
  }
1285
1285
  } else {
1286
1286
  process.stderr.write("[ctxloom] Building dependency graph...\n");
1287
- const { ASTParser: ASTParser2, DependencyGraph: DependencyGraph2 } = await import("./src-DZ5Z7KVU.js");
1287
+ const { ASTParser: ASTParser2, DependencyGraph: DependencyGraph2 } = await import("./src-YPSOSNW5.js");
1288
1288
  let parser;
1289
1289
  try {
1290
1290
  parser = new ASTParser2();
@@ -80,7 +80,7 @@ import {
80
80
  startTrial,
81
81
  track,
82
82
  writeCODEOWNERS
83
- } from "./chunk-3AF7Z7DD.js";
83
+ } from "./chunk-WQMLQTFY.js";
84
84
  import {
85
85
  VectorStore
86
86
  } from "./chunk-NEHYSE2Y.js";
@@ -89,7 +89,7 @@ import {
89
89
  collectFiles,
90
90
  generateEmbedding,
91
91
  indexDirectory
92
- } from "./chunk-NYBVAPM3.js";
92
+ } from "./chunk-VR6PNQYH.js";
93
93
  import {
94
94
  logger
95
95
  } from "./chunk-TYDMSHV7.js";
@@ -182,4 +182,4 @@ export {
182
182
  track,
183
183
  writeCODEOWNERS
184
184
  };
185
- //# sourceMappingURL=src-DZ5Z7KVU.js.map
185
+ //# sourceMappingURL=src-YPSOSNW5.js.map
@@ -3,7 +3,7 @@ import {
3
3
  } from "../chunk-NEHYSE2Y.js";
4
4
  import {
5
5
  generateEmbedding
6
- } from "../chunk-NYBVAPM3.js";
6
+ } from "../chunk-VR6PNQYH.js";
7
7
  import "../chunk-TYDMSHV7.js";
8
8
 
9
9
  // packages/core/src/workers/indexerWorker.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ctxloom-pro",
3
- "version": "1.0.28",
3
+ "version": "1.0.29",
4
4
  "description": "ctxloom — The Universal Code Context Engine. A local-first MCP server providing intelligent code context via hybrid Vector + AST + Graph search with Skeletonization (92% token reduction).",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",