-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat(memory): redesign sync flow with ingest_summary, graph improvements, audit log #3113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bc4ba60
e4afa19
4f3b3d4
7c7d7a0
3a3f26e
f94e558
68cd776
8af949c
bdf3d17
8922ee8
2829437
5d29bd8
06e16a6
632619e
016c8f5
c45d61e
5a77d5f
d65d96f
bc0dd4a
d96cf03
29f8375
4459f1e
96167ec
8168b46
08f72fc
43af778
8ed861f
0069ac2
cae2ee7
6c630a8
c0a27ad
9f080bd
a3725f9
a499c15
4e10785
47d9906
9299a5f
d188c06
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ import { MemoryGraph } from './MemoryGraph'; | |
| import { MemorySourcesRegistry } from './MemorySourcesRegistry'; | ||
| import { MemoryTreeStatusPanel } from './MemoryTreeStatusPanel'; | ||
| import { ObsidianVaultSection } from './ObsidianVaultSection'; | ||
| import { SyncAuditPanel } from './SyncAuditPanel'; | ||
| import { WhatsAppMemorySection } from './WhatsAppMemorySection'; | ||
|
|
||
| interface MemoryWorkspaceProps { | ||
|
|
@@ -63,13 +64,13 @@ export function MemoryWorkspace({ onToast }: MemoryWorkspaceProps) { | |
| const [resetting, setResetting] = useState(false); | ||
| const [mode, setMode] = useState<GraphMode>('tree'); | ||
|
|
||
| // (Re)load the graph whenever the mode toggle flips. The Memory | ||
| // sources panel manages its own polling. | ||
| const [graphVersion, setGraphVersion] = useState(0); | ||
|
|
||
| // (Re)load the graph whenever the mode toggle flips or tree events arrive. | ||
| useEffect(() => { | ||
| console.debug('[ui-flow][memory-workspace] graph load: entry mode=%s', mode); | ||
| console.debug('[ui-flow][memory-workspace] graph load: entry mode=%s v=%d', mode, graphVersion); | ||
| let cancelled = false; | ||
| setError(null); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid synchronous state updates inside Line 73 calls Based on learnings: “do not perform synchronous 🤖 Prompt for AI Agents |
||
| setGraph(null); | ||
| void (async () => { | ||
| try { | ||
| const resp = await memoryTreeGraphExport(mode); | ||
|
|
@@ -90,7 +91,25 @@ export function MemoryWorkspace({ onToast }: MemoryWorkspaceProps) { | |
| return () => { | ||
| cancelled = true; | ||
| }; | ||
| }, [mode]); | ||
| }, [mode, graphVersion]); | ||
|
|
||
| useEffect(() => { | ||
| const onTreeDone = () => { | ||
| setTimeout(() => setGraphVersion(v => v + 1), 2000); | ||
| }; | ||
| const onSyncDone = (e: Event) => { | ||
| const data = (e as CustomEvent).detail as { stage?: string } | null; | ||
| if (data?.stage === 'completed') { | ||
| setTimeout(() => setGraphVersion(v => v + 1), 3000); | ||
| } | ||
| }; | ||
| window.addEventListener('openhuman:memory-tree-completed', onTreeDone); | ||
| window.addEventListener('openhuman:memory-sync-stage', onSyncDone); | ||
| return () => { | ||
| window.removeEventListener('openhuman:memory-tree-completed', onTreeDone); | ||
| window.removeEventListener('openhuman:memory-sync-stage', onSyncDone); | ||
| }; | ||
| }, []); | ||
|
Comment on lines
+96
to
+112
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clear scheduled refresh timers in effect cleanup The effect unregisters listeners but doesn’t clear pending Suggested fix useEffect(() => {
+ const timerIds: number[] = [];
const onTreeDone = () => {
- setTimeout(() => setGraphVersion(v => v + 1), 2000);
+ const id = window.setTimeout(() => setGraphVersion(v => v + 1), 2000);
+ timerIds.push(id);
};
const onSyncDone = (e: Event) => {
const data = (e as CustomEvent).detail as { stage?: string } | null;
if (data?.stage === 'completed') {
- setTimeout(() => setGraphVersion(v => v + 1), 3000);
+ const id = window.setTimeout(() => setGraphVersion(v => v + 1), 3000);
+ timerIds.push(id);
}
};
window.addEventListener('openhuman:memory-tree-completed', onTreeDone);
window.addEventListener('openhuman:memory-sync-stage', onSyncDone);
return () => {
window.removeEventListener('openhuman:memory-tree-completed', onTreeDone);
window.removeEventListener('openhuman:memory-sync-stage', onSyncDone);
+ timerIds.forEach(id => window.clearTimeout(id));
};
}, []);🤖 Prompt for AI Agents |
||
|
|
||
| const handleWipe = useCallback(async () => { | ||
| // Two-step confirm so accidental clicks can't nuke a workspace. | ||
|
|
@@ -296,6 +315,13 @@ export function MemoryWorkspace({ onToast }: MemoryWorkspaceProps) { | |
| ) : ( | ||
| <MemoryGraph nodes={graph.nodes} edges={graph.edges} mode={mode} /> | ||
| )} | ||
|
|
||
| <div className="rounded-lg border border-stone-100 dark:border-neutral-800 bg-white dark:bg-neutral-900 p-4"> | ||
| <h3 className="mb-2 text-sm font-medium text-stone-700 dark:text-neutral-200"> | ||
| {t('sync.auditTitle', 'Sync History')} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove fallback literal and use a real i18n key path Line 321 uses a hardcoded fallback ( Suggested fix- {t('sync.auditTitle', 'Sync History')}
+ {t('sync.auditTitle')}// app/src/lib/i18n/en.ts
+ 'sync.auditTitle': 'Sync History',As per coding guidelines: “Every user-visible string in app/src/** ... must go through useT() ... and be added to app/src/lib/i18n/en.ts”. 🤖 Prompt for AI Agents |
||
| </h3> | ||
| <SyncAuditPanel /> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.