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 migration tab

Steven Enamakela635f379ceb4
diff --git a/app/src/components/memory/MemoryImportBanner.tsx b/app/src/components/memory/MemoryImportBanner.tsx
index 571e0b281a..71c222a50b 100644
--- a/app/src/components/memory/MemoryImportBanner.tsx
+++ b/app/src/components/memory/MemoryImportBanner.tsx
@@ -10,10 +10,14 @@
* ("Migrate now") or runs in the background while free. A legacy tree other
* accounts may share (self-hosted) is only taken after the takeover dialog.
*
+ * Both steps always show once their scans answer: a step with nothing to do
+ * (nothing found, already imported, already moved, or waiting on the import)
+ * renders disabled with why, so the Migration tab never looks empty.
+ *
* debug logging: DEBUG=openhuman:memory:import, DEBUG=openhuman:memory:migration
*/
import debug from 'debug';
-import { type ReactNode, useCallback, useEffect, useRef, useState } from 'react';
+import { useCallback, useEffect, useRef, useState } from 'react';
import { useT } from '../../lib/i18n/I18nContext';
import {
@@ -48,11 +52,36 @@ 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, emptyState }: MemoryImportBannerProps) {
+/** A step with nothing to do: its title, why, and its action, disabled. */
+function DisabledStep({
+ testId,
+ title,
+ body,
+ action,
+}: {
+ testId: string;
+ title: string;
+ body: string;
+ action: string;
+}) {
+ return (
+ <Alert className="opacity-60" aria-disabled="true" data-testid={testId}>
+ <div className="flex w-full flex-wrap items-center justify-between gap-3">
+ <div className="min-w-0">
+ <AlertTitle>{title}</AlertTitle>
+ <AlertDescription>{body}</AlertDescription>
+ </div>
+ <Button type="button" size="sm" variant="secondary" disabled>
+ {action}
+ </Button>
+ </div>
+ </Alert>
+ );
+}
+
+export default function MemoryImportBanner({ engineLabel }: MemoryImportBannerProps) {
const { t } = useT();
const [scan, setScan] = useState<ImportScan | null>(null);
const [state, setState] = useState<ImportState | null>(null);
@@ -288,9 +317,12 @@ export default function MemoryImportBanner({ engineLabel, emptyState }: MemoryIm
const paused = !moving && (mState?.phase === 'paused' || mStatus?.interrupted);
const showOffer = importPending;
- if (!showOffer && !state && !showMove) {
- return importChecked && moveChecked && emptyState ? <>{emptyState}</> : null;
- }
+ // Until both scans answer, nothing: a disabled step must not flash first.
+ if (!importChecked || !moveChecked) return null;
+ // Step 1 renders live when offered, or when its run state is visible below.
+ const importShown =
+ showOffer ||
+ (!!state && state.phase !== 'idle' && !(importDone && showMove && !(state.failed ?? 0)));
const counts = scan?.counts ?? { documents: 0, conversations: 0, learnings: 0 };
const countsText = fill(t('memoryPage.import.counts'), {
@@ -300,7 +332,16 @@ export default function MemoryImportBanner({ engineLabel, emptyState }: MemoryIm
});
return (
- <div data-testid="memory-import-banner">
+ <div className="space-y-3" data-testid="memory-import-banner">
+ {!importShown && (
+ <DisabledStep
+ testId="memory-import-idle"
+ title={importDone ? t('memoryPage.import.done') : t('memoryPage.import.action')}
+ body={importDone ? t('memoryPage.import.doneBody') : t('memoryPage.import.none')}
+ action={t('memoryPage.import.short')}
+ />
+ )}
+
{showOffer && (
<Alert variant="info">
<div className="flex w-full flex-wrap items-center justify-between gap-3">
@@ -461,6 +502,19 @@ export default function MemoryImportBanner({ engineLabel, emptyState }: MemoryIm
</div>
)}
+ {!showMove && (
+ <DisabledStep
+ testId="memory-migration-idle"
+ title={t('memoryPage.migrate.title')}
+ body={
+ importPending || importBusy
+ ? t('memoryPage.migrate.afterImport')
+ : t('memoryPage.migrate.doneBody')
+ }
+ action={t('memoryPage.migrate.action')}
+ />
+ )}
+
{error !== null && (
<MemoryErrorAlert message={error} className="mt-3" data-testid="memory-import-error" />
)}
diff --git a/app/src/components/memory/MemoryMigrationTab.tsx b/app/src/components/memory/MemoryMigrationTab.tsx
index 60d72c2c5e..f16a654360 100644
--- a/app/src/components/memory/MemoryMigrationTab.tsx
+++ b/app/src/components/memory/MemoryMigrationTab.tsx
@@ -2,13 +2,10 @@
* 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.
+ * (`MemoryImportBanner`), whose steps stay visible, disabled, once done.
*/
import type { ReactNode } from 'react';
-import { LuDatabaseBackup } from 'react-icons/lu';
-import { useT } from '../../lib/i18n/I18nContext';
-import EmptyStateCard from '../EmptyStateCard';
import MemoryCortexAnnouncement from './MemoryCortexAnnouncement';
import MemoryImportBanner from './MemoryImportBanner';
@@ -20,24 +17,10 @@ interface MemoryMigrationTabProps {
}
export default function MemoryMigrationTab({ engineLabel, offState }: MemoryMigrationTabProps) {
- const { t } = useT();
return (
<div className="w-full space-y-5 animate-fade-up" data-testid="memory-migration-tab">
<MemoryCortexAnnouncement />
- {offState ?? (
- <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>
- }
- />
- )}
+ {offState ?? <MemoryImportBanner engineLabel={engineLabel} />}
</div>
);
}