@tonyclaw/agent-inspector 2.0.4 → 2.0.6
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-BCH_fsLm.js → CompareDrawer-DDmqSAfl.js} +1 -1
- package/.output/public/assets/ProxyViewerContainer-Cxpdziwd.js +101 -0
- package/.output/public/assets/ReplayDialog-Bt5DGzlh.js +1 -0
- package/.output/public/assets/RequestAnatomy-BxX3_N9S.js +1 -0
- package/.output/public/assets/ResponseView-Bl_5S9gZ.js +1 -0
- package/.output/public/assets/StreamingChunkSequence-RJMwNf6F.js +1 -0
- package/.output/public/assets/_sessionId-b4isaoDp.js +1 -0
- package/.output/public/assets/index-BZ4x5UI6.js +1 -0
- package/.output/public/assets/{index-CobXD0yH.css → index-C624DUk9.css} +1 -1
- package/.output/public/assets/{json-viewer-BrzjD7qI.js → json-viewer-CRL_gWEZ.js} +1 -1
- package/.output/public/assets/{main-mgxeUdZQ.js → main-CKnTJ4-O.js} +6 -6
- package/.output/server/_libs/lucide-react.mjs +181 -114
- package/.output/server/{_sessionId-C4xsxIWm.mjs → _sessionId-B-x9fRY3.mjs} +3 -3
- package/.output/server/_ssr/{CompareDrawer-DuWEpqQ7.mjs → CompareDrawer-BQVNsAY2.mjs} +6 -6
- package/.output/server/_ssr/{ProxyViewerContainer-Cckz5qKu.mjs → ProxyViewerContainer-CYm2Dw19.mjs} +766 -122
- package/.output/server/_ssr/{ReplayDialog-BDRcr8E5.mjs → ReplayDialog-CaMQBc79.mjs} +240 -14
- package/.output/server/_ssr/{RequestAnatomy-BoO2_Ij0.mjs → RequestAnatomy--P5arRH2.mjs} +236 -66
- package/.output/server/_ssr/{ResponseView-DZiPBxvO.mjs → ResponseView-RtFwNvgD.mjs} +8 -8
- package/.output/server/_ssr/{StreamingChunkSequence-D-be7KEL.mjs → StreamingChunkSequence-B5HPkzab.mjs} +3 -3
- package/.output/server/_ssr/{index-5RImHKfu.mjs → index-CZIKZU43.mjs} +2 -2
- package/.output/server/_ssr/index.mjs +2 -2
- package/.output/server/_ssr/{json-viewer-aJhb93ZK.mjs → json-viewer-d4obyRaA.mjs} +3 -3
- package/.output/server/_ssr/{router-Dgkv5nKP.mjs → router-DGPt3MUc.mjs} +145 -71
- package/.output/server/_tanstack-start-manifest_v-BzH4pNaI.mjs +4 -0
- package/.output/server/index.mjs +64 -64
- package/package.json +1 -1
- package/src/components/OnboardingBanner.tsx +11 -19
- package/src/components/ProxyViewer.tsx +1 -1
- package/src/components/providers/ProviderCard.tsx +6 -20
- package/src/components/providers/SettingsDialog.tsx +95 -2
- package/src/components/proxy-viewer/AgentTraceSummary.tsx +639 -38
- package/src/components/proxy-viewer/CompareDrawer.tsx +4 -2
- package/src/components/proxy-viewer/LogEntry.tsx +4 -4
- package/src/components/proxy-viewer/LogEntryHeader.tsx +15 -25
- package/src/components/proxy-viewer/ReplayDialog.tsx +190 -8
- package/src/components/proxy-viewer/ResponseView.tsx +2 -2
- package/src/components/proxy-viewer/ToolTraceEvents.tsx +37 -16
- package/src/components/proxy-viewer/TurnGroup.tsx +14 -2
- package/src/components/proxy-viewer/anatomy/RequestAnatomy.tsx +196 -45
- package/src/components/proxy-viewer/anatomy/SegmentBar.tsx +92 -67
- package/src/components/proxy-viewer/anatomy/types.ts +15 -13
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +2 -2
- package/src/components/proxy-viewer/log-formats/anthropic.ts +1 -1
- package/src/components/proxy-viewer/log-formats/openai.ts +1 -1
- package/src/components/proxy-viewer/log-formats/types.ts +1 -1
- package/src/components/proxy-viewer/replayComparison.ts +131 -0
- package/src/components/proxy-viewer/useKeyboardNavigation.ts +64 -22
- package/src/components/proxy-viewer/viewerState.ts +14 -2
- package/src/components/ui/json-viewer.tsx +1 -1
- package/src/knowledge/candidateStore.ts +32 -1
- package/src/routes/api/knowledge.candidates.$candidateId.ts +50 -0
- package/src/routes/api/knowledge.sessions.$sessionId.candidates.ts +12 -2
- package/.output/public/assets/ProxyViewerContainer-D85_UANk.js +0 -101
- package/.output/public/assets/ReplayDialog-DTeaHHit.js +0 -1
- package/.output/public/assets/RequestAnatomy-DZ8grAih.js +0 -1
- package/.output/public/assets/ResponseView-Cldm6RCi.js +0 -1
- package/.output/public/assets/StreamingChunkSequence-3x4p-yT7.js +0 -1
- package/.output/public/assets/_sessionId-YqWFBu6d.js +0 -1
- package/.output/public/assets/index-BIw2H6jO.js +0 -1
- package/.output/server/_tanstack-start-manifest_v-B8rrWXjr.mjs +0 -4
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as e}from"./main-mgxeUdZQ.js";import{D as S,k as C,l as q,m as D,n as F,T as i,o as u,p as n,q as t,s as B,t as E,u as I,v as O,w as V,x as z,y as v,z as d,A as R}from"./ProxyViewerContainer-D85_UANk.js";import{ResponseView as h}from"./ResponseView-Cldm6RCi.js";import"./json-viewer-BrzjD7qI.js";const M=z({success:v(),error:R().optional(),responseStatus:d().optional(),responseText:R().optional(),inputTokens:d().optional(),outputTokens:d().optional(),elapsedMs:d().optional(),streaming:v().optional()});function H({log:a,open:y,onOpenChange:g}){const[j,w]=l.useState(()=>a.rawRequestBody??"{}"),[s,p]=l.useState(null),[f,c]=l.useState(!1),[x,r]=l.useState(null);async function k(){c(!0),r(null),p(null);try{const N=await(await fetch(`/api/logs/${a.id}/replay`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({modifiedBody:j})})).json(),T=M.safeParse(N);if(!T.success){r("Invalid response from server"),c(!1);return}const m=T.data;p(m),m.success||r(m.error??"Replay failed")}catch(o){r(o instanceof Error?o.message:"Network error")}finally{c(!1)}}function b(){p(null),r(null),g(!1)}return e.jsx(S,{open:y,onOpenChange:b,children:e.jsxs(C,{className:"max-w-4xl max-h-[85vh] overflow-auto",children:[e.jsx(q,{children:e.jsxs(D,{className:"flex items-center gap-2",children:[e.jsx(F,{className:"size-4"}),"Replay Request #",a.id]})}),e.jsxs(i,{defaultValue:"modified",children:[e.jsxs(u,{children:[e.jsx(n,{value:"modified",children:"Modified Request"}),e.jsx(n,{value:"original",children:"Original Response"}),s&&e.jsx(n,{value:"replay",children:"Replay Response"})]}),e.jsxs(t,{value:"modified",className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Request Body (JSON)"}),e.jsx(B,{children:e.jsxs(E,{children:[e.jsx(I,{asChild:!0,children:e.jsx("textarea",{className:"w-full h-64 p-3 font-mono text-xs bg-muted rounded-md border border-input resize-none focus:outline-none focus:ring-2 focus:ring-ring",value:j,onChange:o=>w(o.target.value),spellCheck:!1})}),e.jsx(O,{children:"Edit the request body before re-sending to the provider"})]})})]}),x!==null&&x!==""&&e.jsx("div",{className:"text-sm text-destructive bg-destructive/10 px-3 py-2 rounded-md",children:x}),e.jsx("div",{className:"flex justify-end",children:e.jsx(V,{onClick:()=>{k()},disabled:f,children:f?"Replaying...":"Replay"})}),s&&s.success&&e.jsxs(i,{defaultValue:"parsed",children:[e.jsxs(u,{children:[e.jsx(n,{value:"parsed",children:"Response"}),e.jsx(n,{value:"raw",children:"Raw Response"})]}),e.jsx(t,{value:"parsed",children:e.jsx(h,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:a.apiFormat})}),e.jsx(t,{value:"raw",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:s.responseText??"No response"})})]})]}),e.jsx(t,{value:"original",children:a.responseText!==null?e.jsxs(i,{defaultValue:"parsed",children:[e.jsxs(u,{children:[e.jsx(n,{value:"parsed",children:"Response"}),e.jsx(n,{value:"raw",children:"Raw Response"})]}),e.jsx(t,{value:"parsed",children:e.jsx(h,{responseText:a.responseText,responseStatus:a.responseStatus,streaming:a.streaming,inputTokens:a.inputTokens,outputTokens:a.outputTokens,cacheCreationInputTokens:a.cacheCreationInputTokens,cacheReadInputTokens:a.cacheReadInputTokens,apiFormat:a.apiFormat})}),e.jsx(t,{value:"raw",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:a.responseText})})]}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No original response"})}),s&&s.success&&e.jsx(t,{value:"replay",children:s.responseText!==null?e.jsxs(i,{defaultValue:"parsed",children:[e.jsxs(u,{children:[e.jsx(n,{value:"parsed",children:"Response"}),e.jsx(n,{value:"raw",children:"Raw Response"})]}),e.jsx(t,{value:"parsed",children:e.jsx(h,{responseText:s.responseText??null,responseStatus:s.responseStatus??null,streaming:s.streaming??!1,inputTokens:s.inputTokens??null,outputTokens:s.outputTokens??null,apiFormat:a.apiFormat})}),e.jsx(t,{value:"raw",children:e.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap bg-muted p-3 rounded-md max-h-96 overflow-auto",children:s.responseText})})]}):e.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No replay response"})})]})]})})}export{H as ReplayDialog};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as c,j as e}from"./main-mgxeUdZQ.js";import{c as _,f as i,s as $,t as j,u as y,b as k,v as N}from"./ProxyViewerContainer-D85_UANk.js";const S=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],R=_("info",S),z={system:"bg-sky-500/70",user:"bg-emerald-500/70",assistant:"bg-violet-500/70",tool:"bg-sky-400/55",tools:"bg-slate-500/70"},T={system:"focus-visible:ring-sky-300",user:"focus-visible:ring-emerald-300",assistant:"focus-visible:ring-violet-300",tool:"focus-visible:ring-sky-300",tools:"focus-visible:ring-slate-300"},g=12,h=1,M=80,I=24;function O(n){return n.length<=I?n:`${n.slice(0,I-1)}…`}function A(n){const s=n.replace(/\s+/g," ").trim();return s.length<=M?s:`${s.slice(0,M)}…`}const D=c.memo(function({segments:s,totalTokens:x,onActivate:u}){const r=c.useMemo(()=>x>0?x:s.reduce((t,l)=>t+l.size,0),[s,x]),o=s.slice(0,g),d=s.slice(g),f=d.reduce((t,l)=>t+l.size,0),a=d.length,m=g,C=m+a-1,w=a>0,L=c.useMemo(()=>o.reduce((t,l)=>t+l.size,0),[o]),E=c.useMemo(()=>`Request anatomy: ~${i(r)} tokens across ${s.length} segment${s.length===1?"":"s"}`,[s.length,r]);return s.length===0||r<=0?e.jsx("div",{role:"img","aria-label":E,className:"h-6"}):e.jsx($,{delayDuration:150,children:e.jsxs("div",{role:"img","aria-label":E,className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"relative flex h-6 w-full overflow-hidden rounded border border-border/40 bg-muted/30","data-testid":"anatomy-segment-bar",children:[o.map((t,l)=>{const b=r>0?t.size/r*100:0,v=Math.max(h,b);return e.jsxs(j,{children:[e.jsx(y,{asChild:!0,children:e.jsx("button",{type:"button",role:"button",tabIndex:0,onClick:()=>u?.(t),onKeyDown:p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),u?.(t))},"data-anatomy-path":t.path,"aria-label":`${t.label}, ~${i(t.size)} tokens`,className:k("h-full border-r border-background/80 last:border-r-0","opacity-90 hover:opacity-100 focus:opacity-100","focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background",z[t.role],T[t.role]),style:{width:`${v}%`}})}),e.jsxs(N,{side:"bottom",className:"max-w-sm text-xs p-2 space-y-0.5",children:[e.jsxs("div",{className:"font-semibold",children:[t.label," · ~",i(t.size)," tokens"]}),e.jsxs("div",{className:"text-muted-foreground",children:[t.characters.toLocaleString()," chars"]}),t.text.length>0&&e.jsx("div",{className:"text-muted-foreground/90 break-words whitespace-pre-wrap",children:A(t.text)})]})]},`${t.path}-${l}`)}),w&&e.jsxs(j,{children:[e.jsx(y,{asChild:!0,children:e.jsxs("div",{role:"img","aria-label":`${a} additional segments`,className:"flex h-full items-center justify-center bg-muted-foreground/30 px-1.5 text-[10px] font-mono text-background",style:{width:`${Math.max(h,f/r*100)}%`},children:["… +",a]})}),e.jsxs(N,{side:"bottom",className:"text-xs",children:[a," more segment",a===1?"":"s"," (indices"," ",m,"–",C,")"]})]})]}),e.jsxs("div",{className:"flex w-full gap-1 text-[10px] text-muted-foreground",children:[o.map((t,l)=>{const b=r>0?t.size/r*100:0,v=Math.max(h,b);return e.jsxs("div",{className:"flex flex-col gap-0.5 truncate",style:{width:`${v}%`},title:`${t.label} · ~${i(t.size)} tokens`,children:[e.jsx("span",{className:"truncate font-mono text-foreground/80",children:O(t.label)}),e.jsxs("span",{className:"truncate font-mono text-muted-foreground/70",children:["~",i(t.size)]})]},`label-${t.path}-${l}`)}),w&&e.jsxs("div",{className:"flex flex-col gap-0.5 truncate text-muted-foreground",style:{width:`${Math.max(h,f/r*100)}%`},children:[e.jsxs("span",{className:"truncate font-mono text-foreground/60",children:["… +",a]}),e.jsxs("span",{className:"truncate font-mono text-muted-foreground/60",children:["~",i(f)]})]})]}),L<r*.1&&e.jsx("div",{className:"h-0"})]})})}),P=.25;function V({parsed:n,inputTokens:s,onSegmentActivate:x,segments:u}){const r=c.useMemo(()=>u??null,[u]),o=c.useMemo(()=>(r??[]).reduce((a,m)=>a+m.size,0),[r]),d=c.useMemo(()=>r==null||s===null||o===0?!1:Math.abs(s-o)/Math.max(s,o)>=P,[s,r,o]),f=c.useMemo(()=>s===null?"text-muted-foreground":d?"text-amber-400":"text-muted-foreground",[s,d]);return r==null||r.length===0||n===null&&u===void 0?null:e.jsx($,{delayDuration:150,children:e.jsxs("div",{className:"px-4 py-3 space-y-2","data-testid":"anatomy-root",children:[e.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[e.jsxs("span",{className:"font-mono tabular-nums text-foreground",children:["~",i(o)," tokens"]}),s!==null&&e.jsxs("span",{className:k("font-mono tabular-nums",f),children:["(server: ",i(s),")"]}),d&&e.jsxs(j,{children:[e.jsx(y,{asChild:!0,children:e.jsx("button",{type:"button",className:"inline-flex items-center text-amber-400 hover:text-amber-300","aria-label":"Token estimate diverges from server",children:e.jsx(R,{className:"size-3.5"})})}),e.jsx(N,{className:"max-w-xs text-xs",children:"Bar uses a token estimate heuristic (~4 ASCII chars / token, ~1 CJK / emoji char per token). The server's reported value is the source of truth for cost."})]})]}),e.jsx(D,{segments:r,totalTokens:o,onActivate:x})]})})}export{V as RequestAnatomy};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as l,j as t}from"./main-mgxeUdZQ.js";import{c as ue,E as Me,F as _,G as We,H as C,I as D,J as P,K as me,L as he,N as Be,O as R,Q as Ve,b as X,S as Fe,B as E,U,h as Y,V as xe,Z as ee,f as w,g as Xe,W as Ue,Y as Ye}from"./ProxyViewerContainer-D85_UANk.js";import{M as $e,a as fe}from"./json-viewer-BrzjD7qI.js";const Ge=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]],pe=ue("circle-stop",Ge);const Je=[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]],ge=ue("terminal",Je);var $="Collapsible",[Ke]=he($),[qe,te]=Ke($),ve=l.forwardRef((e,n)=>{const{__scopeCollapsible:r,open:o,defaultOpen:s,disabled:a,onOpenChange:i,...c}=e,[d,u]=Me({prop:o,defaultProp:s??!1,onChange:i,caller:$});return t.jsx(qe,{scope:r,disabled:a,contentId:We(),open:d,onOpenToggle:l.useCallback(()=>u(m=>!m),[u]),children:t.jsx(_.div,{"data-state":re(d),"data-disabled":a?"":void 0,...c,ref:n})})});ve.displayName=$;var be="CollapsibleTrigger",Se=l.forwardRef((e,n)=>{const{__scopeCollapsible:r,...o}=e,s=te(be,r);return t.jsx(_.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":re(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...o,ref:n,onClick:C(e.onClick,s.onOpenToggle)})});Se.displayName=be;var ne="CollapsibleContent",je=l.forwardRef((e,n)=>{const{forceMount:r,...o}=e,s=te(ne,e.__scopeCollapsible);return t.jsx(D,{present:r||s.open,children:({present:a})=>t.jsx(Ze,{...o,ref:n,present:a})})});je.displayName=ne;var Ze=l.forwardRef((e,n)=>{const{__scopeCollapsible:r,present:o,children:s,...a}=e,i=te(ne,r),[c,d]=l.useState(o),u=l.useRef(null),m=P(n,u),x=l.useRef(0),h=x.current,f=l.useRef(0),v=f.current,y=i.open||c,A=l.useRef(y),b=l.useRef(void 0);return l.useEffect(()=>{const g=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(g)},[]),me(()=>{const g=u.current;if(g){b.current=b.current||{transitionDuration:g.style.transitionDuration,animationName:g.style.animationName},g.style.transitionDuration="0s",g.style.animationName="none";const T=g.getBoundingClientRect();x.current=T.height,f.current=T.width,A.current||(g.style.transitionDuration=b.current.transitionDuration,g.style.animationName=b.current.animationName),d(o)}},[i.open,o]),t.jsx(_.div,{"data-state":re(i.open),"data-disabled":i.disabled?"":void 0,id:i.contentId,hidden:!y,...a,ref:m,style:{"--radix-collapsible-content-height":h?`${h}px`:void 0,"--radix-collapsible-content-width":v?`${v}px`:void 0,...e.style},children:y&&s})});function re(e){return e?"open":"closed"}var Qe=ve;function et(e,n){return l.useReducer((r,o)=>n[r][o]??r,e)}var oe="ScrollArea",[we]=he(oe),[tt,S]=we(oe),Ne=l.forwardRef((e,n)=>{const{__scopeScrollArea:r,type:o="hover",dir:s,scrollHideDelay:a=600,...i}=e,[c,d]=l.useState(null),[u,m]=l.useState(null),[x,h]=l.useState(null),[f,v]=l.useState(null),[y,A]=l.useState(null),[b,g]=l.useState(0),[T,I]=l.useState(0),[H,O]=l.useState(!1),[M,W]=l.useState(!1),p=P(n,k=>d(k)),j=Be(s);return t.jsx(tt,{scope:r,type:o,dir:j,scrollHideDelay:a,scrollArea:c,viewport:u,onViewportChange:m,content:x,onContentChange:h,scrollbarX:f,onScrollbarXChange:v,scrollbarXEnabled:H,onScrollbarXEnabledChange:O,scrollbarY:y,onScrollbarYChange:A,scrollbarYEnabled:M,onScrollbarYEnabledChange:W,onCornerWidthChange:g,onCornerHeightChange:I,children:t.jsx(_.div,{dir:j,...i,ref:p,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":T+"px",...e.style}})})});Ne.displayName=oe;var ye="ScrollAreaViewport",_e=l.forwardRef((e,n)=>{const{__scopeScrollArea:r,children:o,nonce:s,...a}=e,i=S(ye,r),c=l.useRef(null),d=P(n,c,i.onViewportChange);return t.jsxs(t.Fragment,{children:[t.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),t.jsx(_.div,{"data-radix-scroll-area-viewport":"",...a,ref:d,style:{overflowX:i.scrollbarXEnabled?"scroll":"hidden",overflowY:i.scrollbarYEnabled?"scroll":"hidden",...e.style},children:t.jsx("div",{ref:i.onContentChange,style:{minWidth:"100%",display:"table"},children:o})})]})});_e.displayName=ye;var N="ScrollAreaScrollbar",Ce=l.forwardRef((e,n)=>{const{forceMount:r,...o}=e,s=S(N,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:i}=s,c=e.orientation==="horizontal";return l.useEffect(()=>(c?a(!0):i(!0),()=>{c?a(!1):i(!1)}),[c,a,i]),s.type==="hover"?t.jsx(nt,{...o,ref:n,forceMount:r}):s.type==="scroll"?t.jsx(rt,{...o,ref:n,forceMount:r}):s.type==="auto"?t.jsx(Re,{...o,ref:n,forceMount:r}):s.type==="always"?t.jsx(se,{...o,ref:n}):null});Ce.displayName=N;var nt=l.forwardRef((e,n)=>{const{forceMount:r,...o}=e,s=S(N,e.__scopeScrollArea),[a,i]=l.useState(!1);return l.useEffect(()=>{const c=s.scrollArea;let d=0;if(c){const u=()=>{window.clearTimeout(d),i(!0)},m=()=>{d=window.setTimeout(()=>i(!1),s.scrollHideDelay)};return c.addEventListener("pointerenter",u),c.addEventListener("pointerleave",m),()=>{window.clearTimeout(d),c.removeEventListener("pointerenter",u),c.removeEventListener("pointerleave",m)}}},[s.scrollArea,s.scrollHideDelay]),t.jsx(D,{present:r||a,children:t.jsx(Re,{"data-state":a?"visible":"hidden",...o,ref:n})})}),rt=l.forwardRef((e,n)=>{const{forceMount:r,...o}=e,s=S(N,e.__scopeScrollArea),a=e.orientation==="horizontal",i=J(()=>d("SCROLL_END"),100),[c,d]=et("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return l.useEffect(()=>{if(c==="idle"){const u=window.setTimeout(()=>d("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(u)}},[c,s.scrollHideDelay,d]),l.useEffect(()=>{const u=s.viewport,m=a?"scrollLeft":"scrollTop";if(u){let x=u[m];const h=()=>{const f=u[m];x!==f&&(d("SCROLL"),i()),x=f};return u.addEventListener("scroll",h),()=>u.removeEventListener("scroll",h)}},[s.viewport,a,d,i]),t.jsx(D,{present:r||c!=="hidden",children:t.jsx(se,{"data-state":c==="hidden"?"hidden":"visible",...o,ref:n,onPointerEnter:C(e.onPointerEnter,()=>d("POINTER_ENTER")),onPointerLeave:C(e.onPointerLeave,()=>d("POINTER_LEAVE"))})})}),Re=l.forwardRef((e,n)=>{const r=S(N,e.__scopeScrollArea),{forceMount:o,...s}=e,[a,i]=l.useState(!1),c=e.orientation==="horizontal",d=J(()=>{if(r.viewport){const u=r.viewport.offsetWidth<r.viewport.scrollWidth,m=r.viewport.offsetHeight<r.viewport.scrollHeight;i(c?u:m)}},10);return L(r.viewport,d),L(r.content,d),t.jsx(D,{present:o||a,children:t.jsx(se,{"data-state":a?"visible":"hidden",...s,ref:n})})}),se=l.forwardRef((e,n)=>{const{orientation:r="vertical",...o}=e,s=S(N,e.__scopeScrollArea),a=l.useRef(null),i=l.useRef(0),[c,d]=l.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),u=ke(c.viewport,c.content),m={...o,sizes:c,onSizesChange:d,hasThumb:u>0&&u<1,onThumbChange:h=>a.current=h,onThumbPointerUp:()=>i.current=0,onThumbPointerDown:h=>i.current=h};function x(h,f){return ct(h,i.current,c,f)}return r==="horizontal"?t.jsx(ot,{...m,ref:n,onThumbPositionChange:()=>{if(s.viewport&&a.current){const h=s.viewport.scrollLeft,f=ie(h,c,s.dir);a.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollLeft=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollLeft=x(h,s.dir))}}):r==="vertical"?t.jsx(st,{...m,ref:n,onThumbPositionChange:()=>{if(s.viewport&&a.current){const h=s.viewport.scrollTop,f=ie(h,c);a.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:h=>{s.viewport&&(s.viewport.scrollTop=h)},onDragScroll:h=>{s.viewport&&(s.viewport.scrollTop=x(h))}}):null}),ot=l.forwardRef((e,n)=>{const{sizes:r,onSizesChange:o,...s}=e,a=S(N,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),u=P(n,d,a.onScrollbarXChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),t.jsx(Pe,{"data-orientation":"horizontal",...s,ref:u,sizes:r,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":G(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.x),onDragScroll:m=>e.onDragScroll(m.x),onWheelScroll:(m,x)=>{if(a.viewport){const h=a.viewport.scrollLeft+m.deltaX;e.onWheelScroll(h),Oe(h,x)&&m.preventDefault()}},onResize:()=>{d.current&&a.viewport&&i&&o({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:d.current.clientWidth,paddingStart:V(i.paddingLeft),paddingEnd:V(i.paddingRight)}})}})}),st=l.forwardRef((e,n)=>{const{sizes:r,onSizesChange:o,...s}=e,a=S(N,e.__scopeScrollArea),[i,c]=l.useState(),d=l.useRef(null),u=P(n,d,a.onScrollbarYChange);return l.useEffect(()=>{d.current&&c(getComputedStyle(d.current))},[d]),t.jsx(Pe,{"data-orientation":"vertical",...s,ref:u,sizes:r,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":G(r)+"px",...e.style},onThumbPointerDown:m=>e.onThumbPointerDown(m.y),onDragScroll:m=>e.onDragScroll(m.y),onWheelScroll:(m,x)=>{if(a.viewport){const h=a.viewport.scrollTop+m.deltaY;e.onWheelScroll(h),Oe(h,x)&&m.preventDefault()}},onResize:()=>{d.current&&a.viewport&&i&&o({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:d.current.clientHeight,paddingStart:V(i.paddingTop),paddingEnd:V(i.paddingBottom)}})}})}),[lt,Ee]=we(N),Pe=l.forwardRef((e,n)=>{const{__scopeScrollArea:r,sizes:o,hasThumb:s,onThumbChange:a,onThumbPointerUp:i,onThumbPointerDown:c,onThumbPositionChange:d,onDragScroll:u,onWheelScroll:m,onResize:x,...h}=e,f=S(N,r),[v,y]=l.useState(null),A=P(n,p=>y(p)),b=l.useRef(null),g=l.useRef(""),T=f.viewport,I=o.content-o.viewport,H=R(m),O=R(d),M=J(x,10);function W(p){if(b.current){const j=p.clientX-b.current.left,k=p.clientY-b.current.top;u({x:j,y:k})}}return l.useEffect(()=>{const p=j=>{const k=j.target;v?.contains(k)&&H(j,I)};return document.addEventListener("wheel",p,{passive:!1}),()=>document.removeEventListener("wheel",p,{passive:!1})},[T,v,I,H]),l.useEffect(O,[o,O]),L(v,M),L(f.content,M),t.jsx(lt,{scope:r,scrollbar:v,hasThumb:s,onThumbChange:R(a),onThumbPointerUp:R(i),onThumbPositionChange:O,onThumbPointerDown:R(c),children:t.jsx(_.div,{...h,ref:A,style:{position:"absolute",...h.style},onPointerDown:C(e.onPointerDown,p=>{p.button===0&&(p.target.setPointerCapture(p.pointerId),b.current=v.getBoundingClientRect(),g.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),W(p))}),onPointerMove:C(e.onPointerMove,W),onPointerUp:C(e.onPointerUp,p=>{const j=p.target;j.hasPointerCapture(p.pointerId)&&j.releasePointerCapture(p.pointerId),document.body.style.webkitUserSelect=g.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),B="ScrollAreaThumb",Ae=l.forwardRef((e,n)=>{const{forceMount:r,...o}=e,s=Ee(B,e.__scopeScrollArea);return t.jsx(D,{present:r||s.hasThumb,children:t.jsx(at,{ref:n,...o})})}),at=l.forwardRef((e,n)=>{const{__scopeScrollArea:r,style:o,...s}=e,a=S(B,r),i=Ee(B,r),{onThumbPositionChange:c}=i,d=P(n,x=>i.onThumbChange(x)),u=l.useRef(void 0),m=J(()=>{u.current&&(u.current(),u.current=void 0)},100);return l.useEffect(()=>{const x=a.viewport;if(x){const h=()=>{if(m(),!u.current){const f=dt(x,c);u.current=f,c()}};return c(),x.addEventListener("scroll",h),()=>x.removeEventListener("scroll",h)}},[a.viewport,m,c]),t.jsx(_.div,{"data-state":i.hasThumb?"visible":"hidden",...s,ref:d,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...o},onPointerDownCapture:C(e.onPointerDownCapture,x=>{const f=x.target.getBoundingClientRect(),v=x.clientX-f.left,y=x.clientY-f.top;i.onThumbPointerDown({x:v,y})}),onPointerUp:C(e.onPointerUp,i.onThumbPointerUp)})});Ae.displayName=B;var le="ScrollAreaCorner",Te=l.forwardRef((e,n)=>{const r=S(le,e.__scopeScrollArea),o=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&o?t.jsx(it,{...e,ref:n}):null});Te.displayName=le;var it=l.forwardRef((e,n)=>{const{__scopeScrollArea:r,...o}=e,s=S(le,r),[a,i]=l.useState(0),[c,d]=l.useState(0),u=!!(a&&c);return L(s.scrollbarX,()=>{const m=s.scrollbarX?.offsetHeight||0;s.onCornerHeightChange(m),d(m)}),L(s.scrollbarY,()=>{const m=s.scrollbarY?.offsetWidth||0;s.onCornerWidthChange(m),i(m)}),u?t.jsx(_.div,{...o,ref:n,style:{width:a,height:c,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function V(e){return e?parseInt(e,10):0}function ke(e,n){const r=e/n;return isNaN(r)?0:r}function G(e){const n=ke(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=(e.scrollbar.size-r)*n;return Math.max(o,18)}function ct(e,n,r,o="ltr"){const s=G(r),a=s/2,i=n||a,c=s-i,d=r.scrollbar.paddingStart+i,u=r.scrollbar.size-r.scrollbar.paddingEnd-c,m=r.content-r.viewport,x=o==="ltr"?[0,m]:[m*-1,0];return Le([d,u],x)(e)}function ie(e,n,r="ltr"){const o=G(n),s=n.scrollbar.paddingStart+n.scrollbar.paddingEnd,a=n.scrollbar.size-s,i=n.content-n.viewport,c=a-o,d=r==="ltr"?[0,i]:[i*-1,0],u=Ve(e,d);return Le([0,i],[0,c])(u)}function Le(e,n){return r=>{if(e[0]===e[1]||n[0]===n[1])return n[0];const o=(n[1]-n[0])/(e[1]-e[0]);return n[0]+o*(r-e[0])}}function Oe(e,n){return e>0&&e<n}var dt=(e,n=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},o=0;return(function s(){const a={left:e.scrollLeft,top:e.scrollTop},i=r.left!==a.left,c=r.top!==a.top;(i||c)&&n(),r=a,o=window.requestAnimationFrame(s)})(),()=>window.cancelAnimationFrame(o)};function J(e,n){const r=R(e),o=l.useRef(0);return l.useEffect(()=>()=>window.clearTimeout(o.current),[]),l.useCallback(()=>{window.clearTimeout(o.current),o.current=window.setTimeout(r,n)},[r,n])}function L(e,n){const r=R(n);me(()=>{let o=0;if(e){const s=new ResizeObserver(()=>{cancelAnimationFrame(o),o=window.requestAnimationFrame(r)});return s.observe(e),()=>{window.cancelAnimationFrame(o),s.unobserve(e)}}},[e,r])}var ut=Ne,mt=_e,ht=Te,xt="Separator",ce="horizontal",ft=["horizontal","vertical"],ze=l.forwardRef((e,n)=>{const{decorative:r,orientation:o=ce,...s}=e,a=pt(o)?o:ce,c=r?{role:"none"}:{"aria-orientation":a==="vertical"?a:void 0,role:"separator"};return t.jsx(_.div,{"data-orientation":a,...c,...s,ref:n})});ze.displayName=xt;function pt(e){return ft.includes(e)}var gt=ze;const vt="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 K({text:e}){return t.jsx("div",{className:vt,children:t.jsx($e,{children:e})})}function De({className:e,orientation:n="horizontal",decorative:r=!0,...o}){return t.jsx(gt,{"data-slot":"separator",decorative:r,orientation:n,className:X("bg-border shrink-0 data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",e),...o})}function q({...e}){return t.jsx(Qe,{"data-slot":"collapsible",...e})}function Z({...e}){return t.jsx(Se,{"data-slot":"collapsible-trigger",...e})}function Q({...e}){return t.jsx(je,{"data-slot":"collapsible-content",...e})}function ae({className:e,children:n,...r}){return t.jsxs(ut,{"data-slot":"scroll-area",className:X("relative",e),...r,children:[t.jsx(mt,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:n}),t.jsx(bt,{}),t.jsx(ht,{})]})}function bt({className:e,orientation:n="vertical",...r}){return t.jsx(Ce,{"data-slot":"scroll-area-scrollbar",orientation:n,className:X("flex touch-none p-px transition-colors select-none",n==="vertical"&&"h-full w-2.5 border-l border-l-transparent",n==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:t.jsx(Ae,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}const St=/<think>([\s\S]*?)<\/think>/gi,jt=/<think>([\s\S]*?)<\/think>/i;function Ie(e){const n=jt.exec(e);if(!n||n[1]===void 0)return{thinking:null,remainingText:e};const r=n[1].trim(),o=e.replace(St,"").trim();return{thinking:r,remainingText:o}}function wt(e){return t.jsx(t.Fragment,{})}function Nt({text:e}){const[n,r]=l.useState(!1);return t.jsxs(q,{open:n,onOpenChange:r,children:[t.jsxs(Z,{className:"flex items-center gap-1.5 py-0.5 cursor-pointer hover:opacity-80 transition-opacity group",children:[n?t.jsx(U,{className:"size-3 text-muted-foreground"}):t.jsx(Y,{className:"size-3 text-muted-foreground"}),t.jsx("span",{className:"text-muted-foreground text-xs italic select-none opacity-60",children:"[system-reminder]"})]}),t.jsx(Q,{children:t.jsx("div",{className:"pl-4 pt-1",children:t.jsx(K,{text:e})})})]})}const yt=l.memo(function({text:n}){if(n.includes("<system-reminder>"))return t.jsx(Nt,{text:n});const{thinking:r,remainingText:o}=Ie(n);return t.jsxs("div",{className:"space-y-2",children:[r!==null&&t.jsx(F,{thinking:r}),o.length>0&&t.jsx(K,{text:o}),r===null&&o.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty text block"})]})}),F=l.memo(function({thinking:n}){const[r,o]=l.useState(!1);return t.jsx(q,{open:r,onOpenChange:o,children:t.jsxs("div",{className:"border-l-2 border-purple-500/40 my-1",children:[t.jsxs(Z,{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:[t.jsx(Fe,{className:"size-3.5 text-purple-400 shrink-0"}),t.jsx("span",{className:"text-xs font-medium text-purple-400",children:"Thinking"}),t.jsxs(E,{variant:"ghost",className:"text-[10px] text-muted-foreground px-1.5 py-0 h-4 font-mono",children:[n.length.toLocaleString()," chars"]}),t.jsx("span",{className:"flex-1"}),r?t.jsx(U,{className:"size-3 text-muted-foreground"}):t.jsx(Y,{className:"size-3 text-muted-foreground"})]}),t.jsx(Q,{children:t.jsx("div",{className:"px-3 pb-2",children:t.jsx(ae,{className:"max-h-[60vh]",children:t.jsx("pre",{className:"text-xs text-muted-foreground whitespace-pre-wrap font-mono leading-relaxed",children:n})})})})]})})}),_t=l.memo(function({name:n,input:r}){const[o,s]=l.useState(!1);return t.jsx(q,{open:o,onOpenChange:s,children:t.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1",children:[t.jsxs(Z,{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:[t.jsx(ge,{className:"size-3.5 text-sky-400/70 shrink-0"}),t.jsx(E,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:n}),t.jsx("span",{className:"flex-1"}),o?t.jsx(U,{className:"size-3 text-muted-foreground"}):t.jsx(Y,{className:"size-3 text-muted-foreground"})]}),t.jsx(Q,{children:t.jsx("div",{className:"px-3 pb-2",children:t.jsx(ae,{className:"max-h-[60vh]",children:t.jsx(fe,{data:xe(r),defaultExpandDepth:0})})})})]})})}),Ct=l.memo(function({block:n}){switch(n.type){case"text":return t.jsx(yt,{text:n.text});case"thinking":case"think":return t.jsx(F,{thinking:n.thinking});case"tool_use":return t.jsx(_t,{name:n.name,input:n.input});default:return wt()}}),Rt=l.memo(function({response:n}){return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(E,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:n.model}),n.stop_reason!==null&&t.jsxs(E,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[t.jsx(pe,{className:"size-2.5"}),n.stop_reason]}),t.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[t.jsx(ee,{className:"size-3"}),t.jsxs("span",{className:"font-mono tabular-nums",children:[w(n.usage.input_tokens??0)," in /"," ",w(n.usage.output_tokens??0)," out"]}),n.usage.cache_creation_input_tokens!==void 0&&n.usage.cache_creation_input_tokens!==null&&n.usage.cache_creation_input_tokens>0&&t.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",w(n.usage.cache_creation_input_tokens)]}),n.usage.cache_read_input_tokens!==void 0&&n.usage.cache_read_input_tokens!==null&&n.usage.cache_read_input_tokens>0&&t.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",w(n.usage.cache_read_input_tokens)]})]})]}),t.jsx(De,{className:"opacity-50"}),t.jsxs("div",{className:"space-y-2",children:[n.content.map((r,o)=>t.jsx(Ct,{block:r},o)),n.content.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function Et(e){if(e===void 0||e==="")return{};try{return JSON.parse(e)}catch{return null}}function Pt({call:e}){const[n,r]=l.useState(!1),o=e.function.name??"(unnamed tool)",s=Et(e.function.arguments);return t.jsx(q,{open:n,onOpenChange:r,children:t.jsxs("div",{className:"border-l-2 border-sky-400/25 my-1",children:[t.jsxs(Z,{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:[t.jsx(ge,{className:"size-3.5 text-sky-400/70 shrink-0"}),t.jsx(E,{variant:"outline",className:"text-[10px] font-mono px-1.5 py-0 h-4",children:o}),e.id!==void 0&&e.id!==""&&t.jsx("span",{className:"text-[10px] font-mono text-muted-foreground/60 truncate",children:e.id}),t.jsx("span",{className:"flex-1"}),n?t.jsx(U,{className:"size-3 text-muted-foreground"}):t.jsx(Y,{className:"size-3 text-muted-foreground"})]}),t.jsx(Q,{children:t.jsx("div",{className:"px-3 pb-2",children:t.jsx(ae,{className:"max-h-[60vh]",children:s===null?t.jsx("pre",{className:"font-mono text-xs whitespace-pre-wrap break-words text-rose-300/90",children:e.function.arguments}):t.jsx(fe,{data:xe(s),defaultExpandDepth:0})})})})]})})}const At=l.memo(function({response:n}){const r=n.choices[0],o=r?.message,s=o?.tool_calls??[];return t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[t.jsx(E,{variant:"secondary",className:"text-[10px] px-1.5 py-0 h-5 font-mono",children:n.model}),r?.finish_reason!==null&&r?.finish_reason!==void 0&&t.jsxs(E,{variant:"outline",className:"text-[10px] px-1.5 py-0 h-5 font-mono flex items-center gap-1",children:[t.jsx(pe,{className:"size-2.5"}),r.finish_reason]}),t.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[t.jsx(ee,{className:"size-3"}),t.jsxs("span",{className:"font-mono tabular-nums",children:[w(n.usage.prompt_tokens??0)," in /"," ",w(n.usage.completion_tokens??0)," out"]})]})]}),t.jsx(De,{className:"opacity-50"}),t.jsxs("div",{className:"space-y-2",children:[o?.reasoning_content!==null&&o?.reasoning_content!==void 0&&o.reasoning_content.length>0&&t.jsx(F,{thinking:o.reasoning_content}),o?.content!==null&&o?.content!==void 0&&o.content.length>0&&(()=>{const a=o.reasoning_content!==null&&o.reasoning_content!==void 0&&o.reasoning_content.length>0,{thinking:i,remainingText:c}=Ie(o.content);return t.jsxs("div",{className:"space-y-2",children:[i!==null&&!a&&t.jsx(F,{thinking:i}),c.length>0&&t.jsx(K,{text:c})]})})(),s.map((a,i)=>t.jsx(Pt,{call:a},a.id??`tc-${i}`)),o?.function_call!==null&&o?.function_call!==void 0&&t.jsxs("div",{className:"border border-sky-400/20 rounded-md p-3 bg-muted/20",children:[t.jsx("div",{className:"text-xs text-sky-400/80 font-mono mb-1",children:"function_call"}),t.jsxs("div",{className:"font-mono text-xs",children:[t.jsx("span",{className:"text-foreground/80",children:o.function_call.name}),t.jsxs("span",{className:"text-muted-foreground",children:["(",o.function_call.arguments,")"]})]})]}),(o?.content===null||o?.content===void 0||o.content.length===0)&&(o?.reasoning_content===null||o?.reasoning_content===void 0||o.reasoning_content.length===0)&&(o?.function_call===null||o?.function_call===void 0)&&s.length===0&&t.jsx("p",{className:"text-xs text-muted-foreground italic",children:"Empty response content"})]})]})});function He(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Tt(e){return He(e)&&e.object==="chat.completion"}function kt(e){return He(e)&&e.type==="message"&&Array.isArray(e.content)}function Lt(e,n){return e==="openai"&&Tt(n)?t.jsx(At,{response:n}):e==="anthropic"&&kt(n)?t.jsx(Rt,{response:n}):null}function Ot(e){switch(e){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 z({status:e}){const n=Ye(e),r=Ot(n);return e===null?t.jsx("span",{className:"text-xs text-muted-foreground italic",children:"pending"}):t.jsxs("span",{className:X("flex items-center gap-1 text-xs font-mono font-semibold",r),children:[n==="server_error"&&t.jsx(Ue,{className:"size-3"}),e]})}function de({text:e}){return t.jsx("div",{className:"rounded-md border border-red-500/30 bg-red-500/5 p-3",children:t.jsx("pre",{className:"text-xs text-red-300 whitespace-pre-wrap font-mono leading-relaxed overflow-auto max-h-[60vh]",children:e})})}function zt({text:e}){return t.jsx(K,{text:e})}const Wt=l.memo(function({responseText:n,responseStatus:r,streaming:o,inputTokens:s,outputTokens:a,cacheCreationInputTokens:i,cacheReadInputTokens:c,apiFormat:d,error:u}){const m=d??"unknown",x=l.useMemo(()=>Xe(m).analyzeResponse(n).parsed,[m,n]);return n===null&&u===void 0?t.jsxs("div",{className:"flex items-center gap-2 py-3",children:[t.jsx(z,{status:r}),t.jsx("span",{className:"text-xs text-muted-foreground italic",children:"No response"})]}):r!==null&&r>=400?t.jsxs("div",{className:"space-y-2",children:[t.jsx(z,{status:r}),t.jsx(de,{text:n??""}),u!=null&&t.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[t.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),t.jsx("div",{className:"text-muted-foreground font-mono",children:u})]})]}):u!=null?t.jsxs("div",{className:"space-y-2",children:[t.jsx(z,{status:r}),t.jsxs("div",{className:"rounded border border-destructive/50 bg-destructive/10 p-3 text-xs",children:[t.jsx("div",{className:"font-semibold text-destructive mb-1",children:"SSE Error"}),t.jsx("div",{className:"text-muted-foreground font-mono",children:u})]}),n!==null&&t.jsx("div",{className:"mt-2",children:t.jsx(de,{text:n})})]}):x!==null?t.jsxs("div",{className:"space-y-2",children:[t.jsx(z,{status:r}),Lt(m,x)]}):t.jsxs("div",{className:"space-y-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(z,{status:r}),o&&(s!==null||a!==null)&&t.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-xs",children:[t.jsx(ee,{className:"size-3"}),t.jsxs("span",{className:"font-mono tabular-nums",children:[s!==null?w(s):"—"," in /"," ",a!==null?w(a):"—"," out"]}),i!=null&&i>0&&t.jsxs("span",{className:"font-mono tabular-nums text-emerald-400",children:["Cache +",w(i)]}),c!=null&&c>0&&t.jsxs("span",{className:"font-mono tabular-nums text-purple-400",children:["Cache ~",w(c)]})]})]}),t.jsx(zt,{text:n??""})]})});export{Wt as ResponseView};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as a,j as e}from"./main-mgxeUdZQ.js";import{s as j,t as v,u as b,U as u,h as l,B as N,v as k,_ as S}from"./ProxyViewerContainer-D85_UANk.js";import{a as y}from"./json-viewer-BrzjD7qI.js";const T=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(S,{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(u,{className:"size-3 text-muted-foreground"}):e.jsx(l,{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(y,{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(u,{className:"size-3"}):e.jsx(l,{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{T as StreamingChunkSequence};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{R as s,j as e}from"./main-mgxeUdZQ.js";import{P as i}from"./ProxyViewerContainer-D85_UANk.js";function t(){const{sessionId:o}=s.useParams();return e.jsx(i,{initialSessionId:o},o)}export{t as component};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{P as o}from"./ProxyViewerContainer-D85_UANk.js";import"./main-mgxeUdZQ.js";const r=o;export{r as component};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
const tsrStartManifest = () => ({ "routes": { "__root__": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/__root.tsx", "children": ["/", "/api/config", "/api/health", "/api/logs", "/api/mcp", "/api/models", "/api/providers", "/api/sessions", "/proxy/$", "/session/$sessionId", "/api/knowledge/candidates", "/api/knowledge/project-context", "/api/knowledge/search", "/api/knowledge/sessions/$sessionId/candidates"], "preloads": ["/assets/main-mgxeUdZQ.js"], "assets": [] }, "/": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/index.tsx", "assets": [], "preloads": ["/assets/index-BIw2H6jO.js", "/assets/ProxyViewerContainer-D85_UANk.js"] }, "/api/config": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/config.ts", "children": ["/api/config/paths"] }, "/api/health": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/health.ts" }, "/api/logs": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.ts", "children": ["/api/logs/$id", "/api/logs/stream"] }, "/api/mcp": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/mcp.ts" }, "/api/models": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/models.ts" }, "/api/providers": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.ts", "children": ["/api/providers/$providerId", "/api/providers/export", "/api/providers/import", "/api/providers/scan"] }, "/api/sessions": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/sessions.ts" }, "/proxy/$": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/proxy/$.ts" }, "/session/$sessionId": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/session/$sessionId.tsx", "assets": [], "preloads": ["/assets/_sessionId-YqWFBu6d.js", "/assets/ProxyViewerContainer-D85_UANk.js"] }, "/api/config/paths": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/config.paths.ts" }, "/api/knowledge/candidates": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.candidates.ts", "children": ["/api/knowledge/candidates/$candidateId/promote"] }, "/api/knowledge/project-context": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.project-context.ts" }, "/api/knowledge/search": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.search.ts" }, "/api/logs/$id": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.$id.ts", "children": ["/api/logs/$id/chunks", "/api/logs/$id/replay"] }, "/api/logs/stream": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.stream.ts" }, "/api/providers/$providerId": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.ts", "children": ["/api/providers/$providerId/test"] }, "/api/providers/export": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.export.ts" }, "/api/providers/import": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.import.ts" }, "/api/providers/scan": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.scan.ts" }, "/api/logs/$id/chunks": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.$id.chunks.ts" }, "/api/logs/$id/replay": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/logs.$id.replay.ts" }, "/api/providers/$providerId/test": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.test.ts", "children": ["/api/providers/$providerId/test/log"] }, "/api/knowledge/candidates/$candidateId/promote": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.candidates.$candidateId.promote.ts" }, "/api/knowledge/sessions/$sessionId/candidates": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/knowledge.sessions.$sessionId.candidates.ts" }, "/api/providers/$providerId/test/log": { "filePath": "C:/Users/claw/workspace/agent-inspector/src/routes/api/providers.$providerId.test.log.ts" } }, "clientEntry": "/assets/main-mgxeUdZQ.js" });
|
|
2
|
-
export {
|
|
3
|
-
tsrStartManifest
|
|
4
|
-
};
|