Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(runtime): eToro SDK connector UI parity

Ofek Shakede9f79ca54af2
diff --git a/frontend/src/components/chat/RunnerStatus.tsx b/frontend/src/components/chat/RunnerStatus.tsx
index 4f847a13e..73e16f8fa 100644
--- a/frontend/src/components/chat/RunnerStatus.tsx
+++ b/frontend/src/components/chat/RunnerStatus.tsx
@@ -17,6 +17,7 @@ import {
api,
type LiveStatus,
type LiveBrokerStatus,
+ type LiveBrokerAuthStatus,
type LiveMandateLimits,
type LiveAuthorizeResponse,
} from "@/lib/api";
@@ -80,6 +81,42 @@ function fallbackAuthorizeInstruction(): string {
return i18n.t("runnerStatus.fallbackInstruction");
}
+function isSdkBroker(auth: LiveBrokerAuthStatus): boolean {
+ return auth.transport === "broker_sdk";
+}
+
+function isOAuthLiveBroker(auth: LiveBrokerAuthStatus): boolean {
+ return auth.is_live_broker === true && !isSdkBroker(auth);
+}
+
+function isSdkConnectionReady(auth: LiveBrokerAuthStatus): boolean {
+ return auth.connection_state === "connected" || auth.connection_state === "ready";
+}
+
+function isConnectorOperational(auth: LiveBrokerAuthStatus): boolean {
+ if (auth.oauth_token_present) return true;
+ if (isSdkBroker(auth)) return isSdkConnectionReady(auth);
+ return false;
+}
+
+function sdkDiagnosticMessage(auth: LiveBrokerAuthStatus): string {
+ switch (auth.error_code) {
+ case "credentials_missing":
+ case "credentials_partial":
+ return i18n.t("runnerStatus.sdkCredentialsRequired");
+ case "credentials_conflict":
+ return i18n.t("runtime.diagnosticCredentialsConflict");
+ case "sdk_missing":
+ return i18n.t("runtime.diagnosticSdkMissing");
+ case "authentication_failed":
+ return i18n.t("runtime.diagnosticAuthenticationFailed");
+ case "network_unreachable":
+ return i18n.t("runtime.diagnosticNetworkUnreachable");
+ default:
+ return auth.error?.trim() || i18n.t("runnerStatus.sdkConnectionError");
+ }
+}
+
function BrokerRow({
broker,
halted,
@@ -92,8 +129,12 @@ function BrokerRow({
const [busy, setBusy] = useState(false);
const [authorizeHint, setAuthorizeHint] = useState<LiveAuthorizeResponse | null>(null);
const [authorizeFailed, setAuthorizeFailed] = useState(false);
- const brokerKey = broker.auth.broker;
- const authorized = broker.auth.oauth_token_present;
+ const auth = broker.auth;
+ const brokerKey = auth.broker;
+ const oauthAuthorized = auth.oauth_token_present;
+ const sdkReady = isSdkBroker(auth) && isSdkConnectionReady(auth);
+ const operational = isConnectorOperational(auth);
+ const showOAuthOnRamp = isOAuthLiveBroker(auth) && !oauthAuthorized;
const runnerAlive = broker.runner?.alive ?? false;
const mandate = broker.mandate ?? null;
const countdown = formatCountdown(mandate?.expires_at);
@@ -105,7 +146,7 @@ function BrokerRow({
let cancelled = false;
setAuthorizeHint(null);
setAuthorizeFailed(false);
- if (authorized || !brokerKey) return () => { cancelled = true; };
+ if (!showOAuthOnRamp || !brokerKey) return () => { cancelled = true; };
api.authorizeLive(brokerKey)
.then((response) => {
@@ -116,7 +157,7 @@ function BrokerRow({
});
return () => { cancelled = true; };
- }, [authorized, brokerKey]);
+ }, [brokerKey, showOAuthOnRamp]);
const toggleRunner = useCallback(async () => {
if (busy) return;
@@ -142,11 +183,16 @@ function BrokerRow({
<div className="flex items-center justify-between gap-2">
<div className="flex min-w-0 items-center gap-1.5">
<span className="truncate text-xs font-semibold capitalize text-foreground">{brokerKey}</span>
- {authorized ? (
+ {oauthAuthorized ? (
<span className="inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400">
<ShieldCheck className="h-2.5 w-2.5" />
{i18n.t("runnerStatus.authorized")}
</span>
+ ) : sdkReady ? (
+ <span className="inline-flex items-center gap-1 rounded-full bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-medium text-emerald-600 dark:text-emerald-400">
+ <CircleDot className="h-2.5 w-2.5" />
+ {i18n.t("runnerStatus.sdkConnected")}
+ </span>
) : (
<span className="inline-flex items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground">
<CircleSlash className="h-2.5 w-2.5" />
@@ -156,10 +202,8 @@ function BrokerRow({
</div>
</div>
- {/* Connect-profile on-ramp for unauthorized brokers (C2). The OAuth bootstrap
- is a desktop-only CLI step (SPEC §4 headless behavior), so the web surface
- surfaces the discoverable instruction rather than driving the browser flow. */}
- {!authorized ? (
+ {/* OAuth on-ramp for mandate live brokers only — SDK key brokers use file/env credentials. */}
+ {showOAuthOnRamp ? (
<div className="grid gap-1.5 rounded-md border border-dashed border-primary/30 bg-primary/5 p-2">
<div className="flex items-center gap-1.5 text-[11px] font-medium text-primary">
<PlugZap className="h-3 w-3 shrink-0" />
@@ -174,8 +218,19 @@ function BrokerRow({
</p>
)}
</div>
- ) : (
+ ) : isSdkBroker(auth) && !operational ? (
+ <div className="grid gap-1.5 rounded-md border border-dashed border-border/60 bg-muted/30 p-2">
+ <p className="text-[10px] leading-relaxed text-muted-foreground">
+ {sdkDiagnosticMessage(auth)}
+ </p>
+ </div>
+ ) : operational ? (
<>
+ {sdkReady && auth.readonly === true ? (
+ <p className="text-[10px] leading-relaxed text-muted-foreground">
+ {i18n.t("runnerStatus.sdkReadOnlyNote")}
+ </p>
+ ) : null}
<div className="grid grid-cols-2 gap-2">
<div className="rounded-md border bg-background/60 p-2">
<div className="flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground">
@@ -259,7 +314,7 @@ function BrokerRow({
</button>
</div>
</>
- )}
+ ) : null}
</div>
);
}
diff --git a/frontend/src/components/chat/__tests__/RunnerStatus.test.tsx b/frontend/src/components/chat/__tests__/RunnerStatus.test.tsx
index d152ca343..eab2eb838 100644
--- a/frontend/src/components/chat/__tests__/RunnerStatus.test.tsx
+++ b/frontend/src/components/chat/__tests__/RunnerStatus.test.tsx
@@ -54,6 +54,7 @@ describe("RunnerStatus compact connector panel", () => {
status={status([
broker("alpaca", { configured: false, connection_state: "not_configured", transport: "broker_sdk" }),
broker("longbridge", { configured: true, connection_state: "connected", transport: "broker_sdk" }),
+ broker("etoro", { configured: true, connection_state: "connected", transport: "broker_sdk" }),
broker("binance", { configured: true, connection_state: "ready", transport: "broker_sdk" }),
broker("futu", { configured: true, connection_state: null, transport: "broker_sdk" }),
broker("okx", { configured: true, connection_state: "error", transport: "broker_sdk" }),
@@ -67,6 +68,7 @@ describe("RunnerStatus compact connector panel", () => {
expect(screen.queryByText("alpaca", { exact: false })).not.toBeInTheDocument();
expect(screen.getByText("longbridge", { exact: false })).toBeInTheDocument();
+ expect(screen.getByText("etoro", { exact: false })).toBeInTheDocument();
expect(screen.getByText("binance", { exact: false })).toBeInTheDocument();
expect(screen.getByText("futu", { exact: false })).toBeInTheDocument();
expect(screen.getByText("okx", { exact: false })).toBeInTheDocument();
@@ -94,6 +96,31 @@ describe("RunnerStatus compact connector panel", () => {
},
);
+ it("shows SDK connected state for key-based brokers instead of OAuth on-ramp", async () => {
+ const user = userEvent.setup();
+ render(
+ <RunnerStatus
+ status={status([
+ broker("etoro", {
+ configured: true,
+ connection_state: "connected",
+ transport: "broker_sdk",
+ readonly: true,
+ profile_id: "etoro-live-sdk-readonly",
+ }),
+ ])}
+ onRefresh={vi.fn()}
+ />,
+ );
+
+ await user.click(screen.getByRole("button", { name: /connector runtime/i }));
+
+ expect(screen.getByText(i18n.t("runnerStatus.sdkConnected"))).toBeInTheDocument();
+ expect(screen.queryByText(i18n.t("runnerStatus.connectProfile"))).not.toBeInTheDocument();
+ expect(screen.getByText(i18n.t("runnerStatus.sdkReadOnlyNote"))).toBeInTheDocument();
+ expect(apiMock.authorizeLive).not.toHaveBeenCalled();
+ });
+
it("bounds the expanded connector list and enables internal vertical scrolling", async () => {
const user = userEvent.setup();
render(
diff --git a/frontend/src/i18n/locales/ar.json b/frontend/src/i18n/locales/ar.json
index fdb93c9ec..fe2ee23fd 100644
--- a/frontend/src/i18n/locales/ar.json
+++ b/frontend/src/i18n/locales/ar.json
@@ -96,6 +96,10 @@
"connectorStatusUnavailable": "الحالة غير متاحة",
"connectedAccessUnknown": "متصل · صلاحية الوصول غير معروفة",
"missingLongbridgeVariables": "الإعدادات ناقصة. اضبط المتغيرات التالية في agent/.env، ثم أعد إنشاء الخدمة:",
+ "missingEtoroVariables": "الإعدادات ناقصة. اضبط متغيرات البيئة التالية أو أنشئ ~/.vibe-trading/etoro.json:",
+ "missingEtoroFileHint": "مثال: {\"api_key\": \"YOUR_PUBLIC_API_KEY\", \"user_key\": \"YOUR_USER_KEY\", \"profile\": \"live-readonly\"}. الملفات: etoro-paper-sdk، etoro-live-sdk-readonly، etoro-paper-trade، etoro-live-trade.",
+ "missingConnectorVariables": "الإعدادات ناقصة. اضبط بيانات اعتماد الموصل في ~/.vibe-trading/ أو agent/.env ثم تحقق من الاتصال.",
+ "pathSeparatedKeyBound": "مسارات منفصلة للتجريبي/الحقيقي (مفتاح مشترك)",
"sdkConnectorProfile": "اتصال مباشر عبر SDK · ملف تعريف للقراءة فقط",
"connectionDetails": "تفاصيل الاتصال",
"environment": "البيئة",
@@ -857,6 +861,10 @@
"running": "قيد التشغيل",
"halted": "موقوف",
"authorized": "مُصادَق",
+ "sdkConnected": "متصل",
+ "sdkReadOnlyNote": "موصل SDK مباشر · ملف قراءة فقط. التداول المباشر يتطلب ملف trade و mandate مُلتزَم.",
+ "sdkCredentialsRequired": "قم بتكوين بيانات اعتماد API لهذا الموصل (راجع Runtime).",
+ "sdkConnectionError": "فشل فحص الاتصال. تحقق من بيانات الاعتماد في Runtime.",
"notConnected": "غير متصل",
"connectProfile": "وصّل ملف التعريف هذا لتفعيل وقت تشغيل الموصل",
"authorizeNote": "تبقى قناة الموصل للقراءة فقط حتى تنجح مصادقة OAuth ويُلتزم التفويض.",
diff --git a/frontend/src/i18n/locales/en.json b/frontend/src/i18n/locales/en.json
index 001be1f7f..bb60a22c8 100644
--- a/frontend/src/i18n/locales/en.json
+++ b/frontend/src/i18n/locales/en.json
@@ -101,6 +101,10 @@
"connectorStatusUnavailable": "Status unavailable",
"connectedAccessUnknown": "Connected · Access unknown",
"missingLongbridgeVariables": "Missing configuration. Configure these variables in agent/.env and recreate the service:",
+ "missingEtoroVariables": "Missing configuration. Set these environment variables or create ~/.vibe-trading/etoro.json:",
+ "missingEtoroFileHint": "Example file: {\"api_key\": \"YOUR_PUBLIC_API_KEY\", \"user_key\": \"YOUR_USER_KEY\", \"profile\": \"live-readonly\"}. Profiles: etoro-paper-sdk, etoro-live-sdk-readonly, etoro-paper-trade, etoro-live-trade.",
+ "missingConnectorVariables": "Missing configuration. Configure connector credentials in ~/.vibe-trading/ or agent/.env, then verify the connection.",
+ "pathSeparatedKeyBound": "Demo/real path-separated (shared key pair)",
"sdkConnectorProfile": "Direct SDK connector · read-only profile",
"connectionDetails": "Connection details",
"environment": "Environment",
@@ -862,6 +866,10 @@
"running": "running",
"halted": "halted",
"authorized": "Authorized",
+ "sdkConnected": "Connected",
+ "sdkReadOnlyNote": "Direct SDK connector · read-only profile. Live trading requires the trade profile and a committed mandate.",
+ "sdkCredentialsRequired": "Configure API credentials for this connector (see Runtime for setup).",
+ "sdkConnectionError": "Connection check failed. Verify credentials on the Runtime page.",
"notConnected": "Not connected",
"connectProfile": "Connect this profile to enable connector runtime",
"authorizeNote": "The connector channel stays read-only until OAuth succeeds and a mandate is committed.",
diff --git a/frontend/src/i18n/locales/ja.json b/frontend/src/i18n/locales/ja.json
index 734a1aec7..531999099 100644
--- a/frontend/src/i18n/locales/ja.json
+++ b/frontend/src/i18n/locales/ja.json
@@ -96,6 +96,10 @@
"connectorStatusUnavailable": "状態を取得できません",
"connectedAccessUnknown": "接続済み・アクセス権不明",
"missingLongbridgeVariables": "設定が不足しています。agent/.env に次の変数を設定し、サービスを再作成してください:",
+ "missingEtoroVariables": "設定が不足しています。次の環境変数を設定するか ~/.vibe-trading/etoro.json を作成してください:",
+ "missingEtoroFileHint": "例: {\"api_key\": \"YOUR_PUBLIC_API_KEY\", \"user_key\": \"YOUR_USER_KEY\", \"profile\": \"live-readonly\"}。プロファイル: etoro-paper-sdk、etoro-live-sdk-readonly、etoro-paper-trade、etoro-live-trade。",
+ "missingConnectorVariables": "設定が不足しています。~/.vibe-trading/ または agent/.env でコネクター認証情報を設定し、接続を検証してください。",
+ "pathSeparatedKeyBound": "デモ/本番パス分離(共有キーペア)",
"sdkConnectorProfile": "SDK 直接接続・読み取り専用プロファイル",
"connectionDetails": "接続の詳細",
"environment": "環境",
@@ -857,6 +861,10 @@
"running": "実行中",
"halted": "停止中",
"authorized": "認可済み",
+ "sdkConnected": "接続済み",
+ "sdkReadOnlyNote": "直接 SDK コネクタ · 読み取り専用プロファイル。実取引には trade プロファイルとコミット済みマンデートが必要です。",
+ "sdkCredentialsRequired": "このコネクタの API 認証情報を設定してください(Runtime を参照)。",
+ "sdkConnectionError": "接続確認に失敗しました。Runtime で認証情報を確認してください。",
"notConnected": "未接続",
"connectProfile": "このプロファイルを接続してコネクタを有効化",
"authorizeNote": "OAuth が成功しマンデートがコミットされるまで、コネクタチャネルは読み取り専用のままです。",
diff --git a/frontend/src/i18n/locales/ko.json b/frontend/src/i18n/locales/ko.json
index 72331da0e..d4f616167 100644
--- a/frontend/src/i18n/locales/ko.json
+++ b/frontend/src/i18n/locales/ko.json
@@ -96,6 +96,10 @@
"connectorStatusUnavailable": "상태를 확인할 수 없음",
"connectedAccessUnknown": "연결됨 · 접근 권한 불명",
"missingLongbridgeVariables": "설정이 누락되었습니다. agent/.env에 다음 변수를 설정하고 서비스를 다시 생성하세요:",
+ "missingEtoroVariables": "설정이 누락되었습니다. 다음 환경 변수를 설정하거나 ~/.vibe-trading/etoro.json을 생성하세요:",
+ "missingEtoroFileHint": "예: {\"api_key\": \"YOUR_PUBLIC_API_KEY\", \"user_key\": \"YOUR_USER_KEY\", \"profile\": \"live-readonly\"}. 프로필: etoro-paper-sdk, etoro-live-sdk-readonly, etoro-paper-trade, etoro-live-trade.",
+ "missingConnectorVariables": "설정이 누락되었습니다. ~/.vibe-trading/ 또는 agent/.env에 커넥터 자격 증명을 구성한 후 연결을 검증하세요.",
+ "pathSeparatedKeyBound": "데모/실계좌 경로 분리(공유 키 페어)",
"sdkConnectorProfile": "SDK 직접 연결 · 읽기 전용 프로필",
"connectionDetails": "연결 세부 정보",
"environment": "환경",
@@ -857,6 +861,10 @@
"running": "실행 중",
"halted": "정지됨",
"authorized": "인증됨",
+ "sdkConnected": "연결됨",
+ "sdkReadOnlyNote": "직접 SDK 커넥터 · 읽기 전용 프로필. 실거래에는 trade 프로필과 커밋된 mandate가 필요합니다.",
+ "sdkCredentialsRequired": "이 커넥터의 API 자격 증명을 구성하세요(Runtime 참조).",
+ "sdkConnectionError": "연결 확인에 실패했습니다. Runtime에서 자격 증명을 확인하세요.",
"notConnected": "연결되지 않음",
"connectProfile": "이 프로필을 연결하여 커넥터 활성화",
"authorizeNote": "OAuth가 성공하고 mandate가 커밋될 때까지 커넥터 채널은 읽기 전용 상태를 유지합니다.",
diff --git a/frontend/src/i18n/locales/zh-CN.json b/frontend/src/i18n/locales/zh-CN.json
index 5f377dcf0..607e45955 100644
--- a/frontend/src/i18n/locales/zh-CN.json
+++ b/frontend/src/i18n/locales/zh-CN.json
@@ -96,6 +96,10 @@
"connectorStatusUnavailable": "状态不可用",
"connectedAccessUnknown": "已连接 · 访问权限未知",
"missingLongbridgeVariables": "缺少配置。请在 agent/.env 中配置以下变量并重新创建服务:",
+ "missingEtoroVariables": "缺少配置。请设置以下环境变量或创建 ~/.vibe-trading/etoro.json:",
+ "missingEtoroFileHint": "示例:{\"api_key\": \"YOUR_PUBLIC_API_KEY\", \"user_key\": \"YOUR_USER_KEY\", \"profile\": \"live-readonly\"}。配置文件:etoro-paper-sdk、etoro-live-sdk-readonly、etoro-paper-trade、etoro-live-trade。",
+ "missingConnectorVariables": "缺少配置。请在 ~/.vibe-trading/ 或 agent/.env 中配置连接器凭据,然后验证连接。",
+ "pathSeparatedKeyBound": "模拟/真实路径分离(共享密钥对)",
"sdkConnectorProfile": "直连 SDK 连接器 · 只读档案",
"connectionDetails": "连接详情",
"environment": "环境",
@@ -857,6 +861,10 @@
"running": "运行中",
"halted": "已停止",
"authorized": "已授权",
+ "sdkConnected": "已连接",
+ "sdkReadOnlyNote": "直连 SDK 连接器 · 只读配置文件。实盘交易需要 trade 配置文件和已提交的授权。",
+ "sdkCredentialsRequired": "请为此连接器配置 API 凭证(参见 Runtime 页面)。",
+ "sdkConnectionError": "连接检查失败。请在 Runtime 页面验证凭证。",
"notConnected": "未连接",
"connectProfile": "连接此档案以启动连接器",
"authorizeNote": "在 OAuth 授权成功且提交交易授权(mandate)之前,连接器通道保持只读。",
diff --git a/frontend/src/pages/Runtime.tsx b/frontend/src/pages/Runtime.tsx
index c851580df..62322dc7f 100644
--- a/frontend/src/pages/Runtime.tsx
+++ b/frontend/src/pages/Runtime.tsx
@@ -343,14 +343,7 @@ function SdkBrokerRuntimeCard({ broker, t, onRefresh }: { broker: LiveBrokerStat
</div>
{state.kind === "not_configured" ? (
- <section className="mt-4 rounded-xl border border-dashed border-border/60 bg-muted/40 p-4 shadow-sm">
- <p className="text-sm text-muted-foreground">{t("runtime.missingLongbridgeVariables")}</p>
- <ul className="mt-2 grid gap-1 font-mono text-sm">
- <li>LONGBRIDGE_APP_KEY</li>
- <li>LONGBRIDGE_APP_SECRET</li>
- <li>LONGBRIDGE_ACCESS_TOKEN</li>
- </ul>
- </section>
+ <ConnectorMissingSetup broker={auth.broker} t={t} />
) : (
<div className="mt-4 grid gap-3 md:grid-cols-3">
<RuntimePanel title={t("runtime.connectionDetails")} icon={state.kind === "connected" ? Wifi : WifiOff}>
@@ -416,9 +409,47 @@ function formatSdkState(installed: boolean | null | undefined, t: TFunction): st
function formatEnvironmentIdentity(identity: string | null | undefined, t: TFunction): string {
if (identity === "config_declared" || identity === "config-declared") return t("runtime.configDeclared");
+ if (identity === "path_separated_key_bound") return t("runtime.pathSeparatedKeyBound");
return identity || t("runtime.unknown");
}
+const SDK_CONNECTOR_SETUP_HINTS = {
+ longbridge: {
+ introKey: "runtime.missingLongbridgeVariables",
+ variables: ["LONGBRIDGE_APP_KEY", "LONGBRIDGE_APP_SECRET", "LONGBRIDGE_ACCESS_TOKEN"],
+ },
+ etoro: {
+ introKey: "runtime.missingEtoroVariables",
+ variables: ["ETORO_API_KEY", "ETORO_USER_KEY"],
+ fileHintKey: "runtime.missingEtoroFileHint",
+ },
+} as const;
+
+function ConnectorMissingSetup({ broker, t }: { broker: string; t: TFunction }) {
+ const hints =
+ SDK_CONNECTOR_SETUP_HINTS[broker as keyof typeof SDK_CONNECTOR_SETUP_HINTS];
+ if (!hints) {
+ return (
+ <section className="mt-4 rounded-xl border border-dashed border-border/60 bg-muted/40 p-4 shadow-sm">
+ <p className="text-sm text-muted-foreground">{t("runtime.missingConnectorVariables")}</p>
+ </section>
+ );
+ }
+ return (
+ <section className="mt-4 rounded-xl border border-dashed border-border/60 bg-muted/40 p-4 shadow-sm">
+ <p className="text-sm text-muted-foreground">{t(hints.introKey)}</p>
+ <ul className="mt-2 grid gap-1 font-mono text-sm">
+ {hints.variables.map((variable) => (
+ <li key={variable}>{variable}</li>
+ ))}
+ </ul>
+ {"fileHintKey" in hints && hints.fileHintKey ? (
+ <p className="mt-2 text-sm text-muted-foreground">{t(hints.fileHintKey)}</p>
+ ) : null}
+ </section>
+ );
+}
+
function isReadCapability(capability: string): boolean {
return capability.endsWith(".read");
}
diff --git a/frontend/src/pages/__tests__/Runtime.test.tsx b/frontend/src/pages/__tests__/Runtime.test.tsx
index 790b03bd2..1b146b1c1 100644
--- a/frontend/src/pages/__tests__/Runtime.test.tsx
+++ b/frontend/src/pages/__tests__/Runtime.test.tsx
@@ -96,6 +96,36 @@ function makeLongbridgeStatus(
});
}
+function makeEtoroStatus(
+ authOverrides: Partial<LiveBrokerStatus["auth"]> = {},
+): LiveStatus {
+ return makeStatus({
+ brokers: [
+ {
+ auth: {
+ broker: "etoro",
+ oauth_token_present: false,
+ is_live_broker: false,
+ profile_id: "etoro-live-sdk-readonly",
+ transport: "broker_sdk",
+ configured: false,
+ connection_state: "not_configured",
+ error_code: "credentials_missing",
+ ...authOverrides,
+ },
+ runner: {
+ broker: "etoro",
+ alive: false,
+ last_tick: null,
+ last_tick_age_seconds: null,
+ },
+ mandate: null,
+ halted: false,
+ },
+ ],
+ });
+}
+
function deferred<T>() {
let resolve!: (value: T) => void;
let reject!: (reason?: unknown) => void;
@@ -228,6 +258,18 @@ describe("Runtime page", () => {
expect(screen.queryByRole("textbox")).not.toBeInTheDocument();
});
+ it("shows exact missing eToro variable names without rendering secret inputs", async () => {
+ apiMock.getLiveStatus.mockResolvedValue(makeEtoroStatus());
+
+ render(<Runtime />);
+
+ expect(await screen.findByText("Not configured")).toBeInTheDocument();
+ expect(screen.getByText("ETORO_API_KEY")).toBeInTheDocument();
+ expect(screen.getByText("ETORO_USER_KEY")).toBeInTheDocument();
+ expect(screen.queryByText("LONGBRIDGE_APP_KEY")).not.toBeInTheDocument();
+ expect(document.querySelector('input[type="password"]')).not.toBeInTheDocument();
+ });
+
it("renders a verify action when Longbridge is ready", async () => {
apiMock.getLiveStatus.mockResolvedValue(makeLongbridgeStatus({
connection_state: "ready",