MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / TaskCard

Function TaskCard

apps/vis/web/src/components/tasks/TasksTab.tsx:70–186  ·  view source on GitHub ↗
({ sessionId, entry }: { sessionId: string; entry: BackgroundTaskEntry })

Source from the content-addressed store, hash-verified

68}
69
70function TaskCard({ sessionId, entry }: { sessionId: string; entry: BackgroundTaskEntry }) {
71 const { task } = entry;
72 const [showLog, setShowLog] = useState(false);
73 const [showRaw, setShowRaw] = useState(false);
74
75 const duration =
76 task.endedAt !== null && task.endedAt !== undefined
77 ? task.endedAt - task.startedAt
78 : null;
79
80 return (
81 <div className="border border-border bg-surface-0">
82 {/* Header line */}
83 <div className="flex flex-wrap items-center gap-2 border-b border-border px-3 py-2">
84 <Pill tone={kindTone(task.kind)} variant="outline">{task.kind}</Pill>
85 <Pill tone={STATUS_TONE[task.status]}>{task.status}</Pill>
86 <span className="font-mono text-[12px] text-fg-0">{task.taskId}</span>
87 <CopyButton value={task.taskId} />
88 {entry.agentId !== 'main' ? (
89 <Pill tone="subagent" variant="outline" title="the agent that spawned this task">
90 {entry.agentId}
91 </Pill>
92 ) : null}
93 {task.detached === false ? (
94 <Pill tone="warning" variant="outline">foreground</Pill>
95 ) : null}
96 <span className="ml-auto font-mono text-[11px] text-fg-3 tabular" title={formatAbsoluteTime(task.startedAt)}>
97 started {formatRelativeTime(task.startedAt)}
98 </span>
99 </div>
100
101 {/* Body fields */}
102 <div className="grid grid-cols-1 gap-x-6 gap-y-1 px-3 py-2 md:grid-cols-2">
103 <Field label="description">{task.description || <Dim>(none)</Dim>}</Field>
104 {task.kind === 'process' ? (
105 <>
106 <Field label="command"><code className="break-all">{task.command}</code></Field>
107 <Field label="pid">{task.pid}</Field>
108 <Field label="exitCode">
109 {task.exitCode ?? <Dim>(running)</Dim>}
110 </Field>
111 </>
112 ) : null}
113 {task.kind === 'agent' ? (
114 <>
115 <Field label="agentId">
116 {task.agentId ? (
117 <Link
118 to={`/sessions/${sessionId}/agents/${task.agentId}`}
119 className="text-[var(--color-cat-subagent)] underline-offset-2 hover:underline"
120 title="open this subagent's wire"
121 >
122 {task.agentId} →
123 </Link>
124 ) : (
125 <Dim>(none)</Dim>
126 )}
127 </Field>

Callers

nothing calls this directly

Calls 4

formatAbsoluteTimeFunction · 0.90
formatRelativeTimeFunction · 0.90
formatBytesFunction · 0.90
kindToneFunction · 0.85

Tested by

no test coverage detected