@tonyclaw/agent-inspector 2.1.4 → 2.1.5
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.
- package/.output/nitro.json +1 -1
- package/.output/public/assets/{CompareDrawer-BihEPd3v.js → CompareDrawer-SAn2KFl2.js} +1 -1
- package/.output/public/assets/{ProxyViewerContainer-DYqXb6WW.js → ProxyViewerContainer-DaiTFf7n.js} +24 -24
- package/.output/public/assets/{ReplayDialog-DnX-6kY8.js → ReplayDialog-CCwz0YUV.js} +1 -1
- package/.output/public/assets/{RequestAnatomy-CIkHAxZO.js → RequestAnatomy-DXcC4ydl.js} +1 -1
- package/.output/public/assets/{ResponseView-BFc8jjZM.js → ResponseView-Bh9t9aZF.js} +1 -1
- package/.output/public/assets/{StreamingChunkSequence-p8qkpF6K.js → StreamingChunkSequence-B69M2rr-.js} +1 -1
- package/.output/public/assets/_sessionId-6fF5JpyQ.js +1 -0
- package/.output/public/assets/index-DBSbw8Gd.js +1 -0
- package/.output/public/assets/{main-xlSdu7_I.js → main-DZVKUeg6.js} +2 -2
- package/.output/server/{_sessionId-CwVQgxoK.mjs → _sessionId-COVUf_EG.mjs} +2 -2
- package/.output/server/_ssr/{CompareDrawer-Br9Ec0ah.mjs → CompareDrawer-DqQHO4tk.mjs} +2 -2
- package/.output/server/_ssr/{ProxyViewerContainer-Oe5Tr3C2.mjs → ProxyViewerContainer-BEeF4V-C.mjs} +30 -11
- package/.output/server/_ssr/{ReplayDialog-C1_QsoA-.mjs → ReplayDialog-DUZbsd5x.mjs} +3 -3
- package/.output/server/_ssr/{RequestAnatomy-cn08QSoz.mjs → RequestAnatomy-DKuIxoBj.mjs} +2 -2
- package/.output/server/_ssr/{ResponseView-CIqUCCTG.mjs → ResponseView-BB9CYmTJ.mjs} +2 -2
- package/.output/server/_ssr/{StreamingChunkSequence-0MhVWD2F.mjs → StreamingChunkSequence-CkY3uTjF.mjs} +2 -2
- package/.output/server/_ssr/{index-jpnI5ghp.mjs → index-CHTchkrO.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{router-SSOn7c09.mjs → router-C8DJ5pQZ.mjs} +5 -3
- package/.output/server/{_tanstack-start-manifest_v-BCgy_9er.mjs → _tanstack-start-manifest_v-Z1ffcxDr.mjs} +1 -1
- package/.output/server/index.mjs +61 -61
- package/package.json +1 -1
- package/src/components/groups/GroupsDialog.tsx +41 -13
- package/src/lib/groupContract.ts +1 -0
- package/src/services/groups.ts +1 -0
- package/.output/public/assets/_sessionId-Csx4T_y6.js +0 -1
- package/.output/public/assets/index-KMuh-31x.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as u,j as s}from"./main-xlSdu7_I.js";import{c as L,u as te,D as ne,l as re,m as ae,n as le,o as z,T as v,p as T,q as o,s as i,t as h,v as oe,w as ie,x as de,y as ue,z as P,A as f,E as ce,F as pe,G as _,H as I,I as me}from"./ProxyViewerContainer-DYqXb6WW.js";import{ResponseView as M}from"./ResponseView-BFc8jjZM.js";const xe=[["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"}]],he=L("braces",xe);const fe=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],ye=L("minimize-2",fe);function A(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function je(e){return e==null?null:new TextEncoder().encode(e).length}function ge(e){try{const t=JSON.parse(e);if(!A(t))return null;const a=t.model;return typeof a=="string"&&a.length>0?a:null}catch{return null}}function be(e,t){try{const a=JSON.parse(e);return A(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 D(e){return{status:e.status??null,elapsedMs:e.elapsedMs??null,inputTokens:e.inputTokens??null,outputTokens:e.outputTokens??null,responseBytes:je(e.responseText),streaming:e.streaming===!0}}function j(e,t){return e===null||t===null?null:t-e}function ve(e,t){return[{id:"status",label:"Status",original:e.status,replay:t.status,delta:j(e.status,t.status)},{id:"elapsed",label:"Elapsed",original:e.elapsedMs,replay:t.elapsedMs,delta:j(e.elapsedMs,t.elapsedMs)},{id:"input",label:"Input",original:e.inputTokens,replay:t.inputTokens,delta:j(e.inputTokens,t.inputTokens)},{id:"output",label:"Output",original:e.outputTokens,replay:t.outputTokens,delta:j(e.outputTokens,t.outputTokens)},{id:"bytes",label:"Bytes",original:e.responseBytes,replay:t.responseBytes,delta:j(e.responseBytes,t.responseBytes)},{id:"streaming",label:"Stream",original:e.streaming,replay:t.streaming,delta:null}]}const Te=P({success:_(),error:I().optional(),responseStatus:f().nullable().optional(),responseText:I().nullable().optional(),inputTokens:f().nullable().optional(),outputTokens:f().nullable().optional(),elapsedMs:f().nullable().optional(),streaming:_().optional(),replayLogId:f().optional()}),Ne=P({logs:ce(me),total:f()});function N(e){try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}function ke(e){try{const t=JSON.parse(e);return JSON.stringify(t)}catch{return e}}function Re(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 C(e){return e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function V(e,t){if(e===null)return"-";if(typeof e=="boolean")return e?"stream":"non-stream";switch(t){case"elapsed":return C(e);case"input":case"output":case"bytes":return e.toLocaleString();case"status":return String(e);case"streaming":return e?"stream":"non-stream"}}function Se(e,t){if(e===null)return"-";const a=e>0?"+":"";switch(t){case"elapsed":return`${a}${C(e)}`;case"input":case"output":case"bytes":case"status":return`${a}${e.toLocaleString()}`;case"streaming":return"-"}}function we(e){return e===null||e===0?"text-muted-foreground":e>0?"text-amber-400":"text-emerald-400"}function H({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:V(t.original,t.id)}),s.jsx("span",{className:"font-mono",children:V(t.replay,t.id)}),s.jsx("span",{className:`font-mono ${we(t.delta)}`,children:Se(t.delta,t.id)})]},t.id))]})}function Je({log:e,open:t,onOpenChange:a}){const{providers:O}=te(),J=e.rawRequestBody??"{}",[c,G]=u.useState(()=>N(J)),[r,g]=u.useState(null),[K,Q]=u.useState([]),[B,k]=u.useState(!1),[R,p]=u.useState(null),m=u.useMemo(()=>Re(c),[c]),b=u.useCallback(async()=>{if(t)try{const n=await fetch(`/api/logs?replayOf=${String(e.id)}`);if(!n.ok)return;const l=await n.json(),d=Ne.safeParse(l);if(!d.success)return;Q(d.data.logs)}catch{}},[e.id,t]);u.useEffect(()=>{b()},[b]);async function U(){if(!m.valid){p("Request body must be valid JSON before replay.");return}k(!0),p(null),g(null);try{const l=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:c})})).json(),d=Te.safeParse(l);if(!d.success){p("Invalid response from server"),k(!1);return}const w=d.data;g(w),await b(),w.success||p(w.error??"Replay failed")}catch(n){p(n instanceof Error?n.message:"Network error")}finally{k(!1)}}function W(){g(null),p(null),a(!1)}function y(n){G(n),g(null),p(null)}function X(){y(N(c))}function Y(){y(ke(c))}function Z(){y(N(J))}function $(n){window.location.hash=`log-${String(n)}`,pe({logId:n,tab:"request"}),a(!1)}const S=u.useMemo(()=>{const n=[];for(const l of O)for(const d of l.models)d.trim().length!==0&&n.push({key:`${l.id}:${d}`,providerName:l.name,model:d});return n},[O]),x=ge(c)??e.model??"";function ee(n){const l=be(c,n);if(l.error!==null){p(l.error);return}y(N(l.body))}const se=D({status:e.responseStatus,elapsedMs:e.elapsedMs,inputTokens:e.inputTokens,outputTokens:e.outputTokens,responseText:e.responseText,streaming:e.streaming}),F=r===null?null:D({status:r.responseStatus,elapsedMs:r.elapsedMs,inputTokens:r.inputTokens,outputTokens:r.outputTokens,responseText:r.responseText,streaming:r.streaming}),E=F===null?[]:ve(se,F),q=K.slice(-5).reverse();return s.jsx(ne,{open:t,onOpenChange:W,children:s.jsxs(re,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[s.jsx(ae,{children:s.jsxs(le,{className:"flex items-center gap-2",children:[s.jsx(z,{className:"size-4"}),"Replay Request #",e.id]})}),s.jsxs(v,{defaultValue:"modified",children:[s.jsxs(T,{children:[s.jsx(o,{value:"modified",children:"Modified Request"}),s.jsx(o,{value:"original",children:"Original Response"}),r&&s.jsx(o,{value:"replay",children:"Replay Response"}),r&&s.jsx(o,{value:"compare",children:"Compare"})]}),s.jsxs(i,{value:"modified",className:"space-y-4",children:[S.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:x,onChange:n=>ee(n.currentTarget.value),className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[x===""&&s.jsx("option",{value:"",children:"Select model"}),x!==""&&!S.some(n=>n.model===x)&&s.jsx("option",{value:x,children:x}),S.map(n=>s.jsxs("option",{value:n.model,children:[n.providerName," / ",n.model]},n.key))]})]}),q.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(h,{type:"button",variant:"ghost",size:"sm",onClick:()=>{b()},children:"Refresh"})]}),s.jsx("div",{className:"grid gap-1",children:q.map(n=>s.jsxs("button",{type:"button",onClick:()=>$(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?"-":C(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:m.valid?"text-xs text-emerald-500":"text-xs text-destructive",children:m.message}),s.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:X,disabled:!m.valid,title:"Format JSON",children:[s.jsx(he,{className:"size-3.5"}),"Format"]}),s.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:Y,disabled:!m.valid,title:"Compact JSON",children:[s.jsx(ye,{className:"size-3.5"}),"Compact"]}),s.jsxs(h,{type:"button",variant:"ghost",size:"sm",onClick:Z,title:"Reset to original request",children:[s.jsx(z,{className:"size-3.5"}),"Reset"]})]})]}),s.jsx(oe,{children:s.jsxs(ie,{children:[s.jsx(de,{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=>y(n.target.value),spellCheck:!1})}),s.jsx(ue,{children:"Edit formatted JSON before re-sending to the provider"})]})})]}),R!==null&&R!==""&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:R}),s.jsx("div",{className:"flex justify-end",children:s.jsx(h,{onClick:()=>{U()},disabled:B||!m.valid,children:B?"Replaying...":"Replay"})}),r!==null&&s.jsx(H,{comparisons:E.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(h,{type:"button",variant:"outline",size:"sm",onClick:()=>$(r.replayLogId??e.id),children:"Open saved log"})]}),r&&r.success&&s.jsxs(v,{defaultValue:"parsed",children:[s.jsxs(T,{children:[s.jsx(o,{value:"parsed",children:"Response"}),s.jsx(o,{value:"raw",children:"Raw Response"})]}),s.jsx(i,{value:"parsed",children:s.jsx(M,{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(i,{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(i,{value:"original",children:e.responseText!==null?s.jsxs(v,{defaultValue:"parsed",children:[s.jsxs(T,{children:[s.jsx(o,{value:"parsed",children:"Response"}),s.jsx(o,{value:"raw",children:"Raw Response"})]}),s.jsx(i,{value:"parsed",children:s.jsx(M,{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(i,{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(i,{value:"replay",children:(r.responseText??null)!==null?s.jsxs(v,{defaultValue:"parsed",children:[s.jsxs(T,{children:[s.jsx(o,{value:"parsed",children:"Response"}),s.jsx(o,{value:"raw",children:"Raw Response"})]}),s.jsx(i,{value:"parsed",children:s.jsx(M,{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(i,{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(i,{value:"compare",className:"space-y-3",children:[s.jsx(H,{comparisons:E}),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{Je as ReplayDialog};
|
|
1
|
+
import{r as u,j as s}from"./main-DZVKUeg6.js";import{c as L,u as te,D as ne,l as re,m as ae,n as le,o as z,T as v,p as T,q as o,s as i,t as h,v as oe,w as ie,x as de,y as ue,z as P,A as f,E as ce,F as pe,G as _,H as I,I as me}from"./ProxyViewerContainer-DaiTFf7n.js";import{ResponseView as M}from"./ResponseView-Bh9t9aZF.js";const xe=[["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"}]],he=L("braces",xe);const fe=[["path",{d:"m14 10 7-7",key:"oa77jy"}],["path",{d:"M20 10h-6V4",key:"mjg0md"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M4 14h6v6",key:"rmj7iw"}]],ye=L("minimize-2",fe);function A(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function je(e){return e==null?null:new TextEncoder().encode(e).length}function ge(e){try{const t=JSON.parse(e);if(!A(t))return null;const a=t.model;return typeof a=="string"&&a.length>0?a:null}catch{return null}}function be(e,t){try{const a=JSON.parse(e);return A(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 D(e){return{status:e.status??null,elapsedMs:e.elapsedMs??null,inputTokens:e.inputTokens??null,outputTokens:e.outputTokens??null,responseBytes:je(e.responseText),streaming:e.streaming===!0}}function j(e,t){return e===null||t===null?null:t-e}function ve(e,t){return[{id:"status",label:"Status",original:e.status,replay:t.status,delta:j(e.status,t.status)},{id:"elapsed",label:"Elapsed",original:e.elapsedMs,replay:t.elapsedMs,delta:j(e.elapsedMs,t.elapsedMs)},{id:"input",label:"Input",original:e.inputTokens,replay:t.inputTokens,delta:j(e.inputTokens,t.inputTokens)},{id:"output",label:"Output",original:e.outputTokens,replay:t.outputTokens,delta:j(e.outputTokens,t.outputTokens)},{id:"bytes",label:"Bytes",original:e.responseBytes,replay:t.responseBytes,delta:j(e.responseBytes,t.responseBytes)},{id:"streaming",label:"Stream",original:e.streaming,replay:t.streaming,delta:null}]}const Te=P({success:_(),error:I().optional(),responseStatus:f().nullable().optional(),responseText:I().nullable().optional(),inputTokens:f().nullable().optional(),outputTokens:f().nullable().optional(),elapsedMs:f().nullable().optional(),streaming:_().optional(),replayLogId:f().optional()}),Ne=P({logs:ce(me),total:f()});function N(e){try{const t=JSON.parse(e);return JSON.stringify(t,null,2)}catch{return e}}function ke(e){try{const t=JSON.parse(e);return JSON.stringify(t)}catch{return e}}function Re(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 C(e){return e<1e3?`${String(e)}ms`:`${(e/1e3).toFixed(1)}s`}function V(e,t){if(e===null)return"-";if(typeof e=="boolean")return e?"stream":"non-stream";switch(t){case"elapsed":return C(e);case"input":case"output":case"bytes":return e.toLocaleString();case"status":return String(e);case"streaming":return e?"stream":"non-stream"}}function Se(e,t){if(e===null)return"-";const a=e>0?"+":"";switch(t){case"elapsed":return`${a}${C(e)}`;case"input":case"output":case"bytes":case"status":return`${a}${e.toLocaleString()}`;case"streaming":return"-"}}function we(e){return e===null||e===0?"text-muted-foreground":e>0?"text-amber-400":"text-emerald-400"}function H({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:V(t.original,t.id)}),s.jsx("span",{className:"font-mono",children:V(t.replay,t.id)}),s.jsx("span",{className:`font-mono ${we(t.delta)}`,children:Se(t.delta,t.id)})]},t.id))]})}function Je({log:e,open:t,onOpenChange:a}){const{providers:O}=te(),J=e.rawRequestBody??"{}",[c,G]=u.useState(()=>N(J)),[r,g]=u.useState(null),[K,Q]=u.useState([]),[B,k]=u.useState(!1),[R,p]=u.useState(null),m=u.useMemo(()=>Re(c),[c]),b=u.useCallback(async()=>{if(t)try{const n=await fetch(`/api/logs?replayOf=${String(e.id)}`);if(!n.ok)return;const l=await n.json(),d=Ne.safeParse(l);if(!d.success)return;Q(d.data.logs)}catch{}},[e.id,t]);u.useEffect(()=>{b()},[b]);async function U(){if(!m.valid){p("Request body must be valid JSON before replay.");return}k(!0),p(null),g(null);try{const l=await(await fetch(`/api/logs/${e.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:c})})).json(),d=Te.safeParse(l);if(!d.success){p("Invalid response from server"),k(!1);return}const w=d.data;g(w),await b(),w.success||p(w.error??"Replay failed")}catch(n){p(n instanceof Error?n.message:"Network error")}finally{k(!1)}}function W(){g(null),p(null),a(!1)}function y(n){G(n),g(null),p(null)}function X(){y(N(c))}function Y(){y(ke(c))}function Z(){y(N(J))}function $(n){window.location.hash=`log-${String(n)}`,pe({logId:n,tab:"request"}),a(!1)}const S=u.useMemo(()=>{const n=[];for(const l of O)for(const d of l.models)d.trim().length!==0&&n.push({key:`${l.id}:${d}`,providerName:l.name,model:d});return n},[O]),x=ge(c)??e.model??"";function ee(n){const l=be(c,n);if(l.error!==null){p(l.error);return}y(N(l.body))}const se=D({status:e.responseStatus,elapsedMs:e.elapsedMs,inputTokens:e.inputTokens,outputTokens:e.outputTokens,responseText:e.responseText,streaming:e.streaming}),F=r===null?null:D({status:r.responseStatus,elapsedMs:r.elapsedMs,inputTokens:r.inputTokens,outputTokens:r.outputTokens,responseText:r.responseText,streaming:r.streaming}),E=F===null?[]:ve(se,F),q=K.slice(-5).reverse();return s.jsx(ne,{open:t,onOpenChange:W,children:s.jsxs(re,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[s.jsx(ae,{children:s.jsxs(le,{className:"flex items-center gap-2",children:[s.jsx(z,{className:"size-4"}),"Replay Request #",e.id]})}),s.jsxs(v,{defaultValue:"modified",children:[s.jsxs(T,{children:[s.jsx(o,{value:"modified",children:"Modified Request"}),s.jsx(o,{value:"original",children:"Original Response"}),r&&s.jsx(o,{value:"replay",children:"Replay Response"}),r&&s.jsx(o,{value:"compare",children:"Compare"})]}),s.jsxs(i,{value:"modified",className:"space-y-4",children:[S.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:x,onChange:n=>ee(n.currentTarget.value),className:"h-8 rounded-md border border-input bg-background px-2 text-sm",children:[x===""&&s.jsx("option",{value:"",children:"Select model"}),x!==""&&!S.some(n=>n.model===x)&&s.jsx("option",{value:x,children:x}),S.map(n=>s.jsxs("option",{value:n.model,children:[n.providerName," / ",n.model]},n.key))]})]}),q.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(h,{type:"button",variant:"ghost",size:"sm",onClick:()=>{b()},children:"Refresh"})]}),s.jsx("div",{className:"grid gap-1",children:q.map(n=>s.jsxs("button",{type:"button",onClick:()=>$(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?"-":C(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:m.valid?"text-xs text-emerald-500":"text-xs text-destructive",children:m.message}),s.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:X,disabled:!m.valid,title:"Format JSON",children:[s.jsx(he,{className:"size-3.5"}),"Format"]}),s.jsxs(h,{type:"button",variant:"outline",size:"sm",onClick:Y,disabled:!m.valid,title:"Compact JSON",children:[s.jsx(ye,{className:"size-3.5"}),"Compact"]}),s.jsxs(h,{type:"button",variant:"ghost",size:"sm",onClick:Z,title:"Reset to original request",children:[s.jsx(z,{className:"size-3.5"}),"Reset"]})]})]}),s.jsx(oe,{children:s.jsxs(ie,{children:[s.jsx(de,{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=>y(n.target.value),spellCheck:!1})}),s.jsx(ue,{children:"Edit formatted JSON before re-sending to the provider"})]})})]}),R!==null&&R!==""&&s.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:R}),s.jsx("div",{className:"flex justify-end",children:s.jsx(h,{onClick:()=>{U()},disabled:B||!m.valid,children:B?"Replaying...":"Replay"})}),r!==null&&s.jsx(H,{comparisons:E.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(h,{type:"button",variant:"outline",size:"sm",onClick:()=>$(r.replayLogId??e.id),children:"Open saved log"})]}),r&&r.success&&s.jsxs(v,{defaultValue:"parsed",children:[s.jsxs(T,{children:[s.jsx(o,{value:"parsed",children:"Response"}),s.jsx(o,{value:"raw",children:"Raw Response"})]}),s.jsx(i,{value:"parsed",children:s.jsx(M,{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(i,{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(i,{value:"original",children:e.responseText!==null?s.jsxs(v,{defaultValue:"parsed",children:[s.jsxs(T,{children:[s.jsx(o,{value:"parsed",children:"Response"}),s.jsx(o,{value:"raw",children:"Raw Response"})]}),s.jsx(i,{value:"parsed",children:s.jsx(M,{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(i,{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(i,{value:"replay",children:(r.responseText??null)!==null?s.jsxs(v,{defaultValue:"parsed",children:[s.jsxs(T,{children:[s.jsx(o,{value:"parsed",children:"Response"}),s.jsx(o,{value:"raw",children:"Raw Response"})]}),s.jsx(i,{value:"parsed",children:s.jsx(M,{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(i,{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(i,{value:"compare",className:"space-y-3",children:[s.jsx(H,{comparisons:E}),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{Je as ReplayDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as f,j as t}from"./main-xlSdu7_I.js";import{u as B,K as F,f as u,v as V,b as p,w as q,x as J,L as Y,y as K,S as X,N as $,O as Q,Q as Z,U as S,V as ee,h as z}from"./ProxyViewerContainer-DYqXb6WW.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":Z(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=Q[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}=B(),[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:F({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(J,{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(Y,{className:"size-3.5"})})}),t.jsx(K,{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(X,{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,j as t}from"./main-DZVKUeg6.js";import{u as B,K as F,f as u,v as V,b as p,w as q,x as J,L as Y,y as K,S as X,N as $,O as Q,Q as Z,U as S,V as ee,h as z}from"./ProxyViewerContainer-DaiTFf7n.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":Z(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=Q[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}=B(),[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:F({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(J,{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(Y,{className:"size-3.5"})})}),t.jsx(K,{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(X,{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 +1 @@
|
|
|
1
|
-
import{r as o,j as e}from"./main-xlSdu7_I.js";import{c as F,W as G,Y as K,b as E,Z as h,_ as f,$ as L,B as m,V as g,h as j,a0 as N,a1 as y,a2 as R,a3 as z,a4 as S,a5 as k,f as l,g as M,a6 as D,a7 as H}from"./ProxyViewerContainer-DYqXb6WW.js";const P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],O=F("circle-stop",P);var J="Separator",w="horizontal",U=["horizontal","vertical"],C=o.forwardRef((n,t)=>{const{decorative:a,orientation:s=w,...r}=n,i=W(s)?s:w,d=a?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return e.jsx(G.div,{"data-orientation":i,...d,...r,ref:t})});C.displayName=J;function W(n){return U.includes(n)}var $=C;const X="prose prose-sm dark:prose-invert max-w-none text-[13px] leading-[1.65] [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_p]:leading-[1.65] [&_ul]:my-1 [&_ol]:my-1 [&_li]:my-0.5 [&_li]:leading-[1.6]";function v({text:n}){return e.jsx("div",{className:X,children:e.jsx(K,{children:n})})}function V({className:n,orientation:t="horizontal",decorative:a=!0,...s}){return e.jsx($,{"data-slot":"separator",decorative:a,orientation:t,className:E("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),...s})}const Z=/<think>([\s\S]*?)<\/think>/gi,Y=/<think>([\s\S]*?)<\/think>/i;function B(n){const t=Y.exec(n);if(!t||t[1]===void 0)return{thinking:null,remainingText:n};const a=t[1].trim(),s=n.replace(Z,"").trim();return{thinking:a,remainingText:s}}function q(n){return e.jsx(e.Fragment,{})}function Q({text:n}){const[t,a]=o.useState(!1);return e.jsxs(h,{open:t,onOpenChange:a,children:[e.jsxs(f,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{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(N,{children:e.jsx("div",{className:"pl-4 pt-1",children:e.jsx(v,{text:n})})})]})}const ee=o.memo(function({text:t}){if(t.includes("<system-reminder>"))return e.jsx(Q,{text:t});const{thinking:a,remainingText:s}=B(t);return e.jsxs("div",{className:"space-y-2",children:[a!==null&&e.jsx(p,{thinking:a}),s.length>0&&e.jsx(v,{text:s}),a===null&&s.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),p=o.memo(function({thinking:t}){const[a,s]=o.useState(!1);return e.jsx(h,{open:a,onOpenChange:s,children:e.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[e.jsxs(f,{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(L,{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"}),a?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{className:"size-3 text-muted-foreground"})]}),e.jsx(N,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(y,{className:"max-h-[60vh]",children:e.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:t})})})})]})})}),te=o.memo(function({name:t,input:a}){const[s,r]=o.useState(!1);return e.jsx(h,{open:s,onOpenChange:r,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1",children:[e.jsxs(f,{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",children:[e.jsx(R,{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"}),s?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{className:"size-3 text-muted-foreground"})]}),e.jsx(N,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(y,{className:"max-h-[60vh]",children:e.jsx(z,{data:S(a),defaultExpandDepth:0})})})})]})})}),ne=o.memo(function({block:t}){switch(t.type){case"text":return e.jsx(ee,{text:t.text});case"thinking":case"think":return e.jsx(p,{thinking:t.thinking});case"tool_use":return e.jsx(te,{name:t.name,input:t.input});default:return q()}}),se=o.memo(function({response:t}){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(O,{className:"size-2.5"}),t.stop_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(k,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[l(t.usage.input_tokens??0)," in /"," ",l(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 +",l(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 ~",l(t.usage.cache_read_input_tokens)]})]})]}),e.jsx(V,{className:"opacity-50"}),e.jsxs("div",{className:"space-y-2",children:[t.content.map((a,s)=>e.jsx(ne,{block:a},s)),t.content.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function ae(n){if(n===void 0||n==="")return{};try{return JSON.parse(n)}catch{return null}}function re({call:n}){const[t,a]=o.useState(!1),s=n.function.name??"(unnamed tool)",r=ae(n.function.arguments);return e.jsx(h,{open:t,onOpenChange:a,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1",children:[e.jsxs(f,{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",children:[e.jsx(R,{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:s}),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"}),t?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{className:"size-3 text-muted-foreground"})]}),e.jsx(N,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(y,{className:"max-h-[60vh]",children:r===null?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:n.function.arguments}):e.jsx(z,{data:S(r),defaultExpandDepth:0})})})})]})})}const oe=o.memo(function({response:t}){const a=t.choices[0],s=a?.message,r=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}),a?.finish_reason!==null&&a?.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(O,{className:"size-2.5"}),a.finish_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(k,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[l(t.usage.prompt_tokens??0)," in /"," ",l(t.usage.completion_tokens??0)," out"]})]})]}),e.jsx(V,{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(p,{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:c,remainingText:d}=B(s.content);return e.jsxs("div",{className:"space-y-2",children:[c!==null&&!i&&e.jsx(p,{thinking:c}),d.length>0&&e.jsx(v,{text:d})]})})(),r.map((i,c)=>e.jsx(re,{call:i},i.id??`tc-${c}`)),s?.function_call!==null&&s?.function_call!==void 0&&e.jsxs("div",{className:"border border-sky-400/20 rounded-md p-3 bg-muted/20",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:s.function_call.name}),e.jsxs("span",{className:"text-muted-foreground",children:["(",s.function_call.arguments,")"]})]})]}),(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)&&r.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function T(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ie(n){return T(n)&&n.object==="chat.completion"}function ce(n){return T(n)&&n.type==="message"&&Array.isArray(n.content)}function le(n,t){return n==="openai"&&ie(t)?e.jsx(oe,{response:t}):n==="anthropic"&&ce(t)?e.jsx(se,{response:t}):null}function de(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 u({status:n}){const t=H(n),a=de(t);return n===null?e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):e.jsxs("span",{className:E("flex items-center gap-1 text-xs font-mono font-semibold",a),children:[t==="server_error"&&e.jsx(D,{className:"size-3"}),n]})}function A({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 xe({text:n}){return e.jsx(v,{text:n})}const he=o.memo(function({responseText:t,responseStatus:a,streaming:s,inputTokens:r,outputTokens:i,cacheCreationInputTokens:c,cacheReadInputTokens:d,apiFormat:I,error:x}){const _=I??"unknown",b=o.useMemo(()=>M(_).analyzeResponse(t).parsed,[_,t]);return t===null&&x===void 0?e.jsxs("div",{className:"flex items-center gap-2 py-3",children:[e.jsx(u,{status:a}),e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):a!==null&&a>=400?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{status:a}),e.jsx(A,{text:t??""}),x!=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:x})]})]}):x!=null?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{status:a}),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:x})]}),t!==null&&e.jsx("div",{className:"mt-2",children:e.jsx(A,{text:t})})]}):b!==null?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{status:a}),le(_,b)]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{status:a}),s&&(r!==null||i!==null)&&e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(k,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[r!==null?l(r):"—"," in /"," ",i!==null?l(i):"—"," out"]}),c!=null&&c>0&&e.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",l(c)]}),d!=null&&d>0&&e.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",l(d)]})]})]}),e.jsx(xe,{text:t??""})]})});export{he as ResponseView};
|
|
1
|
+
import{r as o,j as e}from"./main-DZVKUeg6.js";import{c as F,W as G,Y as K,b as E,Z as h,_ as f,$ as L,B as m,V as g,h as j,a0 as N,a1 as y,a2 as R,a3 as z,a4 as S,a5 as k,f as l,g as M,a6 as D,a7 as H}from"./ProxyViewerContainer-DaiTFf7n.js";const P=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],O=F("circle-stop",P);var J="Separator",w="horizontal",U=["horizontal","vertical"],C=o.forwardRef((n,t)=>{const{decorative:a,orientation:s=w,...r}=n,i=W(s)?s:w,d=a?{role:"none"}:{"aria-orientation":i==="vertical"?i:void 0,role:"separator"};return e.jsx(G.div,{"data-orientation":i,...d,...r,ref:t})});C.displayName=J;function W(n){return U.includes(n)}var $=C;const X="prose prose-sm dark:prose-invert max-w-none text-[13px] leading-[1.65] [&_pre]:bg-muted [&_pre]:text-foreground [&_code]:text-[0.8em] [&_p]:my-1 [&_p]:leading-[1.65] [&_ul]:my-1 [&_ol]:my-1 [&_li]:my-0.5 [&_li]:leading-[1.6]";function v({text:n}){return e.jsx("div",{className:X,children:e.jsx(K,{children:n})})}function V({className:n,orientation:t="horizontal",decorative:a=!0,...s}){return e.jsx($,{"data-slot":"separator",decorative:a,orientation:t,className:E("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),...s})}const Z=/<think>([\s\S]*?)<\/think>/gi,Y=/<think>([\s\S]*?)<\/think>/i;function B(n){const t=Y.exec(n);if(!t||t[1]===void 0)return{thinking:null,remainingText:n};const a=t[1].trim(),s=n.replace(Z,"").trim();return{thinking:a,remainingText:s}}function q(n){return e.jsx(e.Fragment,{})}function Q({text:n}){const[t,a]=o.useState(!1);return e.jsxs(h,{open:t,onOpenChange:a,children:[e.jsxs(f,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[t?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{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(N,{children:e.jsx("div",{className:"pl-4 pt-1",children:e.jsx(v,{text:n})})})]})}const ee=o.memo(function({text:t}){if(t.includes("<system-reminder>"))return e.jsx(Q,{text:t});const{thinking:a,remainingText:s}=B(t);return e.jsxs("div",{className:"space-y-2",children:[a!==null&&e.jsx(p,{thinking:a}),s.length>0&&e.jsx(v,{text:s}),a===null&&s.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),p=o.memo(function({thinking:t}){const[a,s]=o.useState(!1);return e.jsx(h,{open:a,onOpenChange:s,children:e.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[e.jsxs(f,{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(L,{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"}),a?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{className:"size-3 text-muted-foreground"})]}),e.jsx(N,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(y,{className:"max-h-[60vh]",children:e.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:t})})})})]})})}),te=o.memo(function({name:t,input:a}){const[s,r]=o.useState(!1);return e.jsx(h,{open:s,onOpenChange:r,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1",children:[e.jsxs(f,{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",children:[e.jsx(R,{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"}),s?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{className:"size-3 text-muted-foreground"})]}),e.jsx(N,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(y,{className:"max-h-[60vh]",children:e.jsx(z,{data:S(a),defaultExpandDepth:0})})})})]})})}),ne=o.memo(function({block:t}){switch(t.type){case"text":return e.jsx(ee,{text:t.text});case"thinking":case"think":return e.jsx(p,{thinking:t.thinking});case"tool_use":return e.jsx(te,{name:t.name,input:t.input});default:return q()}}),se=o.memo(function({response:t}){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(O,{className:"size-2.5"}),t.stop_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(k,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[l(t.usage.input_tokens??0)," in /"," ",l(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 +",l(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 ~",l(t.usage.cache_read_input_tokens)]})]})]}),e.jsx(V,{className:"opacity-50"}),e.jsxs("div",{className:"space-y-2",children:[t.content.map((a,s)=>e.jsx(ne,{block:a},s)),t.content.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function ae(n){if(n===void 0||n==="")return{};try{return JSON.parse(n)}catch{return null}}function re({call:n}){const[t,a]=o.useState(!1),s=n.function.name??"(unnamed tool)",r=ae(n.function.arguments);return e.jsx(h,{open:t,onOpenChange:a,children:e.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1",children:[e.jsxs(f,{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",children:[e.jsx(R,{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:s}),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"}),t?e.jsx(g,{className:"size-3 text-muted-foreground"}):e.jsx(j,{className:"size-3 text-muted-foreground"})]}),e.jsx(N,{children:e.jsx("div",{className:"px-3 pb-2",children:e.jsx(y,{className:"max-h-[60vh]",children:r===null?e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:n.function.arguments}):e.jsx(z,{data:S(r),defaultExpandDepth:0})})})})]})})}const oe=o.memo(function({response:t}){const a=t.choices[0],s=a?.message,r=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}),a?.finish_reason!==null&&a?.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(O,{className:"size-2.5"}),a.finish_reason]}),e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(k,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[l(t.usage.prompt_tokens??0)," in /"," ",l(t.usage.completion_tokens??0)," out"]})]})]}),e.jsx(V,{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(p,{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:c,remainingText:d}=B(s.content);return e.jsxs("div",{className:"space-y-2",children:[c!==null&&!i&&e.jsx(p,{thinking:c}),d.length>0&&e.jsx(v,{text:d})]})})(),r.map((i,c)=>e.jsx(re,{call:i},i.id??`tc-${c}`)),s?.function_call!==null&&s?.function_call!==void 0&&e.jsxs("div",{className:"border border-sky-400/20 rounded-md p-3 bg-muted/20",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:s.function_call.name}),e.jsxs("span",{className:"text-muted-foreground",children:["(",s.function_call.arguments,")"]})]})]}),(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)&&r.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function T(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function ie(n){return T(n)&&n.object==="chat.completion"}function ce(n){return T(n)&&n.type==="message"&&Array.isArray(n.content)}function le(n,t){return n==="openai"&&ie(t)?e.jsx(oe,{response:t}):n==="anthropic"&&ce(t)?e.jsx(se,{response:t}):null}function de(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 u({status:n}){const t=H(n),a=de(t);return n===null?e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):e.jsxs("span",{className:E("flex items-center gap-1 text-xs font-mono font-semibold",a),children:[t==="server_error"&&e.jsx(D,{className:"size-3"}),n]})}function A({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 xe({text:n}){return e.jsx(v,{text:n})}const he=o.memo(function({responseText:t,responseStatus:a,streaming:s,inputTokens:r,outputTokens:i,cacheCreationInputTokens:c,cacheReadInputTokens:d,apiFormat:I,error:x}){const _=I??"unknown",b=o.useMemo(()=>M(_).analyzeResponse(t).parsed,[_,t]);return t===null&&x===void 0?e.jsxs("div",{className:"flex items-center gap-2 py-3",children:[e.jsx(u,{status:a}),e.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):a!==null&&a>=400?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{status:a}),e.jsx(A,{text:t??""}),x!=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:x})]})]}):x!=null?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{status:a}),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:x})]}),t!==null&&e.jsx("div",{className:"mt-2",children:e.jsx(A,{text:t})})]}):b!==null?e.jsxs("div",{className:"space-y-2",children:[e.jsx(u,{status:a}),le(_,b)]}):e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(u,{status:a}),s&&(r!==null||i!==null)&&e.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[e.jsx(k,{className:"size-3"}),e.jsxs("span",{className:"font-mono tabular-nums",children:[r!==null?l(r):"—"," in /"," ",i!==null?l(i):"—"," out"]}),c!=null&&c>0&&e.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["KV Cache +",l(c)]}),d!=null&&d>0&&e.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["KV Cache ~",l(d)]})]})]}),e.jsx(xe,{text:t??""})]})});export{he as ResponseView};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,j as e}from"./main-
|
|
1
|
+
import{r as a,j as e}from"./main-DZVKUeg6.js";import{v as j,w as v,x as b,V as l,h as u,B as N,y as k,a8 as y,a3 as S}from"./ProxyViewerContainer-DaiTFf7n.js";const z=a.memo(function({logId:d,truncated:x}){const[o,m]=a.useState(!1),[r,i]=a.useState({status:"idle"}),[h,p]=a.useState(new Set);a.useEffect(()=>{if(!o||r.status!=="idle")return;let s=!1;return i({status:"loading"}),fetch(`/api/logs/${d}/chunks`).then(t=>t.ok?t.json():Promise.reject(new Error("Chunks not found"))).then(t=>{s||i({status:"success",chunks:t.chunks})}).catch(()=>{s||i({status:"error",message:"Chunk data unavailable"})}),()=>{s=!0}},[o,d]);const c=a.useMemo(()=>{if(r.status!=="success")return[];const s=new Map;for(const t of r.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)},[r]),f=s=>{p(t=>{const n=new Set(t);return n.has(s)?n.delete(s):n.add(s),n})};function g(){return r.status==="idle"||r.status==="loading"?e.jsxs("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[e.jsx(y,{className:"size-3 animate-spin"}),e.jsx("span",{children:"Loading chunks..."})]}):r.status==="error"?e.jsx("div",{className:"py-2 text-xs text-muted-foreground italic",children:r.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:[c.length," index group",c.length!==1?"s":""," available"]}),c.map(s=>{const t=h.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:()=>f(s.index),children:[t?e.jsx(l,{className:"size-3 text-muted-foreground"}):e.jsx(u,{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(S,{data:n,defaultExpandDepth:0,showCopy:!0})]},n.index))})]},s.index)})]})}return e.jsxs("div",{className:"space-y-1",children:[e.jsx(j,{children:e.jsxs(v,{children:[e.jsx(b,{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:()=>m(s=>!s),children:[o?e.jsx(l,{className:"size-3"}):e.jsx(u,{className:"size-3"}),e.jsx("span",{children:"Raw SSE Events"}),e.jsxs(N,{variant:"outline",className:"text-[9px] px-1 py-0 h-4 font-mono ml-1",children:[d,x===!0?"+":""]})]})}),e.jsx(k,{children:"Server-Sent Events streaming chunks from the provider"})]})}),o===!0?e.jsx("div",{className:"rounded-md border border-border bg-muted/20 overflow-auto max-h-64",children:g()}):null]})});export{z as StreamingChunkSequence};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{R as s,j as e}from"./main-DZVKUeg6.js";import{P as i}from"./ProxyViewerContainer-DaiTFf7n.js";function t(){const{sessionId:o}=s.useParams();return e.jsx(i,{initialSessionId:o},o)}export{t as component};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{P as o}from"./ProxyViewerContainer-DaiTFf7n.js";import"./main-DZVKUeg6.js";const r=o;export{r as component};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DBSbw8Gd.js","assets/ProxyViewerContainer-DaiTFf7n.js","assets/_sessionId-6fF5JpyQ.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
function I0(a,u){for(var i=0;i<u.length;i++){const r=u[i];if(typeof r!="string"&&!Array.isArray(r)){for(const o in r)if(o!=="default"&&!(o in a)){const f=Object.getOwnPropertyDescriptor(r,o);f&&Object.defineProperty(a,o,f.get?f:{enumerable:!0,get:()=>r[o]})}}}return Object.freeze(Object.defineProperty(a,Symbol.toStringTag,{value:"Module"}))}var yR=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function hp(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}var ho={exports:{}},Xi={};var py;function tS(){if(py)return Xi;py=1;var a=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function i(r,o,f){var h=null;if(f!==void 0&&(h=""+f),o.key!==void 0&&(h=""+o.key),"key"in o){f={};for(var y in o)y!=="key"&&(f[y]=o[y])}else f=o;return o=f.ref,{$$typeof:a,type:r,key:h,ref:o!==void 0?o:null,props:f}}return Xi.Fragment=u,Xi.jsx=i,Xi.jsxs=i,Xi}var gy;function eS(){return gy||(gy=1,ho.exports=tS()),ho.exports}var k=eS(),mo={exports:{}},dt={};var vy;function nS(){if(vy)return dt;vy=1;var a=Symbol.for("react.transitional.element"),u=Symbol.for("react.portal"),i=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),o=Symbol.for("react.profiler"),f=Symbol.for("react.consumer"),h=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),v=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),_=Symbol.iterator;function R(w){return w===null||typeof w!="object"?null:(w=_&&w[_]||w["@@iterator"],typeof w=="function"?w:null)}var C={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},A=Object.assign,M={};function Y(w,q,J){this.props=w,this.context=q,this.refs=M,this.updater=J||C}Y.prototype.isReactComponent={},Y.prototype.setState=function(w,q){if(typeof w!="object"&&typeof w!="function"&&w!=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,w,q,"setState")},Y.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function B(){}B.prototype=Y.prototype;function Z(w,q,J){this.props=w,this.context=q,this.refs=M,this.updater=J||C}var H=Z.prototype=new B;H.constructor=Z,A(H,Y.prototype),H.isPureReactComponent=!0;var F=Array.isArray;function I(){}var Q={H:null,A:null,T:null,S:null},X=Object.prototype.hasOwnProperty;function K(w,q,J){var W=J.ref;return{$$typeof:a,type:w,key:q,ref:W!==void 0?W:null,props:J}}function rt(w,q){return K(w.type,q,w.props)}function nt(w){return typeof w=="object"&&w!==null&&w.$$typeof===a}function lt(w){var q={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(J){return q[J]})}var ht=/\/+/g;function it(w,q){return typeof w=="object"&&w!==null&&w.key!=null?lt(""+w.key):q.toString(36)}function jt(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(I,I):(w.status="pending",w.then(function(q){w.status==="pending"&&(w.status="fulfilled",w.value=q)},function(q){w.status==="pending"&&(w.status="rejected",w.reason=q)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function N(w,q,J,W,ct){var ot=typeof w;(ot==="undefined"||ot==="boolean")&&(w=null);var ft=!1;if(w===null)ft=!0;else switch(ot){case"bigint":case"string":case"number":ft=!0;break;case"object":switch(w.$$typeof){case a:case u:ft=!0;break;case v:return ft=w._init,N(ft(w._payload),q,J,W,ct)}}if(ft)return ct=ct(w),ft=W===""?"."+it(w,0):W,F(ct)?(J="",ft!=null&&(J=ft.replace(ht,"$&/")+"/"),N(ct,q,J,"",function(De){return De})):ct!=null&&(nt(ct)&&(ct=rt(ct,J+(ct.key==null||w&&w.key===ct.key?"":(""+ct.key).replace(ht,"$&/")+"/")+ft)),q.push(ct)),1;ft=0;var Xt=W===""?".":W+":";if(F(w))for(var Ht=0;Ht<w.length;Ht++)W=w[Ht],ot=Xt+it(W,Ht),ft+=N(W,q,J,ot,ct);else if(Ht=R(w),typeof Ht=="function")for(w=Ht.call(w),Ht=0;!(W=w.next()).done;)W=W.value,ot=Xt+it(W,Ht++),ft+=N(W,q,J,ot,ct);else if(ot==="object"){if(typeof w.then=="function")return N(jt(w),q,J,W,ct);throw q=String(w),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return ft}function P(w,q,J){if(w==null)return w;var W=[],ct=0;return N(w,W,"","",function(ot){return q.call(J,ot,ct++)}),W}function ut(w){if(w._status===-1){var q=w._result;q=q(),q.then(function(J){(w._status===0||w._status===-1)&&(w._status=1,w._result=J)},function(J){(w._status===0||w._status===-1)&&(w._status=2,w._result=J)}),w._status===-1&&(w._status=0,w._result=q)}if(w._status===1)return w._result.default;throw w._result}var Tt=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof w=="object"&&w!==null&&typeof w.message=="string"?String(w.message):String(w),error:w});if(!window.dispatchEvent(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},pt={map:P,forEach:function(w,q,J){P(w,function(){q.apply(this,arguments)},J)},count:function(w){var q=0;return P(w,function(){q++}),q},toArray:function(w){return P(w,function(q){return q})||[]},only:function(w){if(!nt(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return dt.Activity=S,dt.Children=pt,dt.Component=Y,dt.Fragment=i,dt.Profiler=o,dt.PureComponent=Z,dt.StrictMode=r,dt.Suspense=m,dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Q,dt.__COMPILER_RUNTIME={__proto__:null,c:function(w){return Q.H.useMemoCache(w)}},dt.cache=function(w){return function(){return w.apply(null,arguments)}},dt.cacheSignal=function(){return null},dt.cloneElement=function(w,q,J){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var W=A({},w.props),ct=w.key;if(q!=null)for(ot in q.key!==void 0&&(ct=""+q.key),q)!X.call(q,ot)||ot==="key"||ot==="__self"||ot==="__source"||ot==="ref"&&q.ref===void 0||(W[ot]=q[ot]);var ot=arguments.length-2;if(ot===1)W.children=J;else if(1<ot){for(var ft=Array(ot),Xt=0;Xt<ot;Xt++)ft[Xt]=arguments[Xt+2];W.children=ft}return K(w.type,ct,W)},dt.createContext=function(w){return w={$$typeof:h,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null},w.Provider=w,w.Consumer={$$typeof:f,_context:w},w},dt.createElement=function(w,q,J){var W,ct={},ot=null;if(q!=null)for(W in q.key!==void 0&&(ot=""+q.key),q)X.call(q,W)&&W!=="key"&&W!=="__self"&&W!=="__source"&&(ct[W]=q[W]);var ft=arguments.length-2;if(ft===1)ct.children=J;else if(1<ft){for(var Xt=Array(ft),Ht=0;Ht<ft;Ht++)Xt[Ht]=arguments[Ht+2];ct.children=Xt}if(w&&w.defaultProps)for(W in ft=w.defaultProps,ft)ct[W]===void 0&&(ct[W]=ft[W]);return K(w,ot,ct)},dt.createRef=function(){return{current:null}},dt.forwardRef=function(w){return{$$typeof:y,render:w}},dt.isValidElement=nt,dt.lazy=function(w){return{$$typeof:v,_payload:{_status:-1,_result:w},_init:ut}},dt.memo=function(w,q){return{$$typeof:p,type:w,compare:q===void 0?null:q}},dt.startTransition=function(w){var q=Q.T,J={};Q.T=J;try{var W=w(),ct=Q.S;ct!==null&&ct(J,W),typeof W=="object"&&W!==null&&typeof W.then=="function"&&W.then(I,Tt)}catch(ot){Tt(ot)}finally{q!==null&&J.types!==null&&(q.types=J.types),Q.T=q}},dt.unstable_useCacheRefresh=function(){return Q.H.useCacheRefresh()},dt.use=function(w){return Q.H.use(w)},dt.useActionState=function(w,q,J){return Q.H.useActionState(w,q,J)},dt.useCallback=function(w,q){return Q.H.useCallback(w,q)},dt.useContext=function(w){return Q.H.useContext(w)},dt.useDebugValue=function(){},dt.useDeferredValue=function(w,q){return Q.H.useDeferredValue(w,q)},dt.useEffect=function(w,q){return Q.H.useEffect(w,q)},dt.useEffectEvent=function(w){return Q.H.useEffectEvent(w)},dt.useId=function(){return Q.H.useId()},dt.useImperativeHandle=function(w,q,J){return Q.H.useImperativeHandle(w,q,J)},dt.useInsertionEffect=function(w,q){return Q.H.useInsertionEffect(w,q)},dt.useLayoutEffect=function(w,q){return Q.H.useLayoutEffect(w,q)},dt.useMemo=function(w,q){return Q.H.useMemo(w,q)},dt.useOptimistic=function(w,q){return Q.H.useOptimistic(w,q)},dt.useReducer=function(w,q,J){return Q.H.useReducer(w,q,J)},dt.useRef=function(w){return Q.H.useRef(w)},dt.useState=function(w){return Q.H.useState(w)},dt.useSyncExternalStore=function(w,q,J){return Q.H.useSyncExternalStore(w,q,J)},dt.useTransition=function(){return Q.H.useTransition()},dt.version="19.2.4",dt}var Sy;function nu(){return Sy||(Sy=1,mo.exports=nS()),mo.exports}var $=nu();const qn=hp($),aS=I0({__proto__:null,default:qn},[$]);var yo={exports:{}},Qi={},po={exports:{}},go={};var by;function lS(){return by||(by=1,(function(a){function u(N,P){var ut=N.length;N.push(P);t:for(;0<ut;){var Tt=ut-1>>>1,pt=N[Tt];if(0<o(pt,P))N[Tt]=P,N[ut]=pt,ut=Tt;else break t}}function i(N){return N.length===0?null:N[0]}function r(N){if(N.length===0)return null;var P=N[0],ut=N.pop();if(ut!==P){N[0]=ut;t:for(var Tt=0,pt=N.length,w=pt>>>1;Tt<w;){var q=2*(Tt+1)-1,J=N[q],W=q+1,ct=N[W];if(0>o(J,ut))W<pt&&0>o(ct,J)?(N[Tt]=ct,N[W]=ut,Tt=W):(N[Tt]=J,N[q]=ut,Tt=q);else if(W<pt&&0>o(ct,ut))N[Tt]=ct,N[W]=ut,Tt=W;else break t}}return P}function o(N,P){var ut=N.sortIndex-P.sortIndex;return ut!==0?ut:N.id-P.id}if(a.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;a.unstable_now=function(){return f.now()}}else{var h=Date,y=h.now();a.unstable_now=function(){return h.now()-y}}var m=[],p=[],v=1,S=null,_=3,R=!1,C=!1,A=!1,M=!1,Y=typeof setTimeout=="function"?setTimeout:null,B=typeof clearTimeout=="function"?clearTimeout:null,Z=typeof setImmediate<"u"?setImmediate:null;function H(N){for(var P=i(p);P!==null;){if(P.callback===null)r(p);else if(P.startTime<=N)r(p),P.sortIndex=P.expirationTime,u(m,P);else break;P=i(p)}}function F(N){if(A=!1,H(N),!C)if(i(m)!==null)C=!0,I||(I=!0,lt());else{var P=i(p);P!==null&&jt(F,P.startTime-N)}}var I=!1,Q=-1,X=5,K=-1;function rt(){return M?!0:!(a.unstable_now()-K<X)}function nt(){if(M=!1,I){var N=a.unstable_now();K=N;var P=!0;try{t:{C=!1,A&&(A=!1,B(Q),Q=-1),R=!0;var ut=_;try{e:{for(H(N),S=i(m);S!==null&&!(S.expirationTime>N&&rt());){var Tt=S.callback;if(typeof Tt=="function"){S.callback=null,_=S.priorityLevel;var pt=Tt(S.expirationTime<=N);if(N=a.unstable_now(),typeof pt=="function"){S.callback=pt,H(N),P=!0;break e}S===i(m)&&r(m),H(N)}else r(m);S=i(m)}if(S!==null)P=!0;else{var w=i(p);w!==null&&jt(F,w.startTime-N),P=!1}}break t}finally{S=null,_=ut,R=!1}P=void 0}}finally{P?lt():I=!1}}}var lt;if(typeof Z=="function")lt=function(){Z(nt)};else if(typeof MessageChannel<"u"){var ht=new MessageChannel,it=ht.port2;ht.port1.onmessage=nt,lt=function(){it.postMessage(null)}}else lt=function(){Y(nt,0)};function jt(N,P){Q=Y(function(){N(a.unstable_now())},P)}a.unstable_IdlePriority=5,a.unstable_ImmediatePriority=1,a.unstable_LowPriority=4,a.unstable_NormalPriority=3,a.unstable_Profiling=null,a.unstable_UserBlockingPriority=2,a.unstable_cancelCallback=function(N){N.callback=null},a.unstable_forceFrameRate=function(N){0>N||125<N?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):X=0<N?Math.floor(1e3/N):5},a.unstable_getCurrentPriorityLevel=function(){return _},a.unstable_next=function(N){switch(_){case 1:case 2:case 3:var P=3;break;default:P=_}var ut=_;_=P;try{return N()}finally{_=ut}},a.unstable_requestPaint=function(){M=!0},a.unstable_runWithPriority=function(N,P){switch(N){case 1:case 2:case 3:case 4:case 5:break;default:N=3}var ut=_;_=N;try{return P()}finally{_=ut}},a.unstable_scheduleCallback=function(N,P,ut){var Tt=a.unstable_now();switch(typeof ut=="object"&&ut!==null?(ut=ut.delay,ut=typeof ut=="number"&&0<ut?Tt+ut:Tt):ut=Tt,N){case 1:var pt=-1;break;case 2:pt=250;break;case 5:pt=1073741823;break;case 4:pt=1e4;break;default:pt=5e3}return pt=ut+pt,N={id:v++,callback:P,priorityLevel:N,startTime:ut,expirationTime:pt,sortIndex:-1},ut>Tt?(N.sortIndex=ut,u(p,N),i(m)===null&&N===i(p)&&(A?(B(Q),Q=-1):A=!0,jt(F,ut-Tt))):(N.sortIndex=pt,u(m,N),C||R||(C=!0,I||(I=!0,lt()))),N},a.unstable_shouldYield=rt,a.unstable_wrapCallback=function(N){var P=_;return function(){var ut=_;_=P;try{return N.apply(this,arguments)}finally{_=ut}}}})(go)),go}var _y;function iS(){return _y||(_y=1,po.exports=lS()),po.exports}var vo={exports:{}},Se={};var Ey;function uS(){if(Ey)return Se;Ey=1;var a=nu();function u(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var v=2;v<arguments.length;v++)p+="&args[]="+encodeURIComponent(arguments[v])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(){}var r={d:{f:i,r:function(){throw Error(u(522))},D:i,C:i,L:i,m:i,X:i,S:i,M:i},p:0,findDOMNode:null},o=Symbol.for("react.portal");function f(m,p,v){var S=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:o,key:S==null?null:""+S,children:m,containerInfo:p,implementation:v}}var h=a.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Se.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,Se.createPortal=function(m,p){var v=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(u(299));return f(m,p,null,v)},Se.flushSync=function(m){var p=h.T,v=r.p;try{if(h.T=null,r.p=2,m)return m()}finally{h.T=p,r.p=v,r.d.f()}},Se.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,r.d.C(m,p))},Se.prefetchDNS=function(m){typeof m=="string"&&r.d.D(m)},Se.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var v=p.as,S=y(v,p.crossOrigin),_=typeof p.integrity=="string"?p.integrity:void 0,R=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;v==="style"?r.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:S,integrity:_,fetchPriority:R}):v==="script"&&r.d.X(m,{crossOrigin:S,integrity:_,fetchPriority:R,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Se.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var v=y(p.as,p.crossOrigin);r.d.M(m,{crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&r.d.M(m)},Se.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var v=p.as,S=y(v,p.crossOrigin);r.d.L(m,v,{crossOrigin:S,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Se.preloadModule=function(m,p){if(typeof m=="string")if(p){var v=y(p.as,p.crossOrigin);r.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:v,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else r.d.m(m)},Se.requestFormReset=function(m){r.d.r(m)},Se.unstable_batchedUpdates=function(m,p){return m(p)},Se.useFormState=function(m,p,v){return h.H.useFormState(m,p,v)},Se.useFormStatus=function(){return h.H.useHostTransitionStatus()},Se.version="19.2.4",Se}var Ry;function mp(){if(Ry)return vo.exports;Ry=1;function a(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(a)}catch(u){console.error(u)}}return a(),vo.exports=uS(),vo.exports}var Ty;function sS(){if(Ty)return Qi;Ty=1;var a=iS(),u=nu(),i=mp();function r(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}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 o(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function f(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function h(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 y(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 m(t){if(f(t)!==t)throw Error(r(188))}function p(t){var e=t.alternate;if(!e){if(e=f(t),e===null)throw Error(r(188));return e!==t?null:t}for(var n=t,l=e;;){var s=n.return;if(s===null)break;var c=s.alternate;if(c===null){if(l=s.return,l!==null){n=l;continue}break}if(s.child===c.child){for(c=s.child;c;){if(c===n)return m(s),t;if(c===l)return m(s),e;c=c.sibling}throw Error(r(188))}if(n.return!==l.return)n=s,l=c;else{for(var d=!1,g=s.child;g;){if(g===n){d=!0,n=s,l=c;break}if(g===l){d=!0,l=s,n=c;break}g=g.sibling}if(!d){for(g=c.child;g;){if(g===n){d=!0,n=c,l=s;break}if(g===l){d=!0,l=c,n=s;break}g=g.sibling}if(!d)throw Error(r(189))}}if(n.alternate!==l)throw Error(r(190))}if(n.tag!==3)throw Error(r(188));return n.stateNode.current===n?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 S=Object.assign,_=Symbol.for("react.element"),R=Symbol.for("react.transitional.element"),C=Symbol.for("react.portal"),A=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),Y=Symbol.for("react.profiler"),B=Symbol.for("react.consumer"),Z=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),F=Symbol.for("react.suspense"),I=Symbol.for("react.suspense_list"),Q=Symbol.for("react.memo"),X=Symbol.for("react.lazy"),K=Symbol.for("react.activity"),rt=Symbol.for("react.memo_cache_sentinel"),nt=Symbol.iterator;function lt(t){return t===null||typeof t!="object"?null:(t=nt&&t[nt]||t["@@iterator"],typeof t=="function"?t:null)}var ht=Symbol.for("react.client.reference");function it(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ht?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case A:return"Fragment";case Y:return"Profiler";case M:return"StrictMode";case F:return"Suspense";case I:return"SuspenseList";case K:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case C:return"Portal";case Z:return t.displayName||"Context";case B:return(t._context.displayName||"Context")+".Consumer";case H:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Q:return e=t.displayName||null,e!==null?e:it(t.type)||"Memo";case X:e=t._payload,t=t._init;try{return it(t(e))}catch{}}return null}var jt=Array.isArray,N=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,P=i.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ut={pending:!1,data:null,method:null,action:null},Tt=[],pt=-1;function w(t){return{current:t}}function q(t){0>pt||(t.current=Tt[pt],Tt[pt]=null,pt--)}function J(t,e){pt++,Tt[pt]=t.current,t.current=e}var W=w(null),ct=w(null),ot=w(null),ft=w(null);function Xt(t,e){switch(J(ot,e),J(ct,t),J(W,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?qm(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=qm(e),t=Vm(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}q(W),J(W,t)}function Ht(){q(W),q(ct),q(ot)}function De(t){t.memoizedState!==null&&J(ft,t);var e=W.current,n=Vm(e,t.type);e!==n&&(J(ct,t),J(W,n))}function Xe(t){ct.current===t&&(q(W),q(ct)),ft.current===t&&(q(ft),qi._currentValue=ut)}var Qn,Ta;function _e(t){if(Qn===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Qn=e&&e[1]||"",Ta=-1<n.stack.indexOf(`
|
|
3
3
|
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
4
4
|
`+Qn+t+Ta}var mn=!1;function Aa(t,e){if(!t||mn)return"";mn=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(e){var G=function(){throw Error()};if(Object.defineProperty(G.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(G,[])}catch(U){var L=U}Reflect.construct(t,[],G)}else{try{G.call()}catch(U){L=U}t.call(G.prototype)}}else{try{throw Error()}catch(U){L=U}(G=t())&&typeof G.catch=="function"&&G.catch(function(){})}}catch(U){if(U&&L&&typeof U.stack=="string")return[U.stack,L.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 c=l.DetermineComponentFrameRoot(),d=c[0],g=c[1];if(d&&g){var E=d.split(`
|
|
@@ -15,4 +15,4 @@ Error generating stack: `+l.message+`
|
|
|
15
15
|
`)}else{const p=o.indexOf(`
|
|
16
16
|
`);if(p>=0){const v=o.slice(0,p).trim();o=o.slice(p+1),v.length>0&&(h=JSON.parse(v),f=!0)}}}return(async()=>{try{for(;;){const{value:y,done:m}=await r.read();y&&(o+=y);const p=o.lastIndexOf(`
|
|
17
17
|
`);if(p>=0){const v=o.slice(0,p);o=o.slice(p+1);const S=v.split(`
|
|
18
|
-
`).filter(Boolean);for(const _ of S)try{u(JSON.parse(_))}catch(R){i?.(`Invalid JSON line: ${_}`,R)}}if(m)break}}catch(y){i?.("Stream processing error:",y)}})(),u(h)}async function yE({jsonStream:a,onMessage:u,onError:i}){const r=a.getReader(),{value:o,done:f}=await r.read();if(f||!o)throw new Error("Stream ended before first object");const h=JSON.parse(o);return(async()=>{try{for(;;){const{value:y,done:m}=await r.read();if(m)break;if(y)try{u(JSON.parse(y))}catch(p){i?.(`Invalid JSON: ${y}`,p)}}}catch(y){i?.("Stream processing error:",y)}})(),u(h)}function pE(a){const u="/_serverFn/"+a;return Object.assign((...o)=>{const f=bg()?.serverFns?.fetch;return fE(u,o,f??fetch)},{url:u,serverFnMeta:{id:a},[Zo]:!0})}const gE={key:"$TSS/serverfn",test:a=>typeof a!="function"||!(Zo in a)?!1:!!a[Zo],toSerializable:({serverFnMeta:a})=>({functionId:a.id}),fromSerializable:({functionId:a})=>pE(a)};var ip=og();const Tg=0,Ag=1,Og=2,up=3;var sp=Object.prototype.hasOwnProperty;function Ko(a,u){var i,r;if(a===u)return!0;if(a&&u&&(i=a.constructor)===u.constructor){if(i===Date)return a.getTime()===u.getTime();if(i===RegExp)return a.toString()===u.toString();if(i===Array){if((r=a.length)===u.length)for(;r--&&Ko(a[r],u[r]););return r===-1}if(!i||typeof a=="object"){r=0;for(i in a)if(sp.call(a,i)&&++r&&!sp.call(u,i)||!(i in u)||!Ko(a[i],u[i]))return!1;return Object.keys(u).length===r}}return a!==a&&u!==u}const Bn=new WeakMap,Hn=()=>{},ge=Hn(),Qs=Object,_t=a=>a===ge,sn=a=>typeof a=="function",Gn=(a,u)=>({...a,...u}),wg=a=>sn(a.then),Uo={},As={},pf="undefined",lu=typeof window!=pf,Jo=typeof document!=pf,vE=lu&&"Deno"in window,SE=()=>lu&&typeof window.requestAnimationFrame!=pf,xg=(a,u)=>{const i=Bn.get(a);return[()=>!_t(u)&&a.get(u)||Uo,r=>{if(!_t(u)){const o=a.get(u);u in As||(As[u]=o),i[5](u,Gn(o,r),o||Uo)}},i[6],()=>!_t(u)&&u in As?As[u]:!_t(u)&&a.get(u)||Uo]};let ko=!0;const bE=()=>ko,[Fo,Po]=lu&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Hn,Hn],_E=()=>{const a=Jo&&document.visibilityState;return _t(a)||a!=="hidden"},EE=a=>(Jo&&document.addEventListener("visibilitychange",a),Fo("focus",a),()=>{Jo&&document.removeEventListener("visibilitychange",a),Po("focus",a)}),RE=a=>{const u=()=>{ko=!0,a()},i=()=>{ko=!1};return Fo("online",u),Fo("offline",i),()=>{Po("online",u),Po("offline",i)}},TE={isOnline:bE,isVisible:_E},AE={initFocus:EE,initReconnect:RE},rp=!qn.useId,Fl=!lu||vE,OE=a=>SE()?window.requestAnimationFrame(a):setTimeout(a,1),Ds=Fl?$.useEffect:$.useLayoutEffect,Bo=typeof navigator<"u"&&navigator.connection,cp=!Fl&&Bo&&(["slow-2g","2g"].includes(Bo.effectiveType)||Bo.saveData),Os=new WeakMap,wE=a=>Qs.prototype.toString.call(a),jo=(a,u)=>a===`[object ${u}]`;let xE=0;const Wo=a=>{const u=typeof a,i=wE(a),r=jo(i,"Date"),o=jo(i,"RegExp"),f=jo(i,"Object");let h,y;if(Qs(a)===a&&!r&&!o){if(h=Os.get(a),h)return h;if(h=++xE+"~",Os.set(a,h),Array.isArray(a)){for(h="@",y=0;y<a.length;y++)h+=Wo(a[y])+",";Os.set(a,h)}if(f){h="#";const m=Qs.keys(a).sort();for(;!_t(y=m.pop());)_t(a[y])||(h+=y+":"+Wo(a[y])+",");Os.set(a,h)}}else h=r?a.toJSON():u=="symbol"?a.toString():u=="string"?JSON.stringify(a):""+a;return h},gf=a=>{if(sn(a))try{a=a()}catch{a=""}const u=a;return a=typeof a=="string"?a:(Array.isArray(a)?a.length:a)?Wo(a):"",[a,u]};let ME=0;const $o=()=>++ME;async function Mg(...a){const[u,i,r,o]=a,f=Gn({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let h=f.populateCache;const y=f.rollbackOnError;let m=f.optimisticData;const p=_=>typeof y=="function"?y(_):y!==!1,v=f.throwOnError;if(sn(i)){const _=i,R=[],C=u.keys();for(const A of C)!/^\$(inf|sub)\$/.test(A)&&_(u.get(A)._k)&&R.push(A);return Promise.all(R.map(S))}return S(i);async function S(_){const[R]=gf(_);if(!R)return;const[C,A]=xg(u,R),[M,Y,B,Z]=Bn.get(u),H=()=>{const it=M[R];return(sn(f.revalidate)?f.revalidate(C().data,_):f.revalidate!==!1)&&(delete B[R],delete Z[R],it&&it[0])?it[0](Og).then(()=>C().data):C().data};if(a.length<3)return H();let F=r,I,Q=!1;const X=$o();Y[R]=[X,0];const K=!_t(m),rt=C(),nt=rt.data,lt=rt._c,ht=_t(lt)?nt:lt;if(K&&(m=sn(m)?m(ht,nt):m,A({data:m,_c:ht})),sn(F))try{F=F(ht)}catch(it){I=it,Q=!0}if(F&&wg(F))if(F=await F.catch(it=>{I=it,Q=!0}),X!==Y[R][0]){if(Q)throw I;return F}else Q&&K&&p(I)&&(h=!0,A({data:ht,_c:ge}));if(h&&!Q)if(sn(h)){const it=h(F,ht);A({data:it,error:ge,_c:ge})}else A({data:F,error:ge,_c:ge});if(Y[R][1]=$o(),Promise.resolve(H()).then(()=>{A({_c:ge})}),Q){if(v)throw I;return}return F}}const op=(a,u)=>{for(const i in a)a[i][0]&&a[i][0](u)},Cg=(a,u)=>{if(!Bn.has(a)){const i=Gn(AE,u),r=Object.create(null),o=Mg.bind(ge,a);let f=Hn;const h=Object.create(null),y=(v,S)=>{const _=h[v]||[];return h[v]=_,_.push(S),()=>_.splice(_.indexOf(S),1)},m=(v,S,_)=>{a.set(v,S);const R=h[v];if(R)for(const C of R)C(S,_)},p=()=>{if(!Bn.has(a)&&(Bn.set(a,[r,Object.create(null),Object.create(null),Object.create(null),o,m,y]),!Fl)){const v=i.initFocus(setTimeout.bind(ge,op.bind(ge,r,Tg))),S=i.initReconnect(setTimeout.bind(ge,op.bind(ge,r,Ag)));f=()=>{v&&v(),S&&S(),Bn.delete(a)}}};return p(),[a,o,p,f]}return[a,Bn.get(a)[4]]},CE=(a,u,i,r,o)=>{const f=i.errorRetryCount,h=o.retryCount,y=~~((Math.random()+.5)*(1<<(h<8?h:8)))*i.errorRetryInterval;!_t(f)&&h>f||setTimeout(r,y,o)},zE=Ko,[vf,DE]=Cg(new Map),zg=Gn({onLoadingSlow:Hn,onSuccess:Hn,onError:Hn,onErrorRetry:CE,onDiscarded:Hn,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:cp?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:cp?5e3:3e3,compare:zE,isPaused:()=>!1,cache:vf,mutate:DE,fallback:{}},TE),Dg=(a,u)=>{const i=Gn(a,u);if(u){const{use:r,fallback:o}=a,{use:f,fallback:h}=u;r&&f&&(i.use=r.concat(f)),o&&h&&(i.fallback=Gn(o,h))}return i},Io=$.createContext({}),LE=a=>{const{value:u}=a,i=$.useContext(Io),r=sn(u),o=$.useMemo(()=>r?u(i):u,[r,i,u]),f=$.useMemo(()=>r?o:Dg(i,o),[r,i,o]),h=o&&o.provider,y=$.useRef(ge);h&&!y.current&&(y.current=Cg(h(f.cache||vf),o));const m=y.current;return m&&(f.cache=m[0],f.mutate=m[1]),Ds(()=>{if(m)return m[2]&&m[2](),m[3]},[]),$.createElement(Io.Provider,Gn(a,{value:f}))},NE="$inf$",Lg=lu&&window.__SWR_DEVTOOLS_USE__,UE=Lg?window.__SWR_DEVTOOLS_USE__:[],BE=()=>{Lg&&(window.__SWR_DEVTOOLS_REACT__=qn)},jE=a=>sn(a[1])?[a[0],a[1],a[2]||{}]:[a[0],null,(a[1]===null?a[2]:a[1])||{}],HE=()=>{const a=$.useContext(Io);return $.useMemo(()=>Gn(zg,a),[a])},qE=a=>(u,i,r)=>a(u,i&&((...f)=>{const[h]=gf(u),[,,,y]=Bn.get(vf);if(h.startsWith(NE))return i(...f);const m=y[h];return _t(m)?i(...f):(delete y[h],m)}),r),VE=UE.concat(qE),YE=a=>function(...i){const r=HE(),[o,f,h]=jE(i),y=Dg(r,h);let m=a;const{use:p}=y,v=(p||[]).concat(VE);for(let S=v.length;S--;)m=v[S](m);return m(o,f||y.fetcher||null,y)},GE=(a,u,i)=>{const r=u[a]||(u[a]=[]);return r.push(i),()=>{const o=r.indexOf(i);o>=0&&(r[o]=r[r.length-1],r.pop())}};BE();const Ho=qn.use||(a=>{switch(a.status){case"pending":throw a;case"fulfilled":return a.value;case"rejected":throw a.reason;default:throw a.status="pending",a.then(u=>{a.status="fulfilled",a.value=u},u=>{a.status="rejected",a.reason=u}),a}}),qo={dedupe:!0},fp=Promise.resolve(ge),XE=()=>Hn,QE=(a,u,i)=>{const{cache:r,compare:o,suspense:f,fallbackData:h,revalidateOnMount:y,revalidateIfStale:m,refreshInterval:p,refreshWhenHidden:v,refreshWhenOffline:S,keepPreviousData:_,strictServerPrefetchWarning:R}=i,[C,A,M,Y]=Bn.get(r),[B,Z]=gf(a),H=$.useRef(!1),F=$.useRef(!1),I=$.useRef(B),Q=$.useRef(u),X=$.useRef(i),K=()=>X.current,rt=()=>K().isVisible()&&K().isOnline(),[nt,lt,ht,it]=xg(r,B),jt=$.useRef({}).current,N=_t(h)?_t(i.fallback)?ge:i.fallback[B]:h,P=(Et,Lt)=>{for(const At in jt){const qt=At;if(qt==="data"){if(!o(Et[qt],Lt[qt])&&(!_t(Et[qt])||!o(ot,Lt[qt])))return!1}else if(Lt[qt]!==Et[qt])return!1}return!0},ut=!H.current,Tt=$.useMemo(()=>{const Et=nt(),Lt=it(),At=Jt=>{const Vt=Gn(Jt);return delete Vt._k,(()=>{if(!B||!u||K().isPaused())return!1;if(ut&&!_t(y))return y;const Mt=_t(N)?Vt.data:N;return _t(Mt)||m})()?{isValidating:!0,isLoading:!0,...Vt}:Vt},qt=At(Et),ve=Et===Lt?qt:At(Lt);let oe=qt;return[()=>{const Jt=At(nt());return P(Jt,oe)?(oe.data=Jt.data,oe.isLoading=Jt.isLoading,oe.isValidating=Jt.isValidating,oe.error=Jt.error,oe):(oe=Jt,Jt)},()=>ve]},[r,B]),pt=ip.useSyncExternalStore($.useCallback(Et=>ht(B,(Lt,At)=>{P(At,Lt)||Et()}),[r,B]),Tt[0],Tt[1]),w=C[B]&&C[B].length>0,q=pt.data,J=_t(q)?N&&wg(N)?Ho(N):N:q,W=pt.error,ct=$.useRef(J),ot=_?_t(q)?_t(ct.current)?J:ct.current:q:J,ft=B&&_t(J),Xt=$.useRef(null);!Fl&&ip.useSyncExternalStore(XE,()=>(Xt.current=!1,Xt),()=>(Xt.current=!0,Xt));const Ht=Xt.current;R&&Ht&&!f&&ft&&console.warn(`Missing pre-initiated data for serialized key "${B}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const De=!B||!u||K().isPaused()||w&&!_t(W)?!1:ut&&!_t(y)?y:f?_t(J)?!1:m:_t(J)||m,Xe=ut&&De,Qn=_t(pt.isValidating)?Xe:pt.isValidating,Ta=_t(pt.isLoading)?Xe:pt.isLoading,_e=$.useCallback(async Et=>{const Lt=Q.current;if(!B||!Lt||F.current||K().isPaused())return!1;let At,qt,ve=!0;const oe=Et||{},Jt=!M[B]||!oe.dedupe,Vt=()=>rp?!F.current&&B===I.current&&H.current:B===I.current,yn={isValidating:!1,isLoading:!1},Mt=()=>{lt(yn)},$t=()=>{const fe=M[B];fe&&fe[1]===qt&&delete M[B]},ae={isValidating:!0};_t(nt().data)&&(ae.isLoading=!0);try{if(Jt&&(lt(ae),i.loadingTimeout&&_t(nt().data)&&setTimeout(()=>{ve&&Vt()&&K().onLoadingSlow(B,i)},i.loadingTimeout),M[B]=[Lt(Z),$o()]),[At,qt]=M[B],At=await At,Jt&&setTimeout($t,i.dedupingInterval),!M[B]||M[B][1]!==qt)return Jt&&Vt()&&K().onDiscarded(B),!1;yn.error=ge;const fe=A[B];if(!_t(fe)&&(qt<=fe[0]||qt<=fe[1]||fe[1]===0))return Mt(),Jt&&Vt()&&K().onDiscarded(B),!1;const Qe=nt().data;yn.data=o(Qe,At)?Qe:At,Jt&&Vt()&&K().onSuccess(At,B,i)}catch(fe){$t();const Qe=K(),{shouldRetryOnError:Wl}=Qe;Qe.isPaused()||(yn.error=fe,Jt&&Vt()&&(Qe.onError(fe,B,Qe),(Wl===!0||sn(Wl)&&Wl(fe))&&(!K().revalidateOnFocus||!K().revalidateOnReconnect||rt())&&Qe.onErrorRetry(fe,B,Qe,Is=>{const pn=C[B];pn&&pn[0]&&pn[0](up,Is)},{retryCount:(oe.retryCount||0)+1,dedupe:!0})))}return ve=!1,Mt(),!0},[B,r]),mn=$.useCallback((...Et)=>Mg(r,I.current,...Et),[]);if(Ds(()=>{Q.current=u,X.current=i,_t(q)||(ct.current=q)}),Ds(()=>{if(!B)return;const Et=_e.bind(ge,qo);let Lt=0;K().revalidateOnFocus&&(Lt=Date.now()+K().focusThrottleInterval);const qt=GE(B,C,(ve,oe={})=>{if(ve==Tg){const Jt=Date.now();K().revalidateOnFocus&&Jt>Lt&&rt()&&(Lt=Jt+K().focusThrottleInterval,Et())}else if(ve==Ag)K().revalidateOnReconnect&&rt()&&Et();else{if(ve==Og)return _e();if(ve==up)return _e(oe)}});return F.current=!1,I.current=B,H.current=!0,lt({_k:Z}),De&&(M[B]||(_t(J)||Fl?Et():OE(Et))),()=>{F.current=!0,qt()}},[B]),Ds(()=>{let Et;function Lt(){const qt=sn(p)?p(nt().data):p;qt&&Et!==-1&&(Et=setTimeout(At,qt))}function At(){!nt().error&&(v||K().isVisible())&&(S||K().isOnline())?_e(qo).then(Lt):Lt()}return Lt(),()=>{Et&&(clearTimeout(Et),Et=-1)}},[p,v,S,B]),$.useDebugValue(ot),f){if(!rp&&Fl&&ft)throw new Error("Fallback data is required when using Suspense in SSR.");ft&&(Q.current=u,X.current=i,F.current=!1);const Et=Y[B],Lt=!_t(Et)&&ft?mn(Et):fp;if(Ho(Lt),!_t(W)&&ft)throw W;const At=ft?_e(qo):fp;!_t(ot)&&ft&&(At.status="fulfilled",At.value=!0),Ho(At)}return{mutate:mn,get data(){return jt.data=!0,ot},get error(){return jt.error=!0,W},get isValidating(){return jt.isValidating=!0,Qn},get isLoading(){return jt.isLoading=!0,Ta}}},ZE=Qs.defineProperty(LE,"defaultValue",{value:zg}),_R=YE(QE),KE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Agent%20Inspector'%3e%3cg%20fill='none'%20stroke='%23f59e0b'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20%3e%3cpath%20d='M5%2013%20C5%209%208%207%2012%207%20C16%207%2019%209%2019%2013%20C19%2016%2016%2018%2012%2018%20C8%2018%205%2016%205%2013%20Z'%20/%3e%3cpath%20d='M5%2011%20C3.5%209.5%201.5%2010%202%2012.5%20C2.5%2014%204%2013.5%205%2012.5'%20/%3e%3cpath%20d='M19%2011%20C20.5%209.5%2022.5%2010%2022%2012.5%20C21.5%2014%2020%2013.5%2019%2012.5'%20/%3e%3cline%20x1='10'%20y1='7'%20x2='9.5'%20y2='5'%20/%3e%3cline%20x1='14'%20y1='7'%20x2='14.5'%20y2='5'%20/%3e%3cline%20x1='6.5'%20y1='16'%20x2='4.5'%20y2='19.5'%20/%3e%3cline%20x1='9'%20y1='17.5'%20x2='8'%20y2='20.5'%20/%3e%3cline%20x1='15'%20y1='17.5'%20x2='16'%20y2='20.5'%20/%3e%3cline%20x1='17.5'%20y1='16'%20x2='19.5'%20y2='19.5'%20/%3e%3c/g%3e%3ccircle%20cx='9.5'%20cy='4.5'%20r='0.9'%20fill='%23f59e0b'%20/%3e%3ccircle%20cx='14.5'%20cy='4.5'%20r='0.9'%20fill='%23f59e0b'%20/%3e%3c/svg%3e",JE="/assets/index-Bcq8bZoK.css",Sf=B2({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"Agent Inspector"}],links:[{rel:"stylesheet",href:JE},{rel:"icon",type:"image/svg+xml",href:KE}]}),component:kE,notFoundComponent:FE});function kE(){return k.jsx(Ng,{children:k.jsx(gg,{})})}function FE(){return k.jsx(Ng,{children:k.jsx("main",{className:"min-h-screen bg-background text-foreground",children:k.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-3xl flex-col justify-center px-6 py-16",children:k.jsxs("div",{className:"border-border/70 bg-card/60 rounded-lg border p-8 shadow-sm",children:[k.jsx("div",{className:"text-muted-foreground font-mono text-xs uppercase tracking-wider",children:"404"}),k.jsx("h1",{className:"mt-3 text-2xl font-semibold",children:"Page not found"}),k.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."}),k.jsx("a",{href:"/",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 Ng({children:a}){return k.jsxs("html",{lang:"en",className:"dark",children:[k.jsx("head",{children:k.jsx(W2,{})}),k.jsxs("body",{children:[k.jsx(ZE,{value:{revalidateOnFocus:!1,revalidateIfStale:!1},children:a}),k.jsx($2,{})]})]})}const PE="modulepreload",WE=function(a){return"/"+a},dp={},Ug=function(u,i,r){let o=Promise.resolve();if(i&&i.length>0){let m=function(p){return Promise.all(p.map(v=>Promise.resolve(v).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),y=h?.nonce||h?.getAttribute("nonce");o=m(i.map(p=>{if(p=WE(p),p in dp)return;dp[p]=!0;const v=p.endsWith(".css"),S=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${S}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":PE,v||(_.as="script"),_.crossOrigin="",_.href=p,y&&_.setAttribute("nonce",y),document.head.appendChild(_),v)return new Promise((R,C)=>{_.addEventListener("load",R),_.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(h){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=h,window.dispatchEvent(y),!y.defaultPrevented)throw h}return o.then(h=>{for(const y of h||[])y.status==="rejected"&&f(y.reason);return u().catch(f)})},$E=()=>Ug(()=>import("./index-KMuh-31x.js"),__vite__mapDeps([0,1])),IE=Xs("/")({component:mg($E,"component")}),tR=/^[A-Za-z0-9_-]+$/;function eR(a){let u="";for(const i of a)u+=String.fromCharCode(i);return u}function nR(a){const u=new Uint8Array(a.length);for(let i=0;i<a.length;i++)u[i]=a.charCodeAt(i);return u}function Bg(a){const u=new TextEncoder().encode(a);return btoa(eR(u)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function aR(a){if(a.startsWith("%"))return decodeURIComponent(a);if(!tR.test(a))return a;try{const i=a.padEnd(Math.ceil(a.length/4)*4,"=").replace(/-/g,"+").replace(/_/g,"/"),r=atob(i);return new TextDecoder().decode(nR(r))}catch{return a}}function ER(a){return`/session/${Bg(a)}`}const lR=()=>Ug(()=>import("./_sessionId-Csx4T_y6.js"),__vite__mapDeps([2,1])),iR=Xs("/session/$sessionId")({component:mg(lR,"component"),parseParams:a=>({sessionId:aR(a.sessionId)}),stringifyParams:a=>({sessionId:Bg(a.sessionId)})}),uR=IE.update({id:"/",path:"/",getParentRoute:()=>Sf}),sR=iR.update({id:"/session/$sessionId",path:"/session/$sessionId",getParentRoute:()=>Sf}),rR={IndexRoute:uR,SessionSessionIdRoute:sR},cR=Sf._addFileChildren(rR);function oR(){const a=Q2({routeTree:cR,scrollRestoration:!1});return fR(a),a}function fR(a){Object.getOwnPropertyDescriptor(a,"stores")===void 0&&Object.defineProperty(a,"stores",{configurable:!0,value:{matches:{get:()=>a.state.matches}}})}async function dR(){const a=await oR();let u;return u=[],window.__TSS_START_OPTIONS__={serializationAdapters:u},u.push(gE),a.options.serializationAdapters&&u.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:u}),a.state.matches.length||await tE(a),a}async function hR(){const a=await dR();return window.$_TSR?.h(),a}let Vo;function mR(){return Vo||(Vo=hR()),k.jsx(d2,{promise:Vo,children:a=>k.jsx(J2,{router:a})})}$.startTransition(()=>{cS.hydrateRoot(document,k.jsx($.StrictMode,{children:k.jsx(mR,{})}))});export{iR as R,Ug as _,HE as a,dg as b,yR as c,qn as d,aS as e,SR as f,hp as g,ER as h,k as j,$ as r,_R as u};
|
|
18
|
+
`).filter(Boolean);for(const _ of S)try{u(JSON.parse(_))}catch(R){i?.(`Invalid JSON line: ${_}`,R)}}if(m)break}}catch(y){i?.("Stream processing error:",y)}})(),u(h)}async function yE({jsonStream:a,onMessage:u,onError:i}){const r=a.getReader(),{value:o,done:f}=await r.read();if(f||!o)throw new Error("Stream ended before first object");const h=JSON.parse(o);return(async()=>{try{for(;;){const{value:y,done:m}=await r.read();if(m)break;if(y)try{u(JSON.parse(y))}catch(p){i?.(`Invalid JSON: ${y}`,p)}}}catch(y){i?.("Stream processing error:",y)}})(),u(h)}function pE(a){const u="/_serverFn/"+a;return Object.assign((...o)=>{const f=bg()?.serverFns?.fetch;return fE(u,o,f??fetch)},{url:u,serverFnMeta:{id:a},[Zo]:!0})}const gE={key:"$TSS/serverfn",test:a=>typeof a!="function"||!(Zo in a)?!1:!!a[Zo],toSerializable:({serverFnMeta:a})=>({functionId:a.id}),fromSerializable:({functionId:a})=>pE(a)};var ip=og();const Tg=0,Ag=1,Og=2,up=3;var sp=Object.prototype.hasOwnProperty;function Ko(a,u){var i,r;if(a===u)return!0;if(a&&u&&(i=a.constructor)===u.constructor){if(i===Date)return a.getTime()===u.getTime();if(i===RegExp)return a.toString()===u.toString();if(i===Array){if((r=a.length)===u.length)for(;r--&&Ko(a[r],u[r]););return r===-1}if(!i||typeof a=="object"){r=0;for(i in a)if(sp.call(a,i)&&++r&&!sp.call(u,i)||!(i in u)||!Ko(a[i],u[i]))return!1;return Object.keys(u).length===r}}return a!==a&&u!==u}const Bn=new WeakMap,Hn=()=>{},ge=Hn(),Qs=Object,_t=a=>a===ge,sn=a=>typeof a=="function",Gn=(a,u)=>({...a,...u}),wg=a=>sn(a.then),Uo={},As={},pf="undefined",lu=typeof window!=pf,Jo=typeof document!=pf,vE=lu&&"Deno"in window,SE=()=>lu&&typeof window.requestAnimationFrame!=pf,xg=(a,u)=>{const i=Bn.get(a);return[()=>!_t(u)&&a.get(u)||Uo,r=>{if(!_t(u)){const o=a.get(u);u in As||(As[u]=o),i[5](u,Gn(o,r),o||Uo)}},i[6],()=>!_t(u)&&u in As?As[u]:!_t(u)&&a.get(u)||Uo]};let ko=!0;const bE=()=>ko,[Fo,Po]=lu&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Hn,Hn],_E=()=>{const a=Jo&&document.visibilityState;return _t(a)||a!=="hidden"},EE=a=>(Jo&&document.addEventListener("visibilitychange",a),Fo("focus",a),()=>{Jo&&document.removeEventListener("visibilitychange",a),Po("focus",a)}),RE=a=>{const u=()=>{ko=!0,a()},i=()=>{ko=!1};return Fo("online",u),Fo("offline",i),()=>{Po("online",u),Po("offline",i)}},TE={isOnline:bE,isVisible:_E},AE={initFocus:EE,initReconnect:RE},rp=!qn.useId,Fl=!lu||vE,OE=a=>SE()?window.requestAnimationFrame(a):setTimeout(a,1),Ds=Fl?$.useEffect:$.useLayoutEffect,Bo=typeof navigator<"u"&&navigator.connection,cp=!Fl&&Bo&&(["slow-2g","2g"].includes(Bo.effectiveType)||Bo.saveData),Os=new WeakMap,wE=a=>Qs.prototype.toString.call(a),jo=(a,u)=>a===`[object ${u}]`;let xE=0;const Wo=a=>{const u=typeof a,i=wE(a),r=jo(i,"Date"),o=jo(i,"RegExp"),f=jo(i,"Object");let h,y;if(Qs(a)===a&&!r&&!o){if(h=Os.get(a),h)return h;if(h=++xE+"~",Os.set(a,h),Array.isArray(a)){for(h="@",y=0;y<a.length;y++)h+=Wo(a[y])+",";Os.set(a,h)}if(f){h="#";const m=Qs.keys(a).sort();for(;!_t(y=m.pop());)_t(a[y])||(h+=y+":"+Wo(a[y])+",");Os.set(a,h)}}else h=r?a.toJSON():u=="symbol"?a.toString():u=="string"?JSON.stringify(a):""+a;return h},gf=a=>{if(sn(a))try{a=a()}catch{a=""}const u=a;return a=typeof a=="string"?a:(Array.isArray(a)?a.length:a)?Wo(a):"",[a,u]};let ME=0;const $o=()=>++ME;async function Mg(...a){const[u,i,r,o]=a,f=Gn({populateCache:!0,throwOnError:!0},typeof o=="boolean"?{revalidate:o}:o||{});let h=f.populateCache;const y=f.rollbackOnError;let m=f.optimisticData;const p=_=>typeof y=="function"?y(_):y!==!1,v=f.throwOnError;if(sn(i)){const _=i,R=[],C=u.keys();for(const A of C)!/^\$(inf|sub)\$/.test(A)&&_(u.get(A)._k)&&R.push(A);return Promise.all(R.map(S))}return S(i);async function S(_){const[R]=gf(_);if(!R)return;const[C,A]=xg(u,R),[M,Y,B,Z]=Bn.get(u),H=()=>{const it=M[R];return(sn(f.revalidate)?f.revalidate(C().data,_):f.revalidate!==!1)&&(delete B[R],delete Z[R],it&&it[0])?it[0](Og).then(()=>C().data):C().data};if(a.length<3)return H();let F=r,I,Q=!1;const X=$o();Y[R]=[X,0];const K=!_t(m),rt=C(),nt=rt.data,lt=rt._c,ht=_t(lt)?nt:lt;if(K&&(m=sn(m)?m(ht,nt):m,A({data:m,_c:ht})),sn(F))try{F=F(ht)}catch(it){I=it,Q=!0}if(F&&wg(F))if(F=await F.catch(it=>{I=it,Q=!0}),X!==Y[R][0]){if(Q)throw I;return F}else Q&&K&&p(I)&&(h=!0,A({data:ht,_c:ge}));if(h&&!Q)if(sn(h)){const it=h(F,ht);A({data:it,error:ge,_c:ge})}else A({data:F,error:ge,_c:ge});if(Y[R][1]=$o(),Promise.resolve(H()).then(()=>{A({_c:ge})}),Q){if(v)throw I;return}return F}}const op=(a,u)=>{for(const i in a)a[i][0]&&a[i][0](u)},Cg=(a,u)=>{if(!Bn.has(a)){const i=Gn(AE,u),r=Object.create(null),o=Mg.bind(ge,a);let f=Hn;const h=Object.create(null),y=(v,S)=>{const _=h[v]||[];return h[v]=_,_.push(S),()=>_.splice(_.indexOf(S),1)},m=(v,S,_)=>{a.set(v,S);const R=h[v];if(R)for(const C of R)C(S,_)},p=()=>{if(!Bn.has(a)&&(Bn.set(a,[r,Object.create(null),Object.create(null),Object.create(null),o,m,y]),!Fl)){const v=i.initFocus(setTimeout.bind(ge,op.bind(ge,r,Tg))),S=i.initReconnect(setTimeout.bind(ge,op.bind(ge,r,Ag)));f=()=>{v&&v(),S&&S(),Bn.delete(a)}}};return p(),[a,o,p,f]}return[a,Bn.get(a)[4]]},CE=(a,u,i,r,o)=>{const f=i.errorRetryCount,h=o.retryCount,y=~~((Math.random()+.5)*(1<<(h<8?h:8)))*i.errorRetryInterval;!_t(f)&&h>f||setTimeout(r,y,o)},zE=Ko,[vf,DE]=Cg(new Map),zg=Gn({onLoadingSlow:Hn,onSuccess:Hn,onError:Hn,onErrorRetry:CE,onDiscarded:Hn,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:cp?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:cp?5e3:3e3,compare:zE,isPaused:()=>!1,cache:vf,mutate:DE,fallback:{}},TE),Dg=(a,u)=>{const i=Gn(a,u);if(u){const{use:r,fallback:o}=a,{use:f,fallback:h}=u;r&&f&&(i.use=r.concat(f)),o&&h&&(i.fallback=Gn(o,h))}return i},Io=$.createContext({}),LE=a=>{const{value:u}=a,i=$.useContext(Io),r=sn(u),o=$.useMemo(()=>r?u(i):u,[r,i,u]),f=$.useMemo(()=>r?o:Dg(i,o),[r,i,o]),h=o&&o.provider,y=$.useRef(ge);h&&!y.current&&(y.current=Cg(h(f.cache||vf),o));const m=y.current;return m&&(f.cache=m[0],f.mutate=m[1]),Ds(()=>{if(m)return m[2]&&m[2](),m[3]},[]),$.createElement(Io.Provider,Gn(a,{value:f}))},NE="$inf$",Lg=lu&&window.__SWR_DEVTOOLS_USE__,UE=Lg?window.__SWR_DEVTOOLS_USE__:[],BE=()=>{Lg&&(window.__SWR_DEVTOOLS_REACT__=qn)},jE=a=>sn(a[1])?[a[0],a[1],a[2]||{}]:[a[0],null,(a[1]===null?a[2]:a[1])||{}],HE=()=>{const a=$.useContext(Io);return $.useMemo(()=>Gn(zg,a),[a])},qE=a=>(u,i,r)=>a(u,i&&((...f)=>{const[h]=gf(u),[,,,y]=Bn.get(vf);if(h.startsWith(NE))return i(...f);const m=y[h];return _t(m)?i(...f):(delete y[h],m)}),r),VE=UE.concat(qE),YE=a=>function(...i){const r=HE(),[o,f,h]=jE(i),y=Dg(r,h);let m=a;const{use:p}=y,v=(p||[]).concat(VE);for(let S=v.length;S--;)m=v[S](m);return m(o,f||y.fetcher||null,y)},GE=(a,u,i)=>{const r=u[a]||(u[a]=[]);return r.push(i),()=>{const o=r.indexOf(i);o>=0&&(r[o]=r[r.length-1],r.pop())}};BE();const Ho=qn.use||(a=>{switch(a.status){case"pending":throw a;case"fulfilled":return a.value;case"rejected":throw a.reason;default:throw a.status="pending",a.then(u=>{a.status="fulfilled",a.value=u},u=>{a.status="rejected",a.reason=u}),a}}),qo={dedupe:!0},fp=Promise.resolve(ge),XE=()=>Hn,QE=(a,u,i)=>{const{cache:r,compare:o,suspense:f,fallbackData:h,revalidateOnMount:y,revalidateIfStale:m,refreshInterval:p,refreshWhenHidden:v,refreshWhenOffline:S,keepPreviousData:_,strictServerPrefetchWarning:R}=i,[C,A,M,Y]=Bn.get(r),[B,Z]=gf(a),H=$.useRef(!1),F=$.useRef(!1),I=$.useRef(B),Q=$.useRef(u),X=$.useRef(i),K=()=>X.current,rt=()=>K().isVisible()&&K().isOnline(),[nt,lt,ht,it]=xg(r,B),jt=$.useRef({}).current,N=_t(h)?_t(i.fallback)?ge:i.fallback[B]:h,P=(Et,Lt)=>{for(const At in jt){const qt=At;if(qt==="data"){if(!o(Et[qt],Lt[qt])&&(!_t(Et[qt])||!o(ot,Lt[qt])))return!1}else if(Lt[qt]!==Et[qt])return!1}return!0},ut=!H.current,Tt=$.useMemo(()=>{const Et=nt(),Lt=it(),At=Jt=>{const Vt=Gn(Jt);return delete Vt._k,(()=>{if(!B||!u||K().isPaused())return!1;if(ut&&!_t(y))return y;const Mt=_t(N)?Vt.data:N;return _t(Mt)||m})()?{isValidating:!0,isLoading:!0,...Vt}:Vt},qt=At(Et),ve=Et===Lt?qt:At(Lt);let oe=qt;return[()=>{const Jt=At(nt());return P(Jt,oe)?(oe.data=Jt.data,oe.isLoading=Jt.isLoading,oe.isValidating=Jt.isValidating,oe.error=Jt.error,oe):(oe=Jt,Jt)},()=>ve]},[r,B]),pt=ip.useSyncExternalStore($.useCallback(Et=>ht(B,(Lt,At)=>{P(At,Lt)||Et()}),[r,B]),Tt[0],Tt[1]),w=C[B]&&C[B].length>0,q=pt.data,J=_t(q)?N&&wg(N)?Ho(N):N:q,W=pt.error,ct=$.useRef(J),ot=_?_t(q)?_t(ct.current)?J:ct.current:q:J,ft=B&&_t(J),Xt=$.useRef(null);!Fl&&ip.useSyncExternalStore(XE,()=>(Xt.current=!1,Xt),()=>(Xt.current=!0,Xt));const Ht=Xt.current;R&&Ht&&!f&&ft&&console.warn(`Missing pre-initiated data for serialized key "${B}" during server-side rendering. Data fetching should be initiated on the server and provided to SWR via fallback data. You can set "strictServerPrefetchWarning: false" to disable this warning.`);const De=!B||!u||K().isPaused()||w&&!_t(W)?!1:ut&&!_t(y)?y:f?_t(J)?!1:m:_t(J)||m,Xe=ut&&De,Qn=_t(pt.isValidating)?Xe:pt.isValidating,Ta=_t(pt.isLoading)?Xe:pt.isLoading,_e=$.useCallback(async Et=>{const Lt=Q.current;if(!B||!Lt||F.current||K().isPaused())return!1;let At,qt,ve=!0;const oe=Et||{},Jt=!M[B]||!oe.dedupe,Vt=()=>rp?!F.current&&B===I.current&&H.current:B===I.current,yn={isValidating:!1,isLoading:!1},Mt=()=>{lt(yn)},$t=()=>{const fe=M[B];fe&&fe[1]===qt&&delete M[B]},ae={isValidating:!0};_t(nt().data)&&(ae.isLoading=!0);try{if(Jt&&(lt(ae),i.loadingTimeout&&_t(nt().data)&&setTimeout(()=>{ve&&Vt()&&K().onLoadingSlow(B,i)},i.loadingTimeout),M[B]=[Lt(Z),$o()]),[At,qt]=M[B],At=await At,Jt&&setTimeout($t,i.dedupingInterval),!M[B]||M[B][1]!==qt)return Jt&&Vt()&&K().onDiscarded(B),!1;yn.error=ge;const fe=A[B];if(!_t(fe)&&(qt<=fe[0]||qt<=fe[1]||fe[1]===0))return Mt(),Jt&&Vt()&&K().onDiscarded(B),!1;const Qe=nt().data;yn.data=o(Qe,At)?Qe:At,Jt&&Vt()&&K().onSuccess(At,B,i)}catch(fe){$t();const Qe=K(),{shouldRetryOnError:Wl}=Qe;Qe.isPaused()||(yn.error=fe,Jt&&Vt()&&(Qe.onError(fe,B,Qe),(Wl===!0||sn(Wl)&&Wl(fe))&&(!K().revalidateOnFocus||!K().revalidateOnReconnect||rt())&&Qe.onErrorRetry(fe,B,Qe,Is=>{const pn=C[B];pn&&pn[0]&&pn[0](up,Is)},{retryCount:(oe.retryCount||0)+1,dedupe:!0})))}return ve=!1,Mt(),!0},[B,r]),mn=$.useCallback((...Et)=>Mg(r,I.current,...Et),[]);if(Ds(()=>{Q.current=u,X.current=i,_t(q)||(ct.current=q)}),Ds(()=>{if(!B)return;const Et=_e.bind(ge,qo);let Lt=0;K().revalidateOnFocus&&(Lt=Date.now()+K().focusThrottleInterval);const qt=GE(B,C,(ve,oe={})=>{if(ve==Tg){const Jt=Date.now();K().revalidateOnFocus&&Jt>Lt&&rt()&&(Lt=Jt+K().focusThrottleInterval,Et())}else if(ve==Ag)K().revalidateOnReconnect&&rt()&&Et();else{if(ve==Og)return _e();if(ve==up)return _e(oe)}});return F.current=!1,I.current=B,H.current=!0,lt({_k:Z}),De&&(M[B]||(_t(J)||Fl?Et():OE(Et))),()=>{F.current=!0,qt()}},[B]),Ds(()=>{let Et;function Lt(){const qt=sn(p)?p(nt().data):p;qt&&Et!==-1&&(Et=setTimeout(At,qt))}function At(){!nt().error&&(v||K().isVisible())&&(S||K().isOnline())?_e(qo).then(Lt):Lt()}return Lt(),()=>{Et&&(clearTimeout(Et),Et=-1)}},[p,v,S,B]),$.useDebugValue(ot),f){if(!rp&&Fl&&ft)throw new Error("Fallback data is required when using Suspense in SSR.");ft&&(Q.current=u,X.current=i,F.current=!1);const Et=Y[B],Lt=!_t(Et)&&ft?mn(Et):fp;if(Ho(Lt),!_t(W)&&ft)throw W;const At=ft?_e(qo):fp;!_t(ot)&&ft&&(At.status="fulfilled",At.value=!0),Ho(At)}return{mutate:mn,get data(){return jt.data=!0,ot},get error(){return jt.error=!0,W},get isValidating(){return jt.isValidating=!0,Qn},get isLoading(){return jt.isLoading=!0,Ta}}},ZE=Qs.defineProperty(LE,"defaultValue",{value:zg}),_R=YE(QE),KE="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2024%2024'%20role='img'%20aria-label='Agent%20Inspector'%3e%3cg%20fill='none'%20stroke='%23f59e0b'%20stroke-width='1.5'%20stroke-linecap='round'%20stroke-linejoin='round'%20%3e%3cpath%20d='M5%2013%20C5%209%208%207%2012%207%20C16%207%2019%209%2019%2013%20C19%2016%2016%2018%2012%2018%20C8%2018%205%2016%205%2013%20Z'%20/%3e%3cpath%20d='M5%2011%20C3.5%209.5%201.5%2010%202%2012.5%20C2.5%2014%204%2013.5%205%2012.5'%20/%3e%3cpath%20d='M19%2011%20C20.5%209.5%2022.5%2010%2022%2012.5%20C21.5%2014%2020%2013.5%2019%2012.5'%20/%3e%3cline%20x1='10'%20y1='7'%20x2='9.5'%20y2='5'%20/%3e%3cline%20x1='14'%20y1='7'%20x2='14.5'%20y2='5'%20/%3e%3cline%20x1='6.5'%20y1='16'%20x2='4.5'%20y2='19.5'%20/%3e%3cline%20x1='9'%20y1='17.5'%20x2='8'%20y2='20.5'%20/%3e%3cline%20x1='15'%20y1='17.5'%20x2='16'%20y2='20.5'%20/%3e%3cline%20x1='17.5'%20y1='16'%20x2='19.5'%20y2='19.5'%20/%3e%3c/g%3e%3ccircle%20cx='9.5'%20cy='4.5'%20r='0.9'%20fill='%23f59e0b'%20/%3e%3ccircle%20cx='14.5'%20cy='4.5'%20r='0.9'%20fill='%23f59e0b'%20/%3e%3c/svg%3e",JE="/assets/index-Bcq8bZoK.css",Sf=B2({head:()=>({meta:[{charSet:"utf-8"},{name:"viewport",content:"width=device-width, initial-scale=1"},{title:"Agent Inspector"}],links:[{rel:"stylesheet",href:JE},{rel:"icon",type:"image/svg+xml",href:KE}]}),component:kE,notFoundComponent:FE});function kE(){return k.jsx(Ng,{children:k.jsx(gg,{})})}function FE(){return k.jsx(Ng,{children:k.jsx("main",{className:"min-h-screen bg-background text-foreground",children:k.jsx("div",{className:"mx-auto flex min-h-screen w-full max-w-3xl flex-col justify-center px-6 py-16",children:k.jsxs("div",{className:"border-border/70 bg-card/60 rounded-lg border p-8 shadow-sm",children:[k.jsx("div",{className:"text-muted-foreground font-mono text-xs uppercase tracking-wider",children:"404"}),k.jsx("h1",{className:"mt-3 text-2xl font-semibold",children:"Page not found"}),k.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."}),k.jsx("a",{href:"/",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 Ng({children:a}){return k.jsxs("html",{lang:"en",className:"dark",children:[k.jsx("head",{children:k.jsx(W2,{})}),k.jsxs("body",{children:[k.jsx(ZE,{value:{revalidateOnFocus:!1,revalidateIfStale:!1},children:a}),k.jsx($2,{})]})]})}const PE="modulepreload",WE=function(a){return"/"+a},dp={},Ug=function(u,i,r){let o=Promise.resolve();if(i&&i.length>0){let m=function(p){return Promise.all(p.map(v=>Promise.resolve(v).then(S=>({status:"fulfilled",value:S}),S=>({status:"rejected",reason:S}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),y=h?.nonce||h?.getAttribute("nonce");o=m(i.map(p=>{if(p=WE(p),p in dp)return;dp[p]=!0;const v=p.endsWith(".css"),S=v?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${S}`))return;const _=document.createElement("link");if(_.rel=v?"stylesheet":PE,v||(_.as="script"),_.crossOrigin="",_.href=p,y&&_.setAttribute("nonce",y),document.head.appendChild(_),v)return new Promise((R,C)=>{_.addEventListener("load",R),_.addEventListener("error",()=>C(new Error(`Unable to preload CSS for ${p}`)))})}))}function f(h){const y=new Event("vite:preloadError",{cancelable:!0});if(y.payload=h,window.dispatchEvent(y),!y.defaultPrevented)throw h}return o.then(h=>{for(const y of h||[])y.status==="rejected"&&f(y.reason);return u().catch(f)})},$E=()=>Ug(()=>import("./index-DBSbw8Gd.js"),__vite__mapDeps([0,1])),IE=Xs("/")({component:mg($E,"component")}),tR=/^[A-Za-z0-9_-]+$/;function eR(a){let u="";for(const i of a)u+=String.fromCharCode(i);return u}function nR(a){const u=new Uint8Array(a.length);for(let i=0;i<a.length;i++)u[i]=a.charCodeAt(i);return u}function Bg(a){const u=new TextEncoder().encode(a);return btoa(eR(u)).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function aR(a){if(a.startsWith("%"))return decodeURIComponent(a);if(!tR.test(a))return a;try{const i=a.padEnd(Math.ceil(a.length/4)*4,"=").replace(/-/g,"+").replace(/_/g,"/"),r=atob(i);return new TextDecoder().decode(nR(r))}catch{return a}}function ER(a){return`/session/${Bg(a)}`}const lR=()=>Ug(()=>import("./_sessionId-6fF5JpyQ.js"),__vite__mapDeps([2,1])),iR=Xs("/session/$sessionId")({component:mg(lR,"component"),parseParams:a=>({sessionId:aR(a.sessionId)}),stringifyParams:a=>({sessionId:Bg(a.sessionId)})}),uR=IE.update({id:"/",path:"/",getParentRoute:()=>Sf}),sR=iR.update({id:"/session/$sessionId",path:"/session/$sessionId",getParentRoute:()=>Sf}),rR={IndexRoute:uR,SessionSessionIdRoute:sR},cR=Sf._addFileChildren(rR);function oR(){const a=Q2({routeTree:cR,scrollRestoration:!1});return fR(a),a}function fR(a){Object.getOwnPropertyDescriptor(a,"stores")===void 0&&Object.defineProperty(a,"stores",{configurable:!0,value:{matches:{get:()=>a.state.matches}}})}async function dR(){const a=await oR();let u;return u=[],window.__TSS_START_OPTIONS__={serializationAdapters:u},u.push(gE),a.options.serializationAdapters&&u.push(...a.options.serializationAdapters),a.update({basepath:"",serializationAdapters:u}),a.state.matches.length||await tE(a),a}async function hR(){const a=await dR();return window.$_TSR?.h(),a}let Vo;function mR(){return Vo||(Vo=hR()),k.jsx(d2,{promise:Vo,children:a=>k.jsx(J2,{router:a})})}$.startTransition(()=>{cS.hydrateRoot(document,k.jsx($.StrictMode,{children:k.jsx(mR,{})}))});export{iR as R,Ug as _,HE as a,dg as b,yR as c,qn as d,aS as e,SR as f,hp as g,ER as h,k as j,$ as r,_R as u};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "./_libs/react.mjs";
|
|
2
|
-
import { P as ProxyViewerContainer } from "./_ssr/ProxyViewerContainer-
|
|
3
|
-
import { R as Route$B } from "./_ssr/router-
|
|
2
|
+
import { P as ProxyViewerContainer } from "./_ssr/ProxyViewerContainer-BEeF4V-C.mjs";
|
|
3
|
+
import { R as Route$B } from "./_ssr/router-C8DJ5pQZ.mjs";
|
|
4
4
|
import "./_libs/jszip.mjs";
|
|
5
5
|
import "./_libs/modelcontextprotocol__server.mjs";
|
|
6
6
|
import "./_libs/swr.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { g as getLogFormatAdapter, r as resolveLogFormat, a as getConversationId, c as cn, B as Badge, f as formatTokens, J as JsonViewerFromString, b as copyTextToClipboard } from "./ProxyViewerContainer-
|
|
3
|
-
import "./router-
|
|
2
|
+
import { g as getLogFormatAdapter, r as resolveLogFormat, a as getConversationId, c as cn, B as Badge, f as formatTokens, J as JsonViewerFromString, b as copyTextToClipboard } from "./ProxyViewerContainer-BEeF4V-C.mjs";
|
|
3
|
+
import "./router-C8DJ5pQZ.mjs";
|
|
4
4
|
import "../_libs/modelcontextprotocol__server.mjs";
|
|
5
5
|
import "../_libs/jszip.mjs";
|
|
6
6
|
import { X, ak as Rows3, al as Columns2, a6 as Minus, P as Plus, y as Pencil, f as ChevronRight, am as Equal, a as Check, c as Copy } from "../_libs/lucide-react.mjs";
|
package/.output/server/_ssr/{ProxyViewerContainer-Oe5Tr3C2.mjs → ProxyViewerContainer-BEeF4V-C.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports, a as React } from "../_libs/react.mjs";
|
|
2
|
-
import { I as InspectorGroupsListResponseSchema, C as CapturedLogSchema, D as DEFAULT_CAPTURE_MODE, a as DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS, b as DEFAULT_PROVIDER_TEST_TIMEOUT_SECONDS, c as DEFAULT_TIME_DISPLAY_FORMAT, d as RuntimeConfigSchema, p as packageJson, P as ProviderConfigSchema, g as apiFormatForPath, l as GroupEvidenceExportResultSchema, m as DeleteInspectorGroupResponseSchema, r as createPendingProviderTestResults, t as ProviderTestResultsSchema, u as createFailedProviderTestResults, M as MAX_SLOW_RESPONSE_THRESHOLD_SECONDS, v as MAX_PROVIDER_TEST_TIMEOUT_SECONDS, T as TimeDisplayFormatSchema, h as getSessionPath, f as parseOpenAIResponse, O as OpenAIRequestSchema, A as AnthropicResponseSchema$1, e as AnthropicRequestSchema, s as safeGetOwnProperty, w as resolveProviderContextWindow, j as AlertSummarySchema, k as AlertListResponseSchema, G as GroupEvidenceReadResponseSchema, q as maskApiKey, n as providerHasContextMetadata, o as findProviderModelMetadata, K as KnowledgeCandidateSchema, i as stripClaudeCodeBillingHeader, L as LogBodyChunkSchema, x as isPlainRecord } from "./router-
|
|
2
|
+
import { I as InspectorGroupsListResponseSchema, C as CapturedLogSchema, D as DEFAULT_CAPTURE_MODE, a as DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS, b as DEFAULT_PROVIDER_TEST_TIMEOUT_SECONDS, c as DEFAULT_TIME_DISPLAY_FORMAT, d as RuntimeConfigSchema, p as packageJson, P as ProviderConfigSchema, g as apiFormatForPath, l as GroupEvidenceExportResultSchema, m as DeleteInspectorGroupResponseSchema, r as createPendingProviderTestResults, t as ProviderTestResultsSchema, u as createFailedProviderTestResults, M as MAX_SLOW_RESPONSE_THRESHOLD_SECONDS, v as MAX_PROVIDER_TEST_TIMEOUT_SECONDS, T as TimeDisplayFormatSchema, h as getSessionPath, f as parseOpenAIResponse, O as OpenAIRequestSchema, A as AnthropicResponseSchema$1, e as AnthropicRequestSchema, s as safeGetOwnProperty, w as resolveProviderContextWindow, j as AlertSummarySchema, k as AlertListResponseSchema, G as GroupEvidenceReadResponseSchema, q as maskApiKey, n as providerHasContextMetadata, o as findProviderModelMetadata, K as KnowledgeCandidateSchema, i as stripClaudeCodeBillingHeader, L as LogBodyChunkSchema, x as isPlainRecord } from "./router-C8DJ5pQZ.mjs";
|
|
3
3
|
import { u as useSWR, a as useSWRConfig } from "../_libs/swr.mjs";
|
|
4
4
|
import { J as JSZip } from "../_libs/jszip.mjs";
|
|
5
5
|
import { c as clsx } from "../_libs/clsx.mjs";
|
|
@@ -1989,19 +1989,19 @@ function useCopyFeedback(text) {
|
|
|
1989
1989
|
return { copied, copy };
|
|
1990
1990
|
}
|
|
1991
1991
|
const LazyCompareDrawer = reactExports.lazy(
|
|
1992
|
-
() => import("./CompareDrawer-
|
|
1992
|
+
() => import("./CompareDrawer-DqQHO4tk.mjs").then((m) => ({ default: m.CompareDrawer }))
|
|
1993
1993
|
);
|
|
1994
1994
|
const LazyReplayDialog = reactExports.lazy(
|
|
1995
|
-
() => import("./ReplayDialog-
|
|
1995
|
+
() => import("./ReplayDialog-DUZbsd5x.mjs").then((m) => ({ default: m.ReplayDialog }))
|
|
1996
1996
|
);
|
|
1997
1997
|
const LazyRequestAnatomy = reactExports.lazy(
|
|
1998
|
-
() => import("./RequestAnatomy-
|
|
1998
|
+
() => import("./RequestAnatomy-DKuIxoBj.mjs").then((m) => ({ default: m.RequestAnatomy }))
|
|
1999
1999
|
);
|
|
2000
2000
|
const LazyResponseView = reactExports.lazy(
|
|
2001
|
-
() => import("./ResponseView-
|
|
2001
|
+
() => import("./ResponseView-BB9CYmTJ.mjs").then((m) => ({ default: m.ResponseView }))
|
|
2002
2002
|
);
|
|
2003
2003
|
const LazyStreamingChunkSequence = reactExports.lazy(
|
|
2004
|
-
() => import("./StreamingChunkSequence-
|
|
2004
|
+
() => import("./StreamingChunkSequence-CkY3uTjF.mjs").then((m) => ({
|
|
2005
2005
|
default: m.StreamingChunkSequence
|
|
2006
2006
|
}))
|
|
2007
2007
|
);
|
|
@@ -6450,14 +6450,22 @@ function summarizeGroup(group) {
|
|
|
6450
6450
|
missingStatusMembers
|
|
6451
6451
|
};
|
|
6452
6452
|
}
|
|
6453
|
-
function buildGroupMemberRows(group, exportResult) {
|
|
6453
|
+
function buildGroupMemberRows(group, exportResult, evidenceResponse = null) {
|
|
6454
6454
|
if (exportResult !== null && exportResult.group.id === group.id) {
|
|
6455
6455
|
return exportResult.members.map((exportMember) => ({
|
|
6456
6456
|
member: exportMember.member,
|
|
6457
|
-
exportMember
|
|
6457
|
+
exportMember,
|
|
6458
|
+
source: "export"
|
|
6458
6459
|
}));
|
|
6459
6460
|
}
|
|
6460
|
-
|
|
6461
|
+
if (evidenceResponse !== null && evidenceResponse.group.id === group.id && evidenceResponse.members !== null) {
|
|
6462
|
+
return evidenceResponse.members.map((exportMember) => ({
|
|
6463
|
+
member: exportMember.member,
|
|
6464
|
+
exportMember,
|
|
6465
|
+
source: "evidence"
|
|
6466
|
+
}));
|
|
6467
|
+
}
|
|
6468
|
+
return group.members.map((member) => ({ member, exportMember: null, source: "group" }));
|
|
6461
6469
|
}
|
|
6462
6470
|
function statusClassName(status) {
|
|
6463
6471
|
switch (status) {
|
|
@@ -6810,7 +6818,7 @@ function GroupDetails({
|
|
|
6810
6818
|
const exportedSummary = exportSummaryFor(group, exportResult, evidenceResponse);
|
|
6811
6819
|
const evidenceReport = evidenceReportFor(group, exportResult, evidenceResponse);
|
|
6812
6820
|
const evidence = evidenceFor(group, exportResult);
|
|
6813
|
-
const rows = buildGroupMemberRows(group, exportResult);
|
|
6821
|
+
const rows = buildGroupMemberRows(group, exportResult, evidenceResponse);
|
|
6814
6822
|
const isExporting = exportingGroupId === group.id;
|
|
6815
6823
|
const isDeleting = deletingGroupId === group.id;
|
|
6816
6824
|
const isConfirmingDelete = deleteTarget?.id === group.id;
|
|
@@ -7089,6 +7097,7 @@ function MemberRow({ row }) {
|
|
|
7089
7097
|
const session = row.exportMember?.session ?? null;
|
|
7090
7098
|
const log = latestLog(row);
|
|
7091
7099
|
const sessionPath = session?.inspectorPath ?? getSessionPath(member.sessionId);
|
|
7100
|
+
const canOpenLiveSession = row.source !== "evidence";
|
|
7092
7101
|
const requests = session?.requestCount ?? null;
|
|
7093
7102
|
const errors = session?.errorCount ?? null;
|
|
7094
7103
|
const tokens = session?.tokenUsage.total ?? null;
|
|
@@ -7096,7 +7105,7 @@ function MemberRow({ row }) {
|
|
|
7096
7105
|
const sessionLabel = firstNonEmpty(member.label, member.sessionId);
|
|
7097
7106
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("tr", { className: "border-b border-border last:border-0", children: [
|
|
7098
7107
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("td", { className: "max-w-56 px-3 py-2", children: [
|
|
7099
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7108
|
+
canOpenLiveSession ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7100
7109
|
"a",
|
|
7101
7110
|
{
|
|
7102
7111
|
href: sessionPath,
|
|
@@ -7110,6 +7119,16 @@ function MemberRow({ row }) {
|
|
|
7110
7119
|
/* @__PURE__ */ jsxRuntimeExports.jsx(ExternalLink, { className: "size-3 shrink-0 text-muted-foreground" })
|
|
7111
7120
|
]
|
|
7112
7121
|
}
|
|
7122
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
7123
|
+
"span",
|
|
7124
|
+
{
|
|
7125
|
+
className: "inline-flex max-w-full min-w-0 items-center gap-2 font-mono text-xs text-foreground",
|
|
7126
|
+
title: `Evidence snapshot for ${sessionLabel}`,
|
|
7127
|
+
children: [
|
|
7128
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "min-w-0 truncate", children: sessionLabel }),
|
|
7129
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Badge, { variant: "outline", className: "shrink-0 border-zinc-200 bg-zinc-50 text-zinc-600", children: "evidence" })
|
|
7130
|
+
]
|
|
7131
|
+
}
|
|
7113
7132
|
),
|
|
7114
7133
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-0.5 truncate text-[11px] text-muted-foreground", children: displayText(member.agent) })
|
|
7115
7134
|
] }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { u as useProviders, D as Dialog, d as DialogContent, e as DialogHeader, h as DialogTitle, T as Tabs, i as TabsList, j as TabsTrigger, k as TabsContent, l as Button, m as TooltipProvider, n as Tooltip, o as TooltipTrigger, p as TooltipContent, q as dispatchLogFocusRequest } from "./ProxyViewerContainer-
|
|
3
|
-
import { ResponseView } from "./ResponseView-
|
|
4
|
-
import { C as CapturedLogSchema } from "./router-
|
|
2
|
+
import { u as useProviders, D as Dialog, d as DialogContent, e as DialogHeader, h as DialogTitle, T as Tabs, i as TabsList, j as TabsTrigger, k as TabsContent, l as Button, m as TooltipProvider, n as Tooltip, o as TooltipTrigger, p as TooltipContent, q as dispatchLogFocusRequest } from "./ProxyViewerContainer-BEeF4V-C.mjs";
|
|
3
|
+
import { ResponseView } from "./ResponseView-BB9CYmTJ.mjs";
|
|
4
|
+
import { C as CapturedLogSchema } from "./router-C8DJ5pQZ.mjs";
|
|
5
5
|
import "../_libs/jszip.mjs";
|
|
6
6
|
import "../_libs/modelcontextprotocol__server.mjs";
|
|
7
7
|
import { a3 as RotateCcw, an as Braces, ao as Minimize2 } from "../_libs/lucide-react.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
|
|
2
|
-
import { u as useProviders, s as analyzeContextIntelligence, f as formatTokens, m as TooltipProvider, c as cn, n as Tooltip, o as TooltipTrigger, p as TooltipContent, S as SegmentBar, R as ROLE_COLOR_CLASSES, A as ANATOMY_ROLE_LABELS, t as formatContextWindowTokens, C as CONTEXT_USAGE_THRESHOLDS } from "./ProxyViewerContainer-
|
|
3
|
-
import "./router-
|
|
2
|
+
import { u as useProviders, s as analyzeContextIntelligence, f as formatTokens, m as TooltipProvider, c as cn, n as Tooltip, o as TooltipTrigger, p as TooltipContent, S as SegmentBar, R as ROLE_COLOR_CLASSES, A as ANATOMY_ROLE_LABELS, t as formatContextWindowTokens, C as CONTEXT_USAGE_THRESHOLDS } from "./ProxyViewerContainer-BEeF4V-C.mjs";
|
|
3
|
+
import "./router-C8DJ5pQZ.mjs";
|
|
4
4
|
import "../_libs/modelcontextprotocol__server.mjs";
|
|
5
5
|
import "../_libs/jszip.mjs";
|
|
6
6
|
import { I as Info, C as ChevronDown, f as ChevronRight } from "../_libs/lucide-react.mjs";
|