claude-memory-layer 1.0.36 → 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 +280 -43
- 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 +271 -41
- package/dist/server/api/index.js.map +2 -2
- package/dist/server/index.js +271 -41
- 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
package/dist/mcp/index.js
CHANGED
|
@@ -12748,6 +12748,14 @@ function normalizeQueryRewriteKind(value) {
|
|
|
12748
12748
|
return "none";
|
|
12749
12749
|
}
|
|
12750
12750
|
var REWRITTEN_QUERY_REWRITE_KIND_SQL = `LOWER(TRIM(COALESCE(query_rewrite_kind, 'none'))) IN ('follow-up-context', 'intent-rewrite')`;
|
|
12751
|
+
var DEFAULT_OUTBOX_STUCK_THRESHOLD_MS = 5 * 60 * 1e3;
|
|
12752
|
+
var DEFAULT_OUTBOX_MAX_RETRIES = 3;
|
|
12753
|
+
function emptyOutboxRecoveryResult() {
|
|
12754
|
+
return {
|
|
12755
|
+
embedding: { recoveredProcessing: 0, retriedFailed: 0 },
|
|
12756
|
+
vector: { recoveredProcessing: 0, retriedFailed: 0 }
|
|
12757
|
+
};
|
|
12758
|
+
}
|
|
12751
12759
|
var SQLiteEventStore = class {
|
|
12752
12760
|
db;
|
|
12753
12761
|
initialized = false;
|
|
@@ -13498,7 +13506,9 @@ var SQLiteEventStore = class {
|
|
|
13498
13506
|
const placeholders = ids.map(() => "?").join(",");
|
|
13499
13507
|
sqliteRun(
|
|
13500
13508
|
this.db,
|
|
13501
|
-
`UPDATE embedding_outbox
|
|
13509
|
+
`UPDATE embedding_outbox
|
|
13510
|
+
SET status = 'processing', processed_at = datetime('now'), error_message = NULL
|
|
13511
|
+
WHERE id IN (${placeholders})`,
|
|
13502
13512
|
ids
|
|
13503
13513
|
);
|
|
13504
13514
|
return pending.map((row) => ({
|
|
@@ -13568,6 +13578,58 @@ var SQLiteEventStore = class {
|
|
|
13568
13578
|
[error, ...ids]
|
|
13569
13579
|
);
|
|
13570
13580
|
}
|
|
13581
|
+
/**
|
|
13582
|
+
* Recover abandoned outbox work after a worker/process crash.
|
|
13583
|
+
*
|
|
13584
|
+
* Rows in `processing` are claimed work. If the process exits before marking
|
|
13585
|
+
* them done/failed, they otherwise remain invisible to future processing.
|
|
13586
|
+
* Recovery is deliberately age-gated so an active worker is not disturbed.
|
|
13587
|
+
*/
|
|
13588
|
+
async recoverStuckOutboxItems(options = {}) {
|
|
13589
|
+
await this.initialize();
|
|
13590
|
+
const thresholdMs = Number.isFinite(options.stuckThresholdMs) && (options.stuckThresholdMs ?? 0) >= 0 ? options.stuckThresholdMs : DEFAULT_OUTBOX_STUCK_THRESHOLD_MS;
|
|
13591
|
+
const maxRetries = Number.isFinite(options.maxRetries) && (options.maxRetries ?? 0) > 0 ? options.maxRetries : DEFAULT_OUTBOX_MAX_RETRIES;
|
|
13592
|
+
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
13593
|
+
const threshold = new Date(now.getTime() - thresholdMs).toISOString();
|
|
13594
|
+
const result = emptyOutboxRecoveryResult();
|
|
13595
|
+
const embeddingRecovered = sqliteRun(
|
|
13596
|
+
this.db,
|
|
13597
|
+
`UPDATE embedding_outbox
|
|
13598
|
+
SET status = 'pending', processed_at = NULL, error_message = NULL
|
|
13599
|
+
WHERE status = 'processing'
|
|
13600
|
+
AND datetime(COALESCE(processed_at, created_at)) < datetime(?)`,
|
|
13601
|
+
[threshold]
|
|
13602
|
+
);
|
|
13603
|
+
result.embedding.recoveredProcessing = Number(embeddingRecovered.changes ?? 0);
|
|
13604
|
+
const embeddingRetried = sqliteRun(
|
|
13605
|
+
this.db,
|
|
13606
|
+
`UPDATE embedding_outbox
|
|
13607
|
+
SET status = 'pending', error_message = NULL
|
|
13608
|
+
WHERE status = 'failed'
|
|
13609
|
+
AND retry_count < ?`,
|
|
13610
|
+
[maxRetries]
|
|
13611
|
+
);
|
|
13612
|
+
result.embedding.retriedFailed = Number(embeddingRetried.changes ?? 0);
|
|
13613
|
+
const vectorRecovered = sqliteRun(
|
|
13614
|
+
this.db,
|
|
13615
|
+
`UPDATE vector_outbox
|
|
13616
|
+
SET status = 'pending', updated_at = ?, error = NULL
|
|
13617
|
+
WHERE status = 'processing'
|
|
13618
|
+
AND datetime(updated_at) < datetime(?)`,
|
|
13619
|
+
[now.toISOString(), threshold]
|
|
13620
|
+
);
|
|
13621
|
+
result.vector.recoveredProcessing = Number(vectorRecovered.changes ?? 0);
|
|
13622
|
+
const vectorRetried = sqliteRun(
|
|
13623
|
+
this.db,
|
|
13624
|
+
`UPDATE vector_outbox
|
|
13625
|
+
SET status = 'pending', updated_at = ?, error = NULL
|
|
13626
|
+
WHERE status = 'failed'
|
|
13627
|
+
AND retry_count < ?`,
|
|
13628
|
+
[now.toISOString(), maxRetries]
|
|
13629
|
+
);
|
|
13630
|
+
result.vector.retriedFailed = Number(vectorRetried.changes ?? 0);
|
|
13631
|
+
return result;
|
|
13632
|
+
}
|
|
13571
13633
|
/**
|
|
13572
13634
|
* Get embedding/vector outbox health statistics
|
|
13573
13635
|
*/
|
|
@@ -14439,6 +14501,7 @@ var VectorStore = class {
|
|
|
14439
14501
|
* Get total count of vectors
|
|
14440
14502
|
*/
|
|
14441
14503
|
async count() {
|
|
14504
|
+
await this.initialize();
|
|
14442
14505
|
if (!this.table)
|
|
14443
14506
|
return 0;
|
|
14444
14507
|
const result = await this.table.countRows();
|
|
@@ -14877,6 +14940,10 @@ var MemoryQueryService = class {
|
|
|
14877
14940
|
await this.initialize();
|
|
14878
14941
|
return this.getMaintenanceStore("getOutboxStats").getOutboxStats();
|
|
14879
14942
|
}
|
|
14943
|
+
async recoverStuckOutboxItems(options) {
|
|
14944
|
+
await this.initialize();
|
|
14945
|
+
return this.getMaintenanceStore("recoverStuckOutboxItems").recoverStuckOutboxItems(options);
|
|
14946
|
+
}
|
|
14880
14947
|
async getStats() {
|
|
14881
14948
|
await this.initialize();
|
|
14882
14949
|
const deps = this.getStatsDeps();
|
|
@@ -18199,6 +18266,9 @@ var MemoryService = class {
|
|
|
18199
18266
|
async getOutboxStats() {
|
|
18200
18267
|
return this.queryService.getOutboxStats();
|
|
18201
18268
|
}
|
|
18269
|
+
async recoverStuckOutboxItems(options) {
|
|
18270
|
+
return this.queryService.recoverStuckOutboxItems(options);
|
|
18271
|
+
}
|
|
18202
18272
|
async getRetrievalTraceStats() {
|
|
18203
18273
|
return this.retrievalAnalyticsService.getRetrievalTraceStats();
|
|
18204
18274
|
}
|