Skip to content

Feature: Bidirectional Agent Chat — Live Interactive Sessions #500

@frankbria

Description

@frankbria

Overview

CodeFRAME currently supports one-way execution monitoring via SSE: the user watches the agent run, but cannot steer it mid-flight except through the blocker Q&A (which pauses the whole run). This issue tracks the full work needed to close the bidirectional agent chat gap — persistent, interactive sessions where users can send messages to a running agent and receive streaming token-by-token responses.

Problem

  • The existing POST /api/projects/{id}/chat endpoint returns complete responses and is wired to the Lead Agent only, not to a running coding agent
  • The existing /ws WebSocket handles project status updates (subscribe/broadcast), not interactive message exchange
  • The web-ui has no sessions page, no chat panel component, no XTerm terminal, and no split-pane layout
  • There is no concept of a persistent interactive session that can be paused and resumed

What "Done" Looks Like

  • User can open a /sessions page and start a new interactive agent session against any workspace
  • Session opens a split-pane layout: agent chat on the left, terminal on the right
  • Agent chat streams tokens in real-time (not wait-for-complete-response)
  • Tool calls are displayed inline with collapsible input/output JSON
  • Thinking blocks are rendered with distinct styling
  • User can type a follow-up message and send it while the agent is idle
  • User can interrupt the agent mid-thinking
  • Sessions are persisted in the DB and listed on /sessions; past sessions can be resumed
  • Cost and token counts update in real-time

Sub-issues (Atomic, Single-session Work)

Backend

Frontend

Dependency Graph

#501 (DB/API)
  └─→ #502 (WS endpoint)
        └─→ #503 (streaming adapter)   ← backend complete

#504 (hook) ← requires #502 running
  └─→ #505 (chat panel)
#506 (terminal)
#507 (split pane)
#508 (list page) ← requires #501 running
  └─→ #509 (detail page) ← requires #504, #505, #506, #507

Existing Infrastructure

  • WebSocket auth pattern: codeframe/ui/routers/websocket.py
  • Lead Agent chat (non-streaming): codeframe/ui/routers/chat.py
  • Session state endpoint: codeframe/ui/routers/session.py
  • SSE streaming pattern: codeframe/core/streaming.py + useEventSource.ts
  • DiscoveryPanel (closest existing chat UI): web-ui/src/components/prd/DiscoveryPanel.tsx

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions