Skip to content

Add running indicator for bash commands in TUI #141

@shuv1337

Description

@shuv1337

Problem/Context

Currently, when an agent executes a bash command in the TUI, there is no visual indicator to show whether the command is still running or has finished. Users might be left wondering if the process is stuck or if it's still generating output.

Acceptance Criteria

  • A spinner indicator is displayed next to the bash command title while it is running.
  • The spinner disappears once the command completes or fails.
  • The spinner color matches the agent color (the color of the symbol next to the agent name).
  • The indicator works for both short-lived and long-running bash commands.

Implementation Details

  1. Extend ToolProps: Update the ToolProps interface in packages/opencode/src/cli/cmd/tui/routes/session/index.tsx to include the tool call status.
  2. Pass Status to Tools: In the ToolPart component, pass the status from props.part.state.status to the dynamic tool component.
  3. Update ToolTitle: Modify the ToolTitle component to accept an optional loading prop. When loading is true, display a spinner.
  4. Theming: The spinner should use the agent's color, which can be retrieved via local.agent.color(props.message.mode).
  5. Bash Tool Integration: Update the BashTool registration to pass loading={props.status !== 'completed' && props.status !== 'error'} to its ToolTitle.

Code References

  • Tool Rendering Logic: packages/opencode/src/cli/cmd/tui/routes/session/index.tsx (around line 1649)
  • Bash Tool Definition: packages/opencode/src/cli/cmd/tui/routes/session/index.tsx (around line 1792)
  • Agent Color Logic: packages/opencode/src/cli/cmd/tui/routes/session/index.tsx (around line 1528)
  • Existing Spinner Frames: packages/opencode/src/cli/cmd/tui/routes/session/sidebar.tsx (line 30)

Tasks

  • Propagate tool call status to tool components.
  • Add loading support to ToolTitle.
  • Implement spinner in BashTool (and potentially other long-running tools like WebFetchTool).
  • Verify visual consistency with the agent color and sidebar spinner.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions