diff --git a/packages/shared/src/agent-platform-types.ts b/packages/shared/src/agent-platform-types.ts index dc79f7fc4..cf0220895 100644 --- a/packages/shared/src/agent-platform-types.ts +++ b/packages/shared/src/agent-platform-types.ts @@ -67,13 +67,34 @@ export interface AgentApplication { // --- Revisions ------------------------------------------------------------- +/** Normalized reasoning-effort knob; mirrors the backend spec schema. */ +export type ReasoningEffort = "minimal" | "low" | "medium" | "high" | "xhigh"; + +/** One model in a manual priority list; per-entry reasoning overrides the spec default. */ +export interface ModelEntry { + model: string; + reasoning?: ReasoningEffort; +} + +/** Quality/cost level for an `auto` policy, resolved to a maintained model list at runtime. */ +export type ModelLevel = "low" | "medium" | "high"; + +/** + * Model selection. `auto` resolves a level to a platform-maintained, + * priority-ordered list at runtime; `manual` is the author's explicit + * priority list (first entry primary, rest fallbacks). + */ +export type ModelPolicy = + | { mode: "auto"; level: ModelLevel; reasoning?: ReasoningEffort } + | { mode: "manual"; models: ModelEntry[] }; + /** * The agent spec carried on a revision. Fully typed elaboration (triggers, * tools, mcps, skills, limits) lands with the config editor milestone; for now * the known top-level fields are surfaced and the rest passes through. */ export interface AgentSpec { - model: string; + model_policy?: ModelPolicy; triggers?: unknown[]; tools?: unknown[]; mcps?: unknown[]; @@ -86,7 +107,7 @@ export interface AgentSpec { max_wall_seconds?: number; }; entrypoint?: string; - reasoning?: "minimal" | "low" | "medium" | "high" | "xhigh"; + reasoning?: ReasoningEffort; [key: string]: unknown; } diff --git a/packages/ui/src/features/agent-applications/components/AgentChatPane.tsx b/packages/ui/src/features/agent-applications/components/AgentChatPane.tsx index 78c75d2d2..77d486e44 100644 --- a/packages/ui/src/features/agent-applications/components/AgentChatPane.tsx +++ b/packages/ui/src/features/agent-applications/components/AgentChatPane.tsx @@ -18,6 +18,7 @@ import { useAgentApplication } from "../hooks/useAgentApplication"; import { useAgentChat } from "../hooks/useAgentChat"; import { useAgentChatPendingApproval } from "../hooks/useAgentChatPendingApproval"; import { useAgentRevision } from "../hooks/useAgentRevision"; +import { modelPolicySummary } from "../utils/format"; import { resolveIngressBaseUrl } from "../utils/ingress"; import { AgentChatPendingApprovalCard } from "./AgentChatPendingApprovalCard"; import { AgentChatSurface } from "./AgentChatSurface"; @@ -199,7 +200,7 @@ export function AgentChatPane({ - - + {policy ? ( + + ) : ( + + )} + {policy?.mode === "auto" ? ( + <> + + + + ) : null} + {policy?.mode === "manual" ? ( + <> + {policy.models.map((m, i) => ( + + ))} + + + ) : null} {spec.entrypoint ? ( ) : null} diff --git a/packages/ui/src/features/agent-applications/utils/format.ts b/packages/ui/src/features/agent-applications/utils/format.ts index 3eed86c74..06371d7e9 100644 --- a/packages/ui/src/features/agent-applications/utils/format.ts +++ b/packages/ui/src/features/agent-applications/utils/format.ts @@ -2,6 +2,7 @@ import type { AgentApprovalRequestState, AgentRevisionState, AgentSessionState, + ModelPolicy, } from "@posthog/shared/agent-platform-types"; /** Formats a USD spend value for the fleet / agent stat strips. */ export function formatSpendUsd(value: number | null | undefined): string { @@ -111,3 +112,14 @@ export function revisionStateColor( return "gray"; } } + +/** Short, glanceable model-policy label for banners (e.g. "auto · high", "claude-sonnet-4-6 +1"). */ +export function modelPolicySummary( + policy: ModelPolicy | null | undefined, +): string | undefined { + if (!policy) return undefined; + if (policy.mode === "auto") return `auto · ${policy.level}`; + const [first, ...rest] = policy.models; + if (!first) return "manual"; + return rest.length > 0 ? `${first.model} +${rest.length}` : first.model; +}