@massa-ai/tools-api 1.35.1 → 1.36.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.
Files changed (2) hide show
  1. package/dist/index.js +24 -3
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -116739,6 +116739,7 @@ class IndexJobTracker {
116739
116739
  filesIndexed: r2?.filesIndexed ?? 0,
116740
116740
  chunksIndexed: r2?.chunksIndexed ?? 0,
116741
116741
  symbolsIndexed: 0,
116742
+ errors: r2?.errors ?? 0,
116742
116743
  durationMs: r2?.duration ?? 0,
116743
116744
  activatedGraphGenerationId: r2?.activatedGraphGenerationId ?? ""
116744
116745
  });
@@ -116760,6 +116761,11 @@ var init_index_job_tracker = __esm(() => {
116760
116761
  indexJobTracker = IndexJobTracker.getInstance();
116761
116762
  });
116762
116763
 
116764
+ // ../../packages/core/dist/kernel/sanitize/strip-nul.js
116765
+ function stripNul(content) {
116766
+ return content.includes("\x00") ? content.replaceAll("\x00", "") : content;
116767
+ }
116768
+
116763
116769
  // ../../packages/core/dist/services/etl/stages/discover.js
116764
116770
  import fs9 from "fs/promises";
116765
116771
  import path15 from "path";
@@ -116850,7 +116856,7 @@ class DiscoverStage {
116850
116856
  const absolutePath = path15.join(ctx.projectPath, relativePath);
116851
116857
  try {
116852
116858
  const stat2 = await fs9.stat(absolutePath);
116853
- const content = await fs9.readFile(absolutePath, "utf-8");
116859
+ const content = stripNul(await fs9.readFile(absolutePath, "utf-8"));
116854
116860
  const contentHash = createHash5("sha256").update(content).digest("hex");
116855
116861
  let needsReparse = forceReindex;
116856
116862
  if (!forceReindex) {
@@ -120911,6 +120917,7 @@ class LoadStage {
120911
120917
  let chunksLoaded = 0;
120912
120918
  let symbolsLoaded = 0;
120913
120919
  let errors5 = 0;
120920
+ const fileErrors = [];
120914
120921
  let processedSinceStart = 0;
120915
120922
  let lastEtaLogAt = 0;
120916
120923
  const BATCH = 10;
@@ -120981,6 +120988,12 @@ class LoadStage {
120981
120988
  } catch (err) {
120982
120989
  errors5++;
120983
120990
  processedSinceStart++;
120991
+ if (fileErrors.length < MAX_FILE_ERRORS) {
120992
+ fileErrors.push({
120993
+ filePath: file3.file.relativePath,
120994
+ error: err.message
120995
+ });
120996
+ }
120984
120997
  if (emitLifecycle)
120985
120998
  ctx.emit({
120986
120999
  type: "file_error",
@@ -121046,7 +121059,7 @@ class LoadStage {
121046
121059
  duration: formatDuration(durationMs),
121047
121060
  filesPerSec: filesLoaded > 0 && durationMs > 0 ? Number((filesLoaded / durationMs * 1000).toFixed(2)) : 0
121048
121061
  });
121049
- return { filesLoaded, chunksLoaded, symbolsLoaded, errors: errors5 };
121062
+ return { filesLoaded, chunksLoaded, symbolsLoaded, errors: errors5, fileErrors };
121050
121063
  }
121051
121064
  async loadToSearchStores(ctx, file3) {
121052
121065
  if (file3.chunks.length === 0)
@@ -121118,6 +121131,7 @@ class LoadStage {
121118
121131
  return batch.definitions.length;
121119
121132
  }
121120
121133
  }
121134
+ var MAX_FILE_ERRORS = 50;
121121
121135
  var init_load = __esm(() => {
121122
121136
  init_dist();
121123
121137
  init_with_deadlock_retry();
@@ -121860,7 +121874,12 @@ var init_pipeline = __esm(() => {
121860
121874
  throw managedRunLeaseLost;
121861
121875
  stageTimings.load = Math.round(performance.now() - st4);
121862
121876
  if (loadResult.errors > 0) {
121863
- throw new Error(`ETL completed with ${loadResult.errors} file error${loadResult.errors === 1 ? "" : "s"}`);
121877
+ logger.warn("EtlPipeline: completed with file errors", {
121878
+ projectId,
121879
+ jobId,
121880
+ errors: loadResult.errors,
121881
+ fileErrors: (loadResult.fileErrors ?? []).slice(0, 10)
121882
+ });
121864
121883
  }
121865
121884
  const activationSnapshot = await abortable(this.discover.run(ctx, { forceReindex, includeTests: include_tests }), graphAbortController.signal);
121866
121885
  if (buildGraphInputSnapshotHash(activationSnapshot) !== graphGenerationLease.inputSnapshotHash) {
@@ -121917,6 +121936,7 @@ var init_pipeline = __esm(() => {
121917
121936
  filesIndexed: result.filesIndexed,
121918
121937
  chunksIndexed: result.chunksIndexed,
121919
121938
  errors: result.errors,
121939
+ fileErrors: loadResult.fileErrors ?? [],
121920
121940
  duration: durationMs,
121921
121941
  activatedGraphGenerationId: result.activatedGraphGenerationId,
121922
121942
  parserDiagnostics: result.parserDiagnostics
@@ -121927,6 +121947,7 @@ var init_pipeline = __esm(() => {
121927
121947
  filesIndexed: result.filesIndexed,
121928
121948
  chunksIndexed: result.chunksIndexed,
121929
121949
  symbolsIndexed: result.symbolsIndexed,
121950
+ errors: result.errors,
121930
121951
  durationMs,
121931
121952
  activatedGraphGenerationId: result.activatedGraphGenerationId
121932
121953
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/tools-api",
3
- "version": "1.35.1",
3
+ "version": "1.36.0",
4
4
  "author": "luizgmassa",
5
5
  "description": "massa-ai REST API server - Semantic code search, memory, and context compression",
6
6
  "type": "module",
@@ -21,8 +21,8 @@
21
21
  "test": "bun scripts/run-tests-isolated.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@massa-ai/core": "^1.35.1",
25
- "@massa-ai/shared": "^1.35.1",
24
+ "@massa-ai/core": "^1.36.0",
25
+ "@massa-ai/shared": "^1.36.0",
26
26
  "elysia": "^1.2.25",
27
27
  "@elysiajs/swagger": "^1.2.0",
28
28
  "@elysiajs/cors": "^1.2.0",