fix(agents): use isPrimaryMode consistently across all agent pickers (#1713)
* fix(agents): use isPrimaryMode filter for agent picker Fix #1527: agent picker filtered by mode !== 'subagent' which missed agents with unexpected mode values. Now uses isPrimaryMode() which only includes 'primary', 'all', undefined, and null — the semantically correct set of agents that should appear in the picker. * fix(agents): use isPrimaryMode consistently across all agent pickers Updated AgentSelector.tsx to use isPrimaryMode instead of mode !== 'subagent'. Removed duplicate isPrimaryMode definition from useConfigStore.ts and imported the shared helper from mobileControlsUtils. --------- Co-authored-by: Leonid Skorobogatyy <bash@opencode.itc.local>
This commit is contained in:
committed by
GitHub
co-authored by
Leonid Skorobogatyy
parent
ac0f173655
commit
6e68015389
@@ -35,7 +35,7 @@ import { getSessionMaterializationStatus } from '@/sync/materialization';
|
||||
import { useUIStore } from '@/stores/useUIStore';
|
||||
import { useModelLists } from '@/hooks/useModelLists';
|
||||
import { useIsTextTruncated } from '@/hooks/useIsTextTruncated';
|
||||
import { formatEffortLabel, getCycledPrimaryAgentName, type MobileControlsPanel } from './mobileControlsUtils';
|
||||
import { formatEffortLabel, getCycledPrimaryAgentName, isPrimaryMode, type MobileControlsPanel } from './mobileControlsUtils';
|
||||
import { getCurrentIntlLocale, useI18n } from '@/lib/i18n';
|
||||
import { useOpenCodeReadiness } from '@/hooks/useOpenCodeReadiness';
|
||||
import { eventMatchesShortcut, getEffectiveShortcutCombo, normalizeCombo } from '@/lib/shortcuts';
|
||||
@@ -492,7 +492,7 @@ export const ModelControls: React.FC<ModelControlsProps> = ({
|
||||
}, [isAgentSelectorOpen, isCompact]);
|
||||
|
||||
const selectableDesktopAgents = React.useMemo(() => {
|
||||
return agents.filter((agent) => agent.mode !== 'subagent');
|
||||
return agents.filter((agent) => isPrimaryMode(agent.mode));
|
||||
}, [agents]);
|
||||
|
||||
const sortedAndFilteredAgents = React.useMemo(() => {
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
SelectValue,
|
||||
} from '@/components/ui/select';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { isPrimaryMode } from '@/components/chat/mobileControlsUtils';
|
||||
import { useConfigStore } from '@/stores/useConfigStore';
|
||||
import { useI18n } from '@/lib/i18n';
|
||||
|
||||
@@ -44,7 +45,7 @@ export const AgentSelector: React.FC<AgentSelectorProps> = ({
|
||||
const defaultAgentName = useConfigStore((state) => state.currentAgentName);
|
||||
const agents = getVisibleAgents();
|
||||
const selectableAgents = React.useMemo(
|
||||
() => agents.filter((agent) => agent.mode !== 'subagent'),
|
||||
() => agents.filter((agent) => isPrimaryMode(agent.mode)),
|
||||
[agents]
|
||||
);
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import { scopeMatches, subscribeToConfigChanges } from "@/lib/configSync";
|
||||
import type { ModelMetadata } from "@/types";
|
||||
import { getSafeStorage } from "./utils/safeStorage";
|
||||
import { filterVisibleAgents } from "./useAgentsStore";
|
||||
import { isPrimaryMode } from "@/components/chat/mobileControlsUtils";
|
||||
import { useSessionUIStore } from "@/sync/session-ui-store";
|
||||
import { useSelectionStore } from "@/sync/selection-store";
|
||||
import { getRegisteredRuntimeAPIs } from "@/contexts/runtimeAPIRegistry";
|
||||
@@ -179,8 +180,6 @@ const parseModelString = (modelString: string): { providerId: string; modelId: s
|
||||
|
||||
const normalizeProviderId = (value: string) => value?.toLowerCase?.() ?? '';
|
||||
|
||||
const isPrimaryMode = (mode?: string) => mode === "primary" || mode === "all" || mode === undefined || mode === null;
|
||||
|
||||
type ProviderModel = Provider["models"][string];
|
||||
type ProviderWithModelList = Omit<Provider, "models"> & { models: ProviderModel[] };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user