MCPcopy Create free account
hub / github.com/agent-tower/core / adaptTaskForList

Function adaptTaskForList

packages/web/src/components/task/adapters.ts:163–184  ·  view source on GitHub ↗
(task: SharedTask)

Source from the content-addressed store, hash-verified

161 branch: string
162} {
163 const active = getPreferredWorkspace(workspaces)
164 if (!active) {
165 return { agent: '—', branch: '—' }
166 }
167
168 const branch = getWorkspaceBranchLabel(active)
169
170 // 从活跃 workspace 的最新 session 获取 agent 类型
171 const sessions = active.sessions
172 if (sessions && sessions.length > 0) {
173 const latestSession = sessions[sessions.length - 1]
174 const agent = formatAgentType(latestSession.agentType as AgentType)
175 return { agent, branch }
176 }
177
178 return { agent: '—', branch }
179}
180
181/**
182 * 将后端 Task (+ 关联数据) 转为列表组件所需的 UITask
183 *
184 * @param task - 后端 Task 实体(可带 workspaces 关联)
185 * @returns UITask 对象,可直接传给 TaskGroup / TaskList
186 */
187export function adaptTaskForList(task: SharedTask): UITask {

Callers

nothing calls this directly

Calls 2

mapTaskStatusToUIFunction · 0.85

Tested by

no test coverage detected