Skip to content

Commit 5e8f988

Browse files
committed
feat(controller): add distinct visual styling for controller output
add header, footer and line formatting for controller agent output use blue color and background for better visual distinction
1 parent 7309ec6 commit 5e8f988

File tree

3 files changed

+41
-2
lines changed

3 files changed

+41
-2
lines changed

src/cli/tui/routes/workflow/components/shared/log-line.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ export function LogLine(props: LogLineProps) {
148148
// Check if this is a user input line (magenta) - show with background
149149
const isUserInput = () => parsed().color === "magenta"
150150

151+
// Check if this is controller output (blue) - show with distinct background
152+
const isControllerOutput = () => parsed().color === "blue"
153+
151154
// Compute text attributes bitmask (add bold for star prefix)
152155
const textAttrs = createMemo(() => {
153156
let attrs = getTextAttributes(parsed())
@@ -189,7 +192,7 @@ export function LogLine(props: LogLineProps) {
189192
</Show>
190193
<text
191194
fg={lineColor()}
192-
bg={isUserInput() ? themeCtx.theme.backgroundElement : undefined}
195+
bg={isUserInput() ? themeCtx.theme.backgroundElement : isControllerOutput() ? '#1a365d' : undefined}
193196
attributes={textAttrs()}
194197
>
195198
{line}

src/shared/formatters/outputMarkers.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,28 @@ export function formatUserInput(text: string): string {
419419
return addMarker('MAGENTA', `${SYMBOL_USER} ${text}`, 'BOLD')
420420
}
421421

422+
/**
423+
* Format controller agent output header (distinct visual style)
424+
*/
425+
export function formatControllerHeader(agentName?: string): string {
426+
const name = agentName ?? 'Controller'
427+
return addMarker('BLUE', `┌── ${name} ${'─'.repeat(30)}`, 'BOLD')
428+
}
429+
430+
/**
431+
* Format controller agent output footer
432+
*/
433+
export function formatControllerFooter(): string {
434+
return addMarker('BLUE', `└${'─'.repeat(40)}`, 'BOLD')
435+
}
436+
437+
/**
438+
* Format controller agent output line (uses BLUE for distinct styling)
439+
*/
440+
export function formatControllerOutput(text: string): string {
441+
return addMarker('BLUE', text)
442+
}
443+
422444
/**
423445
* Format AI response header
424446
*/

src/workflows/input/controller.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ import {
1212
parseControllerAction,
1313
extractInputText,
1414
} from '../../shared/workflows/controller.js';
15+
import {
16+
formatControllerHeader,
17+
formatControllerFooter,
18+
} from '../../shared/formatters/outputMarkers.js';
1519
import type { ControllerConfig } from '../../shared/workflows/template.js';
1620
import type {
1721
InputProvider,
@@ -87,14 +91,19 @@ export class ControllerInputProvider implements InputProvider {
8791
// Build prompt for controller
8892
const prompt = context.stepOutput.output || 'Continue from where you left off.';
8993

94+
// Write controller header
95+
if (context.stepOutput.monitoringId !== undefined) {
96+
loggerService.write(context.stepOutput.monitoringId, '\n' + formatControllerHeader('PO Agent') + '\n');
97+
}
98+
9099
// Execute controller agent (resume existing session)
91100
const result = await executeAgent(config.agentId, prompt, {
92101
workingDir: this.cwd,
93102
resumeSessionId: config.sessionId,
94103
resumePrompt: prompt,
95104
abortSignal: this.abortController.signal,
96105
logger: (chunk) => {
97-
// Log controller output to step's log
106+
// Log controller output to step's log (preserve original formatting)
98107
if (context.stepOutput.monitoringId !== undefined) {
99108
loggerService.write(context.stepOutput.monitoringId, chunk);
100109
}
@@ -106,6 +115,11 @@ export class ControllerInputProvider implements InputProvider {
106115
},
107116
});
108117

118+
// Write controller footer
119+
if (context.stepOutput.monitoringId !== undefined) {
120+
loggerService.write(context.stepOutput.monitoringId, '\n' + formatControllerFooter() + '\n');
121+
}
122+
109123
if (this.aborted) {
110124
debug('[Controller] Aborted during execution');
111125
return { type: 'stop' };

0 commit comments

Comments
 (0)