Repository navigation
Todo
Labels
type: enhancement 💅🏼New feature or request
Description
Problem
People work with pi in Tapas through a terminal, which shuts out anyone who is not at ease in one. The direction is a chat-first product. Home should be a chat with pi, and everything Home shows today should still be one click away. Depends on #27 (UI foundation) and #28 (chat endpoint, PR #34).
Proposal
Home is the chat
- Home (
/) is a full-screen chat. With no conversation open it shows a greeting and the composer in the middle of the screen, with a "Build with Pi" button beside it. Nothing else is on the page. - On send, the composer moves to the bottom, the person's message appears above it, and the reply streams in. The URL becomes
/chat/{id}, so reload and back work. This is an in-page transition, not a navigation between pages. Use the View Transitions API with a plain fallback, the Nebari motion tokens for timing, and an instant swap underprefers-reduced-motion. - The browser makes the conversation id (a lowercase UUID, which the bridge accepts for a new conversation), so the URL changes before the server answers.
- A slim header stays: a "New chat" control that returns to the empty state, the conversation title, and the profile menu. On wide screens the message column has a capped width; the background fills the window.
- "Build with Pi" beside the composer sends the composer's text through the existing
useBuildWithAgent(ui/src/features/ai/ai.ts), which starts a pi terminal app. It stays on the New App page and in the palette as well. - Opening Home starts no pod. The pod is created or started on the first message (see below).
What moves off Home
Now on Home (ui/src/features/home/Home.tsx) |
Goes to |
|---|---|
"Try a sample" (SampleGallery) |
Apps page, after the apps list. First on the page when the person has no apps |
| Apps list and view switch | Already on the Apps page |
| Storage notices | Already on the Apps page |
| Running count | Apps page head |
| "Needs your attention" (failed or stuck apps, feature items) | Top of the Apps page. The Apps nav item shows the count, so failures are still seen on sign-in |
Jobs section (homeSections from features/jobs) |
The Jobs page. Drop the homeSections hook, or render it on the Apps page |
Who sees chat
- A person who may not use the chat template, or when an admin has turned chat off (
chat.enabled), goes from/to/apps, which now holds everything the old Home had. - A person with no model (the admin set no agent model and the person stored no key) sees the chat Home with a message that links to Settings, not a send button that fails. Check the existing agent status (
internal/gateway/apps/agent.go) before sending. The bridge does not report a missing model as its own error.
The first message
- The gateway does not create a chat app, and the routes return 404 when the person has none and 409
not runningwhen it is stopped. On the first message, the UI creates the person's chat app if it is missing and starts it if it is stopped, shows the same start steps an app page shows, then sends the message. useChatsends from the chat view, which stays mounted through the transition, so the stream is never owned by something that unmounts.- Load the chat code when the composer gets focus, so the transition does not wait on a download.
The chat app is not something people pick
- Hide the "pi chat" template from the template list and New App, since Home creates the chat app. Tapas has no way to hide a template today, so add one (a template field, set in
deploy/helm/javo/files/templates/chat.yaml). - Hide "Open" for chat apps on the Apps page and the app page. The app's own address answers 403 by design (Run pi behind a chat endpoint: RPC bridge in the pod and gateway routes #28).
Rendering
- A new feature module,
ui/src/features/chat, registered like the other features inui/src/features/index.ts. The message view is its own chunk. The Apps page content is lazy too, since it is no longer the first screen. useChatfrom the AI SDK, pointed at the/api/chatroutes. It sends only the new message, because pi owns the history.- shadcn AI Elements for the conversation, messages, the composer, reasoning and tool calls. Streamdown renders the markdown. Mermaid and math stay off until they are shown to work under the page policy. The spike (Spike: pi in RPC mode, and the chat UI stack under the UI's page policy #26) did not test either.
- Code is colored by the highlighter Tapas already has (
ui/src/features/files/fileSyntax.ts: Shiki's JavaScript engine, colors from the--code-*tokens), in two places:- Streamdown ships no highlighter. Give it one as its
codeplugin, backed byfileSyntax.ts. - The AI Elements code block, which the tool call element uses, is rewritten to draw tokens as React elements. As installed it imports the full
shikipackage, whose WebAssembly engine and inline-styled HTML the gateway's page policy both refuse. - The full
shikipackage is not a dependency. With it the spike's build was 380 asset files and 16 MB, and without it 71 files and 6.5 MB.
- Streamdown ships no highlighter. Give it one as its
- AI Elements are installed with the shadcn CLI, which rewrites them to Base UI primitives. What still needs a hand edit:
- 11 selectors that use Radix's
data-[state=open]anddata-[state=closed]. Base UI emitsdata-openanddata-closed, so open and close animations do not fire until they are rewritten. - The reasoning element imports
@radix-ui/react-use-controllable-state. Replace it with Base UI's own or a few lines of state, so no file underui/srcimports Radix. - 8 small type errors: the hover card's delay props, props passed through to Streamdown, and two stale
@ts-expect-errorlines.
- 11 selectors that use Radix's
- The chat endpoint already drops the system prompt and unknown roles. The UI does not render a role it does not know either.
- Every pi tool call arrives as a
dynamic-toolpart and renders as one generic row that opens to show what was sent and what came back. No renderer per tool yet. - A stop button while a reply streams. The composer is disabled until the reply ends.
- Reloading
/chat/{id}loads the conversation withGET /api/chat/conversations/{id}.
Out of scope
- The final visual design, which is still with design. This is the base experience.
- Approvals, attachments and a preview pane.
- The list of past conversations, reconnecting partway through a reply, and error handling beyond the start and no-model cases: Chat: reconnect, past conversations, errors, idle stop and one app per person #30.
- Opening a chat conversation in the terminal app builder with its history: separate issue.
Definition of done
- Home is the chat for a person allowed to use it. Sending a message moves to
/chat/{id}with the transition, and the reply streams: text, reasoning and tool calls. - Under
prefers-reduced-motionthe transition is an instant swap. - "New chat" returns to the empty Home.
- "Build with Pi" beside the composer starts a pi terminal app with the composer's text.
- Opening Home starts no pod. A first message with no chat app, or a stopped one, shows start progress and then the reply.
- A person with no model sees the Settings message, not an error.
- A person who may not use chat, or when chat is turned off, lands on
/apps. - The Apps page shows the attention list, the running count, the storage notices, the apps list and "Try a sample". The Apps nav item shows the attention count. The Jobs section is on the Jobs page.
- The "pi chat" template is not offered in the template list or New App, and chat apps have no "Open" button.
- Stop ends the reply, and the composer works again.
- Reloading
/chat/{id}shows the conversation again. - The chat works by keyboard alone, and new messages are announced to screen readers.
- Light and dark both use the Tapas tokens.
- No page policy errors in the console when served through the gateway, with a reply that has a code block, a table and a tool call.
- Code blocks are colored in markdown and in tool calls, in light and dark, and the page requests no WebAssembly.
- Reasoning and tool rows animate open and closed.
- No file under
ui/srcimports from@radix-ui, andshikiis not inui/package.json. - Tests, with the API mocked: the empty Home, sending and the transition, streaming, stop, reload, the redirect to
/apps, the no-model message, and the Apps page sections. - Every new package is pinned and has a row in
ui/DEPS.md. AI Elements addmotion,nanoid,use-stick-to-bottomandcnbesideai,@ai-sdk/reactandstreamdown.
Metadata
Metadata
Assignees
Labels
type: enhancement 💅🏼New feature or request
Type
Fields
Priority
None yet
Start date
None yet
Target date
None yet
Size
None yet
Activity
[-]Base chat experience on Home, behind a switch[/-][+]Chat is Home, with the current Home moved to the Apps page[/+]