Skip to content

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

fix(settings): remove memory engine option panel

Steven Enamakelfd3326dd4ebc
diff --git a/app/src/components/settings/panels/MemoryEngineOption.tsx b/app/src/components/settings/panels/MemoryEngineOption.tsx
new file mode 100644
index 0000000000..313b3ae71c
--- /dev/null
+++ b/app/src/components/settings/panels/MemoryEngineOption.tsx
@@ -0,0 +1,133 @@
+import { useT } from '../../../lib/i18n/I18nContext';
+import type { MemoryEngineDescriptor } from '../../../utils/tauriCommands/memoryEngine';
+import { Badge, NativeSelect, TextField } from '../../ui';
+import { RadioGroupItem } from '../../ui/RadioGroup';
+
+export interface EngineFormValues {
+ endpoint: string;
+ deployment: string;
+ apiKey: string;
+}
+
+interface MemoryEngineOptionProps {
+ engine: MemoryEngineDescriptor;
+ isActive: boolean;
+ isSelected: boolean;
+ /** A key is already stored for this engine (only ever true for the active one). */
+ keySaved: boolean;
+ /** Hosted engine while signed out: not selectable. */
+ disabledReason: 'signed_out' | null;
+ form: EngineFormValues;
+ onFormChange: (patch: Partial<EngineFormValues>) => void;
+}
+
+/** One radio row; the configuration form opens under the selected engine. */
+export default function MemoryEngineOption({
+ engine,
+ isActive,
+ isSelected,
+ keySaved,
+ disabledReason,
+ form,
+ onFormChange,
+}: MemoryEngineOptionProps) {
+ const { t } = useT();
+ const label = t(`memoryEngine.engine.${engine.id}.label`, engine.label);
+ const description = t(`memoryEngine.engine.${engine.id}.description`, engine.description);
+ const inputId = `memory-engine-${engine.id}`;
+ const showKey = engine.needs_key || engine.key_optional;
+
+ return (
+ <div
+ data-testid={`memory-engine-option-${engine.id}`}
+ className="rounded-lg border border-line px-4 py-3">
+ <div className="flex items-start gap-3">
+ <RadioGroupItem
+ id={inputId}
+ value={engine.id}
+ disabled={disabledReason !== null}
+ className="mt-0.5"
+ />
+ <div className="min-w-0 flex-1">
+ <div className="flex flex-wrap items-center gap-2">
+ <label htmlFor={inputId} className="text-sm font-medium text-content">
+ {label}
+ </label>
+ {isActive ? <Badge variant="success">{t('memoryEngine.active')}</Badge> : null}
+ </div>
+ <p className="mt-0.5 text-xs leading-relaxed text-content-muted">{description}</p>
+ {engine.hosted ? (
+ <p className="mt-1 text-xs text-content-muted">
+ {t('memoryEngine.hostedNote')}
+ {disabledReason === 'signed_out' ? (
+ <span className="ml-1 font-medium text-coral-600" role="note">
+ {t('memoryEngine.signInRequired')}
+ </span>
+ ) : null}
+ </p>
+ ) : null}
+
+ {isSelected && disabledReason === null ? (
+ <div className="mt-3 space-y-3" data-testid={`memory-engine-form-${engine.id}`}>
+ {engine.needs_endpoint ? (
+ <div>
+ <label
+ htmlFor={`${inputId}-endpoint`}
+ className="mb-1 block text-xs font-medium text-content-secondary">
+ {t('memoryEngine.endpoint')}
+ </label>
+ <TextField
+ id={`${inputId}-endpoint`}
+ mono
+ value={form.endpoint}
+ placeholder={engine.default_endpoint ?? 'https://'}
+ onChange={e => onFormChange({ endpoint: e.target.value })}
+ />
+ </div>
+ ) : null}
+ {engine.deployments.length > 0 ? (
+ <div>
+ <label
+ htmlFor={`${inputId}-deployment`}
+ className="mb-1 block text-xs font-medium text-content-secondary">
+ {t('memoryEngine.deployment')}
+ </label>
+ <NativeSelect
+ id={`${inputId}-deployment`}
+ value={form.deployment}
+ onChange={e => onFormChange({ deployment: e.target.value })}>
+ {engine.deployments.map(d => (
+ <option key={d} value={d}>
+ {t(`memoryEngine.deployment.${d}`, d)}
+ </option>
+ ))}
+ </NativeSelect>
+ </div>
+ ) : null}
+ {showKey ? (
+ <div>
+ <label
+ htmlFor={`${inputId}-key`}
+ className="mb-1 block text-xs font-medium text-content-secondary">
+ {engine.key_optional ? t('memoryEngine.apiKeyOptional') : t('memoryEngine.apiKey')}
+ </label>
+ <TextField
+ id={`${inputId}-key`}
+ type="password"
+ autoComplete="off"
+ value={form.apiKey}
+ placeholder={keySaved ? t('memoryEngine.keySavedPlaceholder') : ''}
+ onChange={e => onFormChange({ apiKey: e.target.value })}
+ />
+ {keySaved ? (
+ <p className="mt-1 text-xs text-content-muted">{t('memoryEngine.keySaved')}</p>
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ </div>
+ </div>
+ );
+}
diff --git a/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx b/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx
new file mode 100644
index 0000000000..060cdc9024
--- /dev/null
+++ b/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx
@@ -0,0 +1,116 @@
+import { useT } from '../../../lib/i18n/I18nContext';
+import type { MemoryEngineMigrateStatus } from '../../../utils/tauriCommands/memoryEngine';
+import { Button, ModalShell, Progress } from '../../ui';
+
+interface MemoryEngineSwitchDialogProps {
+ targetLabel: string;
+ /** Capabilities of the current engine that the target lacks (humanized). */
+ lacking: string[];
+ /** Set once "Copy & switch" started; swaps the choices for a progress view. */
+ migration: MemoryEngineMigrateStatus | null;
+ busy: boolean;
+ errorMessage: string | null;
+ onCopy: () => void;
+ onSkipCopy: () => void;
+ onCancel: () => void;
+}
+
+/** "Copy my existing memories?" confirmation, then migration progress. */
+export default function MemoryEngineSwitchDialog({
+ targetLabel,
+ lacking,
+ migration,
+ busy,
+ errorMessage,
+ onCopy,
+ onSkipCopy,
+ onCancel,
+}: MemoryEngineSwitchDialogProps) {
+ const { t } = useT();
+ const migrating = migration !== null && migration.state === 'running';
+ const percent =
+ migration && migration.total && migration.total > 0
+ ? Math.min(100, Math.round((migration.copied / migration.total) * 100))
+ : null;
+
+ return (
+ <ModalShell
+ title={t('memoryEngine.dialog.title').replace('{engine}', targetLabel)}
+ titleId="memory-engine-switch-title"
+ testId="memory-engine-switch-dialog"
+ onClose={onCancel}
+ maxWidthClassName="max-w-md"
+ closePolicy={busy ? { escape: false, backdrop: false, button: false } : undefined}
+ footer={
+ migrating ? null : (
+ <div className="flex flex-wrap justify-end gap-2">
+ <Button
+ variant="tertiary"
+ size="sm"
+ analyticsId="memory-engine-cancel"
+ data-testid="memory-engine-cancel"
+ disabled={busy}
+ onClick={onCancel}>
+ {t('common.cancel')}
+ </Button>
+ <Button
+ variant="secondary"
+ size="sm"
+ analyticsId="memory-engine-switch-only"
+ data-testid="memory-engine-switch-only"
+ disabled={busy}
+ onClick={onSkipCopy}>
+ {t('memoryEngine.dialog.switchOnly')}
+ </Button>
+ <Button
+ variant="primary"
+ size="sm"
+ analyticsId="memory-engine-copy-switch"
+ data-testid="memory-engine-copy-switch"
+ disabled={busy}
+ onClick={onCopy}>
+ {t('memoryEngine.dialog.copySwitch')}
+ </Button>
+ </div>
+ )
+ }>
+ <div className="space-y-3 text-sm text-content-secondary">
+ {migrating ? (
+ <div data-testid="memory-engine-progress" className="space-y-2">
+ <p>{t('memoryEngine.dialog.copying')}</p>
+ <Progress value={percent} aria-label={t('memoryEngine.dialog.copying')} />
+ <p className="text-xs text-content-muted">
+ {migration.total !== null
+ ? t('memoryEngine.dialog.progress')
+ .replace('{copied}', String(migration.copied))
+ .replace('{total}', String(migration.total))
+ : t('memoryEngine.dialog.progressUnknown').replace(
+ '{copied}',
+ String(migration.copied)
+ )}
+ </p>
+ </div>
+ ) : (
+ <>
+ <p>{t('memoryEngine.dialog.body')}</p>
+ {lacking.length > 0 ? (
+ <div data-testid="memory-engine-lacking">
+ <p className="font-medium text-content">{t('memoryEngine.dialog.lacking')}</p>
+ <ul className="mt-1 list-disc pl-5 text-xs text-content-muted">
+ {lacking.map(cap => (
+ <li key={cap}>{cap}</li>
+ ))}
+ </ul>
+ </div>
+ ) : null}
+ </>
+ )}
+ {errorMessage ? (
+ <p role="alert" className="text-xs text-coral-600">
+ {errorMessage}
+ </p>
+ ) : null}
+ </div>
+ </ModalShell>
+ );
+}