Skip to main content
The Chat Console is the primary operator interface within the Palyra Web Console. It provides a high-fidelity environment for interacting with agents, managing session lineage, inspecting tool execution, and maintaining context budgets. Unlike standard chat interfaces, the Chat Console is designed for “Human-in-the-Loop” (HITL) workflows, allowing operators to approve tool calls, branch conversations, and restore state via checkpoints.

Component Architecture

The chat interface is composed of several specialized React components that separate the conversation transcript from debugging data and session management.

Key Components

ComponentResponsibility
ChatConsolePanelThe top-level orchestrator that manages state for the entire chat view, including session switching and run streaming apps/web/src/chat/ChatConsolePanel.tsx#81-88.
ChatConsoleWorkspaceViewDefines the three-column layout: Sessions Sidebar, Main Conversation, and Inspector Column apps/web/src/chat/ChatConsoleWorkspaceView.tsx#50-75.
ChatComposerThe input area supporting multi-line text, slash commands, file attachments, and context budget visualization apps/web/src/chat/ChatComposer.tsx#66-102.
ChatTranscriptRenders the message history, including specialized blocks for tool calls, A2UI surfaces, and approval requests apps/web/src/chat/ChatTranscript.tsx.
ChatInspectorColumnA dedicated sidebar for technical metadata: A2UI surfaces, background tasks, session lineage, and JSON payload inspection apps/web/src/chat/ChatInspectorColumn.tsx#109-155.

Workspace Data Flow

The following diagram illustrates how user input in the ChatComposer triggers a stream that updates the ChatTranscript and ChatInspectorColumn. Title: Chat Console Data Flow Sources: apps/web/src/chat/ChatConsolePanel.tsx#132-168, apps/web/src/chat/ChatComposer.tsx#145-151, apps/web/src/chat/useChatRunStream.ts

Streaming Lifecycle (NDJSON)

Palyra uses a streaming protocol based on NDJSON (Newline Delimited JSON) to provide real-time feedback during agent execution. The useChatRunStream hook manages the connection to the daemon’s gateway apps/web/src/chat/ChatConsolePanel.tsx#162-168.
  1. Initiation: sendMessage is called, sending a POST request to the gateway.
  2. NDJSON Processing: The client parses incoming chunks into discrete TranscriptEntry objects apps/web/src/chat/chatShared.tsx#97-114.
  3. Entry Types:
  4. Token Batching: To prevent UI lag, assistant tokens are collected and applied in batches via applyAssistantTokenBatch apps/web/src/chat/chatShared.tsx#230-235.

Context Budget Estimation

The ChatComposer includes a real-time Context Budget indicator to help operators avoid model context window overflows. Sources: apps/web/src/chat/chatShared.tsx#61-72, apps/web/src/chat/ChatComposer.tsx#152-163

Slash Commands & Suggestions

The Chat Console implements a robust slash command system that provides parity between the Web UI and the TUI (Terminal User Interface). Sources: apps/web/src/chat/chatCommandRegistry.ts, apps/web/src/chat/chatCommandSuggestions.ts, apps/web/src/chat/chatSlashActions.ts

Human-in-the-Loop (HITL) & Approvals

When an agent attempts a sensitive action (e.g., writing to a file or making a payment), the stream emits an approval_request. Sources: apps/web/src/chat/chatShared.tsx#141-221

Compaction & Checkpoints

To manage long-running conversations, Palyra supports session state manipulation.

Session Branching & Lineage

Palyra treats conversations as a tree rather than a linear list. Title: Session Branching Logic Sources: apps/web/src/chat/chatSessionActions.ts#153-194, apps/web/src/chat/ChatInspectorColumn.tsx#183-203