claude-memory-layer 1.0.35 → 1.0.37
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/cli/index.js +321 -54
- package/dist/cli/index.js.map +2 -2
- package/dist/core/index.js +68 -1
- package/dist/core/index.js.map +2 -2
- package/dist/hooks/post-tool-use.js +71 -1
- package/dist/hooks/post-tool-use.js.map +2 -2
- package/dist/hooks/semantic-daemon.js +71 -1
- package/dist/hooks/semantic-daemon.js.map +2 -2
- package/dist/hooks/session-end.js +71 -1
- package/dist/hooks/session-end.js.map +2 -2
- package/dist/hooks/session-start.js +71 -1
- package/dist/hooks/session-start.js.map +2 -2
- package/dist/hooks/stop.js +71 -1
- package/dist/hooks/stop.js.map +2 -2
- package/dist/hooks/user-prompt-submit.js +71 -1
- package/dist/hooks/user-prompt-submit.js.map +2 -2
- package/dist/index.js +71 -1
- package/dist/index.js.map +2 -2
- package/dist/mcp/index.js +71 -1
- package/dist/mcp/index.js.map +2 -2
- package/dist/server/api/index.js +312 -52
- package/dist/server/api/index.js.map +2 -2
- package/dist/server/index.js +312 -52
- package/dist/server/index.js.map +2 -2
- package/dist/services/memory-service.js +71 -1
- package/dist/services/memory-service.js.map +2 -2
- package/dist/ui/assets/js/chat.js +21 -3
- package/package.json +1 -1
|
@@ -2441,6 +2441,14 @@ function normalizeQueryRewriteKind(value) {
|
|
|
2441
2441
|
return "none";
|
|
2442
2442
|
}
|
|
2443
2443
|
var REWRITTEN_QUERY_REWRITE_KIND_SQL = `LOWER(TRIM(COALESCE(query_rewrite_kind, 'none'))) IN ('follow-up-context', 'intent-rewrite')`;
|
|
2444
|
+
var DEFAULT_OUTBOX_STUCK_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
2445
|
+
var DEFAULT_OUTBOX_MAX_RETRIES = 3;
|
|
2446
|
+
function emptyOutboxRecoveryResult() {
|
|
2447
|
+
return {
|
|
2448
|
+
embedding: { recoveredProcessing: 0, retriedFailed: 0 },
|
|
2449
|
+
vector: { recoveredProcessing: 0, retriedFailed: 0 }
|
|
2450
|
+
};
|
|
2451
|
+
}
|
|
2444
2452
|
var SQLiteEventStore = class {
|
|
2445
2453
|
db;
|
|
2446
2454
|
initialized = false;
|
|
@@ -3191,7 +3199,9 @@ var SQLiteEventStore = class {
|
|
|
3191
3199
|
const placeholders = ids.map(() => "?").join(",");
|
|
3192
3200
|
sqliteRun(
|
|
3193
3201
|
this.db,
|
|
3194
|
-
`UPDATE embedding_outbox
|
|
3202
|
+
`UPDATE embedding_outbox
|
|
3203
|
+
SET status = 'processing', processed_at = datetime('now'), error_message = NULL
|
|
3204
|
+
WHERE id IN (${placeholders})`,
|
|
3195
3205
|
ids
|
|
3196
3206
|
);
|
|
3197
3207
|
return pending.map((row) => ({
|
|
@@ -3261,6 +3271,58 @@ var SQLiteEventStore = class {
|
|
|
3261
3271
|
[error, ...ids]
|
|
3262
3272
|
);
|
|
3263
3273
|
}
|
|
3274
|
+
/**
|
|
3275
|
+
* Recover abandoned outbox work after a worker/process crash.
|
|
3276
|
+
*
|
|
3277
|
+
* Rows in `processing` are claimed work. If the process exits before marking
|
|
3278
|
+
* them done/failed, they otherwise remain invisible to future processing.
|
|
3279
|
+
* Recovery is deliberately age-gated so an active worker is not disturbed.
|
|
3280
|
+
*/
|
|
3281
|
+
async recoverStuckOutboxItems(options = {}) {
|
|
3282
|
+
await this.initialize();
|
|
3283
|
+
const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
|
|
3284
|
+
const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
|
|
3285
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
3286
|
+
const threshold = new Date(now.getTime() - thresholdMs).toISOString();
|
|
3287
|
+
const result = emptyOutboxRecoveryResult();
|
|
3288
|
+
const embeddingRecovered = sqliteRun(
|
|
3289
|
+
this.db,
|
|
3290
|
+
`UPDATE embedding_outbox
|
|
3291
|
+
SET status = 'pending', processed_at = NULL, error_message = NULL
|
|
3292
|
+
WHERE status = 'processing'
|
|
3293
|
+
AND datetime(COALESCE(processed_at, created_at)) < datetime(?)`,
|
|
3294
|
+
[threshold]
|
|
3295
|
+
);
|
|
3296
|
+
result.embedding.recoveredProcessing = Number(embeddingRecovered.changes ?? 0);
|
|
3297
|
+
const embeddingRetried = sqliteRun(
|
|
3298
|
+
this.db,
|
|
3299
|
+
`UPDATE embedding_outbox
|
|
3300
|
+
SET status = 'pending', error_message = NULL
|
|
3301
|
+
WHERE status = 'failed'
|
|
3302
|
+
AND retry_count < ?`,
|
|
3303
|
+
[maxRetries]
|
|
3304
|
+
);
|
|
3305
|
+
result.embedding.retriedFailed = Number(embeddingRetried.changes ?? 0);
|
|
3306
|
+
const vectorRecovered = sqliteRun(
|
|
3307
|
+
this.db,
|
|
3308
|
+
`UPDATE vector_outbox
|
|
3309
|
+
SET status = 'pending', updated_at = ?, error = NULL
|
|
3310
|
+
WHERE status = 'processing'
|
|
3311
|
+
AND datetime(updated_at) < datetime(?)`,
|
|
3312
|
+
[now.toISOString(), threshold]
|
|
3313
|
+
);
|
|
3314
|
+
result.vector.recoveredProcessing = Number(vectorRecovered.changes ?? 0);
|
|
3315
|
+
const vectorRetried = sqliteRun(
|
|
3316
|
+
this.db,
|
|
3317
|
+
`UPDATE vector_outbox
|
|
3318
|
+
SET status = 'pending', updated_at = ?, error = NULL
|
|
3319
|
+
WHERE status = 'failed'
|
|
3320
|
+
AND retry_count < ?`,
|
|
3321
|
+
[now.toISOString(), maxRetries]
|
|
3322
|
+
);
|
|
3323
|
+
result.vector.retriedFailed = Number(vectorRetried.changes ?? 0);
|
|
3324
|
+
return result;
|
|
3325
|
+
}
|
|
3264
3326
|
/**
|
|
3265
3327
|
* Get embedding/vector outbox health statistics
|
|
3266
3328
|
*/
|
|
@@ -4132,6 +4194,7 @@ var VectorStore = class {
|
|
|
4132
4194
|
* Get total count of vectors
|
|
4133
4195
|
*/
|
|
4134
4196
|
async count() {
|
|
4197
|
+
await this.initialize();
|
|
4135
4198
|
if (!this.table)
|
|
4136
4199
|
return 0;
|
|
4137
4200
|
const result = await this.table.countRows();
|
|
@@ -4570,6 +4633,10 @@ var MemoryQueryService = class {
|
|
|
4570
4633
|
await this.initialize();
|
|
4571
4634
|
return this.getMaintenanceStore("getOutboxStats").getOutboxStats();
|
|
4572
4635
|
}
|
|
4636
|
+
async recoverStuckOutboxItems(options) {
|
|
4637
|
+
await this.initialize();
|
|
4638
|
+
return this.getMaintenanceStore("recoverStuckOutboxItems").recoverStuckOutboxItems(options);
|
|
4639
|
+
}
|
|
4573
4640
|
async getStats() {
|
|
4574
4641
|
await this.initialize();
|
|
4575
4642
|
const deps = this.getStatsDeps();
|
|
@@ -7838,6 +7905,9 @@ var MemoryService = class {
|
|
|
7838
7905
|
async getOutboxStats() {
|
|
7839
7906
|
return this.queryService.getOutboxStats();
|
|
7840
7907
|
}
|
|
7908
|
+
async recoverStuckOutboxItems(options) {
|
|
7909
|
+
return this.queryService.recoverStuckOutboxItems(options);
|
|
7910
|
+
}
|
|
7841
7911
|
async getRetrievalTraceStats() {
|
|
7842
7912
|
return this.retrievalAnalyticsService.getRetrievalTraceStats();
|
|
7843
7913
|
}
|