MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / updateStatusDisplay

Function updateStatusDisplay

source code/bridge/bridgeMain.ts:374–422  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

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

Callers 1

startStatusUpdatesFunction · 0.85

Calls 3

entriesMethod · 0.80
formatDurationFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected