MCPcopy Index your code
hub / github.com/codeaashu/claude-code / AgentLine

Function AgentLine

src/components/CoordinatorAgentStatus.tsx:143–272  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

141 onClick?: () => void;
142};
143function AgentLine(t0) {
144 const $ = _c(32);
145 const {
146 task,
147 name,
148 isSelected,
149 isViewed,
150 onClick
151 } = t0;
152 const {
153 columns
154 } = useTerminalSize();
155 const [hover, setHover] = React.useState(false);
156 const isRunning = !isTerminalStatus(task.status);
157 const pausedMs = task.totalPausedMs ?? 0;
158 const elapsedMs = Math.max(0, isRunning ? Date.now() - task.startTime - pausedMs : (task.endTime ?? task.startTime) - task.startTime - pausedMs);
159 let t1;
160 if ($[0] !== elapsedMs) {
161 t1 = formatDuration(elapsedMs);
162 $[0] = elapsedMs;
163 $[1] = t1;
164 } else {
165 t1 = $[1];
166 }
167 const elapsed = t1;
168 const tokenCount = task.progress?.tokenCount;
169 const lastActivity = task.progress?.lastActivity;
170 const arrow = lastActivity ? figures.arrowDown : figures.arrowUp;
171 let t2;
172 if ($[2] !== arrow || $[3] !== tokenCount) {
173 t2 = tokenCount !== undefined && tokenCount > 0 ? ` · ${arrow} ${formatNumber(tokenCount)} tokens` : "";
174 $[2] = arrow;
175 $[3] = tokenCount;
176 $[4] = t2;
177 } else {
178 t2 = $[4];
179 }
180 const tokenText = t2;
181 const queuedCount = task.pendingMessages.length;
182 const queuedText = queuedCount > 0 ? ` · ${queuedCount} queued` : "";
183 const displayDescription = task.progress?.summary || task.description;
184 const highlighted = isSelected || hover;
185 const prefix = highlighted ? figures.pointer + " " : " ";
186 const bullet = isViewed ? BLACK_CIRCLE : figures.circle;
187 const dim = !highlighted && !isViewed;
188 const sep = isRunning ? PLAY_ICON : PAUSE_ICON;
189 const namePart = name ? `${name}: ` : "";
190 const hintPart = isSelected && !isViewed ? ` · x to ${isRunning ? "stop" : "clear"}` : "";
191 const suffixPart = ` ${sep} ${elapsed}${tokenText}${queuedText}${hintPart}`;
192 const availableForDesc = columns - stringWidth(prefix) - stringWidth(`${bullet} `) - stringWidth(namePart) - stringWidth(suffixPart);
193 const t3 = Math.max(0, availableForDesc);
194 let t4;
195 if ($[5] !== displayDescription || $[6] !== t3) {
196 t4 = wrapText(displayDescription, t3, "truncate-end");
197 $[5] = displayDescription;
198 $[6] = t3;
199 $[7] = t4;
200 } else {

Callers

nothing calls this directly

Calls 6

useTerminalSizeFunction · 0.85
isTerminalStatusFunction · 0.85
formatNumberFunction · 0.85
maxMethod · 0.80
wrapTextFunction · 0.70
formatDurationFunction · 0.50

Tested by

no test coverage detected