feat(FN-1741): add memory compaction feature

- Add MemoryCompaction service in core for compacting agent memory stores
- Add POST /api/memory/compact route handler in dashboard server
- Add compactMemory frontend API wrapper in dashboard app
- Add Compact Memory button to SettingsModal UI
- Add comprehensive tests for the compaction service and routes
This commit is contained in:
Fusion
2026-04-15 22:03:50 -07:00
committed by gsxdsm
parent 91cc970e78
commit c0cf2e91f2
9 changed files with 753 additions and 1 deletions

View File

@@ -323,6 +323,18 @@ export function saveMemory(content: string, projectId?: string): Promise<{ succe
});
}
/**
* Compact memory content using AI to distill it down to the most important insights.
* Reads current memory, compacts it via AI, and writes the result back.
* @param projectId - Optional project ID for multi-project support
* @returns Promise resolving to the compacted memory content
*/
export function compactMemory(projectId?: string): Promise<{ content: string }> {
return api<{ content: string }>(withProjectId("/memory/compact", projectId), {
method: "POST",
});
}
/**
* Memory backend capabilities returned by the backend status API.
*/