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.
package/dist/mcp/index.js CHANGED
@@ -12,7 +12,11 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
12
12
  var __getProtoOf = Object.getPrototypeOf;
13
13
  var __hasOwnProp = Object.prototype.hasOwnProperty;
14
14
  var __commonJS = (cb, mod) => function __require() {
15
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
15
+ try {
16
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
17
+ } catch (e) {
18
+ throw mod = 0, e;
19
+ }
16
20
  };
17
21
  var __copyProps = (to, from, except, desc) => {
18
22
  if (from && typeof from === "object" || typeof from === "function") {
@@ -13415,6 +13419,10 @@ var DEFAULT_CONFIG2 = {
13415
13419
  // 5 minutes
13416
13420
  cleanupDays: 7
13417
13421
  };
13422
+ function isRetryableLanceCommitConflict(error) {
13423
+ const normalized = error.toLowerCase();
13424
+ return normalized.includes("lance") && normalized.includes("commit") && normalized.includes("conflict");
13425
+ }
13418
13426
  var VectorOutbox = class {
13419
13427
  constructor(db, config) {
13420
13428
  this.db = db;
@@ -13519,6 +13527,16 @@ var VectorOutbox = class {
13519
13527
  );
13520
13528
  if (rows.length === 0) return;
13521
13529
  const retryCount = rows[0].retry_count;
13530
+ if (isRetryableLanceCommitConflict(error)) {
13531
+ await dbRun(
13532
+ this.db,
13533
+ `UPDATE vector_outbox
13534
+ SET status = 'pending', error = ?, updated_at = ?
13535
+ WHERE job_id = ?`,
13536
+ [error, now, jobId]
13537
+ );
13538
+ return;
13539
+ }
13522
13540
  const newStatus = retryCount >= this.config.maxRetries - 1 ? "failed" : "pending";
13523
13541
  await dbRun(
13524
13542
  this.db,
@@ -15202,6 +15220,7 @@ var SQLiteEventStore = class {
15202
15220
  async getOutboxStats(options = {}) {
15203
15221
  await this.initialize();
15204
15222
  const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
15223
+ const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
15205
15224
  const now = options.now ?? /* @__PURE__ */ new Date();
15206
15225
  const threshold = new Date(now.getTime() - thresholdMs).toISOString();
15207
15226
  const embeddingRows = sqliteAll(
@@ -15219,8 +15238,8 @@ var SQLiteEventStore = class {
15219
15238
  if (!Number.isFinite(time)) return null;
15220
15239
  return Math.max(0, now.getTime() - time);
15221
15240
  };
15222
- const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs) => {
15223
- const out = { pending: 0, processing: 0, failed: 0, total: 0, stuckProcessing, oldestProcessingAgeMs };
15241
+ const fromRows = (rows, stuckProcessing, oldestProcessingAgeMs, retryableFailed, quarantinedFailed) => {
15242
+ const out = { pending: 0, processing: 0, failed: 0, retryableFailed, quarantinedFailed, total: 0, stuckProcessing, oldestProcessingAgeMs };
15224
15243
  for (const row of rows) {
15225
15244
  const key = row.status;
15226
15245
  if (key === "pending" || key === "processing" || key === "failed") {
@@ -15244,6 +15263,22 @@ var SQLiteEventStore = class {
15244
15263
  FROM embedding_outbox
15245
15264
  WHERE status = 'processing'`
15246
15265
  );
15266
+ const embeddingRetryableFailed = sqliteGet(
15267
+ this.db,
15268
+ `SELECT COUNT(*) as count
15269
+ FROM embedding_outbox
15270
+ WHERE status = 'failed'
15271
+ AND retry_count < ?`,
15272
+ [maxRetries]
15273
+ );
15274
+ const embeddingQuarantinedFailed = sqliteGet(
15275
+ this.db,
15276
+ `SELECT COUNT(*) as count
15277
+ FROM embedding_outbox
15278
+ WHERE status = 'failed'
15279
+ AND retry_count >= ?`,
15280
+ [maxRetries]
15281
+ );
15247
15282
  const vectorStuck = sqliteGet(
15248
15283
  this.db,
15249
15284
  `SELECT COUNT(*) as count
@@ -15258,16 +15293,36 @@ var SQLiteEventStore = class {
15258
15293
  FROM vector_outbox
15259
15294
  WHERE status = 'processing'`
15260
15295
  );
15296
+ const vectorRetryableFailed = sqliteGet(
15297
+ this.db,
15298
+ `SELECT COUNT(*) as count
15299
+ FROM vector_outbox
15300
+ WHERE status = 'failed'
15301
+ AND retry_count < ?`,
15302
+ [maxRetries]
15303
+ );
15304
+ const vectorQuarantinedFailed = sqliteGet(
15305
+ this.db,
15306
+ `SELECT COUNT(*) as count
15307
+ FROM vector_outbox
15308
+ WHERE status = 'failed'
15309
+ AND retry_count >= ?`,
15310
+ [maxRetries]
15311
+ );
15261
15312
  return {
15262
15313
  embedding: fromRows(
15263
15314
  embeddingRows,
15264
15315
  Number(embeddingStuck?.count ?? 0),
15265
- processingAgeMs(embeddingOldest?.oldest)
15316
+ processingAgeMs(embeddingOldest?.oldest),
15317
+ Number(embeddingRetryableFailed?.count ?? 0),
15318
+ Number(embeddingQuarantinedFailed?.count ?? 0)
15266
15319
  ),
15267
15320
  vector: fromRows(
15268
15321
  vectorRows,
15269
15322
  Number(vectorStuck?.count ?? 0),
15270
- processingAgeMs(vectorOldest?.oldest)
15323
+ processingAgeMs(vectorOldest?.oldest),
15324
+ Number(vectorRetryableFailed?.count ?? 0),
15325
+ Number(vectorQuarantinedFailed?.count ?? 0)
15271
15326
  )
15272
15327
  };
15273
15328
  }