Skip to content

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

feat(memory): add provider connection panel

Steven Enamakele206f60f28dc
diff --git a/app/src/components/memory/MemoryProviderModal.tsx b/app/src/components/memory/MemoryConnectionPanel.tsx
similarity index 69%
rename from app/src/components/memory/MemoryProviderModal.tsx
rename to app/src/components/memory/MemoryConnectionPanel.tsx
index b7a613881c..23154d330e 100644
--- a/app/src/components/memory/MemoryProviderModal.tsx
+++ b/app/src/components/memory/MemoryConnectionPanel.tsx
@@ -1,12 +1,12 @@
-import { ExternalLink, ShieldCheck } from 'lucide-react';
+import { Check, ExternalLink, Gift } from 'lucide-react';
import { type ReactNode, useId } from 'react';
import { useT } from '../../lib/i18n/I18nContext';
import type { EngineState } from '../../services/api/memoryApi';
import { TERMS_OF_USE_URL } from '../../utils/links';
import { openUrl } from '../../utils/openUrl';
-import { Alert, AlertDescription, Button, Label, ModalShell, TextField } from '../ui';
-import MemoryProviderLogo, { type MemoryProviderOption } from './MemoryProviderLogo';
+import { Alert, AlertDescription, Button, Label, TextField } from '../ui';
+import type { MemoryProviderOption } from './MemoryProviderLogo';
/** CortexDB's self-hosting guide, linked from the Local provider. */
export const CORTEXDB_SELF_HOST_DOCS_URL = 'https://cortexdb.ai/docs/self-hosting/quickstart';
@@ -38,9 +38,8 @@ const ExternalTextLink = ({
</a>
);
-export interface MemoryProviderModalProps {
+export interface MemoryConnectionPanelProps {
option: MemoryProviderOption;
- title: string;
description: string;
state: EngineState;
/** True when this provider is the configured one. */
@@ -61,17 +60,16 @@ export interface MemoryProviderModalProps {
/** Whether the footer's primary button can be pressed. */
canSubmit: boolean;
onSubmit: () => void;
- onClose: () => void;
}
/**
- * Settings for one memory provider: what it is, what it needs (nothing for
- * TinyHumans, a key for Cloud, an endpoint and key for Local), and for
- * TinyHumans the free-ingestion terms.
+ * One way to connect CortexDB, shown under its chip on Memory → Provider: what
+ * it is, what it needs (nothing via TinyHumans, a key for your own account, an
+ * endpoint and key for Local), its action, and via TinyHumans the free
+ * ingestion note with the fair-use terms.
*/
-export default function MemoryProviderModal({
+export default function MemoryConnectionPanel({
option,
- title,
description,
state,
active,
@@ -88,8 +86,7 @@ export default function MemoryProviderModal({
onLocalKey,
canSubmit,
onSubmit,
- onClose,
-}: MemoryProviderModalProps) {
+}: MemoryConnectionPanelProps) {
const { t } = useT();
const baseId = useId();
const formId = `${baseId}-form`;
@@ -127,8 +124,33 @@ export default function MemoryProviderModal({
const builtinBody = (
<>
- <p className="text-sm text-content-secondary">{t('memoryPage.engine.builtin.description')}</p>
- <p className="text-xs text-content-muted">{t('memoryPage.engine.builtin.enrichmentNote')}</p>
+ <p className="text-xs leading-relaxed text-content-secondary">{description}</p>
+ <p
+ className="flex items-center gap-1.5 text-xs text-content-secondary"
+ data-testid="memory-engine-builtin-note">
+ <Gift className="h-3.5 w-3.5 shrink-0 text-primary-500" aria-hidden />
+ {plan === 'BASIC' || plan === 'PRO'
+ ? t('memoryPage.engine.freeIngestion.notePlan').replace(
+ '{plan}',
+ plan === 'PRO' ? 'Pro' : 'Basic'
+ )
+ : t('memoryPage.engine.freeIngestion.noteUpgrade')}
+ </p>
+ <details className="group text-xs" data-testid="memory-engine-fair-use">
+ <summary className="cursor-pointer font-medium text-content-secondary select-none hover:text-content">
+ {t('memoryPage.engine.fairUse.summary')}
+ </summary>
+ <ul className="mt-1.5 list-disc space-y-1 pl-4 leading-relaxed text-content-muted">
+ <li>{t('memoryPage.engine.fairUse.own')}</li>
+ <li>{t('memoryPage.engine.fairUse.noAbuse')}</li>
+ <li>{t('memoryPage.engine.fairUse.limits')}</li>
+ </ul>
+ <p className="mt-1.5">
+ <ExternalTextLink href={TERMS_OF_USE_URL} testId="memory-engine-terms">
+ {t('memoryPage.engine.fairUse.terms')}
+ </ExternalTextLink>
+ </p>
+ </details>
{/* The backend origin the core resolved, read-only: never a hard-coded
URL, and only known while TinyHumans is configured. */}
{active && state.endpoint && (
@@ -144,32 +166,6 @@ export default function MemoryProviderModal({
{t('memoryPage.engine.builtin.signInHint')}
</p>
)}
- <section
- className="rounded-lg border border-line bg-surface-muted p-3.5"
- data-testid="memory-engine-fair-use">
- <h3 className="flex items-center gap-1.5 text-sm font-semibold text-content">
- <ShieldCheck className="h-4 w-4 text-primary-500" aria-hidden />
- {t('memoryPage.engine.freeIngestion.title')}
- </h3>
- <p className="mt-1 text-xs leading-relaxed text-content-secondary">
- {plan === 'BASIC' || plan === 'PRO'
- ? t('memoryPage.engine.freeIngestion.bodyIncluded').replace(
- '{plan}',
- plan === 'PRO' ? 'Pro' : 'Basic'
- )
- : t('memoryPage.engine.freeIngestion.bodyUpgrade')}
- </p>
- <ul className="mt-2 list-disc space-y-1 pl-4 text-xs leading-relaxed text-content-muted">
- <li>{t('memoryPage.engine.fairUse.own')}</li>
- <li>{t('memoryPage.engine.fairUse.noAbuse')}</li>
- <li>{t('memoryPage.engine.fairUse.limits')}</li>
- </ul>
- <p className="mt-2 text-xs">
- <ExternalTextLink href={TERMS_OF_USE_URL} testId="memory-engine-terms">
- {t('memoryPage.engine.fairUse.terms')}
- </ExternalTextLink>
- </p>
- </section>
</>
);
@@ -181,7 +177,7 @@ export default function MemoryProviderModal({
event.preventDefault();
onSubmit();
}}>
- <p className="text-sm text-content-secondary">
+ <p className="text-xs leading-relaxed text-content-secondary">
{t('memoryPage.engine.apiKeyOption.description')}
</p>
{keyField(cloudKey, onCloudKey)}
@@ -196,7 +192,7 @@ export default function MemoryProviderModal({
event.preventDefault();
onSubmit();
}}>
- <ol className="list-decimal space-y-1 pl-4 text-sm text-content-secondary">
+ <ol className="list-decimal space-y-1 pl-4 text-xs leading-relaxed text-content-secondary">
<li>
{t('memoryPage.engine.selfHost.step1')}{' '}
<ExternalTextLink href={CORTEXDB_SELF_HOST_DOCS_URL} testId="memory-engine-selfhost-docs">
@@ -246,45 +242,37 @@ export default function MemoryProviderModal({
: t('memoryPage.engine.connect');
return (
- <ModalShell
- onClose={onClose}
- title={title}
- titleId={`${baseId}-title`}
- subtitle={description}
- icon={<MemoryProviderLogo option={option} className="h-5 w-5" />}
- maxWidthClassName="max-w-lg"
- contentClassName="flex flex-col gap-4 px-5 py-4"
- testId="memory-engine-modal"
- footer={
- <div className="flex w-full items-center justify-end gap-2">
- <Button
- size="sm"
- variant="secondary"
- analyticsId="memory-engine-modal-close"
- data-testid="memory-engine-modal-close"
- onClick={onClose}>
- {t('common.close')}
- </Button>
- {showSubmit && (
- <Button
- size="sm"
- type={option === 'builtin' ? 'button' : 'submit'}
- form={option === 'builtin' ? undefined : formId}
- analyticsId={`memory-engine-${option}-submit`}
- data-testid={`memory-engine-${option}-submit`}
- disabled={!canSubmit}
- onClick={option === 'builtin' ? onSubmit : undefined}>
- {submitLabel}
- </Button>
- )}
- </div>
- }>
+ <div
+ className="flex flex-col gap-3"
+ role="tabpanel"
+ data-testid={`memory-engine-panel-${option}`}>
{option === 'builtin' ? builtinBody : option === 'apikey' ? cloudBody : localBody}
{error && (
<Alert variant="destructive" data-testid={`memory-engine-${option}-error`}>
<AlertDescription>{error}</AlertDescription>
</Alert>
)}
- </ModalShell>
+ <div className="flex items-center justify-end gap-2">
+ {showSubmit ? (
+ <Button
+ size="sm"
+ type={option === 'builtin' ? 'button' : 'submit'}
+ form={option === 'builtin' ? undefined : formId}
+ analyticsId={`memory-engine-${option}-submit`}
+ data-testid={`memory-engine-${option}-submit`}
+ disabled={!canSubmit}
+ onClick={option === 'builtin' ? onSubmit : undefined}>
+ {submitLabel}
+ </Button>
+ ) : (
+ <span
+ className="inline-flex h-8 items-center gap-1 text-xs font-semibold text-primary-600 dark:text-primary-300"
+ data-testid={`memory-engine-${option}-in-use`}>
+ <Check className="h-4 w-4" aria-hidden />
+ {t('memoryPage.engine.inUse')}
+ </span>
+ )}
+ </div>
+ </div>
);
}
diff --git a/app/src/components/memory/MemoryProviderCard.tsx b/app/src/components/memory/MemoryProviderCard.tsx
deleted file mode 100644
index d82e10eb2d..0000000000
--- a/app/src/components/memory/MemoryProviderCard.tsx
+++ /dev/null
@@ -1,115 +0,0 @@
-import { Gift, Settings } from 'lucide-react';
-import type { ReactNode } from 'react';
-
-import { cn } from '../../lib/cn';
-import { useT } from '../../lib/i18n/I18nContext';
-import { IncludedTag } from '../settings/panels/LiveVoiceVendorCard';
-import { Badge, type BadgeVariant, Button } from '../ui';
-import MemoryProviderLogo, { type MemoryProviderOption } from './MemoryProviderLogo';
-
-export interface MemoryProviderCardProps {
- option: MemoryProviderOption;
- title: string;
- description: string;
- /** True when this is the configured provider (even if it is off or down). */
- active: boolean;
- status: { variant: BadgeVariant; label: string };
- /** The card's one call to action; omitted when there is nothing to do. */
- action?: { label: string; onClick: () => void; disabled?: boolean };
- /** Small note under the tags (the free-ingestion line on TinyHumans). */
- note?: ReactNode;
- onOpenSettings: () => void;
-}
-
-/** One way to store memory on Memory → Provider: logo, what it is, status and actions. */
-const MemoryProviderCard = ({
- option,
- title,
- description,
- active,
- status,
- action,
- note,
- onOpenSettings,
-}: MemoryProviderCardProps) => {
- const { t } = useT();
- return (
- <div
- data-testid={`memory-engine-${option}`}
- data-active={active || undefined}
- className={cn(
- 'flex h-full flex-col gap-3 rounded-xl border p-4 transition-colors',
- active
- ? 'border-primary-500 bg-primary-50 ring-1 ring-primary-500 dark:bg-primary-500/10'
- : 'border-line bg-surface'
- )}>
- <div className="flex items-start justify-between gap-2">
- <span
- className={cn(
- 'flex h-11 w-11 shrink-0 items-center justify-center rounded-xl',
- option === 'builtin'
- ? active
- ? 'bg-primary-500 text-content-inverted'
- : 'bg-surface-strong text-content'
- : 'bg-white ring-1 ring-line'
- )}>
- <MemoryProviderLogo option={option} className="h-6 w-6" />
- </span>
- <Badge variant={status.variant} data-testid={`memory-engine-${option}-status`}>
- {status.label}
- </Badge>
- </div>
-
- <div>
- <h4 className="text-sm font-semibold text-content">{title}</h4>
- <p className="mt-0.5 text-xs leading-relaxed text-content-muted">{description}</p>
- </div>
-
- {note && (
- <p
- className="flex items-center gap-1.5 text-xs text-content-secondary"
- data-testid={`memory-engine-${option}-note`}>
- <Gift className="h-3.5 w-3.5 shrink-0 text-primary-500" aria-hidden />
- {note}
- </p>
- )}
-
- <div className="mt-auto flex flex-wrap items-center justify-between gap-2">
- {option === 'builtin' ? (
- <IncludedTag label={t('memoryPage.engine.includedTag')} />
- ) : (
- <Badge>
- {option === 'apikey'
- ? t('memoryPage.engine.tagOwnKey')
- : t('memoryPage.engine.tagThisComputer')}
- </Badge>
- )}
- <div className="ml-auto flex items-center gap-1.5">
- {action && (
- <Button
- size="sm"
- analyticsId={`memory-engine-${option}-action`}
- data-testid={`memory-engine-${option}-action`}
- disabled={action.disabled}
- onClick={action.onClick}>
- {action.label}
- </Button>
- )}
- <Button
- size="sm"
- variant="secondary"
- iconOnly
- analyticsId="memory-engine-open-settings"
- data-testid={`memory-engine-${option}-settings`}
- aria-label={t('memoryPage.engine.settingsAria').replace('{name}', title)}
- title={t('memoryPage.engine.settings')}
- onClick={onOpenSettings}>
- <Settings className="h-4 w-4" aria-hidden />
- </Button>
- </div>
- </div>
- </div>
- );
-};
-
-export default MemoryProviderCard;