- {visibleSessions.length === 0 ? (
-
- No sessions yet
-
- ) : (
-
- {visibleSessions.map((session) => {
- const duration = formatDuration(session.startedAt, session.status === 'running');
- // Use currentTime to force re-render when timer updates
- void currentTime;
+
+
+ {sortedSessions.length}
+
+
+
+
+
+ Sessions
+
+
+
+
+ {sortedSessions.length === 0 ? (
+
+ No sessions yet
+
+ ) : (
+
+ {sortedSessions.map((session, index) => {
+ const status = mapSessionStatus(session.state);
+ const duration = formatDuration(
+ session.started_at,
+ status === 'running',
+ currentTime
+ );
+ const showDuration = duration !== '0s';
+ const number = sortedSessions.length - index;
- return (
-
handleSelectSession(session.id)}
- className={`w-full flex items-center gap-3 px-2 py-1.5 hover:bg-muted/50 rounded-sm cursor-pointer transition-colors ${
- activeSessionId === session.id ? 'bg-muted/50' : ''
- }`}
- >
- {/* Session Number - Fixed width */}
-
- #{session.number}
-
+ return (
+
handleSelectSession(session.id)}
+ className={`w-full flex items-center gap-3 px-2 py-1.5 hover:bg-muted/50 rounded-sm cursor-pointer transition-colors ${activeSessionId === session.id ? 'bg-muted/50' : ''
+ }`}
+ >
+
+ #{number}
+
- {/* Agent Profile - Flexible width */}
-
- {session.agentProfile}
-
+
+ {resolveAgentLabel(session)}
+
- {/* Duration - Fixed width */}
-
- {duration}
-
+ {showDuration ?
+
+ {duration}
+
+ : ''}
- {/* Status Icon - Fixed width with tooltip */}
-
-
-
- {getStatusIcon(session.status)}
-
-
- {getStatusLabel(session.status)}
-
-
-
-
- {/* Cancel Button - Only for running sessions */}
-
- {session.status === 'running' && (
+
-
+ {getSessionStateIcon(session.state, 'h-3.5 w-3.5')}
- Cancel session
+ {getStatusLabel(status)}
- )}
+
-
- );
- })}
-
- )}
-
-
-
+ );
+ })}
+
+ )}
+
+
+
-
- >
+
+ >
);
}
diff --git a/apps/web/components/task/task-chat-panel.tsx b/apps/web/components/task/task-chat-panel.tsx
index 0921e3e7bc..b986ae9cb8 100644
--- a/apps/web/components/task/task-chat-panel.tsx
+++ b/apps/web/components/task/task-chat-panel.tsx
@@ -27,6 +27,7 @@ import { useSessionMessages } from '@/hooks/use-session-messages';
import { MessageRenderer } from '@/components/task/chat/message-renderer';
import { RunningIndicator } from '@/components/task/chat/messages/running-indicator';
import { TodoSummary } from '@/components/task/chat/todo-summary';
+import { SessionsDropdown } from '@/components/task/sessions-dropdown';
type AgentOption = {
id: string;
@@ -60,7 +61,9 @@ export function TaskChatPanel({
const task = useTask(session?.task_id ?? null);
const taskId = session?.task_id ?? null;
const taskDescription = task?.description ?? null;
- const isWorking = session?.state === 'STARTING' || session?.state === 'RUNNING';
+ const isStarting = session?.state === 'STARTING';
+ const isWorking = isStarting || session?.state === 'RUNNING';
+ const isAgentBusy = session?.state === 'CREATED' || session?.state === 'RUNNING';
// Fetch messages for this session
const { messages, isLoading: messagesLoading } = useSessionMessages(resolvedSessionId);
@@ -317,7 +320,11 @@ export function TaskChatPanel({
value={messageInput}
onChange={setMessageInput}
onSubmit={() => handleSubmit()}
- placeholder="Write to submit work to the agent..."
+ placeholder={
+ agentMessageCount > 0
+ ? 'Continue working on this task...'
+ : 'Write to submit work to the agent...'
+ }
planModeEnabled={planModeEnabled}
/>
@@ -338,7 +345,7 @@ export function TaskChatPanel({
-
@@ -360,7 +367,7 @@ export function TaskChatPanel({
variant="outline"
size="icon"
className={cn(
- 'h-9 w-9 cursor-pointer',
+ 'h-7 w-7 cursor-pointer',
planModeEnabled &&
'bg-primary/15 text-primary border-primary/40 shadow-[0_0_0_1px_rgba(59,130,246,0.35)]'
)}
@@ -377,16 +384,36 @@ export function TaskChatPanel({
+
-
+
Add attachments
-
- Submit
+
+
+ {isAgentBusy ? (
+ <>
+
+ Stop
+ >
+ ) : (
+ 'Submit'
+ )}
+
diff --git a/apps/web/components/task/task-session-sidebar.tsx b/apps/web/components/task/task-session-sidebar.tsx
index b52fc7fa80..135096ce99 100644
--- a/apps/web/components/task/task-session-sidebar.tsx
+++ b/apps/web/components/task/task-session-sidebar.tsx
@@ -2,16 +2,13 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import type { TaskState } from '@/lib/types/http';
-import { TaskSessionSwitcher } from './task-session-switcher';
import { TaskSwitcher } from './task-switcher';
import { Button } from '@kandev/ui/button';
import { IconPlus } from '@tabler/icons-react';
import { TaskCreateDialog } from '@/components/task-create-dialog';
import { useAppStore, useAppStoreApi } from '@/components/state-provider';
-import { getWebSocketClient } from '@/lib/ws/connection';
import { linkToSession } from '@/lib/links';
import { listTaskSessions } from '@/lib/http';
-import { useTaskSessions } from '@/hooks/use-task-sessions';
import { useTasks } from '@/hooks/use-tasks';
type TaskSummary = {
@@ -36,8 +33,8 @@ export function TaskSessionSidebar({ workspaceId, boardId }: TaskSessionSidebarP
const columns = useAppStore((state) => state.kanban.columns);
const workspaces = useAppStore((state) => state.workspaces.items);
const repositoriesByWorkspace = useAppStore((state) => state.repositories.itemsByWorkspaceId);
- const setActiveSession = useAppStore((state) => state.setActiveSession);
const setActiveTask = useAppStore((state) => state.setActiveTask);
+ const setActiveSession = useAppStore((state) => state.setActiveSession);
const setTaskSessionsForTask = useAppStore((state) => state.setTaskSessionsForTask);
const setTaskSessionsLoading = useAppStore((state) => state.setTaskSessionsLoading);
const selectedTaskId = useMemo(() => {
@@ -46,10 +43,7 @@ export function TaskSessionSidebar({ workspaceId, boardId }: TaskSessionSidebarP
}
return activeTaskId;
}, [activeSessionId, activeTaskId, sessionsById]);
- const { sessions: selectedSessions, loadSessions: loadSelectedSessions } = useTaskSessions(selectedTaskId ?? null);
const [taskDialogOpen, setTaskDialogOpen] = useState(false);
- const [sessionDialogOpen, setSessionDialogOpen] = useState(false);
- const [sessionTask, setSessionTask] = useState