Skip to content

"Vibe-Trading: Your Personal Trading Agent"

feat(ux): surface shadow account + trade journal in CLI, web, README

warren61825380bac96b8
diff --git a/.gitignore b/.gitignore
index 65a0df2f0..1b76f7b70 100644
--- a/.gitignore
+++ b/.gitignore
@@ -41,3 +41,12 @@ agent/vibe_trading_ai.egg-info/
agent/tests/e2e_backtest/
dist/
build/
+
+# Local demo videos (too large for git; link to external host instead)
+assets/*.mp4
+
+# Manual E2E smoke tests — require live API keys (OpenRouter / yfinance),
+# would break CI if committed. Kept local; run explicitly when validating
+# a release.
+agent/tests/e2e_*.py
+agent/tests/test_e2e_*.py
diff --git a/README.md b/README.md
index 0f177c3fe..31fbbd35a 100644
--- a/README.md
+++ b/README.md
@@ -51,13 +51,14 @@
## 📰 News
+- **2026-04-18** 👥 **Shadow Account**: Extract your strategy rules from a broker journal → backtest the shadow across markets → 8-section HTML/PDF report showing exactly how much you leave on the table (rule violations, early exits, missed signals, counterfactual trades). 4 new tools, 1 skill, 32 tools total. Trade Journal + Shadow Account samples now live in the web UI welcome screen.
- **2026-04-17** 📊 **Trade Journal Analyzer + Universal File Reader**: Upload broker exports (同花顺/东财/富途/generic CSV) → auto trading profile (holding days, win rate, PnL ratio, drawdown) + 4 bias diagnostics (disposition effect, overtrading, chasing momentum, anchoring). `read_document` now dispatches PDF, Word, Excel, PowerPoint, images (OCR), and 40+ text formats behind one unified call.
- **2026-04-16** 🧠 **Agent Harness**: Persistent cross-session memory, FTS5 session search, self-evolving skills (full CRUD), 5-layer context compression, read/write tool batching. 27 tools, 107 new tests.
-- **2026-04-15** 🤖 **Z.ai + MiniMax**: Z.ai provider ([#35](https://github.com/HKUDS/Vibe-Trading/pull/35)), MiniMax temperature fix + model update ([#33](https://github.com/HKUDS/Vibe-Trading/pull/33)). 13 providers.
<details>
<summary>Earlier news</summary>
+- **2026-04-15** 🤖 **Z.ai + MiniMax**: Z.ai provider ([#35](https://github.com/HKUDS/Vibe-Trading/pull/35)), MiniMax temperature fix + model update ([#33](https://github.com/HKUDS/Vibe-Trading/pull/33)). 13 providers.
- **2026-04-14** 🔧 **MCP Stability**: Fixed backtest tool `Connection closed` error on stdio transport ([#32](https://github.com/HKUDS/Vibe-Trading/pull/32)).
- **2026-04-13** 🌐 **Cross-Market Composite Backtest**: New `CompositeEngine` backtests mixed-market portfolios (e.g. A-shares + crypto) with shared capital pool and per-market rules. Also fixed swarm template variable fallback and frontend timeout.
- **2026-04-12** 🌍 **Multi-Platform Export**: `/pine` exports strategies to TradingView (Pine Script v6), TDX (通达信/同花顺/东方财富), and MetaTrader 5 (MQL5) in one command.
diff --git a/README_ar.md b/README_ar.md
index 6fcb86fb3..b4d16c496 100644
--- a/README_ar.md
+++ b/README_ar.md
@@ -51,13 +51,14 @@
## 📰 أحدث الأخبار
+- **2026-04-18** 👥 **حساب الظل Shadow Account**: استخرج قواعد إستراتيجيتك من سجل التداول الخاص بك → اختبر الظل عبر الأسواق → تقرير HTML/PDF من 8 أقسام يوضح بدقة أين فقدت المال (خرق القواعد، الخروج المبكر، الإشارات المفقودة، الصفقات العكسية). 4 أدوات جديدة، مهارة واحدة جديدة، إجمالي 32 أداة. أمثلة Trade Journal / Shadow Account متاحة الآن في شاشة الترحيب على واجهة الويب.
- **2026-04-17** 📊 **محلل سجل التداول + قارئ ملفات عالمي**: حمّل سجلات التداول من الوسطاء (同花顺/东财/富途/CSV عام) → ملف تعريف تداول تلقائي (أيام الاحتفاظ، معدل الفوز، نسبة الربح/الخسارة، أقصى تراجع) + تشخيص 4 تحيزات سلوكية (تأثير التصرف، الإفراط في التداول، مطاردة الزخم، التثبيت السعري). `read_document` يوزّع الآن PDF وWord وExcel وPowerPoint والصور (OCR) و40+ صيغة نصية خلف استدعاء موحد.
- **2026-04-16** 🧠 **هيكل الوكيل**: ذاكرة دائمة عبر الجلسات، بحث جلسات FTS5، مهارات ذاتية التطور (CRUD كامل)، ضغط سياق 5 طبقات، معالجة أدوات القراءة/الكتابة دفعة واحدة. 27 أداة، 107 اختبار جديد.
-- **2026-04-15** 🤖 **Z.ai + MiniMax**: إضافة مزود Z.ai ([#35](https://github.com/HKUDS/Vibe-Trading/pull/35))، إصلاح temperature وتحديث نموذج MiniMax ([#33](https://github.com/HKUDS/Vibe-Trading/pull/33)). 13 مزوداً.
<details>
<summary>أخبار سابقة</summary>
+- **2026-04-15** 🤖 **Z.ai + MiniMax**: إضافة مزود Z.ai ([#35](https://github.com/HKUDS/Vibe-Trading/pull/35))، إصلاح temperature وتحديث نموذج MiniMax ([#33](https://github.com/HKUDS/Vibe-Trading/pull/33)). 13 مزوداً.
- **2026-04-14** 🔧 **استقرار MCP**: إصلاح خطأ `Connection closed` في أداة الاختبار الرجعي عبر نقل stdio ([#32](https://github.com/HKUDS/Vibe-Trading/pull/32)).
- **2026-04-13** 🌐 **الاختبار الرجعي المركب عبر الأسواق**: محرك `CompositeEngine` الجديد لاختبار محافظ متعددة الأسواق (مثل أسهم A + العملات المشفرة) بمجمع رأسمال مشترك. إصلاح متغيرات قوالب Swarm ومهلة الواجهة الأمامية.
- **2026-04-12** 🌍 **تصدير متعدد المنصات**: أمر `/pine` يصدّر إلى TradingView (Pine Script v6) وTDX (通达信/同花顺/东方财富) وMetaTrader 5 (MQL5) دفعة واحدة.
diff --git a/README_ja.md b/README_ja.md
index 3544d10a3..1b3dcd986 100644
--- a/README_ja.md
+++ b/README_ja.md
@@ -51,13 +51,14 @@
## 📰 ニュース
+- **2026-04-18** 👥 **シャドウアカウント Shadow Account**: ブローカーの取引明細から自分の戦略ルールを抽出 → マーケット横断でシャドウをバックテスト → 8セクションのHTML/PDFレポートが、どこでいくら取りこぼしたか(ルール違反・早すぎる利確・見逃したシグナル・逆張り)を正確に可視化。新規ツール4つ、新スキル1つ、合計32ツール。Trade Journal / Shadow Accountのサンプル例文がWeb UIウェルカム画面に追加。
- **2026-04-17** 📊 **取引明細アナライザー + ユニバーサルファイルリーダー**: ブローカーの取引明細(同花順/東方財富/富途/汎用CSV)をアップロード → 取引プロフィール(保有日数、勝率、損益比、最大ドローダウン)+ 4つの行動バイアス診断(処分効果、過剰取引、追随買い、アンカリング)を自動生成。`read_document`はPDF、Word、Excel、PowerPoint、画像(OCR)、40+テキスト形式を1回の呼び出しで統一処理。
- **2026-04-16** 🧠 **エージェントハーネス**: クロスセッション永続メモリ、FTS5セッション検索、自己進化スキル(完全CRUD)、5層コンテキスト圧縮、読み書きツールバッチ処理。27ツール、107新テスト。
-- **2026-04-15** 🤖 **Z.ai + MiniMax**: Z.aiプロバイダー追加([#35](https://github.com/HKUDS/Vibe-Trading/pull/35))、MiniMax temperature修正+モデル更新([#33](https://github.com/HKUDS/Vibe-Trading/pull/33))。13プロバイダー対応。
<details>
<summary>過去のニュース</summary>
+- **2026-04-15** 🤖 **Z.ai + MiniMax**: Z.aiプロバイダー追加([#35](https://github.com/HKUDS/Vibe-Trading/pull/35))、MiniMax temperature修正+モデル更新([#33](https://github.com/HKUDS/Vibe-Trading/pull/33))。13プロバイダー対応。
- **2026-04-14** 🔧 **MCP安定性**: バックテストツールのstdioトランスポートにおける`Connection closed`エラーを修正([#32](https://github.com/HKUDS/Vibe-Trading/pull/32))。
- **2026-04-13** 🌐 **クロスマーケット複合バックテスト**: 新`CompositeEngine`で異なる市場の銘柄(例:A株+暗号資産)を共有資金プールで同時バックテスト、市場ルールは銘柄ごとに適用。Swarmテンプレート変数フォールバックとフロントエンドタイムアウトも修正。
- **2026-04-12** 🌍 **マルチプラットフォーム出力**: `/pine`でTradingView (Pine Script v6)、TDX(通達信/同花順/東方財富)、MetaTrader 5 (MQL5) に一括エクスポート。
diff --git a/README_ko.md b/README_ko.md
index 8b8e5d3d4..e81e41ec3 100644
--- a/README_ko.md
+++ b/README_ko.md
@@ -51,13 +51,14 @@
## 📰 뉴스
+- **2026-04-18** 👥 **섀도우 계정 Shadow Account**: 증권사 거래 명세서에서 자신의 전략 규칙을 추출 → 여러 시장에서 섀도우 백테스트 실행 → 8개 섹션 HTML/PDF 리포트가 어디에서 얼마를 놓쳤는지(규칙 위반, 조기 익절, 놓친 시그널, 역방향 거래) 정확히 보여줌. 신규 도구 4개, 신규 스킬 1개, 총 32개 도구. Trade Journal / Shadow Account 샘플 프롬프트가 Web UI 웰컴 화면에 추가.
- **2026-04-17** 📊 **거래 명세서 분석기 + 유니버설 파일 리더**: 증권사 거래 명세서(同花顺/东财/富途/일반 CSV) 업로드 → 거래 프로필(보유 일수, 승률, 손익비, 최대 드로다운) + 4가지 행동 편향 진단(처분 효과, 과잉 거래, 추격 매수, 앵커링) 자동 생성. `read_document`는 이제 PDF, Word, Excel, PowerPoint, 이미지(OCR), 40+ 텍스트 형식을 하나의 호출로 통합 처리.
- **2026-04-16** 🧠 **에이전트 하네스**: 크로스세션 영구 메모리, FTS5 세션 검색, 자가 진화 스킬(전체 CRUD), 5계층 컨텍스트 압축, 읽기/쓰기 도구 배치 처리. 27개 도구, 107개 신규 테스트.
-- **2026-04-15** 🤖 **Z.ai + MiniMax**: Z.ai 제공자 추가([#35](https://github.com/HKUDS/Vibe-Trading/pull/35)), MiniMax temperature 수정 + 모델 업데이트([#33](https://github.com/HKUDS/Vibe-Trading/pull/33)). 13개 제공자.
<details>
<summary>이전 뉴스</summary>
+- **2026-04-15** 🤖 **Z.ai + MiniMax**: Z.ai 제공자 추가([#35](https://github.com/HKUDS/Vibe-Trading/pull/35)), MiniMax temperature 수정 + 모델 업데이트([#33](https://github.com/HKUDS/Vibe-Trading/pull/33)). 13개 제공자.
- **2026-04-14** 🔧 **MCP 안정성**: 백테스트 도구의 stdio 전송에서 `Connection closed` 오류 수정([#32](https://github.com/HKUDS/Vibe-Trading/pull/32)).
- **2026-04-13** 🌐 **크로스마켓 복합 백테스트**: 새 `CompositeEngine`으로 서로 다른 시장 종목(예: A주 + 암호화폐)을 공유 자금 풀로 동시 백테스트, 시장 규칙은 종목별 적용. Swarm 템플릿 변수 폴백 및 프론트엔드 타임아웃도 수정.
- **2026-04-12** 🌍 **멀티 플랫폼 내보내기**: `/pine`으로 TradingView (Pine Script v6), TDX (통달신/동화순/동방재부), MetaTrader 5 (MQL5) 한 번에 내보내기.
diff --git a/README_zh.md b/README_zh.md
index 3c844e830..df44e13b7 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -51,13 +51,14 @@
## 📰 新闻
+- **2026-04-18** 👥 **影子账户 Shadow Account**:从券商交割单提取你自己的策略规则 → 跨市场回测这个"影子" → 8 节 HTML/PDF 报告精确告诉你每一块钱是怎么错过的(规则违反、过早止盈、漏掉信号、反向操作)。4 个新工具、1 个新技能、共 32 工具。Trade Journal / Shadow Account 例句已进 Web UI 欢迎屏。
- **2026-04-17** 📊 **交割单分析器 + 通用文件阅读器**:上传券商交割单(同花顺/东财/富途/通用 CSV)→ 自动生成交易画像(持仓天数、胜率、盈亏比、最大回撤)+ 4 项行为偏差诊断(处置效应、过度交易、追涨杀跌、锚定效应)。`read_document` 现统一分发 PDF、Word、Excel、PowerPoint、图片(OCR)及 40+ 文本格式,一个调用走全部类型。
- **2026-04-16** 🧠 **Agent Harness**:跨会话持久记忆、FTS5 会话搜索、自进化技能(完整 CRUD)、5 层上下文压缩、读写工具批处理。27 工具,107 新测试。
-- **2026-04-15** 🤖 **Z.ai + MiniMax**:新增 Z.ai 提供商([#35](https://github.com/HKUDS/Vibe-Trading/pull/35)),修复 MiniMax temperature 及模型更新([#33](https://github.com/HKUDS/Vibe-Trading/pull/33))。共 13 家提供商。
<details>
<summary>更早的新闻</summary>
+- **2026-04-15** 🤖 **Z.ai + MiniMax**:新增 Z.ai 提供商([#35](https://github.com/HKUDS/Vibe-Trading/pull/35)),修复 MiniMax temperature 及模型更新([#33](https://github.com/HKUDS/Vibe-Trading/pull/33))。共 13 家提供商。
- **2026-04-14** 🔧 **MCP 稳定性**:修复回测工具在 stdio 传输中的 `Connection closed` 错误([#32](https://github.com/HKUDS/Vibe-Trading/pull/32))。
- **2026-04-13** 🌐 **跨市场复合回测**:新增 `CompositeEngine`,混合不同市场标的(如 A 股 + 加密货币)共享资金池回测,各市场规则按标的独立执行。同时修复 swarm 模板变量回退和前端超时问题。
- **2026-04-12** 🌍 **多平台指标导出**:`/pine` 一次性导出 TradingView (Pine Script v6)、通达信/同花顺/东方财富 (TDX)、MetaTrader 5 (MQL5) 三大平台。
diff --git a/agent/cli.py b/agent/cli.py
index eff5556ce..d585dfed6 100644
--- a/agent/cli.py
+++ b/agent/cli.py
@@ -196,6 +196,14 @@ def _format_tool_result_preview(tool: str, status: str, preview: str) -> str:
if ret:
parts.append(f"return={float(ret.group(1))*100:.1f}%")
return ", ".join(parts) if parts else ""
+ if tool == "render_shadow_report":
+ url = re.search(r'"report_url":\s*"([^"]+)"', preview)
+ if url:
+ return f"[bold cyan]report:[/bold cyan] [link]{url.group(1)}[/link]"
+ return ""
+ if tool in ("extract_shadow_strategy", "run_shadow_backtest"):
+ sid = re.search(r'"shadow_id":\s*"([^"]+)"', preview)
+ return f"shadow_id={sid.group(1)}" if sid else ""
if tool in ("bash", "background_run"):
if "OK" in preview[:50]:
return "OK"
@@ -447,7 +455,9 @@ def _print_welcome() -> None:
"\n"
" [cyan]/skills[/cyan] List available skills [cyan]/swarm[/cyan] Agent team presets\n"
" [cyan]/list[/cyan] Recent runs [cyan]/settings[/cyan] Runtime config\n"
- " [cyan]/help[/cyan] All commands [cyan]/quit[/cyan] Exit"
+ " [cyan]/help[/cyan] All commands [cyan]/quit[/cyan] Exit\n"
+ "\n"
+ "[dim]Try: \"analyze my trade journal\" or \"train my shadow account\"[/dim]"
)
console.print(Panel(welcome, border_style="cyan", padding=(1, 2)))
@@ -476,6 +486,10 @@ def _print_help() -> None:
("/settings", "Show runtime settings"),
("/clear", "Clear screen"),
("/quit", "Exit"),
+ ("", ""),
+ ("[dim]--- Natural language ---[/dim]", ""),
+ ('"analyze journal.csv"', "Parse broker export → profile + 4 behavior diagnostics"),
+ ('"train my shadow"', "Extract strategy → backtest → HTML/PDF report"),
]
for cmd, desc in cmds:
table.add_row(cmd, desc)
diff --git a/frontend/src/components/chat/RunCompleteCard.tsx b/frontend/src/components/chat/RunCompleteCard.tsx
index 22a0f67a3..550039bf8 100644
--- a/frontend/src/components/chat/RunCompleteCard.tsx
+++ b/frontend/src/components/chat/RunCompleteCard.tsx
@@ -1,6 +1,6 @@
import { memo, useEffect, useState, useCallback } from "react";
import { Link } from "react-router-dom";
-import { BarChart3, Code2, Loader2 } from "lucide-react";
+import { BarChart3, Code2, FileText, Loader2 } from "lucide-react";
import { useI18n } from "@/lib/i18n";
import { api } from "@/lib/api";
import { AgentAvatar } from "./AgentAvatar";
@@ -30,9 +30,13 @@ export const RunCompleteCard = memo(function RunCompleteCard({ msg }: Props) {
}
}, [msg.runId, curve]);
- // Check if Pine Script exists for this run
+ // Check if Pine Script exists for this run (skip for shadow-only cards with no runId)
useEffect(() => {
- if (msg.runId && !pineChecked) {
+ if (!msg.runId) {
+ setPineChecked(true);
+ return;
+ }
+ if (!pineChecked) {
api.getRunPine(msg.runId).then(r => {
setPineChecked(true);
if (r.exists && r.content) {
@@ -72,13 +76,15 @@ export const RunCompleteCard = memo(function RunCompleteCard({ msg }: Props) {
<MiniEquityChart data={curve} height={80} />
)}
<div className="flex items-center gap-3 flex-wrap">
- <Link
- to={`/runs/${msg.runId}`}
- className="text-sm text-primary hover:underline inline-flex items-center gap-1.5 font-medium"
- >
- <BarChart3 className="h-3.5 w-3.5" />
- {t.fullReport}
- </Link>
+ {msg.runId && (
+ <Link
+ to={`/runs/${msg.runId}`}
+ className="text-sm text-primary hover:underline inline-flex items-center gap-1.5 font-medium"
+ >
+ <BarChart3 className="h-3.5 w-3.5" />
+ {t.fullReport}
+ </Link>
+ )}
{pineExists && (
<button
onClick={handlePineClick}
@@ -89,6 +95,17 @@ export const RunCompleteCard = memo(function RunCompleteCard({ msg }: Props) {
Pine Script
</button>
)}
+ {msg.shadowId && (
+ <a
+ href={`/shadow-reports/${encodeURIComponent(msg.shadowId)}?format=html`}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="text-sm text-teal-600 dark:text-teal-400 hover:underline inline-flex items-center gap-1.5 font-medium"
+ >
+ <FileText className="h-3.5 w-3.5" />
+ Shadow Report
+ </a>
+ )}
</div>
{showPine && pineCode && (
<PineScriptViewer code={pineCode} onClose={() => setShowPine(false)} />
diff --git a/frontend/src/components/chat/WelcomeScreen.tsx b/frontend/src/components/chat/WelcomeScreen.tsx
index fce5911f1..b3868d31b 100644
--- a/frontend/src/components/chat/WelcomeScreen.tsx
+++ b/frontend/src/components/chat/WelcomeScreen.tsx
@@ -1,4 +1,4 @@
-import { Bot, TrendingUp, Bitcoin, Globe, Sparkles, Users } from "lucide-react";
+import { Bot, TrendingUp, Bitcoin, Globe, Sparkles, Users, UserCircle2, NotebookPen } from "lucide-react";
import { useI18n } from "@/lib/i18n";
interface Example {
@@ -88,12 +88,51 @@ const CATEGORIES: Category[] = [
},
],
},
+ {
+ label: "Trade Journal",
+ icon: <NotebookPen className="h-4 w-4" />,
+ color: "text-orange-400 border-orange-500/30 hover:border-orange-500/60 hover:bg-orange-500/5",
+ examples: [
+ {
+ title: "Analyze My Broker Export",
+ desc: "Parse 同花顺/东财/富途/generic CSV — holding days, win rate, PnL ratio, hourly distribution",
+ prompt: "Analyze the trade journal I just uploaded — full profile with holding stats, win rate, top symbols, and hourly distribution",
+ },
+ {
+ title: "Diagnose My Behavior Biases",
+ desc: "Disposition effect, overtrading, chasing momentum, anchoring — severity + numeric evidence",
+ prompt: "Run the 4 behavior diagnostics on my trade journal (disposition, overtrading, chasing, anchoring) and tell me which bias hurts my PnL most",
+ },
+ ],
+ },
+ {
+ label: "Shadow Account",
+ icon: <UserCircle2 className="h-4 w-4" />,
+ color: "text-emerald-400 border-emerald-500/30 hover:border-emerald-500/60 hover:bg-emerald-500/5",
+ examples: [
+ {
+ title: "Train My Shadow from Journal",
+ desc: "Extract your strategy rules from a broker CSV and persist a Shadow profile",
+ prompt: "Train my shadow account from the trading journal I just uploaded — show the extracted rules and confirm they look like my behavior",
+ },
+ {
+ title: "How Much Am I Leaving on the Table?",
+ desc: "Backtest your shadow strategy and attribute delta vs. your actual PnL",
+ prompt: "Run a shadow backtest for the last 90 days on the US market and break down where my PnL diverged from the shadow (rule violations, early exits, missed signals)",
+ },
+ {
+ title: "Generate Shadow Report",
+ desc: "8-section HTML/PDF — equity curve, per-market Sharpe, attribution waterfall",
+ prompt: "Render the shadow report and give me the URL — lead with the you-vs-shadow delta",
+ },
+ ],
+ },
];
const CAPABILITY_CHIPS = [
- "56 Finance Skills",
- "25 Swarm Presets",
- "19 Agent Tools",
+ "70 Finance Skills",
+ "29 Swarm Presets",
+ "32 Agent Tools",
"3 Markets: A-Share · Crypto · HK/US",
"Minute to Daily Timeframes",
"4 Portfolio Optimizers",
@@ -101,6 +140,10 @@ const CAPABILITY_CHIPS = [
"Options & Derivatives",
"PDF & Web Research",
"Factor Analysis & ML",
+ "Trade Journal Analyzer",
+ "Shadow Account Backtest",
+ "Persistent Memory",
+ "Session Search",
];
interface Props {
diff --git a/frontend/src/lib/i18n.tsx b/frontend/src/lib/i18n.tsx
index af29c0818..e944be018 100644
--- a/frontend/src/lib/i18n.tsx
+++ b/frontend/src/lib/i18n.tsx
@@ -15,6 +15,7 @@ const messages = {
feat1: "AI Agent", feat1d: "Natural language strategy generation with ReAct reasoning",
feat2: "Built-in Backtest", feat2d: "3 data sources: A-shares, US/HK, Crypto",
feat3: "Real-time Streaming", feat3d: "Watch the agent think, call tools, and iterate",
+ feat4: "Strategy Replay", feat4d: "Trade journal analyzer + Shadow Account — extract your rules, backtest them, attribute PnL delta",
score: "Score", passed: "Passed", failed: "Failed", findings: "Findings", recommendations: "Recommendations",
darkMode: "Dark", lightMode: "Light", language: "Language",
sessions: "Sessions", newChat: "New Chat", deleteConfirm: "Delete?",
diff --git a/frontend/src/pages/Agent.tsx b/frontend/src/pages/Agent.tsx
index deb8ef338..1737b8dec 100644
--- a/frontend/src/pages/Agent.tsx
+++ b/frontend/src/pages/Agent.tsx
@@ -213,20 +213,30 @@ export function Agent() {
const summary = String(d.summary || "");
if (summary) s.addMessage({ id: "", type: "answer", content: summary, timestamp: Date.now() });
- // Only show RunCompleteCard if backtest produced metrics
+ // Detect Shadow Account id if render_shadow_report fired successfully this turn
+ const shadowCall = completedTools.find(
+ (tc) => tc.tool === "render_shadow_report" && (tc.status || "ok") === "ok",
+ );
+ const shadowMatch = shadowCall?.preview?.match(/"shadow_id"\s*:\s*"(shadow_[A-Za-z0-9_]+)"/);
+ const shadowId = shadowMatch?.[1];
+
+ // Show RunCompleteCard when the turn produced backtest metrics or a shadow report
if (runId) {
try {
const runData = await api.getRun(runId);
const hasMetrics = runData.metrics && Object.keys(runData.metrics).length > 0;
- if (hasMetrics) {
+ if (hasMetrics || shadowId) {
s.addMessage({
id: "", type: "run_complete", content: "", runId,
- metrics: runData.metrics,
+ metrics: hasMetrics ? runData.metrics : undefined,
equityCurve: runData.equity_curve?.map(e => ({ time: e.time, equity: e.equity })),
+ shadowId,
timestamp: Date.now(),
});
}
} catch { /* ignore */ }
+ } else if (shadowId) {
+ s.addMessage({ id: "", type: "run_complete", content: "", shadowId, timestamp: Date.now() });
}
// Reset
diff --git a/frontend/src/pages/Home.tsx b/frontend/src/pages/Home.tsx
index b40cdcd3f..70c640147 100644
--- a/frontend/src/pages/Home.tsx
+++ b/frontend/src/pages/Home.tsx
@@ -1,5 +1,5 @@
import { Link } from "react-router-dom";
-import { ArrowRight, Bot, BarChart3, Zap } from "lucide-react";
+import { ArrowRight, Bot, BarChart3, Zap, UserCircle2 } from "lucide-react";
import { useI18n } from "@/lib/i18n";
export function Home() {
@@ -9,6 +9,7 @@ export function Home() {
{ icon: Bot, title: t.feat1, desc: t.feat1d },
{ icon: BarChart3, title: t.feat2, desc: t.feat2d },
{ icon: Zap, title: t.feat3, desc: t.feat3d },
+ { icon: UserCircle2, title: t.feat4, desc: t.feat4d },
];
return (
@@ -24,7 +25,7 @@ export function Home() {
</Link>
</div>
- <div className="grid grid-cols-1 md:grid-cols-3 gap-6 mt-16 max-w-4xl w-full">
+ <div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mt-16 max-w-5xl w-full">
{FEATURES.map(({ icon: Icon, title, desc }) => (
<div key={title} className="border rounded-lg p-6 space-y-3">
<Icon className="h-8 w-8 text-primary" />
diff --git a/frontend/src/types/agent.ts b/frontend/src/types/agent.ts
index 465180f95..111a17b87 100644
--- a/frontend/src/types/agent.ts
+++ b/frontend/src/types/agent.ts
@@ -17,6 +17,8 @@ export interface AgentMessage {
equityCurve?: Array<{ time: string; equity: number | string }>;
/** Phase label for thinking entries */
stage?: string;
+ /** Shadow Account id if render_shadow_report fired in this turn (RunCompleteCard renders a "View Shadow Report" button). */
+ shadowId?: string;
}
/** Tool call tracking entry */
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 1a19726b4..6f4c290e1 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -20,6 +20,7 @@ export default defineConfig({
"/upload": { target: "http://localhost:8899", changeOrigin: true },
"/api": { target: "http://localhost:8899", changeOrigin: true },
"/system": { target: "http://localhost:8899", changeOrigin: true },
+ "/shadow-reports": { target: "http://localhost:8899", changeOrigin: true },
},
},
build: {