| 42 | // the always-run plugin default — that's the safe state and the |
| 43 | // header would just be noise. |
| 44 | const policyBadgeFor = (policy: EffectivePolicy) => { |
| 45 | if (policy.source === "plugin-default" && policy.action === "approve") { |
| 46 | return null; |
| 47 | } |
| 48 | if (policy.source === "user") { |
| 49 | return { |
| 50 | variant: POLICY_BADGE_VARIANT[policy.action], |
| 51 | title: `Matched policy: ${policy.pattern}`, |
| 52 | text: `${POLICY_STATE_LABEL[policy.action]} · ${policy.pattern}`, |
| 53 | className: "font-mono text-[10px]", |
| 54 | }; |
| 55 | } |
| 56 | return { |
| 57 | variant: "outline" as const, |
| 58 | title: "No matching policy — plugin default applies", |
| 59 | text: `Default: ${POLICY_STATE_LABEL[policy.action]}`, |
| 60 | className: "text-[10px] text-muted-foreground", |
| 61 | }; |
| 62 | }; |
| 63 | |
| 64 | function EmptySection(props: { title: string; message: string }) { |
| 65 | return ( |