feat(panel): migrate trajectory cache to incremental SQLite ledger

- Add short-connection WAL trajectory_store.sqlite (and remote ssh-*.sqlite) with transactional .json-to-.bak migration, O(delta) step UPSERTs, undo tail truncation, and ledger_epoch/write_seq cross-process sync
- Split steps into string-interned compact accounting tuples (retaining anomaly and step account owners) and lazy detail_json with an explicit 24-session hot LRU and precomputed O(1) cold metadata flags
- Archive deleted source conversations permanently across cache rebuilds and skip redundant 404 trajectory RPCs while un-archiving automatically if sources reappear
This commit is contained in:
fish
2026-11-24 13:36:24 +09:00
parent 8b025a969c
commit 275955c37f
10 changed files with 2104 additions and 56 deletions
+9 -3
View File
@@ -18,7 +18,10 @@ import {
} from './endpoint-registry.mjs';
import { isLocalHostRequest, readLocalAsync } from './http-helpers.mjs';
import { revealLocalExportFile, writeLocalExportFile } from './file-exporter.mjs';
import { clearScannerRuntimeMemos } from './local-scanner.mjs';
import {
clearScannerRuntimeMemos,
collectAuthoritativeLiveCascadeIds,
} from './local-scanner.mjs';
import {
SETTINGS_FILE,
clearRuntimeCaches,
@@ -556,9 +559,12 @@ export function executeRebuildCacheAction(data = undefined, opts = {}) {
if (!epCtx.ok) {
return buildEndpointErrorResponse(epCtx);
}
const liveCascadeIds = collectAuthoritativeLiveCascadeIds(
epCtx.isRemote ? epCtx.endpoint : null
);
const ok = epCtx.isRemote
? clearRemoteEndpointCaches(epCtx.id)
: clearRuntimeCaches();
? clearRemoteEndpointCaches(epCtx.id, { liveCascadeIds })
: clearRuntimeCaches({ liveCascadeIds });
if (!ok) {
return {
ok: false,