Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(chat): pin conversation traces to the left lane

rubenluetke10-beep00552d3f44d8
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
new file mode 100644
index 0000000000..010c065ad3
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.css
@@ -0,0 +1,16 @@
+/* Conversation traces share one left lane. Inner rows used to set their own
+ max width and then center it in the chat pane, so a live or interrupted
+ tool jumped to the middle until it joined the completed fold. */
+[data-testid="work-trace"][data-conversation] {
+ width: 100%;
+ max-width: 36rem;
+ margin-left: 0 !important;
+ margin-right: auto;
+ align-self: flex-start;
+}
+[data-testid="work-trace"][data-conversation] [data-trace-tool],
+[data-testid="work-trace"][data-conversation] [data-trace-summary] {
+ margin-left: 0 !important;
+ margin-right: 0;
+ width: 100%;
+}
diff --git a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
index 46149b49df..a070424ea8 100644
--- a/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
+++ b/jarvis/ui/web/frontend/src/components/agentchat/WorkTrace.tsx
@@ -12,6 +12,7 @@ import { formatTokens, outputTokens } from "./toolView";
import { activityParts, traceToolIdentity } from "./traceActivity";
import { ToolChoiceIcon } from "./ToolChoiceChips";
import { toolIdentityStyle } from "./toolIdentity";
+import "./WorkTrace.css";
export type Decide = (id: string, decision: ApprovalDecision) => void | Promise<void>;
type Group = { id: string; blocks: TurnBlock[]; family: string | null };
@@ -325,7 +326,7 @@ function TraceGroups({ groups, live, status, onDecide, renderText, conversation
const t = useT();
return groups.map(group => {
const first = group.blocks[0];
- if (group.family === "activity" && group.blocks.length > 1) return <div key={group.id} className={cn("py-1", conversation && "w-full max-w-xl")} data-trace-summary>
+ if (group.family === "activity" && group.blocks.length > 1) return <div key={group.id} className={cn("py-1", conversation && "w-full")} data-trace-summary>
<Disclosure label={<ActivitySummary blocks={group.blocks} live={live} />}
icon={<ActivityIcon blocks={group.blocks} live={live} />} initiallyOpen={live}
forced={live}>
@@ -339,8 +340,8 @@ function TraceGroups({ groups, live, status, onDecide, renderText, conversation
icon={<Check aria-hidden className={iconClass} />} initiallyOpen={live}>
{group.blocks.map(block => <TraceTool key={(block as ToolBlock).callId} block={block as ToolBlock} status={status} onDecide={onDecide} />)}
</Disclosure>;
- if (first.kind === "tool") return <div key={group.id} className={conversation ? "w-full max-w-xl py-1 text-xs [&_button]:text-xs" : undefined}><TraceTool block={first} status={status} onDecide={onDecide} /></div>;
- if (first.kind === "reasoning") return <div key={group.id} className={conversation ? "w-full max-w-xl text-xs [&_button]:text-xs" : undefined}><ReasoningTrace block={first} turnLive={live} compact={conversation} /></div>;
+ if (first.kind === "tool") return <div key={group.id} className={conversation ? "w-full py-1 text-xs [&_button]:text-xs" : undefined}><TraceTool block={first} status={status} onDecide={onDecide} /></div>;
+ if (first.kind === "reasoning") return <div key={group.id} className={conversation ? "w-full text-xs [&_button]:text-xs" : undefined}><ReasoningTrace block={first} turnLive={live} compact={conversation} /></div>;
return first.text.trim() ? <div key={group.id} className={cn("min-w-0 py-2", conversation && "w-fit max-w-[min(85%,42rem)] rounded-2xl rounded-bl-md bg-secondary px-4 py-2.5")}>{renderText ? renderText(first.text, first.id) : <div className="prose prose-sm max-w-none text-foreground dark:prose-invert [overflow-wrap:anywhere]"><ChatMarkdown text={first.text} /></div>}</div> : null;
});
}
@@ -361,9 +362,9 @@ export function WorkTrace({ blocks, status, startedMs, durationMs, error, onDeci
const outcome = pending ? "approval" : live ? "working" : status === "error" ? "failed" : status === "cancelled" ? "stopped" : "done";
const Icon = pending ? ShieldQuestion : live ? CircleDashed : status === "error" ? CircleAlert : Check;
const groupProps = { live, status, onDecide, renderText, conversation };
- return <div className={cn("min-w-0 space-y-0.5", className)} data-testid="work-trace" data-state={status}>
+ return <div className={cn("min-w-0 space-y-0.5", conversation && "w-full max-w-xl self-start", className)} data-testid="work-trace" data-state={status} {...(conversation ? { "data-conversation": "" } : {})}>
{fold ? <ConversationWorkFold durationMs={durationMs} attention={fold.work.filter(isAttentionBlock).map(block =>
- <div key={block.callId} className="w-full max-w-xl py-1 text-xs [&_button]:text-xs">
+ <div key={block.callId} className="w-full py-1 text-xs [&_button]:text-xs">
<TraceTool block={block} status={status} onDecide={onDecide} />
</div>)}>
<TraceGroups groups={groups} {...groupProps} />
diff --git a/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx b/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx
index 8ef7b0cdda..20dfe0ebc8 100644
--- a/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/chat/ChatActivity.test.tsx
@@ -41,20 +41,27 @@ it("folds a live manual choice on completion even when the provider never ends r
expect(screen.getByText(block.text)).toBeTruthy();
});
-it("keeps live conversation tool rows left-aligned instead of centering them", () => {
+it("keeps live and interrupted conversation tools in the left lane", () => {
const live: ToolBlock = {
kind: "tool", callId: "live", name: "search_files", input: { pattern: "archive" },
output: null, isError: false, durationMs: null, approval: null, startedMs: 0,
};
- const { container } = render(<WorkTrace conversation status="running" startedMs={0} durationMs={null} blocks={[
- { kind: "reasoning", id: "r", text: "Inspect archive.", live: false, durationMs: 2000, startedMs: 0 },
+ const thought: ReasoningBlock = { kind: "reasoning", id: "r", text: "Inspect archive.", live: false, durationMs: 2000, startedMs: 0 };
+ const { container, rerender } = render(<WorkTrace conversation status="running" startedMs={0} durationMs={null} blocks={[thought, live]} />);
+ const lane = screen.getByTestId("work-trace");
+ expect(lane.hasAttribute("data-conversation")).toBe(true);
+ expect(lane.className).toMatch(/max-w-xl/);
+ expect(lane.className).toMatch(/self-start/);
+ expect(container.querySelectorAll(".mx-auto")).toHaveLength(0);
+ expect(container.querySelector("[data-trace-tool]")?.closest("[data-testid='work-trace']")).toBe(lane);
+ rerender(<WorkTrace conversation status="cancelled" startedMs={0} durationMs={4100} blocks={[
+ thought,
+ { kind: "text", id: "reply", text: "I will send the mail next." },
live,
]} />);
- // A live tool is a singleton group; mx-auto used to park it in the middle of
- // the lane, then snap it left once it joined the completed activity fold.
- const liveRow = container.querySelector("[data-trace-tool]")?.parentElement;
- expect(liveRow?.className ?? "").not.toMatch(/(^|\s)mx-auto(\s|$)/);
+ expect(screen.getByText("Interrupted without a result")).toBeTruthy();
expect(container.querySelectorAll(".mx-auto")).toHaveLength(0);
+ expect(screen.getByTestId("work-trace").className).toMatch(/self-start/);
});
it("keeps a failure visible when the surrounding work is folded", () => {