Skip to content

Commit f995d4d

Browse files
committed
refactor(output-window): improve activity derivation logic and enhance display updates
- Replaced static activity assignment with dynamic derivation based on agent status and log-based refinements. - Updated character face and phrase generation to use derived activity for more accurate state representation.
1 parent 97b766a commit f995d4d

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

src/cli/tui/routes/workflow/components/output/output-window.tsx

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,32 @@ export function OutputWindow(props: OutputWindowProps) {
171171
const displayEngine = () => isControllerActive() ? props.controllerState!.engine : props.currentAgent?.engine
172172
const displayModel = () => isControllerActive() ? props.controllerState!.model : props.currentAgent?.model
173173

174-
// Get character face and phrase based on engine and current activity
175-
const currentFace = () => getFace(displayEngine() ?? "default", props.currentActivity ?? "idle")
176-
const currentPhrase = () => getPhrase(displayEngine() ?? "default", props.currentActivity ?? "idle")
174+
// Derive activity from agent status, with log-based refinement when running
175+
const derivedActivity = (): ActivityType => {
176+
const status = effectiveStatus()
177+
178+
// Error states
179+
if (status === "failed" || status === "retrying") {
180+
return "error"
181+
}
182+
183+
// Running state - use log-based activity detection for granularity
184+
if (status === "running") {
185+
// If we have log-based activity (thinking vs tool), use it
186+
if (props.currentActivity && props.currentActivity !== "idle") {
187+
return props.currentActivity
188+
}
189+
// Default to thinking when running but no specific activity detected
190+
return "thinking"
191+
}
192+
193+
// All other states (pending, completed, skipped, paused, awaiting, delegated)
194+
return "idle"
195+
}
196+
197+
// Get character face and phrase based on engine and derived activity
198+
const currentFace = () => getFace(displayEngine() ?? "default", derivedActivity())
199+
const currentPhrase = () => getPhrase(displayEngine() ?? "default", derivedActivity())
177200

178201
// Check if we have something to display (agent or controller in controller view)
179202
const hasDisplayContent = () => props.currentAgent != null || isControllerViewMode()

0 commit comments

Comments
 (0)