Skip to content

Commit 54d654e

Browse files
committed
feat(workflow): add workflow name state management
Add setWorkflowName action to manage workflow name state and update it when workflow starts
1 parent 2a8277b commit 54d654e

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

src/cli/tui/routes/workflow/adapters/opentui.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface UIActions {
4343
batchAddSubAgents(parentId: string, subAgents: SubAgentState[]): void
4444
updateSubAgentStatus(subAgentId: string, status: AgentStatus): void
4545
clearSubAgents(parentId: string): void
46+
setWorkflowName(name: string): void
4647
setWorkflowStatus(status: "running" | "stopping" | "completed" | "stopped" | "awaiting" | "paused" | "error"): void
4748
setCheckpointState(checkpoint: { active: boolean; reason?: string } | null): void
4849
setInputState(inputState: InputState | null): void
@@ -95,6 +96,7 @@ export class OpenTUIAdapter extends BaseUIAdapter {
9596
case "workflow:started":
9697
// Reset timer for new workflow (will auto-start on first agent)
9798
timerService.reset()
99+
this.actions.setWorkflowName(event.workflowName)
98100
this.actions.setWorkflowStatus("running")
99101
break
100102

src/cli/tui/routes/workflow/context/ui-state/actions/workflow-actions.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ export type WorkflowActionsContext = {
1313
}
1414

1515
export function createWorkflowActions(ctx: WorkflowActionsContext) {
16+
function setWorkflowName(name: string): void {
17+
const state = ctx.getState()
18+
if (state.workflowName === name) return
19+
ctx.setState({ ...state, workflowName: name })
20+
ctx.notify()
21+
}
22+
1623
function setWorkflowStatus(status: WorkflowStatus): void {
1724
const state = ctx.getState()
1825
if (state.workflowStatus === status) return
@@ -129,6 +136,7 @@ export function createWorkflowActions(ctx: WorkflowActionsContext) {
129136
}
130137

131138
return {
139+
setWorkflowName,
132140
setWorkflowStatus,
133141
setCheckpointState,
134142
setInputState,

src/cli/tui/routes/workflow/context/ui-state/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export type UIActions = {
3636
toggleTimeline(): void
3737
setVisibleItemCount(count: number): void
3838
setScrollOffset(offset: number, visibleItemCount?: number): void
39+
setWorkflowName(name: string): void
3940
setWorkflowStatus(status: WorkflowStatus): void
4041
setCheckpointState(checkpoint: { active: boolean; reason?: string } | null): void
4142
setInputState(inputState: InputState | null): void

src/cli/tui/routes/workflow/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function Workflow(props: WorkflowProps) {
3131
}
3232

3333
return (
34-
<UIStateProvider workflowName="CodeMachine Workflow">
34+
<UIStateProvider workflowName="Workflow">
3535
<WorkflowShell
3636
version={getVersion()}
3737
currentDir={getCwd()}

0 commit comments

Comments
 (0)