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.
@@ -2434,6 +2434,10 @@ var DEFAULT_CONFIG2 = {
2434
2434
  // 5 minutes
2435
2435
  cleanupDays: 7
2436
2436
  };
2437
+ function isRetryableLanceCommitConflict(error) {
2438
+ const normalized = error.toLowerCase();
2439
+ return normalized.includes("lance") && normalized.includes("commit") && normalized.includes("conflict");
2440
+ }
2437
2441
  var VectorOutbox = class {
2438
2442
  constructor(db, config) {
2439
2443
  this.db = db;
@@ -2538,6 +2542,16 @@ var VectorOutbox = class {
2538
2542
  );
2539
2543
  if (rows.length === 0) return;
2540
2544
  const retryCount = rows[0].retry_count;
2545
+ if (isRetryableLanceCommitConflict(error)) {
2546
+ await dbRun(
2547
+ this.db,
2548
+ `UPDATE vector_outbox
2549
+ SET status = 'pending', error = ?, updated_at = ?
2550
+ WHERE job_id = ?`,
2551
+ [error, now, jobId]
2552
+ );
2553
+ return;
2554
+ }
2541
2555
  const newStatus = retryCount >= this.config.maxRetries - 1 ? "failed" : "pending";
2542
2556
  await dbRun(
2543
2557
  this.db,
@@ -4221,6 +4235,7 @@ var SQLiteEventStore = class {
4221
4235
  async getOutboxStats(options = {}) {
4222
4236
  await this.initialize();
4223
4237
  const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
4238
+ const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
4224
4239
  const now = options.now ?? /* @__PURE__ */ new Date();
4225
4240
  const threshold = new Date(now.getTime() - thresholdMs).toISOString();
4226
4241
  const embeddingRows = sqliteAll(
@@ -4238,8 +4253,8 @@ var SQLiteEventStore = class {
4238
4253
  if (!Number.isFinite(time)) return null;
4239
4254
  return Math.max(0, now.getTime() - time);
4240
4255
  };
4241
- const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs) => {
4242
- const out = { pending: 0, processing: 0, failed: 0, total: 0, stuckProcessing, oldestProcessingAgeMs };
4256
+ const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs, retryableFailed, quarantinedFailed) => {
4257
+ const out = { pending: 0, processing: 0, failed: 0, retryableFailed, quarantinedFailed, total: 0, stuckProcessing, oldestProcessingAgeMs };
4243
4258
  for (const row of rows) {
4244
4259
  const key = row.status;
4245
4260
  if (key === "pending" || key === "processing" || key === "failed") {
@@ -4263,6 +4278,22 @@ var SQLiteEventStore = class {
4263
4278
  FROM embedding_outbox
4264
4279
  WHERE status = 'processing'`
4265
4280
  );
4281
+ const embeddingRetryableFailed = sqliteGet(
4282
+ this.db,
4283
+ `SELECT COUNT(*) as count
4284
+ FROM embedding_outbox
4285
+ WHERE status = 'failed'
4286
+ AND retry_count < ?`,
4287
+ [maxRetries]
4288
+ );
4289
+ const embeddingQuarantinedFailed = sqliteGet(
4290
+ this.db,
4291
+ `SELECT COUNT(*) as count
4292
+ FROM embedding_outbox
4293
+ WHERE status = 'failed'
4294
+ AND retry_count >= ?`,
4295
+ [maxRetries]
4296
+ );
4266
4297
  const vectorStuck = sqliteGet(
4267
4298
  this.db,
4268
4299
  `SELECT COUNT(*) as count
@@ -4277,16 +4308,36 @@ var SQLiteEventStore = class {
4277
4308
  FROM vector_outbox
4278
4309
  WHERE status = 'processing'`
4279
4310
  );
4311
+ const vectorRetryableFailed = sqliteGet(
4312
+ this.db,
4313
+ `SELECT COUNT(*) as count
4314
+ FROM vector_outbox
4315
+ WHERE status = 'failed'
4316
+ AND retry_count < ?`,
4317
+ [maxRetries]
4318
+ );
4319
+ const vectorQuarantinedFailed = sqliteGet(
4320
+ this.db,
4321
+ `SELECT COUNT(*) as count
4322
+ FROM vector_outbox
4323
+ WHERE status = 'failed'
4324
+ AND retry_count >= ?`,
4325
+ [maxRetries]
4326
+ );
4280
4327
  return {
4281
4328
  embedding: fromRows(
4282
4329
  embeddingRows,
4283
4330
  Number(embeddingStuck?.count ?? 0),
4284
- processingAgeMs(embeddingOldest?.oldest)
4331
+ processingAgeMs(embeddingOldest?.oldest),
4332
+ Number(embeddingRetryableFailed?.count ?? 0),
4333
+ Number(embeddingQuarantinedFailed?.count ?? 0)
4285
4334
  ),
4286
4335
  vector: fromRows(
4287
4336
  vectorRows,
4288
4337
  Number(vectorStuck?.count ?? 0),
4289
- processingAgeMs(vectorOldest?.oldest)
4338
+ processingAgeMs(vectorOldest?.oldest),
4339
+ Number(vectorRetryableFailed?.count ?? 0),
4340
+ Number(vectorQuarantinedFailed?.count ?? 0)
4290
4341
  )
4291
4342
  };
4292
4343
  }