claude-memory-layer 1.0.50 → 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.
@@ -2322,6 +2322,10 @@ var DEFAULT_CONFIG2 = {
2322
2322
  // 5 minutes
2323
2323
  cleanupDays: 7
2324
2324
  };
2325
+ function isRetryableLanceCommitConflict(error) {
2326
+ const normalized = error.toLowerCase();
2327
+ return normalized.includes("lance") && normalized.includes("commit") && normalized.includes("conflict");
2328
+ }
2325
2329
  var VectorOutbox = class {
2326
2330
  constructor(db, config) {
2327
2331
  this.db = db;
@@ -2426,6 +2430,16 @@ var VectorOutbox = class {
2426
2430
  );
2427
2431
  if (rows.length === 0) return;
2428
2432
  const retryCount = rows[0].retry_count;
2433
+ if (isRetryableLanceCommitConflict(error)) {
2434
+ await dbRun(
2435
+ this.db,
2436
+ `UPDATE vector_outbox
2437
+ SET status = 'pending', error = ?, updated_at = ?
2438
+ WHERE job_id = ?`,
2439
+ [error, now, jobId]
2440
+ );
2441
+ return;
2442
+ }
2429
2443
  const newStatus = retryCount >= this.config.maxRetries - 1 ? "failed" : "pending";
2430
2444
  await dbRun(
2431
2445
  this.db,
@@ -4109,6 +4123,7 @@ var SQLiteEventStore = class {
4109
4123
  async getOutboxStats(options = {}) {
4110
4124
  await this.initialize();
4111
4125
  const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
4126
+ const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
4112
4127
  const now = options.now ?? /* @__PURE__ */ new Date();
4113
4128
  const threshold = new Date(now.getTime() - thresholdMs).toISOString();
4114
4129
  const embeddingRows = sqliteAll(
@@ -4126,8 +4141,8 @@ var SQLiteEventStore = class {
4126
4141
  if (!Number.isFinite(time)) return null;
4127
4142
  return Math.max(0, now.getTime() - time);
4128
4143
  };
4129
- const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs) => {
4130
- const out = { pending: 0, processing: 0, failed: 0, total: 0, stuckProcessing, oldestProcessingAgeMs };
4144
+ const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs, retryableFailed, quarantinedFailed) => {
4145
+ const out = { pending: 0, processing: 0, failed: 0, retryableFailed, quarantinedFailed, total: 0, stuckProcessing, oldestProcessingAgeMs };
4131
4146
  for (const row of rows) {
4132
4147
  const key = row.status;
4133
4148
  if (key === "pending" || key === "processing" || key === "failed") {
@@ -4151,6 +4166,22 @@ var SQLiteEventStore = class {
4151
4166
  FROM embedding_outbox
4152
4167
  WHERE status = 'processing'`
4153
4168
  );
4169
+ const embeddingRetryableFailed = sqliteGet(
4170
+ this.db,
4171
+ `SELECT COUNT(*) as count
4172
+ FROM embedding_outbox
4173
+ WHERE status = 'failed'
4174
+ AND retry_count < ?`,
4175
+ [maxRetries]
4176
+ );
4177
+ const embeddingQuarantinedFailed = sqliteGet(
4178
+ this.db,
4179
+ `SELECT COUNT(*) as count
4180
+ FROM embedding_outbox
4181
+ WHERE status = 'failed'
4182
+ AND retry_count >= ?`,
4183
+ [maxRetries]
4184
+ );
4154
4185
  const vectorStuck = sqliteGet(
4155
4186
  this.db,
4156
4187
  `SELECT COUNT(*) as count
@@ -4165,16 +4196,36 @@ var SQLiteEventStore = class {
4165
4196
  FROM vector_outbox
4166
4197
  WHERE status = 'processing'`
4167
4198
  );
4199
+ const vectorRetryableFailed = sqliteGet(
4200
+ this.db,
4201
+ `SELECT COUNT(*) as count
4202
+ FROM vector_outbox
4203
+ WHERE status = 'failed'
4204
+ AND retry_count < ?`,
4205
+ [maxRetries]
4206
+ );
4207
+ const vectorQuarantinedFailed = sqliteGet(
4208
+ this.db,
4209
+ `SELECT COUNT(*) as count
4210
+ FROM vector_outbox
4211
+ WHERE status = 'failed'
4212
+ AND retry_count >= ?`,
4213
+ [maxRetries]
4214
+ );
4168
4215
  return {
4169
4216
  embedding: fromRows(
4170
4217
  embeddingRows,
4171
4218
  Number(embeddingStuck?.count ?? 0),
4172
- processingAgeMs(embeddingOldest?.oldest)
4219
+ processingAgeMs(embeddingOldest?.oldest),
4220
+ Number(embeddingRetryableFailed?.count ?? 0),
4221
+ Number(embeddingQuarantinedFailed?.count ?? 0)
4173
4222
  ),
4174
4223
  vector: fromRows(
4175
4224
  vectorRows,
4176
4225
  Number(vectorStuck?.count ?? 0),
4177
- processingAgeMs(vectorOldest?.oldest)
4226
+ processingAgeMs(vectorOldest?.oldest),
4227
+ Number(vectorRetryableFailed?.count ?? 0),
4228
+ Number(vectorQuarantinedFailed?.count ?? 0)
4178
4229
  )
4179
4230
  };
4180
4231
  }