Skip to content

The VS Code of video editing, built for agents.

TypeScript

Add ldrs dependency and enhance Transcript component

konstantin-paulusa0ccde9e597e
diff --git a/apps/web/package.json b/apps/web/package.json
index 64bc0dcf..efe466a6 100644
--- a/apps/web/package.json
+++ b/apps/web/package.json
@@ -38,6 +38,7 @@
"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/chat-panel.tsx b/apps/web/src/agent-chat/chat-panel.tsx
index 15fbab60..c42e0b4f 100644
--- a/apps/web/src/agent-chat/chat-panel.tsx
+++ b/apps/web/src/agent-chat/chat-panel.tsx
@@ -148,7 +148,7 @@ export function ChatPanel() {
/>
</div>
- <Transcript items={items()} sendCount={sendCount()} chatKey={chatId() ?? "draft"} running={running()} />
+ <Transcript items={items()} sendCount={sendCount()} chatKey={chatId() ?? "draft"} running={running()} waiting={waiting()} />
<Show when={transcript().pending}>
{(request) => <QuestionCard request={request()} onSubmit={answer} onSkip={() => answer("skip")} />}
diff --git a/apps/web/src/agent-chat/running-indicator.tsx b/apps/web/src/agent-chat/running-indicator.tsx
new file mode 100644
index 00000000..5ab4aef5
--- /dev/null
+++ b/apps/web/src/agent-chat/running-indicator.tsx
@@ -0,0 +1,70 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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 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 };
+ }
+ }
+}
+
+/** What the agent is doing, judged by the item the turn is on. */
+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}`;
+ }
+}
+
+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>
+ );
+}
diff --git a/apps/web/src/agent-chat/transcript.tsx b/apps/web/src/agent-chat/transcript.tsx
index fcbb85ce..7704a9ea 100644
--- a/apps/web/src/agent-chat/transcript.tsx
+++ b/apps/web/src/agent-chat/transcript.tsx
@@ -6,11 +6,12 @@
// they overflow: the end of the streaming text stays right above the
// composer, a wheel-up lets go, scrolling back near the bottom pins again.
-import { For, createEffect, createSignal, on } from "solid-js";
+import { For, Show, createEffect, createSignal, on } from "solid-js";
import type { Item } from "@diffusionstudio/agent-chat";
import { ChatItem } from "./items";
+import { RunningIndicator } from "./running-indicator";
import { createStickToBottom } from "./stick-to-bottom";
type TranscriptProps = {
@@ -21,6 +22,8 @@ type TranscriptProps = {
chatKey: string;
/** A turn is running: the last item is where the agent is right now. */
running: boolean;
+ /** The turn is paused on a question: the card below is the affordance, not a loader. */
+ waiting: boolean;
};
export function Transcript(props: TranscriptProps) {
@@ -36,6 +39,9 @@ export function Transcript(props: TranscriptProps) {
<For each={props.items}>
{(item, index) => <ChatItem item={item} active={props.running && index() === props.items.length - 1} />}
</For>
+ <Show when={props.running && !props.waiting}>
+ <RunningIndicator last={props.items[props.items.length - 1]} />
+ </Show>
</div>
</div>
);
diff --git a/package-lock.json b/package-lock.json
index 135e2e74..364c4bd7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -114,6 +114,7 @@
"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",
@@ -9160,6 +9161,12 @@
}
}
},
+ "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",