Documentation Index
Fetch the complete documentation index at: https://docs.photon.codes/docs/llms.txt
Use this file to discover all available pages before exploring further.

app.messages stream, and develop everything end-to-end without provisioning a phone number or pairing a device.
How it works
terminal.config() spawns the standalone tuichat binary as a subprocess and drives it over JSON-RPC. The binary auto-downloads from GitHub Releases the first time you run it. In a TTY it boots the rich UI; in a non-TTY context (CI, piped input) it falls back to a synchronous readline loop, so the same agent code works for scripted integration tests.
What you get
Input and output are decoupled, so you can type while the agent is responding and the agent can push messages whenever it wants.| Feature | How |
|---|---|
| Multiple chats | Ctrl+N opens a new chat, Ctrl+J / Ctrl+K switch between them. Each chat is its own Spectrum space. |
| Reactions | Press r on a message to react. Arrives in your code as a reaction content message. |
| Replies | Press e to reply inline. Arrives with a replyTo: { messageId } extra on the message. |
| File attachments | Drag-and-drop into the terminal — messages arrive with name, MIME type, and buffer. |
| Inline images | Rendered with the Kitty graphics protocol when supported, with a half-block fallback. |
| Typing indicators | space.startTyping() / space.stopTyping() show a live indicator. |
| Console capture | console.log / info / warn / error / debug from your agent are forwarded into a pinned __system__ chat instead of garbling the UI. |
Config
| Option | Type | Default | Description |
|---|---|---|---|
commands | { name: string; description?: string }[] | [] | Slash commands surfaced in the TUI’s command picker. Names must match /^\/[A-Za-z0-9_-]+$/. |
for await loop the same way you’d handle any text.
Working with multiple spaces
By default the TUI starts onchat-1; new chats opened with Ctrl+N get chat-2, chat-3, and so on. To open a named space programmatically, pass an id:
space() ensures the chat exists in the sidebar — useful for kicking off a conversation before any user input.
Reactions and replies
Reactions ride the sameapp.messages stream as text — they arrive as a reaction content message:
replyTo field:
When to use it
- Iterating on agent logic — every Spectrum API works exactly as it would in production, so behavior you build here ships unchanged.
- Integration tests — pipe stdin in non-TTY mode and assert on stdout; no TUI dependency for CI.
- CLI tools — same handler shape as any multi-platform deployment, with reactions and replies as first-class events.