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

Function updateStatusDisplay

src/bridge/bridgeMain.ts:372–420  ·  view source on GitHub ↗

Refresh the inline status display. Shows idle or active depending on state.

()

Source from the content-addressed store, hash-verified

370
371 /** Refresh the inline status display. Shows idle or active depending on state. */
372 function updateStatusDisplay(): void {
373 // Push the session count (no-op when maxSessions === 1) so the
374 // next renderStatusLine tick shows the current count.
375 logger.updateSessionCount(
376 activeSessions.size,
377 config.maxSessions,
378 config.spawnMode,
379 )
380
381 // Push per-session activity into the multi-session display.
382 for (const [sid, handle] of activeSessions) {
383 const act = handle.currentActivity
384 if (act) {
385 logger.updateSessionActivity(sessionCompatIds.get(sid) ?? sid, act)
386 }
387 }
388
389 if (activeSessions.size === 0) {
390 logger.updateIdleStatus()
391 return
392 }
393
394 // Show the most recently started session that is still actively working.
395 // Sessions whose current activity is 'result' or 'error' are between
396 // turns — the CLI emitted its result but the process stays alive waiting
397 // for the next user message. Skip updating so the status line keeps
398 // whatever state it had (Attached / session title).
399 const [sessionId, handle] = [...activeSessions.entries()].pop()!
400 const startTime = sessionStartTimes.get(sessionId)
401 if (!startTime) return
402
403 const activity = handle.currentActivity
404 if (!activity || activity.type === 'result' || activity.type === 'error') {
405 // Session is between turns — keep current status (Attached/titled).
406 // In multi-session mode, still refresh so bullet-list activities stay current.
407 if (config.maxSessions > 1) logger.refreshDisplay()
408 return
409 }
410
411 const elapsed = formatDuration(Date.now() - startTime)
412
413 // Build trail from recent tool activities (last 5)
414 const trail = handle.activities
415 .filter(a => a.type === 'tool_start')
416 .slice(-5)
417 .map(a => a.summary)
418
419 logger.updateSessionStatus(sessionId, elapsed, activity, trail)
420 }
421
422 /** Start the status display update ticker. */
423 function startStatusUpdates(): void {

Callers 1

startStatusUpdatesFunction · 0.85

Calls 4

popMethod · 0.80
entriesMethod · 0.80
formatDurationFunction · 0.70
getMethod · 0.65

Tested by

no test coverage detected