refactor(web): move the Memory screens onto the memory contract API (P1.5)
- adapter: memory ids are strings; single-memory calls take only the id
(no ?mind= disambiguation). searchMemory takes the workspace as its own
parameter. New getMemoryCapabilities / setMemoryExtraction. Removed:
incrementFrameAccess, getMemoryOriginalSource, listSuppression,
allowReimport, getWeaverStatus, and the dead importPreview, importCommit
and getWikiWatermark. eraseMemory takes { id } or { sessionId }.
- memory-features reads GET /api/memory/capabilities for the knowledge
graph; history import, wiki, hooks, Room and the memory MCP stay hidden
(ADR-0002). useMemoryCapabilities re-renders the Memory screens.
- Settings > General has a Memory toggle for background fact extraction.
- Memory Center: the confidence filter, the erased-sources panel, the
original-source view and the Deprecated chip are gone; Erase forgets
every memory saved from the chat a memory came from and is offered only
for memories with a chat session. Memory kinds follow the contract.
- Trust views show short memory labels for the new string ids and drop the
per-row "not scored yet" badge (v1 stores no confidence).
- The Weaver maintenance view and the Cockpit weaver card are removed
(the weaver package and its routes are deleted).
- Timeline uses the contract kinds and maps important/temporary
importance.
Logs UF-033 (search scope sent as the workspace id), UF-034 (importance
mapping) and UF-035 (restore over open databases, open).
This commit is contained in:
@@ -21,8 +21,9 @@ export const useMemory = (workspaceId: string | null) => {
|
||||
if (!workspaceId) return;
|
||||
setLoading(true);
|
||||
try {
|
||||
// Search covers what the list shows: personal memory plus this workspace's.
|
||||
const data = filters.searchQuery
|
||||
? await adapter.searchMemory(filters.searchQuery, workspaceId)
|
||||
? await adapter.searchMemory(filters.searchQuery, 'all', workspaceId)
|
||||
: await adapter.getMemoryFrames(workspaceId);
|
||||
setFrames(data);
|
||||
setError(null);
|
||||
@@ -54,15 +55,6 @@ export const useMemory = (workspaceId: string | null) => {
|
||||
setFrames(prev => prev.map(f => f.id === id ? updated : f));
|
||||
}, []);
|
||||
|
||||
const incrementAccess = useCallback(async (id: string) => {
|
||||
try {
|
||||
const { accessCount } = await adapter.incrementFrameAccess(id, workspaceId ?? undefined);
|
||||
setFrames(prev => prev.map(f => f.id === id ? { ...f, metadata: { ...f.metadata, accessCount } } : f));
|
||||
} catch (err) {
|
||||
console.error('[useMemory] incrementAccess failed:', err);
|
||||
}
|
||||
}, [workspaceId]);
|
||||
|
||||
const deleteFrame = useCallback(async (id: string) => {
|
||||
await adapter.deleteMemoryFrame(id);
|
||||
setFrames(prev => prev.filter(f => f.id !== id));
|
||||
@@ -78,7 +70,7 @@ export const useMemory = (workspaceId: string | null) => {
|
||||
return {
|
||||
frames: filteredFrames, selectedFrame, setSelectedFrame,
|
||||
loading, error, filters, setFilters,
|
||||
addFrame, editFrame, deleteFrame, incrementAccess, refresh: fetchFrames,
|
||||
addFrame, editFrame, deleteFrame, refresh: fetchFrames,
|
||||
stats: { total: frames.length, filtered: filteredFrames.length, entities: entityCount, relations: relationCount },
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user