sendChatMessage reads NDJSON from /chat/stream and grows the assistant
bubble per real token, falling back to classic POST /chat on failure;
simulated replies get a visible engine label. Adds the Deal Intel
overview tab.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat(ui): committee flow graph — node-edge view driven by real agent events
SVG graph above the status board: dashed amber edge animation while a
specialist audits, solid green with a check when its report lands. No
scripted animation; state mirrors the event bus.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The WS hook handles streamed 'thinking' events (collapsing consecutive
deltas), binder cards render a Live Reasoning panel fed by real model
output, and engine badges label every report honestly.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: POST /chat/stream (NDJSON token frames) + GET /deal-intel endpoints
llm_router gains groq in the fallback chain and a ContextVar sink: when
set, call_llm streams SSE from the provider and forwards each real delta
while still returning the full text, so callers need no changes.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
feat: real Groq reasoning narrator with streamed thinking + honest engine tags
Agents now surface a genuine model's chain-of-thought (ChatGroq,
reasoning_format=parsed) streamed as incremental 'thinking' events, and
every done event carries engine=live|simulated so the UI never presents
scripted output as live. No GROQ_API_KEY -> narrator absent, never faked.
Includes assert-based self-check.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
docs: align all markdown files with FUSION VC Investment Committee context
1. ARR disambiguation: removed "revenue" from the ARR regex so that
"FY2025 revenue $1.4M" no longer shadows the explicit "ARR: $3.7M"
headline. Added an "arr is reported at" pattern as a secondary match.
2. Customer concentration: added pattern for "Top customer contributes X%"
(singular, no count after "top") and "X% of revenue/ARR [top/single]"
— the previous patterns required a digit ("top 3 customers") and missed
single-customer concentration statements.
3. Legal placeholder filter: the StrataIQ appendix had 30 boilerplate
"Due Diligence Section #N ... investigation area" sections whose word
"investigation" triggered the legal parser. Added a skip guard for
lines matching "this section contains additional" or "due diligence
section N".
4. Uploaded-pitch risk signal scan: the market competition scan now
includes raw doc_text so "Microsoft Copilot / OpenAI Enterprise /
Anthropic Team" in the document body triggers the heavy-competition
penalty …
fix: eliminate cross-company contamination in uploaded pitch evaluation
Root cause: three-layer bug caused StrataIQ uploads to be evaluated as NovaPay.
Layer 1 — pitch_loader.py: resolve_uploaded_pitch() searched only the public
MemoryGraph (missing uid-scoped incidents for authenticated users) and returned
a relative filename like pitch_INC-xxx.json that _load_pitch_file() would look
for in data/ — where it doesn't exist — then silently fall back to novapay_pitch.json.
Fix: check uid-scoped graph first, then public; return absolute path so the file
is always found regardless of which memory directory it lives in.
Layer 2 — api/main.py trigger_deal: when resolved_pitch was None (company name
lookup failed), sim_state.active_pitch_file was set to None, causing every
subsequent _load_pitch_file() call during the run to fall through to the NovaPay
default. Fix: only update active_pitch_file when resolved_pitch is not None.
Layer 3 — api/main.py mock-LLM: the /mock-llm endpoint ran in a fresh HTTP
request context where current_pitch_file ContextVar was neve…
fix: apply deep audit — 35+ bug fixes across backend, engine, and frontend
Chat history is persisted server-side keyed by uid + session_id, but the
frontend reset activeSessionId to null on logout/refresh. On re-login it then
fetched the empty default conversation instead of the user's named session —
which still existed in the sidebar — so the chat panel came back blank and
read as "history disappeared."
- Persist activeSessionId per-uid in localStorage (survives refresh)
- Restore it on login
- Fall back to auto-selecting the most recent backend session when none is
active (handles logout->login, where the scoped key is cleared for
shared-browser privacy)
- Clear the scoped session key on sign-out
Verified locally: data was never lost (session fetch returns all turns),
uid isolation holds (other users see nothing), durability OK (Space RTDB probe ok).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix: convert images from Git LFS to normal files for Vercel deployment
The file-download step failed repeatedly (file never landed at the
configured path, on two different locations). Remove the file entirely:
the Windows config now runs
python -c "import urllib.request; exec(urllib.request.urlopen('<raw proxy url>').read().decode())" fus_KEY
so Python fetches the bridge from GitHub raw and runs it at startup, with
the key passed as the trailing argv. No download, no path to misplace, no
npx/Node. Verified end-to-end against live HF (initialize + tools/list).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix: foolproof Windows MCP setup — PowerShell download to fixed path
The most common Windows failure was the proxy file not being where the
config pointed. Eliminate the variable entirely:
- Download command targets C:\Users\Public\mcp_proxy.py (writable by any
user, no admin, username-independent)
- The config's path is hardcoded to the same C:\Users\Public location, so
download path and config path can never mismatch — nothing to edit
- Replace the "download link + save somewhere + update the path" steps
with a single copyable `curl.exe -L ... -o C:\Users\Public\mcp_proxy.py`
PowerShell command (curl.exe ships with Windows 10+)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix: make MCP OAuth discoverable (RFC 9728) + harden Windows proxy
Root-caused the Windows connection failures from the client logs:
1. mcp-remote OAuth 404'd because the 401 from /mcp/ advertised only
`WWW-Authenticate: Bearer realm="FUSION MCP"` with no resource_metadata
pointer. Clients couldn't discover the auth server, so they guessed
wrong registration paths → 404. Now the 401 includes
resource_metadata="<base>/.well-known/oauth-protected-resource"
(derived from x-forwarded-* so it's correct on any deploy).
2. Newer clients try the path-aware well-known URL first
(/.well-known/oauth-protected-resource/mcp) which 404'd. Added that
variant plus /.well-known/oauth-authorization-server/mcp (and trailing
-slash forms) returning the same metadata.
3. mcp_proxy.py was silent on failure. Added stderr diagnostics (startup
banner, explicit 401/429/network messages, missing/malformed key
warning) that surface in Claude Desktop's MCP log — so the next setup
problem is self-explaining instead of a blank disconnect.
The pr…
Settings → Connect via MCP now leads with a developer-first "Fastest"
card: a single `npx add-mcp` command that configures Claude Desktop,
Cursor, VS Code, Windsurf and Zed at once, with the user's personal key
pre-filled. No per-app JSON editing for the common case.
- add-mcp writes config only (never runs a process) so there's no Windows
npx path-space bug and no security prompt — it just edits client configs
- Per-app accordion (Claude.ai, VS Code, Cursor, Claude Code, Claude
Desktop) kept below for targeted/manual setup
- Personal key box relabeled "Your private key — only you can see your
deals" to make the per-user isolation model obvious
test_mcp_isolation.py: standalone self-check (repo convention, no pytest)
proving each fus_<uid> key resolves to exactly one uid and that empty/
malformed keys are rejected — the guarantee the whole MCP data-isolation
model rests on. Verified green.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fix: Claude Desktop Windows — switch to stdio configs, add OS toggle
The native url+headers format in mcpServers is not supported by all
Claude Desktop versions and fails on Windows with "not valid MCP server
configurations". Switch to stdio-based configs that work universally:
- Windows tab: python mcp_proxy.py <key> (bypasses npx path-space bug)
- Mac/Linux tab: npx -y mcp-remote <url> --header ... (works cleanly)
Claude Desktop card now shows a Mac/Linux | Windows toggle when expanded.
Windows steps include a direct download link for mcp_proxy.py.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
redesign: MCP integration section — accordion cards with brand logos
Replace tab navigation with a clean accordion list. Each integration
(Claude.ai, VS Code, Cursor, Claude Code, Claude Desktop) is a card with:
- Real brand SVG logo in a rounded box
- App name + subtitle in the background
- "Setup" button (expands numbered steps inline)
- "Copy" button (per-card, independent copied state)
When expanded, shows numbered step-by-step instructions with inline CTA
buttons (Copy / Open), a syntax-highlighted code block with its own copy
button, and file path hints where relevant.
Removes: MCP_TABS, mcpTab state, all {mcpTab === '...'} branches.
Adds: expandedClient, copiedId (per-card), copiedKey states.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
feat: OAuth 2.0 MCP auth + one-click connect for all devices
Backend (api/oauth.py):
- /.well-known/oauth-authorization-server — MCP discovery endpoint
- /.well-known/oauth-protected-resource — resource metadata
- POST /oauth/register — dynamic client registration (PKCE S256)
- GET /oauth/authorize — redirects to frontend consent page
- POST /oauth/callback — verifies Firebase token, issues one-time code
- POST /oauth/token — exchanges code for fus_<uid> access token
The issued token is identical to the personal MCP key, so no changes to
the existing auth middleware or memory graph isolation are needed.
Frontend (pages/oauth.tsx):
- Clean consent page: Firebase Google sign-in → OAuth code → redirect
- Auto-completes if already signed in, works on all browsers/OS
Settings (SettingsView.tsx):
- New "Claude.ai ★ Best" tab: 3-step connect flow, copy URL + open claude.ai
One connection syncs to Claude Desktop, web, and mobile automatically
- Claude Desktop tab: switched to native url+headers format — works on
Windows/Mac/Linux identically, no…
fix: replace mcp-remote Windows workaround with Python stdio proxy
mcp-remote has two unfixable issues on Windows: (1) path-with-spaces breaks
npx.cmd resolution through cmd.exe, (2) the --header quoting is garbled so
auth is ignored and mcp-remote falls through to OAuth discovery which 404s.
Replace with a 40-line Python stdlib proxy (scripts/mcp_proxy.py) that POSTs
JSON-RPC directly to /mcp/ with Bearer token — no OAuth, no path issues,
works on any OS with Python installed. Settings Windows tab now shows a
download link + step-by-step config.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: Windows Claude Desktop MCP config — cmd /c workaround for path-with-spaces
npx resolves to C:\Program Files\nodejs\npx.cmd on Windows; when passed as an
arg to cmd.exe it breaks at the space. Using cmd as the command with the full
npx invocation as a single /c string bypasses the issue. Settings now shows
separate Mac/Linux and Windows snippets under Claude Desktop tab.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Four bugs fixed:
1. _resolved_uid property replaces duplicated uid-lookup logic across
MemoryGraph. The global singleton (explicit_uid=None) was sending
authenticated users' deal data to the __public__ Firestore namespace,
so Firestore recovery never found their history. All Firestore calls
now use _resolved_uid (falls through to sim_state.active_uid).
2. create_incident seeds local cache from Firestore first when local is
empty. Previously, triggering a new deal after a restart wrote only
that deal to local, causing list_incidents to ignore all prior
Firestore history on every subsequent read.
3. list_incidents writes Firestore data back to the local file when
recovering, so subsequent reads don't hit Firestore on every call.
4. Chat history (append_chat/get_chat_history) now mirrors to and
recovers from a new Firestore collection (fusion_chats/{uid}/
sessions/{id}/turns). /chat/sessions falls back to Firestore when
no local chat_history_*.json fil…
feat: restructure PDF report with dedicated per-partner pages
Each partner agent now gets its own full page with a color-coded role
banner (financial=blue, legal=violet, technical=cyan, market=green,
managing=slate). Scorecard redesigned as a 2×2 domain card grid with
a dark weighted-total banner. Cover → Exec Summary → Scorecard →
partner pages in canonical order, precisely aligned margins throughout.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Replace unescaped ' and " in JSX text with ' / " across all components
- Wrap // comment strings inside JSX spans in {'...'} to satisfy jsx-no-comment-textnodes
- Remove dead @ts-expect-error directive (import had no actual TS error)
- Lazy-initialize lastActivityTime with useState(() => Date.now()) for purity rule
- Fix activeNode cast to explicit union type instead of as any
- Remaining 57 errors are pre-existing structural patterns (react-hooks/set-state-in-effect,
react-hooks/refs, no-explicit-any with downstream .property access) that require
broader refactoring and don't affect runtime behavior or the build
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: replace /.info/connected probe with real write — Admin SDK doesn't support .info namespace
Writes a timestamped record to /diagnostics/probe_tests so RTDB
connectivity can be verified end-to-end without triggering a full deal.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: surface RTDB failures in logs instead of silently swallowing them
- Add probe() to core/rtdb.py that makes a real network call at startup
- Wire probe() into lifespan so misconfig shows immediately in HF Space logs
- Replace bare `except Exception: pass` at all rtdb call sites with warning logs
- Fix misleading comment on _fdb.reference("/") — it does not validate the URL
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
fix: harden multi-user isolation, auth persistence, and data safety
resetAll was a plain function declaration (new reference every render),
causing restoreDealState (which depends on it) to be recreated each render,
which caused its useEffect to fire on every render, calling /api/v1/deal-state
in a tight loop and immediately resetting all agent states to idle — making
every triggered deal appear broken and exhausting browser connections.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>