Skip to content

features

Zachary BENSALEM edited this page Aug 15, 2026 · 1 revision

Features

This section documents the cross-cutting capabilities of Prime Agent that span multiple packages: the web chat surface in web/, the agent runtime in packages/coding-agent, and the LLM layer in packages/ai. Where package pages describe one package's structure and files, feature pages follow a single capability end to end from the browser through the server adapter into the agent loop.

The web chat wire contract is defined in web/protocol (web/protocol/src/chat-protocol.ts) and adapted in web/server (web/server/src/event-mapper.ts, web/server/src/prime-bridge.ts). The agent runtime is packages/coding-agent; the LLM provider abstraction is packages/ai. Feature pages refer to these package pages for the underlying structure.

Feature pages

  • streaming-chat: the end-to-end streaming architecture: NDJSON turn stream over POST /api/chat, the SSE push channel with ring-buffer replay, and the client stream state machine.
  • tool-cards: the tool-call rendering lifecycle: tool events become ChatToolPart cards with a state machine, dispatched through the tool renderer and registry.
  • providers-and-models: how a user authenticates against LLM providers and selects models, from credential storage to the model picker.
  • sessions-and-branching: session lifecycle, JSONL transcripts, resume, fork, and branch switching.
  • slash-commands: /command interactions in both the TUI and the web client, with autocomplete.
  • mcp: Model Context Protocol client support, including OAuth and the server catalog.
  • oauth: OAuth login flows for providers such as Anthropic, GitHub Copilot, and OpenAI Codex.

The mcp, oauth, sessions-and-branching, and slash-commands pages are documented alongside this batch; see also session lifecycle and the glossary for term definitions.

How features map to packages

Each feature is a thin slice across a predictable set of packages:

Feature Wire contract Server adapter Client / UI Runtime
Streaming chat web/protocol/src/chat-protocol.ts web/server/src/prime-bridge.ts, web/server/src/event-mapper.ts, web/server/src/ring-buffer.ts web/app/src/lib/pi/chat-stream-state.ts, web/app/src/lib/pi/use-pi-chat.ts packages/coding-agent AgentSession
Tool cards web/protocol/src/chat-types.ts (ChatToolPart) web/server/src/event-mapper.ts (tool frames) web/design/src/components/agent-elements/tools/ packages/coding-agent tool execution
Providers and models web/protocol/src/provider-catalog.ts, model-patterns.ts web/server/src/handlers/chat-providers.ts, chat-models.ts, chat-models-discover.ts web/design/src/components/agent-elements/input/model-picker.tsx packages/ai/src/models.ts, packages/coding-agent/src/core/model-registry.ts, auth-storage.ts, settings-manager.ts
Sessions and branching web/protocol/src/chat-protocol.ts (session metadata) web/server/src/handlers/chat-new.ts, chat-resume.ts, chat-sessions.ts web/app/src/lib/pi/use-pi-chat.ts packages/coding-agent/src/core/session-manager.ts
Slash commands web/protocol/src/chat-protocol.ts (commands) web/server/src/handlers/chat-command.ts, chat-commands.ts web/app/src/lib/pi/slash-commands.ts packages/coding-agent/src/core/slash-commands.ts
MCP (in agent runtime) web/server custom MCP tool renderers web/design/src/components/agent-elements/tools/mcp-tool.tsx packages/ai/src/mcp.ts, packages/ai/src/mcp/
OAuth web/protocol/src/provider-catalog.ts (authType) web/server/src/handlers/chat-providers-oauth.ts web/app/src/routes/api/chat/providers/oauth.ts packages/ai/src/utils/oauth/, packages/coding-agent/src/core/auth-storage.ts

Related pages

Clone this wiki locally