Skip to main content
The Chat Interface is the primary operational surface for interacting with agents within the Palyra Console. It is designed to handle complex agentic workflows, including long-running streams, tool execution, session branching, and context management, without overwhelming the user with raw data.

Architecture Overview

The chat system is built around a centralized state orchestrator, ChatConsolePanel, which coordinates several specialized hooks and sub-components.

Component Relationship

The following diagram maps the logical “Chat Workspace” to the React components and hooks that implement them. Diagram: Chat Interface Component Mapping Sources: apps/web/src/chat/ChatConsolePanel.tsx#81-168, apps/web/src/chat/ChatConsoleWorkspaceView.tsx#50-193

Session Management and Lineage

Sessions in Palyra are not just linear logs; they support branching and versioning (checkpoints).

Session Lifecycle (useChatSessions)

The useChatSessions hook manages the catalog of available sessions, handling creation, renaming, archiving, and switching.

Branching and Lineage

Palyra supports “Branching,” allowing a user to fork a session from a specific point in time. Sources: apps/web/src/chat/useChatSessions.ts#37-191, apps/web/src/chat/chatShared.tsx#38-40

Run Orchestration and Streaming

The useChatRunStream hook is the core engine for active agent interactions. It manages the lifecycle of a “Run” within a session.

Data Flow: Run Events to UI

The daemon streams events (NDJSON) which are processed and transformed into TranscriptEntry objects. Diagram: Stream Processing Pipeline Sources: apps/web/src/chat/useChatRunStream.ts#95-173, apps/web/src/chat/chatShared.tsx#223-244

The Chat Composer and Slash Commands

The ChatComposer handles user input, file attachments, and the shared slash command registry.

Slash Command Registry

Slash commands are shared between the Web Console and the CLI TUI. They are defined in a central JSON registry.

Context Budgeting

Before sending a message, the composer calculates a “Context Budget” to warn users if the prompt is too large for the model’s window. Sources: apps/web/src/chat/ChatComposer.tsx#66-151, apps/web/src/chat/chatCommandRegistry.ts#6-36, apps/web/src/chat/chatShared.tsx#29-30

Continuity Operations

The interface provides tools for managing the long-term health and “undo” capability of a session.
FeatureCode EntityDescription
CompactionrunChatCompactionFlowReduces session size by summarizing older turns into artifacts apps/web/src/chat/ChatConsolePanel.tsx#24-24.
Undo CheckpointsChatCheckpointRecordAllows reverting a session to a known good state apps/web/src/chat/ChatConsolePanel.tsx#6-6.
Recall PreviewuseRecallPreviewShows what information the agent will “recall” from memory/RAG for the current draft apps/web/src/chat/useRecallPreview.ts#1-1.
Context PreviewuseContextReferencePreviewResolves [[references]] in the composer text before submission apps/web/src/chat/useContextReferencePreview.ts#1-1.

Inline Approvals

When an agent attempts a high-risk tool call, an approval_request entry appears in the transcript. Sources: apps/web/src/chat/ChatConsolePanel.tsx#20-26, apps/web/src/chat/chatShared.tsx#141-221