@tonyclaw/agent-inspector 3.0.41 → 3.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-D7CEZjaX.js → CompareDrawer-7Gr3T28l.js} +1 -1
  3. package/.output/public/assets/{InspectorPet-CZC5A3d3.js → InspectorPet-BYY_Sa_k.js} +1 -1
  4. package/.output/public/assets/{ProxyViewerContainer-DoCpLJM1.js → ProxyViewerContainer-CCtygisW.js} +5 -5
  5. package/.output/public/assets/{ReplayDialog-O7zJrccK.js → ReplayDialog-By1tvcuO.js} +1 -1
  6. package/.output/public/assets/{RequestAnatomy-DzJwNU_L.js → RequestAnatomy-AbVJG4VA.js} +1 -1
  7. package/.output/public/assets/{ResponseView-NZExNRvM.js → ResponseView-BqfnTwq-.js} +1 -1
  8. package/.output/public/assets/{StreamingChunkSequence-DXcrVPst.js → StreamingChunkSequence-BK_GhL1n.js} +1 -1
  9. package/.output/public/assets/{_sessionId-B5lQVwmL.js → _sessionId-BEVn_RD0.js} +1 -1
  10. package/.output/public/assets/{_sessionId-BOAAnQhC.js → _sessionId-BsoVln_N.js} +1 -1
  11. package/.output/public/assets/{index-BlSm4bqn.js → index-BmKouSES.js} +2 -2
  12. package/.output/public/assets/{index-IpdII72q.js → index-D1Ar_Dtb.js} +1 -1
  13. package/.output/public/assets/{index-DswDeL6m.js → index-DPsfwdop.js} +1 -1
  14. package/.output/public/assets/{index-zdDXZ8fd.js → index-DavUo6mY.js} +1 -1
  15. package/.output/public/assets/{json-viewer-C_vPvztu.js → json-viewer-vkLlnvyf.js} +1 -1
  16. package/.output/public/assets/{jszip.min-BLbXONM_.js → jszip.min-CMLonFfU.js} +1 -1
  17. package/.output/server/{_sessionId-XMJZJjKn.mjs → _sessionId-BH52f7aR.mjs} +1 -1
  18. package/.output/server/{_sessionId-BDR3VoGL.mjs → _sessionId-DYkPEoJd.mjs} +2 -2
  19. package/.output/server/_ssr/{CompareDrawer-Dc10NRP-.mjs → CompareDrawer-Bt3LIoPy.mjs} +2 -2
  20. package/.output/server/_ssr/{InspectorPet-bAbBl9xU.mjs → InspectorPet-CikVNW8S.mjs} +1 -1
  21. package/.output/server/_ssr/{ProxyViewerContainer-C833zSld.mjs → ProxyViewerContainer-BS6MZd0t.mjs} +9 -9
  22. package/.output/server/_ssr/{ReplayDialog-irE6GkCe.mjs → ReplayDialog-DxFLoYlZ.mjs} +3 -3
  23. package/.output/server/_ssr/{RequestAnatomy-CCbfr4bA.mjs → RequestAnatomy-CbLJjhKb.mjs} +2 -2
  24. package/.output/server/_ssr/{ResponseView-TE4dZ2zB.mjs → ResponseView-Bs1sYg_8.mjs} +2 -2
  25. package/.output/server/_ssr/{StreamingChunkSequence-C3-k9wrY.mjs → StreamingChunkSequence-D0dBru3U.mjs} +2 -2
  26. package/.output/server/_ssr/{index-CQt9ZYRA.mjs → index-DIHmtfFU.mjs} +1 -1
  27. package/.output/server/_ssr/{index-CORKk6yP.mjs → index-hK95DE4-.mjs} +2 -2
  28. package/.output/server/_ssr/index.mjs +2 -2
  29. package/.output/server/_ssr/{json-viewer-CPCoU-8e.mjs → json-viewer-BfRCUg1t.mjs} +2 -2
  30. package/.output/server/_ssr/{router-CzPRr1HX.mjs → router-NjASMtmk.mjs} +5 -5
  31. package/.output/server/{_tanstack-start-manifest_v-BRb947T9.mjs → _tanstack-start-manifest_v-BNqjyvHx.mjs} +1 -1
  32. package/.output/server/index.mjs +91 -91
  33. package/package.json +5 -4
@@ -1 +1 @@
1
- import{r as l,j as s,B as y}from"./index-BlSm4bqn.js";import{c as ae,u as le,i as D,D as oe,j as ie,k as de,l as ue,m as L,T as R,n as N,o as d,p as u,q as ce,s as pe,t as me,v as xe,w as fe,x as U,y as j,z as he,A as ye,E as je,F as A,G as H,H as be}from"./ProxyViewerContainer-DoCpLJM1.js";import{ResponseView as O}from"./ResponseView-NZExNRvM.js";const ge=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],Te=ae("braces",ge);function G(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ve(e){return e==null?null:new TextEncoder().encode(e).length}function Re(e){try{const t=JSON.parse(e);if(!G(t))return null;const a=t.model;return typeof a=="string"&&a.length>0?a:null}catch{return null}}function Ne(e,t){try{const a=JSON.parse(e);return G(a)?{body:JSON.stringify({...a,model:t},null,2),error:null}:{body:e,error:"Request body must be a JSON object."}}catch{return{body:e,error:"Request body must be valid JSON before changing the replay model."}}}function V(e){return{status:e.status??null,elapsedMs:e.elapsedMs??null,inputTokens:e.inputTokens??null,outputTokens:e.outputTokens??null,responseBytes:ve(e.responseText),streaming:e.streaming===!0}}function g(e,t){return e===null||t===null?null:t-e}function ke(e,t){return[{id:"status",label:"Status",original:e.status,replay:t.status,delta:g(e.status,t.status)},{id:"elapsed",label:"Elapsed",original:e.elapsedMs,replay:t.elapsedMs,delta:g(e.elapsedMs,t.elapsedMs)},{id:"input",label:"Input",original:e.inputTokens,replay:t.inputTokens,delta:g(e.inputTokens,t.inputTokens)},{id:"output",label:"Output",original:e.outputTokens,replay:t.outputTokens,delta:g(e.outputTokens,t.outputTokens)},{id:"bytes",label:"Bytes",original:e.responseBytes,replay:t.responseBytes,delta:g(e.responseBytes,t.responseBytes)},{id:"streaming",label:"Stream",original:e.streaming,replay:t.streaming,delta:null}]}const Se=U({success:A(),error:H().optional(),responseStatus:j().nullable().optional(),responseText:H().nullable().optional(),inputTokens:j().nullable().optional(),outputTokens:j().nullable().optional(),elapsedMs:j().nullable().optional(),streaming:A().optional(),replayLogId:j().optional()}),we=U({logs:he(be),total:j()}),Me=6e4,Ce=1e4;function k(e){try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}function Oe(e){try{const t=JSON.parse(e);return JSON.stringify(t)}catch{return e}}function Ee(e){try{return JSON.parse(e),{valid:!0,message:"Valid JSON"}}catch(t){return{valid:!1,message:t instanceof Error?t.message:"Invalid JSON"}}}function E(e){return e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function P(e,t){if(e===null)return"-";if(typeof e=="boolean")return e?"stream":"non-stream";switch(t){case"elapsed":return E(e);case"input":case"output":case"bytes":return e.toLocaleString();case"status":return String(e);case"streaming":return e?"stream":"non-stream"}}function Je(e,t){if(e===null)return"-";const a=e>0?"+":"";switch(t){case"elapsed":return`${a}${E(e)}`;case"input":case"output":case"bytes":case"status":return`${a}${e.toLocaleString()}`;case"streaming":return"-"}}function Be(e){return e===null||e===0?"text-muted-foreground":e>0?"text-amber-400":"text-emerald-400"}function Y({comparisons:e}){return s.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_1fr] bg-muted/40 px-3 py-2 text-[11px] font-medium text-muted-foreground",children:[s.jsx("span",{children:"Metric"}),s.jsx("span",{children:"Original"}),s.jsx("span",{children:"Replay"}),s.jsx("span",{children:"Delta"})]}),e.map(t=>s.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_1fr] border-t border-border px-3 py-2 text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:t.label}),s.jsx("span",{className:"font-mono",children:P(t.original,t.id)}),s.jsx("span",{className:"font-mono",children:P(t.replay,t.id)}),s.jsx("span",{className:`font-mono ${Be(t.delta)}`,children:Je(t.delta,t.id)})]},t.id))]})}function Ie({log:e,displayNumber:t,open:a,onOpenChange:J}){const{providers:B}=le(),$=e.rawRequestBody??"{}",[c,W]=l.useState(()=>k($)),[r,T]=l.useState(null),[K,Q]=l.useState([]),[q,S]=l.useState(!1),[w,p]=l.useState(null),m=l.useRef(null),x=l.useRef(0),f=l.useMemo(()=>Ee(c),[c]),M=l.useCallback(()=>{x.current+=1,m.current?.abort(),m.current=null,S(!1)},[]),v=l.useCallback(async()=>{if(a)try{const n=await D(`/api/logs?replayOf=${String(e.id)}`,we,Ce);Q(n.logs)}catch{}},[e.id,a]);l.useEffect(()=>{v()},[v]),l.useEffect(()=>{a||M()},[M,a]),l.useEffect(()=>()=>{x.current+=1,m.current?.abort(),m.current=null},[]);async function X(){if(!f.valid){p("Request body must be valid JSON before replay.");return}m.current?.abort();const n=x.current+1;x.current=n;const i=new AbortController;m.current=i,S(!0),p(null),T(null);try{const o=await D(`/api/logs/${e.id}/replay`,Se,Me,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:c}),signal:i.signal});if(x.current!==n)return;T(o),await v(),o.success||p(o.error??"Replay failed")}catch(o){if(x.current!==n)return;if(o instanceof je||o instanceof DOMException&&o.name==="AbortError"){p("Replay timed out or was canceled.");return}p(o instanceof Error?o.message:"Network error")}finally{x.current===n&&(m.current=null,S(!1))}}function Z(){M(),T(null),p(null),J(!1)}function b(n){W(n),T(null),p(null)}function ee(){b(k(c))}function se(){b(Oe(c))}function te(){b(k($))}function F(n){window.location.hash=`log-${String(n)}`,ye({logId:n,tab:"request"}),J(!1)}const C=l.useMemo(()=>{const n=[];for(const i of B)for(const o of i.models)o.trim().length!==0&&n.push({key:`${i.id}:${o}`,providerName:i.name,model:o});return n},[B]),h=Re(c)??e.model??"";function ne(n){const i=Ne(c,n);if(i.error!==null){p(i.error);return}b(k(i.body))}const re=V({status:e.responseStatus,elapsedMs:e.elapsedMs,inputTokens:e.inputTokens,outputTokens:e.outputTokens,responseText:e.responseText,streaming:e.streaming}),I=r===null?null:V({status:r.responseStatus,elapsedMs:r.elapsedMs,inputTokens:r.inputTokens,outputTokens:r.outputTokens,responseText:r.responseText,streaming:r.streaming}),_=I===null?[]:ke(re,I),z=K.slice(-5).reverse();return s.jsx(oe,{open:a,onOpenChange:Z,children:s.jsxs(ie,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[s.jsx(de,{children:s.jsxs(ue,{className:"flex items-center gap-2",children:[s.jsx(L,{className:"size-4"}),s.jsxs("span",{title:`Log ID ${String(e.id)}`,children:["Replay Request #",t]})]})}),s.jsxs(R,{defaultValue:"modified",children:[s.jsxs(N,{children:[s.jsx(d,{value:"modified",children:"Modified Request"}),s.jsx(d,{value:"original",children:"Original Response"}),r&&s.jsx(d,{value:"replay",children:"Replay Response"}),r&&s.jsx(d,{value:"compare",children:"Compare"})]}),s.jsxs(u,{value:"modified",className:"space-y-4",children:[C.length>0&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("label",{htmlFor:`replay-model-${String(e.id)}`,className:"text-sm font-medium",children:"Replay target"}),s.jsxs("select",{id:`replay-model-${String(e.id)}`,value:h,onChange:n=>ne(n.currentTarget.value),className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[h===""&&s.jsx("option",{value:"",children:"Select model"}),h!==""&&!C.some(n=>n.model===h)&&s.jsx("option",{value:h,children:h}),C.map(n=>s.jsxs("option",{value:n.model,children:[n.providerName," / ",n.model]},n.key))]})]}),z.length>0&&s.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-xs font-medium",children:"Replay history"}),s.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>{v()},children:"Refresh"})]}),s.jsx("div",{className:"grid gap-1",children:z.map(n=>s.jsxs("button",{type:"button",onClick:()=>F(n.id),className:"grid grid-cols-[auto_1fr_auto_auto] items-center gap-2 rounded-sm px-2 py-1 text-left text-xs hover:bg-muted",children:[s.jsxs("span",{className:"font-mono text-emerald-600",children:["#",n.id]}),s.jsx("span",{className:"truncate font-mono text-muted-foreground",children:n.model??"unknown"}),s.jsx("span",{className:"font-mono text-muted-foreground",children:n.responseStatus??"-"}),s.jsx("span",{className:"font-mono text-muted-foreground",children:n.elapsedMs===null?"-":E(n.elapsedMs)})]},n.id))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx("label",{htmlFor:`replay-body-${String(e.id)}`,className:"text-sm font-medium",children:"Request Body"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:f.valid?"text-xs text-emerald-500":"text-xs text-destructive",children:f.message}),s.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:ee,disabled:!f.valid,title:"Format JSON",children:[s.jsx(Te,{className:"size-3.5"}),"Format"]}),s.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:se,disabled:!f.valid,title:"Compact JSON",children:[s.jsx(ce,{className:"size-3.5"}),"Compact"]}),s.jsxs(y,{type:"button",variant:"ghost",size:"sm",onClick:te,title:"Reset to original request",children:[s.jsx(L,{className:"size-3.5"}),"Reset"]})]})]}),s.jsx(pe,{children:s.jsxs(me,{children:[s.jsx(xe,{asChild:!0,children:s.jsx("textarea",{id:`replay-body-${String(e.id)}`,className:"w-full min-h-80 p-3 font-mono text-xs leading-5 bg-muted rounded-md border border-input resize-y tabular-nums focus:outline-none focus:ring-2 focus:ring-ring",value:c,onChange:n=>b(n.target.value),spellCheck:!1})}),s.jsx(fe,{children:"Edit formatted JSON before re-sending to the provider"})]})})]}),w!==null&&w!==""&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:w}),s.jsx("div",{className:"flex justify-end",children:s.jsx(y,{onClick:()=>{X()},disabled:q||!f.valid,children:q?"Replaying...":"Replay"})}),r!==null&&s.jsx(Y,{comparisons:_.slice(0,4)}),r?.success===!0&&r.replayLogId!==void 0&&s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-600",children:[s.jsxs("span",{children:["Replay saved as test log #",r.replayLogId,"."]}),s.jsx(y,{type:"button",variant:"outline",size:"sm",onClick:()=>F(r.replayLogId??e.id),children:"Open saved log"})]}),r&&r.success&&s.jsxs(R,{defaultValue:"parsed",children:[s.jsxs(N,{children:[s.jsx(d,{value:"parsed",children:"Response"}),s.jsx(d,{value:"raw",children:"Raw Response"})]}),s.jsx(u,{value:"parsed",children:s.jsx(O,{responseText:r.responseText??null,responseStatus:r.responseStatus??null,streaming:r.streaming??!1,inputTokens:r.inputTokens??null,outputTokens:r.outputTokens??null,apiFormat:e.apiFormat})}),s.jsx(u,{value:"raw",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:r.responseText??"No response"})})]})]}),s.jsx(u,{value:"original",children:e.responseText!==null?s.jsxs(R,{defaultValue:"parsed",children:[s.jsxs(N,{children:[s.jsx(d,{value:"parsed",children:"Response"}),s.jsx(d,{value:"raw",children:"Raw Response"})]}),s.jsx(u,{value:"parsed",children:s.jsx(O,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})}),s.jsx(u,{value:"raw",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:e.responseText})})]}):s.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),r&&r.success&&s.jsx(u,{value:"replay",children:(r.responseText??null)!==null?s.jsxs(R,{defaultValue:"parsed",children:[s.jsxs(N,{children:[s.jsx(d,{value:"parsed",children:"Response"}),s.jsx(d,{value:"raw",children:"Raw Response"})]}),s.jsx(u,{value:"parsed",children:s.jsx(O,{responseText:r.responseText??null,responseStatus:r.responseStatus??null,streaming:r.streaming??!1,inputTokens:r.inputTokens??null,outputTokens:r.outputTokens??null,apiFormat:e.apiFormat})}),s.jsx(u,{value:"raw",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:r.responseText??""})})]}):s.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})}),r&&s.jsxs(u,{value:"compare",className:"space-y-3",children:[s.jsx(Y,{comparisons:_}),r.success?null:s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:r.error??"Replay failed"})]})]})]})})}export{Ie as ReplayDialog};
1
+ import{r as l,j as s,B as y}from"./index-BmKouSES.js";import{c as ae,u as le,i as D,D as oe,j as ie,k as de,l as ue,m as L,T as R,n as N,o as d,p as u,q as ce,s as pe,t as me,v as xe,w as fe,x as U,y as j,z as he,A as ye,E as je,F as A,G as H,H as be}from"./ProxyViewerContainer-CCtygisW.js";import{ResponseView as O}from"./ResponseView-BqfnTwq-.js";const ge=[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]],Te=ae("braces",ge);function G(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ve(e){return e==null?null:new TextEncoder().encode(e).length}function Re(e){try{const t=JSON.parse(e);if(!G(t))return null;const a=t.model;return typeof a=="string"&&a.length>0?a:null}catch{return null}}function Ne(e,t){try{const a=JSON.parse(e);return G(a)?{body:JSON.stringify({...a,model:t},null,2),error:null}:{body:e,error:"Request body must be a JSON object."}}catch{return{body:e,error:"Request body must be valid JSON before changing the replay model."}}}function V(e){return{status:e.status??null,elapsedMs:e.elapsedMs??null,inputTokens:e.inputTokens??null,outputTokens:e.outputTokens??null,responseBytes:ve(e.responseText),streaming:e.streaming===!0}}function g(e,t){return e===null||t===null?null:t-e}function ke(e,t){return[{id:"status",label:"Status",original:e.status,replay:t.status,delta:g(e.status,t.status)},{id:"elapsed",label:"Elapsed",original:e.elapsedMs,replay:t.elapsedMs,delta:g(e.elapsedMs,t.elapsedMs)},{id:"input",label:"Input",original:e.inputTokens,replay:t.inputTokens,delta:g(e.inputTokens,t.inputTokens)},{id:"output",label:"Output",original:e.outputTokens,replay:t.outputTokens,delta:g(e.outputTokens,t.outputTokens)},{id:"bytes",label:"Bytes",original:e.responseBytes,replay:t.responseBytes,delta:g(e.responseBytes,t.responseBytes)},{id:"streaming",label:"Stream",original:e.streaming,replay:t.streaming,delta:null}]}const Se=U({success:A(),error:H().optional(),responseStatus:j().nullable().optional(),responseText:H().nullable().optional(),inputTokens:j().nullable().optional(),outputTokens:j().nullable().optional(),elapsedMs:j().nullable().optional(),streaming:A().optional(),replayLogId:j().optional()}),we=U({logs:he(be),total:j()}),Me=6e4,Ce=1e4;function k(e){try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}function Oe(e){try{const t=JSON.parse(e);return JSON.stringify(t)}catch{return e}}function Ee(e){try{return JSON.parse(e),{valid:!0,message:"Valid JSON"}}catch(t){return{valid:!1,message:t instanceof Error?t.message:"Invalid JSON"}}}function E(e){return e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function P(e,t){if(e===null)return"-";if(typeof e=="boolean")return e?"stream":"non-stream";switch(t){case"elapsed":return E(e);case"input":case"output":case"bytes":return e.toLocaleString();case"status":return String(e);case"streaming":return e?"stream":"non-stream"}}function Je(e,t){if(e===null)return"-";const a=e>0?"+":"";switch(t){case"elapsed":return`${a}${E(e)}`;case"input":case"output":case"bytes":case"status":return`${a}${e.toLocaleString()}`;case"streaming":return"-"}}function Be(e){return e===null||e===0?"text-muted-foreground":e>0?"text-amber-400":"text-emerald-400"}function Y({comparisons:e}){return s.jsxs("div",{className:"overflow-hidden rounded-md border border-border",children:[s.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_1fr] bg-muted/40 px-3 py-2 text-[11px] font-medium text-muted-foreground",children:[s.jsx("span",{children:"Metric"}),s.jsx("span",{children:"Original"}),s.jsx("span",{children:"Replay"}),s.jsx("span",{children:"Delta"})]}),e.map(t=>s.jsxs("div",{className:"grid grid-cols-[1fr_1fr_1fr_1fr] border-t border-border px-3 py-2 text-xs",children:[s.jsx("span",{className:"text-muted-foreground",children:t.label}),s.jsx("span",{className:"font-mono",children:P(t.original,t.id)}),s.jsx("span",{className:"font-mono",children:P(t.replay,t.id)}),s.jsx("span",{className:`font-mono ${Be(t.delta)}`,children:Je(t.delta,t.id)})]},t.id))]})}function Ie({log:e,displayNumber:t,open:a,onOpenChange:J}){const{providers:B}=le(),$=e.rawRequestBody??"{}",[c,W]=l.useState(()=>k($)),[r,T]=l.useState(null),[K,Q]=l.useState([]),[q,S]=l.useState(!1),[w,p]=l.useState(null),m=l.useRef(null),x=l.useRef(0),f=l.useMemo(()=>Ee(c),[c]),M=l.useCallback(()=>{x.current+=1,m.current?.abort(),m.current=null,S(!1)},[]),v=l.useCallback(async()=>{if(a)try{const n=await D(`/api/logs?replayOf=${String(e.id)}`,we,Ce);Q(n.logs)}catch{}},[e.id,a]);l.useEffect(()=>{v()},[v]),l.useEffect(()=>{a||M()},[M,a]),l.useEffect(()=>()=>{x.current+=1,m.current?.abort(),m.current=null},[]);async function X(){if(!f.valid){p("Request body must be valid JSON before replay.");return}m.current?.abort();const n=x.current+1;x.current=n;const i=new AbortController;m.current=i,S(!0),p(null),T(null);try{const o=await D(`/api/logs/${e.id}/replay`,Se,Me,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:c}),signal:i.signal});if(x.current!==n)return;T(o),await v(),o.success||p(o.error??"Replay failed")}catch(o){if(x.current!==n)return;if(o instanceof je||o instanceof DOMException&&o.name==="AbortError"){p("Replay timed out or was canceled.");return}p(o instanceof Error?o.message:"Network error")}finally{x.current===n&&(m.current=null,S(!1))}}function Z(){M(),T(null),p(null),J(!1)}function b(n){W(n),T(null),p(null)}function ee(){b(k(c))}function se(){b(Oe(c))}function te(){b(k($))}function F(n){window.location.hash=`log-${String(n)}`,ye({logId:n,tab:"request"}),J(!1)}const C=l.useMemo(()=>{const n=[];for(const i of B)for(const o of i.models)o.trim().length!==0&&n.push({key:`${i.id}:${o}`,providerName:i.name,model:o});return n},[B]),h=Re(c)??e.model??"";function ne(n){const i=Ne(c,n);if(i.error!==null){p(i.error);return}b(k(i.body))}const re=V({status:e.responseStatus,elapsedMs:e.elapsedMs,inputTokens:e.inputTokens,outputTokens:e.outputTokens,responseText:e.responseText,streaming:e.streaming}),I=r===null?null:V({status:r.responseStatus,elapsedMs:r.elapsedMs,inputTokens:r.inputTokens,outputTokens:r.outputTokens,responseText:r.responseText,streaming:r.streaming}),_=I===null?[]:ke(re,I),z=K.slice(-5).reverse();return s.jsx(oe,{open:a,onOpenChange:Z,children:s.jsxs(ie,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[s.jsx(de,{children:s.jsxs(ue,{className:"flex items-center gap-2",children:[s.jsx(L,{className:"size-4"}),s.jsxs("span",{title:`Log ID ${String(e.id)}`,children:["Replay Request #",t]})]})}),s.jsxs(R,{defaultValue:"modified",children:[s.jsxs(N,{children:[s.jsx(d,{value:"modified",children:"Modified Request"}),s.jsx(d,{value:"original",children:"Original Response"}),r&&s.jsx(d,{value:"replay",children:"Replay Response"}),r&&s.jsx(d,{value:"compare",children:"Compare"})]}),s.jsxs(u,{value:"modified",className:"space-y-4",children:[C.length>0&&s.jsxs("div",{className:"grid gap-1.5",children:[s.jsx("label",{htmlFor:`replay-model-${String(e.id)}`,className:"text-sm font-medium",children:"Replay target"}),s.jsxs("select",{id:`replay-model-${String(e.id)}`,value:h,onChange:n=>ne(n.currentTarget.value),className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[h===""&&s.jsx("option",{value:"",children:"Select model"}),h!==""&&!C.some(n=>n.model===h)&&s.jsx("option",{value:h,children:h}),C.map(n=>s.jsxs("option",{value:n.model,children:[n.providerName," / ",n.model]},n.key))]})]}),z.length>0&&s.jsxs("div",{className:"space-y-2 rounded-md border border-border bg-muted/20 px-3 py-2",children:[s.jsxs("div",{className:"flex items-center justify-between gap-2",children:[s.jsx("div",{className:"text-xs font-medium",children:"Replay history"}),s.jsx(y,{type:"button",variant:"ghost",size:"sm",onClick:()=>{v()},children:"Refresh"})]}),s.jsx("div",{className:"grid gap-1",children:z.map(n=>s.jsxs("button",{type:"button",onClick:()=>F(n.id),className:"grid grid-cols-[auto_1fr_auto_auto] items-center gap-2 rounded-sm px-2 py-1 text-left text-xs hover:bg-muted",children:[s.jsxs("span",{className:"font-mono text-emerald-600",children:["#",n.id]}),s.jsx("span",{className:"truncate font-mono text-muted-foreground",children:n.model??"unknown"}),s.jsx("span",{className:"font-mono text-muted-foreground",children:n.responseStatus??"-"}),s.jsx("span",{className:"font-mono text-muted-foreground",children:n.elapsedMs===null?"-":E(n.elapsedMs)})]},n.id))})]}),s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[s.jsx("label",{htmlFor:`replay-body-${String(e.id)}`,className:"text-sm font-medium",children:"Request Body"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:f.valid?"text-xs text-emerald-500":"text-xs text-destructive",children:f.message}),s.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:ee,disabled:!f.valid,title:"Format JSON",children:[s.jsx(Te,{className:"size-3.5"}),"Format"]}),s.jsxs(y,{type:"button",variant:"outline",size:"sm",onClick:se,disabled:!f.valid,title:"Compact JSON",children:[s.jsx(ce,{className:"size-3.5"}),"Compact"]}),s.jsxs(y,{type:"button",variant:"ghost",size:"sm",onClick:te,title:"Reset to original request",children:[s.jsx(L,{className:"size-3.5"}),"Reset"]})]})]}),s.jsx(pe,{children:s.jsxs(me,{children:[s.jsx(xe,{asChild:!0,children:s.jsx("textarea",{id:`replay-body-${String(e.id)}`,className:"w-full min-h-80 p-3 font-mono text-xs leading-5 bg-muted rounded-md border border-input resize-y tabular-nums focus:outline-none focus:ring-2 focus:ring-ring",value:c,onChange:n=>b(n.target.value),spellCheck:!1})}),s.jsx(fe,{children:"Edit formatted JSON before re-sending to the provider"})]})})]}),w!==null&&w!==""&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:w}),s.jsx("div",{className:"flex justify-end",children:s.jsx(y,{onClick:()=>{X()},disabled:q||!f.valid,children:q?"Replaying...":"Replay"})}),r!==null&&s.jsx(Y,{comparisons:_.slice(0,4)}),r?.success===!0&&r.replayLogId!==void 0&&s.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 rounded-md border border-emerald-500/25 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-600",children:[s.jsxs("span",{children:["Replay saved as test log #",r.replayLogId,"."]}),s.jsx(y,{type:"button",variant:"outline",size:"sm",onClick:()=>F(r.replayLogId??e.id),children:"Open saved log"})]}),r&&r.success&&s.jsxs(R,{defaultValue:"parsed",children:[s.jsxs(N,{children:[s.jsx(d,{value:"parsed",children:"Response"}),s.jsx(d,{value:"raw",children:"Raw Response"})]}),s.jsx(u,{value:"parsed",children:s.jsx(O,{responseText:r.responseText??null,responseStatus:r.responseStatus??null,streaming:r.streaming??!1,inputTokens:r.inputTokens??null,outputTokens:r.outputTokens??null,apiFormat:e.apiFormat})}),s.jsx(u,{value:"raw",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:r.responseText??"No response"})})]})]}),s.jsx(u,{value:"original",children:e.responseText!==null?s.jsxs(R,{defaultValue:"parsed",children:[s.jsxs(N,{children:[s.jsx(d,{value:"parsed",children:"Response"}),s.jsx(d,{value:"raw",children:"Raw Response"})]}),s.jsx(u,{value:"parsed",children:s.jsx(O,{responseText:e.responseText,responseStatus:e.responseStatus,streaming:e.streaming,inputTokens:e.inputTokens,outputTokens:e.outputTokens,cacheCreationInputTokens:e.cacheCreationInputTokens,cacheReadInputTokens:e.cacheReadInputTokens,apiFormat:e.apiFormat})}),s.jsx(u,{value:"raw",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:e.responseText})})]}):s.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),r&&r.success&&s.jsx(u,{value:"replay",children:(r.responseText??null)!==null?s.jsxs(R,{defaultValue:"parsed",children:[s.jsxs(N,{children:[s.jsx(d,{value:"parsed",children:"Response"}),s.jsx(d,{value:"raw",children:"Raw Response"})]}),s.jsx(u,{value:"parsed",children:s.jsx(O,{responseText:r.responseText??null,responseStatus:r.responseStatus??null,streaming:r.streaming??!1,inputTokens:r.inputTokens??null,outputTokens:r.outputTokens??null,apiFormat:e.apiFormat})}),s.jsx(u,{value:"raw",children:s.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:r.responseText??""})})]}):s.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})}),r&&s.jsxs(u,{value:"compare",className:"space-y-3",children:[s.jsx(Y,{comparisons:_}),r.success?null:s.jsx("div",{className:"rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:r.error??"Replay failed"})]})]})]})})}export{Ie as ReplayDialog};
@@ -1 +1 @@
1
- import{r as f,o as u,j as t,k as p,v as B}from"./index-BlSm4bqn.js";import{u as F,I as J,s as V,t as q,v as Y,J as K,w as X,S as Q,K as $,N as Z,O as S,Q as ee,e as z}from"./ProxyViewerContainer-DoCpLJM1.js";const te=.25,se=5,re=4,ne=6,oe=.25,ae=.2,ie=.2,le=["system","user","assistant","tool","tools"],de={system:"instructions",user:"user turns",assistant:"assistant turns",tool:"tool results",tools:"tool schemas"},ue=[{value:"role",label:"By Role"},{value:"segment",label:"By Segment"}],ce={unknown:"bg-muted-foreground/50",ok:"bg-emerald-500/70",watch:"bg-amber-400/75",danger:"bg-red-500/80"},me={unknown:"text-muted-foreground",ok:"text-emerald-400",watch:"text-amber-300",danger:"text-red-300"},xe={ok:"border-emerald-400/30 bg-emerald-400/8 text-emerald-200",optimizable:"border-amber-400/30 bg-amber-400/8 text-amber-100",risk:"border-red-400/35 bg-red-500/10 text-red-100"},pe={ok:"OK",optimizable:"Optimizable",risk:"Risk"};function h(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}function w(e){return e===null?"Unknown":h(e*100)}function L(e){return e===null?"Unknown":e<0?`-${u(Math.abs(e))}`:u(e)}function A(e){return e.contextWindow.tokens===null?"Unknown":B(e.contextWindow.tokens)}function fe(e){switch(e.contextWindow.source){case"request":return e.contextWindow.label;case"provider":return e.contextWindow.label;case"model-rule":return e.contextWindow.label;case"unknown":return e.model===null?e.contextWindow.label:`${e.contextWindow.label}: ${e.model}`}}function he(e){switch(e){case"watch":return"border-amber-400/30 bg-amber-400/8 text-amber-100";case"danger":return"border-red-400/35 bg-red-500/10 text-red-100"}}function _(e){const s=pe[e.level];if(e.level==="ok")return s;const r=e.level==="risk"?`${String(e.opportunityCount)} signal${e.opportunityCount===1?"":"s"}`:`${String(e.opportunityCount)} opportunit${e.opportunityCount===1?"y":"ies"}`;return e.reclaimableTokens<=0?`${s} | ${r}`:`${s} | ${r} | ~${u(e.reclaimableTokens)} tokens`}function ge({health:e}){return t.jsx("span",{className:p("inline-flex h-5 max-w-full items-center rounded border px-1.5 font-mono text-[10px]",xe[e.level]),"aria-label":`Context health ${_(e)}`,children:t.jsx("span",{className:"truncate",children:_(e)})})}function y(e,s){return e.roleUsages.find(r=>r.role===s)?.tokens??0}function O(e,s){return e.roleUsages.find(r=>r.role===s)?.percent??0}function C(e,s){if(e<=0)return null;const r=Math.round(e*s);return r>0?r:null}function I(e,s){return[...e].filter(r=>r.role===s).sort((r,n)=>n.size-r.size)[0]??null}function be(e){return[...e].filter(s=>s.role==="user"||s.role==="assistant"||s.role==="tool").sort((s,r)=>r.size-s.size)[0]??null}function ve(e,s){const r=e[0]??null;if(r===null)return null;const n=r.segments[0]??null;return n===null?null:P(n,s)}function je(e){const s=e.reduce((r,n)=>r+n.repeatedTokens,0);return s>0?s:null}function Ne(e){return y(e,"user")+y(e,"assistant")+y(e,"tool")}function ke({diagnostic:e,intelligence:s,segments:r}){switch(e.kind){case"duplicate":return{key:"duplicate",kind:"duplicate",severity:e.severity,title:"Duplicate content",impact:e.detail,action:"Remove repeated blocks or keep one canonical copy in the next request.",savingTokens:je(s.duplicateGroups),target:ve(s.duplicateGroups,r)};case"tool-schema":{const n=y(s,"tools"),l=O(s,"tools");return{key:"tool-schema",kind:"tool-schema",severity:e.severity,title:"Tool schema pressure",impact:`Tool definitions use ~${u(n)} tokens (${h(l*100)}).`,action:"Disable unused tools or shorten verbose schema descriptions.",savingTokens:C(n,oe),target:I(r,"tools")}}case"system-heavy":{const n=y(s,"system"),l=O(s,"system");return{key:"system-heavy",kind:"system-heavy",severity:e.severity,title:"Large system prompt",impact:`System instructions use ~${u(n)} tokens (${h(l*100)}).`,action:"Compress repeated policy text and move stable guidance into reusable memory.",savingTokens:C(n,ae),target:I(r,"system")}}case"history-bloat":{const n=Ne(s);return{key:"history-bloat",kind:"history-bloat",severity:e.severity,title:"Conversation history growth",impact:e.detail,action:"Summarize older turns and trim resolved tool outputs before continuing.",savingTokens:C(n,ie),target:be(r)}}}}function we({intelligence:e,segments:s}){const r=[];return(e.riskLevel==="watch"||e.riskLevel==="danger")&&r.push({key:"context-pressure",kind:"context-pressure",severity:e.riskLevel==="danger"?"danger":"watch",title:"Context window pressure",impact:`${w(e.usagePercent)} used, ${L(e.remainingAfterReserveTokens)} remaining after output reserve.`,action:"Start with the largest context block, then remove duplicates or summarize history.",savingTokens:null,target:[...s].sort((n,l)=>l.size-n.size)[0]??null}),e.contextWindow.source==="unknown"&&r.push({key:"context-window",kind:"context-window",severity:"watch",title:"Context window unknown",impact:"Agent Inspector cannot calculate remaining space for this model.",action:"Add model metadata in Provider settings so risk and remaining space are accurate.",savingTokens:null,target:null}),e.diagnostics.forEach(n=>{r.push(ke({diagnostic:n,intelligence:e,segments:s}))}),r}function ye({items:e,onSegmentActivate:s}){return e.length===0?null:t.jsxs("section",{className:"space-y-2 rounded border border-border/70 bg-muted/15 p-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("div",{className:"text-xs font-medium text-foreground",children:"Context Advisor"}),t.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground",children:[String(e.length)," issue",e.length===1?"":"s"]})]}),t.jsx("div",{className:"grid gap-2",children:e.map(r=>{const n=r.target,l=n!==null&&s!==void 0;return t.jsx("div",{className:p("rounded border px-2 py-1.5 text-xs",he(r.severity)),children:t.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium",children:r.title}),t.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["Impact: ",r.impact]}),t.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["Action: ",r.action]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.savingTokens!==null&&t.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["Save ~",u(r.savingTokens)]}),l&&n!==null&&s!==void 0&&t.jsxs("button",{type:"button",onClick:()=>s(n),className:"inline-flex h-6 items-center gap-1 rounded border border-border/60 px-1.5 text-[11px] text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground",title:"Jump to the most relevant context block",children:[t.jsx(z,{className:"size-3"}),"Jump"]})]})]})},r.key)})})]})}function Te({intelligence:e,segments:s,onSegmentActivate:r}){const n=e.usagePercent===null?0:Math.max(1,e.usagePercent*100),l=e.outputReserveTokens===null?"No output reserve":`Output reserve ${u(e.outputReserveTokens)}`,c=e.largestRole,m=we({intelligence:e,segments:s});return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-y border-border/60 py-2 text-xs sm:grid-cols-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Window"}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-foreground",children:A(e)}),t.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:fe(e)})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Used"}),t.jsx("div",{className:p("mt-0.5 font-mono",me[e.riskLevel]),children:w(e.usagePercent)}),t.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:l})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Remaining"}),t.jsx("div",{className:"mt-0.5 font-mono text-foreground",children:L(e.remainingAfterReserveTokens)}),t.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:["Input only ",L(e.remainingInputTokens)]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Largest"}),c===null?t.jsx("div",{className:"mt-0.5 text-muted-foreground",children:"Unknown"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{"aria-hidden":"true",className:p("size-2.5 shrink-0 rounded-[2px]",$[c.role])}),t.jsx("span",{className:"truncate text-foreground",children:c.label})]}),t.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",children:[h(c.percent*100)," | ~",u(c.tokens)]})]})]})]}),e.contextWindow.tokens!==null&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"relative h-2 overflow-hidden rounded-full bg-muted/40",children:[t.jsx("div",{className:p("h-full rounded-full",ce[e.riskLevel]),style:{width:`${String(n)}%`}}),t.jsx("div",{"aria-hidden":"true",className:"absolute top-0 h-full w-px bg-amber-200/70",style:{left:`${String(S.watch*100)}%`}}),t.jsx("div",{"aria-hidden":"true",className:"absolute top-0 h-full w-px bg-red-200/80",style:{left:`${String(S.danger*100)}%`}})]}),t.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[t.jsx("span",{children:"Context window"}),t.jsxs("span",{children:["Watch ",w(S.watch)," / Danger"," ",w(S.danger)]})]})]}),t.jsx(ye,{items:m,onSegmentActivate:r})]})}function P(e,s){return s.find(r=>r.path===e.path)??null}function Se({groups:e,segments:s,onSegmentActivate:r}){const[n,l]=f.useState(!1);if(e.length===0)return null;const c=e.slice(0,re),m=e.length-c.length,g=e.reduce((o,i)=>o+i.repeatedTokens,0);return t.jsxs("section",{className:"space-y-2 rounded border border-border/70 bg-muted/15 p-2",children:[t.jsxs("button",{type:"button",onClick:()=>l(o=>!o),"aria-expanded":n,className:"flex w-full flex-wrap items-center justify-between gap-2 rounded px-1 py-0.5 text-left transition-colors hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",children:[t.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[n?t.jsx(ee,{className:"size-3.5 shrink-0 text-muted-foreground"}):t.jsx(z,{className:"size-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:"Duplicate Content"})]}),t.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:[String(e.length)," group",e.length===1?"":"s"," | ~",u(g)," repeated"]})]}),n&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-2",children:c.map((o,i)=>{const b=o.segments.slice(0,ne),T=o.segments.length-b.length;return t.jsxs("div",{className:"space-y-1.5 border-t border-border/50 pt-2 first:border-t-0 first:pt-0",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs",children:[t.jsx("span",{className:"w-5 shrink-0 text-right font-mono text-muted-foreground/70",children:String(i+1)}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-foreground",children:o.firstLabel}),t.jsxs("span",{className:"shrink-0 font-mono text-muted-foreground",children:["x",String(o.count)," | ~",u(o.repeatedTokens)," saved"]})]}),o.preview.length>0&&t.jsx("div",{className:"ml-7 line-clamp-2 break-words rounded bg-background/40 px-2 py-1 font-mono text-[11px] leading-4 text-muted-foreground",children:o.preview}),t.jsxs("div",{className:"ml-7 flex flex-wrap gap-1",children:[b.map((d,v)=>{const j=P(d,s),N=j===null||r===void 0?void 0:r,k=`${d.label} ~${u(d.tokens)}`;return N===void 0||j===null?t.jsx("span",{className:"inline-flex h-6 max-w-40 items-center rounded border border-border/60 px-1.5 text-[11px] text-muted-foreground",title:k,children:t.jsx("span",{className:"truncate",children:k})},`${d.path}-${v}`):t.jsx("button",{type:"button",onClick:()=>N(j),className:"inline-flex h-6 max-w-40 items-center rounded border border-border/60 px-1.5 text-[11px] text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground",title:"Jump to this duplicate block",children:t.jsx("span",{className:"truncate",children:k})},`${d.path}-${v}`)}),T>0&&t.jsxs("span",{className:"inline-flex h-6 items-center rounded border border-border/40 px-1.5 font-mono text-[11px] text-muted-foreground/70",children:["+",String(T)]})]})]},o.key)})}),m>0&&t.jsxs("div",{className:"border-t border-border/50 pt-2 font-mono text-[11px] text-muted-foreground",children:["+",String(m)," more duplicate group",m===1?"":"s"]})]})]})}function Ce(e){const s=[];for(const r of le){const n=e.filter(o=>o.role===r);if(n.length===0)continue;const l=n.reduce((o,i)=>o+i.size,0),c=n.reduce((o,i)=>o+i.characters,0),m=Z[r],g=`${n.length} segment${n.length===1?"":"s"} grouped as ${de[r]}`;s.push({role:r,label:m,size:l,characters:c,text:g,path:`role:${r}`})}return s}function $e(e){return[...e].sort((s,r)=>r.size-s.size).slice(0,se)}function Ee({parsed:e,inputTokens:s,model:r=null,onSegmentActivate:n,segments:l}){const{providers:c}=F(),[m,g]=f.useState("role"),o=f.useMemo(()=>l??null,[l]),i=f.useMemo(()=>(o??[]).reduce((a,x)=>a+x.size,0),[o]),b=f.useMemo(()=>o===null?[]:Ce(o),[o]),T=f.useMemo(()=>o===null?[]:$e(o),[o]),d=f.useMemo(()=>o===null?null:J({segments:o,inputTokens:s,parsed:e,model:r,providers:c}),[s,r,e,c,o]),v=f.useMemo(()=>o===null||s===null||i===0?!1:Math.abs(s-i)/Math.max(s,i)>=te,[s,o,i]);if(o===null||o.length===0||e===null&&l===void 0)return null;const j=s!==null&&v?"text-amber-400":"text-muted-foreground",N=m==="role"?b:o,k=i>0?i:N.reduce((a,x)=>a+x.size,0),D=m==="segment"?n:void 0,M=`${String(o.length)} segment${o.length===1?"":"s"}`,U=s===null?"Provider input unknown":`Provider input ${u(s)}`,W=d===null?"Limit unknown":`Limit ${A(d)}`,G=d===null?"Usage unknown":`${w(d.usagePercent)} used`;return t.jsx(V,{delayDuration:150,children:t.jsxs("div",{className:"px-4 py-3 space-y-3","data-testid":"anatomy-root",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Request Context"}),d!==null&&t.jsx(ge,{health:d.health})]}),t.jsxs("div",{className:p("mt-0.5 text-xs font-mono tabular-nums",j),children:["Estimated ~",u(i)," tokens | ",U," | ",W," |"," ",G," | ",M]})]}),t.jsx("div",{className:"inline-flex shrink-0 rounded border border-border bg-muted/20 p-0.5",role:"group","aria-label":"Context breakdown mode",children:ue.map(a=>t.jsx("button",{type:"button","aria-pressed":m===a.value,onClick:()=>g(a.value),className:p("h-6 rounded-sm px-2 text-[11px] font-medium transition-colors",m===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))})]}),v&&t.jsxs("div",{className:"inline-flex items-center gap-1.5 text-xs text-amber-400",children:[t.jsxs(q,{children:[t.jsx(Y,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center hover:text-amber-300","aria-label":"Token estimate differs from provider input",children:t.jsx(K,{className:"size-3.5"})})}),t.jsx(X,{className:"max-w-xs text-xs",children:"The bar uses a local token estimate. Provider input tokens remain the source of truth for billing and context-window usage."})]}),"Estimate differs from provider-reported input."]}),d!==null&&t.jsx(Te,{intelligence:d,segments:o,onSegmentActivate:n}),d!==null&&t.jsx(Se,{groups:d.duplicateGroups,segments:o,onSegmentActivate:n}),t.jsx(Q,{segments:N,totalTokens:k,showLabels:m==="segment",onActivate:D}),t.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[11px] text-muted-foreground",children:b.map(a=>{const x=i>0?a.size/i*100:0;return t.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{"aria-hidden":"true",className:p("size-2.5 rounded-[2px]",$[a.role])}),t.jsx("span",{children:a.label}),t.jsx("span",{className:"font-mono text-muted-foreground/70",children:h(x)})]},a.role)})}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"text-xs font-medium text-foreground",children:"Top Contributors"}),t.jsx("div",{className:"grid gap-1",children:T.map((a,x)=>{const H=i>0?a.size/i*100:0,R=n,E=t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"w-5 shrink-0 text-right font-mono text-muted-foreground/70",children:String(x+1)}),t.jsx("span",{"aria-hidden":"true",className:p("size-2.5 shrink-0 rounded-[2px]",$[a.role])}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:a.label}),t.jsxs("span",{className:"shrink-0 font-mono text-muted-foreground",children:[h(H)," | ~",u(a.size)]})]});return R!==void 0?t.jsx("button",{type:"button",onClick:()=>R(a),className:"flex h-7 items-center gap-2 rounded px-1.5 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",title:"Jump to this request block",children:E},`${a.path}-${x}`):t.jsx("div",{className:"flex h-7 items-center gap-2 rounded px-1.5 text-xs text-muted-foreground",children:E},`${a.path}-${x}`)})})]})]})})}export{Ee as RequestAnatomy};
1
+ import{r as f,o as u,j as t,k as p,v as B}from"./index-BmKouSES.js";import{u as F,I as J,s as V,t as q,v as Y,J as K,w as X,S as Q,K as $,N as Z,O as S,Q as ee,e as z}from"./ProxyViewerContainer-CCtygisW.js";const te=.25,se=5,re=4,ne=6,oe=.25,ae=.2,ie=.2,le=["system","user","assistant","tool","tools"],de={system:"instructions",user:"user turns",assistant:"assistant turns",tool:"tool results",tools:"tool schemas"},ue=[{value:"role",label:"By Role"},{value:"segment",label:"By Segment"}],ce={unknown:"bg-muted-foreground/50",ok:"bg-emerald-500/70",watch:"bg-amber-400/75",danger:"bg-red-500/80"},me={unknown:"text-muted-foreground",ok:"text-emerald-400",watch:"text-amber-300",danger:"text-red-300"},xe={ok:"border-emerald-400/30 bg-emerald-400/8 text-emerald-200",optimizable:"border-amber-400/30 bg-amber-400/8 text-amber-100",risk:"border-red-400/35 bg-red-500/10 text-red-100"},pe={ok:"OK",optimizable:"Optimizable",risk:"Risk"};function h(e){return e>=10?`${e.toFixed(0)}%`:e>=1?`${e.toFixed(1)}%`:e>0?"<1%":"0%"}function w(e){return e===null?"Unknown":h(e*100)}function L(e){return e===null?"Unknown":e<0?`-${u(Math.abs(e))}`:u(e)}function A(e){return e.contextWindow.tokens===null?"Unknown":B(e.contextWindow.tokens)}function fe(e){switch(e.contextWindow.source){case"request":return e.contextWindow.label;case"provider":return e.contextWindow.label;case"model-rule":return e.contextWindow.label;case"unknown":return e.model===null?e.contextWindow.label:`${e.contextWindow.label}: ${e.model}`}}function he(e){switch(e){case"watch":return"border-amber-400/30 bg-amber-400/8 text-amber-100";case"danger":return"border-red-400/35 bg-red-500/10 text-red-100"}}function _(e){const s=pe[e.level];if(e.level==="ok")return s;const r=e.level==="risk"?`${String(e.opportunityCount)} signal${e.opportunityCount===1?"":"s"}`:`${String(e.opportunityCount)} opportunit${e.opportunityCount===1?"y":"ies"}`;return e.reclaimableTokens<=0?`${s} | ${r}`:`${s} | ${r} | ~${u(e.reclaimableTokens)} tokens`}function ge({health:e}){return t.jsx("span",{className:p("inline-flex h-5 max-w-full items-center rounded border px-1.5 font-mono text-[10px]",xe[e.level]),"aria-label":`Context health ${_(e)}`,children:t.jsx("span",{className:"truncate",children:_(e)})})}function y(e,s){return e.roleUsages.find(r=>r.role===s)?.tokens??0}function O(e,s){return e.roleUsages.find(r=>r.role===s)?.percent??0}function C(e,s){if(e<=0)return null;const r=Math.round(e*s);return r>0?r:null}function I(e,s){return[...e].filter(r=>r.role===s).sort((r,n)=>n.size-r.size)[0]??null}function be(e){return[...e].filter(s=>s.role==="user"||s.role==="assistant"||s.role==="tool").sort((s,r)=>r.size-s.size)[0]??null}function ve(e,s){const r=e[0]??null;if(r===null)return null;const n=r.segments[0]??null;return n===null?null:P(n,s)}function je(e){const s=e.reduce((r,n)=>r+n.repeatedTokens,0);return s>0?s:null}function Ne(e){return y(e,"user")+y(e,"assistant")+y(e,"tool")}function ke({diagnostic:e,intelligence:s,segments:r}){switch(e.kind){case"duplicate":return{key:"duplicate",kind:"duplicate",severity:e.severity,title:"Duplicate content",impact:e.detail,action:"Remove repeated blocks or keep one canonical copy in the next request.",savingTokens:je(s.duplicateGroups),target:ve(s.duplicateGroups,r)};case"tool-schema":{const n=y(s,"tools"),l=O(s,"tools");return{key:"tool-schema",kind:"tool-schema",severity:e.severity,title:"Tool schema pressure",impact:`Tool definitions use ~${u(n)} tokens (${h(l*100)}).`,action:"Disable unused tools or shorten verbose schema descriptions.",savingTokens:C(n,oe),target:I(r,"tools")}}case"system-heavy":{const n=y(s,"system"),l=O(s,"system");return{key:"system-heavy",kind:"system-heavy",severity:e.severity,title:"Large system prompt",impact:`System instructions use ~${u(n)} tokens (${h(l*100)}).`,action:"Compress repeated policy text and move stable guidance into reusable memory.",savingTokens:C(n,ae),target:I(r,"system")}}case"history-bloat":{const n=Ne(s);return{key:"history-bloat",kind:"history-bloat",severity:e.severity,title:"Conversation history growth",impact:e.detail,action:"Summarize older turns and trim resolved tool outputs before continuing.",savingTokens:C(n,ie),target:be(r)}}}}function we({intelligence:e,segments:s}){const r=[];return(e.riskLevel==="watch"||e.riskLevel==="danger")&&r.push({key:"context-pressure",kind:"context-pressure",severity:e.riskLevel==="danger"?"danger":"watch",title:"Context window pressure",impact:`${w(e.usagePercent)} used, ${L(e.remainingAfterReserveTokens)} remaining after output reserve.`,action:"Start with the largest context block, then remove duplicates or summarize history.",savingTokens:null,target:[...s].sort((n,l)=>l.size-n.size)[0]??null}),e.contextWindow.source==="unknown"&&r.push({key:"context-window",kind:"context-window",severity:"watch",title:"Context window unknown",impact:"Agent Inspector cannot calculate remaining space for this model.",action:"Add model metadata in Provider settings so risk and remaining space are accurate.",savingTokens:null,target:null}),e.diagnostics.forEach(n=>{r.push(ke({diagnostic:n,intelligence:e,segments:s}))}),r}function ye({items:e,onSegmentActivate:s}){return e.length===0?null:t.jsxs("section",{className:"space-y-2 rounded border border-border/70 bg-muted/15 p-2",children:[t.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[t.jsx("div",{className:"text-xs font-medium text-foreground",children:"Context Advisor"}),t.jsxs("div",{className:"font-mono text-[11px] text-muted-foreground",children:[String(e.length)," issue",e.length===1?"":"s"]})]}),t.jsx("div",{className:"grid gap-2",children:e.map(r=>{const n=r.target,l=n!==null&&s!==void 0;return t.jsx("div",{className:p("rounded border px-2 py-1.5 text-xs",he(r.severity)),children:t.jsxs("div",{className:"flex min-w-0 flex-wrap items-start justify-between gap-2",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"font-medium",children:r.title}),t.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["Impact: ",r.impact]}),t.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:["Action: ",r.action]})]}),t.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[r.savingTokens!==null&&t.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:["Save ~",u(r.savingTokens)]}),l&&n!==null&&s!==void 0&&t.jsxs("button",{type:"button",onClick:()=>s(n),className:"inline-flex h-6 items-center gap-1 rounded border border-border/60 px-1.5 text-[11px] text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground",title:"Jump to the most relevant context block",children:[t.jsx(z,{className:"size-3"}),"Jump"]})]})]})},r.key)})})]})}function Te({intelligence:e,segments:s,onSegmentActivate:r}){const n=e.usagePercent===null?0:Math.max(1,e.usagePercent*100),l=e.outputReserveTokens===null?"No output reserve":`Output reserve ${u(e.outputReserveTokens)}`,c=e.largestRole,m=we({intelligence:e,segments:s});return t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"grid gap-x-4 gap-y-2 border-y border-border/60 py-2 text-xs sm:grid-cols-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Window"}),t.jsx("div",{className:"mt-0.5 truncate font-mono text-foreground",children:A(e)}),t.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:fe(e)})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Used"}),t.jsx("div",{className:p("mt-0.5 font-mono",me[e.riskLevel]),children:w(e.usagePercent)}),t.jsx("div",{className:"truncate text-[11px] text-muted-foreground",children:l})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Remaining"}),t.jsx("div",{className:"mt-0.5 font-mono text-foreground",children:L(e.remainingAfterReserveTokens)}),t.jsxs("div",{className:"truncate text-[11px] text-muted-foreground",children:["Input only ",L(e.remainingInputTokens)]})]}),t.jsxs("div",{className:"min-w-0",children:[t.jsx("div",{className:"text-[10px] font-medium uppercase text-muted-foreground",children:"Largest"}),c===null?t.jsx("div",{className:"mt-0.5 text-muted-foreground",children:"Unknown"}):t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"mt-0.5 flex min-w-0 items-center gap-1.5",children:[t.jsx("span",{"aria-hidden":"true",className:p("size-2.5 shrink-0 rounded-[2px]",$[c.role])}),t.jsx("span",{className:"truncate text-foreground",children:c.label})]}),t.jsxs("div",{className:"truncate font-mono text-[11px] text-muted-foreground",children:[h(c.percent*100)," | ~",u(c.tokens)]})]})]})]}),e.contextWindow.tokens!==null&&t.jsxs("div",{className:"space-y-1.5",children:[t.jsxs("div",{className:"relative h-2 overflow-hidden rounded-full bg-muted/40",children:[t.jsx("div",{className:p("h-full rounded-full",ce[e.riskLevel]),style:{width:`${String(n)}%`}}),t.jsx("div",{"aria-hidden":"true",className:"absolute top-0 h-full w-px bg-amber-200/70",style:{left:`${String(S.watch*100)}%`}}),t.jsx("div",{"aria-hidden":"true",className:"absolute top-0 h-full w-px bg-red-200/80",style:{left:`${String(S.danger*100)}%`}})]}),t.jsxs("div",{className:"flex justify-between text-[10px] text-muted-foreground",children:[t.jsx("span",{children:"Context window"}),t.jsxs("span",{children:["Watch ",w(S.watch)," / Danger"," ",w(S.danger)]})]})]}),t.jsx(ye,{items:m,onSegmentActivate:r})]})}function P(e,s){return s.find(r=>r.path===e.path)??null}function Se({groups:e,segments:s,onSegmentActivate:r}){const[n,l]=f.useState(!1);if(e.length===0)return null;const c=e.slice(0,re),m=e.length-c.length,g=e.reduce((o,i)=>o+i.repeatedTokens,0);return t.jsxs("section",{className:"space-y-2 rounded border border-border/70 bg-muted/15 p-2",children:[t.jsxs("button",{type:"button",onClick:()=>l(o=>!o),"aria-expanded":n,className:"flex w-full flex-wrap items-center justify-between gap-2 rounded px-1 py-0.5 text-left transition-colors hover:bg-muted/30 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",children:[t.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1.5",children:[n?t.jsx(ee,{className:"size-3.5 shrink-0 text-muted-foreground"}):t.jsx(z,{className:"size-3.5 shrink-0 text-muted-foreground"}),t.jsx("span",{className:"truncate text-xs font-medium text-foreground",children:"Duplicate Content"})]}),t.jsxs("span",{className:"font-mono text-[11px] text-muted-foreground",children:[String(e.length)," group",e.length===1?"":"s"," | ~",u(g)," repeated"]})]}),n&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"space-y-2",children:c.map((o,i)=>{const b=o.segments.slice(0,ne),T=o.segments.length-b.length;return t.jsxs("div",{className:"space-y-1.5 border-t border-border/50 pt-2 first:border-t-0 first:pt-0",children:[t.jsxs("div",{className:"flex min-w-0 items-center gap-2 text-xs",children:[t.jsx("span",{className:"w-5 shrink-0 text-right font-mono text-muted-foreground/70",children:String(i+1)}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-foreground",children:o.firstLabel}),t.jsxs("span",{className:"shrink-0 font-mono text-muted-foreground",children:["x",String(o.count)," | ~",u(o.repeatedTokens)," saved"]})]}),o.preview.length>0&&t.jsx("div",{className:"ml-7 line-clamp-2 break-words rounded bg-background/40 px-2 py-1 font-mono text-[11px] leading-4 text-muted-foreground",children:o.preview}),t.jsxs("div",{className:"ml-7 flex flex-wrap gap-1",children:[b.map((d,v)=>{const j=P(d,s),N=j===null||r===void 0?void 0:r,k=`${d.label} ~${u(d.tokens)}`;return N===void 0||j===null?t.jsx("span",{className:"inline-flex h-6 max-w-40 items-center rounded border border-border/60 px-1.5 text-[11px] text-muted-foreground",title:k,children:t.jsx("span",{className:"truncate",children:k})},`${d.path}-${v}`):t.jsx("button",{type:"button",onClick:()=>N(j),className:"inline-flex h-6 max-w-40 items-center rounded border border-border/60 px-1.5 text-[11px] text-muted-foreground hover:border-border hover:bg-muted/40 hover:text-foreground",title:"Jump to this duplicate block",children:t.jsx("span",{className:"truncate",children:k})},`${d.path}-${v}`)}),T>0&&t.jsxs("span",{className:"inline-flex h-6 items-center rounded border border-border/40 px-1.5 font-mono text-[11px] text-muted-foreground/70",children:["+",String(T)]})]})]},o.key)})}),m>0&&t.jsxs("div",{className:"border-t border-border/50 pt-2 font-mono text-[11px] text-muted-foreground",children:["+",String(m)," more duplicate group",m===1?"":"s"]})]})]})}function Ce(e){const s=[];for(const r of le){const n=e.filter(o=>o.role===r);if(n.length===0)continue;const l=n.reduce((o,i)=>o+i.size,0),c=n.reduce((o,i)=>o+i.characters,0),m=Z[r],g=`${n.length} segment${n.length===1?"":"s"} grouped as ${de[r]}`;s.push({role:r,label:m,size:l,characters:c,text:g,path:`role:${r}`})}return s}function $e(e){return[...e].sort((s,r)=>r.size-s.size).slice(0,se)}function Ee({parsed:e,inputTokens:s,model:r=null,onSegmentActivate:n,segments:l}){const{providers:c}=F(),[m,g]=f.useState("role"),o=f.useMemo(()=>l??null,[l]),i=f.useMemo(()=>(o??[]).reduce((a,x)=>a+x.size,0),[o]),b=f.useMemo(()=>o===null?[]:Ce(o),[o]),T=f.useMemo(()=>o===null?[]:$e(o),[o]),d=f.useMemo(()=>o===null?null:J({segments:o,inputTokens:s,parsed:e,model:r,providers:c}),[s,r,e,c,o]),v=f.useMemo(()=>o===null||s===null||i===0?!1:Math.abs(s-i)/Math.max(s,i)>=te,[s,o,i]);if(o===null||o.length===0||e===null&&l===void 0)return null;const j=s!==null&&v?"text-amber-400":"text-muted-foreground",N=m==="role"?b:o,k=i>0?i:N.reduce((a,x)=>a+x.size,0),D=m==="segment"?n:void 0,M=`${String(o.length)} segment${o.length===1?"":"s"}`,U=s===null?"Provider input unknown":`Provider input ${u(s)}`,W=d===null?"Limit unknown":`Limit ${A(d)}`,G=d===null?"Usage unknown":`${w(d.usagePercent)} used`;return t.jsx(V,{delayDuration:150,children:t.jsxs("div",{className:"px-4 py-3 space-y-3","data-testid":"anatomy-root",children:[t.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2",children:[t.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Request Context"}),d!==null&&t.jsx(ge,{health:d.health})]}),t.jsxs("div",{className:p("mt-0.5 text-xs font-mono tabular-nums",j),children:["Estimated ~",u(i)," tokens | ",U," | ",W," |"," ",G," | ",M]})]}),t.jsx("div",{className:"inline-flex shrink-0 rounded border border-border bg-muted/20 p-0.5",role:"group","aria-label":"Context breakdown mode",children:ue.map(a=>t.jsx("button",{type:"button","aria-pressed":m===a.value,onClick:()=>g(a.value),className:p("h-6 rounded-sm px-2 text-[11px] font-medium transition-colors",m===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))})]}),v&&t.jsxs("div",{className:"inline-flex items-center gap-1.5 text-xs text-amber-400",children:[t.jsxs(q,{children:[t.jsx(Y,{asChild:!0,children:t.jsx("button",{type:"button",className:"inline-flex items-center hover:text-amber-300","aria-label":"Token estimate differs from provider input",children:t.jsx(K,{className:"size-3.5"})})}),t.jsx(X,{className:"max-w-xs text-xs",children:"The bar uses a local token estimate. Provider input tokens remain the source of truth for billing and context-window usage."})]}),"Estimate differs from provider-reported input."]}),d!==null&&t.jsx(Te,{intelligence:d,segments:o,onSegmentActivate:n}),d!==null&&t.jsx(Se,{groups:d.duplicateGroups,segments:o,onSegmentActivate:n}),t.jsx(Q,{segments:N,totalTokens:k,showLabels:m==="segment",onActivate:D}),t.jsx("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5 text-[11px] text-muted-foreground",children:b.map(a=>{const x=i>0?a.size/i*100:0;return t.jsxs("div",{className:"inline-flex items-center gap-1.5",children:[t.jsx("span",{"aria-hidden":"true",className:p("size-2.5 rounded-[2px]",$[a.role])}),t.jsx("span",{children:a.label}),t.jsx("span",{className:"font-mono text-muted-foreground/70",children:h(x)})]},a.role)})}),t.jsxs("div",{className:"space-y-1.5",children:[t.jsx("div",{className:"text-xs font-medium text-foreground",children:"Top Contributors"}),t.jsx("div",{className:"grid gap-1",children:T.map((a,x)=>{const H=i>0?a.size/i*100:0,R=n,E=t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"w-5 shrink-0 text-right font-mono text-muted-foreground/70",children:String(x+1)}),t.jsx("span",{"aria-hidden":"true",className:p("size-2.5 shrink-0 rounded-[2px]",$[a.role])}),t.jsx("span",{className:"min-w-0 flex-1 truncate text-left",children:a.label}),t.jsxs("span",{className:"shrink-0 font-mono text-muted-foreground",children:[h(H)," | ~",u(a.size)]})]});return R!==void 0?t.jsx("button",{type:"button",onClick:()=>R(a),className:"flex h-7 items-center gap-2 rounded px-1.5 text-xs text-muted-foreground hover:bg-muted/40 hover:text-foreground",title:"Jump to this request block",children:E},`${a.path}-${x}`):t.jsx("div",{className:"flex h-7 items-center gap-2 rounded px-1.5 text-xs text-muted-foreground",children:E},`${a.path}-${x}`)})})]})]})})}export{Ee as RequestAnatomy};
@@ -1,2 +1,2 @@
1
- import{r as c,j as e,k as B,o as d,t as D}from"./index-BlSm4bqn.js";import{U as F,V as g,W as j,Y as H,B as m,Q as N,e as v,Z as y,_ as k,$ as O,a0 as z,a1 as S,a2 as b,a3 as T,a4 as w,a5 as p,g as M,a6 as U}from"./ProxyViewerContainer-DoCpLJM1.js";var $="Separator",C="horizontal",X=["horizontal","vertical"],G=c.forwardRef((n,t)=>{const{decorative:o,orientation:r=C,...s}=n,a=Z(r)?r:C,l=o?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return e.jsx(F.div,{"data-orientation":a,...l,...s,ref:t})});G.displayName=$;function Z(n){return X.includes(n)}var Q=G;function A({className:n,orientation:t="horizontal",decorative:o=!0,...r}){return e.jsx(Q,{"data-slot":"separator",decorative:o,orientation:t,className:B("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",n),...r})}const W=/<think>([\s\S]*?)<\/think>/gi,Y=/<think>([\s\S]*?)<\/think>/i;function L(n){const t=Y.exec(n);if(!t||t[1]===void 0)return{thinking:null,remainingText:n};const o=t[1].trim(),r=n.replace(W,"").trim();return{thinking:o,remainingText:r}}function q(n){return e.jsx(e.Fragment,{})}function ee({text:n}){const[t,o]=c.useState(!1);return e.jsxs(g,{open:t,onOpenChange:o,children:[e.jsxs(j,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),e.jsx(y,{children:e.jsx("div",{className:"pl-4 pt-1",children:e.jsx(b,{text:n})})})]})}const te=c.memo(function({text:t}){if(t.includes("<system-reminder>"))return e.jsx(ee,{text:t});const{thinking:o,remainingText:r}=L(t);return e.jsxs("div",{className:"space-y-2",children:[o!==null&&e.jsx(_,{thinking:o}),r.length>0&&e.jsx(b,{text:r}),o===null&&r.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),_=c.memo(function({thinking:t}){const[o,r]=c.useState(!1);return e.jsx(g,{open:o,onOpenChange:r,children:e.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[e.jsxs(j,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group",children:[e.jsx(H,{className:"size-3.5 text-purple-400 shrink-0"}),e.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),e.jsxs(m,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[t.length.toLocaleString()," chars"]}),e.jsx("span",{className:"flex-1"}),o?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:e.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:t})})})})]})})}),ne=c.memo(function({name:t,input:o,toolIndex:r,toolFocus:s}){const[a,i]=c.useState(!1),l=c.useRef(null),x=s?.focusedToolIndex===r;return c.useEffect(()=>{if(!x||s===void 0||s.toolFocusNonce<=0)return;i(!0);const u=window.setTimeout(()=>{const f=l.current;f!==null&&(f.scrollIntoView({block:"center",behavior:"smooth"}),f.focus({preventScroll:!0}))},0);return()=>window.clearTimeout(u)},[x,s,s?.toolFocusNonce]),e.jsx(g,{open:a,onOpenChange:i,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1","data-response-tool-index":r,children:[e.jsxs(j,{ref:l,className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(O,{className:"size-3.5 text-sky-400/70 shrink-0"}),e.jsx(m,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:t}),e.jsx("span",{className:"flex-1"}),a?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:a&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:S(o),defaultExpandDepth:0})})})})})]})})}),se=c.memo(function({block:t,toolIndex:o,toolFocus:r}){switch(t.type){case"text":return e.jsx(te,{text:t.text});case"thinking":case"think":return e.jsx(_,{thinking:t.thinking});case"tool_use":return e.jsx(ne,{name:t.name,input:t.input,toolIndex:o??0,toolFocus:r});default:return q()}}),oe=c.memo(function({response:t,toolFocus:o}){let r=0;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(m,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),t.stop_reason!==null&&e.jsxs(m,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[e.jsx(T,{className:"size-2.5"}),t.stop_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(w,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[d(t.usage.input_tokens??0)," in /"," ",d(t.usage.output_tokens??0)," out"]}),t.usage.cache_creation_input_tokens!==void 0&&t.usage.cache_creation_input_tokens!==null&&t.usage.cache_creation_input_tokens>0&&e.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",d(t.usage.cache_creation_input_tokens)]}),t.usage.cache_read_input_tokens!==void 0&&t.usage.cache_read_input_tokens!==null&&t.usage.cache_read_input_tokens>0&&e.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",d(t.usage.cache_read_input_tokens)]})]})]}),e.jsx(A,{className:"opacity-50"}),e.jsxs("div",{className:"space-y-2",children:[t.content.map((s,a)=>{const i=s.type==="tool_use"?r:void 0;return s.type==="tool_use"&&(r+=1),e.jsx(se,{block:s,toolIndex:i,toolFocus:o},a)}),t.content.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function J(n){if(n===void 0||n==="")return{};try{return JSON.parse(n)}catch{return null}}function K({toolIndex:n,toolFocus:t,setOpen:o}){const r=c.useRef(null),s=t?.focusedToolIndex===n;return c.useEffect(()=>{if(!s||t===void 0||t.toolFocusNonce<=0)return;o(!0);const a=window.setTimeout(()=>{const i=r.current;i!==null&&(i.scrollIntoView({block:"center",behavior:"smooth"}),i.focus({preventScroll:!0}))},0);return()=>window.clearTimeout(a)},[o,s,t,t?.toolFocusNonce]),r}function re({name:n,argumentsText:t,toolIndex:o,toolFocus:r}){const s=c.useRef(null),a=r?.focusedToolIndex===o;return c.useEffect(()=>{if(!a||r===void 0||r.toolFocusNonce<=0)return;const i=window.setTimeout(()=>{const l=s.current;l!==null&&(l.scrollIntoView({block:"center",behavior:"smooth"}),l.focus({preventScroll:!0}))},0);return()=>window.clearTimeout(i)},[a,r,r?.toolFocusNonce]),e.jsxs("div",{ref:s,tabIndex:-1,className:"border border-sky-400/20 rounded-md p-3 bg-muted/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","data-response-tool-index":o,children:[e.jsx("div",{className:"text-xs text-sky-400/80 font-mono mb-1",children:"function_call"}),e.jsxs("div",{className:"font-mono text-xs",children:[e.jsx("span",{className:"text-foreground/80",children:n}),e.jsxs("span",{className:"text-muted-foreground",children:["(",t,")"]})]})]})}function ae({call:n,toolIndex:t,toolFocus:o}){const[r,s]=c.useState(!1),a=n.function.name??"(unnamed tool)",i=r?J(n.function.arguments):{},l=K({toolIndex:t,toolFocus:o,setOpen:s});return e.jsx(g,{open:r,onOpenChange:s,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1","data-response-tool-index":t,children:[e.jsxs(j,{ref:l,className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(O,{className:"size-3.5 text-sky-400/70 shrink-0"}),e.jsx(m,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:a}),n.id!==void 0&&n.id!==""&&e.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 truncate",children:n.id}),e.jsx("span",{className:"flex-1"}),r?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:r&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:i===null?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:n.function.arguments}):e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:S(i),defaultExpandDepth:0})})})})})]})})}function ie(n){if(n.output_text!==void 0&&n.output_text.length>0)return n.output_text;const t=[];for(const o of n.output??[]){if(p(o,"type")!=="message")continue;const r=p(o,"content");if(Array.isArray(r))for(const s of r){const a=p(s,"type"),i=p(s,"text");(a==="output_text"||a==="text")&&typeof i=="string"&&t.push(i)}}return t.join(`
1
+ import{r as c,j as e,k as B,o as d,t as D}from"./index-BmKouSES.js";import{U as F,V as g,W as j,Y as H,B as m,Q as N,e as v,Z as y,_ as k,$ as O,a0 as z,a1 as S,a2 as b,a3 as T,a4 as w,a5 as p,g as M,a6 as U}from"./ProxyViewerContainer-CCtygisW.js";var $="Separator",C="horizontal",X=["horizontal","vertical"],G=c.forwardRef((n,t)=>{const{decorative:o,orientation:r=C,...s}=n,a=Z(r)?r:C,l=o?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return e.jsx(F.div,{"data-orientation":a,...l,...s,ref:t})});G.displayName=$;function Z(n){return X.includes(n)}var Q=G;function A({className:n,orientation:t="horizontal",decorative:o=!0,...r}){return e.jsx(Q,{"data-slot":"separator",decorative:o,orientation:t,className:B("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",n),...r})}const W=/<think>([\s\S]*?)<\/think>/gi,Y=/<think>([\s\S]*?)<\/think>/i;function L(n){const t=Y.exec(n);if(!t||t[1]===void 0)return{thinking:null,remainingText:n};const o=t[1].trim(),r=n.replace(W,"").trim();return{thinking:o,remainingText:r}}function q(n){return e.jsx(e.Fragment,{})}function ee({text:n}){const[t,o]=c.useState(!1);return e.jsxs(g,{open:t,onOpenChange:o,children:[e.jsxs(j,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"}),e.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),e.jsx(y,{children:e.jsx("div",{className:"pl-4 pt-1",children:e.jsx(b,{text:n})})})]})}const te=c.memo(function({text:t}){if(t.includes("<system-reminder>"))return e.jsx(ee,{text:t});const{thinking:o,remainingText:r}=L(t);return e.jsxs("div",{className:"space-y-2",children:[o!==null&&e.jsx(_,{thinking:o}),r.length>0&&e.jsx(b,{text:r}),o===null&&r.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),_=c.memo(function({thinking:t}){const[o,r]=c.useState(!1);return e.jsx(g,{open:o,onOpenChange:r,children:e.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[e.jsxs(j,{className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-purple-500/5 transition-colors rounded-r-sm group",children:[e.jsx(H,{className:"size-3.5 text-purple-400 shrink-0"}),e.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),e.jsxs(m,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[t.length.toLocaleString()," chars"]}),e.jsx("span",{className:"flex-1"}),o?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:e.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:t})})})})]})})}),ne=c.memo(function({name:t,input:o,toolIndex:r,toolFocus:s}){const[a,i]=c.useState(!1),l=c.useRef(null),x=s?.focusedToolIndex===r;return c.useEffect(()=>{if(!x||s===void 0||s.toolFocusNonce<=0)return;i(!0);const u=window.setTimeout(()=>{const f=l.current;f!==null&&(f.scrollIntoView({block:"center",behavior:"smooth"}),f.focus({preventScroll:!0}))},0);return()=>window.clearTimeout(u)},[x,s,s?.toolFocusNonce]),e.jsx(g,{open:a,onOpenChange:i,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1","data-response-tool-index":r,children:[e.jsxs(j,{ref:l,className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(O,{className:"size-3.5 text-sky-400/70 shrink-0"}),e.jsx(m,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:t}),e.jsx("span",{className:"flex-1"}),a?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:a&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:S(o),defaultExpandDepth:0})})})})})]})})}),se=c.memo(function({block:t,toolIndex:o,toolFocus:r}){switch(t.type){case"text":return e.jsx(te,{text:t.text});case"thinking":case"think":return e.jsx(_,{thinking:t.thinking});case"tool_use":return e.jsx(ne,{name:t.name,input:t.input,toolIndex:o??0,toolFocus:r});default:return q()}}),oe=c.memo(function({response:t,toolFocus:o}){let r=0;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(m,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),t.stop_reason!==null&&e.jsxs(m,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[e.jsx(T,{className:"size-2.5"}),t.stop_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(w,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[d(t.usage.input_tokens??0)," in /"," ",d(t.usage.output_tokens??0)," out"]}),t.usage.cache_creation_input_tokens!==void 0&&t.usage.cache_creation_input_tokens!==null&&t.usage.cache_creation_input_tokens>0&&e.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",d(t.usage.cache_creation_input_tokens)]}),t.usage.cache_read_input_tokens!==void 0&&t.usage.cache_read_input_tokens!==null&&t.usage.cache_read_input_tokens>0&&e.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",d(t.usage.cache_read_input_tokens)]})]})]}),e.jsx(A,{className:"opacity-50"}),e.jsxs("div",{className:"space-y-2",children:[t.content.map((s,a)=>{const i=s.type==="tool_use"?r:void 0;return s.type==="tool_use"&&(r+=1),e.jsx(se,{block:s,toolIndex:i,toolFocus:o},a)}),t.content.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function J(n){if(n===void 0||n==="")return{};try{return JSON.parse(n)}catch{return null}}function K({toolIndex:n,toolFocus:t,setOpen:o}){const r=c.useRef(null),s=t?.focusedToolIndex===n;return c.useEffect(()=>{if(!s||t===void 0||t.toolFocusNonce<=0)return;o(!0);const a=window.setTimeout(()=>{const i=r.current;i!==null&&(i.scrollIntoView({block:"center",behavior:"smooth"}),i.focus({preventScroll:!0}))},0);return()=>window.clearTimeout(a)},[o,s,t,t?.toolFocusNonce]),r}function re({name:n,argumentsText:t,toolIndex:o,toolFocus:r}){const s=c.useRef(null),a=r?.focusedToolIndex===o;return c.useEffect(()=>{if(!a||r===void 0||r.toolFocusNonce<=0)return;const i=window.setTimeout(()=>{const l=s.current;l!==null&&(l.scrollIntoView({block:"center",behavior:"smooth"}),l.focus({preventScroll:!0}))},0);return()=>window.clearTimeout(i)},[a,r,r?.toolFocusNonce]),e.jsxs("div",{ref:s,tabIndex:-1,className:"border border-sky-400/20 rounded-md p-3 bg-muted/20 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring","data-response-tool-index":o,children:[e.jsx("div",{className:"text-xs text-sky-400/80 font-mono mb-1",children:"function_call"}),e.jsxs("div",{className:"font-mono text-xs",children:[e.jsx("span",{className:"text-foreground/80",children:n}),e.jsxs("span",{className:"text-muted-foreground",children:["(",t,")"]})]})]})}function ae({call:n,toolIndex:t,toolFocus:o}){const[r,s]=c.useState(!1),a=n.function.name??"(unnamed tool)",i=r?J(n.function.arguments):{},l=K({toolIndex:t,toolFocus:o,setOpen:s});return e.jsx(g,{open:r,onOpenChange:s,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1","data-response-tool-index":t,children:[e.jsxs(j,{ref:l,className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(O,{className:"size-3.5 text-sky-400/70 shrink-0"}),e.jsx(m,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:a}),n.id!==void 0&&n.id!==""&&e.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 truncate",children:n.id}),e.jsx("span",{className:"flex-1"}),r?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:r&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:i===null?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:n.function.arguments}):e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:S(i),defaultExpandDepth:0})})})})})]})})}function ie(n){if(n.output_text!==void 0&&n.output_text.length>0)return n.output_text;const t=[];for(const o of n.output??[]){if(p(o,"type")!=="message")continue;const r=p(o,"content");if(Array.isArray(r))for(const s of r){const a=p(s,"type"),i=p(s,"text");(a==="output_text"||a==="text")&&typeof i=="string"&&t.push(i)}}return t.join(`
2
2
  `)}function le(n){const t=[];for(const o of n.output??[]){if(p(o,"type")!=="function_call")continue;const r=p(o,"name");if(typeof r!="string"||r.length===0)continue;const s=p(o,"id"),a=p(o,"call_id"),i=p(o,"arguments"),l=p(o,"status");t.push({id:typeof s=="string"&&s.length>0?s:null,callId:typeof a=="string"&&a.length>0?a:null,name:r,argumentsText:typeof i=="string"?i:"",status:typeof l=="string"&&l.length>0?l:null})}return t}function ce({call:n,toolIndex:t,toolFocus:o}){const[r,s]=c.useState(!1),a=r?J(n.argumentsText):{},i=n.callId??n.id,l=K({toolIndex:t,toolFocus:o,setOpen:s});return e.jsx(g,{open:r,onOpenChange:s,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1","data-response-tool-index":t,children:[e.jsxs(j,{ref:l,className:"flex items-center gap-1.5 px-3 py-1 w-full text-left cursor-pointer hover:bg-sky-400/[0.04] transition-colors rounded-r-sm group focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(O,{className:"size-3.5 text-sky-400/70 shrink-0"}),e.jsx(m,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:n.name}),i!==null&&e.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 truncate",children:i}),n.status!==null&&e.jsx(m,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-4 font-mono",children:n.status}),e.jsx("span",{className:"flex-1"}),r?e.jsx(N,{className:"size-3 text-muted-foreground"}):e.jsx(v,{className:"size-3 text-muted-foreground"})]}),e.jsx(y,{children:r&&e.jsx("div",{className:"px-3 pb-2",children:e.jsx(k,{className:"max-h-[60vh]",children:a===null?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:n.argumentsText}):e.jsx(c.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:S(a),defaultExpandDepth:0})})})})})]})})}const ue=c.memo(function({response:t,toolFocus:o}){const r=t.choices[0],s=r?.message,a=s?.tool_calls??[];return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx(m,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),r?.finish_reason!==null&&r?.finish_reason!==void 0&&e.jsxs(m,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[e.jsx(T,{className:"size-2.5"}),r.finish_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(w,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[d(t.usage.prompt_tokens??0)," in /"," ",d(t.usage.completion_tokens??0)," out"]})]})]}),e.jsx(A,{className:"opacity-50"}),e.jsxs("div",{className:"space-y-2",children:[s?.reasoning_content!==null&&s?.reasoning_content!==void 0&&s.reasoning_content.length>0&&e.jsx(_,{thinking:s.reasoning_content}),s?.content!==null&&s?.content!==void 0&&s.content.length>0&&(()=>{const i=s.reasoning_content!==null&&s.reasoning_content!==void 0&&s.reasoning_content.length>0,{thinking:l,remainingText:x}=L(s.content);return e.jsxs("div",{className:"space-y-2",children:[l!==null&&!i&&e.jsx(_,{thinking:l}),x.length>0&&e.jsx(b,{text:x})]})})(),a.map((i,l)=>e.jsx(ae,{call:i,toolIndex:l,toolFocus:o},i.id??`tc-${l}`)),s?.function_call!==null&&s?.function_call!==void 0&&e.jsx(re,{name:s.function_call.name,argumentsText:s.function_call.arguments,toolIndex:a.length,toolFocus:o}),(s?.content===null||s?.content===void 0||s.content.length===0)&&(s?.reasoning_content===null||s?.reasoning_content===void 0||s.reasoning_content.length===0)&&(s?.function_call===null||s?.function_call===void 0)&&a.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})}),de=c.memo(function({response:t,toolFocus:o}){const r=ie(t),s=le(t),a=t.status??null,i=t.usage?.input_tokens??0,l=t.usage?.output_tokens??0;return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.model!==void 0&&t.model.length>0&&e.jsx(m,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:t.model}),a!==null&&e.jsxs(m,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[e.jsx(T,{className:"size-2.5"}),a]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(w,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[d(i)," in / ",d(l)," out"]})]})]}),e.jsx(A,{className:"opacity-50"}),e.jsxs("div",{className:"space-y-2",children:[r.length>0&&e.jsx(b,{text:r}),s.map((x,u)=>e.jsx(ce,{call:x,toolIndex:u,toolFocus:o},x.callId??x.id??`call-${u}`)),r.length===0&&s.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function E(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function xe(n){return E(n)&&n.object==="chat.completion"}function me(n){return E(n)&&n.object==="response"}function pe(n){return E(n)&&n.type==="message"&&Array.isArray(n.content)}function fe(n,t,o){return n==="openai"&&xe(t)?e.jsx(ue,{response:t,toolFocus:o}):n==="openai"&&me(t)?e.jsx(de,{response:t,toolFocus:o}):n==="anthropic"&&pe(t)?e.jsx(oe,{response:t,toolFocus:o}):null}function he(n){switch(n){case"success":return"text-emerald-400";case"client_error":return"text-amber-400";case"server_error":return"text-red-400";case"pending":return"text-muted-foreground"}}function h({status:n}){const t=D(n),o=he(t);return n===null?e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):e.jsxs("span",{className:B("flex items-center gap-1 text-xs font-mono font-semibold",o),children:[t==="server_error"&&e.jsx(U,{className:"size-3"}),n]})}function V({text:n}){return e.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-3",children:e.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]",children:n})})}function ge({text:n}){return e.jsx(b,{text:n})}const ye=c.memo(function({responseText:t,responseStatus:o,streaming:r,inputTokens:s,outputTokens:a,cacheCreationInputTokens:i,cacheReadInputTokens:l,apiFormat:x,error:u,focusedToolIndex:f=null,toolFocusNonce:P=0}){const R=x??"unknown",I=c.useMemo(()=>M(R).analyzeResponse(t).parsed,[R,t]);return t===null&&u===void 0?e.jsxs("div",{className:"flex items-center gap-2 py-3",children:[e.jsx(h,{status:o}),e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):o!==null&&o>=400?e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{status:o}),e.jsx(V,{text:t??""}),u!=null&&e.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[e.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),e.jsx("div",{className:"text-muted-foreground font-mono",children:u})]})]}):u!=null?e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{status:o}),e.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[e.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),e.jsx("div",{className:"text-muted-foreground font-mono",children:u})]}),t!==null&&e.jsx("div",{className:"mt-2",children:e.jsx(V,{text:t})})]}):I!==null?e.jsxs("div",{className:"space-y-2",children:[e.jsx(h,{status:o}),fe(R,I,{focusedToolIndex:f,toolFocusNonce:P})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(h,{status:o}),r&&(s!==null||a!==null)&&e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(w,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[s!==null?d(s):"—"," in /"," ",a!==null?d(a):"—"," out"]}),i!=null&&i>0&&e.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",d(i)]}),l!=null&&l>0&&e.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",d(l)]})]})]}),e.jsx(ge,{text:t??""})]})});export{ye as ResponseView};
@@ -1 +1 @@
1
- import{r,j as e}from"./index-BlSm4bqn.js";import{i as b,s as v,t as N,v as k,Q as l,e as x,B as S,w as C,x as y,F as E,z as w,a7 as T,a0 as z,a8 as R}from"./ProxyViewerContainer-DoCpLJM1.js";const L=y({chunks:w(R),truncated:E().optional()}),M=1e4,J=r.memo(function({logId:o,truncated:m}){const[i,h]=r.useState(!1),[a,d]=r.useState({status:"idle"}),[p,f]=r.useState(new Set),c=r.useRef(null);r.useEffect(()=>{if(!i||c.current===o)return;const s=new AbortController;return d({status:"loading"}),b(`/api/logs/${o}/chunks`,L,M,{signal:s.signal},()=>"Chunks not found").then(t=>{c.current=o,d({status:"success",chunks:t.chunks})}).catch(t=>{t instanceof DOMException&&t.name==="AbortError"||(c.current=null,d({status:"error",message:t instanceof Error?t.message:"Chunk data unavailable"}))}),()=>{s.abort()}},[i,o]);const u=r.useMemo(()=>{if(a.status!=="success")return[];const s=new Map;for(const t of a.chunks){const n=s.get(t.index);n?n.push(t):s.set(t.index,[t])}return Array.from(s.entries()).map(([t,n])=>({index:t,chunks:n})).sort((t,n)=>t.index-n.index)},[a]),g=s=>{f(t=>{const n=new Set(t);return n.has(s)?n.delete(s):n.add(s),n})};function j(){return a.status==="idle"||a.status==="loading"?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[e.jsx(T,{className:"size-3 animate-spin"}),e.jsx("span",{children:"Loading chunks..."})]}):a.status==="error"?e.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:a.message}):e.jsxs("div",{className:"p-2 space-y-1",children:[e.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono mb-2",children:[u.length," index group",u.length!==1?"s":""," available"]}),u.map(s=>{const t=p.has(s.index);return e.jsxs("div",{className:"rounded border border-border bg-background",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>g(s.index),children:[t?e.jsx(l,{className:"size-3 text-muted-foreground"}):e.jsx(x,{className:"size-3 text-muted-foreground"}),e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",s.index,"] ",s.chunks[0]?.type??""]}),e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[s.chunks.length," chunk",s.chunks.length!==1?"s":""]})]}),t&&e.jsx("div",{className:"px-2 pb-2 space-y-1",children:s.chunks.map(n=>e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["+",n.timestamp,"ms"]}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:n.type})]}),e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:n,defaultExpandDepth:0,showCopy:!0})})]},n.index))})]},s.index)})]})}return e.jsxs("div",{className:"space-y-1",children:[e.jsx(v,{children:e.jsxs(N,{children:[e.jsx(k,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>h(s=>!s),children:[i?e.jsx(l,{className:"size-3"}):e.jsx(x,{className:"size-3"}),e.jsx("span",{children:"Raw SSE Events"}),e.jsxs(S,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[o,m===!0?"+":""]})]})}),e.jsx(C,{children:"Server-Sent Events streaming chunks from the provider"})]})}),i===!0?e.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:j()}):null]})});export{J as StreamingChunkSequence};
1
+ import{r,j as e}from"./index-BmKouSES.js";import{i as b,s as v,t as N,v as k,Q as l,e as x,B as S,w as C,x as y,F as E,z as w,a7 as T,a0 as z,a8 as R}from"./ProxyViewerContainer-CCtygisW.js";const L=y({chunks:w(R),truncated:E().optional()}),M=1e4,J=r.memo(function({logId:o,truncated:m}){const[i,h]=r.useState(!1),[a,d]=r.useState({status:"idle"}),[p,f]=r.useState(new Set),c=r.useRef(null);r.useEffect(()=>{if(!i||c.current===o)return;const s=new AbortController;return d({status:"loading"}),b(`/api/logs/${o}/chunks`,L,M,{signal:s.signal},()=>"Chunks not found").then(t=>{c.current=o,d({status:"success",chunks:t.chunks})}).catch(t=>{t instanceof DOMException&&t.name==="AbortError"||(c.current=null,d({status:"error",message:t instanceof Error?t.message:"Chunk data unavailable"}))}),()=>{s.abort()}},[i,o]);const u=r.useMemo(()=>{if(a.status!=="success")return[];const s=new Map;for(const t of a.chunks){const n=s.get(t.index);n?n.push(t):s.set(t.index,[t])}return Array.from(s.entries()).map(([t,n])=>({index:t,chunks:n})).sort((t,n)=>t.index-n.index)},[a]),g=s=>{f(t=>{const n=new Set(t);return n.has(s)?n.delete(s):n.add(s),n})};function j(){return a.status==="idle"||a.status==="loading"?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[e.jsx(T,{className:"size-3 animate-spin"}),e.jsx("span",{children:"Loading chunks..."})]}):a.status==="error"?e.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:a.message}):e.jsxs("div",{className:"p-2 space-y-1",children:[e.jsxs("div",{className:"text-[10px] text-muted-foreground font-mono mb-2",children:[u.length," index group",u.length!==1?"s":""," available"]}),u.map(s=>{const t=p.has(s.index);return e.jsxs("div",{className:"rounded border border-border bg-background",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 w-full px-2 py-1.5 text-left hover:bg-muted/50 transition-colors cursor-pointer",onClick:()=>g(s.index),children:[t?e.jsx(l,{className:"size-3 text-muted-foreground"}):e.jsx(x,{className:"size-3 text-muted-foreground"}),e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["[",s.index,"] ",s.chunks[0]?.type??""]}),e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:[s.chunks.length," chunk",s.chunks.length!==1?"s":""]})]}),t&&e.jsx("div",{className:"px-2 pb-2 space-y-1",children:s.chunks.map(n=>e.jsxs("div",{className:"rounded border border-border bg-muted/20 p-2",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[e.jsxs("span",{className:"text-[10px] text-muted-foreground font-mono",children:["+",n.timestamp,"ms"]}),e.jsx("span",{className:"text-[10px] text-muted-foreground font-mono",children:n.type})]}),e.jsx(r.Suspense,{fallback:e.jsx("div",{className:"text-xs text-muted-foreground",children:"Loading JSON..."}),children:e.jsx(z,{data:n,defaultExpandDepth:0,showCopy:!0})})]},n.index))})]},s.index)})]})}return e.jsxs("div",{className:"space-y-1",children:[e.jsx(v,{children:e.jsxs(N,{children:[e.jsx(k,{asChild:!0,children:e.jsxs("button",{type:"button",className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer",onClick:()=>h(s=>!s),children:[i?e.jsx(l,{className:"size-3"}):e.jsx(x,{className:"size-3"}),e.jsx("span",{children:"Raw SSE Events"}),e.jsxs(S,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[o,m===!0?"+":""]})]})}),e.jsx(C,{children:"Server-Sent Events streaming chunks from the provider"})]})}),i===!0?e.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:j()}):null]})});export{J as StreamingChunkSequence};
@@ -1 +1 @@
1
- import{j as e,S as s}from"./index-BlSm4bqn.js";function n({error:o,reset:r}){return e.jsx(s,{error:o,reset:r,scope:"session-route"})}export{n as errorComponent};
1
+ import{j as e,S as s}from"./index-BmKouSES.js";function n({error:o,reset:r}){return e.jsx(s,{error:o,reset:r,scope:"session-route"})}export{n as errorComponent};
@@ -1 +1 @@
1
- import{R as o,j as e,r}from"./index-BlSm4bqn.js";import{P as a}from"./ProxyViewerContainer-DoCpLJM1.js";function m(){const{sessionId:t}=o.useParams();return e.jsx(i,{sessionId:t})}function i({sessionId:t}){const[s,n]=r.useState(!1);return r.useEffect(()=>{n(!0)},[]),s?e.jsx(a,{initialSessionId:t},t):e.jsx("main",{className:"min-h-screen bg-background text-foreground",children:e.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center",children:e.jsxs("div",{className:"border border-border bg-card shadow-sm rounded-[8px] px-4 py-8",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Loading session data..."}),e.jsx("p",{className:"mt-3 inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all text-muted-foreground",children:t})]})})})}export{m as component};
1
+ import{R as o,j as e,r}from"./index-BmKouSES.js";import{P as a}from"./ProxyViewerContainer-CCtygisW.js";function m(){const{sessionId:t}=o.useParams();return e.jsx(i,{sessionId:t})}function i({sessionId:t}){const[s,n]=r.useState(!1);return r.useEffect(()=>{n(!0)},[]),s?e.jsx(a,{initialSessionId:t},t):e.jsx("main",{className:"min-h-screen bg-background text-foreground",children:e.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center",children:e.jsxs("div",{className:"border border-border bg-card shadow-sm rounded-[8px] px-4 py-8",children:[e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Loading session data..."}),e.jsx("p",{className:"mt-3 inline-block max-w-full rounded bg-muted px-3 py-1 font-mono text-xs break-all text-muted-foreground",children:t})]})})})}export{m as component};
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DswDeL6m.js","assets/ProxyViewerContainer-DoCpLJM1.js","assets/_sessionId-BOAAnQhC.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DPsfwdop.js","assets/ProxyViewerContainer-CCtygisW.js","assets/_sessionId-BsoVln_N.js"])))=>i.map(i=>d[i]);
2
2
  function SS(n,i){for(var r=0;r<i.length;r++){const o=i[r];if(typeof o!="string"&&!Array.isArray(o)){for(const c in o)if(c!=="default"&&!(c in n)){const f=Object.getOwnPropertyDescriptor(o,c);f&&Object.defineProperty(n,c,f.get?f:{enumerable:!0,get:()=>o[c]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var vT=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function _S(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ac={exports:{}},Ji={};var Bp;function xS(){if(Bp)return Ji;Bp=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function r(o,c,f){var d=null;if(f!==void 0&&(d=""+f),c.key!==void 0&&(d=""+c.key),"key"in c){f={};for(var p in c)p!=="key"&&(f[p]=c[p])}else f=c;return c=f.ref,{$$typeof:n,type:o,key:d,ref:c!==void 0?c:null,props:f}}return Ji.Fragment=i,Ji.jsx=r,Ji.jsxs=r,Ji}var Hp;function ES(){return Hp||(Hp=1,Ac.exports=xS()),Ac.exports}var Y=ES(),Cc={exports:{}},pt={};var kp;function RS(){if(kp)return pt;kp=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),c=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),d=Symbol.for("react.context"),p=Symbol.for("react.forward_ref"),y=Symbol.for("react.suspense"),m=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),S=Symbol.iterator;function _(A){return A===null||typeof A!="object"?null:(A=S&&A[S]||A["@@iterator"],typeof A=="function"?A:null)}var w={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},D=Object.assign,E={};function M(A,V,F){this.props=A,this.context=V,this.refs=E,this.updater=F||w}M.prototype.isReactComponent={},M.prototype.setState=function(A,V){if(typeof A!="object"&&typeof A!="function"&&A!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,A,V,"setState")},M.prototype.forceUpdate=function(A){this.updater.enqueueForceUpdate(this,A,"forceUpdate")};function O(){}O.prototype=M.prototype;function Q(A,V,F){this.props=A,this.context=V,this.refs=E,this.updater=F||w}var q=Q.prototype=new O;q.constructor=Q,D(q,M.prototype),q.isPureReactComponent=!0;var Z=Array.isArray;function J(){}var H={H:null,A:null,T:null,S:null},L=Object.prototype.hasOwnProperty;function P(A,V,F){var tt=F.ref;return{$$typeof:n,type:A,key:V,ref:tt!==void 0?tt:null,props:F}}function ct(A,V){return P(A.type,V,A.props)}function lt(A){return typeof A=="object"&&A!==null&&A.$$typeof===n}function rt(A){var V={"=":"=0",":":"=2"};return"$"+A.replace(/[=:]/g,function(F){return V[F]})}var Bt=/\/+/g;function vt(A,V){return typeof A=="object"&&A!==null&&A.key!=null?rt(""+A.key):V.toString(36)}function Tt(A){switch(A.status){case"fulfilled":return A.value;case"rejected":throw A.reason;default:switch(typeof A.status=="string"?A.then(J,J):(A.status="pending",A.then(function(V){A.status==="pending"&&(A.status="fulfilled",A.value=V)},function(V){A.status==="pending"&&(A.status="rejected",A.reason=V)})),A.status){case"fulfilled":return A.value;case"rejected":throw A.reason}}throw A}function B(A,V,F,tt,et){var st=typeof A;(st==="undefined"||st==="boolean")&&(A=null);var mt=!1;if(A===null)mt=!0;else switch(st){case"bigint":case"string":case"number":mt=!0;break;case"object":switch(A.$$typeof){case n:case i:mt=!0;break;case v:return mt=A._init,B(mt(A._payload),V,F,tt,et)}}if(mt)return et=et(A),mt=tt===""?"."+vt(A,0):tt,Z(et)?(F="",mt!=null&&(F=mt.replace(Bt,"$&/")+"/"),B(et,V,F,"",function(Ae){return Ae})):et!=null&&(lt(et)&&(et=ct(et,F+(et.key==null||A&&A.key===et.key?"":(""+et.key).replace(Bt,"$&/")+"/")+mt)),V.push(et)),1;mt=0;var jt=tt===""?".":tt+":";if(Z(A))for(var ht=0;ht<A.length;ht++)tt=A[ht],st=jt+vt(tt,ht),mt+=B(tt,V,F,st,et);else if(ht=_(A),typeof ht=="function")for(A=ht.call(A),ht=0;!(tt=A.next()).done;)tt=tt.value,st=jt+vt(tt,ht++),mt+=B(tt,V,F,st,et);else if(st==="object"){if(typeof A.then=="function")return B(Tt(A),V,F,tt,et);throw V=String(A),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(A).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return mt}function I(A,V,F){if(A==null)return A;var tt=[],et=0;return B(A,tt,"","",function(st){return V.call(F,st,et++)}),tt}function ot(A){if(A._status===-1){var V=A._result;V=V(),V.then(function(F){(A._status===0||A._status===-1)&&(A._status=1,A._result=F)},function(F){(A._status===0||A._status===-1)&&(A._status=2,A._result=F)}),A._status===-1&&(A._status=0,A._result=V)}if(A._status===1)return A._result.default;throw A._result}var St=typeof reportError=="function"?reportError:function(A){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof A=="object"&&A!==null&&typeof A.message=="string"?String(A.message):String(A),error:A});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",A);return}console.error(A)},W={map:I,forEach:function(A,V,F){I(A,function(){V.apply(this,arguments)},F)},count:function(A){var V=0;return I(A,function(){V++}),V},toArray:function(A){return I(A,function(V){return V})||[]},only:function(A){if(!lt(A))throw Error("React.Children.only expected to receive a single React element child.");return A}};return pt.Activity=g,pt.Children=W,pt.Component=M,pt.Fragment=r,pt.Profiler=c,pt.PureComponent=Q,pt.StrictMode=o,pt.Suspense=y,pt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=H,pt.__COMPILER_RUNTIME={__proto__:null,c:function(A){return H.H.useMemoCache(A)}},pt.cache=function(A){return function(){return A.apply(null,arguments)}},pt.cacheSignal=function(){return null},pt.cloneElement=function(A,V,F){if(A==null)throw Error("The argument must be a React element, but you passed "+A+".");var tt=D({},A.props),et=A.key;if(V!=null)for(st in V.key!==void 0&&(et=""+V.key),V)!L.call(V,st)||st==="key"||st==="__self"||st==="__source"||st==="ref"&&V.ref===void 0||(tt[st]=V[st]);var st=arguments.length-2;if(st===1)tt.children=F;else if(1<st){for(var mt=Array(st),jt=0;jt<st;jt++)mt[jt]=arguments[jt+2];tt.children=mt}return P(A.type,et,tt)},pt.createContext=function(A){return A={$$typeof:d,_currentValue:A,_currentValue2:A,_threadCount:0,Provider:null,Consumer:null},A.Provider=A,A.Consumer={$$typeof:f,_context:A},A},pt.createElement=function(A,V,F){var tt,et={},st=null;if(V!=null)for(tt in V.key!==void 0&&(st=""+V.key),V)L.call(V,tt)&&tt!=="key"&&tt!=="__self"&&tt!=="__source"&&(et[tt]=V[tt]);var mt=arguments.length-2;if(mt===1)et.children=F;else if(1<mt){for(var jt=Array(mt),ht=0;ht<mt;ht++)jt[ht]=arguments[ht+2];et.children=jt}if(A&&A.defaultProps)for(tt in mt=A.defaultProps,mt)et[tt]===void 0&&(et[tt]=mt[tt]);return P(A,st,et)},pt.createRef=function(){return{current:null}},pt.forwardRef=function(A){return{$$typeof:p,render:A}},pt.isValidElement=lt,pt.lazy=function(A){return{$$typeof:v,_payload:{_status:-1,_result:A},_init:ot}},pt.memo=function(A,V){return{$$typeof:m,type:A,compare:V===void 0?null:V}},pt.startTransition=function(A){var V=H.T,F={};H.T=F;try{var tt=A(),et=H.S;et!==null&&et(F,tt),typeof tt=="object"&&tt!==null&&typeof tt.then=="function"&&tt.then(J,St)}catch(st){St(st)}finally{V!==null&&F.types!==null&&(V.types=F.types),H.T=V}},pt.unstable_useCacheRefresh=function(){return H.H.useCacheRefresh()},pt.use=function(A){return H.H.use(A)},pt.useActionState=function(A,V,F){return H.H.useActionState(A,V,F)},pt.useCallback=function(A,V){return H.H.useCallback(A,V)},pt.useContext=function(A){return H.H.useContext(A)},pt.useDebugValue=function(){},pt.useDeferredValue=function(A,V){return H.H.useDeferredValue(A,V)},pt.useEffect=function(A,V){return H.H.useEffect(A,V)},pt.useEffectEvent=function(A){return H.H.useEffectEvent(A)},pt.useId=function(){return H.H.useId()},pt.useImperativeHandle=function(A,V,F){return H.H.useImperativeHandle(A,V,F)},pt.useInsertionEffect=function(A,V){return H.H.useInsertionEffect(A,V)},pt.useLayoutEffect=function(A,V){return H.H.useLayoutEffect(A,V)},pt.useMemo=function(A,V){return H.H.useMemo(A,V)},pt.useOptimistic=function(A,V){return H.H.useOptimistic(A,V)},pt.useReducer=function(A,V,F){return H.H.useReducer(A,V,F)},pt.useRef=function(A){return H.H.useRef(A)},pt.useState=function(A){return H.H.useState(A)},pt.useSyncExternalStore=function(A,V,F){return H.H.useSyncExternalStore(A,V,F)},pt.useTransition=function(){return H.H.useTransition()},pt.version="19.2.7",pt}var qp;function ur(){return qp||(qp=1,Cc.exports=RS()),Cc.exports}var $=ur();const Zn=_S($),bT=SS({__proto__:null,default:Zn},[$]);var Mc={exports:{}},Ii={},Oc={exports:{}},zc={};var Gp;function wS(){return Gp||(Gp=1,(function(n){function i(B,I){var ot=B.length;B.push(I);t:for(;0<ot;){var St=ot-1>>>1,W=B[St];if(0<c(W,I))B[St]=I,B[ot]=W,ot=St;else break t}}function r(B){return B.length===0?null:B[0]}function o(B){if(B.length===0)return null;var I=B[0],ot=B.pop();if(ot!==I){B[0]=ot;t:for(var St=0,W=B.length,A=W>>>1;St<A;){var V=2*(St+1)-1,F=B[V],tt=V+1,et=B[tt];if(0>c(F,ot))tt<W&&0>c(et,F)?(B[St]=et,B[tt]=ot,St=tt):(B[St]=F,B[V]=ot,St=V);else if(tt<W&&0>c(et,ot))B[St]=et,B[tt]=ot,St=tt;else break t}}return I}function c(B,I){var ot=B.sortIndex-I.sortIndex;return ot!==0?ot:B.id-I.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,p=d.now();n.unstable_now=function(){return d.now()-p}}var y=[],m=[],v=1,g=null,S=3,_=!1,w=!1,D=!1,E=!1,M=typeof setTimeout=="function"?setTimeout:null,O=typeof clearTimeout=="function"?clearTimeout:null,Q=typeof setImmediate<"u"?setImmediate:null;function q(B){for(var I=r(m);I!==null;){if(I.callback===null)o(m);else if(I.startTime<=B)o(m),I.sortIndex=I.expirationTime,i(y,I);else break;I=r(m)}}function Z(B){if(D=!1,q(B),!w)if(r(y)!==null)w=!0,J||(J=!0,rt());else{var I=r(m);I!==null&&Tt(Z,I.startTime-B)}}var J=!1,H=-1,L=5,P=-1;function ct(){return E?!0:!(n.unstable_now()-P<L)}function lt(){if(E=!1,J){var B=n.unstable_now();P=B;var I=!0;try{t:{w=!1,D&&(D=!1,O(H),H=-1),_=!0;var ot=S;try{e:{for(q(B),g=r(y);g!==null&&!(g.expirationTime>B&&ct());){var St=g.callback;if(typeof St=="function"){g.callback=null,S=g.priorityLevel;var W=St(g.expirationTime<=B);if(B=n.unstable_now(),typeof W=="function"){g.callback=W,q(B),I=!0;break e}g===r(y)&&o(y),q(B)}else o(y);g=r(y)}if(g!==null)I=!0;else{var A=r(m);A!==null&&Tt(Z,A.startTime-B),I=!1}}break t}finally{g=null,S=ot,_=!1}I=void 0}}finally{I?rt():J=!1}}}var rt;if(typeof Q=="function")rt=function(){Q(lt)};else if(typeof MessageChannel<"u"){var Bt=new MessageChannel,vt=Bt.port2;Bt.port1.onmessage=lt,rt=function(){vt.postMessage(null)}}else rt=function(){M(lt,0)};function Tt(B,I){H=M(function(){B(n.unstable_now())},I)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(B){B.callback=null},n.unstable_forceFrameRate=function(B){0>B||125<B?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):L=0<B?Math.floor(1e3/B):5},n.unstable_getCurrentPriorityLevel=function(){return S},n.unstable_next=function(B){switch(S){case 1:case 2:case 3:var I=3;break;default:I=S}var ot=S;S=I;try{return B()}finally{S=ot}},n.unstable_requestPaint=function(){E=!0},n.unstable_runWithPriority=function(B,I){switch(B){case 1:case 2:case 3:case 4:case 5:break;default:B=3}var ot=S;S=B;try{return I()}finally{S=ot}},n.unstable_scheduleCallback=function(B,I,ot){var St=n.unstable_now();switch(typeof ot=="object"&&ot!==null?(ot=ot.delay,ot=typeof ot=="number"&&0<ot?St+ot:St):ot=St,B){case 1:var W=-1;break;case 2:W=250;break;case 5:W=1073741823;break;case 4:W=1e4;break;default:W=5e3}return W=ot+W,B={id:v++,callback:I,priorityLevel:B,startTime:ot,expirationTime:W,sortIndex:-1},ot>St?(B.sortIndex=ot,i(m,B),r(y)===null&&B===r(m)&&(D?(O(H),H=-1):D=!0,Tt(Z,ot-St))):(B.sortIndex=W,i(y,B),w||_||(w=!0,J||(J=!0,rt()))),B},n.unstable_shouldYield=ct,n.unstable_wrapCallback=function(B){var I=S;return function(){var ot=S;S=I;try{return B.apply(this,arguments)}finally{S=ot}}}})(zc)),zc}var Vp;function TS(){return Vp||(Vp=1,Oc.exports=wS()),Oc.exports}var Dc={exports:{}},we={};var Yp;function AS(){if(Yp)return we;Yp=1;var n=ur();function i(y){var m="https://react.dev/errors/"+y;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)m+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+y+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var o={d:{f:r,r:function(){throw Error(i(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},c=Symbol.for("react.portal");function f(y,m,v){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:c,key:g==null?null:""+g,children:y,containerInfo:m,implementation:v}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function p(y,m){if(y==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return we.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,we.createPortal=function(y,m){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(i(299));return f(y,m,null,v)},we.flushSync=function(y){var m=d.T,v=o.p;try{if(d.T=null,o.p=2,y)return y()}finally{d.T=m,o.p=v,o.d.f()}},we.preconnect=function(y,m){typeof y=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,o.d.C(y,m))},we.prefetchDNS=function(y){typeof y=="string"&&o.d.D(y)},we.preinit=function(y,m){if(typeof y=="string"&&m&&typeof m.as=="string"){var v=m.as,g=p(v,m.crossOrigin),S=typeof m.integrity=="string"?m.integrity:void 0,_=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;v==="style"?o.d.S(y,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:g,integrity:S,fetchPriority:_}):v==="script"&&o.d.X(y,{crossOrigin:g,integrity:S,fetchPriority:_,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},we.preinitModule=function(y,m){if(typeof y=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var v=p(m.as,m.crossOrigin);o.d.M(y,{crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&o.d.M(y)},we.preload=function(y,m){if(typeof y=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var v=m.as,g=p(v,m.crossOrigin);o.d.L(y,v,{crossOrigin:g,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},we.preloadModule=function(y,m){if(typeof y=="string")if(m){var v=p(m.as,m.crossOrigin);o.d.m(y,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:v,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else o.d.m(y)},we.requestFormReset=function(y){o.d.r(y)},we.unstable_batchedUpdates=function(y,m){return y(m)},we.useFormState=function(y,m,v){return d.H.useFormState(y,m,v)},we.useFormStatus=function(){return d.H.useHostTransitionStatus()},we.version="19.2.7",we}var Xp;function ty(){if(Xp)return Dc.exports;Xp=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Dc.exports=AS(),Dc.exports}var Qp;function CS(){if(Qp)return Ii;Qp=1;var n=TS(),i=ur(),r=ty();function o(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)e+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function f(t){var e=t,a=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(a=e.return),t=e.return;while(t)}return e.tag===3?a:null}function d(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function p(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function y(t){if(f(t)!==t)throw Error(o(188))}function m(t){var e=t.alternate;if(!e){if(e=f(t),e===null)throw Error(o(188));return e!==t?null:t}for(var a=t,l=e;;){var s=a.return;if(s===null)break;var u=s.alternate;if(u===null){if(l=s.return,l!==null){a=l;continue}break}if(s.child===u.child){for(u=s.child;u;){if(u===a)return y(s),t;if(u===l)return y(s),e;u=u.sibling}throw Error(o(188))}if(a.return!==l.return)a=s,l=u;else{for(var h=!1,b=s.child;b;){if(b===a){h=!0,a=s,l=u;break}if(b===l){h=!0,l=s,a=u;break}b=b.sibling}if(!h){for(b=u.child;b;){if(b===a){h=!0,a=u,l=s;break}if(b===l){h=!0,l=u,a=s;break}b=b.sibling}if(!h)throw Error(o(189))}}if(a.alternate!==l)throw Error(o(190))}if(a.tag!==3)throw Error(o(188));return a.stateNode.current===a?t:e}function v(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=v(t),e!==null)return e;t=t.sibling}return null}var g=Object.assign,S=Symbol.for("react.element"),_=Symbol.for("react.transitional.element"),w=Symbol.for("react.portal"),D=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),O=Symbol.for("react.consumer"),Q=Symbol.for("react.context"),q=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),J=Symbol.for("react.suspense_list"),H=Symbol.for("react.memo"),L=Symbol.for("react.lazy"),P=Symbol.for("react.activity"),ct=Symbol.for("react.memo_cache_sentinel"),lt=Symbol.iterator;function rt(t){return t===null||typeof t!="object"?null:(t=lt&&t[lt]||t["@@iterator"],typeof t=="function"?t:null)}var Bt=Symbol.for("react.client.reference");function vt(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===Bt?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case D:return"Fragment";case M:return"Profiler";case E:return"StrictMode";case Z:return"Suspense";case J:return"SuspenseList";case P:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case w:return"Portal";case Q:return t.displayName||"Context";case O:return(t._context.displayName||"Context")+".Consumer";case q:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case H:return e=t.displayName||null,e!==null?e:vt(t.type)||"Memo";case L:e=t._payload,t=t._init;try{return vt(t(e))}catch{}}return null}var Tt=Array.isArray,B=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ot={pending:!1,data:null,method:null,action:null},St=[],W=-1;function A(t){return{current:t}}function V(t){0>W||(t.current=St[W],St[W]=null,W--)}function F(t,e){W++,St[W]=t.current,t.current=e}var tt=A(null),et=A(null),st=A(null),mt=A(null);function jt(t,e){switch(F(st,e),F(et,t),F(tt,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?rp(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=rp(e),t=op(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}V(tt),F(tt,t)}function ht(){V(tt),V(et),V(st)}function Ae(t){t.memoizedState!==null&&F(mt,t);var e=tt.current,a=op(e,t.type);e!==a&&(F(et,t),F(tt,a))}function ye(t){et.current===t&&(V(tt),V(et)),mt.current===t&&(V(mt),Qi._currentValue=ot)}var Ce,un;function ne(t){if(Ce===void 0)try{throw Error()}catch(a){var e=a.stack.trim().match(/\n( *(at )?)/);Ce=e&&e[1]||"",un=-1<a.stack.indexOf(`
3
3
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
4
4
  `+Ce+t+un}var Wn=!1;function Na(t,e){if(!t||Wn)return"";Wn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(e){var K=function(){throw Error()};if(Object.defineProperty(K.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(K,[])}catch(k){var j=k}Reflect.construct(t,[],K)}else{try{K.call()}catch(k){j=k}t.call(K.prototype)}}else{try{throw Error()}catch(k){j=k}(K=t())&&typeof K.catch=="function"&&K.catch(function(){})}}catch(k){if(k&&j&&typeof k.stack=="string")return[k.stack,j.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var u=l.DetermineComponentFrameRoot(),h=u[0],b=u[1];if(h&&b){var R=h.split(`
@@ -73,4 +73,4 @@ Error generating stack: `+l.message+`
73
73
  document.documentElement.dataset.uiScaleResolved = "100";
74
74
  }
75
75
  })();
76
- `,kf=TE({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{name:xv,content:zf()},{title:"Agent Inspector"}],links:[{rel:"stylesheet",href:ns(Nw)},{rel:"icon",type:"image/svg+xml",href:ns(OR)}]}),component:Qw,errorComponent:Zw,notFoundComponent:Kw});function Qw(){return $.useEffect(()=>Hw(),[]),Y.jsx(qf,{children:Y.jsx($v,{scope:"root-render",title:"Agent Inspector could not continue",description:"The application stopped this render safely. Retry or reload Inspector.",variant:"page",children:Y.jsx(bv,{})})})}function Zw({error:n,reset:i}){return Y.jsx(qf,{children:Y.jsx(Lw,{error:n,reset:i,scope:"root-route"})})}function Kw(){return Y.jsx(qf,{children:Y.jsx("main",{className:"min-h-screen bg-background text-foreground",children:Y.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-3xl flex-col justify-center px-6 py-16",children:Y.jsxs("div",{className:"border-border/70 bg-card/60 rounded-lg border p-8 shadow-sm",children:[Y.jsx("div",{className:"text-muted-foreground font-mono text-xs uppercase tracking-wider",children:"404"}),Y.jsx("h1",{className:"mt-3 text-2xl font-semibold",children:"Page not found"}),Y.jsx("p",{className:"text-muted-foreground mt-3 max-w-xl text-sm leading-6",children:"This route is not part of the Agent Inspector UI or API surface."}),Y.jsx("a",{href:ns("/"),className:"bg-primary text-primary-foreground hover:bg-primary/90 mt-6 inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors",children:"Open Agent Inspector"})]})})})})}function qf({children:n}){return Y.jsxs("html",{lang:"en",className:"dark","data-theme":"dark",suppressHydrationWarning:!0,children:[Y.jsxs("head",{children:[Y.jsx("script",{dangerouslySetInnerHTML:{__html:Yw}}),Y.jsx("script",{dangerouslySetInnerHTML:{__html:Xw}}),Y.jsx(ZE,{})]}),Y.jsxs("body",{suppressHydrationWarning:!0,children:[Y.jsx(MR,{value:{revalidateOnFocus:!1,revalidateIfStale:!1},children:n}),Y.jsx(KE,{})]})]})}const Pw="modulepreload",Jw=function(n){return"/"+n},$g={},hs=function(i,r,o){let c=Promise.resolve();if(r&&r.length>0){let y=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=d?.nonce||d?.getAttribute("nonce");c=y(r.map(m=>{if(m=Jw(m),m in $g)return;$g[m]=!0;const v=m.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const S=document.createElement("link");if(S.rel=v?"stylesheet":Pw,v||(S.as="script"),S.crossOrigin="",S.href=m,p&&S.setAttribute("nonce",p),document.head.appendChild(S),v)return new Promise((_,w)=>{S.addEventListener("load",_),S.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${m}`)))})}))}function f(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return c.then(d=>{for(const p of d||[])p.status==="rejected"&&f(p.reason);return i().catch(f)})},Iw=()=>hs(()=>import("./index-IpdII72q.js"),[]),Fw=()=>hs(()=>import("./index-DswDeL6m.js"),__vite__mapDeps([0,1])),Ww=gv("/")({component:es(Fw,"component"),errorComponent:es(Iw,"errorComponent")}),$w=/^[A-Za-z0-9_-]+$/;function tT(n){let i="";for(const r of n)i+=String.fromCharCode(r);return i}function eT(n){const i=new Uint8Array(n.length);for(let r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}function a0(n){const i=new TextEncoder().encode(n);return btoa(tT(i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function nT(n){if(n.startsWith("%"))return decodeURIComponent(n);if(!$w.test(n))return n;try{const r=n.padEnd(Math.ceil(n.length/4)*4,"=").replace(/-/g,"+").replace(/_/g,"/"),o=atob(r);return new TextDecoder().decode(eT(o))}catch{return n}}function UT(n,i){return ns(`/session/${a0(n)}`,i)}const aT=()=>hs(()=>import("./_sessionId-B5lQVwmL.js"),[]),lT=()=>hs(()=>import("./_sessionId-BOAAnQhC.js"),__vite__mapDeps([2,1])),iT=gv("/session/$sessionId")({component:es(lT,"component"),errorComponent:es(aT,"errorComponent"),parseParams:n=>({sessionId:nT(n.sessionId)}),stringifyParams:n=>({sessionId:a0(n.sessionId)})}),rT=Ww.update({id:"/",path:"/",getParentRoute:()=>kf}),oT=iT.update({id:"/session/$sessionId",path:"/session/$sessionId",getParentRoute:()=>kf}),sT={IndexRoute:rT,SessionSessionIdRoute:oT},uT=kf._addFileChildren(sT);var cT={};function fT(){return eR(typeof process>"u"?void 0:cT)}function dT(n=fT()){const i=qE({routeTree:uT,basepath:n,scrollRestoration:!1});return hT(i),i}function hT(n){Object.getOwnPropertyDescriptor(n,"state")===void 0||Object.getOwnPropertyDescriptor(n,"stores")!==void 0||Object.defineProperty(n,"stores",{configurable:!0,value:{matches:{get:()=>n.state.matches}}})}async function mT(){const n=await dT();let i;return i=[],window.__TSS_START_OPTIONS__={serializationAdapters:i},i.push(X2),n.options.serializationAdapters&&i.push(...n.options.serializationAdapters),n.update({basepath:"",serializationAdapters:i}),n.stores.matchesId.get().length||await Z2(n),n}var pT=mT;async function gT(){const n=await pT();return window.$_TSR?.h(),n}var ef;function yT(){return ef||(ef=gT()),Y.jsx(I2,{promise:ef,children:n=>Y.jsx(YE,{router:n})})}$.startTransition(()=>{OS.hydrateRoot(document,Y.jsx($.StrictMode,{children:Y.jsx(yT,{})}))});export{vT as A,$c as B,Dw as C,_S as D,AT as L,iT as R,Lw as S,Bf as T,Hf as U,hs as _,xR as a,MT as b,CT as c,LT as d,NT as e,DT as f,qw as g,bT as h,hE as i,Y as j,Fv as k,Zn as l,UT as m,kw as n,xT as o,OT as p,HR as q,$ as r,NR as s,TT as t,_T as u,ET as v,ns as w,RT as x,wT as y,zT as z};
76
+ `,kf=TE({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{name:xv,content:zf()},{title:"Agent Inspector"}],links:[{rel:"stylesheet",href:ns(Nw)},{rel:"icon",type:"image/svg+xml",href:ns(OR)}]}),component:Qw,errorComponent:Zw,notFoundComponent:Kw});function Qw(){return $.useEffect(()=>Hw(),[]),Y.jsx(qf,{children:Y.jsx($v,{scope:"root-render",title:"Agent Inspector could not continue",description:"The application stopped this render safely. Retry or reload Inspector.",variant:"page",children:Y.jsx(bv,{})})})}function Zw({error:n,reset:i}){return Y.jsx(qf,{children:Y.jsx(Lw,{error:n,reset:i,scope:"root-route"})})}function Kw(){return Y.jsx(qf,{children:Y.jsx("main",{className:"min-h-screen bg-background text-foreground",children:Y.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-3xl flex-col justify-center px-6 py-16",children:Y.jsxs("div",{className:"border-border/70 bg-card/60 rounded-lg border p-8 shadow-sm",children:[Y.jsx("div",{className:"text-muted-foreground font-mono text-xs uppercase tracking-wider",children:"404"}),Y.jsx("h1",{className:"mt-3 text-2xl font-semibold",children:"Page not found"}),Y.jsx("p",{className:"text-muted-foreground mt-3 max-w-xl text-sm leading-6",children:"This route is not part of the Agent Inspector UI or API surface."}),Y.jsx("a",{href:ns("/"),className:"bg-primary text-primary-foreground hover:bg-primary/90 mt-6 inline-flex h-9 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors",children:"Open Agent Inspector"})]})})})})}function qf({children:n}){return Y.jsxs("html",{lang:"en",className:"dark","data-theme":"dark",suppressHydrationWarning:!0,children:[Y.jsxs("head",{children:[Y.jsx("script",{dangerouslySetInnerHTML:{__html:Yw}}),Y.jsx("script",{dangerouslySetInnerHTML:{__html:Xw}}),Y.jsx(ZE,{})]}),Y.jsxs("body",{suppressHydrationWarning:!0,children:[Y.jsx(MR,{value:{revalidateOnFocus:!1,revalidateIfStale:!1},children:n}),Y.jsx(KE,{})]})]})}const Pw="modulepreload",Jw=function(n){return"/"+n},$g={},hs=function(i,r,o){let c=Promise.resolve();if(r&&r.length>0){let y=function(m){return Promise.all(m.map(v=>Promise.resolve(v).then(g=>({status:"fulfilled",value:g}),g=>({status:"rejected",reason:g}))))};document.getElementsByTagName("link");const d=document.querySelector("meta[property=csp-nonce]"),p=d?.nonce||d?.getAttribute("nonce");c=y(r.map(m=>{if(m=Jw(m),m in $g)return;$g[m]=!0;const v=m.endsWith(".css"),g=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${m}"]${g}`))return;const S=document.createElement("link");if(S.rel=v?"stylesheet":Pw,v||(S.as="script"),S.crossOrigin="",S.href=m,p&&S.setAttribute("nonce",p),document.head.appendChild(S),v)return new Promise((_,w)=>{S.addEventListener("load",_),S.addEventListener("error",()=>w(new Error(`Unable to preload CSS for ${m}`)))})}))}function f(d){const p=new Event("vite:preloadError",{cancelable:!0});if(p.payload=d,window.dispatchEvent(p),!p.defaultPrevented)throw d}return c.then(d=>{for(const p of d||[])p.status==="rejected"&&f(p.reason);return i().catch(f)})},Iw=()=>hs(()=>import("./index-D1Ar_Dtb.js"),[]),Fw=()=>hs(()=>import("./index-DPsfwdop.js"),__vite__mapDeps([0,1])),Ww=gv("/")({component:es(Fw,"component"),errorComponent:es(Iw,"errorComponent")}),$w=/^[A-Za-z0-9_-]+$/;function tT(n){let i="";for(const r of n)i+=String.fromCharCode(r);return i}function eT(n){const i=new Uint8Array(n.length);for(let r=0;r<n.length;r++)i[r]=n.charCodeAt(r);return i}function a0(n){const i=new TextEncoder().encode(n);return btoa(tT(i)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function nT(n){if(n.startsWith("%"))return decodeURIComponent(n);if(!$w.test(n))return n;try{const r=n.padEnd(Math.ceil(n.length/4)*4,"=").replace(/-/g,"+").replace(/_/g,"/"),o=atob(r);return new TextDecoder().decode(eT(o))}catch{return n}}function UT(n,i){return ns(`/session/${a0(n)}`,i)}const aT=()=>hs(()=>import("./_sessionId-BEVn_RD0.js"),[]),lT=()=>hs(()=>import("./_sessionId-BsoVln_N.js"),__vite__mapDeps([2,1])),iT=gv("/session/$sessionId")({component:es(lT,"component"),errorComponent:es(aT,"errorComponent"),parseParams:n=>({sessionId:nT(n.sessionId)}),stringifyParams:n=>({sessionId:a0(n.sessionId)})}),rT=Ww.update({id:"/",path:"/",getParentRoute:()=>kf}),oT=iT.update({id:"/session/$sessionId",path:"/session/$sessionId",getParentRoute:()=>kf}),sT={IndexRoute:rT,SessionSessionIdRoute:oT},uT=kf._addFileChildren(sT);var cT={};function fT(){return eR(typeof process>"u"?void 0:cT)}function dT(n=fT()){const i=qE({routeTree:uT,basepath:n,scrollRestoration:!1});return hT(i),i}function hT(n){Object.getOwnPropertyDescriptor(n,"state")===void 0||Object.getOwnPropertyDescriptor(n,"stores")!==void 0||Object.defineProperty(n,"stores",{configurable:!0,value:{matches:{get:()=>n.state.matches}}})}async function mT(){const n=await dT();let i;return i=[],window.__TSS_START_OPTIONS__={serializationAdapters:i},i.push(X2),n.options.serializationAdapters&&i.push(...n.options.serializationAdapters),n.update({basepath:"",serializationAdapters:i}),n.stores.matchesId.get().length||await Z2(n),n}var pT=mT;async function gT(){const n=await pT();return window.$_TSR?.h(),n}var ef;function yT(){return ef||(ef=gT()),Y.jsx(I2,{promise:ef,children:n=>Y.jsx(YE,{router:n})})}$.startTransition(()=>{OS.hydrateRoot(document,Y.jsx($.StrictMode,{children:Y.jsx(yT,{})}))});export{vT as A,$c as B,Dw as C,_S as D,AT as L,iT as R,Lw as S,Bf as T,Hf as U,hs as _,xR as a,MT as b,CT as c,LT as d,NT as e,DT as f,qw as g,bT as h,hE as i,Y as j,Fv as k,Zn as l,UT as m,kw as n,xT as o,OT as p,HR as q,$ as r,NR as s,TT as t,_T as u,ET as v,ns as w,RT as x,wT as y,zT as z};
@@ -1 +1 @@
1
- import{j as e,S as t}from"./index-BlSm4bqn.js";function m({error:o,reset:r}){return e.jsx(t,{error:o,reset:r,scope:"home-route"})}export{m as errorComponent};
1
+ import{j as e,S as t}from"./index-BmKouSES.js";function m({error:o,reset:r}){return e.jsx(t,{error:o,reset:r,scope:"home-route"})}export{m as errorComponent};
@@ -1 +1 @@
1
- import{r,j as e}from"./index-BlSm4bqn.js";import{P as o}from"./ProxyViewerContainer-DoCpLJM1.js";function x(){const[t,n]=r.useState(!1);return r.useEffect(()=>{n(!0)},[]),t?e.jsx(o,{}):e.jsx("main",{className:"min-h-screen bg-background text-foreground",children:e.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center",children:e.jsx("div",{className:"rounded-[8px] border border-border bg-card px-4 py-8 shadow-sm",children:e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Loading Inspector..."})})})})}export{x as component};
1
+ import{r,j as e}from"./index-BmKouSES.js";import{P as o}from"./ProxyViewerContainer-CCtygisW.js";function x(){const[t,n]=r.useState(!1);return r.useEffect(()=>{n(!0)},[]),t?e.jsx(o,{}):e.jsx("main",{className:"min-h-screen bg-background text-foreground",children:e.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-2xl flex-col justify-center px-6 py-16 text-center",children:e.jsx("div",{className:"rounded-[8px] border border-border bg-card px-4 py-8 shadow-sm",children:e.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Loading Inspector..."})})})})}export{x as component};