Skip to content

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

feat(settings): add memory engine panel with switch dialog

Steven Enamakel67a87bb211d1
diff --git a/app/src/components/settings/panels/MemoryEnginePanel.tsx b/app/src/components/settings/panels/MemoryEnginePanel.tsx
index eb871ec986..67ab90b497 100644
--- a/app/src/components/settings/panels/MemoryEnginePanel.tsx
+++ b/app/src/components/settings/panels/MemoryEnginePanel.tsx
@@ -82,6 +82,8 @@ export default function MemoryEnginePanel() {
const [jobId, setJobId] = useState<string | null>(null);
const [migration, setMigration] = useState<MemoryEngineMigrateStatus | null>(null);
const mounted = useRef(true);
+ // Driver the running migration is copying into (finishSwitch needs it after polling).
+ const targetDriverRef = useRef<string>('');
useEffect(() => {
mounted.current = true;
@@ -135,12 +137,11 @@ export default function MemoryEnginePanel() {
const dirty = useMemo(() => {
if (!isSameDriver || !form || !current) return false;
- return (
- form.apiKey.trim() !== '' ||
- (selected?.needs_endpoint === true && form.endpoint !== (current.endpoint ?? '')) ||
- (selected ? selected.deployments.length > 0 : false) &&
- form.deployment !== (current.deployment ?? '')
- );
+ const endpointChanged =
+ selected?.needs_endpoint === true && form.endpoint !== (current.endpoint ?? '');
+ const deploymentChanged =
+ (selected?.deployments.length ?? 0) > 0 && form.deployment !== (current.deployment ?? '');
+ return form.apiKey.trim() !== '' || endpointChanged || deploymentChanged;
}, [isSameDriver, form, current, selected]);
const buildTarget = (): MemoryEngineTarget | null => {
@@ -194,6 +195,7 @@ export default function MemoryEnginePanel() {
setSaving(true);
setError(null);
try {
+ targetDriverRef.current = target.driver;
const { job_id } = await memoryEngineMigrate(target);
log('migrate started job=%s driver=%s', job_id, target.driver);
if (!mounted.current) return;
@@ -226,7 +228,7 @@ export default function MemoryEnginePanel() {
setSaving(false);
if (status.state === 'done') {
log('migrate done job=%s copied=%d', jobId, status.copied);
- await finishSwitch(selectedIdRef.current ?? '');
+ await finishSwitch(targetDriverRef.current);
} else {
log('migrate failed job=%s', jobId);
setJobId(null);
@@ -251,9 +253,6 @@ export default function MemoryEnginePanel() {
};
}, [jobId, finishSwitch]);
- const selectedIdRef = useRef<string | null>(null);
- selectedIdRef.current = selectedId;
-
const onSwitchClick = () => {
if (isSameDriver) {
void doSet();
@@ -364,7 +363,6 @@ export default function MemoryEnginePanel() {
lacking={lacking}
migration={migration}
busy={saving}
- errorMessage={null}
onCopy={() => void doMigrate()}
onSkipCopy={() => void doSet()}
onCancel={() => setConfirming(false)}
diff --git a/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx b/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx
index 060cdc9024..7bfbad6a5e 100644
--- a/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx
+++ b/app/src/components/settings/panels/MemoryEngineSwitchDialog.tsx
@@ -9,7 +9,6 @@ interface MemoryEngineSwitchDialogProps {
/** 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;
@@ -21,7 +20,6 @@ export default function MemoryEngineSwitchDialog({
lacking,
migration,
busy,
- errorMessage,
onCopy,
onSkipCopy,
onCancel,
@@ -105,11 +103,6 @@ export default function MemoryEngineSwitchDialog({
) : null}
</>
)}
- {errorMessage ? (
- <p role="alert" className="text-xs text-coral-600">
- {errorMessage}
- </p>
- ) : null}
</div>
</ModalShell>
);
diff --git a/vendor/tinymemory b/vendor/tinymemory
index d0eba30294..fdbaaf4860 160000
--- a/vendor/tinymemory
+++ b/vendor/tinymemory
@@ -1 +1 @@
-Subproject commit d0eba30294835e22c8472b2176f90113e521e48a
+Subproject commit fdbaaf48609b264c9a293f82aabcae3c7e10c115