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