// PEP-41: provider / model / effort of the agent and escalation (project and story). import { AGENT_EFFORT_RU, AGENT_EFFORTS, AGENT_PROVIDERS, agentSettingsLabel, type AgentSettings, type AgentSettingsPatch, type Escalation } from "@peppa/core"; import { setAgentSettingsAction } from "@/app/(app)/actions"; import { Hidden } from "@/components/cards"; import { Badge } from "@/components/ui/badge"; import { Button } from "@/components/ui/button"; import { Input, Label, NativeSelect } from "@/components/ui/input"; import { getT } from "@/lib/i18n"; import { m, type Translator } from "@peppa/shared/i18n"; const PROVIDER_RU: Record = { claude: "Claude Code", codex: "Codex", opencode: "OpenCode" }; const inherit = (t: Translator, v: string | number | null | undefined, none = m("по умолчанию")) => (v == null ? t(none) : t("как выше: {n}", { n: typeof v === "string" ? t(v) : v })); async function ProviderSelect({ name, own, inherited, none }: { name: string; own?: string | null; inherited?: string | null; none?: string }) { const t = await getT(); return ( {AGENT_PROVIDERS.map((p) => ( ))} ); } async function EffortSelect({ name, own, inherited }: { name: string; own?: string | null; inherited?: string | null }) { const t = await getT(); return ( {AGENT_EFFORTS.map((e) => ( ))} ); } /** «⋯ Настройки проекта → Модель агента». */ export async function AgentModelPanel({ projectId, own, inherited, back }: { projectId: number; own: AgentSettingsPatch; inherited: AgentSettings; back: string }) { const t = await getT(); return (

{t("Эскалация после неудач")}

{t("Запасной провайдер")}

{t("Модель — для")} --model {t("(sonnet, opus, gpt-5-codex…), действует только на своего провайдера.")}{" "} {t("Неудачи — красные проверки по разным коммитам и возвраты ревьюера; после порога стори до конца идёт на сильной модели, живой раннер перезапускается в том же разговоре.")}{" "} {t("Запасной провайдер — если у основного нет рабочей подписки в пуле.")}

); } /** Story page: provider / model / effort for this story only, and the escalation mark. */ export async function TaskAgentModel({ taskKey, own, inherited, escalation, back }: { taskKey: string; own: AgentSettingsPatch; inherited: AgentSettings; escalation: Escalation | null; back: string }) { const t = await getT(); return (

{t("Сейчас:")} {t.text(agentSettingsLabel({ ...inherited, ...own }))} {escalation && ( {t("эскалация на {model} после {failures} неудач", { model: escalation.model, failures: escalation.failures })} )}

); }