一键导入
model-selector-filtering
**When to use:** When adding or modifying model selector dropdowns, or when working with the provider system and model availability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
**When to use:** When adding or modifying model selector dropdowns, or when working with the provider system and model availability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
How the multi-backend adapter system works — AgentAdapter interface, ACP protocol, session resume, and how to add new provider adapters
When debugging why an agent has the wrong provider/model, or when modifying agent creation or delegation flows.
How to get agents to use group chats for peer coordination in flightdeck-based crews. Covers hub-and-spoke anti-pattern, auto-grouping triggers, and file-lock-linked groups. Use when setting up multi-agent crews with 3+ agents or diagnosing why agents aren't collaborating directly.
When fetching from the `/coordination/activity` API and you only need specific action types (e.g., `progress_update`, `task_completed`, `delegated`).
When fetching activity data for UI display, or debugging why activity-based features show empty/stale data.
Architecture decisions and patterns from Flightdeck development (Phases 2–4). Covers feature architecture, state management, component patterns, and API design.
| name | model-selector-filtering |
| description | **When to use:** When adding or modifying model selector dropdowns, or when working with the provider system and model availability. |
When to use: When adding or modifying model selector dropdowns, or when working with the provider system and model availability.
All model dropdowns showed all 21 models across all providers (copilot, claude, gemini, etc.), but users can only use models from the active provider. Selecting a model from a different provider would silently fail.
The useModels() hook now returns both the full model list and a filtered list:
const {
models, // All 21 models (for config panels that need the full list)
filteredModels, // Only models from the active provider (for selectors)
activeProvider, // e.g. 'claude', 'copilot', 'gemini'
modelsByProvider, // { claude: [...], copilot: [...], ... }
modelName, // (id: string) => display name
} = useModels();
filteredModels:const { filteredModels: availableModels } = useModels();
<select>
<option value="">Default</option>
{availableModels.map((m) => (
<option key={m} value={m}>{deriveModelName(m)}</option>
))}
</select>
models:const { models: allModels } = useModels();
| Component | File | Purpose |
|---|---|---|
| Hook | packages/web/src/hooks/useModels.ts | Single source of truth for model data |
| Backend | packages/server/src/routes/projects.ts ~line 934 | GET /models returns activeProvider |
| Provider registry | packages/shared/src/domain/provider.ts | PROVIDER_REGISTRY with model-to-provider mapping |
| Provider manager | packages/server/src/providers/ProviderManager.ts | getActiveProviderId() resolves active provider |
{
"models": ["claude-opus-4.6", "claude-sonnet-4.6", "gpt-5.1", ...],
"defaults": { "lead": ["claude-opus-4.6"], "developer": [...] },
"modelsByProvider": {
"claude": ["claude-opus-4.6", "claude-sonnet-4.6", "claude-haiku-4.5"],
"copilot": ["gpt-5.1", "gpt-5.2", ...],
"gemini": ["gemini-3-pro-preview"]
},
"activeProvider": "claude"
}
In the hook, filteredModels is computed as:
const providerModels = cachedData?.modelsByProvider[activeProvider];
const filteredModels = providerModels
? models.filter((m) => providerModels.includes(m))
: models; // fallback: show all if provider not found
These use filteredModels (updated):
NewProjectModal.tsx — new project creationNewSessionDialog.tsx — new session within a projectSpawnDialog.tsx — spawning a new agentThese still use unfiltered models (could be updated):
AgentCard.tsx, CrewRoster.tsx, AgentActivityTable.tsx, AgentDetailPanel.tsx — model switching on running agentsModelConfigPanel.tsx fetches from /models directly (not via the hook) and needs ALL models — don't filter there_resetModelsCache() is exported for tests to clear the singleton cache between test casesactiveProvider isn't in modelsByProvider, the fallback shows all models (safe degradation)