The VS Code of video editing, built for agents.
TypeScript
Remove ldrs dependency and introduce activity styles for agent chat
konstantin-paulusd97d63baec39
diff --git a/apps/web/package.json b/apps/web/package.jsonindex efe466a6..64bc0dcf 100644--- a/apps/web/package.json+++ b/apps/web/package.json@@ -38,7 +38,6 @@"dompurify": "^3.4.15","idb": "^8.0.3","koota": "^0.6.6",- "ldrs": "^1.1.9","marked": "^18.0.12","mediabunny": "^1.32.2","solid-js": "^1.9.10",diff --git a/apps/web/src/agent-chat/shimmer.css b/apps/web/src/agent-chat/activity.csssimilarity index 53%rename from apps/web/src/agent-chat/shimmer.cssrename to apps/web/src/agent-chat/activity.cssindex b6267fde..32336ec5 100644--- a/apps/web/src/agent-chat/shimmer.css+++ b/apps/web/src/agent-chat/activity.css@@ -2,9 +2,10 @@* License, v. 2.0. If a copy of the MPL was not distributed with this* file, You can obtain one at http://mozilla.org/MPL/2.0/. */-/* A highlight sweeping through muted text: what a row shows while the- agent is thinking or a tool is running. Settles on plain muted text for- anyone who asked the system for less motion. */+/* What a row shows while the agent is at work: a highlight sweeping+ through the muted text of a running tool, and the stepping ellipsis of+ the transcript's running indicator. Both settle on plain text for anyone+ who asked the system for less motion. */.agent-shimmer {color: transparent;@@ -36,3 +37,31 @@color: var(--muted-foreground);}}++/* "Thinking" → ".", "..", "..." on a fixed-width tail so the label does not jitter. */+.agent-ellipsis::after {+ content: ".";+ display: inline-block;+ width: 1.2em;+ text-align: left;+ animation: agent-ellipsis 1.2s steps(1, end) infinite;+}++@keyframes agent-ellipsis {+ 0% {+ content: ".";+ }+ 33% {+ content: "..";+ }+ 66% {+ content: "...";+ }+}++@media (prefers-reduced-motion: reduce) {+ .agent-ellipsis::after {+ animation: none;+ content: "...";+ }+}diff --git a/apps/web/src/agent-chat/items.tsx b/apps/web/src/agent-chat/items.tsxindex 1af7b756..024cbb1c 100644--- a/apps/web/src/agent-chat/items.tsx+++ b/apps/web/src/agent-chat/items.tsx@@ -13,7 +13,7 @@ import type { Item } from "@diffusionstudio/agent-chat";import { AttachmentChip } from "./attachments";import { Markdown } from "./markdown";-import "./shimmer.css";+import "./activity.css";type Of<K extends Item["kind"]> = Extract<Item, { kind: K }>;@@ -38,8 +38,8 @@ export function AssistantItem(props: { item: Of<"assistant"> }) {);}-/** `active`: the model is still thinking here, so the label shimmers (and stays even before any text). */-export function ReasoningItem(props: { item: Of<"reasoning">; active?: boolean }) {+/** The record of a thought: what the model is on right now is the transcript's running indicator, not this row. */+export function ReasoningItem(props: { item: Of<"reasoning"> }) {const [open, setOpen] = createSignal(false);const expandable = () => props.item.text.trim().length > 0;return (@@ -52,7 +52,7 @@ export function ReasoningItem(props: { item: Of<"reasoning">; active?: boolean }onClick={() => expandable() && setOpen(!open())}><Icon name={open() ? "chevron-down" : "chevron-right"} class="size-6" />- <span classList={{ "agent-shimmer": props.active }}>Thinking</span>+ <span>Thinking</span></button><Show when={open()}><div class="mt-0.5 whitespace-pre-wrap break-words border-l border-border pl-2 text-[11px] leading-4 text-muted-foreground">@@ -150,8 +150,8 @@ export function NoticeItem(props: { item: Of<"notice"> }) {);}-/** Dispatches on kind. `active`: this is the item the running turn is on right now. */-export function ChatItem(props: { item: Item; active?: boolean }) {+/** Dispatches on kind. */+export function ChatItem(props: { item: Item }) {const item = () => props.item;return (<>@@ -161,9 +161,9 @@ export function ChatItem(props: { item: Item; active?: boolean }) {<Show when={item().kind === "assistant"}><AssistantItem item={item() as Of<"assistant">} /></Show>- {/* Thinking the model keeps to itself arrives as an empty block: shown only while it is happening. */}- <Show when={item().kind === "reasoning" && ((item() as Of<"reasoning">).text.trim() || props.active)}>- <ReasoningItem item={item() as Of<"reasoning">} active={props.active} />+ {/* Thinking the model keeps to itself arrives as an empty block: nothing to show. */}+ <Show when={item().kind === "reasoning" && (item() as Of<"reasoning">).text.trim()}>+ <ReasoningItem item={item() as Of<"reasoning">} /></Show><Show when={item().kind === "tool"}><ToolItem item={item() as Of<"tool">} />diff --git a/apps/web/src/agent-chat/running-indicator.tsx b/apps/web/src/agent-chat/running-indicator.tsxindex 5ab4aef5..a4d37c5a 100644--- a/apps/web/src/agent-chat/running-indicator.tsx+++ b/apps/web/src/agent-chat/running-indicator.tsx@@ -2,69 +2,22 @@* License, v. 2.0. If a copy of the MPL was not distributed with this* file, You can obtain one at http://mozilla.org/MPL/2.0/. */-// The row under the last message while a turn runs: a tail-chase loader-// and a muted line saying what the agent is on right now, read off the-// last item. Both harnesses map to the same item model, so the wording is-// the same for Claude Code and Codex.--import "ldrs/tailChase";+import { Icon } from "@/components/ui/icon";import type { Item } from "@diffusionstudio/agent-chat";-declare module "solid-js" {- namespace JSX {- interface IntrinsicElements {- "l-tail-chase": { size?: number | string; color?: string; speed?: number | string };- }- }-}+import "./activity.css";-/** What the agent is doing, judged by the item the turn is on. */+/** What the agent is doing, judged by the item the turn is on. A tool in flight has its own row, so it never lands here. */export function runningLabel(last: Item | undefined): string {- if (!last) return "Thinking";- switch (last.kind) {- case "reasoning":- return "Thinking";- case "assistant":- return "Writing";- case "tool":- return last.status === "running" ? toolLabel(last.name, last.title) : "Thinking";- default:- return "Thinking";- }-}--function toolLabel(name: string, title: string): string {- switch (name) {- case "Read":- case "Glob":- case "Grep":- return "Reading files";- case "Edit":- case "Write":- case "MultiEdit":- case "NotebookEdit":- case "fileChange":- return "Editing files";- case "Bash":- case "commandExecution":- return "Running a command";- case "WebSearch":- case "WebFetch":- case "webSearch":- return "Searching the web";- case "Agent":- return "Delegating";- default:- return `Using ${title}`;- }+ return last?.kind === "assistant" ? "Writing" : "Thinking";}export function RunningIndicator(props: { last: Item | undefined }) {return (- <div class="flex h-6 items-center gap-2 px-1 text-[11px] text-muted-foreground" role="status" aria-live="polite">- <l-tail-chase size="15" speed="1.75" color="currentColor" />- <span>{runningLabel(props.last)}…</span>+ <div class="flex h-6 items-center text-[11px] text-muted-foreground" role="status" aria-live="polite">+ <Icon name="spinner-loader" class="size-6 shrink-0 animate-spin" />+ <span class="agent-ellipsis">{runningLabel(props.last)}</span></div>);}diff --git a/apps/web/src/agent-chat/transcript.tsx b/apps/web/src/agent-chat/transcript.tsxindex 7704a9ea..42cff9a7 100644--- a/apps/web/src/agent-chat/transcript.tsx+++ b/apps/web/src/agent-chat/transcript.tsx@@ -26,9 +26,12 @@ type TranscriptProps = {waiting: boolean;};+const toolInFlight = (item: Item | undefined) => item?.kind === "tool" && item.status === "running";+export function Transcript(props: TranscriptProps) {const [scrollEl, setScrollEl] = createSignal<HTMLDivElement>();const stick = createStickToBottom(scrollEl, { initial: "instant" });+ const last = () => props.items[props.items.length - 1];createEffect(on(() => props.sendCount, (count) => count > 0 && void stick.scrollToBottom(), { defer: true }));createEffect(on(() => props.chatKey, () => void stick.scrollToBottom({ animation: "instant" }), { defer: true }));@@ -37,10 +40,11 @@ export function Transcript(props: TranscriptProps) {<div ref={setScrollEl} class="min-h-0 flex-1 overflow-y-auto overflow-x-hidden"><div class="flex flex-col gap-2 px-4 pb-2 pt-4"><For each={props.items}>- {(item, index) => <ChatItem item={item} active={props.running && index() === props.items.length - 1} />}+ {(item) => <ChatItem item={item} />}</For>- <Show when={props.running && !props.waiting}>- <RunningIndicator last={props.items[props.items.length - 1]} />+ {/* A tool in flight spins on its own row; the indicator covers everything else the turn does. */}+ <Show when={props.running && !props.waiting && !toolInFlight(last())}>+ <RunningIndicator last={last()} /></Show></div></div>diff --git a/package-lock.json b/package-lock.jsonindex 364c4bd7..135e2e74 100644--- a/package-lock.json+++ b/package-lock.json@@ -114,7 +114,6 @@"dompurify": "^3.4.15","idb": "^8.0.3","koota": "^0.6.6",- "ldrs": "^1.1.9","marked": "^18.0.12","mediabunny": "^1.32.2","solid-js": "^1.9.10",@@ -9161,12 +9160,6 @@}}},- "node_modules/ldrs": {- "version": "1.1.9",- "resolved": "https://registry.npmjs.org/ldrs/-/ldrs-1.1.9.tgz",- "integrity": "sha512-JKVdzboxeZrKecA8ovi5iIDgs59wUrtJ+LDrHCgZecNrR0AJi2cJ3ZANJ+UCNS/sHRol73/jlypNCAMCXS+Ung==",- "license": "MIT"- },"node_modules/levn": {"version": "0.4.1","resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",