Skip to main content
The Chat Console is the primary operational interface of Palyra, providing a real-time, streaming environment for human-agent collaboration. It integrates session lifecycle management, context budget monitoring, and advanced “Phase 4” continuity operations (compaction and branching).

ChatConsolePanel Architecture

ChatConsolePanel is the root coordinator for the chat interface apps/web/src/chat/ChatConsolePanel.tsx#77-83. It orchestrates several specialized hooks and sub-components to maintain a high-performance streaming UI while managing complex session state.

Core Data Flow

The panel manages state across three primary vertical columns:
  1. Session Rail (Left): Managed by useChatSessions, handling session switching, searching, and metadata apps/web/src/chat/useChatSessions.ts#37-42.
  2. Transcript (Center): Managed by useChatRunStream, handling gRPC-backed NDJSON streaming and local optimistic updates apps/web/src/chat/useChatRunStream.ts#157-163.
  3. Inspector (Right): Managed by ChatInspectorColumn, providing deep-dive views into tool payloads, compactions, and background tasks apps/web/src/chat/ChatInspectorColumn.tsx#109-155.

Component Hierarchy & Code Entities

The following diagram bridges the UI concepts to the specific React components and hooks that implement them. Chat Console Component Mapping Sources: apps/web/src/chat/ChatConsolePanel.tsx#77-163, apps/web/src/chat/ChatConsoleWorkspaceView.tsx#1-20, apps/web/src/chat/ChatComposer.tsx#53-84, apps/web/src/chat/ChatInspectorColumn.tsx#109-155

Session Management (useChatSessions)

The useChatSessions hook encapsulates the lifecycle of SessionCatalogRecord objects apps/web/src/chat/useChatSessions.ts#37-42. Sources: apps/web/src/chat/useChatSessions.ts#14-35, apps/web/src/chat/chatShared.tsx#355-385

Slash Commands & Composer

The ChatComposer supports a rich set of operator shortcuts via “Slash Commands”. These are parsed client-side to trigger specific API actions or UI state changes apps/web/src/chat/chatShared.tsx#76-163.
CommandFunctionCode Reference
/compactTriggers transcript compaction (preview or apply)apps/web/src/chat/chatShared.tsx#145-150
/branchCreates a child session from the current stateapps/web/src/chat/chatShared.tsx#102-106
/checkpointCreates a named restore point for the sessionapps/web/src/chat/ChatConsolePanel.tsx#430-445
/delegateSpawns a delegated child run using a profileapps/web/src/chat/chatShared.tsx#114-119
/queueQueues follow-up text without interrupting the runapps/web/src/chat/chatShared.tsx#108-112

Context Budget Subsystem

Palyra calculates a “Context Budget” in real-time as the operator types. This is managed by useChatContextBudget apps/web/src/chat/useChatContextBudget.ts#16-23. Sources: apps/web/src/chat/ChatComposer.tsx#131-148, apps/web/src/chat/chatShared.tsx#22-23, apps/web/src/chat/useChatContextBudget.ts#24-43

Transcript & Inspector Column

The ChatTranscript renders a sequence of TranscriptEntry objects apps/web/src/chat/ChatTranscript.tsx#27-42. To maintain performance, Palyra caps the rendered items to the latest 120, though up to 800 are retained in memory apps/web/src/chat/chatShared.tsx#18-19.

Payload Offloading

Large JSON payloads (tool inputs/outputs) are not rendered inline. Instead, they are offloaded to the ChatInspectorColumn apps/web/src/chat/ChatTranscript.tsx#174-184. Data Flow: Payload Inspection Sources: apps/web/src/chat/ChatTranscript.tsx#174-184, apps/web/src/chat/ChatConsolePanel.tsx#233-242, apps/web/src/chat/chatConsoleUtils.ts#22-30

Inspector Components

The ChatInspectorColumn displays several distinct types of operational data: Sources: apps/web/src/chat/ChatInspectorColumn.tsx#109-155, apps/web/src/chat/chatConsoleUtils.ts#50-100

Implementation Details

Streaming Logic (useChatRunStream)

This hook manages the ConsoleApiClient.streamChatRun connection apps/web/src/chat/useChatRunStream.ts. It handles:

Inline Approvals

When a tool requires human-in-the-loop approval, the transcript renders ApprovalRequestControls apps/web/src/chat/ChatTranscript.tsx#190-202. Sources: apps/web/src/chat/ChatTranscript.tsx#190-202, apps/web/src/chat/chatShared.tsx#230-245, apps/web/src/chat/ChatConsolePanel.tsx#155