fix(ui): exclude hidden agents from pickers

This commit is contained in:
Shantur Rathore
2026-02-18 16:00:58 +00:00
parent 127a1f628d
commit f75c942162
4 changed files with 9 additions and 6 deletions

View File

@@ -31,10 +31,10 @@ export default function AgentSelector(props: AgentSelectorProps) {
const availableAgents = createMemo(() => { const availableAgents = createMemo(() => {
const allAgents = instanceAgents() const allAgents = instanceAgents()
if (isChildSession()) { if (isChildSession()) {
return allAgents return allAgents.filter((agent) => !agent.hidden)
} }
const filtered = allAgents.filter((agent) => agent.mode !== "subagent") const filtered = allAgents.filter((agent) => !agent.hidden && agent.mode !== "subagent")
const currentAgent = allAgents.find((a) => a.name === props.currentAgent) const currentAgent = allAgents.find((a) => a.name === props.currentAgent)
if (currentAgent && !filtered.find((a) => a.name === props.currentAgent)) { if (currentAgent && !filtered.find((a) => a.name === props.currentAgent)) {
@@ -103,10 +103,10 @@ export default function AgentSelector(props: AgentSelectorProps) {
> >
<div class="flex-1 min-w-0"> <div class="flex-1 min-w-0">
<Select.Value<Agent>> <Select.Value<Agent>>
{(state) => ( {() => (
<div class="selector-trigger-label selector-trigger-label--stacked"> <div class="selector-trigger-label selector-trigger-label--stacked">
<span class="selector-trigger-primary selector-trigger-primary--align-left"> <span class="selector-trigger-primary selector-trigger-primary--align-left">
{t("agentSelector.trigger.primary", { agent: state.selectedOption()?.name ?? t("agentSelector.none") })} {t("agentSelector.trigger.primary", { agent: props.currentAgent || t("agentSelector.none") })}
</span> </span>
</div> </div>
)} )}

View File

@@ -287,13 +287,14 @@ const UnifiedPicker: Component<UnifiedPickerProps> = (props) => {
if (mode() !== "mention") return if (mode() !== "mention") return
const query = props.searchQuery.toLowerCase() const query = props.searchQuery.toLowerCase()
const visibleAgents = props.agents.filter((agent) => !agent.hidden)
const filtered = query const filtered = query
? props.agents.filter( ? visibleAgents.filter(
(agent) => (agent) =>
agent.name.toLowerCase().includes(query) || agent.name.toLowerCase().includes(query) ||
(agent.description && agent.description.toLowerCase().includes(query)), (agent.description && agent.description.toLowerCase().includes(query)),
) )
: props.agents : visibleAgents
setFilteredAgents(filtered) setFilteredAgents(filtered)
}) })

View File

@@ -526,6 +526,7 @@ async function fetchAgents(instanceId: string): Promise<void> {
name: agent.name, name: agent.name,
description: agent.description || "", description: agent.description || "",
mode: agent.mode, mode: agent.mode,
hidden: agent.hidden,
model: agent.model?.modelID model: agent.model?.modelID
? { ? {
providerId: agent.model.providerID || "", providerId: agent.model.providerID || "",

View File

@@ -68,6 +68,7 @@ export interface Agent {
name: string name: string
description: string description: string
mode: string mode: string
hidden?: boolean
model?: { model?: {
providerId: string providerId: string
modelId: string modelId: string