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.
@@ -2315,6 +2315,10 @@ var DEFAULT_CONFIG2 = {
2315
2315
  // 5 minutes
2316
2316
  cleanupDays: 7
2317
2317
  };
2318
+ function isRetryableLanceCommitConflict(error) {
2319
+ const normalized = error.toLowerCase();
2320
+ return normalized.includes("lance") && normalized.includes("commit") && normalized.includes("conflict");
2321
+ }
2318
2322
  var VectorOutbox = class {
2319
2323
  constructor(db, config) {
2320
2324
  this.db = db;
@@ -2419,6 +2423,16 @@ var VectorOutbox = class {
2419
2423
  );
2420
2424
  if (rows.length === 0) return;
2421
2425
  const retryCount = rows[0].retry_count;
2426
+ if (isRetryableLanceCommitConflict(error)) {
2427
+ await dbRun(
2428
+ this.db,
2429
+ `UPDATE vector_outbox
2430
+ SET status = 'pending', error = ?, updated_at = ?
2431
+ WHERE job_id = ?`,
2432
+ [error, now, jobId]
2433
+ );
2434
+ return;
2435
+ }
2422
2436
  const newStatus = retryCount >= this.config.maxRetries - 1 ? "failed" : "pending";
2423
2437
  await dbRun(
2424
2438
  this.db,
@@ -4102,6 +4116,7 @@ var SQLiteEventStore = class {
4102
4116
  async getOutboxStats(options = {}) {
4103
4117
  await this.initialize();
4104
4118
  const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
4119
+ const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
4105
4120
  const now = options.now ?? /* @__PURE__ */ new Date();
4106
4121
  const threshold = new Date(now.getTime() - thresholdMs).toISOString();
4107
4122
  const embeddingRows = sqliteAll(
@@ -4119,8 +4134,8 @@ var SQLiteEventStore = class {
4119
4134
  if (!Number.isFinite(time)) return null;
4120
4135
  return Math.max(0, now.getTime() - time);
4121
4136
  };
4122
- const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs) => {
4123
- const out = { pending: 0, processing: 0, failed: 0, total: 0, stuckProcessing, oldestProcessingAgeMs };
4137
+ const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs, retryableFailed, quarantinedFailed) => {
4138
+ const out = { pending: 0, processing: 0, failed: 0, retryableFailed, quarantinedFailed, total: 0, stuckProcessing, oldestProcessingAgeMs };
4124
4139
  for (const row of rows) {
4125
4140
  const key = row.status;
4126
4141
  if (key === "pending" || key === "processing" || key === "failed") {
@@ -4144,6 +4159,22 @@ var SQLiteEventStore = class {
4144
4159
  FROM embedding_outbox
4145
4160
  WHERE status = 'processing'`
4146
4161
  );
4162
+ const embeddingRetryableFailed = sqliteGet(
4163
+ this.db,
4164
+ `SELECT COUNT(*) as count
4165
+ FROM embedding_outbox
4166
+ WHERE status = 'failed'
4167
+ AND retry_count < ?`,
4168
+ [maxRetries]
4169
+ );
4170
+ const embeddingQuarantinedFailed = sqliteGet(
4171
+ this.db,
4172
+ `SELECT COUNT(*) as count
4173
+ FROM embedding_outbox
4174
+ WHERE status = 'failed'
4175
+ AND retry_count >= ?`,
4176
+ [maxRetries]
4177
+ );
4147
4178
  const vectorStuck = sqliteGet(
4148
4179
  this.db,
4149
4180
  `SELECT COUNT(*) as count
@@ -4158,16 +4189,36 @@ var SQLiteEventStore = class {
4158
4189
  FROM vector_outbox
4159
4190
  WHERE status = 'processing'`
4160
4191
  );
4192
+ const vectorRetryableFailed = sqliteGet(
4193
+ this.db,
4194
+ `SELECT COUNT(*) as count
4195
+ FROM vector_outbox
4196
+ WHERE status = 'failed'
4197
+ AND retry_count < ?`,
4198
+ [maxRetries]
4199
+ );
4200
+ const vectorQuarantinedFailed = sqliteGet(
4201
+ this.db,
4202
+ `SELECT COUNT(*) as count
4203
+ FROM vector_outbox
4204
+ WHERE status = 'failed'
4205
+ AND retry_count >= ?`,
4206
+ [maxRetries]
4207
+ );
4161
4208
  return {
4162
4209
  embedding: fromRows(
4163
4210
  embeddingRows,
4164
4211
  Number(embeddingStuck?.count ?? 0),
4165
- processingAgeMs(embeddingOldest?.oldest)
4212
+ processingAgeMs(embeddingOldest?.oldest),
4213
+ Number(embeddingRetryableFailed?.count ?? 0),
4214
+ Number(embeddingQuarantinedFailed?.count ?? 0)
4166
4215
  ),
4167
4216
  vector: fromRows(
4168
4217
  vectorRows,
4169
4218
  Number(vectorStuck?.count ?? 0),
4170
- processingAgeMs(vectorOldest?.oldest)
4219
+ processingAgeMs(vectorOldest?.oldest),
4220
+ Number(vectorRetryableFailed?.count ?? 0),
4221
+ Number(vectorQuarantinedFailed?.count ?? 0)
4171
4222
  )
4172
4223
  };
4173
4224
  }