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.
@@ -2375,6 +2375,10 @@ var DEFAULT_CONFIG2 = {
2375
2375
  // 5 minutes
2376
2376
  cleanupDays: 7
2377
2377
  };
2378
+ function isRetryableLanceCommitConflict(error) {
2379
+ const normalized = error.toLowerCase();
2380
+ return normalized.includes("lance") && normalized.includes("commit") && normalized.includes("conflict");
2381
+ }
2378
2382
  var VectorOutbox = class {
2379
2383
  constructor(db, config) {
2380
2384
  this.db = db;
@@ -2479,6 +2483,16 @@ var VectorOutbox = class {
2479
2483
  );
2480
2484
  if (rows.length === 0) return;
2481
2485
  const retryCount = rows[0].retry_count;
2486
+ if (isRetryableLanceCommitConflict(error)) {
2487
+ await dbRun(
2488
+ this.db,
2489
+ `UPDATE vector_outbox
2490
+ SET status = 'pending', error = ?, updated_at = ?
2491
+ WHERE job_id = ?`,
2492
+ [error, now, jobId]
2493
+ );
2494
+ return;
2495
+ }
2482
2496
  const newStatus = retryCount >= this.config.maxRetries - 1 ? "failed" : "pending";
2483
2497
  await dbRun(
2484
2498
  this.db,
@@ -4162,6 +4176,7 @@ var SQLiteEventStore = class {
4162
4176
  async getOutboxStats(options = {}) {
4163
4177
  await this.initialize();
4164
4178
  const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
4179
+ const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
4165
4180
  const now = options.now ?? /* @__PURE__ */ new Date();
4166
4181
  const threshold = new Date(now.getTime() - thresholdMs).toISOString();
4167
4182
  const embeddingRows = sqliteAll(
@@ -4179,8 +4194,8 @@ var SQLiteEventStore = class {
4179
4194
  if (!Number.isFinite(time)) return null;
4180
4195
  return Math.max(0, now.getTime() - time);
4181
4196
  };
4182
- const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs) => {
4183
- const out = { pending: 0, processing: 0, failed: 0, total: 0, stuckProcessing, oldestProcessingAgeMs };
4197
+ const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs, retryableFailed, quarantinedFailed) => {
4198
+ const out = { pending: 0, processing: 0, failed: 0, retryableFailed, quarantinedFailed, total: 0, stuckProcessing, oldestProcessingAgeMs };
4184
4199
  for (const row of rows) {
4185
4200
  const key = row.status;
4186
4201
  if (key === "pending" || key === "processing" || key === "failed") {
@@ -4204,6 +4219,22 @@ var SQLiteEventStore = class {
4204
4219
  FROM embedding_outbox
4205
4220
  WHERE status = 'processing'`
4206
4221
  );
4222
+ const embeddingRetryableFailed = sqliteGet(
4223
+ this.db,
4224
+ `SELECT COUNT(*) as count
4225
+ FROM embedding_outbox
4226
+ WHERE status = 'failed'
4227
+ AND retry_count < ?`,
4228
+ [maxRetries]
4229
+ );
4230
+ const embeddingQuarantinedFailed = sqliteGet(
4231
+ this.db,
4232
+ `SELECT COUNT(*) as count
4233
+ FROM embedding_outbox
4234
+ WHERE status = 'failed'
4235
+ AND retry_count >= ?`,
4236
+ [maxRetries]
4237
+ );
4207
4238
  const vectorStuck = sqliteGet(
4208
4239
  this.db,
4209
4240
  `SELECT COUNT(*) as count
@@ -4218,16 +4249,36 @@ var SQLiteEventStore = class {
4218
4249
  FROM vector_outbox
4219
4250
  WHERE status = 'processing'`
4220
4251
  );
4252
+ const vectorRetryableFailed = sqliteGet(
4253
+ this.db,
4254
+ `SELECT COUNT(*) as count
4255
+ FROM vector_outbox
4256
+ WHERE status = 'failed'
4257
+ AND retry_count < ?`,
4258
+ [maxRetries]
4259
+ );
4260
+ const vectorQuarantinedFailed = sqliteGet(
4261
+ this.db,
4262
+ `SELECT COUNT(*) as count
4263
+ FROM vector_outbox
4264
+ WHERE status = 'failed'
4265
+ AND retry_count >= ?`,
4266
+ [maxRetries]
4267
+ );
4221
4268
  return {
4222
4269
  embedding: fromRows(
4223
4270
  embeddingRows,
4224
4271
  Number(embeddingStuck?.count ?? 0),
4225
- processingAgeMs(embeddingOldest?.oldest)
4272
+ processingAgeMs(embeddingOldest?.oldest),
4273
+ Number(embeddingRetryableFailed?.count ?? 0),
4274
+ Number(embeddingQuarantinedFailed?.count ?? 0)
4226
4275
  ),
4227
4276
  vector: fromRows(
4228
4277
  vectorRows,
4229
4278
  Number(vectorStuck?.count ?? 0),
4230
- processingAgeMs(vectorOldest?.oldest)
4279
+ processingAgeMs(vectorOldest?.oldest),
4280
+ Number(vectorRetryableFailed?.count ?? 0),
4281
+ Number(vectorQuarantinedFailed?.count ?? 0)
4231
4282
  )
4232
4283
  };
4233
4284
  }