Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat(agent-tasks): add agent-scoped task list and refine task UI (#16111)

Arvin Xu3ed3ac02e511
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/task.ts b/apps/server/src/services/toolExecution/serverRuntimes/task.ts
index 9bbaf9f7d01..a9dfbc645d2 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/task.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/task.ts
@@ -150,9 +150,12 @@ export const createTaskRuntime = (deps: TaskRuntimeDeps) => {
},
createTask: async (args: CreateTaskArgs) => {
- const result = await createTaskImpl(args);
- const { identifier: _identifier, ...rest } = result;
- return rest;
+ const { identifier, ...rest } = await createTaskImpl(args);
+ // Surface the created task identifier as plugin state (mirrors the client
+ // executor's `{ identifier, success }`) so the inline render can link to
+ // the task detail. Without this the tool message persists no state and the
+ // card has nothing to open.
+ return identifier ? { ...rest, state: { identifier, success: rest.success } } : rest;
},
createTasks: async (args: { tasks: CreateTaskArgs[] }) => {
diff --git a/locales/en-US/chat.json b/locales/en-US/chat.json
index abfa4f593a4..e7f61cfa2f3 100644
--- a/locales/en-US/chat.json
+++ b/locales/en-US/chat.json
@@ -651,6 +651,8 @@
"taskDetail.artifacts": "Artifacts",
"taskDetail.blockedBy": "Blocked by {{id}}",
"taskDetail.cancelSchedule": "Cancel schedule",
+ "taskDetail.closeDetail": "Close detail",
+ "taskDetail.collapseReply": "Collapse",
"taskDetail.comment.cancel": "Cancel",
"taskDetail.comment.delete": "Delete",
"taskDetail.comment.deleteConfirm.content": "This comment will be permanently removed.",
@@ -677,6 +679,7 @@
"taskDetail.notFound.backToTasks": "Back to all tasks",
"taskDetail.notFound.desc": "This task may have been deleted, or you don't have permission to view it.",
"taskDetail.notFound.title": "Task not found",
+ "taskDetail.openDetail": "Open detail",
"taskDetail.pauseTask": "Pause task",
"taskDetail.priority.high": "High",
"taskDetail.priority.low": "Low",
diff --git a/locales/zh-CN/chat.json b/locales/zh-CN/chat.json
index 6ee4de66d93..9ddf4eaad63 100644
--- a/locales/zh-CN/chat.json
+++ b/locales/zh-CN/chat.json
@@ -651,6 +651,8 @@
"taskDetail.artifacts": "产物",
"taskDetail.blockedBy": "被 {{id}} 阻塞",
"taskDetail.cancelSchedule": "取消定时",
+ "taskDetail.closeDetail": "收起详情",
+ "taskDetail.collapseReply": "收起",
"taskDetail.comment.cancel": "取消",
"taskDetail.comment.delete": "删除",
"taskDetail.comment.deleteConfirm.content": "此评论将被永久删除。",
@@ -677,6 +679,7 @@
"taskDetail.notFound.backToTasks": "返回任务列表",
"taskDetail.notFound.desc": "该任务可能已被删除,或你没有查看权限。",
"taskDetail.notFound.title": "找不到该任务",
+ "taskDetail.openDetail": "展开详情",
"taskDetail.pauseTask": "暂停任务",
"taskDetail.priority.high": "高",
"taskDetail.priority.low": "低",
diff --git a/packages/agent-manager-runtime/src/AgentManagerRuntime.ts b/packages/agent-manager-runtime/src/AgentManagerRuntime.ts
index b0fcc557911..72929741f2d 100644
--- a/packages/agent-manager-runtime/src/AgentManagerRuntime.ts
+++ b/packages/agent-manager-runtime/src/AgentManagerRuntime.ts
@@ -33,6 +33,7 @@ import { LobehubSkillStatus } from '@/store/tool/slices/lobehubSkillStore/types'
import { getUserStoreState } from '@/store/user';
import { userProfileSelectors } from '@/store/user/selectors';
+import { describeHeterogeneousAgent, renderHeteroRuntimeLines } from './heteroAgentDescriptor';
import type {
AgentManagerRuntimeServices,
AgentSearchItem,
@@ -306,6 +307,11 @@ export class AgentManagerRuntime {
// (e.g., description, tags) that aren't on LobeAgentConfig type
const raw = config as Record<string, any>;
+ // Heterogeneous agents (Claude Code / Codex / …) bring their own toolset
+ // and ignore the chat model/plugins. Surface a runtime descriptor so the
+ // orchestrator can reason about what the external agent can actually do.
+ const runtime = describeHeterogeneousAgent(config.agencyConfig);
+
const detail = {
config: {
model: config.model,
@@ -313,6 +319,7 @@ export class AgentManagerRuntime {
openingQuestions: config.openingQuestions,
plugins: config.plugins,
provider: config.provider,
+ ...(runtime && { runtime }),
systemRole: config.systemRole,
},
meta: {
@@ -330,6 +337,7 @@ export class AgentManagerRuntime {
if (detail.config.model)
parts.push(`Model: ${detail.config.provider || ''}/${detail.config.model}`);
if (detail.config.plugins?.length) parts.push(`Plugins: ${detail.config.plugins.join(', ')}`);
+ parts.push(...renderHeteroRuntimeLines(runtime));
if (detail.config.systemRole) {
parts.push(`System Prompt: ${detail.config.systemRole}`);
}
diff --git a/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts b/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts
index 6c88384ab55..4af7523284d 100644
--- a/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts
+++ b/packages/agent-manager-runtime/src/__tests__/AgentManagerRuntime.test.ts
@@ -548,6 +548,50 @@ describe('AgentManagerRuntime', () => {
expect(result.success).toBe(false);
expect(result.content).toContain('not found');
});
+
+ it('should describe a heterogeneous (Claude Code) agent runtime', async () => {
+ vi.mocked(mockAgentService.getAgentConfigById).mockResolvedValue({
+ agencyConfig: {
+ boundDeviceId: 'device-1',
+ executionTarget: 'device',
+ heterogeneousProvider: { type: 'claude-code' },
+ },
+ chatConfig: {} as any,
+ model: 'gpt-4o',
+ params: {} as any,
+ plugins: [],
+ provider: 'openai',
+ title: 'CC 2号机',
+ } as any);
+
+ const result = await runtime.getAgentDetail('cc-agent');
+
+ expect(result.success).toBe(true);
+ expect(result.content).toContain('Claude Code');
+ expect(result.content).toContain('deviceId: device-1');
+ expect((result.state as any).config.runtime).toMatchObject({
+ boundDeviceId: 'device-1',
+ executionTarget: 'device',
+ kind: 'cli',
+ type: 'claude-code',
+ });
+ });
+
+ it('should not add runtime descriptor for a normal model-backed agent', async () => {
+ vi.mocked(mockAgentService.getAgentConfigById).mockResolvedValue({
+ chatConfig: {} as any,
+ model: 'gpt-4o',
+ params: {} as any,
+ plugins: [],
+ provider: 'openai',
+ title: 'Plain Agent',
+ } as any);
+
+ const result = await runtime.getAgentDetail('plain-agent');
+
+ expect(result.success).toBe(true);
+ expect((result.state as any).config.runtime).toBeUndefined();
+ });
});
describe('duplicateAgent', () => {
diff --git a/packages/agent-manager-runtime/src/heteroAgentDescriptor.ts b/packages/agent-manager-runtime/src/heteroAgentDescriptor.ts
new file mode 100644
index 00000000000..204bb2caefc
--- /dev/null
+++ b/packages/agent-manager-runtime/src/heteroAgentDescriptor.ts
@@ -0,0 +1,166 @@
+/**
+ * Heterogeneous-agent descriptor.
+ *
+ * `getAgentDetail` is called by an orchestrator agent (e.g. LobeAI) to decide
+ * whether a target agent is fit for a job — typically "can this agent fix a bug
+ * in a real codebase?". For a normal model-backed agent the answer lives in
+ * `model` / `provider` / `plugins`. For a **heterogeneous** agent (an external
+ * CLI/runtime such as Claude Code or Codex) those fields are misleading: the
+ * agent brings its own toolset and ignores the plugin list, so we must instead
+ * describe what the external runtime is and what it can do.
+ *
+ * This module maps a `LobeAgentAgencyConfig` into a compact, LLM-facing runtime
+ * descriptor plus a few human-readable lines for the tool `content`.
+ */
+import type {
+ DeviceExecutionTarget,
+ HeterogeneousProviderConfig,
+ LobeAgentAgencyConfig,
+} from '@lobechat/types';
+
+type HeteroType = HeterogeneousProviderConfig['type'];
+
+interface HeteroTypeProfile {
+ /** High-level capability tags the orchestrator can reason over. */
+ capabilities: string[];
+ /** One-paragraph capability summary written for the orchestrator LLM. */
+ description: string;
+ /** Friendly product name. */
+ displayName: string;
+ /** Local child-process CLI vs. an agent dispatched to a remote device. */
+ kind: 'cli' | 'remote';
+}
+
+const CODING_CAPABILITIES = [
+ 'filesystem-read',
+ 'filesystem-write',
+ 'shell-commands',
+ 'code-search',
+ 'multi-step-autonomy',
+];
+
+const HETERO_PROFILES: Record<HeteroType, HeteroTypeProfile> = {
+ 'amp': {
+ capabilities: CODING_CAPABILITIES,
+ description:
+ "Amp — Sourcegraph's autonomous coding agent. Reads, edits and writes files, runs shell commands and works across a real codebase to complete software-engineering tasks.",
+ displayName: 'Amp',
+ kind: 'cli',
+ },
+ 'claude-code': {
+ capabilities: CODING_CAPABILITIES,
+ description:
+ "Claude Code — Anthropic's autonomous CLI coding agent. It has full access to a working directory: it can read, edit and write files, run shell commands and tests, search the codebase, and carry multi-step software-engineering tasks (bug fixes, feature work, refactors) end to end on its own. It does NOT use the chat `plugins`/`model` settings — it runs its own built-in toolset and model.",
+ displayName: 'Claude Code',
+ kind: 'cli',
+ },
+ 'codex': {
+ capabilities: CODING_CAPABILITIES,
+ description:
+ "Codex — OpenAI's autonomous CLI coding agent. It has full access to a working directory: it can read, edit and write files, run shell commands and tests, and complete multi-step software-engineering tasks autonomously. It does NOT use the chat `plugins`/`model` settings — it runs its own built-in toolset and model.",
+ displayName: 'Codex',
+ kind: 'cli',
+ },
+ 'hermes': {
+ capabilities: CODING_CAPABILITIES,
+ description:
+ 'Hermes — a remote autonomous agent runtime that runs on a connected device and can read, edit and write files and run commands in its workspace.',
+ displayName: 'Hermes',
+ kind: 'remote',
+ },
+ 'opencode': {
+ capabilities: CODING_CAPABILITIES,
+ description:
+ 'OpenCode — an open-source terminal coding agent with filesystem and shell access that completes software-engineering tasks autonomously.',
+ displayName: 'OpenCode',
+ kind: 'cli',
+ },
+ 'openclaw': {
+ capabilities: CODING_CAPABILITIES,
+ description:
+ 'OpenClaw — a remote autonomous agent platform. It runs on a connected device with full filesystem and shell access to its workspace.',
+ displayName: 'OpenClaw',
+ kind: 'remote',
+ },
+};
+
+const EXECUTION_TARGET_DESCRIPTIONS: Record<DeviceExecutionTarget, string> = {
+ auto: 'auto-selected online device (one is activated automatically; with several the agent picks one)',
+ device: 'a specific device connected via `lh connect`',
+ local: "in-process on the user's desktop",
+ none: 'no execution environment (plain chat)',
+ sandbox: 'a server-spawned cloud sandbox',
+};
+
+/**
+ * LLM-facing runtime descriptor for a heterogeneous agent. Surfaced in
+ * `GetAgentDetailState.config.runtime`.
+ */
+export interface HeteroAgentRuntimeDescriptor {
+ /** Device this agent is bound to, when `executionTarget === 'device'`. */
+ boundDeviceId?: string;
+ /** High-level capability tags. */
+ capabilities: string[];
+ /** Human-readable capability summary for the orchestrator. */
+ description: string;
+ /** Friendly product name (e.g. "Claude Code"). */
+ displayName: string;
+ /** Where the agent executes. */
+ executionTarget?: DeviceExecutionTarget;
+ /** Local CLI child-process vs. remote device runtime. */
+ kind: 'cli' | 'remote';
+ /** Runtime type identifier (e.g. `claude-code`, `codex`). */
+ type: HeteroType;
+}
+
+/**
+ * Build a runtime descriptor for a heterogeneous agent, or `undefined` when the
+ * agent is a normal model-backed chat agent (no `heterogeneousProvider`).
+ */
+export const describeHeterogeneousAgent = (
+ agencyConfig: LobeAgentAgencyConfig | undefined,
+): HeteroAgentRuntimeDescriptor | undefined => {
+ const provider = agencyConfig?.heterogeneousProvider;
+ if (!provider?.type) return undefined;
+
+ const profile = HETERO_PROFILES[provider.type];
+ if (!profile) return undefined;
+
+ return {
+ boundDeviceId: agencyConfig?.boundDeviceId,
+ capabilities: profile.capabilities,
+ description: profile.description,
+ displayName: profile.displayName,
+ executionTarget: agencyConfig?.executionTarget,
+ kind: profile.kind,
+ type: provider.type,
+ };
+};
+
+/**
+ * Render the runtime descriptor into human-readable lines for the tool
+ * `content`. Returns an empty array for non-hetero agents.
+ */
+export const renderHeteroRuntimeLines = (
+ descriptor: HeteroAgentRuntimeDescriptor | undefined,
+): string[] => {
+ if (!descriptor) return [];
+
+ const lines: string[] = [
+ `Runtime: ${descriptor.displayName} (heterogeneous \`${descriptor.type}\` agent — ignores the chat model/plugins settings above)`,
+ descriptor.description,
+ ];
+
+ if (descriptor.executionTarget) {
+ const where = EXECUTION_TARGET_DESCRIPTIONS[descriptor.executionTarget];
+ lines.push(
+ `Runs on: ${where}${
+ descriptor.executionTarget === 'device' && descriptor.boundDeviceId
+ ? ` (deviceId: ${descriptor.boundDeviceId})`
+ : ''
+ }`,
+ );
+ }
+
+ return lines;
+};
diff --git a/packages/agent-manager-runtime/src/index.ts b/packages/agent-manager-runtime/src/index.ts
index 72d61cfa4e7..e883190a637 100644
--- a/packages/agent-manager-runtime/src/index.ts
+++ b/packages/agent-manager-runtime/src/index.ts
@@ -1,2 +1,7 @@
export { AgentManagerRuntime } from './AgentManagerRuntime';
+export {
+ describeHeterogeneousAgent,
+ type HeteroAgentRuntimeDescriptor,
+ renderHeteroRuntimeLines,
+} from './heteroAgentDescriptor';
export * from './types';
diff --git a/packages/builtin-tool-agent-management/src/manifest.ts b/packages/builtin-tool-agent-management/src/manifest.ts
index 3be4f41d68c..6bf7d9d8b0a 100644
--- a/packages/builtin-tool-agent-management/src/manifest.ts
+++ b/packages/builtin-tool-agent-management/src/manifest.ts
@@ -159,7 +159,7 @@ export const AgentManagementManifest: BuiltinToolManifest = {
{
description:
- 'Get the detailed configuration and metadata of an agent, including its system prompt, model, provider, plugins, and other settings.',
+ 'Get the detailed configuration and metadata of an agent, including its system prompt, model, provider, plugins, and other settings. For heterogeneous agents (external CLI/runtime such as Claude Code or Codex) the result also describes the external runtime and its capabilities (filesystem/shell access, where it runs) — use this to judge whether the agent can carry out coding/software-engineering tasks.',
name: AgentManagementApiName.getAgentDetail,
parameters: {
properties: {
diff --git a/packages/builtin-tool-agent-management/src/types.ts b/packages/builtin-tool-agent-management/src/types.ts
index 128cc0a9ebe..2ae1563301f 100644
--- a/packages/builtin-tool-agent-management/src/types.ts
+++ b/packages/builtin-tool-agent-management/src/types.ts
@@ -1,3 +1,4 @@
+import type { HeteroAgentRuntimeDescriptor } from '@lobechat/agent-manager-runtime';
import type { LobeAgentConfig, MetaData } from '@lobechat/types';
import type { PartialDeep } from 'type-fest';
@@ -323,6 +324,12 @@ export interface GetAgentDetailState {
openingQuestions?: string[];
plugins?: string[];
provider?: string;
+ /**
+ * Present only for heterogeneous agents (external CLI/runtime such as Claude
+ * Code or Codex). Describes what the external runtime is and what it can do;
+ * such agents ignore the `model`/`plugins` fields above.
+ */
+ runtime?: HeteroAgentRuntimeDescriptor;
systemRole?: string;
};
/**
diff --git a/packages/builtin-tool-task/src/client/Render/CreateTask/index.tsx b/packages/builtin-tool-task/src/client/Render/CreateTask/index.tsx
index 1de6cf75f11..5627c6d7576 100644
--- a/packages/builtin-tool-task/src/client/Render/CreateTask/index.tsx
+++ b/packages/builtin-tool-task/src/client/Render/CreateTask/index.tsx
@@ -1,19 +1,22 @@
'use client';
import type { BuiltinRenderProps } from '@lobechat/types';
-import { Block, Text } from '@lobehub/ui';
+import { ActionIcon, Block, Text } from '@lobehub/ui';
import { createStaticStyles, cssVar } from 'antd-style';
-import { memo } from 'react';
+import { PanelRight, PanelRightClose } from 'lucide-react';
+import { memo, useEffect, useRef } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
import type { CreateTaskParams, CreateTaskState } from '../../../types';
+// Tracks task identifiers we've already auto-expanded so re-mounting the card
+// (scrolling the message back into view) doesn't reopen a portal the user closed.
+const autoOpened = new Set<string>();
+
const styles = createStaticStyles(({ css, cssVar }) => ({
- body: css`
- display: flex;
- flex-direction: column;
- gap: 4px;
- min-width: 0;
- `,
identifier: css`
flex-shrink: 0;
@@ -51,27 +54,82 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
padding-inline: 12px;
`,
title: css`
+ overflow: hidden;
+ flex: 1;
+
+ min-width: 0;
+
font-size: 13px;
line-height: 1.4;
color: ${cssVar.colorText};
+ text-overflow: ellipsis;
+ white-space: nowrap;
`,
}));
export const CreateTaskRender = memo<BuiltinRenderProps<CreateTaskParams, CreateTaskState>>(
({ args, pluginState }) => {
- if (!args?.name && !pluginState?.identifier) return null;
+ const { t } = useTranslation('chat');
+ const [activeTaskDetailId, showTaskDetail, openTaskDetail, closeTaskDetail] = useChatStore(
+ (s) => [
+ chatPortalSelectors.taskDetailId(s),
+ chatPortalSelectors.showTaskDetail(s),
+ s.openTaskDetail,
+ s.closeTaskDetail,
+ ],
+ );
const identifier = pluginState?.identifier;
+ // Identifier present at first render means this card mounted already-resolved
+ // (e.g. an old task when reopening the conversation) — only the fresh
+ // undefined → defined transition counts as "just created".
+ const identifierAtMount = useRef(identifier);
+
+ // Once the task is freshly created, auto-expand its detail in the right-side
+ // portal so the user can review it without leaving the conversation.
+ useEffect(() => {
+ if (!identifier || identifierAtMount.current === identifier) return;
+ if (autoOpened.has(identifier)) return;
+ autoOpened.add(identifier);
+ openTaskDetail(identifier);
+ }, [identifier, openTaskDetail]);
+
+ if (!args?.name && !identifier) return null;
+
const name = args?.name;
const instruction = args?.instruction;
const parent = args?.parentIdentifier;
+ const isExpanded = !!identifier && showTaskDetail && activeTaskDetailId === identifier;
+
+ const toggle = () => {
+ if (!identifier) return;
+ if (isExpanded) closeTaskDetail();
+ else openTaskDetail(identifier);
+ };
return (
- <Block variant={'outlined'} width={'100%'}>
+ <Block
+ clickable={!!identifier}
+ variant={'outlined'}
+ width={'100%'}
+ onClick={identifier ? () => openTaskDetail(identifier) : undefined}
+ >
<div className={styles.taskItem}>
<div className={styles.row}>
{identifier && <span className={styles.identifier}>{identifier}</span>}
{name && <Text className={styles.title}>{name}</Text>}
+ {identifier && (
+ <ActionIcon
+ active={isExpanded}
+ icon={isExpanded ? PanelRightClose : PanelRight}
+ size={'small'}
+ title={t(isExpanded ? 'taskDetail.closeDetail' : 'taskDetail.openDetail')}
+ onClick={(e) => {
+ e.stopPropagation();
+ toggle();
+ }}
+ />
+ )}
</div>
{instruction && <div className={styles.instruction}>{instruction}</div>}
{parent && (
diff --git a/packages/locales/src/default/chat.ts b/packages/locales/src/default/chat.ts
index 24e97fca7cb..af402863411 100644
--- a/packages/locales/src/default/chat.ts
+++ b/packages/locales/src/default/chat.ts
@@ -784,6 +784,7 @@ export default {
'taskDetail.comment.save': 'Save',
'taskDetail.commentPlaceholder':
'Leave feedback to guide the agent — your comments shape the next run...',
+ 'taskDetail.collapseReply': 'Collapse',
'taskDetail.replyInThread': 'Reply in this thread',
'taskDetail.replyPlaceholder': 'Reply in this thread...',
'taskDetail.sendFollowUp': 'Send follow up message',
@@ -809,6 +810,8 @@ export default {
'taskDetail.runTask': 'Run',
'taskDetail.stopTask': 'Stop task',
'taskDetail.navigation': 'Navigation',
+ 'taskDetail.closeDetail': 'Close detail',
+ 'taskDetail.openDetail': 'Open detail',
'taskDetail.notFound.backToTasks': 'Back to all tasks',
'taskDetail.notFound.desc':
"This task may have been deleted, or you don't have permission to view it.",
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailAssignee.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailAssignee.tsx
index 05d60582eda..d890583749f 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailAssignee.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailAssignee.tsx
@@ -5,6 +5,9 @@ import { UserCircle2 } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import HeterogeneousTag from '@/features/HeterogeneousTag';
+import { useHomeStore } from '@/store/home';
+import { homeAgentListSelectors } from '@/store/home/selectors';
import { useTaskStore } from '@/store/task';
import { taskDetailSelectors } from '@/store/task/selectors';
@@ -18,6 +21,10 @@ const TaskDetailAssignee = memo(() => {
const status = useTaskStore(taskDetailSelectors.activeTaskStatus) as TaskStatus | undefined;
const assigneeAgentId = useTaskStore(taskDetailSelectors.activeTaskAgentId);
const assigneeMeta = useAgentDisplayMeta(assigneeAgentId);
+ // Same source as the home list so the runtime tag stays consistent.
+ const assigneeHeterogeneousType = useHomeStore(
+ (s) => homeAgentListSelectors.getAgentById(assigneeAgentId ?? '')(s)?.heterogeneousType,
+ );
const { isDarkMode } = useThemeMode();
if (!taskId) return null;
@@ -43,6 +50,7 @@ const TaskDetailAssignee = memo(() => {
<>
<AssigneeAvatar agentId={assigneeAgentId} size={20} />
<Text weight={500}>{assigneeMeta?.title}</Text>
+ <HeterogeneousTag type={assigneeHeterogeneousType} />
</>
) : (
<>
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx
index bc0aff15fea..f4a2c99e81f 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx
@@ -1,5 +1,5 @@
import { Button, Flexbox } from '@lobehub/ui';
-import { memo, useEffect } from 'react';
+import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router';
@@ -16,18 +16,10 @@ import { useTaskStore } from '@/store/task';
import { taskDetailSelectors } from '@/store/task/selectors';
import Breadcrumb from '../shared/Breadcrumb';
-import TaskActivities from './TaskActivities';
-import TaskArtifacts from './TaskArtifacts';
-import TaskDetailAssignee from './TaskDetailAssignee';
import TaskDetailHeaderActions from './TaskDetailHeaderActions';
-import TaskDetailRunPauseAction from './TaskDetailRunPauseAction';
-import TaskDetailTitleInput from './TaskDetailTitleInput';
-import TaskInstruction from './TaskInstruction';
-import TaskModelConfig from './TaskModelConfig';
-import TaskParentBar from './TaskParentBar';
-import TaskProperties from './TaskProperties';
-import TaskSubtasks from './TaskSubtasks';
+import TaskDetailSections from './TaskDetailSections';
import TopicChatDrawer from './TopicChatDrawer';
+import { useActiveTaskDetail } from './useActiveTaskDetail';
interface TaskDetailPageProps {
showTaskAgentPanelToggle?: boolean;
@@ -36,27 +28,13 @@ interface TaskDetailPageProps {
const TaskDetailPage = memo<TaskDetailPageProps>(({ taskId, showTaskAgentPanelToggle = true }) => {
const { t } = useTranslation('chat');
- const setActiveTaskId = useTaskStore((s) => s.setActiveTaskId);
- const useFetchTaskDetail = useTaskStore((s) => s.useFetchTaskDetail);
const saveStatus = useTaskStore(taskDetailSelectors.taskSaveStatus);
- const hasTaskDetail = useTaskStore((s) => !!s.taskDetailMap[taskId]);
const [showTaskAgentPanel, toggleTaskAgentPanel] = useGlobalStore((s) => [
systemStatusSelectors.showTaskAgentPanel(s),
s.toggleTaskAgentPanel,
]);
- useEffect(() => {
- setActiveTaskId(taskId);
- return () => setActiveTaskId(undefined);
- }, [taskId, setActiveTaskId]);
-
- const { isLoading } = useFetchTaskDetail(taskId);
-
- const isInitialLoading = isLoading && !hasTaskDetail;
- // Only treat as not-found when there is no cached detail and the initial fetch
- // has settled. A transient revalidation error (focus/reconnect/poll/5xx) must not
- // hide an already-loaded task behind the 404 fallback.
- const isNotFound = !isLoading && !hasTaskDetail;
+ const { isInitialLoading, isNotFound } = useActiveTaskDetail(taskId);
if (isNotFound) {
return (
@@ -108,32 +86,7 @@ const TaskDetailPage = memo<TaskDetailPageProps>(({ taskId, showTaskAgentPanelTo
/>
<Flexbox flex={1} style={{ minHeight: 0, overflowY: 'auto' }}>
<WideScreenContainer>
- {isInitialLoading ? (
- <Loading debugId="TaskDetail" />
- ) : (
- <>
- <Flexbox gap={4} style={{ paddingBlock: '24px 36px' }}>
- <TaskDetailTitleInput />
- <Flexbox horizontal align={'flex-start'} gap={16} justify={'space-between'}>
- <Flexbox align={'flex-start'} flex={1} gap={16}>
- <TaskParentBar />
- <Flexbox horizontal align={'center'} gap={8}>
- <TaskDetailAssignee />
- <TaskModelConfig />
- </Flexbox>
- <TaskDetailRunPauseAction />
- </Flexbox>
- <TaskProperties />
- </Flexbox>
- </Flexbox>
- <Flexbox gap={24} style={{ paddingBottom: 120 }}>
- <TaskInstruction />
- <TaskSubtasks />
- <TaskArtifacts />
- <TaskActivities />
- </Flexbox>
- </>
- )}
+ {isInitialLoading ? <Loading debugId="TaskDetail" /> : <TaskDetailSections />}
</WideScreenContainer>
</Flexbox>
<TopicChatDrawer />
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx
new file mode 100644
index 00000000000..928d63a007a
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailSections.tsx
@@ -0,0 +1,48 @@
+import { Flexbox } from '@lobehub/ui';
+import { memo } from 'react';
+
+import TaskActivities from './TaskActivities';
+import TaskArtifacts from './TaskArtifacts';
+import TaskDetailAssignee from './TaskDetailAssignee';
+import TaskDetailRunPauseAction from './TaskDetailRunPauseAction';
+import TaskDetailTitleInput from './TaskDetailTitleInput';
+import TaskInstruction from './TaskInstruction';
+import TaskModelConfig from './TaskModelConfig';
+import TaskParentBar from './TaskParentBar';
+import TaskProperties from './TaskProperties';
+import TaskSubtasks from './TaskSubtasks';
+
+/**
+ * The scrollable body sections of a task detail, shared by the full-page
+ * `/task/[tid]` route and the chat-side Portal. All children read the active
+ * task from the task store, so the host is responsible for setting
+ * `activeTaskId` (e.g. via `setActiveTaskId`) before rendering this.
+ */
+const TaskDetailSections = memo(() => {
+ return (
+ <>
+ <Flexbox gap={4} style={{ paddingBlock: '24px 36px' }}>
+ <TaskDetailTitleInput />
+ <Flexbox horizontal align={'flex-start'} gap={16} justify={'space-between'}>
+ <Flexbox align={'flex-start'} flex={1} gap={16}>
+ <TaskParentBar />
+ <Flexbox horizontal align={'center'} gap={8}>
+ <TaskDetailAssignee />
+ <TaskModelConfig />
+ </Flexbox>
+ <TaskDetailRunPauseAction />
+ </Flexbox>
+ <TaskProperties />
+ </Flexbox>
+ </Flexbox>
+ <Flexbox gap={24} style={{ paddingBottom: 120 }}>
+ <TaskInstruction />
+ <TaskSubtasks />
+ <TaskArtifacts />
+ <TaskActivities />
+ </Flexbox>
+ </>
+ );
+});
+
+export default TaskDetailSections;
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskModelConfig.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskModelConfig.tsx
index f0fefbf155d..267ed8c9719 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskModelConfig.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskModelConfig.tsx
@@ -3,7 +3,7 @@ import { memo, useCallback } from 'react';
import ModelSelect from '@/features/ModelSelect';
import { usePermission } from '@/hooks/usePermission';
import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
+import { agentByIdSelectors, agentSelectors } from '@/store/agent/selectors';
import { useTaskStore } from '@/store/task';
import { taskDetailSelectors } from '@/store/task/selectors';
@@ -12,10 +12,26 @@ const TaskModelConfig = memo(() => {
const taskId = useTaskStore(taskDetailSelectors.activeTaskId);
const taskModel = useTaskStore(taskDetailSelectors.activeTaskModel);
const taskProvider = useTaskStore(taskDetailSelectors.activeTaskProvider);
+ const assigneeAgentId = useTaskStore(taskDetailSelectors.activeTaskAgentId);
const updateTaskModelConfig = useTaskStore((s) => s.updateTaskModelConfig);
- const agentModel = useAgentStore(agentSelectors.currentAgentModel);
- const agentProvider = useAgentStore(agentSelectors.currentAgentModelProvider);
+ // Fall back to the *assignee* agent's model, not whatever agent is active in
+ // the surrounding chat (e.g. a Portal opened from an orchestrator). The detail
+ // surface front-loads the assignee config (see `useActiveTaskDetail`), so this
+ // resolves correctly. Only an unassigned task falls back to the active agent.
+ const agentModel = useAgentStore((s) =>
+ assigneeAgentId
+ ? agentByIdSelectors.getAgentModelById(assigneeAgentId)(s)
+ : agentSelectors.currentAgentModel(s),
+ );
+ const agentProvider = useAgentStore((s) =>
+ assigneeAgentId
+ ? agentByIdSelectors.getAgentModelProviderById(assigneeAgentId)(s)
+ : agentSelectors.currentAgentModelProvider(s),
+ );
+ const isHeterogeneous = useAgentStore(
+ agentByIdSelectors.isAgentHeterogeneousById(assigneeAgentId ?? ''),
+ );
const model = taskModel || agentModel || '';
const provider = taskProvider || agentProvider || '';
@@ -29,6 +45,10 @@ const TaskModelConfig = memo(() => {
[canEditTask, taskId, updateTaskModelConfig],
);
+ // Heterogeneous agents (e.g. Claude Code) run on their own external runtime,
+ // so the model is not user-selectable — hide the picker entirely.
+ if (isHeterogeneous) return null;
+
return (
<ModelSelect
initialWidth
diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
index 65c9329b416..31691b5c7cb 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/FeedbackInput.tsx
@@ -1,12 +1,13 @@
import { ChatInput, ChatInputActionBar, SendButton, useEditor } from '@lobehub/editor/react';
-import { Button } from '@lobehub/ui';
+import { Button, Flexbox } from '@lobehub/ui';
import { $getRoot } from 'lexical';
-import { MessageCirclePlus } from 'lucide-react';
+import { ChevronDownIcon, MessageCirclePlus } from 'lucide-react';
import { memo, useCallback, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { AttachmentUploadButton } from '@/features/AttachmentInput';
import { useConversationStore } from '@/features/Conversation';
+import OpStatusTray from '@/features/Conversation/ChatInput/OpStatusTray';
import { EditorCanvas } from '@/features/EditorCanvas';
import {
getAttachmentFileIdsFromEditor,
@@ -78,49 +79,70 @@ const FeedbackInput = memo(() => {
}
}, [editor, sendMessage, submitting]);
+ // Mirror Fleet's ReplyArea: surface the live running-op status flush above the
+ // reply affordance (seamless inline row that renders nothing when idle), so the
+ // user can watch the agent work without expanding the composer.
if (!expanded) {
return (
- <Button block icon={MessageCirclePlus} variant={'filled'} onClick={() => setExpanded(true)}>
- {t('taskDetail.sendFollowUp')}
- </Button>
+ <Flexbox gap={8}>
+ <OpStatusTray seamless />
+ <Button block icon={MessageCirclePlus} variant={'filled'} onClick={() => setExpanded(true)}>
+ {t('taskDetail.sendFollowUp')}
+ </Button>
+ </Flexbox>
);
}
return (
- <ChatInput
- maxHeight={240}
- minHeight={64}
- footer={
- <ChatInputActionBar
- left={<AttachmentUploadButton onFiles={handleAttach} />}
- style={{ paddingInline: 8 }}
- right={
- <SendButton
- disabled={!canSubmit && !submitting}
- loading={submitting}
- shape={'round'}
- title={t('taskDetail.replyInThread')}
- type={'primary'}
- onClick={handleSubmit}
- />
- }
+ <Flexbox gap={8}>
+ <OpStatusTray seamless />
+ <ChatInput
+ maxHeight={240}
+ minHeight={64}
+ footer={
+ <ChatInputActionBar
+ style={{ paddingInline: 8 }}
+ left={
+ <Flexbox horizontal align={'center'} gap={2}>
+ <Button
+ icon={ChevronDownIcon}
+ size={'small'}
+ type={'text'}
+ onClick={() => setExpanded(false)}
+ >
+ {t('taskDetail.collapseReply')}
+ </Button>
+ <AttachmentUploadButton onFiles={handleAttach} />
+ </Flexbox>
+ }
+ right={
+ <SendButton
+ disabled={!canSubmit && !submitting}
+ loading={submitting}
+ shape={'round'}
+ title={t('taskDetail.replyInThread')}
+ type={'primary'}
+ onClick={handleSubmit}
+ />
+ }
+ />
+ }
+ >
+ <EditorCanvas
+ editor={editor}
+ floatingToolbar={false}
+ placeholder={t('taskDetail.replyPlaceholder')}
+ style={{ paddingBlock: 0 }}
+ onContentChange={handleContentChange}
+ onPressEnter={({ event }) => {
+ if (shouldSendOnEnter(event)) {
+ handleSubmit();
+ return true;
+ }
+ }}
/>
- }
- >
- <EditorCanvas
- editor={editor}
- floatingToolbar={false}
- placeholder={t('taskDetail.replyPlaceholder')}
- style={{ paddingBlock: 0 }}
- onContentChange={handleContentChange}
- onPressEnter={({ event }) => {
- if (shouldSendOnEnter(event)) {
- handleSubmit();
- return true;
- }
- }}
- />
- </ChatInput>
+ </ChatInput>
+ </Flexbox>
);
});
diff --git a/src/features/AgentTasks/AgentTaskDetail/index.tsx b/src/features/AgentTasks/AgentTaskDetail/index.tsx
index 8faa9a7ddf8..0912232cb38 100644
--- a/src/features/AgentTasks/AgentTaskDetail/index.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/index.tsx
@@ -1 +1,4 @@
export { default as TaskDetailPage } from './TaskDetailPage';
+export { default as TaskDetailSections } from './TaskDetailSections';
+export { default as TopicChatDrawer } from './TopicChatDrawer';
+export { useActiveTaskDetail } from './useActiveTaskDetail';
diff --git a/src/features/AgentTasks/AgentTaskDetail/useActiveTaskDetail.ts b/src/features/AgentTasks/AgentTaskDetail/useActiveTaskDetail.ts
new file mode 100644
index 00000000000..5ec41b894d0
--- /dev/null
+++ b/src/features/AgentTasks/AgentTaskDetail/useActiveTaskDetail.ts
@@ -0,0 +1,74 @@
+import { useEffect } from 'react';
+
+import { useAgentStore } from '@/store/agent';
+import { useTaskStore } from '@/store/task';
+import { useUserStore } from '@/store/user';
+import { authSelectors } from '@/store/user/selectors';
+
+interface ActiveTaskDetailState {
+ /**
+ * Hard loading gate: the first task snapshot isn't ready yet, OR it is but the
+ * assignee agent's config (model / heterogeneous runtime) hasn't hydrated. The
+ * detail surfaces depend on the assignee config to render the model picker
+ * correctly, so we hold the skeleton until it lands.
+ */
+ isInitialLoading: boolean;
+ /** The task fetch settled with an error and there is no cached detail. */
+ isNotFound: boolean;
+}
+
+/**
+ * Shared task-detail data wiring for every surface that shows a single task
+ * (the full `/task/[tid]` page and the chat-side Portal). Owns `activeTaskId`
+ * while mounted, drives the polling task fetch, and front-loads the assignee
+ * agent's config into the agent store so model / heterogeneous-runtime reads
+ * resolve against the *assignee* — not whatever agent happens to be active in
+ * the surrounding chat. Returning only loading/not-found flags keeps each
+ * surface free to own its own chrome.
+ */
+export const useActiveTaskDetail = (taskId?: string): ActiveTaskDetailState => {
+ const isLogin = useUserStore(authSelectors.isLogin);
+ const setActiveTaskId = useTaskStore((s) => s.setActiveTaskId);
+ const useFetchTaskDetail = useTaskStore((s) => s.useFetchTaskDetail);
+ const useHydrateAgentConfig = useAgentStore((s) => s.useHydrateAgentConfig);
+
+ const hasTaskDetail = useTaskStore((s) => (taskId ? !!s.taskDetailMap[taskId] : false));
+ // The assignee comes from the loaded task detail, so this stays undefined
+ // until the first fetch resolves — which is exactly when its hydration kicks in.
+ const assigneeAgentId = useTaskStore((s) =>
+ taskId ? (s.taskDetailMap[taskId]?.agentId ?? undefined) : undefined,
+ );
+ const assigneeInMap = useAgentStore((s) => !!(assigneeAgentId && s.agentMap[assigneeAgentId]));
+
+ useEffect(() => {
+ if (!taskId) return;
+ setActiveTaskId(taskId);
+ return () => setActiveTaskId(undefined);
+ }, [taskId, setActiveTaskId]);
+
+ // `fetchTaskDetail` throws on a missing task, so `error` is the definitive
+ // "settled and absent" signal — using it (instead of `!isLoading`) avoids the
+ // first-paint flash where no fetch has run yet but the cache is still empty.
+ const { error: taskError } = useFetchTaskDetail(taskId);
+
+ // Hydrate-only (never touches `activeAgentId`); no-ops on an empty id, so it
+ // simply activates once the assignee is known from the task detail.
+ const { error: agentConfigError } = useHydrateAgentConfig(isLogin, assigneeAgentId ?? '');
+
+ if (!taskId) return { isInitialLoading: false, isNotFound: false };
+
+ const isNotFound = !!taskError && !hasTaskDetail;
+ // Anything that isn't "we have the detail" or "it's confirmed gone" is still
+ // resolving — keep the skeleton up instead of flashing empty/404.
+ const isTaskResolving = !hasTaskDetail && !isNotFound;
+
+ // Block on the assignee config only when there is one and a fetch can run;
+ // release on success (in map) or failure (error) so we never deadlock.
+ const isAssigneeResolving =
+ !!assigneeAgentId && isLogin === true && !assigneeInMap && !agentConfigError;
+
+ return {
+ isInitialLoading: isTaskResolving || (hasTaskDetail && isAssigneeResolving),
+ isNotFound,
+ };
+};
diff --git a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx
index 2c815a4de31..beb83b40fb5 100644
--- a/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx
+++ b/src/features/AgentTasks/AgentTaskList/AgentTasksPage.tsx
@@ -46,13 +46,21 @@ export const getTaskCreateActionBehavior = ({
} as const;
};
-const AgentTasksPage = memo(() => {
+interface AgentTasksPageProps {
+ /**
+ * When provided, the page is scoped to a single agent's tasks; otherwise it
+ * shows tasks across all agents.
+ */
+ agentId?: string;
+}
+
+const AgentTasksPage = memo<AgentTasksPageProps>(({ agentId }) => {
const navigate = useWorkspaceAwareNavigate();
const isMobile = useIsMobile();
const { allowed: canCreateTask, reason } = usePermission('create_content');
const viewMode = useTaskStore(taskListSelectors.viewMode);
const useFetchTaskList = useTaskStore((s) => s.useFetchTaskList);
- useFetchTaskList({ allAgents: true });
+ useFetchTaskList(agentId ? { agentId } : { allAgents: true });
const isEmptyHero = useTaskStore(taskListSelectors.isListEmpty);
const rawViewOptions = useGlobalStore(systemStatusSelectors.taskListViewOptions);
const viewOptions = useMemo(() => normalizeTaskListViewOptions(rawViewOptions), [rawViewOptions]);
@@ -88,11 +96,13 @@ const AgentTasksPage = memo(() => {
if (!canCreateTask) return;
createTaskModal({
+ agentId,
+ lockAssignee: !!agentId,
onCreated: (task) => {
navigate(taskDetailPath(task.identifier, task.agentId));
},
});
- }, [canCreateTask, createActionBehavior.mode, navigate, updateSystemStatus]);
+ }, [agentId, canCreateTask, createActionBehavior.mode, navigate, updateSystemStatus]);
const handleShowHiddenCompleted = useCallback(() => {
setViewOptions((prev) => ({ ...prev, hideCompleted: false }));
@@ -133,10 +143,10 @@ const AgentTasksPage = memo(() => {
}}
/>
{isEmptyHero ? (
- <EmptyState />
+ <EmptyState agentId={agentId} />
) : viewMode === 'kanban' ? (
<Flexbox flex={1} style={{ overflowX: 'auto', overflowY: 'hidden' }}>
- <KanbanBoard />
+ <KanbanBoard agentId={agentId} />
</Flexbox>
) : (
<WideScreenContainer
@@ -144,7 +154,7 @@ const AgentTasksPage = memo(() => {
paddingBlock={16}
wrapperStyle={{ flex: 1, overflowY: 'auto' }}
>
- {!inlineCollapsed && <CreateTaskInlineEntry />}
+ {!inlineCollapsed && <CreateTaskInlineEntry agentId={agentId} lockAssignee={!!agentId} />}
<TaskList options={viewOptions} onShowHiddenCompleted={handleShowHiddenCompleted} />
</WideScreenContainer>
)}
diff --git a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx
index 4174dd03078..37e1f051b86 100644
--- a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx
+++ b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.tsx
@@ -26,6 +26,11 @@ import { useAgentDisplayMeta } from '../shared/useAgentDisplayMeta';
interface CreateTaskInlineEntryProps {
agentId?: string;
autoFocus?: boolean;
+ /**
+ * Locks the assignee to `agentId` and hides the agent picker. Used on the
+ * agent-scoped task list where every task belongs to that agent.
+ */
+ lockAssignee?: boolean;
onCollapse?: () => void;
onCreated?: (task: { agentId?: string; identifier: string }) => void;
parentTaskId?: string;
@@ -41,6 +46,7 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {
const {
agentId,
autoFocus,
+ lockAssignee,
onCollapse,
onCreated,
parentTaskId,
@@ -64,6 +70,13 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {
const assigneeMeta = useAgentDisplayMeta(assigneeAgentId);
+ // When the assignee is locked to a scoped agent, keep it in sync with the
+ // `agentId` prop. The route subtree is reused across /agent/A/tasks ->
+ // /agent/B/tasks, so without this the hidden assignee would stay on A.
+ useEffect(() => {
+ if (lockAssignee) setAssigneeAgentId(agentId);
+ }, [agentId, lockAssignee]);
+
useEffect(() => {
if (!canCreateTask) return;
if (autoFocus || isHero) editor?.focus?.();
@@ -220,31 +233,41 @@ const CreateTaskInlineEntry = memo<CreateTaskInlineEntryProps>((props) => {
</Block>
</TaskPriorityTag>
- <AssigneeAgentSelector currentAgentId={assigneeAgentId} onChange={setAssigneeAgentId}>
- <Block
- clickable
- horizontal
- align="center"
- gap={6}
- paddingBlock={4}
- paddingInline={8}
- variant={'borderless'}
- >
- {assigneeAgentId ? (
- <>
- <AssigneeAvatar agentId={assigneeAgentId} size={18} />
- <Text fontSize={12}>{assigneeMeta?.title}</Text>
- </>
- ) : (
- <>
- <Icon color={cssVar.colorTextDescription} icon={UserCircle2} size={14} />
- <Text color={cssVar.colorTextDescription} fontSize={12}>
- {t('createTask.assignee')}
- </Text>
- </>
- )}
- </Block>
- </AssigneeAgentSelector>
+ {(() => {
+ const assigneeChip = (
+ <Block
+ horizontal
+ align="center"
+ clickable={!lockAssignee}
+ gap={6}
+ paddingBlock={4}
+ paddingInline={8}
+ variant={'borderless'}
+ >
+ {assigneeAgentId ? (
+ <>
+ <AssigneeAvatar agentId={assigneeAgentId} size={18} />
+ <Text fontSize={12}>{assigneeMeta?.title}</Text>
+ </>
+ ) : (
+ <>
+ <Icon color={cssVar.colorTextDescription} icon={UserCircle2} size={14} />
+ <Text color={cssVar.colorTextDescription} fontSize={12}>
+ {t('createTask.assignee')}
+ </Text>
+ </>
+ )}
+ </Block>
+ );
+
+ return lockAssignee ? (
+ assigneeChip
+ ) : (
+ <AssigneeAgentSelector currentAgentId={assigneeAgentId} onChange={setAssigneeAgentId}>
+ {assigneeChip}
+ </AssigneeAgentSelector>
+ );
+ })()}
<ActionIcon
icon={Paperclip}
diff --git a/src/features/AgentTasks/AgentTaskList/EmptyState.tsx b/src/features/AgentTasks/AgentTaskList/EmptyState.tsx
index 6f758c25667..ea8c3d62533 100644
--- a/src/features/AgentTasks/AgentTaskList/EmptyState.tsx
+++ b/src/features/AgentTasks/AgentTaskList/EmptyState.tsx
@@ -28,7 +28,12 @@ const styles = createStaticStyles(({ css }) => ({
`,
}));
-const EmptyState = memo(() => {
+interface EmptyStateProps {
+ /** When set, scopes task creation to this agent and locks the assignee. */
+ agentId?: string;
+}
+
+const EmptyState = memo<EmptyStateProps>(({ agentId }) => {
const { t } = useTranslation('chat');
const { t: tCommon } = useTranslation('common');
const templatesState = useDailyBriefRecommendationsUI({ count: EMPTY_STATE_RECOMMEND_COUNT });
@@ -49,7 +54,7 @@ const EmptyState = memo(() => {
</Text>
</Flexbox>
- <CreateTaskInlineEntry variant={'hero'} />
+ <CreateTaskInlineEntry agentId={agentId} lockAssignee={!!agentId} variant={'hero'} />
{templatesState.mode !== 'hidden' && (
<Flexbox gap={12}>
diff --git a/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx b/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx
index 92831ee6202..9964915910c 100644
--- a/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx
+++ b/src/features/AgentTasks/AgentTaskList/KanbanBoard.tsx
@@ -74,13 +74,18 @@ const optimisticMoveTask = (
});
};
-const KanbanBoard = memo(() => {
+interface KanbanBoardProps {
+ /** When set, scopes the board (and task creation) to a single agent. */
+ agentId?: string;
+}
+
+const KanbanBoard = memo<KanbanBoardProps>(({ agentId }) => {
const { t } = useTranslation('chat');
const navigate = useWorkspaceAwareNavigate();
const { allowed: canEditTask } = usePermission('create_content');
const useFetchTaskGroupList = useTaskStore((s) => s.useFetchTaskGroupList);
- useFetchTaskGroupList({ allAgents: true });
+ useFetchTaskGroupList(agentId ? { agentId } : { allAgents: true });
const taskGroups = useTaskStore(taskListSelectors.taskGroups);
const isInit = useTaskStore(taskListSelectors.isTaskGroupListInit);
@@ -143,12 +148,14 @@ const KanbanBoard = memo(() => {
const handleCreateTask = useCallback(() => {
if (!canEditTask) return;
createTaskModal({
+ agentId,
+ lockAssignee: !!agentId,
onCreated: (task) => {
navigate(taskDetailPath(task.identifier, task.agentId));
},
showInlineToggle: false,
});
- }, [canEditTask, navigate]);
+ }, [agentId, canEditTask, navigate]);
const handleHideColumn = useCallback(
(columnKey: string) => {
diff --git a/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx b/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx
index 0b11a1af18f..70f0150461a 100644
--- a/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx
+++ b/src/features/AgentTasks/CreateTaskModal/CreateTaskContent.tsx
@@ -25,6 +25,11 @@ import { useAgentDisplayMeta } from '../shared/useAgentDisplayMeta';
export interface CreateTaskContentProps {
agentId?: string;
+ /**
+ * Locks the assignee to `agentId` and hides the agent picker. Used on the
+ * agent-scoped task list where every task belongs to that agent.
+ */
+ lockAssignee?: boolean;
onCreated?: (task: { agentId?: string; identifier: string }) => void;
/**
* Whether to show the "minimize to inline entry" button. Only the list view has an
@@ -34,7 +39,7 @@ export interface CreateTaskContentProps {
}
const CreateTaskContent = memo<CreateTaskContentProps>(
- ({ agentId, onCreated, showInlineToggle = true }) => {
+ ({ agentId, lockAssignee, onCreated, showInlineToggle = true }) => {
const { t } = useTranslation('chat');
const { close } = useModalContext();
const { allowed: canCreateTask, reason } = usePermission('create_content');
@@ -177,31 +182,44 @@ const CreateTaskContent = memo<CreateTaskContentProps>(
</Block>
</TaskPriorityTag>
- <AssigneeAgentSelector currentAgentId={assigneeAgentId} onChange={setAssigneeAgentId}>
- <Block
- clickable
- horizontal
- align="center"
- gap={6}
- paddingBlock={4}
- paddingInline={8}
- variant={'borderless'}
- >
- {assigneeAgentId ? (
- <>
- <AssigneeAvatar agentId={assigneeAgentId} size={18} />
- <Text fontSize={12}>{assigneeMeta?.title}</Text>
- </>
- ) : (
- <>
- <Icon color={cssVar.colorTextDescription} icon={UserCircle2} size={14} />
- <Text color={cssVar.colorTextDescription} fontSize={12}>
- {t('createTask.assignee')}
- </Text>
- </>
- )}
- </Block>
- </AssigneeAgentSelector>
+ {(() => {
+ const assigneeChip = (
+ <Block
+ horizontal
+ align="center"
+ clickable={!lockAssignee}
+ gap={6}
+ paddingBlock={4}
+ paddingInline={8}
+ variant={'borderless'}
+ >
+ {assigneeAgentId ? (
+ <>
+ <AssigneeAvatar agentId={assigneeAgentId} size={18} />
+ <Text fontSize={12}>{assigneeMeta?.title}</Text>
+ </>
+ ) : (
+ <>
+ <Icon color={cssVar.colorTextDescription} icon={UserCircle2} size={14} />
+ <Text color={cssVar.colorTextDescription} fontSize={12}>
+ {t('createTask.assignee')}
+ </Text>
+ </>
+ )}
+ </Block>
+ );
+
+ return lockAssignee ? (
+ assigneeChip
+ ) : (
+ <AssigneeAgentSelector
+ currentAgentId={assigneeAgentId}
+ onChange={setAssigneeAgentId}
+ >
+ {assigneeChip}
+ </AssigneeAgentSelector>
+ );
+ })()}
<ActionIcon
icon={Paperclip}
diff --git a/src/features/AgentTasks/features/AssigneeAgentSelector.tsx b/src/features/AgentTasks/features/AssigneeAgentSelector.tsx
index 0c4edbbecc0..a3d459d8448 100644
--- a/src/features/AgentTasks/features/AssigneeAgentSelector.tsx
+++ b/src/features/AgentTasks/features/AssigneeAgentSelector.tsx
@@ -210,6 +210,7 @@ const AssigneeAgentSelector = memo<AssigneeAgentSelectorProps>(
agentId={agent.id}
agentTitle={agent.title || t('untitledAgent', { ns: 'chat' })}
avatar={agent.avatar}
+ heterogeneousType={agent.heterogeneousType}
onAgentChange={handleAgentChange}
onClose={() => setKey((k) => k + 1)}
/>
diff --git a/src/features/AgentTasks/index.tsx b/src/features/AgentTasks/index.tsx
index 8666e64ad18..c6c84747cfe 100644
--- a/src/features/AgentTasks/index.tsx
+++ b/src/features/AgentTasks/index.tsx
@@ -1,2 +1,7 @@
-export { TaskDetailPage } from './AgentTaskDetail';
+export {
+ TaskDetailPage,
+ TaskDetailSections,
+ TopicChatDrawer,
+ useActiveTaskDetail,
+} from './AgentTaskDetail';
export { AgentTasksPage } from './AgentTaskList';
diff --git a/src/features/AgentTasks/shared/Breadcrumb.test.tsx b/src/features/AgentTasks/shared/Breadcrumb.test.tsx
index a9b8938b13f..90a945253a0 100644
--- a/src/features/AgentTasks/shared/Breadcrumb.test.tsx
+++ b/src/features/AgentTasks/shared/Breadcrumb.test.tsx
@@ -38,6 +38,18 @@ vi.mock('react-i18next', () => ({
vi.mock('react-router', () => ({
Link: ({ children, to }: { children: ReactNode; to: string }) => <a href={to}>{children}</a>,
+ useParams: () => ({}),
+}));
+
+// Render the workspace-aware link as a plain anchor so the asserted hrefs stay
+// the raw task paths (no workspace-slug prefix, no real router context).
+vi.mock('@/features/Workspace/WorkspaceLink', () => ({
+ default: ({ children, to }: { children: ReactNode; to: string }) => <a href={to}>{children}</a>,
+}));
+
+// Agent crumb metadata isn't under test here; the agent store isn't mocked.
+vi.mock('./useAgentDisplayMeta', () => ({
+ useAgentDisplayMeta: () => undefined,
}));
vi.mock('zustand/react/shallow', () => ({
diff --git a/src/features/AgentTasks/shared/Breadcrumb.tsx b/src/features/AgentTasks/shared/Breadcrumb.tsx
index 36570f2ea13..0c872ef4111 100644
--- a/src/features/AgentTasks/shared/Breadcrumb.tsx
+++ b/src/features/AgentTasks/shared/Breadcrumb.tsx
@@ -3,6 +3,7 @@ import { Breadcrumb as AntBreadcrumb } from 'antd';
import { ChevronRight } from 'lucide-react';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import { useParams } from 'react-router';
import { useShallow } from 'zustand/react/shallow';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
@@ -10,6 +11,7 @@ import { useTaskStore } from '@/store/task';
import { styles } from './style';
import { taskDetailPath } from './taskDetailPath';
+import { useAgentDisplayMeta } from './useAgentDisplayMeta';
interface BreadcrumbProps {
taskId?: string;
@@ -17,6 +19,8 @@ interface BreadcrumbProps {
const Breadcrumb = memo<BreadcrumbProps>(({ taskId }) => {
const { t } = useTranslation('chat');
+ const { aid } = useParams<{ aid?: string }>();
+ const agentMeta = useAgentDisplayMeta(aid);
const taskTitle = useTaskStore((s) => (taskId ? s.taskDetailMap[taskId]?.name : undefined));
const taskIdentifier = useTaskStore((s) =>
taskId ? s.taskDetailMap[taskId]?.identifier : undefined,
@@ -46,6 +50,34 @@ const Breadcrumb = memo<BreadcrumbProps>(({ taskId }) => {
</Text>
);
+ const agentCrumb =
+ aid && agentMeta
+ ? {
+ key: `agent-${aid}`,
+ title: (
+ <Text
+ ellipsis
+ color={'inherit'}
+ style={{ maxWidth: 160 }}
+ type={taskId ? undefined : 'secondary'}
+ weight={500}
+ >
+ {agentMeta.title}
+ </Text>
+ ),
+ }
+ : undefined;
+
+ // The agent crumb links to its task list only when it is not the current page
+ // (i.e. when a deeper task crumb follows it).
+ const agentCrumbNode =
+ agentCrumb && taskId
+ ? {
+ ...agentCrumb,
+ title: <WorkspaceLink to={`/agent/${aid}/tasks`}>{agentCrumb.title}</WorkspaceLink>,
+ }
+ : agentCrumb;
+
const ancestorCrumbs = ancestors.map(({ identifier, agentId }) => ({
key: identifier,
title: (
@@ -100,12 +132,14 @@ const Breadcrumb = memo<BreadcrumbProps>(({ taskId }) => {
separator={<Icon icon={ChevronRight} />}
items={[
{
- title: taskId ? (
- <WorkspaceLink to={'/tasks'}>{allTasksLabel}</WorkspaceLink>
- ) : (
- allTasksLabel
- ),
+ title:
+ taskId || agentCrumbNode ? (
+ <WorkspaceLink to={'/tasks'}>{allTasksLabel}</WorkspaceLink>
+ ) : (
+ allTasksLabel
+ ),
},
+ ...(agentCrumbNode ? [agentCrumbNode] : []),
...ancestorCrumbs,
...(currentTaskCrumb ? [currentTaskCrumb] : []),
]}
diff --git a/src/features/HeterogeneousTag/index.tsx b/src/features/HeterogeneousTag/index.tsx
new file mode 100644
index 00000000000..b31ba7d3ac5
--- /dev/null
+++ b/src/features/HeterogeneousTag/index.tsx
@@ -0,0 +1,32 @@
+import { HETEROGENEOUS_TYPE_LABELS } from '@lobechat/heterogeneous-agents';
+import { Tag } from '@lobehub/ui';
+import type { CSSProperties } from 'react';
+import { memo } from 'react';
+
+interface HeterogeneousTagProps {
+ style?: CSSProperties;
+ /**
+ * Heterogeneous runtime type (e.g. `claude-code`). `null`/`undefined` renders
+ * nothing, so callers can pass it unconditionally.
+ */
+ type?: string | null;
+}
+
+/**
+ * Small pill that labels a heterogeneous agent by its runtime (Claude Code,
+ * Codex, …). Single source of truth for the badge so every agent listing — the
+ * home sidebar, the assignee picker, the task assignee chip — stays consistent.
+ */
+const HeterogeneousTag = memo<HeterogeneousTagProps>(({ type, style }) => {
+ if (!type) return null;
+
+ const label = HETEROGENEOUS_TYPE_LABELS[type] ?? type;
+
+ return (
+ <Tag size={'small'} style={{ flexShrink: 0, ...style }}>
+ {label}
+ </Tag>
+ );
+});
+
+export default HeterogeneousTag;
diff --git a/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx b/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx
index 1e21853b50b..2ca8ad2687e 100644
--- a/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx
+++ b/src/features/PageEditor/Copilot/AgentSelector/AgentItem.tsx
@@ -1,7 +1,9 @@
import { type GroupMemberAvatar } from '@lobechat/types';
+import { Flexbox } from '@lobehub/ui';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
+import HeterogeneousTag from '@/features/HeterogeneousTag';
import NavItem from '@/features/NavPanel/components/NavItem';
import AgentAvatar from '@/routes/(main)/home/_layout/Body/Agent/List/AgentItem/Avatar';
@@ -10,20 +12,35 @@ interface AgentItemProps {
agentId: string;
agentTitle: string;
avatar: string | GroupMemberAvatar[] | null | undefined;
+ /** Heterogeneous runtime type (e.g. `claude-code`); shows a runtime tag when set. */
+ heterogeneousType?: string | null;
onAgentChange: (agentId: string) => void;
onClose: () => void;
}
const AgentItem = memo<AgentItemProps>(
- ({ active, agentId, agentTitle, avatar, onAgentChange, onClose }) => {
+ ({ active, agentId, agentTitle, avatar, heterogeneousType, onAgentChange, onClose }) => {
const { t } = useTranslation('chat');
+ const title = agentTitle || t('untitledAgent');
+
return (
<NavItem
active={active}
icon={<AgentAvatar avatar={typeof avatar === 'string' ? avatar : undefined} />}
style={{ flexShrink: 0 }}
- title={agentTitle || t('untitledAgent')}
+ title={
+ heterogeneousType ? (
+ <Flexbox horizontal align={'center'} gap={4}>
+ <span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
+ {title}
+ </span>
+ <HeterogeneousTag type={heterogeneousType} />
+ </Flexbox>
+ ) : (
+ title
+ )
+ }
onClick={() => {
onAgentChange(agentId);
onClose();
diff --git a/src/features/Portal/TaskDetail/Body.tsx b/src/features/Portal/TaskDetail/Body.tsx
new file mode 100644
index 00000000000..8fd09ef216a
--- /dev/null
+++ b/src/features/Portal/TaskDetail/Body.tsx
@@ -0,0 +1,43 @@
+import { Flexbox } from '@lobehub/ui';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import NotFound from '@/components/404';
+import Loading from '@/components/Loading/BrandTextLoading';
+import { TaskDetailSections, TopicChatDrawer, useActiveTaskDetail } from '@/features/AgentTasks';
+import DocumentPreviewModal from '@/features/DocumentModal/Preview';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+const Body = memo(() => {
+ const { t } = useTranslation('chat');
+ const taskId = useChatStore(chatPortalSelectors.taskDetailId);
+ // Same data wiring as the full /task/[tid] page — owns activeTaskId + polling
+ // fetch so the shared section components resolve to this task.
+ const { isInitialLoading, isNotFound } = useActiveTaskDetail(taskId);
+
+ if (!taskId) return null;
+
+ if (isNotFound) {
+ return (
+ <Flexbox flex={1} height={'100%'} style={{ minHeight: 0, overflowY: 'auto' }}>
+ <NotFound desc={t('taskDetail.notFound.desc')} title={t('taskDetail.notFound.title')} />
+ </Flexbox>
+ );
+ }
+
+ return (
+ <Flexbox
+ flex={1}
+ height={'100%'}
+ paddingInline={16}
+ style={{ minHeight: 0, overflowY: 'auto' }}
+ >
+ {isInitialLoading ? <Loading debugId="PortalTaskDetail" /> : <TaskDetailSections />}
+ <TopicChatDrawer />
+ <DocumentPreviewModal />
+ </Flexbox>
+ );
+});
+
+export default Body;
diff --git a/src/features/Portal/TaskDetail/Title.tsx b/src/features/Portal/TaskDetail/Title.tsx
new file mode 100644
index 00000000000..0c20f5cff06
--- /dev/null
+++ b/src/features/Portal/TaskDetail/Title.tsx
@@ -0,0 +1,44 @@
+import { Flexbox, Text } from '@lobehub/ui';
+import { createStaticStyles, cssVar } from 'antd-style';
+import { memo } from 'react';
+
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+import { useTaskStore } from '@/store/task';
+import { oneLineEllipsis } from '@/styles';
+
+const styles = createStaticStyles(({ css, cssVar }) => ({
+ identifier: css`
+ flex-shrink: 0;
+
+ padding-block: 1px;
+ padding-inline: 6px;
+ border-radius: 4px;
+
+ font-family: ${cssVar.fontFamilyCode};
+ font-size: 12px;
+ color: ${cssVar.colorTextSecondary};
+
+ background: ${cssVar.colorFillTertiary};
+ `,
+}));
+
+const Title = memo(() => {
+ const taskId = useChatStore(chatPortalSelectors.taskDetailId);
+ const detail = useTaskStore((s) => (taskId ? s.taskDetailMap[taskId] : undefined));
+ const identifier = detail?.identifier ?? taskId;
+ const name = detail?.name;
+
+ return (
+ <Flexbox horizontal align={'center'} gap={8} style={{ minWidth: 0 }}>
+ {identifier && <span className={styles.identifier}>{identifier}</span>}
+ {name && (
+ <Text className={oneLineEllipsis} style={{ color: cssVar.colorText, fontSize: 14 }}>
+ {name}
+ </Text>
+ )}
+ </Flexbox>
+ );
+});
+
+export default Title;
diff --git a/src/features/Portal/TaskDetail/index.ts b/src/features/Portal/TaskDetail/index.ts
new file mode 100644
index 00000000000..6e098f0e16c
--- /dev/null
+++ b/src/features/Portal/TaskDetail/index.ts
@@ -0,0 +1,8 @@
+import { type PortalImpl } from '../type';
+import Body from './Body';
+import Title from './Title';
+
+export const TaskDetail: PortalImpl = {
+ Body,
+ Title,
+};
diff --git a/src/features/Portal/router.tsx b/src/features/Portal/router.tsx
index 96caef075e7..da1f943e8a0 100644
--- a/src/features/Portal/router.tsx
+++ b/src/features/Portal/router.tsx
@@ -16,6 +16,7 @@ import { LocalFile } from './LocalFile';
import { MessageDetail } from './MessageDetail';
import { Notebook } from './Notebook';
import { Plugins } from './Plugins';
+import { TaskDetail } from './TaskDetail';
import { Thread } from './Thread';
import { type PortalImpl } from './type';
import { VerifyResult } from './VerifyResult';
@@ -33,6 +34,7 @@ const VIEW_COMPONENTS: Record<PortalViewType, PortalImpl> = {
[PortalViewType.LocalFile]: LocalFile,
[PortalViewType.MessageDetail]: MessageDetail,
[PortalViewType.ToolUI]: Plugins,
+ [PortalViewType.TaskDetail]: TaskDetail,
[PortalViewType.Thread]: Thread,
[PortalViewType.GroupThread]: GroupThread,
[PortalViewType.VerifyResult]: VerifyResult,
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Body.tsx b/src/routes/(main)/agent/_layout/Sidebar/Body.tsx
index d627c6ea2ed..fe21efc4f65 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Body.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Body.tsx
@@ -1,5 +1,9 @@
import { Accordion, Flexbox } from '@lobehub/ui';
-import React, { memo } from 'react';
+import React, { type Key, memo, useCallback, useMemo } from 'react';
+
+import { useAgentStore } from '@/store/agent';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
import TaskList from './Task';
import Topic from './Topic';
@@ -9,10 +13,43 @@ export enum ChatSidebarKey {
Topic = 'topic',
}
+// Topic expanded, Tasks collapsed — the resting state for an agent with no
+// saved preference (matches the prior `defaultExpandedKeys={[Topic]}`).
+const DEFAULT_EXPANDED: Record<string, boolean> = {
+ [ChatSidebarKey.Tasks]: false,
+ [ChatSidebarKey.Topic]: true,
+};
+
const Body = memo(() => {
+ const agentId = useAgentStore((s) => s.activeAgentId);
+ // Per-agent expand/collapse state, so switching agents remembers each one's
+ // own sidebar layout instead of sharing a single (uncontrolled) accordion.
+ const sections = useGlobalStore(systemStatusSelectors.agentSidebarSections(agentId));
+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
+
+ const expandedKeys = useMemo(() => {
+ const resolved = { ...DEFAULT_EXPANDED, ...sections };
+ return Object.keys(resolved).filter((key) => resolved[key]);
+ }, [sections]);
+
+ const handleExpandedChange = useCallback(
+ (keys: Key[]) => {
+ if (!agentId) return;
+ updateSystemStatus({
+ expandAgentSidebarSectionsByAgent: {
+ [agentId]: {
+ [ChatSidebarKey.Tasks]: keys.includes(ChatSidebarKey.Tasks),
+ [ChatSidebarKey.Topic]: keys.includes(ChatSidebarKey.Topic),
+ },
+ },
+ });
+ },
+ [agentId, updateSystemStatus],
+ );
+
return (
<Flexbox paddingInline={4}>
- <Accordion defaultExpandedKeys={[ChatSidebarKey.Topic]} gap={8}>
+ <Accordion expandedKeys={expandedKeys} gap={8} onExpandedChange={handleExpandedChange}>
<TaskList itemKey={ChatSidebarKey.Tasks} />
<Topic itemKey={ChatSidebarKey.Topic} />
</Accordion>
diff --git a/src/routes/(main)/agent/_layout/Sidebar/Task/index.tsx b/src/routes/(main)/agent/_layout/Sidebar/Task/index.tsx
index fb4ab128e61..23456f4fc4a 100644
--- a/src/routes/(main)/agent/_layout/Sidebar/Task/index.tsx
+++ b/src/routes/(main)/agent/_layout/Sidebar/Task/index.tsx
@@ -1,15 +1,16 @@
'use client';
-import { Accordion, AccordionItem, Flexbox, Text } from '@lobehub/ui';
-import { memo, useMemo } from 'react';
+import { Accordion, AccordionItem, ActionIcon, Flexbox, Text } from '@lobehub/ui';
+import { ArrowRight } from 'lucide-react';
+import { memo, type MouseEvent, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import SkeletonList from '@/features/NavPanel/components/SkeletonList';
+import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import { useClientDataSWR } from '@/libs/swr';
import { sidebarKeys } from '@/libs/swr/keys';
import { taskService } from '@/services/task';
import { useAgentStore } from '@/store/agent';
-import { agentSelectors } from '@/store/agent/selectors';
import type { TaskGroupItem } from '@/store/task/slices/list/initialState';
import StatusGroup from './StatusGroup';
@@ -27,10 +28,10 @@ interface TaskListProps {
const TaskList = memo<TaskListProps>(({ itemKey }) => {
const { t } = useTranslation('chat');
+ const navigate = useWorkspaceAwareNavigate();
const agentId = useAgentStore((s) => s.activeAgentId);
- const isHeterogeneous = useAgentStore(agentSelectors.isCurrentAgentHeterogeneous);
- const enabled = !isHeterogeneous && !!agentId;
+ const enabled = !!agentId;
const { data, isLoading } = useClientDataSWR<{ data: TaskGroupItem[]; success: boolean }>(
enabled ? sidebarKeys.taskGroups(agentId) : null,
async ([, id]: [string, string]) =>
@@ -54,7 +55,14 @@ const TaskList = memo<TaskListProps>(({ itemKey }) => {
[orderedGroups],
);
- if (isHeterogeneous) return null;
+ const handleViewAll = useCallback(
+ (e: MouseEvent) => {
+ // Stop the click from toggling the accordion header.
+ e.stopPropagation();
+ if (agentId) navigate(`/agent/${agentId}/tasks`);
+ },
+ [agentId, navigate],
+ );
const titleNode = (
<Flexbox horizontal align="center" gap={4}>
@@ -69,16 +77,37 @@ const TaskList = memo<TaskListProps>(({ itemKey }) => {
</Flexbox>
);
+ const actionNode = (
+ <ActionIcon
+ icon={ArrowRight}
+ size={'small'}
+ title={t('taskList.viewAll')}
+ onClick={handleViewAll}
+ />
+ );
+
if (isLoading && taskGroups.length === 0) {
return (
- <AccordionItem itemKey={itemKey} paddingBlock={4} paddingInline={'8px 4px'} title={titleNode}>
+ <AccordionItem
+ action={actionNode}
+ itemKey={itemKey}
+ paddingBlock={4}
+ paddingInline={'8px 4px'}
+ title={titleNode}
+ >
<SkeletonList />
</AccordionItem>
);
}
return (
- <AccordionItem itemKey={itemKey} paddingBlock={4} paddingInline={'8px 4px'} title={titleNode}>
+ <AccordionItem
+ action={actionNode}
+ itemKey={itemKey}
+ paddingBlock={4}
+ paddingInline={'8px 4px'}
+ title={titleNode}
+ >
{orderedGroups.length === 0 ? (
<Text fontSize={12} style={{ padding: '8px 12px' }} type="secondary">
{t('taskList.kanban.emptyColumn')}
diff --git a/src/routes/(main)/agent/features/Portal/features/Portal.tsx b/src/routes/(main)/agent/features/Portal/features/Portal.tsx
index 98f2a12f8b8..7206b8b52c1 100644
--- a/src/routes/(main)/agent/features/Portal/features/Portal.tsx
+++ b/src/routes/(main)/agent/features/Portal/features/Portal.tsx
@@ -39,11 +39,12 @@ const styles = createStaticStyles(({ css, cssVar }) => ({
}));
const PortalPanel = memo(({ children }: PropsWithChildren) => {
- const [showPortal, showToolUI, showArtifactUI, showThread] = useChatStore((s) => [
+ const [showPortal, showToolUI, showArtifactUI, showThread, showTaskDetail] = useChatStore((s) => [
chatPortalSelectors.showPortal(s),
chatPortalSelectors.showPluginUI(s),
chatPortalSelectors.showArtifactUI(s),
portalThreadSelectors.showThread(s),
+ chatPortalSelectors.showTaskDetail(s),
]);
const [portalWidth, updateSystemStatus] = useGlobalStore((s) => [
@@ -82,7 +83,9 @@ const PortalPanel = memo(({ children }: PropsWithChildren) => {
content: styles.content,
}}
minWidth={
- showArtifactUI || showToolUI || showThread ? CHAT_PORTAL_TOOL_UI_WIDTH : CHAT_PORTAL_WIDTH
+ showArtifactUI || showToolUI || showThread || showTaskDetail
+ ? CHAT_PORTAL_TOOL_UI_WIDTH
+ : CHAT_PORTAL_WIDTH
}
onSizeChange={handleSizeChange}
>
diff --git a/src/routes/(main)/agent/tasks/index.tsx b/src/routes/(main)/agent/tasks/index.tsx
new file mode 100644
index 00000000000..4d47b6517ea
--- /dev/null
+++ b/src/routes/(main)/agent/tasks/index.tsx
@@ -0,0 +1,16 @@
+'use client';
+
+import { memo } from 'react';
+import { useParams } from 'react-router';
+
+import { AgentTasksPage } from '@/features/AgentTasks';
+
+const AgentScopedTasksRoute = memo(() => {
+ const { aid } = useParams<{ aid?: string }>();
+
+ if (!aid) return null;
+
+ return <AgentTasksPage agentId={aid} />;
+});
+
+export default AgentScopedTasksRoute;
diff --git a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx b/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx
index 40d4fe1fc37..a193317c375 100644
--- a/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx
+++ b/src/routes/(main)/home/_layout/Body/Agent/List/AgentItem/index.tsx
@@ -1,12 +1,12 @@
-import { HETEROGENEOUS_TYPE_LABELS } from '@lobechat/heterogeneous-agents';
import { type SidebarAgentItem } from '@lobechat/types';
-import { ActionIcon, Flexbox, Icon, Tag } from '@lobehub/ui';
+import { ActionIcon, Flexbox, Icon } from '@lobehub/ui';
import { createStaticStyles, cssVar } from 'antd-style';
import { Loader2, PinIcon } from 'lucide-react';
import { type CSSProperties, type DragEvent } from 'react';
import { memo, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import HeterogeneousTag from '@/features/HeterogeneousTag';
import NavItem from '@/features/NavPanel/components/NavItem';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
import { usePrefetchAgent } from '@/hooks/usePrefetchAgent';
@@ -101,18 +101,12 @@ const AgentItem = memo<AgentItemProps>(({ item, style, className, onNavigate })
// Heterogeneous agents (Claude Code, Codex, …) show their runtime as a tag
// so they stand out from built-in agents in the sidebar.
- const heterogeneousLabel = heterogeneousType
- ? (HETEROGENEOUS_TYPE_LABELS[heterogeneousType] ?? heterogeneousType)
- : null;
-
- const titleNode = heterogeneousLabel ? (
+ const titleNode = heterogeneousType ? (
<Flexbox horizontal align="center" gap={4}>
<span style={{ overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>
{displayTitle}
</span>
- <Tag size="small" style={{ flexShrink: 0 }}>
- {heterogeneousLabel}
- </Tag>
+ <HeterogeneousTag type={heterogeneousType} />
</Flexbox>
) : (
displayTitle
diff --git a/src/spa/router/desktopRouter.config.desktop.tsx b/src/spa/router/desktopRouter.config.desktop.tsx
index 3dd1363a693..491128cc78e 100644
--- a/src/spa/router/desktopRouter.config.desktop.tsx
+++ b/src/spa/router/desktopRouter.config.desktop.tsx
@@ -54,6 +54,7 @@ import AgentDocumentRoute from '@/routes/(main)/agent/docs/[docId]';
import { agentRouteMeta } from '@/routes/(main)/agent/features/routeMeta';
import AgentProfilePage from '@/routes/(main)/agent/profile';
import AgentTaskDetailRoute from '@/routes/(main)/agent/task/[taskId]';
+import AgentScopedTasksRoute from '@/routes/(main)/agent/tasks';
import AgentTopicsPage from '@/routes/(main)/agent/topics';
import CommunityLayout from '@/routes/(main)/community/_layout';
import CommunityDetailLayout from '@/routes/(main)/community/(detail)/_layout';
@@ -178,6 +179,11 @@ export const sharedMainAreaChildren: RouteObject[] = [
element: <AgentTopicsPage />,
path: 'topics',
},
+ {
+ element: <AgentScopedTasksRoute />,
+ handle: { meta: tasksRouteMeta },
+ path: 'tasks',
+ },
{
element: <AgentTaskDetailRoute />,
handle: { meta: taskRouteMeta },
diff --git a/src/spa/router/desktopRouter.config.tsx b/src/spa/router/desktopRouter.config.tsx
index e26e86693d4..1ef479d2257 100644
--- a/src/spa/router/desktopRouter.config.tsx
+++ b/src/spa/router/desktopRouter.config.tsx
@@ -103,6 +103,14 @@ export const sharedMainAreaChildren: RouteObject[] = [
),
path: 'topics',
},
+ {
+ element: dynamicElement(
+ () => import('@/routes/(main)/agent/tasks'),
+ 'Desktop > Chat > Tasks',
+ ),
+ handle: { meta: tasksRouteMeta },
+ path: 'tasks',
+ },
{
element: dynamicElement(
() => import('@/routes/(main)/agent/task/[taskId]'),
diff --git a/src/store/chat/slices/portal/action.ts b/src/store/chat/slices/portal/action.ts
index fd21be4c6c2..4429bb4a954 100644
--- a/src/store/chat/slices/portal/action.ts
+++ b/src/store/chat/slices/portal/action.ts
@@ -433,6 +433,13 @@ export class ChatPortalActionImpl {
}
};
+ closeTaskDetail = (): void => {
+ const { portalStack } = this.#get();
+ if (getCurrentViewType(portalStack) === PortalViewType.TaskDetail) {
+ this.#get().popPortalView();
+ }
+ };
+
closeToolUI = (): void => {
const { portalStack } = this.#get();
if (getCurrentViewType(portalStack) === PortalViewType.ToolUI) {
@@ -575,6 +582,10 @@ export class ChatPortalActionImpl {
this.#get().pushPortalView({ type: PortalViewType.Notebook });
};
+ openTaskDetail = (taskId: string): void => {
+ this.#get().pushPortalView({ taskId, type: PortalViewType.TaskDetail });
+ };
+
openToolUI = (messageId: string, identifier: string, params?: Record<string, any>): void => {
this.#get().pushPortalView({ identifier, messageId, params, type: PortalViewType.ToolUI });
};
diff --git a/src/store/chat/slices/portal/initialState.ts b/src/store/chat/slices/portal/initialState.ts
index d1a8e69cd76..dafaa2b2814 100644
--- a/src/store/chat/slices/portal/initialState.ts
+++ b/src/store/chat/slices/portal/initialState.ts
@@ -16,6 +16,7 @@ export enum PortalViewType {
LocalFile = 'localFile',
MessageDetail = 'messageDetail',
Notebook = 'notebook',
+ TaskDetail = 'taskDetail',
Thread = 'thread',
ToolUI = 'toolUI',
VerifyResult = 'verifyResult',
@@ -54,6 +55,7 @@ export type PortalViewData =
}
| { startMessageId?: string; threadId?: string; type: PortalViewType.Thread }
| { agentId: string; type: PortalViewType.GroupThread }
+ | { taskId: string; type: PortalViewType.TaskDetail }
| { checkItemId: string; operationId: string; type: PortalViewType.VerifyResult };
// ============== Portal State ==============
diff --git a/src/store/chat/slices/portal/selectors.ts b/src/store/chat/slices/portal/selectors.ts
index 4480d025244..484712b9b20 100644
--- a/src/store/chat/slices/portal/selectors.ts
+++ b/src/store/chat/slices/portal/selectors.ts
@@ -39,6 +39,7 @@ const showLocalFile = (s: ChatStoreState) => currentViewType(s) === PortalViewTy
const showMessageDetail = (s: ChatStoreState) =>
currentViewType(s) === PortalViewType.MessageDetail;
const showPluginUI = (s: ChatStoreState) => currentViewType(s) === PortalViewType.ToolUI;
+const showTaskDetail = (s: ChatStoreState) => currentViewType(s) === PortalViewType.TaskDetail;
// ============== Data Extractors ==============
@@ -207,6 +208,12 @@ const messageDetailId = (s: ChatStoreState): string | undefined => {
return view?.messageId;
};
+// Task Detail selectors
+const taskDetailId = (s: ChatStoreState): string | undefined => {
+ const view = getViewData(s, PortalViewType.TaskDetail);
+ return view?.taskId;
+};
+
// Tool UI / Plugin selectors
const currentToolUI = (
s: ChatStoreState,
@@ -244,6 +251,7 @@ export const chatPortalSelectors = {
showLocalFile,
showMessageDetail,
showPluginUI,
+ showTaskDetail,
// Artifact data
currentArtifact,
@@ -279,6 +287,9 @@ export const chatPortalSelectors = {
// Message detail data
messageDetailId,
+ // Task detail data
+ taskDetailId,
+
// Tool UI data
currentToolUI,
toolMessageId,
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 5b7349251ee..9d4c90918f4 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -123,6 +123,14 @@ export interface SystemStatus {
* so dismissing the current one does not hide future ones.
*/
dismissedBannerIds?: string[];
+ /**
+ * Per-agent expanded state of the agent sidebar's top-level sections
+ * (Tasks / Topic), keyed by agentId. Lets each agent remember its own
+ * collapse/expand state so switching agents doesn't share one accordion.
+ * Nested booleans (not a key array) so the lodash `merge` in
+ * `updateSystemStatus` replaces scalars cleanly instead of index-merging arrays.
+ */
+ expandAgentSidebarSectionsByAgent?: Record<string, Record<string, boolean>>;
expandInputActionbar?: boolean;
// which sessionGroup should expand
expandSessionGroupKeys: string[];
diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.ts
index 7b59d4466c1..34723e74afd 100644
--- a/src/store/global/selectors/systemStatus.ts
+++ b/src/store/global/selectors/systemStatus.ts
@@ -26,6 +26,11 @@ const sessionGroupKeys = (s: GlobalState): string[] =>
const topicGroupKeys = (s: GlobalState): string[] | undefined => s.status.expandTopicGroupKeys;
+const agentSidebarSections =
+ (agentId: string | undefined) =>
+ (s: GlobalState): Record<string, boolean> | undefined =>
+ agentId ? s.status.expandAgentSidebarSectionsByAgent?.[agentId] : undefined;
+
const topicPageSize = (s: GlobalState): number => s.status.topicPageSize || 20;
const agentPageSize = (s: GlobalState): number => s.status.agentPageSize || 5;
@@ -357,6 +362,7 @@ export const systemStatusSelectors = {
taskKanbanHiddenPanelCollapsed,
taskListViewOptions,
sidebarExpandedKeys,
+ agentSidebarSections,
sidebarItems,
sessionGroupKeys,
showAgentBuilderPanel,
diff --git a/src/store/task/slices/list/action.ts b/src/store/task/slices/list/action.ts
index ebdfa1a2705..92d646c3a4e 100644
--- a/src/store/task/slices/list/action.ts
+++ b/src/store/task/slices/list/action.ts
@@ -27,6 +27,20 @@ const DEFAULT_KANBAN_GROUPS = [
{ key: 'canceled', statuses: ['canceled'] },
];
+/**
+ * Cleared whenever the list scope changes (all-agents <-> a specific agent).
+ * The list and group datasets are shared store fields, so without this reset
+ * the previous scope's tasks would render until the new fetch resolves — e.g.
+ * the `/tasks` page briefly showing only the last-visited agent's tasks.
+ */
+const scopeChangeResetState = {
+ isTaskGroupListInit: false,
+ isTaskListInit: false,
+ taskGroups: [] as TaskGroupItem[],
+ tasks: [] as TaskListItem[],
+ tasksTotal: 0,
+};
+
type Setter = StoreSetter<TaskStore>;
export const createTaskListSlice = (set: Setter, get: () => TaskStore, _api?: unknown) =>
@@ -76,7 +90,11 @@ export class TaskListSliceActionImpl {
const { agentId, allAgents = false, enabled = true } = options;
const effectiveKey = allAgents ? ALL_AGENTS_LIST_KEY : agentId;
if (effectiveKey && this.#get().listAgentId !== effectiveKey) {
- this.#set({ listAgentId: effectiveKey }, false, 'useFetchTaskGroupList/syncAgentId');
+ this.#set(
+ { ...scopeChangeResetState, listAgentId: effectiveKey },
+ false,
+ 'useFetchTaskGroupList/syncAgentId',
+ );
}
return useClientDataSWR(
@@ -111,7 +129,11 @@ export class TaskListSliceActionImpl {
const { agentId, allAgents = false, enabled = true } = options;
const effectiveKey = allAgents ? ALL_AGENTS_LIST_KEY : agentId;
if (effectiveKey && this.#get().listAgentId !== effectiveKey) {
- this.#set({ listAgentId: effectiveKey }, false, 'useFetchTaskList/syncAgentId');
+ this.#set(
+ { ...scopeChangeResetState, listAgentId: effectiveKey },
+ false,
+ 'useFetchTaskList/syncAgentId',
+ );
}
return useClientDataSWR(