| null;
chatId: string | null;
messageId: string;
+ createdAt?: number | null;
siblingIndex?: number;
siblingTotal?: number;
speaking?: boolean;
@@ -37,6 +39,7 @@
usage,
chatId,
messageId,
+ createdAt = null,
siblingIndex = 0,
siblingTotal = 1,
speaking = false,
@@ -593,7 +596,7 @@
{#if done || siblingTotal > 1}
-
+
{#if siblingTotal > 1}
{/if}
+
{/if}
{/if}
diff --git a/cptr/frontend/src/lib/components/chat/ChatInput.svelte b/cptr/frontend/src/lib/components/chat/ChatInput.svelte
index c7efd5d..cc231e7 100644
--- a/cptr/frontend/src/lib/components/chat/ChatInput.svelte
+++ b/cptr/frontend/src/lib/components/chat/ChatInput.svelte
@@ -20,12 +20,13 @@
import { searchFiles } from '$lib/apis/files';
import { getSkills } from '$lib/apis/skills';
import { uploadFile } from '$lib/apis/files';
- import type { ContextUsage } from '$lib/apis/chat';
+ import type { ChatTask, ContextUsage } from '$lib/apis/chat';
import ModelSelector from '../common/ModelSelector.svelte';
import SendButton from './SendButton.svelte';
import PlusMenu from './PlusMenu.svelte';
import DictateButton from './DictateButton.svelte';
import QueuedMessageItem from './QueuedMessageItem.svelte';
+ import Tasks from './Tasks.svelte';
import Icon from '../Icon.svelte';
import { planMode } from '$lib/stores';
import {
@@ -69,6 +70,7 @@
workspace?: string;
placeholder?: string;
contextUsage?: ContextUsage | null;
+ tasks?: ChatTask[];
queuedMessages?: { id: string; content: string }[];
onsend: () => void;
oncompact?: () => void;
@@ -88,6 +90,7 @@
workspace = '',
placeholder = 'Message...',
contextUsage = null,
+ tasks = [],
queuedMessages = [],
onsend,
oncompact,
@@ -1003,6 +1006,12 @@
}}
role="presentation"
>
+ {#if tasks.length > 0}
+
+
+
+ {/if}
+
{#if queuedMessages.length > 0}
e.preventDefault()}
onclick={() => {
runSlashCommand('skills:list');
@@ -1191,14 +1201,13 @@
placement: 'right'
}}
class="slash-command-row flex items-center gap-2 w-full h-6 px-2 rounded-xl text-xs text-left transition-colors duration-75
- {slashCommandIds[selectedSlashCommandIndex] === 'skills:create'
- ? 'app-interactive-active'
- : ''}"
+ {slashCommandIds[selectedSlashCommandIndex] === 'skills:create' ? 'app-interactive-active' : ''}"
onmousedown={(e) => e.preventDefault()}
onclick={() => {
runSlashCommand('skills:create');
}}
- onmouseenter={() => (selectedSlashCommandIndex = slashCommandIds.indexOf('skills:create'))}
+ onmouseenter={() =>
+ (selectedSlashCommandIndex = slashCommandIds.indexOf('skills:create'))}
>
diff --git a/cptr/frontend/src/lib/components/chat/ChatPanel.svelte b/cptr/frontend/src/lib/components/chat/ChatPanel.svelte
index dd2fb3c..439cffe 100644
--- a/cptr/frontend/src/lib/components/chat/ChatPanel.svelte
+++ b/cptr/frontend/src/lib/components/chat/ChatPanel.svelte
@@ -15,7 +15,8 @@
type ChatMessageRow,
type ChatSendParams,
type ChatInfo,
- type ContextUsage
+ type ContextUsage,
+ type ChatTask
} from '$lib/apis/chat';
import {
chatModels,
@@ -80,6 +81,7 @@
let allMessages = $state([]);
let currentMessageId = $state(null);
let contextUsage = $state(null);
+ let chatTasks = $state([]);
let showStatusModal = $state(false);
let showSkillsModal = $state(false);
let skillsModalList = $state([]);
@@ -107,6 +109,7 @@
let speakingMessageId = $state(null);
let ttsStopRequested = false;
let commandSessionsChatId: string | null = null;
+ let taskClearTimer: ReturnType | null = null;
// This browser memory cache only helps while the current page is open, such as when
// someone taps the same speak button twice. The backend cache is the durable source
// for cross-session reuse and the workspace data flywheel.
@@ -315,6 +318,23 @@
.map((m) => ({ id: m.id, content: m.content }))
);
+ function setChatTasks(tasks: ChatTask[]) {
+ if (taskClearTimer) {
+ clearTimeout(taskClearTimer);
+ taskClearTimer = null;
+ }
+ chatTasks = tasks;
+ if (
+ tasks.length > 0 &&
+ !tasks.some((task) => task.status === 'pending' || task.status === 'in_progress')
+ ) {
+ taskClearTimer = setTimeout(() => {
+ taskClearTimer = null;
+ chatTasks = [];
+ }, 4000);
+ }
+ }
+
$effect(() => {
if (chatId === commandSessionsChatId) return;
commandSessionsChatId = chatId;
@@ -345,6 +365,13 @@
allMessages = data.messages;
currentMessageId = data.chat.current_message_id;
contextUsage = data.context_usage ?? null;
+ setChatTasks(
+ (data.tasks ?? []).some(
+ (task) => task.status === 'pending' || task.status === 'in_progress'
+ )
+ ? (data.tasks ?? [])
+ : []
+ );
// Update tab label with the real title from the DB
if (tabId && data.chat.title) {
chatTitle = data.chat.title;
@@ -418,10 +445,12 @@
let landingRefreshTimer: ReturnType | null = null;
function handleSocketEvent(data: {
+ type?: string;
chat_id: string;
- message_id: string;
+ message_id?: string;
delta?: string;
output?: any;
+ tasks?: ChatTask[];
done?: boolean;
error?: string;
pending_inputs_processed?: boolean;
@@ -454,6 +483,11 @@
if (data.chat_id !== chatId) return;
+ if (data.type === 'chat:tasks') {
+ setChatTasks(data.tasks ?? []);
+ return;
+ }
+
// Title generated by backend — update tab label
if (data.title && tabId) {
updateTab(tabId, data.chat_id, data.title);
@@ -465,6 +499,7 @@
return;
}
+ if (!data.message_id) return;
const msg = allMessages.find((m) => m.id === data.message_id);
if (!msg) return;
@@ -535,6 +570,9 @@
// the DB reload returns. This avoids a transient blank message if the
// final `done` socket event beats the commit/read path.
msg.done = true;
+ if (chatTasks.some((task) => task.status === 'pending' || task.status === 'in_progress')) {
+ setChatTasks([]);
+ }
allMessages = [...allMessages];
loadChat(data.chat_id);
}
@@ -577,6 +615,7 @@
commandSessionsTimer = null;
window.removeEventListener('cptr:inspect-command-session', handleInspectCommandSession);
if (landingRefreshTimer) clearTimeout(landingRefreshTimer);
+ if (taskClearTimer) clearTimeout(taskClearTimer);
// Don't clear streamingChatTabs here -- the global listener in
// chat.ts handles cleanup when the "done" event arrives, so the
// spinner persists even when the chat tab is not active.
@@ -1481,6 +1520,7 @@
{sending}
{workspace}
placeholder={$t('chat.placeholder', { name: workspaceDisplayName })}
+ tasks={chatTasks}
onsend={send}
onstatus={handleStatusCommand}
{queuedMessages}
@@ -1524,6 +1564,7 @@
handleNavigate(msg.id, dir)}
@@ -1537,6 +1578,7 @@
usage={msg.usage}
{chatId}
messageId={msg.id}
+ createdAt={msg.created_at}
{siblingIndex}
siblingTotal={siblingIds.length}
speaking={speakingMessageId === msg.id}
@@ -1590,6 +1632,7 @@
{streaming}
{workspace}
{contextUsage}
+ tasks={chatTasks}
onsend={send}
oncompact={handleManualCompact}
onplan={handlePlanCommand}
diff --git a/cptr/frontend/src/lib/components/chat/MessageTimestamp.svelte b/cptr/frontend/src/lib/components/chat/MessageTimestamp.svelte
new file mode 100644
index 0000000..1d70ca4
--- /dev/null
+++ b/cptr/frontend/src/lib/components/chat/MessageTimestamp.svelte
@@ -0,0 +1,48 @@
+
+
+{#if date && label}
+
+{/if}
diff --git a/cptr/frontend/src/lib/components/chat/Tasks.svelte b/cptr/frontend/src/lib/components/chat/Tasks.svelte
new file mode 100644
index 0000000..6d3d3ad
--- /dev/null
+++ b/cptr/frontend/src/lib/components/chat/Tasks.svelte
@@ -0,0 +1,70 @@
+
+
+{#if tasks.length > 0}
+
+
+
+
+
+ {completedCount}
+ {$t('chat.tasksOutOf')}
+ {totalCount}
+ {$t('chat.tasksCompleted')}
+
+
+
+
+
+ {#if !collapsed}
+
+ {#each tasks as task, idx (task.id)}
+
+
+ {#if task.status === 'completed'}
+
+ {:else if task.status === 'in_progress'}
+
+ {:else if task.status === 'cancelled'}
+
+ {:else}
+
+ {/if}
+
+
+ {idx + 1}. {task.content}
+
+
+ {/each}
+
+ {/if}
+
+{/if}
diff --git a/cptr/frontend/src/lib/components/chat/UserMessage.svelte b/cptr/frontend/src/lib/components/chat/UserMessage.svelte
index af33d6f..ab4b84a 100644
--- a/cptr/frontend/src/lib/components/chat/UserMessage.svelte
+++ b/cptr/frontend/src/lib/components/chat/UserMessage.svelte
@@ -1,6 +1,7 @@