PageSourceSearch

https://www.akeptus.com/_next/static/chunks/30900-2b4f276828f2ce0d.js

js akeptus.com collected 2026-09-24 12:17:08 UTC 55,362 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[30900],{240339:(e,t,a)=>{a.d(t,{A:()=>x});var s=a(637876),r=a(894890),n=a(975656);let l=r.bOF.adminSystemModelControlPage.evalQuality,d={attention:{box:"border-[#e5383b]/20 bg-[#e5383b]/10",label:"text-[#e5383b]",chip:"bg-white text-[#e5383b] border border-[#e5383b]/20",dot:"bg-[#e5383b]",tag:"Needs attention"},warning:{box:"border-amber-200 bg-amber-50",label:"text-amber-800",chip:"bg-white text-amber-700 border border-amber-200",dot:"bg-amber-500",tag:"Warning"},info:{box:"border-blue-200 bg-blue-50",label:"text-blue-800",chip:"bg-white text-blue-700 border border-blue-200",dot:"bg-blue-500",tag:"For your info"}};function i(e){let{label:t,value:a,sublabel:r}=e;return(0,s.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-5",children:[(0,s.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:t}),(0,s.jsx)("p",{className:"mt-2 text-3xl font-light text-gray-900 tabular-nums",children:a}),r&&(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:r})]})}function o(){return(0,s.jsxs)("div",{className:"space-y-6","aria-hidden":"true",children:[(0,s.jsx)("div",{className:"space-y-3",children:[0,1].map(e=>(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4",children:[(0,s.jsx)("div",{className:"h-3 w-24 rounded bg-gray-200 animate-pulse"}),(0,s.jsx)("div",{className:"mt-3 h-4 w-3/4 rounded bg-gray-200 animate-pulse"})]},e))}),(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4",children:[0,1,2,3].map(e=>(0,s.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-5",children:[(0,s.jsx)("div",{className:"h-3 w-24 rounded bg-gray-200 animate-pulse"}),(0,s.jsx)("div",{className:"mt-3 h-8 w-16 rounded bg-gray-200 animate-pulse"}),(0,s.jsx)("div",{className:"mt-2 h-3 w-32 rounded bg-gray-200 animate-pulse"})]},e))}),(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 space-y-4",children:[(0,s.jsx)("div",{className:"h-5 w-40 rounded bg-gray-200 animate-pulse"}),[0,1,2].map(e=>(0,s.jsx)("div",{className:"h-12 rounded bg-gray-100 animate-pulse"},e))]})]})}function c(e){var t;let{flag:a}=e,r=d[a.severity],n=null!=(t=a.detail)?t:[],l=n.slice(0,8),i=n.length-l.length;return(0,s.jsx)("div",{className:"rounded-lg border px-4 py-3 ".concat(r.box),children:(0,s.jsxs)("div",{className:"flex items-start gap-3",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"mt-1.5 inline-flex h-2 w-2 shrink-0 rounded-full ".concat(r.dot)}),(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide ".concat(r.label),children:r.tag}),(0,s.jsx)("span",{className:"font-mono text-[11px] text-gray-500",children:a.kind})]}),(0,s.jsx)("p",{className:"mt-1 text-sm font-medium ".concat(r.label),children:a.message}),l.length>0&&(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[l.map(e=>(0,s.jsx)("span",{className:"inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium ".concat(r.chip),children:e},e)),i>0&&(0,s.jsxs)("span",{className:"inline-flex items-center rounded-full border border-gray-200 bg-white px-2 py-0.5 text-[11px] font-medium text-gray-600",children:["+",i," more"]})]})]})]})})}function x(){var e;let{data:t,error:a,isLoading:r}=(0,n.Ay)(l),d=null!=(e=null==t?void 0:t.data)?e:null,x=a&&"object"==typeof a&&"status"in a?a.status:void 0;return(0,s.jsxs)("section",{className:"mt-8",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h2",{className:"universal-h4 text-gray-900",children:"Eval & Quality"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"How the AI quality loop is exercising — golden coverage, divergence bands, and gaps."})]}),a&&(0,s.jsx)("div",{className:"rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-[#e5383b]",children:["Couldn't load the eval-quality feed",x?" (status ".concat(x,")"):""," — the eval feed 
1itself may be degraded."]})}),!a&&(r||!d)&&(0,s.jsx)(o,{}),!a&&d&&(0,s.jsxs)("div",{className:"space-y-8",children:[(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Coherence flags"}),d.flags.length>0?(0,s.jsx)("div",{className:"space-y-3",children:d.flags.map(e=>(0,s.jsx)(c,{flag:e},"".concat(e.kind,"-").concat(e.severity)))}):(0,s.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"No eval coherence flags — the loop is covered and exercising."})})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("h3",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:["Divergence \xb7 last ",d.windowDays,"d"]}),(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4",children:[(0,s.jsx)(i,{label:"Samples evaluated",value:d.divergence.totalSamples.toLocaleString(),sublabel:"Last ".concat(d.windowDays,"d \xb7 ").concat(d.divergence.divergedSamples.toLocaleString()," diverged")}),(0,s.jsx)(i,{label:"Bands",value:"".concat(d.divergence.byBand.info," \xb7 ").concat(d.divergence.byBand.warning," \xb7 ").concat(d.divergence.byBand.regression),sublabel:"Info \xb7 Warning \xb7 Regression"}),(0,s.jsx)(i,{label:"Diverged share",value:d.divergence.totalSamples>0?"".concat(Math.round(d.divergence.divergedSamples/d.divergence.totalSamples*100),"%"):"—",sublabel:"Of samples in window"}),(0,s.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-5",children:[(0,s.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Last evaluated"}),(0,s.jsx)("p",{className:"mt-2 text-lg font-medium text-gray-900",children:function(e){if(!e)return"Never — no samples logged";let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}(d.divergence.lastEvaluatedAt)}),d.divergence.lastEvaluatedAt&&(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Most recent sample logged by the eval loop."})]})]}),0===d.divergence.totalSamples&&(0,s.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-gray-600",children:["The eval sampler runs daily but has logged no samples in the last"," ",d.windowDays," days."]})})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Golden coverage"}),(0,s.jsxs)("p",{className:"text-xs text-gray-500 tabular-nums",children:[d.coverage.total.toLocaleString()," goldens across"," ",d.coverage.surfaces.length.toLocaleString()," ",1===d.coverage.surfaces.length?"surface":"surfaces"]})]}),d.coverage.bySurface.length>0?(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:d.coverage.bySurface.map(e=>(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-4",children:[(0,s.jsx)("p",{className:"text-sm font-semibold text-gray-900 break-words",children:e.surface}),(0,s.jsxs)("div",{className:"mt-3 flex items-center gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-2xl font-light text-gray-900 tabular-nums",children:e.goldens.toLocaleString()}),(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"Goldens"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-2xl font-light text-gray-900 tabular-nums",children:e.withRequiredTokens.toLocaleString()}),(0,s.jsx)("p",{className:"text-[11px] uppercase tracking-wide text-gray-500",children:"With required tokens"})]})]})]},e.surface))}):(0,s.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"No goldens on file yet — no surface is covered by the eval loop."})})]}),(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Recent divergences"}),d.recent.length>0?(0,s.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,s.jsx)("thead",{className:"bg-gray-50",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Surface"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Model"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Severity"}),(0,s.jsx)("th",{className:"px-4 py-3 text-right text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Similarity"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Evaluated"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:d.recent.map((e,t)=>{var a,r;return(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-4 py-3 text-sm text-gray-900 break-words",children:e.surface}),(0,s.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-gray-600",children:e.model}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-medium ".concat(function(e){let t=e.toLowerCase();return"regression"===t||"attention"===t?"bg-[#e5383b]/10 text-[#e5383b] border-[#e5383b]/20":"warning"===t?"bg-amber-50 text-amber-700 border-amber-200":"bg-gray-50 text-gray-600 border-gray-200"}
1(e.severity)),children:e.severity})}),(0,s.jsx)("td",{className:"px-4 py-3 text-right text-sm text-gray-900 tabular-nums",children:null===(r=e.similarity_score)||Number.isNaN(r)?"—":r.toFixed(2)}),(0,s.jsx)("td",{className:"px-4 py-3 text-xs text-gray-600 whitespace-nowrap",children:function(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(e.evaluated_at)})]},"".concat(null!=(a=e.golden_answer_id)?a:e.surface,"-").concat(t))})})]})})}):(0,s.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"No divergences in the window."})})]})]})]})}},256732:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(358693).A)("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]])},417688:(e,t,a)=>{a.d(t,{A:()=>w});var s=a(637876),r=a(14232),n=a(656840),l=a(975656),d=a(894890);let i=d.bOF.adminSystemModelControlPage.modelChanges,o=d.bOF.adminSystemModelControlPage.modelChangesPreview,c=d.bOF.adminSystemModelControlPage.modelChanges,x=d.bOF.adminSystemModelControlPage.modelChangesShadowValidate,m=d.bOF.adminSystemModelControlPage.modelChangeRollback,g=["document_extraction","basis_classifier","ask_drawer","cpsc_recall_watcher","panel_scrutiny_vision","plumbing_material_vision","permit_status_extraction","maintenance_scope","bill_upload_vision","finish_matches","morning_brief_rewrite","midday_brief_rewrite","autopilot_opportunity_scanner","autopilot_narrate"];function u(e){if(null==e||""===e)return"not set";if("boolean"==typeof e)return e?"enabled":"disabled";if("string"==typeof e)return e;if("number"==typeof e)return String(e);try{return JSON.stringify(e)}catch(t){return String(e)}}let p={pinned_model:"Pinned model",enabled:"Enabled"};function b(e){let{guardrails:t}=e;return 0===t.length?null:(0,s.jsx)("div",{className:"space-y-2",children:t.map(e=>{let t="block"===e.severity;return(0,s.jsx)("div",{className:"rounded-lg border px-3 py-2 ".concat(t?"border-[#e5383b]/20 bg-[#e5383b]/10":"border-amber-200 bg-amber-50"),children:(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"mt-1.5 inline-flex h-2 w-2 shrink-0 rounded-full ".concat(t?"bg-[#e5383b]":"bg-amber-500")}),(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide ".concat(t?"text-[#e5383b]":"text-amber-800"),children:t?"Blocks":"Warning"}),(0,s.jsx)("span",{className:"font-mono text-[11px] text-gray-500",children:e.code})]}),(0,s.jsx)("p",{className:"mt-0.5 text-sm ".concat(t?"text-[#e5383b]":"text-amber-800"),children:e.message})]})]})},"".concat(e.code,"-").concat(e.severity))})})}function h(e){var t,a,r,n;let{impact:l}=e,{blastRadius:d,usageBaseline:i,traceCount:o}=l,c="broad"===d.scope,x=null==(t=d.affects)?void 0:t.surfaces,m=null==(a=d.affects)?void 0:a.tools,g=null!==i&&i.calls>0;return(0,s.jsxs)("div",{className:"space-y-3",children:[(0,s.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Impact"}),(0,s.jsxs)("div",{className:"rounded-lg border-l-4 px-4 py-3 ".concat(c?"border-l-amber-400 border-y border-r border-amber-200 bg-amber-50":"border-l-gray-300 border-y border-r border-gray-200 bg-white"),children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:"Blast radius"}),c&&(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border border-amber-200 bg-white px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-amber-700",children:"Broad reach"})]}),(0,s.jsx)("p",{className:"mt-1 text-sm ".concat(c?"text-amber-800":"text-gray-700"),children:d.summary}),("number"==typeof x||"number"==typeof m)&&(0,s.jsxs)("p",{className:"mt-1 text-xs text-gray-500 tabular-nums",children:["number"==typeof x?"".concat(x," surfaces"):"","number"==typeof x&&"number"==typeof m?" \xb7 ":"","number"==typeof m?"".concat(m," tools"):""]})]}),(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-white px-4 py-3",children:[(0,s.jsxs)("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:["Usage baseline",i?" \xb7 last ".concat(i.windowDays,"d"):""]}),g?(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("span",{className:"inline-flex items-center rounded-md border border-gray-200 bg-gray-50 px-2.5 py-1 font-mono text-xs text-gray-700 tabular-nums",children:[i.calls.toLocaleStr
1ing()," calls"]}),(0,s.jsxs)("span",{className:"inline-flex items-center rounded-md border border-gray-200 bg-gray-50 px-2.5 py-1 font-mono text-xs text-gray-700 tabular-nums",children:[null!=(r=i.errorRatePct)?r:0,"% errors"]}),(0,s.jsxs)("span",{className:"inline-flex items-center rounded-md border border-gray-200 bg-gray-50 px-2.5 py-1 font-mono text-xs text-gray-700 tabular-nums",children:["p99 ",null!=(n=i.p99LatencyMs)?n:"—","ms"]})]}):(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"No traffic in the last 7 days for this feature."})]}),(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-white px-4 py-3",children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:"Traces"}),o>0?(0,s.jsxs)("p",{className:"mt-1 text-sm text-gray-700",children:[(0,s.jsx)("span",{className:"font-mono font-medium text-gray-900 tabular-nums",children:o})," ","replayable ",1===o?"trace":"traces"]}):(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-500",children:"No replayable traces yet (the trace spine is sampling)."})]})]})}function y(e){let{status:t}=e;return"promoted"===t?(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border border-emerald-200 bg-emerald-50 px-2.5 py-0.5 text-xs font-medium text-emerald-700",children:"Promoted"}):(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border border-gray-200 bg-gray-50 px-2.5 py-0.5 text-xs font-medium text-gray-500",children:"Rolled back"})}let f={info:"Clean",warning:"Advisories",regression:"Regressions"};function j(e){return(Number.isFinite(e)?e/100:0).toFixed(2)}function N(e){let{targetModel:t,featureKey:a,dryRunning:r,liveRunning:n,error:l,plan:d,summary:i,budgetStop:o,onDryRun:c,onLiveRun:x}=e;return(0,s.jsxs)("div",{className:"mt-4 rounded-lg border border-gray-200 bg-gray-50 p-5",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-baseline justify-between gap-2",children:[(0,s.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:["Shadow-validate \xb7 pinning"," ",(0,s.jsx)("span",{className:"font-mono text-gray-700",children:t})]}),(0,s.jsx)("span",{className:"text-[11px] text-gray-400",children:"Scores the model against the golden set before you promote."})]}),(0,s.jsx)("div",{className:"mt-3",children:(0,s.jsx)("button",{type:"button",onClick:c,disabled:r||n,className:"inline-flex items-center gap-2 rounded-lg border border-gray-300 bg-white px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",children:r?"Estimating…":d?"Re-estimate (dry run)":"Shadow-validate (dry run)"})}),l&&(0,s.jsx)("div",{className:"mt-3 rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-[#e5383b]",children:l})}),d&&(0,s.jsxs)("div",{className:"mt-4 rounded-lg border border-gray-200 bg-white p-4",children:[(0,s.jsxs)("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:["Plan \xb7 ",a]}),(0,s.jsxs)("p",{className:"mt-2 text-sm text-gray-800 tabular-nums",children:[(0,s.jsx)("span",{className:"font-mono font-medium text-gray-900",children:d.goldensToRun})," goldens across"," ",(0,s.jsx)("span",{className:"font-mono font-medium text-gray-900",children:d.surfaces.length})," ",1===d.surfaces.length?"surface":"surfaces"," \xb7"," ",(0,s.jsx)("span",{className:"font-mono font-medium text-gray-900",children:d.estimatedCalls})," est. calls \xb7 ~",(0,s.jsx)("span",{className:"font-mono font-medium text-gray-900",children:j(d.estimatedCostCents)})," ","USD"]}),d.surfaces.length>0&&(0,s.jsx)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:d.surfaces.map(e=>(0,s.jsx)("span",{className:"inline-flex items-center rounded-md border border-gray-200 bg-gray-50 px-2 py-0.5 font-mono text-[11px] text-gray-600",children:e},e))}),d.coverageNote&&(0,s.jsx)("p",{className:"mt-2 text-xs text-gray-500",children:d.coverageNote}),(0,s.jsxs)("div",{className:"mt-4 border-t border-gray-100 pt-4",children:[(0,s.jsx)("button",{type:"button",onClick:x,disabled:n||r,className:"inline-flex items-center gap-2 rounded-lg border border-amber-300 bg-amber-50 px-4 py-2 text-sm font-medium text-amber-800 transition-colors hover:bg-amber-100 disabled:cursor-not-allowed disabled:opacity-50",children:n?"Validating…":"Run live (~$".concat(j(d.estimatedCostCents),")")}),(0,s.jsxs)("p",{className:"mt-1.5 text-[11px] text-amber-700",children:["A live run makes real model calls and spends about"," ",j(d.estimatedCostCents)," USD. It c
1an take ~20 seconds."]})]})]}),o&&(0,s.jsx)("div",{className:"mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-amber-800",children:["Stopped by a budget guard (ran"," ",(0,s.jsx)("span",{className:"font-mono font-medium",children:o.ranBeforeStop})," before stopping)."]})}),i&&(0,s.jsxs)("div",{className:"mt-4 space-y-3 rounded-lg border border-gray-200 bg-white p-4",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,s.jsxs)("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:["Result \xb7 ran"," ",(0,s.jsx)("span",{className:"font-mono text-gray-700 tabular-nums",children:i.ran})," goldens"]}),i.passed?(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border border-emerald-200 bg-emerald-50 px-2.5 py-0.5 text-xs font-medium text-emerald-700",children:"Passed"}):(0,s.jsxs)("span",{className:"inline-flex items-center rounded-full border border-[#e5383b]/20 bg-[#e5383b]/10 px-2.5 py-0.5 text-xs font-medium text-[#e5383b]",children:["Regressions: ",i.byBand.regression]})]}),(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsxs)("span",{className:"inline-flex items-center rounded-md border border-gray-200 bg-gray-50 px-2.5 py-1 font-mono text-xs text-gray-700 tabular-nums",children:["info ",i.byBand.info]}),(0,s.jsxs)("span",{className:"inline-flex items-center rounded-md border border-amber-200 bg-amber-50 px-2.5 py-1 font-mono text-xs text-amber-800 tabular-nums",children:["warning ",i.byBand.warning]}),(0,s.jsxs)("span",{className:"inline-flex items-center rounded-md px-2.5 py-1 font-mono text-xs tabular-nums ".concat(i.byBand.regression>0?"border border-[#e5383b]/20 bg-[#e5383b]/10 text-[#e5383b]":"border border-gray-200 bg-gray-50 text-gray-700"),children:["regression ",i.byBand.regression]})]}),(0,s.jsxs)("p",{className:"text-xs text-gray-500",children:["Worst severity:"," ",(0,s.jsx)("span",{className:"font-medium ".concat("regression"===i.worstSeverity?"text-[#e5383b]":"warning"===i.worstSeverity?"text-amber-800":"text-emerald-700"),children:f[i.worstSeverity]})]}),i.bySurface.length>0&&(0,s.jsxs)("div",{className:"border-t border-gray-100 pt-3",children:[(0,s.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-gray-500",children:"By surface"}),(0,s.jsx)("ul",{className:"mt-2 space-y-1",children:i.bySurface.map(e=>(0,s.jsxs)("li",{className:"flex items-center justify-between text-xs text-gray-600",children:[(0,s.jsx)("span",{className:"font-mono text-gray-700",children:e.surface}),(0,s.jsxs)("span",{className:"tabular-nums",children:[(0,s.jsxs)("span",{className:"text-gray-500",children:[e.ran," ran"]}),(0,s.jsx)("span",{"aria-hidden":"true",className:"mx-1.5 text-gray-300",children:"\xb7"}),(0,s.jsxs)("span",{className:e.regressions>0?"font-medium text-[#e5383b]":"text-gray-500",children:[e.regressions," ",1===e.regressions?"regression":"regressions"]})]})]},e.surface))})]})]})]})}function v(){return(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden","aria-hidden":"true",children:[(0,s.jsx)("div",{className:"border-b border-gray-200 bg-gray-50 px-6 py-3",children:(0,s.jsx)("div",{className:"h-3 w-32 rounded bg-gray-200 animate-pulse"})}),(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:[0,1,2].map(e=>(0,s.jsx)("div",{className:"px-6 py-4",children:(0,s.jsx)("div",{className:"h-4 w-3/4 rounded bg-gray-100 animate-pulse"})},e))})]})}function w(){let{mutate:e}=(0,n.iX)(),{data:t,error:a,isLoading:d}=(0,l.Ay)(i),f=(0,r.useMemo)(()=>{var e,a;return null!=(a=null==t||null==(e=t.data)?void 0:e.changes)?a:[]},[t]),j=a&&"object"==typeof a&&"status"in a?a.status:void 0,[w,k]=(0,r.useState)(g[0]),[S,C]=(0,r.useState)("pinned_model"),[_,A]=(0,r.useState)(""),[P,R]=(0,r.useState)(!0),[T,M]=(0,r.useState)(""),[O,L]=(0,r.useState)(!1),[F,B]=(0,r.useState)(null),[D,E]=(0,r.useState)(null),[W,I]=(0,r.useState)(!1),[q,V]=(0,r.useState)(!1),[H,J]=(0,r.useState)(null),[U,z]=(0,r.useState)([]),[G,K]=(0,r.useState)(null),[Q,X]=(0,r.useState)(null),[Y,$]=(0,r.useState)(null),[Z,ee]=(0,r.useState)(null),[et,ea]=(0,r.useState)(!1),[es,er]=(0,r.useState)(!1),[en,el]=(0,r.useState)(null),[ed,ei]=(0,r.useState)(null),[eo,ec]=(0,r.useState)(null),[ex,em]=(0,r.useState)(null),eg="pinned_model"===S?_.trim():P,eu=_.trim(),ep="pinned_model"===S&&eu.length>0,eb=()=>{E(null),B(null),I(!1),J(null),z([]),K(null),ei(null),ec(null),em(null),el(null)},eh=null!==D&&!D.blocked;async function ey(){L(!0),B(null),E(null),I(!1),J(null),z([]),K(null);try{var e;let t=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:"feature_flag",featureKey:w,organizationId:null,field:S,value:eg})});if(!t.ok)return void B("Couldn't preview the change (status ".concat(t.status,") — no change was made."));let a=await t.json().catch(()=>null),s=null!=(e=null==a?void 0:a.data)?e:null;if(!s)return void B("Couldn't read the preview result — no change was made.");E(s)}catch(e){B("Couldn't reach the preview endpoint — no change was made.")}finally{L(!1)}}async function ef(){V(!0),J(null),z([]),K(null);try{var t,a,s,r,n,l;let d=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({target:"feature_flag",featureKey:w,organizationId:null,field:S,value:eg,note:T.trim()||void 0})});if(!d.ok&&409!==d.status)return void J("Couldn't promote the change (status ".concat(d.status,") — nothing was written."));let o=await d.json().catch(()=>null);if(409===d.status){let e=null!=(n=null!=(r=null!=(s=null==o||null==(t=o.details)?void 0:t.guardrails)?s:null==o||null==(a=o.data)?void 0:a.guardrails)?r:null==o?void 0:o.guardrails)?n:[];z(Array.isArray(e)?e:[]),J("This change was refused by a preflight guardrail — nothing was written.");return}let x=null!=(l=null==o?void 0:o.data)?l:null;x?K(x.changeId):J("Couldn't read the promote result — refresh the history to confirm."),I(!1),E(null),M(""),await e(i)}catch(e){J("Couldn't reach the promote endpoint — nothing was written.")}finally{V(!1)}}async function ej(t){X(t),ee(null);try{let a=await fetch(m(t),{method:"POST",headers:{"Content-Type":"application/json"}});if(!a.ok)return void ee("Couldn't roll back that change (status ".concat(a.status,") — nothing changed."));$(null),await e(i)}catch(e){ee("Couldn't reach the rollback endpoint — nothing changed.")}finally{X(null)}}async function eN(){if(ep){ea(!0),el(null),ec(null),em(null);try{var e;let t=await fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetModel:eu,mode:"dry_run",featureKey:w})});if(!t.ok)return void el("Couldn't estimate the shadow run (status ".concat(t.status,") — no model calls were made."));let a=await t.json().catch(()=>null),s=null!=(e=null==a?void 0:a.data)?e:null;if(!(null==s?void 0:s.plan))return void el("Couldn't read the dry-run plan — no model calls were made.");ei(s.plan)}catch(e){el("Couldn't reach the shadow-validate endpoint — no model calls were made.")}finally{ea(!1)}}}async function ev(){if(ep){er(!0),el(null),ec(null),em(null);try{var e,t,a;let s=await fetch(x,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({targetModel:eu,mode:"live",featureKey:w})});if(!s.ok&&429!==s.status)return void el("Couldn't run the live shadow validation (status ".concat(s.status,") — no change was promoted."));let r=await s.json().catch(()=>null);if(429===s.status){let a=null!=(t=null!=(e=null==r?void 0:r.data)?e:r)?t:null;em({reason:"string"==typeof(null==a?void 0:a.reason)?a.reason:"budget_guard",ranBeforeStop:"number"==typeof(null==a?void 0:a.ranBeforeStop)?a.ranBeforeStop:0});return}let n=null!=(a=null==r?void 0:r.data)?a:null;if(!(null==n?void 0:n.summary))return void el("Couldn't read the live validation summary — try the run again.");n.plan&&ei(n.plan),ec(n.summary)}catch(e){el("Couldn't reach the shadow-validate endpoint — no change was promoted.")}finally{er(!1)}}}return(0,s.jsxs)("section",{className:"mt-8",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h2",{className:"universal-h4 text-gray-900",children:"Changes & Promotion"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"Make an audited, reversible change to a feature flag — pin a model or toggle a feature."})]}),(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{htmlFor:"cp-feature",className:"block text-xs font-medium uppercase tracking-wide text-gray-500",children:"Feature"}),(0,s.jsx)("select",{id:"cp-feature",value:w,onChange:e=>{k(e.target.value),eb()},className:"mt-2 block w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 focus:border-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-400",children:g.map(e=>(0,s.jsx)("option",{value:e,children:e},e))}),(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:"Platform default (all organizations) — v1 scope."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-xs font-medium uppercase tracking-wide text-gray-500",children:"Field"}),(0,s.jsxs)("div",{className:"mt-2 inline-flex rounded-lg border border-gray-200 p-0.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{C("pinned_model"),eb()},className:"rounded-md px-4 py-1.5 text-sm font-medium transition-colors ".concat("pinned_model"===S?"bg-gray-900 text-white":"text-gray-600 hover:bg-gray-50"),"aria-pressed":"pinned_model"===S,children:"Pin model"}),(0,s.jsx)("button",{type:"button",onClick:()=>{C("enabled"),eb()},className:"rounded-md px-4 py-1.5 text-sm font-medium transition-colors ".concat("enabled"===S?"bg-gray-900 text-white":"text-gray-600 hover:bg-gray-50"),"aria-pressed":"enabled"===S,children:"Enable/disable"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("span",{className:"block text-xs font-medium uppercase tracking-wide text-gray-500",children:"New value"}),"pinned_model"===S?(0,s.jsx)("input",{type:"text",value:_,onCh
1ange:e=>{A(e.target.value),eb()},placeholder:"claude-sonnet-4-6",className:"mt-2 block w-full rounded-lg border border-gray-200 bg-white px-3 py-2 font-mono text-sm text-gray-900 focus:border-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-400"}):(0,s.jsxs)("div",{className:"mt-2 inline-flex rounded-lg border border-gray-200 p-0.5",children:[(0,s.jsx)("button",{type:"button",onClick:()=>{R(!0),eb()},className:"rounded-md px-4 py-1.5 text-sm font-medium transition-colors ".concat(P?"bg-emerald-600 text-white":"text-gray-600 hover:bg-gray-50"),"aria-pressed":P,children:"Enabled"}),(0,s.jsx)("button",{type:"button",onClick:()=>{R(!1),eb()},className:"rounded-md px-4 py-1.5 text-sm font-medium transition-colors ".concat(P?"text-gray-600 hover:bg-gray-50":"bg-gray-900 text-white"),"aria-pressed":!P,children:"Disabled"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{htmlFor:"cp-note",className:"block text-xs font-medium uppercase tracking-wide text-gray-500",children:["Note ",(0,s.jsx)("span",{className:"normal-case text-gray-400",children:"(optional)"})]}),(0,s.jsx)("input",{id:"cp-note",type:"text",value:T,onChange:e=>M(e.target.value),placeholder:"Why are you making this change?",className:"mt-2 block w-full rounded-lg border border-gray-200 bg-white px-3 py-2 text-sm text-gray-900 focus:border-gray-400 focus:outline-none focus:ring-1 focus:ring-gray-400"})]})]}),(0,s.jsxs)("div",{className:"mt-6 flex flex-wrap items-center gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:ey,disabled:O||"pinned_model"===S&&0===_.trim().length,className:"inline-flex items-center gap-2 rounded-lg bg-gray-900 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-gray-800 disabled:cursor-not-allowed disabled:opacity-50",children:O?"Previewing…":"Preview change"}),D&&!D.blocked&&!W&&(0,s.jsx)("span",{className:"text-xs text-emerald-700",children:"Preflight clear — you can promote this change."})]}),ep&&(0,s.jsx)(N,{targetModel:eu,featureKey:w,dryRunning:et,liveRunning:es,error:en,plan:ed,summary:eo,budgetStop:ex,onDryRun:eN,onLiveRun:ev}),F&&(0,s.jsx)("div",{className:"mt-4 rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-[#e5383b]",children:F})}),D&&(0,s.jsxs)("div",{className:"mt-6 space-y-4 rounded-lg border border-gray-200 bg-gray-50 p-5",children:[(0,s.jsxs)("div",{children:[(0,s.jsxs)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:["Preview \xb7 ",w," \xb7 ",p[S]]}),(0,s.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-sm",children:[(0,s.jsx)("span",{className:"inline-flex items-center rounded-md border border-gray-200 bg-white px-2.5 py-1 font-mono text-gray-700",children:u(D.currentValue)}),(0,s.jsx)("span",{"aria-hidden":"true",className:"text-gray-400",children:"→"}),(0,s.jsx)("span",{className:"inline-flex items-center rounded-md border border-gray-300 bg-white px-2.5 py-1 font-mono font-medium text-gray-900",children:u(D.resultingValue)})]})]}),(0,s.jsx)(b,{guardrails:D.guardrails}),D.impact&&(0,s.jsx)(h,{impact:D.impact}),D.blocked?(0,s.jsx)("div",{className:"rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm font-medium text-[#e5383b]",children:"Blocked — this change cannot be promoted. Resolve the guardrail above first."})}):D.guardrails.length>0?(0,s.jsx)("p",{className:"text-xs text-amber-800",children:"Advisories present — review them, then promote if you accept the tradeoff."}):null,W?(0,s.jsxs)("div",{className:"rounded-lg border border-emerald-200 bg-white p-4",children:[(0,s.jsxs)("p",{className:"text-sm text-gray-900",children:["Apply this change to production?"," ",(0,s.jsx)("span",{className:"font-medium",children:w})," →"," ",(0,s.jsx)("span",{className:"font-medium",children:p[S]})," ="," ",(0,s.jsx)("span",{className:"font-mono font-medium",children:u(D.resultingValue)})]}),(0,s.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-3",children:[(0,s.jsx)("button",{type:"button",onClick:ef,disabled:q||!eh,className:"inline-flex items-center gap-2 rounded-lg bg-emerald-700 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-emerald-600 disabled:cursor-not-allowed disabled:opacity-50",children:q?"Promoting…":"Yes, apply to production"}),(0,s.jsx)("button",{type:"button",onClick:()=>I(!1),disabled:q,className:"inline-flex items-center gap-2 rounded-lg border border-gray-200 bg-white px-4 py-2 text-sm font-medium text-gray-700 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",children:"Cancel"})]})]}):(0,s.jsx)("button",{type:"button",onClick:()=>I(!0),disabled:!eh,className:"inline-flex items-center gap-2 rounded-lg bg-emerald-700 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-emerald-600 disabled:cursor-not-allowed disabled:opacity-50",children:"Promote to production"})]}),H&&(0,s.jsxs)("div",{className:"mt-4 space-y-3",children:[(0,s.jsx)("div",{className:"rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-[#e5383b]",children:H})}),(0,s.jsx)(b,{guardrails:U})]}),G&&(0,s.jsx)("div",{className:"mt-4 rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-emerald-800",children:["Promoted — rollback token"," ",(0,s.jsx)("span",{className:"font-mono font-medium",children:G}),". Find it in the change history below to roll it back."]})})]}),(0,s.jsxs)("div",{className:"mt-8",children:[(0,s.jsxs)("div",{className:"mb-4 flex items-baseline justify-between",children:[(0,s.jsx)("h3",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Change history"}),f.length>0&&(0,s.jsxs)("span",{className:"text-xs text-gray-500 tabular-nums",children:[f.length," ",1===f.length?"change":"changes"]})]}),Z&&(0,s.jsx)("div",{className:"mb-4 rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsx)("p",{className:"text-sm text-[#e5383b]",children:Z})}),a&&(0,s.jsx)("div",{className:"rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-[#e5383b]",children:["Couldn't load the change history",j?" (status ".concat(j,")"):""," — the audit feed may be degraded."]})}),!a&&(d||!t)&&(0,s.jsx)(v,{}),!a&&t&&0===f.length&&(0,s.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"No changes yet — promote one above."})}),!a&&t&&f.length>0&&(0,s.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,s.jsx)("thead",{className:"bg-gray-50",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"When"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Feature"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Field"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Change"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Status"}),(0,s.jsx)("th",{className:"px-4 py-3 text-right text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Action"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:f.map(e=>{var t;let a=!!e.reverts_change_id,r="rolled_back"===e.status,n="promoted"===e.status&&!a&&!e.rolled_back_by_change_id,l=Q===e.id,d=Y===e.id;return(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-4 py-3 text-xs text-gray-600 whitespace-nowrap",children:function(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(e.created_at)}),(0,s.jsxs)("td",{className:"px-4 py-3 text-sm text-gray-900 break-words",children:[(0,s.jsx)("span",{className:r?"line-through text-gray-400":"",children:e.target_key}),a&&(0,s.jsx)("span",{className:"ml-2 inline-flex items-center rounded-full border border-gray-200 bg-gray-50 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-gray-500",children:"Revert"})]}),(0,s.jsx)("td",{className:"px-4 py-3 text-xs text-gray-600 whitespace-nowrap",children:null!=(t=p[e.field])?t:e.field}),(0,s.jsxs)("td",{className:"px-4 py-3 text-xs whitespace-nowrap",children:[(0,s.jsx)("span",{className:"font-mono text-gray-500",children:u(e.before_value)}),(0,s.jsx)("span",{"aria-hidden":"true",className:"mx-1.5 text-gray-400",children:"→"}),(0,s.jsx)("span",{className:"font-mono font-medium text-gray-900",children:u(e.after_value)})]}),(0,s.jsx)("td",{className:"px-4 py-3",children:(0,s.jsx)(y,{status:e.status})}),(0,s.jsx)("td",{className:"px-4 py-3 text-right",children:n?d?(0,s.jsxs)("div",{className:"inline-flex items-center gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:()=>ej(e.id),disabled:l,className:"inline-flex items-center rounded-md border border-[#e5383b]/20 bg-[#e5383b]/10 px-3 py-1.5 text-xs font-medium text-[#e5383b] transition-colors hover:bg-[#e5383b]/15 disabled:cursor-not-allowed disabled:opacity-60",children:l?"Rolling back…":"Confirm rollback"}),(0,s.jsx)("button",{type:"button",onClick:()=>$(null),disabled:l,className:"inline-flex items-center rounded-md border border-gray-200 bg-white px-3 py-1.5 text-xs font-medium text-gray-600 transition-colors hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-60",children:"Cancel"})]}):(0,s.jsx)("button",{type:"button",onClick:()=>{$(e.id),ee(null)},className:"inline-flex items-center rounded-md border border-gray-200 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 transition-colors hover:bg-gray-50",children:"Roll back"}):(0,s.jsx)("span",{className:"text-xs text-gray-400",children:"—"})})]},e.id)})})]})})})]})]})}},426694:(e,t,a)=>{a.d(t,{A:()=>c});var s=a(637876),r=a(975656);let n=a(894890).bOF.adminSystemModelControlPage.modelTraces;function l(e){let{reason:t}=e;return"error"===t?(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border border-[#e5383b]/20 bg-[#e5383b]/10 px-2.5 py-0.5 text-xs font-medium text-[#e5383b]",children:"Error"}):(0,s.jsx)("span",{className:"inline-flex items-center rounded-full border border-gray-200 bg-gray-50 px-2.5 py-0.5 text-xs font-medium text-gray-600",children:"Sampled success"})}function d(e){let{success:t}=e;return!0===t?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-emerald-700",title:"Turn succeeded",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"✓"}),(0,s.jsx)("span",{className:"sr-only",children:"Succeeded"}),(0,s.jsx)("span",{className:"not-sr-only",children:"OK"})]}):!1===t?(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-[#e5383b]",title:"Turn failed",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"✗"}),(0,s.jsx)("span",{className:"sr-only",children:"Failed"}),(0,s.jsx)("span",{className:"not-sr-only",children:"Failed"})]}):(0,s.jsxs)("span",{className:"inline-flex items-center gap-1.5 text-xs font-medium text-gray-500",title:"Outcome not recorded",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"inline-flex h-2 w-2 rounded-full bg-gray-300"}),(0,s.jsx)("span",{children:"Unknown"})]})}function i(e){let{label:t,value:a,tone:r}=e;return(0,s.jsxs)("div",{className:"rounded-lg border px-4 py-3 ".concat("danger"===r?"border-[#e5383b]/20 bg-[#e5383b]/10 text-[#e5383b]":"success"===r?"border-emerald-200 bg-emerald-50 text-emerald-700":"border-gray-200 bg-gray-50 text-gray-700"),children:[(0,s.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide ".concat("danger"===r?"text-[#e5383b]":"success"===r?"text-emerald-700":"text-gray-500"),children:t}),(0,s.jsx)("p",{className:"mt-1 text-2xl font-light tabular-nums",children:a.toLocaleStr
1ing()})]})}function o(){return(0,s.jsxs)("div",{className:"space-y-6","aria-hidden":"true",children:[(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[0,1,2].map(e=>(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4",children:[(0,s.jsx)("div",{className:"h-3 w-20 rounded bg-gray-200 animate-pulse"}),(0,s.jsx)("div",{className:"mt-3 h-7 w-12 rounded bg-gray-200 animate-pulse"})]},e))}),(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:[(0,s.jsx)("div",{className:"border-b border-gray-200 bg-gray-50 px-6 py-3",children:(0,s.jsx)("div",{className:"h-3 w-32 rounded bg-gray-200 animate-pulse"})}),(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:[0,1,2,3].map(e=>(0,s.jsx)("div",{className:"px-6 py-4",children:(0,s.jsx)("div",{className:"h-4 w-3/4 rounded bg-gray-100 animate-pulse"})},e))})]})]})}function c(){var e,t,a;let{data:c,error:x,isLoading:m}=(0,r.Ay)(n),g=null!=(e=null==c?void 0:c.data)?e:null,u=null!=(t=null==g?void 0:g.traces)?t:[],p=null!=(a=null==g?void 0:g.counts)?a:{total:0,errors:0,sampledSuccess:0},b=x&&"object"==typeof x&&"status"in x?x.status:void 0;return(0,s.jsxs)("section",{className:"mt-8",children:[(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsx)("h2",{className:"universal-h4 text-gray-900",children:"Trace Browser"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-600",children:"Recent replayable model turns — sampled 100% of errors, a fraction of successes."})]}),x&&(0,s.jsx)("div",{className:"rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsxs)("p",{className:"text-sm text-[#e5383b]",children:["Couldn't load the trace feed",b?" (status ".concat(b,")"):""," — the trace spine may be degraded."]})}),!x&&(m||!g)&&(0,s.jsx)(o,{}),!x&&g&&(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[(0,s.jsx)(i,{label:"Total traces",value:p.total,tone:"neutral"}),(0,s.jsx)(i,{label:"Errors",value:p.errors,tone:"danger"}),(0,s.jsx)(i,{label:"Sampled success",value:p.sampledSuccess,tone:"success"})]}),0===u.length?(0,s.jsx)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 px-4 py-6 text-center",children:(0,s.jsx)("p",{className:"text-sm text-gray-600",children:"No traces captured yet — the trace spine samples 100% of errors and a fraction of successes, so traces appear here as the agent is used."})}):(0,s.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:(0,s.jsx)("div",{className:"overflow-x-auto",children:(0,s.jsxs)("table",{className:"min-w-full divide-y divide-gray-200",children:[(0,s.jsx)("thead",{className:"bg-gray-50",children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"When"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Feature"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Model"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Reason"}),(0,s.jsx)("th",{className:"px-4 py-3 text-left text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Outcome"}),(0,s.jsx)("th",{className:"px-4 py-3 text-right text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Tool calls"}),(0,s.jsx)("th",{className:"px-4 py-3 text-right text-[11px] font-medium uppercase tracking-wide text-gray-500",children:"Latency (ms)"})]})}),(0,s.jsx)("tbody",{className:"divide-y divide-gray-100",children:u.map(e=>{var t,a;return(0,s.jsxs)("tr",{children:[(0,s.jsx)("td",{className:"px-4 py-3 text-xs text-gray-600 whitespace-nowrap",children:function(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(e.created_at)}),(0,s.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-gray-700 whitespace-nowrap",children:e.feature_key}),(0,s.jsx)("td",{className:"px-4 py-3 font-mono text-xs text-gray-600 max-w-[16rem] truncate",children:e.model}),(0,s.jsx)("td",{className:"px-4 py-3 whitespace-nowrap",children:(0,s.jsx)(l,{reason:e.sample_reason})}),(0,s.jsx)("td",{className:"px-4 py-3 whitespace-nowrap",children:(0,s.jsx)(d,{success:e.success})}),(0,s.jsx)("td",{className:"px-4 py-3 text-right font-mono text-xs text-gray-700 tabular-nums whitespace-nowrap",children:null===(t=e.tool_call_count)||Number.isNaN(t)?"—":t.toLocaleStr
1ing()}),(0,s.jsx)("td",{className:"px-4 py-3 text-right font-mono text-xs text-gray-700 tabular-nums whitespace-nowrap",children:null===(a=e.response_time_ms)||Number.isNaN(a)?"—":a.toLocaleString()})]},e.id)})})]})})})]})]})}},562933:(e,t,a)=>{a.r(t),a.d(t,{ModelControlView:()=>f,default:()=>j});var s=a(637876),r=a(417688),n=a(240339),l=a(426694),d=a(287856),i=a(743956),o=a(894890),c=a(89099),x=a(975656),m=a(310773),g=a(114804);let u=o.bOF.adminSystemModelControlPage.modelManifest,p={server:"bg-gray-100 text-gray-700 border border-gray-200",event:"bg-blue-50 text-blue-700 border border-blue-200",client:"bg-amber-50 text-amber-700 border border-amber-200"},b={server:"Server",event:"Event",client:"Client"};function h(e){let{label:t,value:a,sublabel:r}=e;return(0,s.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-5",children:[(0,s.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:t}),(0,s.jsx)("p",{className:"mt-2 text-3xl font-light text-gray-900 tabular-nums",children:a}),r&&(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:r})]})}function y(){return(0,s.jsxs)("div",{className:"space-y-8","aria-hidden":"true",children:[(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4",children:[0,1,2,3].map(e=>(0,s.jsxs)("div",{className:"bg-gray-50 border border-gray-200 rounded-lg p-5",children:[(0,s.jsx)("div",{className:"h-3 w-24 rounded bg-gray-200 animate-pulse"}),(0,s.jsx)("div",{className:"mt-3 h-8 w-16 rounded bg-gray-200 animate-pulse"}),(0,s.jsx)("div",{className:"mt-2 h-3 w-32 rounded bg-gray-200 animate-pulse"})]},e))}),(0,s.jsx)("div",{className:"h-4 w-80 rounded bg-gray-200 animate-pulse"}),[0,1].map(e=>(0,s.jsxs)("div",{className:"bg-white border border-gray-200 rounded-lg p-6 space-y-4",children:[(0,s.jsx)("div",{className:"h-5 w-40 rounded bg-gray-200 animate-pulse"}),[0,1,2].map(e=>(0,s.jsx)("div",{className:"h-12 rounded bg-gray-100 animate-pulse"},e))]},e))]})}let f=()=>{var e;let t=(0,c.useRouter)(),{data:a,error:o,isLoading:f,mutate:j}=(0,x.Ay)(u),N=null!=(e=null==a?void 0:a.data)?e:null,v=o&&"object"==typeof o&&"status"in o?o.status:void 0;return(0,s.jsx)(m.OV,{requiredRoles:[g.gG.SUPER_ADMIN],children:(0,s.jsx)(i.A,{children:(0,s.jsxs)("div",{className:"min-h-screen bg-gray-50 pb-16",children:[(0,s.jsx)(d.z,{title:"Model Control",description:"Read-only capability manifest for the homeowner AI — every tool the model can call, how it dispatches, and its wiring health.",breadcrumbs:[{label:"Admin",href:"/admin"},{label:"System",href:"/admin/system"},{label:"Model Control"}],actions:[(0,s.jsx)("button",{type:"button",onClick:()=>t.push("/admin/system"),className:"flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors text-sm font-medium",children:"Back to System Status"},"back"),(0,s.jsxs)("button",{type:"button",onClick:()=>j(),disabled:f,className:"flex items-center gap-2 px-4 py-2 bg-gray-100 text-gray-700 rounded-lg hover:bg-gray-200 transition-colors text-sm font-medium",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"inline-flex h-2 w-2 rounded-full ".concat(f?"bg-emerald-500 animate-ping":"bg-gray-400")}),f?"Refreshing…":"Refresh"]},"refresh")]}),(0,s.jsxs)("div",{className:"max-w-7xl mx-auto px-6 py-8",children:[o&&(0,s.jsx)("div",{className:"mb-6 rounded-lg border border-[#e5383b]/20 bg-[#e5383b]/10 px-4 py-3",children:(0,s.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsxs)("p",{className:"text-sm text-[#e5383b]",children:["Couldn't load the model manifest",v?" (status ".concat(v,")"):"","."]}),(0,s.jsx)("button",{type:"button",onClick:()=>j(),disabled:f,className:"inline-flex items-center justify-center rounded-md border border-[#e5383b]/20 bg-white px-3 py-1.5 text-sm font-medium text-[#e5383b] hover:bg-[#e5383b]/15 disabled:cursor-not-allowed disabled:opacity-60",children:f?"Trying again…":"Try loading model control again"})]})}),!o&&(f||!N)&&(0,s.jsx)(y,{}),!o&&N&&(0,s.jsxs)("div",{className:"space-y-8",children:[(0,s.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-4 gap-4",children:[(0,s.jsx)(h,{label:"Callable tools",value:N.counts.total.toLocaleStr
1ing(),sublabel:"Tools the agent can call"}),(0,s.jsx)(h,{label:"Dispatch classes",value:"".concat(N.counts.server," \xb7 ").concat(N.counts.event," \xb7 ").concat(N.counts.client),sublabel:"Server \xb7 Event \xb7 Client"}),(0,s.jsx)(h,{label:"Writes vs reads",value:"".concat(N.counts.writes," / ").concat(N.counts.reads),sublabel:"Write tools / read tools"}),(0,s.jsxs)("div",{className:"bg-gray-50 border border-emerald-200 rounded-lg p-5",children:[(0,s.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-gray-500",children:"Wiring health"}),(0,s.jsxs)("div",{className:"mt-2 inline-flex items-center gap-2",children:[(0,s.jsx)("span",{"aria-hidden":"true",className:"inline-flex h-2.5 w-2.5 rounded-full bg-emerald-500"}),(0,s.jsx)("span",{className:"text-lg font-medium text-emerald-700",children:"Enforced"})]}),(0,s.jsxs)("p",{className:"mt-2 text-xs text-gray-600",children:["No dark tools — every server tool has a handler. Guaranteed by"," ",(0,s.jsx)("span",{className:"font-mono text-[11px] text-gray-700",children:N.darkInvariant.enforcedBy}),"."]})]})]}),(0,s.jsx)("div",{className:"bg-white border border-gray-200 rounded-lg px-6 py-4",children:(0,s.jsxs)("p",{className:"text-sm text-gray-700",children:[(0,s.jsx)("span",{className:"font-medium text-gray-900",children:"Dispatch handlers:"})," ",(0,s.jsx)("span",{className:"tabular-nums",children:N.registryCoverage.readHandlers})," ","read \xb7"," ",(0,s.jsx)("span",{className:"tabular-nums",children:N.registryCoverage.writeHandlers})," ","write \xb7"," ",(0,s.jsx)("span",{className:"tabular-nums",children:N.registryCoverage.eventHandlers})," ","event \xb7"," ",(0,s.jsx)("span",{className:"tabular-nums",children:N.registryCoverage.inlineHandlers})," ","inline"]})}),(0,s.jsxs)("div",{className:"space-y-6",children:[(0,s.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,s.jsx)("h2",{className:"universal-h4 text-gray-900",children:"Tool roster"}),(0,s.jsxs)("p",{className:"text-xs text-gray-500",children:[N.counts.categories.toLocaleString()," categories \xb7"," ",N.counts.total.toLocaleString()," tools"]})]}),N.categories.map(e=>(0,s.jsxs)("section",{className:"bg-white border border-gray-200 rounded-lg overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-6 py-3 border-b border-gray-200 bg-gray-50",children:[(0,s.jsx)("h3",{className:"text-sm font-semibold text-gray-900",children:e.category}),(0,s.jsxs)("span",{className:"text-xs text-gray-500 tabular-nums",children:[e.tools.length," ",1===e.tools.length?"tool":"tools"]})]}),(0,s.jsx)("ul",{className:"divide-y divide-gray-100",children:e.tools.map(e=>(0,s.jsx)("li",{className:"px-6 py-4",children:(0,s.jsxs)("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between",children:[(0,s.jsxs)("div",{className:"min-w-0",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,s.jsx)("span",{className:"text-sm font-semibold text-gray-900",children:e.label}),(0,s.jsx)("span",{className:"font-mono text-xs text-gray-500",children:e.name})]}),e.description&&(0,s.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:e.description})]}),(0,s.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,s.jsx)("span",{className:"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium ".concat(p[e.dispatch]),children:b[e.dispatch]}),(0,s.jsx)("span",{className:"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium border ".concat(e.writes?"bg-[#e5383b]/10 text-[#e5383b] border-[#e5383b]/20":"bg-gray-50 text-gray-600 border-gray-200"),children:e.writes?"Writes":"Reads"})]})]})},e.name))})]},e.category))]})]}),(0,s.jsx)(n.A,{}),(0,s.jsx)(r.A,{}),(0,s.jsx)(l.A,{})]})]})})})},j=f},729053:(e,t,a)=>{a.d(t,{A:()=>s});let s=(0,a(358693).A)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.