@edihasaj/recall 0.9.5 → 0.9.7

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/daemon.js CHANGED
@@ -1020,6 +1020,14 @@ function formatMaintenanceSummary(result) {
1020
1020
  return `[recall] maintenance prune=${result.prune_total} scanned(normalized=${result.scanned_memories_normalized},demoted=${result.scanned_memories_demoted},rejected=${result.scanned_memories_rejected}) activity=${result.activity_pruned} feedback=${result.feedback_pruned} signals=${result.signals_pruned} refreshed=${result.embeddings_refreshed} rebuilt(vec=${result.vector_rows_rebuilt},fts=${result.lexical_rows_rebuilt}) drift(vec=${result.vector_drift},fts=${result.lexical_drift}) stale=${result.embedding_stale} history(created=${result.history_snippets_created},refreshed=${result.history_embeddings_refreshed},drift_vec=${result.history_vector_drift},drift_fts=${result.history_lexical_drift}) tasks(enqueued=${result.maintenance_tasks_enqueued},swept=${result.maintenance_leases_swept},dropped=${result.maintenance_tasks_dropped},expired=${result.maintenance_tasks_expired},invalid=${result.maintenance_tasks_invalid})`;
1021
1021
  }
1022
1022
 
1023
+ // src/maintenance/dispatch-scheduling.ts
1024
+ function maintenanceCreatedDispatchableTasks(result) {
1025
+ return result.maintenance_tasks_enqueued > result.maintenance_tasks_dropped + result.maintenance_tasks_invalid;
1026
+ }
1027
+ function dispatchBatchNeedsContinuation(report, maxTasksPerRun) {
1028
+ return report.released === 0 && report.attempted >= maxTasksPerRun;
1029
+ }
1030
+
1023
1031
  // src/daemon.ts
1024
1032
  init_keychain();
1025
1033
 
@@ -1191,6 +1199,9 @@ function scheduleMaintenanceLoop() {
1191
1199
  if (shouldLogMaintenance(result)) {
1192
1200
  console.log(formatMaintenanceSummary(result));
1193
1201
  }
1202
+ if (maintenanceCreatedDispatchableTasks(result)) {
1203
+ wakeDispatcherDebounced();
1204
+ }
1194
1205
  } catch (error) {
1195
1206
  const message = error instanceof Error ? error.stack ?? error.message : String(error);
1196
1207
  console.error(`[recall] maintenance failed: ${message}`);
@@ -1233,6 +1244,9 @@ async function runDispatcherOnce() {
1233
1244
  rejected: report.rejected
1234
1245
  });
1235
1246
  }
1247
+ if (dispatchBatchNeedsContinuation(report, dispatcherConfig.maxTasksPerRun)) {
1248
+ wakeDispatcherDebounced();
1249
+ }
1236
1250
  } catch (error) {
1237
1251
  const message = error instanceof Error ? error.stack ?? error.message : String(error);
1238
1252
  console.error(`[recall] dispatcher failed: ${message}`);