claude-memory-layer 1.0.51 → 1.0.52

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/mcp/index.js CHANGED
@@ -13419,6 +13419,10 @@ var DEFAULT_CONFIG2 = {
13419
13419
  // 5 minutes
13420
13420
  cleanupDays: 7
13421
13421
  };
13422
+ function isRetryableLanceCommitConflict(error) {
13423
+ const normalized = error.toLowerCase();
13424
+ return normalized.includes("lance") && normalized.includes("commit") && normalized.includes("conflict");
13425
+ }
13422
13426
  var VectorOutbox = class {
13423
13427
  constructor(db, config) {
13424
13428
  this.db = db;
@@ -13523,6 +13527,16 @@ var VectorOutbox = class {
13523
13527
  );
13524
13528
  if (rows.length === 0) return;
13525
13529
  const retryCount = rows[0].retry_count;
13530
+ if (isRetryableLanceCommitConflict(error)) {
13531
+ await dbRun(
13532
+ this.db,
13533
+ `UPDATE vector_outbox
13534
+ SET status = 'pending', error = ?, updated_at = ?
13535
+ WHERE job_id = ?`,
13536
+ [error, now, jobId]
13537
+ );
13538
+ return;
13539
+ }
13526
13540
  const newStatus = retryCount >= this.config.maxRetries - 1 ? "failed" : "pending";
13527
13541
  await dbRun(
13528
13542
  this.db,
@@ -15206,6 +15220,7 @@ var SQLiteEventStore = class {
15206
15220
  async getOutboxStats(options = {}) {
15207
15221
  await this.initialize();
15208
15222
  const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
15223
+ const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
15209
15224
  const now = options.now ?? /* @__PURE__ */ new Date();
15210
15225
  const threshold = new Date(now.getTime() - thresholdMs).toISOString();
15211
15226
  const embeddingRows = sqliteAll(
@@ -15223,8 +15238,8 @@ var SQLiteEventStore = class {
15223
15238
  if (!Number.isFinite(time)) return null;
15224
15239
  return Math.max(0, now.getTime() - time);
15225
15240
  };
15226
- const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs) => {
15227
- const out = { pending: 0, processing: 0, failed: 0, total: 0, stuckProcessing, oldestProcessingAgeMs };
15241
+ const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs, retryableFailed, quarantinedFailed) => {
15242
+ const out = { pending: 0, processing: 0, failed: 0, retryableFailed, quarantinedFailed, total: 0, stuckProcessing, oldestProcessingAgeMs };
15228
15243
  for (const row of rows) {
15229
15244
  const key = row.status;
15230
15245
  if (key === "pending" || key === "processing" || key === "failed") {
@@ -15248,6 +15263,22 @@ var SQLiteEventStore = class {
15248
15263
  FROM embedding_outbox
15249
15264
  WHERE status = 'processing'`
15250
15265
  );
15266
+ const embeddingRetryableFailed = sqliteGet(
15267
+ this.db,
15268
+ `SELECT COUNT(*) as count
15269
+ FROM embedding_outbox
15270
+ WHERE status = 'failed'
15271
+ AND retry_count < ?`,
15272
+ [maxRetries]
15273
+ );
15274
+ const embeddingQuarantinedFailed = sqliteGet(
15275
+ this.db,
15276
+ `SELECT COUNT(*) as count
15277
+ FROM embedding_outbox
15278
+ WHERE status = 'failed'
15279
+ AND retry_count >= ?`,
15280
+ [maxRetries]
15281
+ );
15251
15282
  const vectorStuck = sqliteGet(
15252
15283
  this.db,
15253
15284
  `SELECT COUNT(*) as count
@@ -15262,16 +15293,36 @@ var SQLiteEventStore = class {
15262
15293
  FROM vector_outbox
15263
15294
  WHERE status = 'processing'`
15264
15295
  );
15296
+ const vectorRetryableFailed = sqliteGet(
15297
+ this.db,
15298
+ `SELECT COUNT(*) as count
15299
+ FROM vector_outbox
15300
+ WHERE status = 'failed'
15301
+ AND retry_count < ?`,
15302
+ [maxRetries]
15303
+ );
15304
+ const vectorQuarantinedFailed = sqliteGet(
15305
+ this.db,
15306
+ `SELECT COUNT(*) as count
15307
+ FROM vector_outbox
15308
+ WHERE status = 'failed'
15309
+ AND retry_count >= ?`,
15310
+ [maxRetries]
15311
+ );
15265
15312
  return {
15266
15313
  embedding: fromRows(
15267
15314
  embeddingRows,
15268
15315
  Number(embeddingStuck?.count ?? 0),
15269
- processingAgeMs(embeddingOldest?.oldest)
15316
+ processingAgeMs(embeddingOldest?.oldest),
15317
+ Number(embeddingRetryableFailed?.count ?? 0),
15318
+ Number(embeddingQuarantinedFailed?.count ?? 0)
15270
15319
  ),
15271
15320
  vector: fromRows(
15272
15321
  vectorRows,
15273
15322
  Number(vectorStuck?.count ?? 0),
15274
- processingAgeMs(vectorOldest?.oldest)
15323
+ processingAgeMs(vectorOldest?.oldest),
15324
+ Number(vectorRetryableFailed?.count ?? 0),
15325
+ Number(vectorQuarantinedFailed?.count ?? 0)
15275
15326
  )
15276
15327
  };
15277
15328
  }