cc-haha/desktop/src/api/subagents.ts
程序员阿江(Relakkes) 56a4be3d14 feat(desktop): add session activity panel
Move session tasks, background tasks, subagents, and team activity into a floating right-side activity panel with capped section scrolling.

Add subagent run detail tabs backed by the existing session run data so member activity can be inspected from the main chat.

Tested: cd desktop && bun run test -- src/components/activity/SessionActivityPanel.test.tsx

Tested: bun run check:desktop
2026-07-03 23:24:22 +08:00

38 lines
995 B
TypeScript

import { api } from './client'
import type { MessageEntry } from '../types/session'
export type SubagentRunStatus = 'running' | 'completed' | 'failed' | 'stopped' | 'unknown'
export type SubagentRunSource = 'subagent-jsonl' | 'session-history' | 'live-task' | 'none'
export type SubagentRunUsage = {
inputTokens?: number
outputTokens?: number
totalTokens?: number
}
export type SubagentRunResponse = {
sessionId: string
toolUseId: string
agentId: string | null
taskId?: string
status: SubagentRunStatus
description?: string
prompt?: string
summary?: string
result?: string
outputFile?: string
usage?: SubagentRunUsage
messages: MessageEntry[]
truncated: boolean
updatedAt?: string
source: SubagentRunSource
}
export const subagentsApi = {
getRunByTool(sessionId: string, toolUseId: string) {
return api.get<SubagentRunResponse>(
`/api/sessions/${encodeURIComponent(sessionId)}/subagents/by-tool/${encodeURIComponent(toolUseId)}`,
)
},
}