MCPcopy Create free account
hub / github.com/Noumena-Network/code / renderStatusLine

Function renderStatusLine

src/bridge/bridgeUI.ts:189–293  ·  view source on GitHub ↗

Render and write the current status lines based on state.

()

Source from the content-addressed store, hash-verified

187
188 /** Render and write the current status lines based on state. */
189 function renderStatusLine(): void {
190 if (currentState === 'reconnecting' || currentState === 'failed') {
191 // These states are handled separately (updateReconnectingStatus /
192 // updateFailedStatus). Return before clearing so callers like toggleQr
193 // and setSpawnModeDisplay don't blank the display during these states.
194 return
195 }
196
197 clearStatusLines()
198
199 const isIdle = currentState === 'idle'
200
201 // QR code above the status line
202 if (qrVisible) {
203 for (const line of qrLines) {
204 writeStatus(`${chalk.dim(line)}\n`)
205 }
206 }
207
208 // Determine indicator and colors based on state
209 const indicator = BRIDGE_READY_INDICATOR
210 const indicatorColor = isIdle ? chalk.green : chalk.cyan
211 const baseColor = isIdle ? chalk.green : chalk.cyan
212 const stateText = baseColor(currentStateText)
213
214 // Build the suffix with repo and branch
215 let suffix = ''
216 if (repoName) {
217 suffix += chalk.dim(' \u00b7 ') + chalk.dim(repoName)
218 }
219 // In worktree mode each session gets its own branch, so showing the
220 // bridge's branch would be misleading.
221 if (branch && spawnMode !== 'worktree') {
222 suffix += chalk.dim(' \u00b7 ') + chalk.dim(branch)
223 }
224
225 if (isInternalBuild() && debugLogPath) {
226 writeStatus(
227 `${chalk.yellow('[NOUMENA-ONLY] Logs:')} ${chalk.dim(debugLogPath)}\n`,
228 )
229 }
230 writeStatus(`${indicatorColor(indicator)} ${stateText}${suffix}\n`)
231
232 // Session count and per-session list (multi-session mode only)
233 if (sessionMax > 1) {
234 const modeHint =
235 spawnMode === 'worktree'
236 ? 'New sessions will be created in an isolated worktree'
237 : 'New sessions will be created in the current directory'
238 writeStatus(
239 ` ${chalk.dim(`Capacity: ${sessionActive}/${sessionMax} \u00b7 ${modeHint}`)}\n`,
240 )
241 for (const [, info] of sessionDisplayInfo) {
242 const titleText = info.title
243 ? truncatePrompt(info.title, 35)
244 : chalk.dim('Attached')
245 const titleLinked = wrapWithOsc8Link(titleText, info.url)
246 const act = info.activity

Callers 7

regenerateQrFunction · 0.85
updateIdleStatusFunction · 0.85
setAttachedFunction · 0.85
updateSessionStatusFunction · 0.85
toggleQrFunction · 0.85
setSessionTitleFunction · 0.85
refreshDisplayFunction · 0.85

Calls 6

clearStatusLinesFunction · 0.85
writeStatusFunction · 0.85
isInternalBuildFunction · 0.85
buildIdleFooterTextFunction · 0.85
buildActiveFooterTextFunction · 0.85
wrapWithOsc8LinkFunction · 0.70

Tested by

no test coverage detected