Skip to content

The IDE you know, rebuilt in Rust. IntelliJ IDEA–style keymap, tool windows and search-everywhere in a fast native app: editor, code insight, debugger, Git, terminal, database and HTTP clients for 60+ languages.

feat(agents): show running/done status on session and terminal tabs (#2233) (#2274)

arookieofc5d8668813019
diff --git a/src/editor/core/controller.ts b/src/editor/core/controller.ts
index 513e9a841..49c2cedff 100644
--- a/src/editor/core/controller.ts
+++ b/src/editor/core/controller.ts
@@ -5,6 +5,7 @@
*/
import { writeClipboardText } from "@/platform/clipboard";
import { pasteEditorClipboard } from "./cm/clipboard";
+import type { ReactNode } from "react";
import { EditorSelection } from "@codemirror/state";
import { create } from "zustand";
import { setContext } from "@/platform/context";
@@ -211,6 +212,16 @@ export function tabIcon(input: EditorInput, kinds: EditorKinds): string {
}
}
+/** A kind's trailing marker (status dot …); `null` when it has none. */
+export function tabTrailing(input: EditorInput, kinds: EditorKinds): ReactNode {
+ const kind = kinds.get(input.kind);
+ try {
+ return kind?.trailing?.(input) ?? null;
+ } catch {
+ return null;
+ }
+}
+
export class EditorController implements SlotHost {
manager: DocumentManager;
readonly slots = new Map<string, EditorSlot>();
diff --git a/src/editor/core/view/EditorArea.tsx b/src/editor/core/view/EditorArea.tsx
index cbf6f7354..79bc6711c 100644
--- a/src/editor/core/view/EditorArea.tsx
+++ b/src/editor/core/view/EditorArea.tsx
@@ -46,7 +46,15 @@ import {
type TabItem,
type TabsDnd,
} from "@/ui";
-import { editorController, isTextInput, tabIcon, tabTitle, useTabs, type VirtualInputData } from "../controller";
+import {
+ editorController,
+ isTextInput,
+ tabIcon,
+ tabTitle,
+ tabTrailing,
+ useTabs,
+ type VirtualInputData,
+} from "../controller";
import { useDocMeta } from "../model/document";
import { inputDirty } from "../model/customDocuments";
import type { LayoutNode, SplitEdge, Tab } from "../model/tabs";
@@ -193,6 +201,8 @@ function PaneView({ paneId }: { paneId: string }) {
: names.filter((n) => n === name).length > 1 && t.input.path
? basename(dirname(t.input.path))
: null;
+ const kindMark = tabTrailing(t.input, kinds);
+ const pin = t.pinned ? <Icon name="pin" size={11} className={styles.pin} label="Pinned" /> : null;
return {
id: t.id,
label: (
@@ -213,7 +223,13 @@ function PaneView({ paneId }: { paneId: string }) {
color: colors[i] || undefined,
tint: tints[i] || undefined,
tooltip: virtualTooltip(t.input) ?? (showFullPathOnHover ? (t.input.path ?? name) : undefined),
- trailing: t.pinned ? <Icon name="pin" size={11} className={styles.pin} label="Pinned" /> : undefined,
+ trailing:
+ kindMark || pin ? (
+ <>
+ {kindMark}
+ {pin}
+ </>
+ ) : undefined,
};
});
}, [
diff --git a/src/features/agents/TaskStatusMark.tsx b/src/features/agents/TaskStatusMark.tsx
new file mode 100644
index 000000000..5ac858f8d
--- /dev/null
+++ b/src/features/agents/TaskStatusMark.tsx
@@ -0,0 +1,25 @@
+/** The tab strip's agent status indicator: spinner while the task is busy, dot once done (#2233). */
+import { Badge, Spinner, tooltipAttrs } from "@/ui";
+import { isBusy, statusLabel } from "./model";
+import { useAgents } from "./store";
+
+export function TaskStatusMark({ task }: { task: string }) {
+ const status = useAgents((s) => s.tasks.get(task)?.status);
+ if (!status) return null;
+ const busy = isBusy(status);
+ const label = statusLabel(status);
+ return (
+ <span {...tooltipAttrs(label, undefined, true)} style={{ display: "inline-flex", alignItems: "center" }}>
+ {busy ? (
+ <Spinner size={10} variant="spokes" label={label} />
+ ) : (
+ <Badge
+ dot
+ tone={status === "ready" ? "success" : status === "failed" || status === "limited" ? "danger" : "neutral"}
+ >
+ {label}
+ </Badge>
+ )}
+ </span>
+ );
+}
diff --git a/src/features/agents/index.ts b/src/features/agents/index.ts
index ce93206ad..b8237c6a3 100644
--- a/src/features/agents/index.ts
+++ b/src/features/agents/index.ts
@@ -3,6 +3,7 @@
* Agents tool window lists tasks by what they need from the user, a task opens as an
* editor tab (conversation + changed files), and New Task is an editor page.
*/
+import { createElement } from "react";
import { registerActions } from "@/platform/actions";
import { useProject } from "@/platform/project";
import { executeAction } from "@/platform/actions";
@@ -22,6 +23,7 @@ import { HOME_KIND, REGISTRY_PAGE, SESSION_KIND, TASK_DRAG, TOOL_WINDOW } from "
import { sendPaths, sendSelection } from "./references";
import { focusedSession } from "./sessionFocus";
import { connect, disconnect, openHome, useAgents } from "./store";
+import { TaskStatusMark } from "./TaskStatusMark";
import { taskActions } from "./taskActions";
import { replyActions } from "./replyActions";
@@ -88,6 +90,8 @@ export function activate(): () => void {
return useAgents.getState().tasks.get(data.task)?.title ?? data.title ?? "Agent Task";
},
icon: () => "toolwindow-agents",
+ // Busy / done marker in the tab's trailing slot (#2233).
+ trailing: (input) => createElement(TaskStatusMark, { task: (input.data as { task: string }).task }),
// Tabs of tasks deleted meanwhile are closed when the tasks load (`connect`).
restorable: true,
// Rebuilding a long conversation on every switch back is slow.
diff --git a/src/features/agents/store.ts b/src/features/agents/store.ts
index aef6944d7..39d45e293 100644
--- a/src/features/agents/store.ts
+++ b/src/features/agents/store.ts
@@ -297,7 +297,7 @@ function onEvent(e: AgentEvent) {
case "task": {
const prev = s.tasks.get(e.task.id);
useAgents.setState({ tasks: new Map(s.tasks).set(e.task.id, e.task) });
- if (prev && prev.title !== e.task.title) notifyTabTitlesChanged();
+ if (prev && (prev.title !== e.task.title || prev.status !== e.task.status)) notifyTabTitlesChanged();
if (e.task.status === "archived") setUnread(e.task.id, false);
else if (attentionChange(prev?.status, e.task.status)) markUnread(e.task.id);
notifyChange(prev, e.task);
diff --git a/src/features/terminal/TerminalView.tsx b/src/features/terminal/TerminalView.tsx
index 8d91a4011..56a5d90e8 100644
--- a/src/features/terminal/TerminalView.tsx
+++ b/src/features/terminal/TerminalView.tsx
@@ -6,6 +6,7 @@ import { ToolWindowHeader, useOwnToolWindowHeader } from "@/workbench/toolwindow
import { usePlatform } from "@/platform/platformInfo";
import { commands, isTauri } from "@/platform/ipc";
import {
+ Badge,
dropZoneAt,
IconButton,
Input,
@@ -13,6 +14,7 @@ import {
Popup,
registerDropTarget,
showContextMenu,
+ Spinner,
SplitGroup,
SplitHandle,
SplitPanel,
@@ -356,8 +358,19 @@ function GroupTabs({ group }: { group: string }) {
const focusRaf = useRef(0);
const items: TabItem[] = tabs.map((t) => {
- const status = sessions[t.session]?.status;
+ const session = sessions[t.session];
+ const status = session?.status;
const dead = status === "exited" || status === "error";
+ // Running / done marker (#2233): a command at work spins, a finished one
+ // shows a filled dot, an idle shell at the prompt shows none.
+ const busy = !!session?.commandRunning || status === "starting";
+ const mark = busy ? (
+ <Spinner size={10} variant="spokes" label="Running" />
+ ) : dead ? (
+ <Badge dot tone={status === "error" ? "danger" : "neutral"}>
+ {status === "error" ? "Failed" : "Exited"}
+ </Badge>
+ ) : null;
return {
id: t.id,
label: tabTitle(t, sessions),
@@ -365,6 +378,7 @@ function GroupTabs({ group }: { group: string }) {
italic: dead,
color: dead ? "var(--fg-subtle)" : undefined,
tooltip: tabTooltip(t, sessions),
+ trailing: mark ?? undefined,
};
});
diff --git a/src/workbench/contributions.ts b/src/workbench/contributions.ts
index e3595695e..1f80c62dd 100644
--- a/src/workbench/contributions.ts
+++ b/src/workbench/contributions.ts
@@ -117,6 +117,8 @@ export interface EditorKindContribution {
component: ComponentType<{ input: EditorInput }>;
title: (input: EditorInput) => string;
icon?: (input: EditorInput) => string;
+ /** Small marker rendered in the tab's trailing slot (a status dot for live state). */
+ trailing?: (input: EditorInput) => ReactNode;
/**
* Its tabs are saved with the editor session and reopened with the project (their
* `data` must be plain JSON). The editor closes tabs whose target is gone itself.