Skip to content

th-d5b446: conversation sidebar + resume + new-chat (daemon PWA) - #181

Merged
brentrager merged 1 commit into
th-c89c2a-smooth-daemonfrom
th-d5b446-daemon-sidebar
Jul 9, 2026
Merged

th-d5b446: conversation sidebar + resume + new-chat (daemon PWA)#181
brentrager merged 1 commit into
th-c89c2a-smooth-daemonfrom
th-d5b446-daemon-sidebar

Conversation

@brentrager

Copy link
Copy Markdown
Contributor

Problem

The Big Smooth daemon PWA (smooth-web SPA) was a single, ephemeral chat: useOperator created one fresh session per page load with a random agentId and had no history or conversation list. There was no way to see past conversations or resume one.

Solution

A toggleable slide-in conversation sidebar + resume + new-chat, built against the sibling server agent's WS contract (pearl th-d5b446).

operator.ts — three more smooth-operator WS actions

  • list_conversations — sent on connect and after every completed turn (eventual_response); the reply's data.conversations populates a new conversations: ConversationSummary[]. Exposed with refreshConversations().
  • resumeConversation(conversationId) — clears the transcript, opens a create_conversation_session bound to that conversationId, and (once the session id comes back) chases it with get_conversation_messages to load history into messages. A pendingResumeRef sequences the history fetch after the session reply, since it needs the sessionId.
  • newConversation() — fresh create_conversation_session (no id), cleared transcript, activeConversationId reset.
  • immediate_response now branches on payload shape (conversations[] → list, messages[] → history, sessionId → bind session + capture conversationId for highlighting).

App.tsx — the sidebar

  • Aurora-Glass Sidebar: overlays with a backdrop on mobile, docks on desktop (lg:pl-72 on the main column), highlights the active conversation, lists title + relative time + message count, and carries a prominent New chat button.
  • A menu-toggle button (top-left, above the drawer). The Smooth brand mark moved into the sidebar header.
  • Empty-state greeting preserved for a fresh/new chat.

Back-compat

No sidebar interaction ⇒ identical single-chat behaviour to before.

Assumptions to reconcile with the server agent

  • History message shape assumed { role, content } (defensive on text/message aliases). User turns render inbound, everything else assistant; past tool chips are NOT reconstructed — history is text-only.
  • ConversationSummary.updatedAt read defensively (ISO string or epoch; a bare number < 1e12 treated as seconds) in relTime.
  • get_conversation_messages is sent with both sessionId and conversationId (contract left it ambiguous).

Build status

  • pnpm build:web — clean ✅
  • tsc --noEmit — clean ✅ (also fixed two pre-existing ChatMessage literals missing the required blocks field, which only survived via vite's esbuild)
  • Not E2E-tested — the list_conversations / get_conversation_messages / resume server actions integrate when the Rust side lands (the daemon path-deps the server).

🤖 Generated with Claude Code

The smooth-web SPA was a single ephemeral chat (one fresh session per load,
no history). Add a toggleable slide-in sidebar listing recent conversations,
resume-in-context, and a New chat button — driven by three more smooth-operator
WS actions.

operator.ts: on connect, request list_conversations (refreshed after each turn);
resumeConversation(id) binds a session to an existing conversationId then loads
its history via get_conversation_messages; newConversation() opens a fresh
session and clears the transcript. New hook surface: conversations,
activeConversationId, refreshConversations, resumeConversation, newConversation.

App.tsx: Aurora-Glass Sidebar (overlay+backdrop on mobile, docks on desktop),
active-row highlight, prominent New chat, brand mark relocated into the sidebar
header. No sidebar interaction = unchanged single-chat behaviour.

Also fills the required blocks: [] on the error/user ChatMessage literals so
tsc --noEmit is clean (they previously only survived via vite's esbuild).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 9e0d264

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@smooai/smooth Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@brentrager
brentrager merged commit bdcb00e into th-c89c2a-smooth-daemon Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant