@edihasaj/recall 2.0.17 → 2.0.19

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.
Files changed (81) hide show
  1. package/README.md +12 -0
  2. package/dist/{chunk-VUVFQJWZ.js → chunk-3SI2FCYS.js} +2 -2
  3. package/dist/{chunk-Q22B7YDQ.js → chunk-5VIPRV3V.js} +5 -5
  4. package/dist/{chunk-22AJZ7UQ.js → chunk-673NQIZX.js} +2 -2
  5. package/dist/{chunk-UDLRBKC3.js → chunk-6B7YHOGI.js} +3 -3
  6. package/dist/{chunk-YIVOTIDF.js → chunk-FH2XQDYL.js} +5 -5
  7. package/dist/{chunk-KLERXJ47.js → chunk-GENJNVHG.js} +3 -3
  8. package/dist/{chunk-2COJXGP4.js → chunk-GTHCX5LX.js} +4 -3
  9. package/dist/{chunk-2COJXGP4.js.map → chunk-GTHCX5LX.js.map} +1 -1
  10. package/dist/{chunk-EY6HIDG2.js → chunk-J4IWU2BE.js} +9 -9
  11. package/dist/{chunk-Q7254IPO.js → chunk-J6YBL72P.js} +193 -15
  12. package/dist/chunk-J6YBL72P.js.map +1 -0
  13. package/dist/{chunk-YIUBD27J.js → chunk-M4JG3HMA.js} +30 -37
  14. package/dist/chunk-M4JG3HMA.js.map +1 -0
  15. package/dist/{chunk-CSBXI3ET.js → chunk-NSXTH2B4.js} +8 -4
  16. package/dist/chunk-NSXTH2B4.js.map +1 -0
  17. package/dist/{chunk-ZT67CYDS.js → chunk-QDCIXULL.js} +2 -2
  18. package/dist/{chunk-ZT67CYDS.js.map → chunk-QDCIXULL.js.map} +1 -1
  19. package/dist/{chunk-FNIIUNW6.js → chunk-QDONEJJG.js} +2 -2
  20. package/dist/{chunk-QQ6YHR7I.js → chunk-R5CG3RC4.js} +231 -26
  21. package/dist/chunk-R5CG3RC4.js.map +1 -0
  22. package/dist/{chunk-KVZN35JF.js → chunk-WDUYM3NZ.js} +7 -7
  23. package/dist/{chunk-RAQT2OBR.js → chunk-WPHCCQOC.js} +7 -7
  24. package/dist/{chunk-GK7OWVRQ.js → chunk-X3EF5QHV.js} +3 -3
  25. package/dist/{chunk-XRKUJ5B4.js → chunk-ZHJRYVOD.js} +2 -2
  26. package/dist/{cleanup-4TXIHTJT.js → cleanup-FOGHMRL5.js} +11 -11
  27. package/dist/cli.js +39 -191
  28. package/dist/cli.js.map +1 -1
  29. package/dist/{codex-trust-2JIY66CP.js → codex-trust-C2GOV764.js} +4 -4
  30. package/dist/daemon.js +143 -39
  31. package/dist/daemon.js.map +1 -1
  32. package/dist/dispatcher-OIINFHQU.js +22 -0
  33. package/dist/{embeddings-AAS7NKGB.js → embeddings-6Y7KXV5L.js} +5 -5
  34. package/dist/ingest-QFX3ZEM6.js +20 -0
  35. package/dist/{keychain-SHRO7W6J.js → keychain-DHS6XKIQ.js} +3 -3
  36. package/dist/mcp.js +15 -15
  37. package/dist/{memory-value-R2C7ZSDF.js → memory-value-U6TGLBZB.js} +11 -11
  38. package/dist/{provenance-I5GIAP7N.js → provenance-PLISLH2V.js} +9 -9
  39. package/dist/quality-AYWNSDIU.js +25 -0
  40. package/dist/retrieval-B2DYBYAJ.js +15 -0
  41. package/dist/{store-X2B6MRBH.js → store-OLSM63EZ.js} +4 -4
  42. package/dist/sync-server.js +2 -2
  43. package/dist/{tasks-H4NIS6QO.js → tasks-S5ZMXA5K.js} +11 -11
  44. package/dist/{usage-35HSDMNT.js → usage-RWS6VQBY.js} +4 -4
  45. package/package.json +1 -1
  46. package/vendor/recall-cloud-sync/PROVENANCE.md +18 -5
  47. package/vendor/recall-cloud-sync/recall-sync-local.mjs +19 -10
  48. package/vendor/recall-cloud-sync/recall-sync.mjs +40 -6
  49. package/dist/chunk-CSBXI3ET.js.map +0 -1
  50. package/dist/chunk-Q7254IPO.js.map +0 -1
  51. package/dist/chunk-QQ6YHR7I.js.map +0 -1
  52. package/dist/chunk-YIUBD27J.js.map +0 -1
  53. package/dist/dispatcher-O6NGADCQ.js +0 -22
  54. package/dist/ingest-DW3AG4M5.js +0 -20
  55. package/dist/quality-32MAXPNJ.js +0 -25
  56. package/dist/retrieval-RKYWWNWC.js +0 -15
  57. /package/dist/{chunk-VUVFQJWZ.js.map → chunk-3SI2FCYS.js.map} +0 -0
  58. /package/dist/{chunk-Q22B7YDQ.js.map → chunk-5VIPRV3V.js.map} +0 -0
  59. /package/dist/{chunk-22AJZ7UQ.js.map → chunk-673NQIZX.js.map} +0 -0
  60. /package/dist/{chunk-UDLRBKC3.js.map → chunk-6B7YHOGI.js.map} +0 -0
  61. /package/dist/{chunk-YIVOTIDF.js.map → chunk-FH2XQDYL.js.map} +0 -0
  62. /package/dist/{chunk-KLERXJ47.js.map → chunk-GENJNVHG.js.map} +0 -0
  63. /package/dist/{chunk-EY6HIDG2.js.map → chunk-J4IWU2BE.js.map} +0 -0
  64. /package/dist/{chunk-FNIIUNW6.js.map → chunk-QDONEJJG.js.map} +0 -0
  65. /package/dist/{chunk-KVZN35JF.js.map → chunk-WDUYM3NZ.js.map} +0 -0
  66. /package/dist/{chunk-RAQT2OBR.js.map → chunk-WPHCCQOC.js.map} +0 -0
  67. /package/dist/{chunk-GK7OWVRQ.js.map → chunk-X3EF5QHV.js.map} +0 -0
  68. /package/dist/{chunk-XRKUJ5B4.js.map → chunk-ZHJRYVOD.js.map} +0 -0
  69. /package/dist/{cleanup-4TXIHTJT.js.map → cleanup-FOGHMRL5.js.map} +0 -0
  70. /package/dist/{codex-trust-2JIY66CP.js.map → codex-trust-C2GOV764.js.map} +0 -0
  71. /package/dist/{dispatcher-O6NGADCQ.js.map → dispatcher-OIINFHQU.js.map} +0 -0
  72. /package/dist/{embeddings-AAS7NKGB.js.map → embeddings-6Y7KXV5L.js.map} +0 -0
  73. /package/dist/{ingest-DW3AG4M5.js.map → ingest-QFX3ZEM6.js.map} +0 -0
  74. /package/dist/{keychain-SHRO7W6J.js.map → keychain-DHS6XKIQ.js.map} +0 -0
  75. /package/dist/{memory-value-R2C7ZSDF.js.map → memory-value-U6TGLBZB.js.map} +0 -0
  76. /package/dist/{provenance-I5GIAP7N.js.map → provenance-PLISLH2V.js.map} +0 -0
  77. /package/dist/{quality-32MAXPNJ.js.map → quality-AYWNSDIU.js.map} +0 -0
  78. /package/dist/{retrieval-RKYWWNWC.js.map → retrieval-B2DYBYAJ.js.map} +0 -0
  79. /package/dist/{store-X2B6MRBH.js.map → store-OLSM63EZ.js.map} +0 -0
  80. /package/dist/{tasks-H4NIS6QO.js.map → tasks-S5ZMXA5K.js.map} +0 -0
  81. /package/dist/{usage-35HSDMNT.js.map → usage-RWS6VQBY.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  graphQuery
3
- } from "./chunk-Q22B7YDQ.js";
3
+ } from "./chunk-5VIPRV3V.js";
4
4
  import {
5
5
  captureCorrectionFallback,
6
6
  compileContext,
@@ -26,7 +26,7 @@ import {
26
26
  scanAndStore,
27
27
  sessionEndFallback,
28
28
  signalOutcomeFallback
29
- } from "./chunk-Q7254IPO.js";
29
+ } from "./chunk-J6YBL72P.js";
30
30
  import {
31
31
  DEFAULT_LEASE_SECONDS,
32
32
  TaskClaimConflictError,
@@ -42,10 +42,10 @@ import {
42
42
  processReviewFeedback,
43
43
  releaseTask,
44
44
  submitTask
45
- } from "./chunk-QQ6YHR7I.js";
45
+ } from "./chunk-R5CG3RC4.js";
46
46
  import {
47
47
  recordCompletionUseValueEventsSemantic
48
- } from "./chunk-RAQT2OBR.js";
48
+ } from "./chunk-WPHCCQOC.js";
49
49
  import {
50
50
  confirmMemory,
51
51
  demoteGlobalMemory,
@@ -58,20 +58,20 @@ import {
58
58
  recordAudit,
59
59
  rejectMemory,
60
60
  rollbackMemory
61
- } from "./chunk-KVZN35JF.js";
61
+ } from "./chunk-WDUYM3NZ.js";
62
62
  import {
63
63
  loadEmbeddingConfigFromEnv,
64
64
  tagActivitySource
65
- } from "./chunk-CSBXI3ET.js";
65
+ } from "./chunk-NSXTH2B4.js";
66
66
  import {
67
67
  getEntity,
68
68
  listEntities,
69
69
  listMemoryIdsForEntity,
70
70
  neighborsOf
71
- } from "./chunk-KLERXJ47.js";
71
+ } from "./chunk-GENJNVHG.js";
72
72
  import {
73
73
  init_define_RECALL_BUILD_INFO
74
- } from "./chunk-ZT67CYDS.js";
74
+ } from "./chunk-QDCIXULL.js";
75
75
 
76
76
  // src/mcp/factory.ts
77
77
  init_define_RECALL_BUILD_INFO();
@@ -1561,4 +1561,4 @@ function createRecallMcpServer(db = initDb()) {
1561
1561
  export {
1562
1562
  createRecallMcpServer
1563
1563
  };
1564
- //# sourceMappingURL=chunk-EY6HIDG2.js.map
1564
+ //# sourceMappingURL=chunk-J4IWU2BE.js.map
@@ -10,17 +10,17 @@ import {
10
10
  redactSensitiveText,
11
11
  redactSensitiveValue,
12
12
  seedScannedConfidence
13
- } from "./chunk-QQ6YHR7I.js";
13
+ } from "./chunk-R5CG3RC4.js";
14
14
  import {
15
15
  recordInjectionValueEvents,
16
16
  recordMemoryInjections,
17
17
  recordOutcomeValueEvent,
18
18
  resolveMemoryInjectionOutcome
19
- } from "./chunk-RAQT2OBR.js";
19
+ } from "./chunk-WPHCCQOC.js";
20
20
  import {
21
21
  matchTokens,
22
22
  textMatchScore
23
- } from "./chunk-XRKUJ5B4.js";
23
+ } from "./chunk-ZHJRYVOD.js";
24
24
  import {
25
25
  activityEventDedupeKey,
26
26
  confirmMemory,
@@ -36,15 +36,16 @@ import {
36
36
  promoteMemory,
37
37
  queryMemories,
38
38
  recordAudit,
39
+ recordAuditWithSnapshot,
39
40
  recordFeedback,
40
41
  rejectMemory,
41
42
  setMemoryNote,
42
43
  statusFromConfidence
43
- } from "./chunk-KVZN35JF.js";
44
+ } from "./chunk-WDUYM3NZ.js";
44
45
  import {
45
46
  asc,
46
47
  desc
47
- } from "./chunk-UDLRBKC3.js";
48
+ } from "./chunk-6B7YHOGI.js";
48
49
  import {
49
50
  BACKGROUND_INDEX_BATCH_SIZE,
50
51
  CONFIDENCE,
@@ -69,11 +70,11 @@ import {
69
70
  resolveProvider,
70
71
  retrievalText,
71
72
  tagActivitySource
72
- } from "./chunk-CSBXI3ET.js";
73
+ } from "./chunk-NSXTH2B4.js";
73
74
  import {
74
75
  hasProviderConfigured,
75
76
  init_keychain
76
- } from "./chunk-FNIIUNW6.js";
77
+ } from "./chunk-QDONEJJG.js";
77
78
  import {
78
79
  Column,
79
80
  Columns,
@@ -138,10 +139,10 @@ import {
138
139
  policyRules,
139
140
  schema_exports,
140
141
  sql
141
- } from "./chunk-2COJXGP4.js";
142
+ } from "./chunk-GTHCX5LX.js";
142
143
  import {
143
144
  init_define_RECALL_BUILD_INFO
144
- } from "./chunk-ZT67CYDS.js";
145
+ } from "./chunk-QDCIXULL.js";
145
146
 
146
147
  // src/cloud/query-lookup.ts
147
148
  init_define_RECALL_BUILD_INFO();
@@ -8091,7 +8092,7 @@ function rowToPolicy(row) {
8091
8092
  };
8092
8093
  }
8093
8094
 
8094
- // src/pruning/pruner.ts
8095
+ // src/pruning/restore.ts
8095
8096
  init_define_RECALL_BUILD_INFO();
8096
8097
 
8097
8098
  // src/pruning/loop-activity.ts
@@ -8153,9 +8154,152 @@ function loadInjectedMemoryIds(db) {
8153
8154
  );
8154
8155
  }
8155
8156
 
8157
+ // src/pruning/restore.ts
8158
+ var DAY_MS2 = 864e5;
8159
+ var CONFIDENCE_EPSILON2 = 1e-9;
8160
+ var RESTORE_ACTOR = "auto-pruner";
8161
+ var RESTORE_REASON_PREFIX = "Restored to auto-injection: demoted while the injection loop was inactive";
8162
+ function isRiskyToRestore(memory) {
8163
+ if (isHighRiskRule(memory.text) || isNonUserCaptureContext(memory.text) || hasNonDurableProvenance(memory)) return true;
8164
+ const contexts = memory.evidence.filter((entry) => entry.type === "session_correction" || entry.type === "review_feedback").map((entry) => entry.context?.trim()).filter((context) => Boolean(context));
8165
+ return contexts.length > 0 && contexts.every(isNonUserCaptureContext);
8166
+ }
8167
+ function prunerArchivalAt(db, memory) {
8168
+ const latest = db.select().from(auditTrail).where(eq(auditTrail.memory_id, memory.id)).orderBy(desc(auditTrail.timestamp), sql`rowid DESC`).limit(1).get();
8169
+ if (!latest || latest.action !== "demoted" || latest.actor !== RESTORE_ACTOR || !/^Archived (?:unconfirmed candidate after \d+(?:\.\d+)?d without selection or repetition|from auto-injection: no activity since )/.test(latest.reason ?? "") || !latest.after_snapshot) return null;
8170
+ try {
8171
+ const after = JSON.parse(latest.after_snapshot);
8172
+ if (!after || typeof after !== "object" || Array.isArray(after)) return null;
8173
+ const fields = [
8174
+ "id",
8175
+ "type",
8176
+ "text",
8177
+ "scope",
8178
+ "repo",
8179
+ "path_scope",
8180
+ "status",
8181
+ "confidence",
8182
+ "source",
8183
+ "created_at",
8184
+ "updated_at",
8185
+ "last_validated_at",
8186
+ "last_injected_at",
8187
+ "injection_count",
8188
+ "override_count",
8189
+ "repetition_count",
8190
+ "auto_inject",
8191
+ "evidence",
8192
+ "capture_context",
8193
+ "supersedes"
8194
+ ];
8195
+ if (fields.some(
8196
+ (field) => JSON.stringify(after[field]) !== JSON.stringify(memory[field])
8197
+ ) || (after.note ?? null) !== (memory.note ?? null)) return null;
8198
+ if (latest.before_snapshot) {
8199
+ const before = JSON.parse(latest.before_snapshot);
8200
+ if (!before || before.auto_inject !== true) return null;
8201
+ }
8202
+ return typeof after.updated_at === "string" && Number.isFinite(Date.parse(after.updated_at)) ? after.updated_at : null;
8203
+ } catch {
8204
+ return null;
8205
+ }
8206
+ }
8207
+ function restoreUnmeasuredCandidates(db, options = {}) {
8208
+ const minConfidence = options.minConfidence ?? CONFIDENCE.ACTIVE_MIN;
8209
+ const lookbackDays = options.lookbackDays ?? 30;
8210
+ const dryRun = options.dryRun ?? false;
8211
+ if (!Number.isFinite(minConfidence) || minConfidence < 0 || minConfidence > 1) {
8212
+ throw new RangeError("minConfidence must be a number between 0 and 1");
8213
+ }
8214
+ if (!Number.isFinite(lookbackDays) || lookbackDays <= 0) {
8215
+ throw new RangeError("lookbackDays must be a positive number");
8216
+ }
8217
+ const now2 = options.now ?? Date.now();
8218
+ const nowIso = new Date(now2).toISOString();
8219
+ const sinceIso = new Date(now2 - lookbackDays * DAY_MS2).toISOString();
8220
+ const loopCovered = createLoopCoverageCache(db);
8221
+ const result = {
8222
+ restored: [],
8223
+ skipped_below_gate: 0,
8224
+ skipped_loop_active: 0,
8225
+ skipped_risky: 0,
8226
+ skipped_not_pruner_archived: 0,
8227
+ min_confidence: minConfidence,
8228
+ lookback_days: lookbackDays,
8229
+ dry_run: dryRun
8230
+ };
8231
+ const restore = () => {
8232
+ const selected = loadInjectedMemoryIds(db);
8233
+ const archived = queryMemories(db, {
8234
+ repo: options.repo,
8235
+ status: "candidate",
8236
+ auto_inject: false
8237
+ }).filter((memory) => memory.injection_count === 0 && !selected.has(memory.id));
8238
+ for (const before of archived) {
8239
+ if (before.confidence + CONFIDENCE_EPSILON2 < minConfidence) {
8240
+ result.skipped_below_gate++;
8241
+ continue;
8242
+ }
8243
+ if (isRiskyToRestore(before)) {
8244
+ result.skipped_risky++;
8245
+ continue;
8246
+ }
8247
+ const archivedAt = prunerArchivalAt(db, before);
8248
+ if (!archivedAt) {
8249
+ result.skipped_not_pruner_archived++;
8250
+ continue;
8251
+ }
8252
+ const archiveWindowStart = new Date(Date.parse(archivedAt) - lookbackDays * DAY_MS2).toISOString();
8253
+ const repo = loopRepoForMemory(before);
8254
+ if (loopCovered(repo, archiveWindowStart, archivedAt) || loopCovered(repo, sinceIso, nowIso)) {
8255
+ result.skipped_loop_active++;
8256
+ continue;
8257
+ }
8258
+ result.restored.push(before.id);
8259
+ if (dryRun) continue;
8260
+ db.update(memories).set({ auto_inject: true, updated_at: nowIso }).where(eq(memories.id, before.id)).run();
8261
+ const reason = `${RESTORE_REASON_PREFIX} (no injection coverage in ${lookbackDays}d; archival ${archivedAt})`;
8262
+ recordAuditWithSnapshot(
8263
+ db,
8264
+ before.id,
8265
+ "policy_applied",
8266
+ RESTORE_ACTOR,
8267
+ reason,
8268
+ before,
8269
+ getMemory(db, before.id) ?? null
8270
+ );
8271
+ }
8272
+ };
8273
+ const transaction = db.$client.transaction(restore);
8274
+ if (dryRun) transaction();
8275
+ else transaction.immediate();
8276
+ return result;
8277
+ }
8278
+ function formatRestoreReport(result) {
8279
+ const prefix = result.dry_run ? "[DRY RUN] " : "";
8280
+ const lines = [
8281
+ `${prefix}Restore Unmeasured Candidates`,
8282
+ ``,
8283
+ `Gate: confidence >= ${result.min_confidence.toFixed(2)}, loop window ${result.lookback_days}d`,
8284
+ `${result.dry_run ? "Would restore" : "Restored"}: ${result.restored.length}`,
8285
+ `Below gate: ${result.skipped_below_gate}`,
8286
+ `Loop active: ${result.skipped_loop_active}`,
8287
+ `Risky (confirm): ${result.skipped_risky}`,
8288
+ `No pruner proof: ${result.skipped_not_pruner_archived}`
8289
+ ];
8290
+ if (result.restored.length > 0) {
8291
+ lines.push("", result.dry_run ? "Would restore:" : "Restored:");
8292
+ for (const id of result.restored.slice(0, 10)) lines.push(` ${id.slice(0, 8)}`);
8293
+ if (result.restored.length > 10) lines.push(` ... and ${result.restored.length - 10} more`);
8294
+ }
8295
+ return lines.join("\n");
8296
+ }
8297
+
8156
8298
  // src/pruning/pruner.ts
8299
+ init_define_RECALL_BUILD_INFO();
8157
8300
  var DEFAULT_CONFIG2 = {
8158
8301
  candidate_unconfirmed_days: 30,
8302
+ candidate_max_age_days: 60,
8159
8303
  stale_days: 90,
8160
8304
  rejected_retention_days: 30,
8161
8305
  transient_retention_days: 7,
@@ -8172,6 +8316,7 @@ function pruneMemories(db, config = {}) {
8172
8316
  const result = {
8173
8317
  unconfirmed_archived: [],
8174
8318
  unconfirmed_skipped_loop_inactive: [],
8319
+ candidate_age_archived: [],
8175
8320
  stale_archived: [],
8176
8321
  stale_skipped_loop_inactive: [],
8177
8322
  rejected_pruned: [],
@@ -8211,6 +8356,38 @@ function pruneMemories(db, config = {}) {
8211
8356
  }
8212
8357
  result.unconfirmed_archived.push(mem.id);
8213
8358
  }
8359
+ if (cfg.candidate_max_age_days > 0) {
8360
+ const maxAgeCutoff = new Date(now2 - cfg.candidate_max_age_days * dayMs).toISOString();
8361
+ const archivedInStep1 = new Set(result.unconfirmed_archived);
8362
+ const recentlyRestored = new Set(db.select({ memory_id: auditTrail.memory_id }).from(auditTrail).where(and(
8363
+ eq(auditTrail.action, "policy_applied"),
8364
+ eq(auditTrail.actor, RESTORE_ACTOR),
8365
+ like(auditTrail.reason, `${RESTORE_REASON_PREFIX}%`),
8366
+ gte(auditTrail.timestamp, maxAgeCutoff)
8367
+ )).all().map((row) => row.memory_id));
8368
+ const aged = queryMemories(db, {
8369
+ repo: cfg.repo,
8370
+ status: "candidate",
8371
+ auto_inject: true
8372
+ }).filter(
8373
+ (mem) => mem.created_at < maxAgeCutoff && mem.repetition_count < 2 && !archivedInStep1.has(mem.id) && !recentlyRestored.has(mem.id)
8374
+ );
8375
+ for (const mem of aged) {
8376
+ if (!cfg.dry_run) {
8377
+ db.update(memories).set({ auto_inject: false, updated_at: (/* @__PURE__ */ new Date()).toISOString() }).where(eq(memories.id, mem.id)).run();
8378
+ recordAudit(
8379
+ db,
8380
+ mem.id,
8381
+ "demoted",
8382
+ "auto-pruner",
8383
+ `Archived candidate past ${cfg.candidate_max_age_days}d max age without confirmation or repetition`
8384
+ );
8385
+ }
8386
+ result.candidate_age_archived.push(mem.id);
8387
+ }
8388
+ const agedIds = new Set(result.candidate_age_archived);
8389
+ result.unconfirmed_skipped_loop_inactive = result.unconfirmed_skipped_loop_inactive.filter((id) => !agedIds.has(id));
8390
+ }
8214
8391
  const staleCutoff = new Date(now2 - cfg.stale_days * dayMs).toISOString();
8215
8392
  const staleCandidates = queryMemories(db, {
8216
8393
  repo: cfg.repo,
@@ -8218,6 +8395,7 @@ function pruneMemories(db, config = {}) {
8218
8395
  }).filter((mem) => mem.status !== "rejected" && mem.status !== "transient");
8219
8396
  for (const mem of staleCandidates) {
8220
8397
  if (result.unconfirmed_archived.includes(mem.id)) continue;
8398
+ if (result.candidate_age_archived.includes(mem.id)) continue;
8221
8399
  if (skippedLoopInactive.has(mem.id)) continue;
8222
8400
  const lastActivity = mem.last_validated_at ?? mem.last_injected_at ?? mem.updated_at;
8223
8401
  if (lastActivity < staleCutoff && mem.auto_inject) {
@@ -8293,7 +8471,7 @@ function pruneMemories(db, config = {}) {
8293
8471
  result.unhealthy_demoted.push(mem.id);
8294
8472
  }
8295
8473
  }
8296
- result.total = result.unconfirmed_archived.length + result.stale_archived.length + result.rejected_pruned.length + result.transient_pruned.length + result.unhealthy_demoted.length;
8474
+ result.total = result.unconfirmed_archived.length + result.candidate_age_archived.length + result.stale_archived.length + result.rejected_pruned.length + result.transient_pruned.length + result.unhealthy_demoted.length;
8297
8475
  return result;
8298
8476
  }
8299
8477
  function deleteMemoryAndDependents(db, memoryId) {
@@ -8316,6 +8494,7 @@ function formatPruneReport(result, dryRun) {
8316
8494
  ``,
8317
8495
  `Unconfirmed archived:${String(result.unconfirmed_archived.length).padStart(5)}`,
8318
8496
  `Unconfirmed skipped (loop inactive): ${result.unconfirmed_skipped_loop_inactive?.length ?? 0}`,
8497
+ `Candidates past max age archived: ${result.candidate_age_archived?.length ?? 0}`,
8319
8498
  `Stale archived: ${result.stale_archived.length}`,
8320
8499
  `Stale skipped (loop inactive): ${result.stale_skipped_loop_inactive?.length ?? 0}`,
8321
8500
  `Rejected pruned: ${result.rejected_pruned.length}`,
@@ -8416,10 +8595,9 @@ export {
8416
8595
  requestApproval,
8417
8596
  resolveApproval,
8418
8597
  listPendingApprovals,
8419
- createLoopCoverageCache,
8420
- loopRepoForMemory,
8421
- loadInjectedMemoryIds,
8598
+ restoreUnmeasuredCandidates,
8599
+ formatRestoreReport,
8422
8600
  pruneMemories,
8423
8601
  formatPruneReport
8424
8602
  };
8425
- //# sourceMappingURL=chunk-Q7254IPO.js.map
8603
+ //# sourceMappingURL=chunk-J6YBL72P.js.map