[PR #4460] Added subagents to agents modal, non-selectable #10980

Closed
opened 2026-02-16 18:15:45 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/4460

State: closed
Merged: Yes


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

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/4460 **State:** closed **Merged:** Yes --- 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 <a href="https://opencode.ai/s/sYUl7LXg"><img width="200" alt="New%20session%20-%202025-11-18T15%3A35%3A21.553Z" src="https://social-cards.sst.dev/opencode-share/TmV3IHNlc3Npb24gLSAyMDI1LTExLTE4VDE1OjM1OjIxLjU1M1o=.png?model=opencode/glm-4.6&version=1.0.72&id=sYUl7LXg" /></a> [opencode session](https://opencode.ai/s/sYUl7LXg)&nbsp;&nbsp;|&nbsp;&nbsp;[github run](/sst/opencode/actions/runs/19471682374)
yindo added the pull-request label 2026-02-16 18:15:45 -05:00
yindo closed this issue 2026-02-16 18:15:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10980