Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

feat(memory): add import banner and chip helpers

Steven Enamakelbe0d71490652
diff --git a/app/src/components/memory/MemoryEngineTab.tsx b/app/src/components/memory/MemoryEngineTab.tsx
index fffcf27554..fea9a6674b 100644
--- a/app/src/components/memory/MemoryEngineTab.tsx
+++ b/app/src/components/memory/MemoryEngineTab.tsx
@@ -38,7 +38,6 @@ import { CenteredLoadingState } from '../ui/LoadingState';
import { toast } from '../ui/Toast';
import MemoryComingSoon from './MemoryComingSoon';
import MemoryConnectionPanel from './MemoryConnectionPanel';
-import MemoryCortexAnnouncement from './MemoryCortexAnnouncement';
import MemoryCortexCard from './MemoryCortexCard';
import MemoryProviderLogo, { type MemoryProviderOption } from './MemoryProviderLogo';
@@ -227,7 +226,6 @@ export default function MemoryEngineTab({ state, onStateChange, embedded }: Memo
<div
className={`@container ${embedded ? 'space-y-5' : 'w-full space-y-6 animate-fade-up'}`}
data-testid="memory-engine-tab">
- {!embedded && <MemoryCortexAnnouncement />}
{statusBanner}
<MemoryCortexCard selected={selected} onSelect={setPicked} active={active} status={status}>
diff --git a/app/src/components/memory/MemoryImportBanner.tsx b/app/src/components/memory/MemoryImportBanner.tsx
index b6531bcddd..571e0b281a 100644
--- a/app/src/components/memory/MemoryImportBanner.tsx
+++ b/app/src/components/memory/MemoryImportBanner.tsx
@@ -13,7 +13,7 @@
* debug logging: DEBUG=openhuman:memory:import, DEBUG=openhuman:memory:migration
*/
import debug from 'debug';
-import { useCallback, useEffect, useRef, useState } from 'react';
+import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react';
import { useT } from '../../lib/i18n/I18nContext';
import {
@@ -48,9 +48,11 @@ export const MIGRATION_IDLE_POLL_MS = 15_000;
interface MemoryImportBannerProps {
/** Label of the engine the data would be uploaded to. */
engineLabel: string;
+ /** Shown once both scans have answered and there is nothing to import or move. */
+ emptyState?: ReactNode;
}
-export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerProps) {
+export default function MemoryImportBanner({ engineLabel, emptyState }: MemoryImportBannerProps) {
const { t } = useT();
const [scan, setScan] = useState<ImportScan | null>(null);
const [state, setState] = useState<ImportState | null>(null);
@@ -143,6 +145,8 @@ export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerPr
// import finishes. Bumping it re-runs the read and discards the answer of
// the one it replaces.
const [mScanAttempt, setMScanAttempt] = useState(0);
+ // The first read of what is left to move has answered (or failed).
+ const [moveChecked, setMoveChecked] = useState(false);
const rescanMove = useCallback(() => setMScanAttempt(n => n + 1), []);
// Bumped by a start or retry: a read or poll asked before it answers for
// an older state, and is dropped.
@@ -161,6 +165,7 @@ export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerPr
mlog('scan: needed=%s shared=%s', found?.needed, found?.shared);
setMScan(found ?? null);
setMStatus(current ?? null);
+ setMoveChecked(true);
})
.catch(err => {
// A transient failure must not hide the move for good: try again.
@@ -171,6 +176,7 @@ export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerPr
// end reads again.
if (!cancelled && gen === mStatusGen.current) {
setMScan(null);
+ setMoveChecked(true);
retry = setTimeout(rescanMove, MIGRATION_IDLE_POLL_MS);
}
});
@@ -282,7 +288,9 @@ export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerPr
const paused = !moving && (mState?.phase === 'paused' || mStatus?.interrupted);
const showOffer = importPending;
- if (!showOffer && !state && !showMove) return null;
+ if (!showOffer && !state && !showMove) {
+ return importChecked && moveChecked && emptyState ? <>{emptyState}</> : null;
+ }
const counts = scan?.counts ?? { documents: 0, conversations: 0, learnings: 0 };
const countsText = fill(t('memoryPage.import.counts'), {
diff --git a/app/src/components/memory/MemoryMigrationTab.tsx b/app/src/components/memory/MemoryMigrationTab.tsx
new file mode 100644
index 0000000000..29019d4474
--- /dev/null
+++ b/app/src/components/memory/MemoryMigrationTab.tsx
@@ -0,0 +1,38 @@
+/**
+ * Memory → Migration: everything about bringing memory forward from earlier
+ * versions, in one place instead of a banner over every chip. Holds the
+ * CortexDB announcement and the import-then-organize flow
+ * (`MemoryImportBanner`); with nothing left to import or move it says so.
+ */
+import { LuDatabaseBackup } from 'react-icons/lu';
+
+import { useT } from '../../lib/i18n/I18nContext';
+import EmptyStateCard from '../EmptyStateCard';
+import MemoryCortexAnnouncement from './MemoryCortexAnnouncement';
+import MemoryImportBanner from './MemoryImportBanner';
+
+interface MemoryMigrationTabProps {
+ /** Label of the engine imported memory is uploaded to. */
+ engineLabel: string;
+}
+
+export default function MemoryMigrationTab({ engineLabel }: MemoryMigrationTabProps) {
+ const { t } = useT();
+ return (
+ <div className="w-full space-y-5 animate-fade-up" data-testid="memory-migration-tab">
+ <MemoryCortexAnnouncement />
+ <MemoryImportBanner
+ engineLabel={engineLabel}
+ emptyState={
+ <div data-testid="memory-migration-empty">
+ <EmptyStateCard
+ icon={<LuDatabaseBackup className="h-6 w-6 text-primary-500" aria-hidden />}
+ title={t('memoryPage.migrate.nothingTitle')}
+ description={t('memoryPage.migrate.nothingBody')}
+ />
+ </div>
+ }
+ />
+ </div>
+ );
+}
diff --git a/app/src/components/memory/memoryChips.ts b/app/src/components/memory/memoryChips.ts
index 9640c44835..51acf276d2 100644
--- a/app/src/components/memory/memoryChips.ts
+++ b/app/src/components/memory/memoryChips.ts
@@ -5,6 +5,7 @@
export type MemoryChip =
| 'engine'
+ | 'migration'
| 'ask'
| 'explorer'
| 'learnings'
@@ -15,6 +16,7 @@ export type MemoryChip =
export const MEMORY_CHIPS: readonly MemoryChip[] = [
'engine',
+ 'migration',
'ask',
'explorer',
'learnings',