Skip to content

Added subagents to agents modal, non-selectable#4460

Merged
rekram1-node merged 3 commits intodevfrom
opencode/issue4452-20251118153522
Nov 19, 2025
Merged

Added subagents to agents modal, non-selectable#4460
rekram1-node merged 3 commits intodevfrom
opencode/issue4452-20251118153522

Conversation

@opencode-agent
Copy link
Copy Markdown
Contributor

Perfect! Now I can see the agent structure. The mode field can be "subagent", "primary", or "all". Looking at the built-in agents:

  • general: mode "subagent"
  • build: mode "primary"
  • plan: mode "primary"

This confirms that my implementation should work correctly. Let me create a simple summary of what I've implemented:

Summary

I've successfully modified the agents modal in the TUI to list both primary agents and subagents with the following changes:

Files Modified:

  1. /home/runner/work/opencode/opencode/packages/opencode/src/cli/cmd/tui/component/dialog-agent.tsx:

    • Added useSync and useTheme imports
    • Modified to fetch all agents (including subagents) from sync.data.agent
    • Separated agents into primary agents and subagents
    • Added categorization: "Primary Agents" and "Subagents"
    • Marked subagents as disabled: true with distinct styling
    • Added "subagent" footer text for subagents
    • Added background color for subagents
    • Prevented selection of disabled options
  2. /home/runner/work/opencode/opencode/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx:

    • Removed filtering of disabled options from the filtered memo so they appear in the list
    • Updated keyboard handling to prevent selection of disabled options on Enter key
    • Updated mouse click handling to prevent selection of disabled options
    • Updated keybind handling to prevent triggering on disabled options
    • Enhanced Option component to accept and handle disabled prop
    • Added distinct styling for disabled options using theme.textMuted
    • Removed current indicator (●) for disabled options
    • Made text muted for disabled options

Key Features:

Subagents are visible - Users can now see all loaded subagents in the modal
Subagents are not selectable - Disabled state prevents selection via keyboard, mouse, or keybinds
Visual distinction - Subagents appear with muted text color and "subagent" footer label
Clear categorization - Primary agents and subagents are grouped separately
Maintains existing functionality - Primary agents work exactly as before

The implementation addresses the GitHub issue where users couldn't see their subagents (like custom agents in ~/.config/opencode/agent/) in the /agents command modal. Now subagents will be visible but clearly marked as non-selectable, solving the confusion while maintaining the proper UX distinction between primary agents and subagents.

Closes #4452

New%20session%20-%202025-11-18T15%3A35%3A21.553Z
opencode session  |  github run

@rekram1-node
Copy link
Copy Markdown
Collaborator

/oc make it more clear that you can't select them, also remove the subagent text on far right for each subagent

Additionally if I am flipping through agents make it so I cant select a subagent at all, the selector should just loop back to the top agent

@opencode-agent
Copy link
Copy Markdown
Contributor Author

opencode-agent Bot commented Nov 19, 2025

Perfect! I've made the following changes to address your requirements:

Changes Made:

  1. Removed subagent text on far right: Removed the footer: "subagent" from subagent options in dialog-agent.tsx:33

  2. Made it more clear subagents can't be selected:

    • Added "(non-selectable)" suffix to subagent titles in dialog-agent.tsx:28
    • Added a hollow circle (○) indicator for disabled options in dialog-select.tsx:276-280
    • Added TextAttributes.DIM styling for disabled options to make them visually distinct
  3. Prevented subagent selection when flipping through agents:

    • Modified the move() function in dialog-select.tsx:93-110 to skip disabled options when navigating with arrow keys
    • Added logic to loop through options and skip any that are disabled, ensuring the selector only lands on selectable primary agents

The implementation now:

  • Shows subagents with "(non-selectable)" in their title
  • Uses a hollow circle (○) instead of no indicator for subagents
  • Applies dimmed text styling to make subagents visually distinct
  • Automatically skips subagents when using arrow keys to navigate, looping back to primary agents only
  • Maintains all existing functionality for primary agents

New%20session%20-%202025-11-19T00%3A41%3A33.922Z
opencode session  |  github run

@rekram1-node
Copy link
Copy Markdown
Collaborator

/oc update it so non-selectable or whatever is next to the Subagents banner rather than next to every subagent

@opencode-agent
Copy link
Copy Markdown
Contributor Author

opencode-agent Bot commented Nov 19, 2025

ProviderInitError

opencode session  |  github run

@opencode-agent
Copy link
Copy Markdown
Contributor Author

opencode-agent Bot commented Nov 19, 2025

Updated the code to move "non-selectable" text next to the Subagents banner instead of each individual subagent.

New%20session%20-%202025-11-19T00%3A49%3A35.130Z
opencode session  |  github run

@rekram1-node
Copy link
Copy Markdown
Collaborator

/oc u did mess up the highlighting plz fix

@opencode-agent
Copy link
Copy Markdown
Contributor Author

opencode-agent Bot commented Nov 19, 2025

Perfect! Now the highlighting should be fixed. The changes I made:

  1. Background color: Disabled options won't get the highlight background color when active
  2. Description text color: When a disabled option is active, the description stays muted instead of switching to background color
  3. Footer text color: Same fix for footer text

The highlighting issue was that disabled subagents were getting the same visual treatment as active selectable agents, making them appear selectable when they weren't.

New%20session%20-%202025-11-19T05%3A49%3A08.739Z
opencode session  |  github run

@rekram1-node rekram1-node force-pushed the opencode/issue4452-20251118153522 branch from 86c7f42 to d1f474a Compare November 19, 2025 06:24
@rekram1-node rekram1-node merged commit 9004419 into dev Nov 19, 2025
5 checks passed
rekram1-node added a commit that referenced this pull request Nov 19, 2025
@thdxr thdxr deleted the opencode/issue4452-20251118153522 branch February 7, 2026 06:24
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Added subagents to agents modal, non-selectable (anomalyco#4460)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The Markdown for the agent is not being recognized in ~/.config/opencode/agent

1 participant