Repository navigation
feat(web): redesign the Assistant as a chat with a saved-chats rail #255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kinqsradio
merged 6 commits into
orbyn-dev:feat/web-rebuild
from
luannn010:feat/assistant-chat-redesign
Nov 3, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2f46f40
feat(web): redesign the Assistant as a chat with a saved-chats rail
luannn010 a0d013b
feat(web): show Upcoming as a priority-first panel beside the chat
luannn010 26e9d86
fix(web): open Upcoming as a pop-up window again
luannn010 9d6449f
feat(web): let each automatic-change permission be chosen
luannn010 e0122f7
feat(web): add an icon to each automatic-change permission
luannn010 ad68444
fix(web): address assistant redesign review findings
kinqsradio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| import type { ChatTraceEntry } from "@orbyn/core"; | ||
| import { ChevronDown, ChevronRight, LoaderCircle } from "lucide-react"; | ||
| import { useEffect, useLayoutEffect, useState } from "react"; | ||
| import { traceWords } from "../agents-shared/words"; | ||
|
|
||
| export function duration(ms: number) { | ||
| const secs = Math.max(1, Math.round(ms / 1000)); | ||
| return secs < 60 ? `${secs}s` : `${Math.floor(secs / 60)}m ${secs % 60}s`; | ||
| } | ||
|
|
||
| /** Recorded steps of a finished turn, folded under how long it worked. */ | ||
| export function TurnTrace({ | ||
| trace, | ||
| status, | ||
| }: { | ||
| trace: readonly ChatTraceEntry[]; | ||
| status?: string; | ||
| }) { | ||
| const [open, setOpen] = useState(false); | ||
| const lines = traceWords([...trace]); | ||
| if (!lines.length && !status) return null; | ||
| const times = trace | ||
| .map((entry) => Date.parse(entry.at)) | ||
| .filter(Number.isFinite); | ||
| const span = | ||
| times.length > 1 ? Math.max(...times) - Math.min(...times) : null; | ||
| const label = [ | ||
| span !== null ? `Worked for ${duration(span)}` : "Steps", | ||
| status, | ||
| ] | ||
| .filter(Boolean) | ||
| .join(" · "); | ||
| return ( | ||
| <div className="assistant-trace"> | ||
| {lines.length > 0 ? ( | ||
| <button | ||
| type="button" | ||
| className="assistant-trace-toggle" | ||
| aria-expanded={open} | ||
| onClick={() => setOpen(!open)} | ||
| > | ||
| {open ? ( | ||
| <ChevronDown aria-hidden="true" /> | ||
| ) : ( | ||
| <ChevronRight aria-hidden="true" /> | ||
| )} | ||
| {label} | ||
| </button> | ||
| ) : ( | ||
| <span className="assistant-trace-toggle">{label}</span> | ||
| )} | ||
| {open && ( | ||
| <ol className="assistant-trace-steps"> | ||
| {lines.map((line, index) => ( | ||
| <li key={index}>{line}</li> | ||
| ))} | ||
| </ol> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| /** The run in progress: elapsed time and each progress label as it arrives. */ | ||
| export function LiveWork({ | ||
| started, | ||
| steps, | ||
| waiting, | ||
| }: { | ||
| started: number; | ||
| steps: string[]; | ||
| waiting: boolean; | ||
| }) { | ||
| const [now, setNow] = useState(Date.now); | ||
| useEffect(() => { | ||
| const timer = setInterval(() => setNow(Date.now()), 1000); | ||
| return () => clearInterval(timer); | ||
| }, []); | ||
| const latest = steps[steps.length - 1]; | ||
| return ( | ||
| <div className="assistant-trace"> | ||
| <span className="assistant-trace-toggle"> | ||
| <LoaderCircle className="assistant-spin" aria-hidden="true" /> | ||
| {waiting ? "Waiting for you" : "Working"} ·{" "} | ||
| {duration(Math.max(1000, now - started))} | ||
| </span> | ||
| <span className="sr-only" role="status" aria-live="polite"> | ||
| {waiting ? "Waiting for you" : (latest ?? "Working")} | ||
| </span> | ||
| {steps.length > 0 && ( | ||
| <ol className="assistant-trace-steps" aria-live="off"> | ||
| {steps.map((step, index) => ( | ||
| <li key={`${index}:${step}`} className="assistant-in"> | ||
| {step} | ||
| </li> | ||
| ))} | ||
| </ol> | ||
| )} | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| const still = () => | ||
| typeof matchMedia === "function" && | ||
| matchMedia("(prefers-reduced-motion: reduce)").matches; | ||
|
|
||
| /** Shows a just-arrived answer a few words at a time; history renders whole. */ | ||
| export function useReveal(text: string | null) { | ||
| const [shown, setShown] = useState(0); | ||
| const words = text?.match(/\S+\s*/g) ?? []; | ||
| const total = words.length; | ||
| useLayoutEffect(() => { | ||
| setShown(0); | ||
| if (!text || still()) { | ||
| setShown(Number.MAX_SAFE_INTEGER); | ||
| return; | ||
| } | ||
| // Long answers speed up so none takes much more than five seconds. | ||
| const step = Math.max(1, Math.ceil(total / 140)); | ||
| const timer = setInterval( | ||
| () => | ||
| setShown((value) => { | ||
| if (value + step >= total) clearInterval(timer); | ||
| return value + step; | ||
| }), | ||
| 35, | ||
| ); | ||
| return () => clearInterval(timer); | ||
| }, [text, total]); | ||
| return { | ||
| done: !text || shown >= total, | ||
| text: text && shown < total ? words.slice(0, shown).join("") : text, | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| import { groupAssistantChats, type AiChatSummary } from "@orbyn/core"; | ||
| import { X } from "lucide-react"; | ||
| import { useEffect } from "react"; | ||
| import { client } from "../../lib/session"; | ||
| import { Button, ErrorNotice, IconButton } from "../../ui/kit"; | ||
| import { useOwned, onForeground } from "../agents-shared/hooks"; | ||
| import { useRead } from "./state"; | ||
|
|
||
| /** Compact saved-chat list beside the conversation; managing chats stays in ChatList. */ | ||
| export function ChatRail({ | ||
| personal, | ||
| active, | ||
| disabled, | ||
| onOpen, | ||
| onManage, | ||
| onHide, | ||
| }: { | ||
| personal: string | null; | ||
| active: string | null; | ||
| disabled: boolean; | ||
| onOpen: (id: string) => void; | ||
| onManage: () => void; | ||
| onHide: () => void; | ||
| }) { | ||
| const owned = useOwned(); | ||
| const read = useRead( | ||
| () => client.aiChats({ search: "", kind: "all", limit: 50 }), | ||
| [active], | ||
| { retain: true }, | ||
| ); | ||
| useEffect( | ||
| () => | ||
| onForeground(() => { | ||
| if (owned()) void read.reload(); | ||
| }), | ||
| [owned, read.reload], | ||
| ); | ||
| const group = groupAssistantChats(read.data ?? [], personal); | ||
| const row = (chat: AiChatSummary) => ( | ||
| <li key={chat.id}> | ||
| <button | ||
| type="button" | ||
| className="assistant-rail-row" | ||
| aria-current={active === chat.id ? "page" : undefined} | ||
| disabled={disabled} | ||
| onClick={() => owned() && onOpen(chat.id)} | ||
| > | ||
| <span dir="auto">{chat.title || "Untitled chat"}</span> | ||
| {chat.active && ( | ||
| <span | ||
| className={`assistant-rail-dot${chat.active === "needs_you" ? " is-warn" : ""}`} | ||
| title={chat.active === "needs_you" ? "Needs you" : "Working"} | ||
| > | ||
| <span className="sr-only"> | ||
| {chat.active === "needs_you" ? "Needs you" : "Working"} | ||
| </span> | ||
| </span> | ||
| )} | ||
| </button> | ||
| </li> | ||
| ); | ||
| const section = (title: string, chats: AiChatSummary[], key = title) => | ||
| chats.length > 0 && ( | ||
| <section key={key} className="assistant-rail-group"> | ||
| <h2 dir="auto">{title}</h2> | ||
| <ul>{chats.map(row)}</ul> | ||
| </section> | ||
| ); | ||
| return ( | ||
| <nav className="assistant-rail" aria-label="Saved chats"> | ||
| <div className="assistant-rail-head"> | ||
| <span>Chats</span> | ||
| <Button variant="ghost" onClick={onManage}> | ||
| Search and manage | ||
| </Button> | ||
| <IconButton | ||
| label="Hide saved chats" | ||
| className="assistant-rail-close" | ||
| onClick={onHide} | ||
| > | ||
| <X aria-hidden="true" /> | ||
| </IconButton> | ||
| </div> | ||
| {read.error && ( | ||
| <ErrorNotice message={read.error} onRetry={() => void read.reload()} /> | ||
| )} | ||
| <div className="assistant-rail-list"> | ||
| {personal && ( | ||
| <ul> | ||
| <li> | ||
| <button | ||
| type="button" | ||
| className="assistant-rail-row" | ||
| aria-current={active === personal ? "page" : undefined} | ||
| disabled={disabled} | ||
| onClick={() => owned() && onOpen(personal)} | ||
| > | ||
| <span>Personal conversation</span> | ||
| </button> | ||
| </li> | ||
| </ul> | ||
| )} | ||
| {section("Pinned", group.pinned)} | ||
| {group.projects.map((project) => | ||
| section(project.name, project.chats, project.id), | ||
| )} | ||
| {section("Recent", group.recent)} | ||
| {read.loading && !read.data && ( | ||
| <p className="small muted" role="status"> | ||
| Loading chats… | ||
| </p> | ||
| )} | ||
| </div> | ||
| </nav> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useReadclears its data and setsloadingwhenever a dependency changes. Passing[active]means every chat switch blanks the rail and refetches up to 50 chats even though only the highlight changed. Removeactivefrom the dependencies, or add a retaining reload mode so the rail stays visible while it refreshes.