mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
25 lines
860 B
TypeScript
25 lines
860 B
TypeScript
import type { RuntimeWorktreeAgentRow } from '../../shared/worktree/catalog/runtime-worktree-contracts'
|
|
import {
|
|
programStatusAttentionLabel,
|
|
resolveProgramStatusPresentation
|
|
} from '../../shared/program-status/presentation'
|
|
|
|
/** A block takes precedence over progress. */
|
|
export function formatWorktreePsProgramStatus(
|
|
agents: readonly RuntimeWorktreeAgentRow[] | undefined
|
|
): string {
|
|
let progress: number | undefined
|
|
for (const agent of agents ?? []) {
|
|
const presentation = resolveProgramStatusPresentation({
|
|
state: agent.state,
|
|
programStatus: agent.programStatus,
|
|
toolName: agent.toolName ?? undefined
|
|
})
|
|
if (presentation.attention) {
|
|
return ` (${programStatusAttentionLabel(presentation.attention)})`
|
|
}
|
|
progress ??= presentation.progress
|
|
}
|
|
return progress === undefined ? '' : ` ${progress}%`
|
|
}
|