@seqyuan/annovibe 0.8.142 → 0.8.143
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/.next/BUILD_ID +1 -1
- package/.next/app-path-routes-manifest.json +11 -11
- package/.next/build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/react-loadable-manifest.json +16 -16
- package/.next/required-server-files.js +1 -1
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/agent/runtime/route.js +1 -1
- package/.next/server/app/api/internal/runtime/route.js +1 -1
- package/.next/server/app/api/version/route.js +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +4 -4
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/index.segments/_full.segment.rsc +4 -4
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login.html +1 -1
- package/.next/server/app/login.rsc +1 -1
- package/.next/server/app/login.segments/_full.segment.rsc +1 -1
- package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/page.js +13 -13
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/session-stream/page.js +1 -1
- package/.next/server/app/smoke/session-stream/page_client-reference-manifest.js +1 -1
- package/.next/server/app/smoke/session-stream.html +1 -1
- package/.next/server/app/smoke/session-stream.rsc +4 -4
- package/.next/server/app/smoke/session-stream.segments/_full.segment.rsc +4 -4
- package/.next/server/app/smoke/session-stream.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/smoke/session-stream.segments/smoke/session-stream/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/smoke.html +2 -2
- package/.next/server/app/smoke.rsc +1 -1
- package/.next/server/app/smoke.segments/_full.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/smoke.segments/smoke/__PAGE__.segment.rsc +1 -1
- package/.next/server/app-paths-manifest.json +11 -11
- package/.next/server/chunks/7699.js +22 -0
- package/.next/server/chunks/8305.js +2 -2
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/.next/server/middleware.js +4 -4
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/preview-props.json +3 -3
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/1230-d71557da20554f50.js +22 -0
- package/.next/static/chunks/3309.581b04bacfeed701.js +1 -0
- package/.next/static/chunks/{3309.d0c34b5ef504a551.js → 5690.332f301b9df6f2dd.js} +1 -1
- package/.next/static/chunks/{6586.775a449050e0e9cc.js → 6586.5969468a897d9e00.js} +1 -1
- package/.next/static/chunks/{8863.2ae457485a63aa22.js → 8863.d853f8eb221377ed.js} +1 -1
- package/.next/static/chunks/app/{page-2e0bf200ed41d4f6.js → page-bdd2e6fc471b822f.js} +8 -8
- package/.next/static/chunks/app/smoke/session-stream/{page-ce422d02fbbe900d.js → page-f0f45a804e43fece.js} +2 -2
- package/.next/static/chunks/{webpack-19f3f7824a602f3b.js → webpack-a60990aaf3b13e7a.js} +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/658.js +0 -22
- package/.next/static/chunks/3824-6bb3afa7d2fc5f09.js +0 -22
- package/.next/static/chunks/5690.64d843d3db8e1b4b.js +0 -1
- /package/.next/static/{ZpLecbnV0af9eeGcGwT88 → 993-z3SwOS_AuLBpkiyRr}/_buildManifest.js +0 -0
- /package/.next/static/{ZpLecbnV0af9eeGcGwT88 → 993-z3SwOS_AuLBpkiyRr}/_ssgManifest.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
exports.id=8305,exports.ids=[8305],exports.modules={129:(a,b,c)=>{"use strict";c.d(b,{O7:()=>s,eR:()=>t,qb:()=>u,qn:()=>o,h5:()=>m,Xz:()=>p,Ln:()=>q});var d=c(48249),e=c(67484);function f({imageData:a,mimeType:b,width:c,height:g,replayToken:h,saveTargetKind:i,saveDefaults:j}){let[k,l]=(0,e.useState)(j??{format:"pdf",dpi:300,width:800,height:600}),[m,n]=(0,e.useState)(k.format),[o,p]=(0,e.useState)(k.dpi),[q,r]=(0,e.useState)(k.width),[s,t]=(0,e.useState)(k.height),[u,v]=(0,e.useState)("idle"),[w,x]=(0,e.useState)(null),y=h&&"object"===i,z=async()=>{if(h){v("saving"),x(null);try{let a=await fetch("/api/plot-kernels/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({replayToken:h,format:m,dpi:o,width:q,height:s})});if(410===a.status)return void v("expired");if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error??`HTTP ${a.status}`)}v("saved")}catch(a){v("error"),x(a instanceof Error?a.message:String(a))}}};return(0,d.jsxs)("div",{style:{position:"relative",display:"inline-block",maxWidth:"100%"},children:[(0,d.jsx)("img",{src:`data:${b};base64,${a}`,alt:"rendered plot",style:{maxWidth:"100%",height:"auto",borderRadius:6,border:"1px solid var(--border)"},width:c??void 0,height:g??void 0}),y&&(0,d.jsxs)("div",{style:{position:"absolute",bottom:0,left:0,right:0,background:"rgba(0,0,0,0.65)",padding:"6px 10px",display:"flex",alignItems:"center",gap:8,flexWrap:"wrap",borderRadius:"0 0 6px 6px",fontSize:11,color:"#e5e7eb",opacity:0,transition:"opacity 0.15s"},className:"kernel-save-bar",onMouseEnter:a=>{a.currentTarget.style.opacity="1"},children:["saved"===u?(0,d.jsx)("span",{style:{color:"#34d399",fontWeight:600},children:"✓ Saved"}):"expired"===u?(0,d.jsx)("span",{style:{color:"#fbbf24"},children:"Save session expired. Re-render plot."}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("select",{value:m,onChange:a=>n(a.target.value),style:{background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4,padding:"2px 4px",fontSize:11,height:24},children:[(0,d.jsx)("option",{value:"pdf",children:"PDF"}),(0,d.jsx)("option",{value:"png",children:"PNG"}),(0,d.jsx)("option",{value:"svg",children:"SVG"})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["DPI",(0,d.jsx)("input",{type:"number",value:o,onChange:a=>p(Number(a.target.value)||300),min:72,max:1200,style:{width:50,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["W",(0,d.jsx)("input",{type:"number",value:q,onChange:a=>r(Number(a.target.value)||800),min:100,max:8e3,style:{width:55,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsxs)("label",{style:{display:"flex",alignItems:"center",gap:3},children:["H",(0,d.jsx)("input",{type:"number",value:s,onChange:a=>t(Number(a.target.value)||600),min:100,max:8e3,style:{width:55,height:24,padding:"2px 4px",fontSize:11,background:"rgba(255,255,255,0.12)",color:"#e5e7eb",border:"1px solid rgba(255,255,255,0.2)",borderRadius:4}})]}),(0,d.jsx)("button",{type:"button",onClick:z,disabled:"saving"===u,style:{height:24,padding:"0 12px",borderRadius:4,background:"rgba(37,99,235,0.4)",border:"1px solid rgba(37,99,235,0.6)",color:"#fff",cursor:"pointer",fontSize:11,fontWeight:600,opacity:"saving"===u?.6:1},children:"saving"===u?"Saving...":"Save"})]}),"error"===u&&w&&(0,d.jsx)("span",{style:{color:"#f87171",marginLeft:4},children:w})]})]})}var g=c(1453),h=c(31343),i=c(4424);let j=/(?:file:\/\/)?(?:(?:[A-Za-z]:[\\/])|\/|~\/|\.{1,2}[\\/]|[A-Za-z0-9_.-]+[\\/])[^`"'<>|\s{}\[\]]+?\.(?:png|jpe?g|webp|gif|svg|bmp|avif|pdf)(?=$|[\s`"'<>|{}\[\]),.;:!?])/gi,k=/\.(?:png|jpe?g|webp|gif|svg|bmp|avif)$/i,l=/\.pdf$/i;function m(a){return a.path?n(a.path):a.source?.type==="base64"&&a.source.data?`data:${a.source.media_type??"image/png"};base64,${a.source.data}`:a.source?.type==="url"&&a.source.url?a.source.url:a.data?`data:${a.mimeType??"image/png"};base64,${a.data}`:null}function n(a){return`/api/files/${(0,h.HG)(a)}?type=read`}function o(a,b){if(!a)return[];let c=[],d=new Set,e=new Set;for(let b of a.matchAll(/!\[[^\]]*]\(([^)]+)\)/g))b[1]&&e.add(b[1].trim());let f=a=>{!a||d.has(a)||c.length>=24||(d.add(a),c.push(a))};for(let c of(j.lastIndex=0,a.matchAll(j))){let d=c[0];if(/^[a-z][a-z\d+.-]*:\/\//i.test(d)&&!/^file:\/\//i.test(d))continue;let g=a.slice(Math.max(0,c.index-12),c.index);if(/[A-Za-z][A-Za-z\d+.-]*:\/?$/.test(g)||d.startsWith("//")||e.has(d))continue;let i=(0,h.HR)(d,b);i&&(k.test(i)?f(i):l.test(i)&&f(i.replace(l,".png")))}return c}function p(a){let b=new Set,c=[];for(let d of a)b.has(d)||(b.add(d),c.push(d));return c}function q(a,b){return a&&b?a.replace(/\n?\[Current model does not support images\. The image will be omitted from this request\.\]\s*/g,"").trim():a}function r({image:a,maxHeight:b}){let c=(0,i.z)(),f=(0,e.useRef)(null),g=(0,e.useRef)(!1),[h,j]=(0,e.useState)(null),[k,l]=(0,e.useState)(!1),[m,o]=(0,e.useState)(null),p=(0,e.useCallback)(async()=>{if(!g.current||!h&&!k){if(g.current=!0,!c||void 0===a.blockIndex)return void o("Image unavailable");l(!0),o(null);try{let b=new URLSearchParams({kind:"image",blockIndex:String(a.blockIndex)});a.toolCallId&&b.set("toolCallId",a.toolCallId);let d=await fetch(`/api/sessions/${encodeURIComponent(c)}/media?${b.toString()}`,{cache:"no-store"}),e=await d.json();if(!d.ok)throw Error(e.error??`HTTP ${d.status}`);if(e.data)j(`data:${e.mimeType??a.mimeType??"image/png"};base64,${e.data}`);else if(e.path)j(n(e.path));else if(e.url)j(e.url);else throw Error("Image payload not found")}catch(a){o(a instanceof Error?a.message:String(a))}finally{l(!1)}}},[a.blockIndex,a.mimeType,a.toolCallId,k,c,h]);return h?(0,d.jsx)("a",{href:h,target:"_blank",rel:"noreferrer",title:"Open image",style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:(0,d.jsx)("img",{src:h,alt:"",loading:"lazy",style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}})}):(0,d.jsx)("button",{ref:f,type:"button",onClick:()=>{g.current=!1,p()},title:m??"Load image",style:{minHeight:88,padding:"12px 10px",border:"1px dashed var(--border)",borderRadius:6,background:"var(--bg)",color:m?"#f87171":"var(--text-dim)",fontSize:11.5,cursor:"pointer"},children:k?"Loading image…":m?"Image unavailable — click to retry":"Load image"})}function s({images:a,maxHeight:b=360}){return 0===a.length?null:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:1===a.length?"minmax(0, 1fr)":"repeat(auto-fit, minmax(180px, 1fr))",gap:8,minWidth:0},children:a.map((a,c)=>{if(a.deferred&&!m(a))return(0,d.jsx)(r,{image:a,maxHeight:b},a.blockIndex??c);let e=m(a);return e?(0,d.jsx)("a",{href:e,target:"_blank",rel:"noreferrer",title:"Open image",style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:(0,d.jsx)("img",{src:e,alt:"",loading:"lazy",style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}})},c):null})})}function t({imagePaths:a,maxHeight:b=360}){let[c,f]=(0,e.useState)(()=>new Set),g=(0,e.useRef)(new Map);a.join("\0");let i=a.filter(a=>!c.has(a));return 0===i.length?null:(0,d.jsx)("div",{style:{display:"grid",gridTemplateColumns:1===i.length?"minmax(0, 1fr)":"repeat(auto-fit, minmax(180px, 1fr))",gap:8,minWidth:0},children:i.map(a=>{let c=n(a),e=(0,h.WP)(a);return(0,d.jsxs)("a",{href:c,target:"_blank",rel:"noreferrer",title:a,style:{display:"block",minWidth:0,border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg)"},children:[(0,d.jsx)("img",{src:c,alt:e,loading:"lazy",onError:()=>{g.current.set(a,(g.current.get(a)??0)+1),f(b=>{let c=new Set(b);return c.add(a),c})},style:{display:"block",width:"100%",maxHeight:b,objectFit:"contain"}}),(0,d.jsx)("div",{style:{padding:"4px 6px",borderTop:"1px solid var(--border)",color:"var(--text-dim)",fontSize:10,fontFamily:"var(--font-mono)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]},a)})})}function u({text:a,isEmpty:b,isError:c,images:e,imagePaths:h,toolDetails:i}){let j=!b||a.trim().length>0;return(0,d.jsxs)("div",{style:{borderTop:`1px solid ${c?"rgba(248,113,113,0.3)":"rgba(34,197,94,0.15)"}`,background:c?"rgba(248,113,113,0.04)":"var(--bg-subtle)"},children:[e.length>0&&(0,d.jsx)("div",{style:{padding:"10px 10px 0",background:"var(--bg)"},children:i?.schema==="kernel-plot.render.v1"?(0,d.jsx)(f,{imageData:e[0].data??e[0].source?.data??"",mimeType:e[0].mimeType??e[0].source?.media_type??"image/png",width:null,height:null,replayToken:i.replayToken??null,saveTargetKind:i.saveTargetKind??null}):(0,d.jsx)(s,{images:e})}),h.length>0&&(0,d.jsx)("div",{style:{padding:"10px 10px 0",background:"var(--bg)"},children:(0,d.jsx)(t,{imagePaths:h})}),j&&(0,d.jsx)(g.m,{text:b?"(no output)":a,maxHeight:400,collapsible:!0,textColor:c?"#f87171":b?"var(--text-dim)":"var(--text-muted)",background:"var(--bg)",empty:b})]})}},1453:(a,b,c)=>{"use strict";c.d(b,{m:()=>i});var d=c(48249),e=c(40805),f=c.n(e);let g=/\x1B\[[0-?]*[ -/]*[@-~]/;var h=c(19581);function i({text:a,maxHeight:b=400,collapsible:c=!0,textColor:e="var(--text-muted)",background:j="var(--bg)",empty:k=!1}){let l=a.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),m=l.split("\n"),n=g.test(a)?(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-word",overflowX:"auto",padding:"8px 10px",maxHeight:c?void 0:b,overflowY:c?void 0:"auto",background:j,color:e,opacity:k?.6:1,fontStyle:k?"italic":"normal"},children:(0,d.jsx)(f(),{children:a})}):(0,d.jsx)("pre",{style:{margin:0,padding:"8px 10px",fontSize:12,lineHeight:1.5,overflowX:"auto",maxHeight:c?void 0:b,overflowY:c?void 0:"auto",background:j,whiteSpace:"pre-wrap",wordBreak:"break-all",fontFamily:"var(--font-mono)",opacity:k?.6:1,fontStyle:k?"italic":"normal",color:e},children:l});return!c||m.length<=20?(0,d.jsx)(d.Fragment,{children:n}):(0,d.jsx)(h.oG,{totalLines:m.length,expandedMaxHeight:b,overlayBackground:j,footerBackground:j,children:n})}},2420:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>e});var d=c(48249);function e({error:a,reset:b}){return(0,d.jsx)("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",padding:24,background:"var(--bg)",color:"var(--text)",fontFamily:"var(--font-mono), ui-monospace, monospace"},children:(0,d.jsxs)("div",{style:{maxWidth:640,width:"100%"},children:[(0,d.jsx)("div",{style:{fontSize:16,fontWeight:600,marginBottom:8},children:"页面出错了"}),(0,d.jsx)("div",{style:{fontSize:13,color:"var(--text-muted)",lineHeight:1.7,marginBottom:16},children:"界面渲染中断,会话数据没有丢失。可以重试,或刷新页面。"}),(0,d.jsxs)("pre",{style:{margin:"0 0 16px",padding:12,borderRadius:8,border:"1px solid var(--border)",background:"var(--bg-panel)",color:"var(--text-dim)",fontSize:12,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[a.message||String(a),a.digest?`
|
|
2
2
|
|
|
3
|
-
digest: ${a.digest}`:""]}),(0,d.jsx)("button",{type:"button",onClick:b,style:{padding:"7px 14px",borderRadius:8,border:"1px solid var(--accent)",background:"var(--accent)",color:"#fff",fontSize:13,cursor:"pointer"},children:"重试"})]})})}c(67484)},2857:(a,b,c)=>{"use strict";c.d(b,{D:()=>i});var d=c(67484);let e=new Set;function f(a){return e.add(a),()=>{e.delete(a)}}function g(){return"u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light"}function h(){return"light"}function i(){let a=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,toggleTheme:(0,d.useCallback)(a=>{let b="dark"===g()?"light":"dark",c=()=>{"dark"===b?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");try{localStorage.setItem("pi-theme",b)}catch{}e.forEach(a=>a())},d=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if("function"!=typeof document.startViewTransition||d)return void c();let f=a?.x??window.innerWidth/2,h=a?.y??window.innerHeight/2,i=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(h,window.innerHeight-h));document.startViewTransition(c).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${h}px)`,`circle(${i}px at ${f}px ${h}px)`]},{duration:450,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)",pseudoElement:"::view-transition-new(root)"})}).catch(()=>{})},[]),isDark:"dark"===a}}},4093:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,90929,23))},4424:(a,b,c)=>{"use strict";c.d(b,{o:()=>g,z:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g({sessionId:a,children:b}){return(0,d.jsx)(f.Provider,{value:a,children:b})}function h(){return(0,e.useContext)(f)}},7952:(a,b,c)=>{"use strict";function d(a){let b,c=[],d=/(^|\n)\s*`{1,3}show-widget`{0,3}\s*(?:\n\s*`{3}(?:json|html)?\s*)?\n?/g,g=0,h=!1;for(;null!==(b=d.exec(a));){h=!0;let i=a.slice(g,b.index).trim();i&&c.push({type:"text",content:i});let j=b.index+b[0].length,k=a.indexOf("```",j),l=a.indexOf("{",j);if(-1!==l&&l<=j+200&&(-1===k||l<k)){let b=function(a,b){let c=0,d=!1,e=!1;for(let f=b;f<a.length;f++){let b=a[f];if(e){e=!1;continue}if("\\"===b&&d){e=!0;continue}if('"'===b){d=!d;continue}if(!d&&("{"===b&&c++,"}"===b)&&0==--c)return f}return -1}(a,l);if(-1===b){let b=function(a){try{let b=e(a);if(b)return b}catch{}let b=a.indexOf('"widget_code"');if(-1===b)return null;let c=a.indexOf(":",b+13);if(-1===c)return null;let d=a.indexOf('"',c+1);if(-1===d)return null;let g=a.slice(d+1);(g=g.replace(/"\s*\}\s*$/,"")).endsWith("\\")&&(g=g.slice(0,-1));let h=a.match(/"title"\s*:\s*"([^"]*?)"/)?.[1],i=f(g.replace(/\\\\/g,"\0BACKSLASH\0").replace(/\\n/g,"\n").replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\u([0-9a-fA-F]{4})/g,(a,b)=>String.fromCharCode(parseInt(b,16))).replace(/\x00BACKSLASH\x00/g,"\\"));return i.code.trim()?{title:h,code:i.code,showOverlay:i.truncated}:null}(a.slice(l));b&&c.push({type:"widget",...b,partial:!0}),g=a.length;break}let h=e(a.slice(l,b+1).trim());h&&c.push({type:"widget",...h});let i=b+1,j=a.slice(i,i+16).match(/^\s*\n?`{1,3}\s*/);j&&(i+=j[0].length),g=i,d.lastIndex=i;continue}if(-1!==k){let b=a.slice(j,k).trim(),f=e(b);f?c.push({type:"widget",...f}):b&&c.push({type:"text",content:b}),d.lastIndex=g=k+3}else{let b=e(a.slice(j).trim());if(b){let a=f(b.code);c.push({type:"widget",title:b.title,code:a.code,partial:!0,showOverlay:a.truncated})}g=a.length;break}}let i=a.slice(g).trim();return i&&c.push({type:"text",content:i}),!h&&0===c.length&&a.trim()&&c.push({type:"text",content:a}),c}function e(a){if(a.startsWith("{")){if(!a.endsWith("}"))return null;try{let b=JSON.parse(a),c=b.widget_code??b.code;if(c)return{title:b.title,code:c}}catch{}let b=function(a){try{return JSON.parse(a)}catch{}let b="",c=!1,d=!1,e=!1,f=!1,g=[],h=!1;for(let i=0;i<a.length;i++){let j=a[i];if(c){if(d){b+=j,d=!1;continue}if("\\"===j){b+=j,d=!0;continue}if('"'===j){let d=a.slice(i+1),k=/^\s*/.exec(d)?.[0]??"",l=d[k.length]??"",m=d.slice(k.length);e?":"===l?(b+=j,c=!1,h=!1,f=!1):b+='\\"':""===l||","===l||"}"===l||"]"===l?(b+=j,c=!1,h=!0,f=!1):/^"[\s\S]{0,100}?"\s*:/.test(m)?(b+=j+",",c=!1,h=!1,f=!0===g[g.length-1]):b+='\\"';continue}if("\n"===j||"\r"===j){b+="\\n";continue}if(" "===j){b+="\\t";continue}if(32>j.charCodeAt(0)){b+="\\u"+j.charCodeAt(0).toString(16).padStart(4,"0");continue}b+=j;continue}if(d){b+=j,d=!1;continue}if("\\"===j){b+=j,d=!0;continue}if('"'===j){h&&(b+=",",h=!1,f=!0===g[g.length-1]),e=f,f=!1,c=!0,b+=j;continue}if("{"===j||"["===j){h&&(b+=","),g.push("{"===j),f="{"===j,h=!1,b+=j;continue}if("}"===j||"]"===j){g.pop(),f=!1,h=!0,b+=j;continue}if(","===j){f=!0===g[g.length-1],h=!1,b+=j;continue}if(":"===j){h=!1,f=!1,b+=j;continue}if(/[0-9tfn-]/.test(j)){h&&(b+=","),b+=j;let c=a[i+1]??"";h=/[\s,}\]"'\\]/.test(c);continue}b+=j}try{return JSON.parse(b)}catch{return null}}(a);if(b){let a=b.widget_code??b.code;if("string"==typeof a&&a.trim())return{title:"string"==typeof b.title?b.title:void 0,code:a}}return null}return/^\s*<[a-zA-Z!][^>]*>/.test(a)||/<(!DOCTYPE|html|svg|canvas|script|style|div)/i.test(a)?{code:a}:null}function f(a){let b=a.lastIndexOf("<script");if(-1===b)return{code:a,truncated:!1};let c=a.slice(b);return/<script[\s\S]*?<\/script>/i.test(c)?{code:a,truncated:!1}:{code:a.slice(0,b).trim(),truncated:!0}}function g(a){return/`{1,3}show-widget/.test(a)}function h(a){return l(a)}function i(a){return l(a).replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>"']*)/gi,"").replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\s+(href|src|action)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']*))/gi,(a,b,c,d,e)=>{let f=(c??d??e??"").trim();return/^\s*(javascript|data)\s*:/i.test(f)?"":a})}c.d(b,{L$:()=>h,SR:()=>n,Xw:()=>i,aH:()=>d,f7:()=>o,qk:()=>g,sM:()=>p});let j=/<(iframe|object|embed|meta|link|base|form)[\s>][\s\S]*?<\/\1>/gi,k=/<(iframe|object|embed|meta|link|base)\b[^>]*\/?>/gi;function l(a){return a.replace(j,"").replace(k,"")}let m=["--bg","--bg-panel","--bg-hover","--bg-selected","--border","--text","--text-muted","--text-dim","--accent","--accent-hover"];function n(){if("u"<typeof document)return{};let a=getComputedStyle(document.documentElement),b={};for(let c of m){let d=a.getPropertyValue(c).trim();d&&(b[c]=d)}return b}function o(a){let b=Object.entries({"--bg":"#ffffff","--bg-panel":"#f5f5f5","--bg-hover":"#eeeeee","--bg-selected":"#e8e8e8","--border":"#e0e0e0","--text":"#1a1a1a","--text-muted":"#6b7280","--text-dim":"#9ca3af","--accent":"#2563eb","--accent-hover":"#1d4ed8",...a,"--font-mono":"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"}).map(([a,b])=>` ${a}: ${b};`).join("\n");return`
|
|
3
|
+
digest: ${a.digest}`:""]}),(0,d.jsx)("button",{type:"button",onClick:b,style:{padding:"7px 14px",borderRadius:8,border:"1px solid var(--accent)",background:"var(--accent)",color:"#fff",fontSize:13,cursor:"pointer"},children:"重试"})]})})}c(67484)},2857:(a,b,c)=>{"use strict";c.d(b,{D:()=>i});var d=c(67484);let e=new Set;function f(a){return e.add(a),()=>{e.delete(a)}}function g(){return"u"<typeof document?"light":document.documentElement.classList.contains("dark")?"dark":"light"}function h(){return"light"}function i(){let a=(0,d.useSyncExternalStore)(f,g,h);return{theme:a,toggleTheme:(0,d.useCallback)(a=>{let b="dark"===g()?"light":"dark",c=()=>{"dark"===b?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark");try{localStorage.setItem("pi-theme",b)}catch{}e.forEach(a=>a())},d=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches;if("function"!=typeof document.startViewTransition||d)return void c();let f=a?.x??window.innerWidth/2,h=a?.y??window.innerHeight/2,i=Math.hypot(Math.max(f,window.innerWidth-f),Math.max(h,window.innerHeight-h));document.startViewTransition(c).ready.then(()=>{document.documentElement.animate({clipPath:[`circle(0px at ${f}px ${h}px)`,`circle(${i}px at ${f}px ${h}px)`]},{duration:450,easing:"cubic-bezier(0.22, 0.61, 0.36, 1)",pseudoElement:"::view-transition-new(root)"})}).catch(()=>{})},[]),isDark:"dark"===a}}},4093:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,90929,23))},4424:(a,b,c)=>{"use strict";c.d(b,{o:()=>g,z:()=>h});var d=c(48249),e=c(67484);let f=(0,e.createContext)(null);function g({sessionId:a,children:b}){return(0,d.jsx)(f.Provider,{value:a,children:b})}function h(){return(0,e.useContext)(f)}},6954:(a,b,c)=>{"use strict";c.d(b,{R:()=>e});var d=c(48249);function e({expanded:a,onToggle:b,children:c,title:f,buttonStyle:g,chevronColor:h="var(--text-dim)",chevronStyle:i}){return(0,d.jsxs)("button",{type:"button",onClick:b,"aria-expanded":a,title:f,style:g,children:[c,(0,d.jsx)("span",{style:{display:"inline-flex",color:h,transform:a?"rotate(180deg)":"none",transition:"transform 0.15s",flexShrink:0,...i},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})})]})}},7952:(a,b,c)=>{"use strict";function d(a){let b,c=[],d=/(^|\n)\s*`{1,3}show-widget`{0,3}\s*(?:\n\s*`{3}(?:json|html)?\s*)?\n?/g,g=0,h=!1;for(;null!==(b=d.exec(a));){h=!0;let i=a.slice(g,b.index).trim();i&&c.push({type:"text",content:i});let j=b.index+b[0].length,k=a.indexOf("```",j),l=a.indexOf("{",j);if(-1!==l&&l<=j+200&&(-1===k||l<k)){let b=function(a,b){let c=0,d=!1,e=!1;for(let f=b;f<a.length;f++){let b=a[f];if(e){e=!1;continue}if("\\"===b&&d){e=!0;continue}if('"'===b){d=!d;continue}if(!d&&("{"===b&&c++,"}"===b)&&0==--c)return f}return -1}(a,l);if(-1===b){let b=function(a){try{let b=e(a);if(b)return b}catch{}let b=a.indexOf('"widget_code"');if(-1===b)return null;let c=a.indexOf(":",b+13);if(-1===c)return null;let d=a.indexOf('"',c+1);if(-1===d)return null;let g=a.slice(d+1);(g=g.replace(/"\s*\}\s*$/,"")).endsWith("\\")&&(g=g.slice(0,-1));let h=a.match(/"title"\s*:\s*"([^"]*?)"/)?.[1],i=f(g.replace(/\\\\/g,"\0BACKSLASH\0").replace(/\\n/g,"\n").replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\u([0-9a-fA-F]{4})/g,(a,b)=>String.fromCharCode(parseInt(b,16))).replace(/\x00BACKSLASH\x00/g,"\\"));return i.code.trim()?{title:h,code:i.code,showOverlay:i.truncated}:null}(a.slice(l));b&&c.push({type:"widget",...b,partial:!0}),g=a.length;break}let h=e(a.slice(l,b+1).trim());h&&c.push({type:"widget",...h});let i=b+1,j=a.slice(i,i+16).match(/^\s*\n?`{1,3}\s*/);j&&(i+=j[0].length),g=i,d.lastIndex=i;continue}if(-1!==k){let b=a.slice(j,k).trim(),f=e(b);f?c.push({type:"widget",...f}):b&&c.push({type:"text",content:b}),d.lastIndex=g=k+3}else{let b=e(a.slice(j).trim());if(b){let a=f(b.code);c.push({type:"widget",title:b.title,code:a.code,partial:!0,showOverlay:a.truncated})}g=a.length;break}}let i=a.slice(g).trim();return i&&c.push({type:"text",content:i}),!h&&0===c.length&&a.trim()&&c.push({type:"text",content:a}),c}function e(a){if(a.startsWith("{")){if(!a.endsWith("}"))return null;try{let b=JSON.parse(a),c=b.widget_code??b.code;if(c)return{title:b.title,code:c}}catch{}let b=function(a){try{return JSON.parse(a)}catch{}let b="",c=!1,d=!1,e=!1,f=!1,g=[],h=!1;for(let i=0;i<a.length;i++){let j=a[i];if(c){if(d){b+=j,d=!1;continue}if("\\"===j){b+=j,d=!0;continue}if('"'===j){let d=a.slice(i+1),k=/^\s*/.exec(d)?.[0]??"",l=d[k.length]??"",m=d.slice(k.length);e?":"===l?(b+=j,c=!1,h=!1,f=!1):b+='\\"':""===l||","===l||"}"===l||"]"===l?(b+=j,c=!1,h=!0,f=!1):/^"[\s\S]{0,100}?"\s*:/.test(m)?(b+=j+",",c=!1,h=!1,f=!0===g[g.length-1]):b+='\\"';continue}if("\n"===j||"\r"===j){b+="\\n";continue}if(" "===j){b+="\\t";continue}if(32>j.charCodeAt(0)){b+="\\u"+j.charCodeAt(0).toString(16).padStart(4,"0");continue}b+=j;continue}if(d){b+=j,d=!1;continue}if("\\"===j){b+=j,d=!0;continue}if('"'===j){h&&(b+=",",h=!1,f=!0===g[g.length-1]),e=f,f=!1,c=!0,b+=j;continue}if("{"===j||"["===j){h&&(b+=","),g.push("{"===j),f="{"===j,h=!1,b+=j;continue}if("}"===j||"]"===j){g.pop(),f=!1,h=!0,b+=j;continue}if(","===j){f=!0===g[g.length-1],h=!1,b+=j;continue}if(":"===j){h=!1,f=!1,b+=j;continue}if(/[0-9tfn-]/.test(j)){h&&(b+=","),b+=j;let c=a[i+1]??"";h=/[\s,}\]"'\\]/.test(c);continue}b+=j}try{return JSON.parse(b)}catch{return null}}(a);if(b){let a=b.widget_code??b.code;if("string"==typeof a&&a.trim())return{title:"string"==typeof b.title?b.title:void 0,code:a}}return null}return/^\s*<[a-zA-Z!][^>]*>/.test(a)||/<(!DOCTYPE|html|svg|canvas|script|style|div)/i.test(a)?{code:a}:null}function f(a){let b=a.lastIndexOf("<script");if(-1===b)return{code:a,truncated:!1};let c=a.slice(b);return/<script[\s\S]*?<\/script>/i.test(c)?{code:a,truncated:!1}:{code:a.slice(0,b).trim(),truncated:!0}}function g(a){return/`{1,3}show-widget/.test(a)}function h(a){return l(a)}function i(a){return l(a).replace(/\s+on[a-z]+\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>"']*)/gi,"").replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\/?>/gi,"").replace(/\s+(href|src|action)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>"']*))/gi,(a,b,c,d,e)=>{let f=(c??d??e??"").trim();return/^\s*(javascript|data)\s*:/i.test(f)?"":a})}c.d(b,{L$:()=>h,SR:()=>n,Xw:()=>i,aH:()=>d,f7:()=>o,qk:()=>g,sM:()=>p});let j=/<(iframe|object|embed|meta|link|base|form)[\s>][\s\S]*?<\/\1>/gi,k=/<(iframe|object|embed|meta|link|base)\b[^>]*\/?>/gi;function l(a){return a.replace(j,"").replace(k,"")}let m=["--bg","--bg-panel","--bg-hover","--bg-selected","--border","--text","--text-muted","--text-dim","--accent","--accent-hover"];function n(){if("u"<typeof document)return{};let a=getComputedStyle(document.documentElement),b={};for(let c of m){let d=a.getPropertyValue(c).trim();d&&(b[c]=d)}return b}function o(a){let b=Object.entries({"--bg":"#ffffff","--bg-panel":"#f5f5f5","--bg-hover":"#eeeeee","--bg-selected":"#e8e8e8","--border":"#e0e0e0","--text":"#1a1a1a","--text-muted":"#6b7280","--text-dim":"#9ca3af","--accent":"#2563eb","--accent-hover":"#1d4ed8",...a,"--font-mono":"ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"}).map(([a,b])=>` ${a}: ${b};`).join("\n");return`
|
|
4
4
|
:root {
|
|
5
5
|
${b}
|
|
6
6
|
}
|
|
@@ -261,4 +261,4 @@ digest: ${a.digest}`:""]}),(0,d.jsx)("button",{type:"button",onClick:b,style:{pa
|
|
|
261
261
|
${a}
|
|
262
262
|
${d}`;(0,p.D)(e).then(()=>{s(!0),setTimeout(()=>s(!1),1500)})},title:"Copy as Markdown fence",ariaLabel:"Copy as Markdown fence",label:"markdown",activeLabel:"md copied",active:r}),(0,d.jsx)(m.Mi,{onClick:()=>{(0,p.D)(a).then(()=>{n(!0),setTimeout(()=>n(!1),1500)})},ariaLabel:"Copy code",label:"copy",activeLabel:"copied",active:l})]})}),(0,d.jsx)(m.oG,{totalLines:u,children:w})]})}function r({chart:a}){let{isDark:b}=(0,l.D)(),[c,f]=(0,e.useState)(null),[g,h]=(0,e.useState)(null);return((0,e.useId)().replace(/:/g,""),g)?(0,d.jsxs)("div",{className:"mermaid-diagram mermaid-diagram-error",children:[(0,d.jsx)("div",{className:"mermaid-diagram-error-title",children:"Mermaid render failed"}),(0,d.jsx)("div",{className:"mermaid-diagram-error-message",children:g}),(0,d.jsx)("pre",{children:a})]}):(0,d.jsx)("div",{className:"mermaid-diagram",children:c?(0,d.jsx)("div",{className:"mermaid-diagram-canvas",dangerouslySetInnerHTML:{__html:c}}):(0,d.jsx)("div",{className:"mermaid-diagram-loading",children:"Rendering diagram..."})})}var s=c(31218),t=c(52515);function u({code:a,onAcceptDiff:b,agentRunning:c}){let f=(0,e.useMemo)(()=>(function(a){let b=a.split("\n"),c=[],d=null,e=1;for(let a of b){let b=/^\+\+\+ [ab]\/(.+)/.exec(a);if(b){d=b[1];continue}if(/^@@ /.test(a)){let b=/@@ -\d+(?:,\d+)? \+(\d+)/.exec(a);b&&(e=parseInt(b[1],10));continue}/^--- /.test(a)||(a.startsWith("+")&&!a.startsWith("+++")?c.push({type:"added",text:a.slice(1),lineNo:e++}):a.startsWith("-")&&!a.startsWith("---")?c.push({type:"removed",text:a.slice(1),lineNo:0}):a.startsWith(" ")?c.push({type:"unchanged",text:a.slice(1),lineNo:e++}):c.push({type:"unchanged",text:a,lineNo:e++}))}return{lines:c,filePath:d}})(a),[a]),g=(0,e.useMemo)(()=>(function(a){let b=0,c=0;for(let d of a)"added"===d.type&&b++,"removed"===d.type&&c++;return{added:b,removed:c}})(f.lines),[f.lines]);return(0,d.jsxs)(m.NG,{className:"markdown-code-block markdown-code-block-chat",style:{marginTop:4,marginBottom:4},children:[(0,d.jsx)(m.iO,{title:(0,d.jsxs)("span",{children:["diff ",f.filePath&&(0,d.jsx)("span",{style:{opacity:.7},children:f.filePath})," ",(0,d.jsxs)("span",{style:{color:"var(--text-dim)",fontWeight:400},children:["(",(0,d.jsxs)("span",{style:{color:"#16a34a"},children:["+",g.added]})," /"," ",(0,d.jsxs)("span",{style:{color:"#dc2626"},children:["-",g.removed]}),")"]})]}),actions:b&&!c?(0,d.jsx)(m.Mi,{onClick:()=>b(a,f.filePath),title:"Ask the agent to apply this diff",ariaLabel:"Ask the agent to apply this diff",label:"apply",activeLabel:"apply",active:!1}):void 0}),(0,d.jsx)(t.pg,{diff:f.lines,emptyLabel:"No changes detected"})]})}let v=new Set,w=new Map,x=null;function y(){return x||(x=Promise.resolve().then(c.bind(c,78908)).then(a=>{if(0===v.size){for(let b of Object.keys(a.bundledLanguages??{}))v.add(b.toLowerCase());for(let b of a.bundledLanguagesInfo??[]){let a=b.id.toLowerCase();for(let c of b.aliases??[])w.set(c.toLowerCase(),a)}}return a})),x}var z=c(7952),A=c(31343);function B(a){return a?.replace(/^language-/,"").trim()??""}function C(a){return/^[a-z][a-z\d+.-]*:/i.test(a)||a.startsWith("//")}function D(a,b,c){let d;if(!c||c.startsWith("#")||C(c))return null;let e=(d=/^([^?#]*)(.*)$/.exec(c),d?.[1]??c);if(!e)return null;let f=function(a){try{return decodeURI(a)}catch{return a}}(e);return(0,A.HR)(f,b,a)}function E(a){return`/api/files/${(0,A.HG)(a)}?type=read`}function F({value:a,baseFilePath:b,cwd:c,onOpenLocalFile:e,onOpenFileAtLine:f}){let g=(0,d.jsx)("code",{style:{background:"var(--bg-selected)",padding:"1px 4px",borderRadius:3,fontFamily:"var(--font-mono)",fontSize:"0.9em"},children:a});return/^(?:\.{1,2}\/|\/|~\/|[\w@.-]+\/)[\w@./+-]+\.[A-Za-z0-9]{1,12}:\d+$/.test(a.trim())?(0,d.jsx)(I,{href:a,baseFilePath:b,cwd:c,onOpenLocalFile:e,onOpenFileAtLine:f,style:{textDecoration:"none"},children:g}):g}function G(a){let b=/^\s*!\[([^\]]*)\]\((.+)\)\s*$/.exec(a);if(!b)return null;let c=b[2]?.trim()??"";if(!c)return null;let d=/^(.+?)\s+(?:"[^"]*"|'[^']*')\s*$/.exec(c);return{alt:b[1]?.trim()||void 0,src:(d?.[1]??c).trim()}}function H({items:a,baseFilePath:b,cwd:c,onOpenLocalFile:e}){let f=1===a.length;return(0,d.jsx)("div",{className:"report-image-gallery",style:{display:"grid",gridTemplateColumns:f?"minmax(0, 1fr)":"repeat(auto-fit, minmax(min(100%, 240px), 1fr))",gap:12,margin:"16px 0"},children:a.map((a,g)=>{let h=D(b,c,a.src),i=h?E(h):a.src,j=a.alt??a.caption??`Figure ${g+1}`,k=(0,d.jsx)("img",{src:i,alt:j,loading:"lazy",title:h??a.src,style:{display:"block",width:"100%",maxHeight:f?520:340,objectFit:"contain",border:"1px solid var(--border)",borderRadius:6,background:"var(--bg-panel)"}});return(0,d.jsxs)("figure",{style:{margin:0,minWidth:0},children:[h&&e?(0,d.jsx)("button",{type:"button",onClick:()=>e(h,(0,A.WP)(h)),title:`Open ${h}`,style:{display:"block",width:"100%",padding:0,border:"none",background:"none",cursor:"zoom-in"},children:k}):k,a.caption&&(0,d.jsx)("figcaption",{style:{marginTop:6,color:"var(--text-muted)",fontSize:12,lineHeight:1.45},children:a.caption})]},`${a.src}-${g}`)})})}function I({href:a,children:b,baseFilePath:c,cwd:e,onOpenLocalFile:f,onOpenFileAtLine:g,title:h,...i}){let j=a?/^(.*):(\d+)$/.exec(a.replace(/[?#].*$/,"")):null,k=j?j[1]:a,l=j?parseInt(j[2],10):void 0,m=D(c,e,k),n=!!m,o=!!a&&C(a),p=m&&l?`${E(m)}#L${l}`:n?E(m):a;return(0,d.jsx)("a",{...i,href:p,target:o?"_blank":void 0,rel:o?"noreferrer":void 0,onClick:a=>{if(!m)return;a.preventDefault();let b=(0,A.WP)(m);g?g(m,b,l):f&&f(m,b)},title:n?m:h,children:b})}function J({src:a,alt:b,title:c,baseFilePath:e,cwd:f,onOpenLocalFile:g,...h}){let i="string"==typeof a?a:void 0,j=D(e,f,i),k=j?E(j):i,l=(0,d.jsx)("img",{...h,src:k,alt:b??"",loading:"lazy",title:j??c,style:{...h.style??{},cursor:k?"zoom-in":h.style?.cursor}});return k?(0,d.jsx)("a",{href:k,target:"_blank",rel:"noreferrer",title:j??c??"Open image",style:{display:"inline-block",maxWidth:"100%"},onClick:a=>{j&&g&&(a.preventDefault(),g(j,(0,A.WP)(j)))},children:l}):l}function K({code:a,language:b,variant:c,isStreaming:e=!1,baseFilePath:f,cwd:g,onOpenLocalFile:h,onWidgetSendMessage:i,renderVisualCodeBlocks:j=!1,testAsyncCodeDelayMs:k=0,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onAcceptDiff:p}){let t,v,w,x;if("mermaid"===(t=b.trim().toLowerCase())||"mmd"===t)return(0,d.jsx)(r,{chart:a});if("diff"===(v=b.trim().toLowerCase())||"patch"===v||"unified-diff"===v)return(0,d.jsx)(u,{code:a,onAcceptDiff:p,agentRunning:m});if("show-widget"===b.trim().toLowerCase()){let b,c=(b=(0,z.aH)(`\`\`\`show-widget
|
|
263
263
|
${a}
|
|
264
|
-
\`\`\``).find(a=>"widget"===a.type),b?.type==="widget"?{title:b.title,code:b.code}:null);if(c)return(0,d.jsx)(s.u,{code:c.code,isStreaming:!1,title:c.title,onSendMessage:i})}if("report-gallery"===b.trim().toLowerCase()){let b=function(a){try{let b=JSON.parse(a);if(!Array.isArray(b))return null;let c=b.flatMap(a=>a&&"object"==typeof a&&"string"==typeof a.src&&a.src.trim()?[{src:a.src.trim(),alt:"string"==typeof a.alt&&a.alt.trim()?a.alt.trim():void 0,caption:"string"==typeof a.caption&&a.caption.trim()?a.caption.trim():void 0}]:[]);return c.length>0?c.slice(0,12):null}catch{return null}}(a);if(b)return(0,d.jsx)(H,{items:b,baseFilePath:f,cwd:g,onOpenLocalFile:h})}return j&&(w=b.trim().toLowerCase(),(x=a.trim())&&("svg"===w||"xml"===w&&/^<svg[\s>]/i.test(x)?/^<svg[\s>]/i.test(x):!("html"!==w||/<!doctype|<html[\s>]|<head[\s>]|<body[\s>]/i.test(x))&&/^<(style|svg|div|section|article|main|figure|canvas)\b/i.test(x)))?(0,d.jsx)(s.u,{code:a,isStreaming:!1,title:`${b||"visual"} preview`,onSendMessage:i}):(0,d.jsx)(q,{code:a,language:b,variant:c,isStreaming:e,testAsyncDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o})}function L({children:a,className:b,node:c,baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i=!1,isStreaming:j=!1,testAsyncCodeDelayMs:k=0,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onOpenFileAtLine:p,onAcceptDiff:q,...r}){let s=("string"==typeof a?a:Array.isArray(a)?a.map(a=>"string"==typeof a?a:"").join(""):"").replace(/\n$/,""),t=B(b);return"data-block"in r?(0,d.jsx)(K,{code:s,language:t,variant:"chat",isStreaming:j||!!r["data-incomplete"],baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i,testAsyncCodeDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onAcceptDiff:q}):(0,d.jsx)(F,{value:s,baseFilePath:e,cwd:f,onOpenLocalFile:g,onOpenFileAtLine:p})}function M({content:a,className:b="markdown-body",style:c,codeBlockVariant:m="chat",baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s=!1,enableImageGallery:t=!1,isStreaming:u=!1,renderer:x="react-markdown",testAsyncCodeDelayMs:z=0,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N}){let O,P,{isDark:Q}=(0,l.D)(),R=t?function(a){let b=a.split("\n"),c=[],d=0;for(;d<b.length;){if(!G(b[d])){c.push(b[d]),d+=1;continue}let a=[],e=d;for(;e<b.length;){let c=G(b[e]);if(!c)break;let d=e+1,f=d;for(;f<b.length&&!b[f].trim();)f+=1;let g=f<b.length?function(a){let b=/^\s*(?:_([^_]+)_|\*([^*]+)\*)\s*$/.exec(a);return(b?.[1]??b?.[2]??"").trim()||null}(b[f]):null;g&&(c.caption=g,d=f+1),a.push(c);let h=d;for(;h<b.length&&!b[h].trim();)h+=1;if(!G(b[h])){e=d;break}e=h}if(a.length>1||a.some(a=>a.caption)){c.push(["```report-gallery",JSON.stringify(a,null,2),"```"].join("\n")),d=e;continue}c.push(b[d]),d+=1}return c.join("\n")}(a):a,S=H?(O=R.split("\n"),P=!1,O.map(a=>/^\s*(```|~~~)/.test(a)?(P=!P,a):P||/\]\([^)]*$/.test(a)?a:a.replace(/(^|[\s([{"'])((?:\.{1,2}\/|\/|~\/|[\w@.-]+\/)[\w@./+-]+\.[A-Za-z0-9]{1,12}:\d+)\b/g,(a,b,c)=>`${b}[${c}](${c})`)).join("\n")):R,T=(0,e.useMemo)(()=>u?{cjk:i.h,math:j.D,mermaid:k.a}:{cjk:i.h,math:j.D,mermaid:k.a,code:function(a,b=[n.cx,n.aU]){return y(),{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>[...v],getThemes:()=>b,supportsLanguage(a){let b;return 0===v.size||null!==((b=a.trim().toLowerCase())?v.has(b)?b:w.get(b)??null:null)},highlight(b,c){let d=b.language,e=(0,n.wY)(b.code,d,a,a=>{c?.({tokens:a.tokens,bg:a.bg,fg:a.fg})});return e?{tokens:e.tokens,bg:e.bg,fg:e.fg}:(y(),null)}}}(Q)},[Q,u]);return"streamdown"!==x||o||t?(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(f.oz,{remarkPlugins:[g.A],components:{code({className:a,children:b,node:c}){let e=B(a),f=String(b),g=f.replace(/\n$/,"");return a?.includes("language-")||f.includes("\n")?(0,d.jsx)(K,{code:g,language:e,variant:m,isStreaming:u,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onAcceptDiff:N}):(0,d.jsx)(F,{value:g,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H})},pre:({children:a})=>(0,d.jsx)(d.Fragment,{children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})}):(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(h.jH,{mode:u?"streaming":"static",isAnimating:!!u,plugins:T,components:{code:({children:a,className:b,node:c,...e})=>(0,d.jsx)(L,{...e,node:c,className:b,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,isStreaming:u,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N,children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})})}},52515:(a,b,c)=>{"use strict";c.d(b,{K$:()=>h,Ph:()=>g,Tg:()=>m,fj:()=>f,mK:()=>i,ml:()=>j,nG:()=>k,pg:()=>l,v7:()=>e});var d=c(48249);function e(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}function f({children:a,style:b}){return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",...b},children:a})}function g({children:a,style:b,bodyRef:c,onScroll:e}){return(0,d.jsx)("div",{ref:c,onScroll:e,style:{flex:1,overflow:"auto",background:"var(--bg)",...b},children:a})}function h({pathLabel:a,title:b,trailing:c,style:e}){return(0,d.jsxs)("div",{"data-file-viewer-surface":"status-bar",style:{display:"flex",alignItems:"center",gap:12,padding:"4px 16px",borderBottom:"1px solid var(--border)",fontSize:11,color:"var(--text-dim)",background:"var(--bg)",flexShrink:0,...e},children:[(0,d.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},title:b??a,children:a}),c]})}function i({watching:a}){return(0,d.jsxs)("span",{title:a?"Live sync active":"Not watching",style:{display:"flex",alignItems:"center",gap:4,color:a?"#4ade80":"var(--text-dim)"},children:[(0,d.jsx)("span",{style:{width:7,height:7,borderRadius:"50%",background:a?"#4ade80":"var(--border)",display:"inline-block",boxShadow:a?"0 0 4px #4ade80":"none"}}),a?"live":"static"]})}function j({children:a,onClick:b,title:c,disabled:e=!1,active:f=!1,emphasis:g="default",style:h}){let i="primary"==g,k="danger"==g;return(0,d.jsx)("button",{"data-file-viewer-surface":"toolbar-button",onClick:b,disabled:e,title:c,style:{padding:"2px 10px",fontSize:11,cursor:e?"not-allowed":"pointer",background:i?"var(--accent)":k?"rgba(239,68,68,0.1)":f?"var(--bg-selected)":"var(--bg-hover)",color:i?"#fff":k?"#ef4444":f?"var(--text)":"var(--text-muted)",border:`1px solid ${i?"var(--accent)":k?"rgba(239,68,68,0.3)":"var(--border)"}`,borderRadius:5,fontWeight:f||i||k?600:400,opacity:e?.6:1,...h},children:a})}function k({children:a,tone:b="muted",style:c}){return(0,d.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",padding:24,color:"error"===b?"#f87171":"var(--text-muted)",fontSize:13,textAlign:"center",...c},children:a})}function l({diff:a,emptyLabel:b="No changes"}){if(!a.some(a=>"unchanged"!==a.type))return(0,d.jsx)("div",{style:{padding:"12px 16px",fontSize:12,color:"var(--text-dim)",fontFamily:"var(--font-mono)"},children:b});let c=new Set(a.flatMap((a,b)=>"unchanged"!==a.type?[b]:[])),e=new Set;for(let b of c)for(let c=Math.max(0,b-3);c<=Math.min(a.length-1,b+3);c++)e.add(c);let f=[],g=0;for(;g<a.length;)if(e.has(g)){let b=[];for(;g<a.length&&e.has(g);)b.push(a[g]),g++;f.push({hidden:!1,lines:b})}else{let b=0;for(;g<a.length&&!e.has(g);)b++,g++;f.push({hidden:!0,count:b})}let h=[],i=1;for(let b of a)"removed"===b.type?h.push(0):h.push(i++);let j=0;return(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.6},children:f.map((a,b)=>{if(a.hidden){let c=(0,d.jsxs)("div",{style:{padding:"2px 16px",color:"var(--text-dim)",background:"var(--bg-panel)",fontSize:11,borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)"},children:["... ",a.count," unchanged lines ..."]},b);return j+=a.count,c}let c=a.lines.map((a,b)=>{let c=h[j+b],e="added"===a.type?"rgba(0,200,80,0.12)":"removed"===a.type?"rgba(240,60,60,0.14)":"transparent",f="added"===a.type?"+":"removed"===a.type?"-":" ",g="added"===a.type?"#4ade80":"removed"===a.type?"#f87171":"var(--text-dim)";return(0,d.jsxs)("div",{style:{display:"flex",background:e,borderLeft:"added"===a.type?"3px solid #4ade80":"removed"===a.type?"3px solid #f87171":"3px solid transparent"},children:[(0,d.jsx)("span",{style:{minWidth:44,padding:"0 8px 0 16px",textAlign:"right",color:"var(--text-dim)",userSelect:"none",fontSize:11,lineHeight:1.6,borderRight:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:"removed"===a.type?a.lineNo:c||""}),(0,d.jsx)("span",{style:{minWidth:16,padding:"0 6px",color:g,userSelect:"none",flexShrink:0,fontWeight:600},children:f}),(0,d.jsx)("span",{style:{flex:1,padding:"0 8px 0 0",whiteSpace:"pre",color:"var(--text)",overflowX:"auto"},children:a.text||"\xa0"})]},b)});return j+=a.lines.length,(0,d.jsx)("div",{children:c},b)})})}function m({options:a}){return(0,d.jsx)("div",{"data-file-viewer-surface":"segmented-toggle",style:{display:"flex",borderRadius:5,overflow:"hidden",border:"1px solid var(--border)"},children:a.map((a,b)=>(0,d.jsx)("button",{onClick:a.onClick,style:{padding:"2px 8px",fontSize:11,border:"none",borderLeft:0===b?"none":"1px solid var(--border)",cursor:"pointer",background:a.active?"var(--bg-selected)":"var(--bg-hover)",color:a.active?"var(--text)":"var(--text-muted)",fontWeight:a.active?600:400},children:a.label},a.key))})}},54097:(a,b,c)=>{"use strict";c.d(b,{p:()=>f,t:()=>e});var d=c(48249);function e({children:a,style:b,kind:c}){return(0,d.jsx)("div",{"data-disclosure-surface":"panel","data-disclosure-kind":c,style:{border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg-panel)",...b},children:a})}function f({children:a,style:b}){return(0,d.jsx)("div",{"data-disclosure-surface":"body",style:{borderTop:"1px solid var(--border)",...b},children:a})}},55038:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/annovibe/annovibe/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/annovibe/annovibe/app/global-error.tsx","default")},57703:(a,b,c)=>{"use strict";c.d(b,{V:()=>h});var d=c(48249),e=c(84573),f=c(40648),g=c(41044);function h({expanded:a,onToggle:b,status:c,title:i,summary:j,durationLabel:k,leading:l,titleTooltip:m,summaryTooltip:n,buttonStyle:o,titleStyle:p,summaryStyle:q,durationStyle:r}){return(0,d.jsxs)(e.R,{expanded:a,onToggle:b,buttonStyle:o,children:[l,(0,d.jsx)("span",{title:m??i,style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontWeight:600,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:+!j,minWidth:0,flex:j?void 0:1,...p},children:"running"===c?(0,d.jsx)(f.n,{children:i}):i}),j?(0,d.jsx)("span",{title:n??j,style:{color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,...q},children:"running"===c?(0,d.jsx)(f.n,{children:j}):j}):(0,d.jsx)("span",{style:{flex:1,minWidth:0}}),(0,d.jsx)(g.U1,{status:c}),k?(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...r},children:k}):null]})}},60125:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,33071,23))},65950:(a,b,c)=>{"use strict";c.d(b,{aU:()=>f,cx:()=>e,nS:()=>r,Rd:()=>q,wY:()=>p,tG:()=>m});class d{#a;#b;constructor(a){this.#b=new Map,this.#a=a}get(a){if(!this.#b.has(a))return;let b=this.#b.get(a);return this.#b.delete(a),this.#b.set(a,b),b}set(a,b){for(this.#b.has(a)&&this.#b.delete(a);this.#b.size>=this.#a;){let a=this.#b.keys().next().value;if(void 0===a)break;this.#b.delete(a)}this.#b.set(a,b)}delete(a){this.#b.delete(a)}get size(){return this.#b.size}}let e="github-light",f="github-dark",g=new d(10),h=new d(200),i=new Set,j=new Map,k=null;function l(a,b,c){let d=a.slice(0,100),e=a.length>100?a.slice(-100):"";return`${b}:${c}:${a.length}:${d}:${e}`}function m(a){return void 0===a||0===a?{}:{fontStyle:1&a?"italic":void 0,fontWeight:2&a?700:void 0,textDecorationLine:4&a?"underline":void 0}}function n(){return k||(k=Promise.resolve().then(c.bind(c,78908)).then(a=>{if(0===i.size){for(let b of Object.keys(a.bundledLanguages??{}))i.add(b.toLowerCase());for(let b of a.bundledLanguagesInfo??[]){let a=b.id.toLowerCase();for(let c of b.aliases??[])j.set(c.toLowerCase(),a)}}return a})),k}async function o(a,b=e,c=f){let d=`${a}:${b}:${c}`,h=g.get(d);if(h)return h;let i=n().then(({createHighlighter:d})=>d({langs:[a],themes:[b,c]})).catch(a=>{throw g.delete(d),a});return g.set(d,i),i}function p(a,b,c,d){let g=q(a,b,c);if(g)return g;let k=c?f:e,m=b.trim().toLowerCase();if(!m)return null;let p=l(a,m,k);return n().then(()=>{let c,g=(c=b.trim().toLowerCase())?i.has(c)?c:j.get(c)??null:null;return g?o(g,e,f).then(b=>{let c=b.codeToTokens(a,{lang:g,theme:k}),e={bg:c.bg??"transparent",fg:c.fg??"inherit",tokens:c.tokens};return h.set(p,e),d(e),e}):null}).catch(a=>{console.warn("[Shiki] highlight failed:",a)}),null}function q(a,b,c){let d=b.trim().toLowerCase();if(!d)return null;let g=l(a,d,c?f:e);return h.get(g)??null}function r(a){return{bg:"transparent",fg:"inherit",tokens:a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(a=>""===a?[]:[{color:"inherit",content:a}])}}},69613:(a,b,c)=>{Promise.resolve().then(c.bind(c,43248))},73383:(a,b,c)=>{"use strict";c.d(b,{pm:()=>k});var d=c(48249),e=c(67484),f=c(54097),g=c(84573),h=c(40648);function i({expanded:a,onToggle:b,durationLabel:c,isStreaming:e=!1,leading:f,label:j="Thinking",buttonStyle:k,labelStyle:l,durationStyle:m}){return(0,d.jsxs)(g.R,{expanded:a,onToggle:b,buttonStyle:{width:"100%",display:"flex",alignItems:"center",gap:7,minWidth:0,textAlign:"left",cursor:"pointer",border:"none",background:"transparent",color:"var(--text-muted)",...k},children:[f,(0,d.jsx)("span",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1,...l},children:e?(0,d.jsx)(h.n,{children:j}):j}),c&&(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...m},children:c})]})}function j({content:a,contentStyle:b}){return(0,d.jsx)(f.p,{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word",...b},children:(0,d.jsx)("div",{style:{padding:"8px 10px"},children:a})})}function k({content:a,durationLabel:b,isStreaming:c=!1,leading:g,label:h="Thinking",containerStyle:l,buttonStyle:m,labelStyle:n,durationStyle:o,contentStyle:p,deferred:q=!1,blockIndex:r,entryId:s,sessionId:t}){let[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null),C=q&&""===a.trim()&&null===w,D=async()=>{let a=!u;if(v(a),a&&C&&!y){if(!t||!s||void 0===r)return void B("Thinking is unavailable");z(!0),B(null);try{let a=new URLSearchParams({kind:"thinking",entryId:s,blockIndex:String(r)}),b=await fetch(`/api/sessions/${encodeURIComponent(t)}/media?${a.toString()}`,{cache:"no-store"}),c=await b.json();if(!b.ok)throw Error(c.error??`HTTP ${b.status}`);x(c.thinking??"")}catch(a){B(a instanceof Error?a.message:String(a))}finally{z(!1)}}},E=w??a;return(0,d.jsxs)(f.t,{kind:"thinking",style:l,children:[(0,d.jsx)(i,{expanded:u,onToggle:D,durationLabel:b,isStreaming:c,leading:g,label:h,buttonStyle:m,labelStyle:n,durationStyle:o}),u&&(0,d.jsx)(j,{content:y?"Loading thinking…":A??E,contentStyle:p})]})}},78335:()=>{},80251:(a,b,c)=>{"use strict";function d(a,b){for(let c of b){let b=a[c];if(null!=b&&""!==b)return String(b)}return null}function e(a,b=60){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function f(a){let b=a.toLowerCase().split("__").filter(Boolean);return b[b.length-1]??a.toLowerCase()}function g(a,b=120){let c=Object.keys(a);return 0===c.length?"":"command"in a?String(a.command).slice(0,b):"cmd"in a?String(a.cmd).slice(0,b):"path"in a?String(a.path).slice(0,b):"file_path"in a?String(a.file_path).slice(0,b):"pattern"in a?String(a.pattern).slice(0,b):"query"in a?String(a.query).slice(0,b):String(a[c[0]]).slice(0,b)}function h(a){let b=a.toolName||"tool",c=f(b),g=a.input??{};if(["bash","execute","run","shell","exec_command","execute_command"].includes(c))return{canonicalName:c,kind:"terminal",label:"Shell",summary:e(d(g,["command","cmd"])??b,60)};if(["read","readfile","read_file"].includes(c))return{canonicalName:c,kind:"read",label:"Read",summary:e(d(g,["file_path","path"])??b,60)};if(["write","edit","write_file","create_file","notebook_edit"].includes(c)){let a,f=d(g,["file_path","path","notebook_path","filename"]);return{canonicalName:c,kind:"edit",label:"Edit",summary:e(f?(a=f.split(/[\\/]/).filter(Boolean))[a.length-1]??f:b,60)}}if(["search","grep","glob","find","find_files","websearch"].includes(c))return{canonicalName:c,kind:"search",label:"Search",summary:e(d(g,["pattern","query","glob"])??b,60)};if(["subagent","agent"].includes(c))return{canonicalName:c,kind:"agent",label:"Agent",summary:e([d(g,["agent","name","agentName"]),d(g,["prompt","task","message"])].filter(Boolean).join(": ")||b,60)};let h=d(g,["command","cmd","path","file_path","pattern","query","glob","prompt","description"])??function(a){try{return JSON.stringify(a)}catch{return String(a)}}(g)??b;return{canonicalName:c,kind:"tool",label:e(b,60),summary:e(h,60)}}c.d(b,{WI:()=>f,Wm:()=>g,wS:()=>h})},82704:()=>{},84153:(a,b,c)=>{Promise.resolve().then(c.bind(c,85034))},84573:(a,b,c)=>{"use strict";c.d(b,{R:()=>e});var d=c(48249);function e({expanded:a,onToggle:b,children:c,title:f,buttonStyle:g,chevronColor:h="var(--text-dim)",chevronStyle:i}){return(0,d.jsxs)("button",{type:"button",onClick:b,"aria-expanded":a,title:f,style:g,children:[c,(0,d.jsx)("span",{style:{display:"inline-flex",color:h,transform:a?"rotate(180deg)":"none",transition:"transform 0.15s",flexShrink:0,...i},children:(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"2 3.5 5 6.5 8 3.5"})})})]})}},84963:(a,b,c)=>{"use strict";c.d(b,{D:()=>R});var d=c(48249),e=c(67484),f=c(51415),g=c(40648),h=c(73383),i=c(8033),j=c(41044),k=c(129),l=c(31218),m=c(7952);function n({block:a,toolResults:b,isStreaming:c,streamingDuration:e,toolCallDurations:f,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t}){if("text"===a.type)return(0,d.jsx)(o,{block:a,isStreaming:c,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t});if("image"===a.type)return(0,d.jsx)(k.O7,{images:[a]});if("thinking"===a.type)return(0,d.jsx)(r,{block:a,duration:e,isStreaming:c});let u=b?.get(a.toolCallId),v=f?.get(a.toolCallId);return(0,d.jsx)(s,{block:a,result:u,duration:v,isStreaming:c,cwd:i})}function o({block:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}){let r=a.text,s=(0,m.aH)(r);if(!s.some(a=>"widget"===a.type)){if(b&&(0,m.qk)(r)){let a=s.filter(a=>"text"===a.type).map(a=>a.content).join("\n\n");return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)(p,{text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}),(0,d.jsx)(q,{})]})}return(0,d.jsx)(p,{text:r,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n})}return(0,d.jsx)(d.Fragment,{children:s.map((a,m)=>"text"===a.type?(0,d.jsx)(p,{text:a.content,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n},m):(0,d.jsx)(l.u,{code:a.code,isStreaming:!!a.partial,title:a.title,showOverlay:a.showOverlay,onSendMessage:c},m))})}function p({text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:g,cwd:h,activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}){let q=(0,e.useMemo)(()=>(0,k.qn)(a,h),[h,a]);return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8*(q.length>0)},children:[(0,d.jsx)(f.T,{content:a,cwd:h,onWidgetSendMessage:c,renderVisualCodeBlocks:g,isStreaming:b,renderer:"streamdown",activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}),q.length>0&&(0,d.jsx)(k.eR,{imagePaths:q})]})}function q(){return(0,d.jsx)(g.r,{height:88,style:{border:"1px solid var(--border)"}})}function r({block:a,duration:b,isStreaming:c}){return(0,d.jsx)(h.pm,{content:a.thinking,durationLabel:void 0!==b?`${b}s`:null,isStreaming:c,buttonStyle:{width:"100%",padding:"6px 10px",fontSize:12},containerStyle:{fontSize:13},contentStyle:{background:"var(--bg-panel)"}})}function s({block:a,result:b,duration:c,isStreaming:e,cwd:f}){let g=(0,j.s2)(b,e),h=(0,j.Gb)(g),k="bash"===a.toolName;return(0,d.jsx)(i.Dm,{tool:a,result:b,status:g,durationLabel:void 0!==c?`${c}s`:null,cwd:f,titleStyle:{color:h},collapsedPreviewBackground:`color-mix(in srgb, ${h} 5%, transparent)`,buttonStyle:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"6px 10px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",minWidth:0},containerStyle:{border:`1px solid color-mix(in srgb, ${h} 38%, transparent)`,background:`color-mix(in srgb, ${h} 8%, transparent)`},notebookStyle:k})}var t=c(39868);function u(a=768){let[b,c]=(0,e.useState)(!1);return b}function v({children:a,hovered:b,onHoverChange:c,style:e}){return(0,d.jsx)("div",{style:e,onMouseEnter:()=>c?.(!0),onMouseLeave:()=>c?.(!1),"data-message-hovered":b?"true":"false",children:a})}function w({children:a,justify:b="flex-start",style:c}){let e=u();return(0,d.jsx)("div",{"data-message-surface":"footer",style:{display:"flex",alignItems:"center",justifyContent:b,gap:e?4:6,marginTop:4,...c},children:a})}function x({children:a,alignEnd:b=!1,style:c}){return(0,d.jsx)("span",{"data-message-surface":"timestamp",style:{fontSize:10,color:"var(--text-dim)",marginLeft:b?"auto":void 0,...c},children:a})}function y({children:a,visible:b,style:c}){return(0,d.jsx)("div",{style:{display:"flex",gap:3,opacity:+!!b,pointerEvents:b?"auto":"none",transition:"opacity 0.12s",...c},children:a})}function z({children:a,onClick:b,disabled:c=!1,title:e,active:f=!1,style:g,onMouseEnterColor:h="var(--accent)",onMouseLeaveColor:i="var(--text-dim)",iconOnlyOnMobile:j=!1}){let k=u();return(0,d.jsx)("button",{onClick:b,disabled:c,title:e,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:c?"not-allowed":"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...g},onMouseEnter:a=>{c||(a.currentTarget.style.color=h)},onMouseLeave:a=>{c||(a.currentTarget.style.color=i)},children:j&&k&&Array.isArray(a)?a[0]:a})}function A({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16,display:"flex",flexDirection:"column",alignItems:"flex-end"},children:a})}function B({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:b?4:6,maxWidth:b?"92%":"85%"},children:(0,d.jsx)("div",{style:{flex:1,minWidth:0,background:"var(--user-bg)",border:"1px solid rgba(59,130,246,0.2)",borderRadius:12,padding:b?"7px 10px":"8px 12px",fontSize:14,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})})}function C({children:a,hasBody:b=!1}){let c=u();return(0,d.jsx)("div",{style:{display:"flex",gap:c?4:6,flexWrap:"wrap",marginBottom:b?c?6:8:0},children:a})}function D({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16},children:a})}function E({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:b?6:8},children:a})}function F({children:a,accent:b="default"}){let c="subagent"===b;return(0,d.jsx)("div",{"data-message-surface":"custom-card","data-message-accent":b,style:{padding:"8px 14px",borderRadius:8,border:`1px solid ${c?"rgba(99,102,241,0.25)":"var(--border)"}`,background:c?"rgba(99,102,241,0.05)":"var(--bg-panel)",fontSize:13,lineHeight:1.6,color:"var(--text-muted)"},children:a})}function G({icon:a,children:b}){return(0,d.jsxs)("div",{"data-message-surface":"custom-icon-row",style:{display:"flex",alignItems:"flex-start",gap:8},children:[(0,d.jsx)("span",{style:{flexShrink:0,fontSize:14},children:a}),(0,d.jsx)("div",{style:{flex:1,minWidth:0},children:b})]})}function H({text:a,title:b="Copy message",style:c}){let[f,g]=(0,e.useState)(!1),h=u();return(0,d.jsxs)("button",{onClick:()=>{(0,t.D)(a).then(()=>{g(!0),setTimeout(()=>g(!1),1500)})},title:b,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...c},onMouseEnter:a=>{f||(a.currentTarget.style.color="var(--accent)")},onMouseLeave:a=>{f||(a.currentTarget.style.color="var(--text-dim)")},children:[f?(0,d.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,d.jsx)("span",{style:h?{display:"none"}:void 0,children:f?"Copied":"Copy"})]})}function I({provider:a,model:b,modelNames:c,isStreaming:e=!1,estimatedTokens:f=0,tps:g=null}){let h=a&&b?c?.[`${a}:${b}`]??c?.[b]??b:null;return(0,d.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:4,display:"flex",alignItems:"center",gap:6},children:[h&&(0,d.jsx)("span",{children:h}),e&&f>0&&(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,color:"var(--text)"},title:"预估 token 数(流式接收中)",children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:11,fontWeight:400},children:[(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"5",y1:"1.5",x2:"5",y2:"8.5"}),(0,d.jsx)("polyline",{points:"2 6 5 8.5 8 6"})]}),f]}),null!==g&&(0,d.jsxs)("span",{style:{marginLeft:6,padding:"1px 6px",borderRadius:4,background:g>=50?"#53b3cb":g>=30?"#9bc53d":g>=15?"#f9c22e":"#e01a4f",color:"#fff",fontSize:11,fontWeight:400},children:[g.toFixed(1)," t/s"]})]})]})}var J=c(27563);function K({files:a,onOpenFile:b}){return 0===a.length?null:(0,d.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:5,margin:"4px 0 2px"},children:[(0,d.jsx)("span",{style:{fontSize:10,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Files"}),a.map(a=>{let c=a.relativePath.split("/").pop()??a.relativePath;return(0,d.jsxs)("button",{type:"button",title:a.filePath,onClick:()=>b?.(a.filePath,c),style:{display:"inline-flex",alignItems:"center",gap:4,maxWidth:260,padding:"2px 7px",fontSize:10.5,color:"var(--text-muted)",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:999,cursor:b?"pointer":"default"},children:[(0,d.jsxs)("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[(0,d.jsx)("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},children:a.relativePath})]},a.filePath)})]})}var L=c(1453);let M=new Set(["write","edit","multi_edit","str_replace_editor","create_file"]),N=[],O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(a){return a.toString().padStart(2,"0")}function Q(a){if(!a)return null;let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear()&&b.getMonth()===c.getMonth()&&b.getDate()===c.getDate(),e=`${P(b.getHours())}:${P(b.getMinutes())}`;if(d)return e;let f=[`${O[b.getMonth()]} ${b.getDate()}`];b.getFullYear()!==c.getFullYear()&&f.push(String(b.getFullYear()));let g=f.join(", ");return`${g} ${e}`}function R({message:a,isStreaming:b,toolResults:c,modelNames:e,entryId:f,sessionId:g,onFork:h,forking:i,onNavigate:j,prevAssistantEntryId:k,onEditContent:l,onSendMessage:m,showTimestamp:n,prevTimestamp:o,renderVisualCodeBlocks:p,cwd:q,onOpenImage:r,activeFilePath:s,agentRunning:t,onApplyToFile:u,onRunCode:v,onOpenFileAtLine:w,onAcceptDiff:x,compactionShadowCount:y,onLoadShadowed:z,forkFresh:A}){return"user"===a.role?(0,d.jsx)(S,{message:a,entryId:f,onFork:h,forking:i,onNavigate:j,prevAssistantEntryId:k,onEditContent:l,onOpenImage:r,compactionShadowCount:y,onLoadShadowed:z}):"assistant"===a.role?(0,d.jsx)(T,{message:a,isStreaming:b,toolResults:c,modelNames:e,entryId:f,sessionId:g,onSendMessage:m,showTimestamp:n,prevTimestamp:o,renderVisualCodeBlocks:p,cwd:q,activeFilePath:s,agentRunning:t,onApplyToFile:u,onRunCode:v,onOpenFileAtLine:w,onAcceptDiff:x,forkFresh:A}):"bashExecution"===a.role?(0,d.jsx)(U,{message:a}):"toolResult"===a.role?null:"custom"===a.role?(0,d.jsx)(V,{message:a,showTimestamp:n}):null}function S({message:a,entryId:b,onFork:c,forking:g,onNavigate:h,prevAssistantEntryId:i,onEditContent:j,onOpenImage:l,compactionShadowCount:m,onLoadShadowed:n}){let[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),u="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),v="string"==typeof a.content?[]:a.content.filter(a=>"image"===a.type),D=v.flatMap(a=>{let b=(0,k.h5)(a);return b?[{src:b}]:[]}),E=Q(a.timestamp),F=!!b&&!!c,G=!!i&&!!h;return(0,d.jsxs)(A,{hovered:o,onHoverChange:p,children:[(0,d.jsxs)(B,{children:[v.length>0&&(0,d.jsx)(C,{hasBody:!!u,children:v.map((a,b)=>{let c=(0,k.h5)(a);if(!c)return null;let e=a.path&&c.startsWith("/api/files/");return(0,d.jsx)("a",{href:c,target:e||!l?"_blank":void 0,rel:e||!l?"noreferrer":void 0,title:"Open image",style:{display:"block",cursor:"zoom-in"},onClick:a=>{l&&(a.preventDefault(),l(c,void 0,D))},children:(0,d.jsx)("img",{src:c,alt:"",style:{maxWidth:240,maxHeight:240,borderRadius:6,objectFit:"contain",display:"block",border:"1px solid rgba(59,130,246,0.15)"}})},b)})}),u]}),null!=m&&m>0&&(0,d.jsx)("div",{style:{marginTop:4,textAlign:"left"},children:null===q?(0,d.jsx)("button",{onClick:()=>{s||null!==q||(t(!0),(b&&n?n(b):Promise.resolve([])).then(a=>r(a)).catch(()=>r([])).finally(()=>t(!1)))},disabled:s,style:{padding:"5px 12px",fontSize:12,color:"var(--accent)",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:6,cursor:s?"wait":"pointer"},children:s?"Loading…":`Show ${m} compacted message${1===m?"":"s"}`}):(0,d.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:7,background:"var(--bg-panel)",padding:"8px 10px",maxHeight:360,overflowY:"auto"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:6},children:[(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Compacted history"}),(0,d.jsx)("button",{onClick:()=>r(null),style:{padding:"2px 8px",fontSize:11,color:"var(--text-dim)",background:"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer"},children:"Hide"})]}),0===q.length&&(0,d.jsx)("div",{style:{fontSize:12,color:"var(--text-muted)"},children:"No earlier messages to show."}),q.map((a,b)=>{let c,e="string"==typeof(c=a.content)?c:Array.isArray(c)?c.filter(a=>!!a&&"object"==typeof a&&"text"===a.type&&"string"==typeof a.text).map(a=>a.text).join("\n"):"";if(!e.trim())return null;let g="user"===a.role?"User":"assistant"===a.role?"Assistant":"Tool";return(0,d.jsxs)("div",{style:{marginBottom:8,paddingBottom:8,borderBottom:b===q.length-1?"none":"1px solid var(--border)"},children:[(0,d.jsx)("div",{style:{fontSize:10,color:"var(--text-dim)",marginBottom:2},children:g}),(0,d.jsx)(f.T,{content:e,style:{fontSize:12.5}})]},b)})]})}),(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[(0,d.jsx)(y,{visible:o,children:(0,d.jsx)(H,{text:u})}),(F||G)&&(0,d.jsxs)(y,{visible:o||!!g,children:[G&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{h(i),j?.(u)},title:"Edit from here — branches within this session",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("polyline",{points:"15 10 20 15 15 20"}),(0,d.jsx)("path",{d:"M4 4v7a4 4 0 0 0 4 4h12"})]}),"Edit from here"]}),F&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{c(b)},disabled:g,active:!!g,title:g?"Creating new session…":"New session — creates an independent copy from here",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,d.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),g?"Creating…":"New session"]})]}),E&&(0,d.jsx)(x,{children:E})]})]})}function T({message:a,isStreaming:b,toolResults:c,modelNames:f,entryId:g,sessionId:h,onSendMessage:i,showTimestamp:j,prevTimestamp:k,renderVisualCodeBlocks:l,cwd:m,activeFilePath:o,agentRunning:p,onApplyToFile:q,onRunCode:r,onOpenFileAtLine:s,onAcceptDiff:t,forkFresh:u}){var v,A;let B,C=j?Q(a.timestamp):null,F=a.content??N,[G,L]=(0,e.useState)(!1);(0,e.useRef)(null),(0,e.useRef)(new Map);let O=(0,e.useRef)(F),[P,R]=(0,e.useState)(null),[S,U]=(0,e.useState)(new Map);O.current=F;let V=(0,e.useMemo)(()=>{if(!a.timestamp||!k)return;let b=Math.round((a.timestamp-k)/1e3);return b>0?b:void 0},[a.timestamp,k]),W=(0,e.useMemo)(()=>(function(a,b){let c=new Map;if(!a||!b)return c;for(let[d,e]of a){if(!e.timestamp)continue;let a=Math.round((e.timestamp-b)/1e3);a>0&&c.set(d,a)}return c})(c,a.timestamp),[c,a.timestamp]),X=(0,e.useMemo)(()=>(function(a,b,c,d={}){let e=[],f=[],g=[];for(let[h,i]of a.entries()){if("thinking"===i.type){f.push({content:i.thinking,duration:b.get(h)??c,...i.deferred?{deferred:!0,blockIndex:h,entryId:d.entryId,sessionId:d.sessionId??void 0}:{}});continue}if("toolCall"===i.type){e.push(i);continue}g.push(i)}return{tools:e,thinkingBlocks:f,visibleBlocks:g}})(F,S,V,{entryId:g,sessionId:h}),[F,S,V,g,h]),Y=(0,e.useMemo)(()=>(function(a,b,c){if(!a?.length)return[];let d=new Set,e=[];for(let f of a){if("toolCall"!==f.type||!M.has(f.toolName))continue;let a=b?.get(f.toolCallId);if(!a||a.isError)continue;let g=function(a){if(!a)return null;let b=a.file_path??a.path??a.filePath??a.target_file;return"string"==typeof b&&b.trim()?b:null}(f.input);if(!g)continue;let h=function(a,b){let c=a.trim().replace(/\\/g,"/");return c.startsWith("/")||/^[A-Za-z]:\//.test(c)||!b?c:`${b.replace(/\/+$/,"")}/${c.replace(/^\.\//,"")}`}(g,c);if(d.has(h))continue;d.add(h);let i=c?`${c.replace(/\/+$/,"")}/`:"",j=i&&h.startsWith(i)?h.slice(i.length):h;e.push({filePath:h,relativePath:j})}return e})(F,c,m),[F,c,m]),Z=(0,e.useMemo)(()=>F.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),[F]),$=(0,e.useMemo)(()=>Math.round(function(a){let b=0;for(let c of a){if("text"===c.type){b+=c.text.length;continue}if("thinking"===c.type){b+=c.thinking.length;continue}"toolCall"===c.type&&(b+=JSON.stringify(c.input??{}).length)}return b}(F)/4),[F]);return(0,d.jsxs)(D,{hovered:G,onHoverChange:L,children:[(0,d.jsx)(I,{provider:a.provider,model:a.model,modelNames:f,isStreaming:b,estimatedTokens:$,tps:P}),(0,d.jsxs)(E,{children:[!b&&"error"===a.stopReason&&a.errorMessage?.trim()&&(0,d.jsxs)("div",{role:"alert","data-message-surface":"assistant-error",style:{border:"1px solid rgba(248,113,113,0.35)",borderRadius:6,background:"rgba(248,113,113,0.07)",padding:"8px 10px",color:"#f87171",fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:[(0,d.jsx)("strong",{style:{display:"block",marginBottom:2,fontWeight:600},children:"Model response failed"}),a.errorMessage.trim(),(v=a.errorMessage,/unknown system error -122\b|\berrno\s*-?122\b|\bEDQUOT\b|disk quota exceeded/i.test(v)&&(0,d.jsxs)("div",{style:{marginTop:6,color:"var(--text-muted)"},children:["This is EDQUOT (disk quota exceeded, errno 122), not a missing file. Free space/quota in your home directory and retry. Useful checks: ",(0,d.jsx)("code",{children:"quota -s"}),", ",(0,d.jsx)("code",{children:"df -h ~"}),", ",(0,d.jsx)("code",{children:"df -i ~"}),", ",(0,d.jsx)("code",{children:"du -sh ~/.pi ~/.npm ~/.cache"}),"."]}))]}),(X.tools.length>0||X.thinkingBlocks.length>0)&&(0,d.jsx)(J.kD,{tools:X.tools,results:c,durations:W,thinkingBlocks:X.thinkingBlocks,isStreaming:b,cwd:m}),X.visibleBlocks.map((a,e)=>(0,d.jsx)(n,{block:a,toolResults:c,isStreaming:b,toolCallDurations:W,onSendMessage:i,renderVisualCodeBlocks:l,cwd:m,activeFilePath:o,agentRunning:p,onApplyToFile:q,onRunCode:r,onOpenFileAtLine:s,onAcceptDiff:t},e))]}),!b&&(0,d.jsx)(K,{files:Y,onOpenFile:s?(a,b)=>s(a,b):void 0}),(0,d.jsxs)(w,{style:{gap:8},children:[a.usage&&!b&&(0,d.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:(A=a.usage,B=[],A.input&&B.push(`${A.input.toLocaleString()} in`),A.output&&B.push(`${A.output.toLocaleString()} out`),A.cacheRead&&B.push(`${A.cacheRead.toLocaleString()} cache`),B.join(" \xb7 "))}),Z&&!b&&(0,d.jsx)(y,{visible:G,children:(0,d.jsx)(H,{text:Z})}),u?.show&&!b&&(0,d.jsxs)(d.Fragment,{children:[u.error&&(0,d.jsx)("span",{style:{fontSize:11,color:"#f87171"},children:u.error}),(0,d.jsxs)(z,{onClick:u.onFork,disabled:u.busy,title:"Fork 新会话 — 携带精简摘要,避免每次提问都等待模型 prefill 变慢",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,d.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),u.busy?"Forking…":"Fork 新会话"]})]}),C&&(0,d.jsx)(x,{alignEnd:!0,children:C})]})]})}function U({message:a}){let b=Q(a.timestamp),c=void 0!==a.exitCode&&0!==a.exitCode,e=a.cancelled?"cancelled":void 0!==a.exitCode?`exit ${a.exitCode}`:null;return(0,d.jsxs)("div",{style:{marginBottom:12},children:[(0,d.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:8,overflow:"hidden",background:"var(--bg-panel)"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:7,padding:"6px 10px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.45},children:[(0,d.jsx)("span",{style:{color:"var(--accent)",flexShrink:0},children:"$"}),(0,d.jsx)("span",{style:{flex:1,minWidth:0,whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--text)"},children:a.command}),a.excludeFromContext&&(0,d.jsx)("span",{title:"Output is not sent to the model on the next turn",style:{flexShrink:0,padding:"0 5px",fontSize:9.5,color:"var(--text-dim)",border:"1px solid var(--border)",borderRadius:3},children:"not in context"}),e&&(0,d.jsx)("span",{style:{flexShrink:0,fontSize:10.5,color:c?"#f87171":"var(--text-dim)"},children:e})]}),(0,d.jsx)(L.m,{text:a.output||"(no output)",maxHeight:360,collapsible:!0,background:"var(--bg)",textColor:c?"#f87171":"var(--text-muted)"}),a.truncated&&a.fullOutputPath&&(0,d.jsxs)("div",{style:{padding:"4px 10px",fontSize:10.5,color:"var(--text-dim)",borderTop:"1px solid var(--border)"},children:["Output truncated \xb7 ",a.fullOutputPath]})]}),b&&(0,d.jsx)(w,{justify:"flex-end",style:{marginTop:3},children:(0,d.jsx)(x,{children:b})})]})}function V({message:a,showTimestamp:b}){if(!a.display)return null;let c=b?Q(a.timestamp):null,e="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),g="subagent-notify"===a.customType,h="branch-summary"===a.customType,i=e.match(/^Background task (completed|failed|paused):\s*\*\*(.+?)\*\*/),j=i?"completed"===i[1]?"✅":"failed"===i[1]?"❌":"⏸":h?"⑂":g?"\uD83E\uDD16":"ℹ";return(0,d.jsxs)("div",{style:{marginBottom:12},children:[(0,d.jsx)(F,{accent:g?"subagent":"default",children:(0,d.jsx)(G,{icon:j,children:(0,d.jsx)("div",{"data-message-surface":"custom-body",children:(0,d.jsx)(f.T,{content:e,style:{fontSize:13}})})})}),(c||i)&&(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[i&&(0,d.jsx)(x,{children:i[2]}),c&&(0,d.jsx)(x,{children:c})]})]})}},85034:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/annovibe/annovibe/app/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/annovibe/annovibe/app/error.tsx","default")},86364:(a,b,c)=>{"use strict";function d(){return[{type:"image/svg+xml",sizes:"any",url:"/icon.svg?6eceb6fbd1a5bb90"}]}c.r(b),c.d(b,{default:()=>d})},90427:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},96487:()=>{},97305:(a,b,c)=>{Promise.resolve().then(c.bind(c,2420))}};
|
|
264
|
+
\`\`\``).find(a=>"widget"===a.type),b?.type==="widget"?{title:b.title,code:b.code}:null);if(c)return(0,d.jsx)(s.u,{code:c.code,isStreaming:!1,title:c.title,onSendMessage:i})}if("report-gallery"===b.trim().toLowerCase()){let b=function(a){try{let b=JSON.parse(a);if(!Array.isArray(b))return null;let c=b.flatMap(a=>a&&"object"==typeof a&&"string"==typeof a.src&&a.src.trim()?[{src:a.src.trim(),alt:"string"==typeof a.alt&&a.alt.trim()?a.alt.trim():void 0,caption:"string"==typeof a.caption&&a.caption.trim()?a.caption.trim():void 0}]:[]);return c.length>0?c.slice(0,12):null}catch{return null}}(a);if(b)return(0,d.jsx)(H,{items:b,baseFilePath:f,cwd:g,onOpenLocalFile:h})}return j&&(w=b.trim().toLowerCase(),(x=a.trim())&&("svg"===w||"xml"===w&&/^<svg[\s>]/i.test(x)?/^<svg[\s>]/i.test(x):!("html"!==w||/<!doctype|<html[\s>]|<head[\s>]|<body[\s>]/i.test(x))&&/^<(style|svg|div|section|article|main|figure|canvas)\b/i.test(x)))?(0,d.jsx)(s.u,{code:a,isStreaming:!1,title:`${b||"visual"} preview`,onSendMessage:i}):(0,d.jsx)(q,{code:a,language:b,variant:c,isStreaming:e,testAsyncDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o})}function L({children:a,className:b,node:c,baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i=!1,isStreaming:j=!1,testAsyncCodeDelayMs:k=0,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onOpenFileAtLine:p,onAcceptDiff:q,...r}){let s=("string"==typeof a?a:Array.isArray(a)?a.map(a=>"string"==typeof a?a:"").join(""):"").replace(/\n$/,""),t=B(b);return"data-block"in r?(0,d.jsx)(K,{code:s,language:t,variant:"chat",isStreaming:j||!!r["data-incomplete"],baseFilePath:e,cwd:f,onOpenLocalFile:g,onWidgetSendMessage:h,renderVisualCodeBlocks:i,testAsyncCodeDelayMs:k,activeFilePath:l,agentRunning:m,onApplyToFile:n,onRunCode:o,onAcceptDiff:q}):(0,d.jsx)(F,{value:s,baseFilePath:e,cwd:f,onOpenLocalFile:g,onOpenFileAtLine:p})}function M({content:a,className:b="markdown-body",style:c,codeBlockVariant:m="chat",baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s=!1,enableImageGallery:t=!1,isStreaming:u=!1,renderer:x="react-markdown",testAsyncCodeDelayMs:z=0,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N}){let O,P,{isDark:Q}=(0,l.D)(),R=t?function(a){let b=a.split("\n"),c=[],d=0;for(;d<b.length;){if(!G(b[d])){c.push(b[d]),d+=1;continue}let a=[],e=d;for(;e<b.length;){let c=G(b[e]);if(!c)break;let d=e+1,f=d;for(;f<b.length&&!b[f].trim();)f+=1;let g=f<b.length?function(a){let b=/^\s*(?:_([^_]+)_|\*([^*]+)\*)\s*$/.exec(a);return(b?.[1]??b?.[2]??"").trim()||null}(b[f]):null;g&&(c.caption=g,d=f+1),a.push(c);let h=d;for(;h<b.length&&!b[h].trim();)h+=1;if(!G(b[h])){e=d;break}e=h}if(a.length>1||a.some(a=>a.caption)){c.push(["```report-gallery",JSON.stringify(a,null,2),"```"].join("\n")),d=e;continue}c.push(b[d]),d+=1}return c.join("\n")}(a):a,S=H?(O=R.split("\n"),P=!1,O.map(a=>/^\s*(```|~~~)/.test(a)?(P=!P,a):P||/\]\([^)]*$/.test(a)?a:a.replace(/(^|[\s([{"'])((?:\.{1,2}\/|\/|~\/|[\w@.-]+\/)[\w@./+-]+\.[A-Za-z0-9]{1,12}:\d+)\b/g,(a,b,c)=>`${b}[${c}](${c})`)).join("\n")):R,T=(0,e.useMemo)(()=>u?{cjk:i.h,math:j.D,mermaid:k.a}:{cjk:i.h,math:j.D,mermaid:k.a,code:function(a,b=[n.cx,n.aU]){return y(),{name:"shiki",type:"code-highlighter",getSupportedLanguages:()=>[...v],getThemes:()=>b,supportsLanguage(a){let b;return 0===v.size||null!==((b=a.trim().toLowerCase())?v.has(b)?b:w.get(b)??null:null)},highlight(b,c){let d=b.language,e=(0,n.wY)(b.code,d,a,a=>{c?.({tokens:a.tokens,bg:a.bg,fg:a.fg})});return e?{tokens:e.tokens,bg:e.bg,fg:e.fg}:(y(),null)}}}(Q)},[Q,u]);return"streamdown"!==x||o||t?(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(f.oz,{remarkPlugins:[g.A],components:{code({className:a,children:b,node:c}){let e=B(a),f=String(b),g=f.replace(/\n$/,"");return a?.includes("language-")||f.includes("\n")?(0,d.jsx)(K,{code:g,language:e,variant:m,isStreaming:u,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onAcceptDiff:N}):(0,d.jsx)(F,{value:g,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H})},pre:({children:a})=>(0,d.jsx)(d.Fragment,{children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})}):(0,d.jsx)("div",{className:b,style:c,children:(0,d.jsx)(h.jH,{mode:u?"streaming":"static",isAnimating:!!u,plugins:T,components:{code:({children:a,className:b,node:c,...e})=>(0,d.jsx)(L,{...e,node:c,className:b,baseFilePath:o,cwd:p,onOpenLocalFile:q,onWidgetSendMessage:r,renderVisualCodeBlocks:s,isStreaming:u,testAsyncCodeDelayMs:z,activeFilePath:A,agentRunning:C,onApplyToFile:D,onRunCode:E,onOpenFileAtLine:H,onAcceptDiff:N,children:a}),a:({href:a,children:b,node:c,...e})=>(0,d.jsx)(I,{...e,href:a,baseFilePath:o,cwd:p,onOpenLocalFile:q,onOpenFileAtLine:H,children:b}),img:({src:a,alt:b,node:c,...e})=>(0,d.jsx)(J,{...e,src:a,alt:b,baseFilePath:o,cwd:p,onOpenLocalFile:q})},children:S})})}},52515:(a,b,c)=>{"use strict";c.d(b,{K$:()=>h,Ph:()=>g,Tg:()=>m,fj:()=>f,mK:()=>i,ml:()=>j,nG:()=>k,pg:()=>l,v7:()=>e});var d=c(48249);function e(a){return a<1024?`${a} B`:a<1048576?`${(a/1024).toFixed(1)} KB`:`${(a/1048576).toFixed(1)} MB`}function f({children:a,style:b}){return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",height:"100%",overflow:"hidden",...b},children:a})}function g({children:a,style:b,bodyRef:c,onScroll:e}){return(0,d.jsx)("div",{ref:c,onScroll:e,style:{flex:1,overflow:"auto",background:"var(--bg)",...b},children:a})}function h({pathLabel:a,title:b,trailing:c,style:e}){return(0,d.jsxs)("div",{"data-file-viewer-surface":"status-bar",style:{display:"flex",alignItems:"center",gap:12,padding:"4px 16px",borderBottom:"1px solid var(--border)",fontSize:11,color:"var(--text-dim)",background:"var(--bg)",flexShrink:0,...e},children:[(0,d.jsx)("span",{style:{flex:1,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},title:b??a,children:a}),c]})}function i({watching:a}){return(0,d.jsxs)("span",{title:a?"Live sync active":"Not watching",style:{display:"flex",alignItems:"center",gap:4,color:a?"#4ade80":"var(--text-dim)"},children:[(0,d.jsx)("span",{style:{width:7,height:7,borderRadius:"50%",background:a?"#4ade80":"var(--border)",display:"inline-block",boxShadow:a?"0 0 4px #4ade80":"none"}}),a?"live":"static"]})}function j({children:a,onClick:b,title:c,disabled:e=!1,active:f=!1,emphasis:g="default",style:h}){let i="primary"==g,k="danger"==g;return(0,d.jsx)("button",{"data-file-viewer-surface":"toolbar-button",onClick:b,disabled:e,title:c,style:{padding:"2px 10px",fontSize:11,cursor:e?"not-allowed":"pointer",background:i?"var(--accent)":k?"rgba(239,68,68,0.1)":f?"var(--bg-selected)":"var(--bg-hover)",color:i?"#fff":k?"#ef4444":f?"var(--text)":"var(--text-muted)",border:`1px solid ${i?"var(--accent)":k?"rgba(239,68,68,0.3)":"var(--border)"}`,borderRadius:5,fontWeight:f||i||k?600:400,opacity:e?.6:1,...h},children:a})}function k({children:a,tone:b="muted",style:c}){return(0,d.jsx)("div",{style:{height:"100%",display:"flex",alignItems:"center",justifyContent:"center",padding:24,color:"error"===b?"#f87171":"var(--text-muted)",fontSize:13,textAlign:"center",...c},children:a})}function l({diff:a,emptyLabel:b="No changes"}){if(!a.some(a=>"unchanged"!==a.type))return(0,d.jsx)("div",{style:{padding:"12px 16px",fontSize:12,color:"var(--text-dim)",fontFamily:"var(--font-mono)"},children:b});let c=new Set(a.flatMap((a,b)=>"unchanged"!==a.type?[b]:[])),e=new Set;for(let b of c)for(let c=Math.max(0,b-3);c<=Math.min(a.length-1,b+3);c++)e.add(c);let f=[],g=0;for(;g<a.length;)if(e.has(g)){let b=[];for(;g<a.length&&e.has(g);)b.push(a[g]),g++;f.push({hidden:!1,lines:b})}else{let b=0;for(;g<a.length&&!e.has(g);)b++,g++;f.push({hidden:!0,count:b})}let h=[],i=1;for(let b of a)"removed"===b.type?h.push(0):h.push(i++);let j=0;return(0,d.jsx)("div",{style:{fontFamily:"var(--font-mono)",fontSize:13,lineHeight:1.6},children:f.map((a,b)=>{if(a.hidden){let c=(0,d.jsxs)("div",{style:{padding:"2px 16px",color:"var(--text-dim)",background:"var(--bg-panel)",fontSize:11,borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)"},children:["... ",a.count," unchanged lines ..."]},b);return j+=a.count,c}let c=a.lines.map((a,b)=>{let c=h[j+b],e="added"===a.type?"rgba(0,200,80,0.12)":"removed"===a.type?"rgba(240,60,60,0.14)":"transparent",f="added"===a.type?"+":"removed"===a.type?"-":" ",g="added"===a.type?"#4ade80":"removed"===a.type?"#f87171":"var(--text-dim)";return(0,d.jsxs)("div",{style:{display:"flex",background:e,borderLeft:"added"===a.type?"3px solid #4ade80":"removed"===a.type?"3px solid #f87171":"3px solid transparent"},children:[(0,d.jsx)("span",{style:{minWidth:44,padding:"0 8px 0 16px",textAlign:"right",color:"var(--text-dim)",userSelect:"none",fontSize:11,lineHeight:1.6,borderRight:"1px solid var(--border)",background:"var(--bg-panel)",flexShrink:0},children:"removed"===a.type?a.lineNo:c||""}),(0,d.jsx)("span",{style:{minWidth:16,padding:"0 6px",color:g,userSelect:"none",flexShrink:0,fontWeight:600},children:f}),(0,d.jsx)("span",{style:{flex:1,padding:"0 8px 0 0",whiteSpace:"pre",color:"var(--text)",overflowX:"auto"},children:a.text||"\xa0"})]},b)});return j+=a.lines.length,(0,d.jsx)("div",{children:c},b)})})}function m({options:a}){return(0,d.jsx)("div",{"data-file-viewer-surface":"segmented-toggle",style:{display:"flex",borderRadius:5,overflow:"hidden",border:"1px solid var(--border)"},children:a.map((a,b)=>(0,d.jsx)("button",{onClick:a.onClick,style:{padding:"2px 8px",fontSize:11,border:"none",borderLeft:0===b?"none":"1px solid var(--border)",cursor:"pointer",background:a.active?"var(--bg-selected)":"var(--bg-hover)",color:a.active?"var(--text)":"var(--text-muted)",fontWeight:a.active?600:400},children:a.label},a.key))})}},54097:(a,b,c)=>{"use strict";c.d(b,{p:()=>f,t:()=>e});var d=c(48249);function e({children:a,style:b,kind:c}){return(0,d.jsx)("div",{"data-disclosure-surface":"panel","data-disclosure-kind":c,style:{border:"1px solid var(--border)",borderRadius:6,overflow:"hidden",background:"var(--bg-panel)",...b},children:a})}function f({children:a,style:b}){return(0,d.jsx)("div",{"data-disclosure-surface":"body",style:{borderTop:"1px solid var(--border)",...b},children:a})}},55038:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/annovibe/annovibe/app/global-error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/annovibe/annovibe/app/global-error.tsx","default")},57703:(a,b,c)=>{"use strict";c.d(b,{V:()=>h});var d=c(48249),e=c(6954),f=c(40648),g=c(41044);function h({expanded:a,onToggle:b,status:c,title:i,summary:j,durationLabel:k,leading:l,titleTooltip:m,summaryTooltip:n,buttonStyle:o,titleStyle:p,summaryStyle:q,durationStyle:r}){return(0,d.jsxs)(e.R,{expanded:a,onToggle:b,buttonStyle:o,children:[l,(0,d.jsx)("span",{title:m??i,style:{color:"var(--text-muted)",fontFamily:"var(--font-mono)",fontWeight:600,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flexShrink:+!j,minWidth:0,flex:j?void 0:1,...p},children:"running"===c?(0,d.jsx)(f.n,{children:i}):i}),j?(0,d.jsx)("span",{title:n??j,style:{color:"var(--text-dim)",fontFamily:"var(--font-mono)",fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1,minWidth:0,...q},children:"running"===c?(0,d.jsx)(f.n,{children:j}):j}):(0,d.jsx)("span",{style:{flex:1,minWidth:0}}),(0,d.jsx)(g.U1,{status:c}),k?(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...r},children:k}):null]})}},60125:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,33071,23))},65950:(a,b,c)=>{"use strict";c.d(b,{aU:()=>f,cx:()=>e,nS:()=>r,Rd:()=>q,wY:()=>p,tG:()=>m});class d{#a;#b;constructor(a){this.#b=new Map,this.#a=a}get(a){if(!this.#b.has(a))return;let b=this.#b.get(a);return this.#b.delete(a),this.#b.set(a,b),b}set(a,b){for(this.#b.has(a)&&this.#b.delete(a);this.#b.size>=this.#a;){let a=this.#b.keys().next().value;if(void 0===a)break;this.#b.delete(a)}this.#b.set(a,b)}delete(a){this.#b.delete(a)}get size(){return this.#b.size}}let e="github-light",f="github-dark",g=new d(10),h=new d(200),i=new Set,j=new Map,k=null;function l(a,b,c){let d=a.slice(0,100),e=a.length>100?a.slice(-100):"";return`${b}:${c}:${a.length}:${d}:${e}`}function m(a){return void 0===a||0===a?{}:{fontStyle:1&a?"italic":void 0,fontWeight:2&a?700:void 0,textDecorationLine:4&a?"underline":void 0}}function n(){return k||(k=Promise.resolve().then(c.bind(c,78908)).then(a=>{if(0===i.size){for(let b of Object.keys(a.bundledLanguages??{}))i.add(b.toLowerCase());for(let b of a.bundledLanguagesInfo??[]){let a=b.id.toLowerCase();for(let c of b.aliases??[])j.set(c.toLowerCase(),a)}}return a})),k}async function o(a,b=e,c=f){let d=`${a}:${b}:${c}`,h=g.get(d);if(h)return h;let i=n().then(({createHighlighter:d})=>d({langs:[a],themes:[b,c]})).catch(a=>{throw g.delete(d),a});return g.set(d,i),i}function p(a,b,c,d){let g=q(a,b,c);if(g)return g;let k=c?f:e,m=b.trim().toLowerCase();if(!m)return null;let p=l(a,m,k);return n().then(()=>{let c,g=(c=b.trim().toLowerCase())?i.has(c)?c:j.get(c)??null:null;return g?o(g,e,f).then(b=>{let c=b.codeToTokens(a,{lang:g,theme:k}),e={bg:c.bg??"transparent",fg:c.fg??"inherit",tokens:c.tokens};return h.set(p,e),d(e),e}):null}).catch(a=>{console.warn("[Shiki] highlight failed:",a)}),null}function q(a,b,c){let d=b.trim().toLowerCase();if(!d)return null;let g=l(a,d,c?f:e);return h.get(g)??null}function r(a){return{bg:"transparent",fg:"inherit",tokens:a.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split("\n").map(a=>""===a?[]:[{color:"inherit",content:a}])}}},69613:(a,b,c)=>{Promise.resolve().then(c.bind(c,43248))},73383:(a,b,c)=>{"use strict";c.d(b,{pm:()=>k});var d=c(48249),e=c(67484),f=c(54097),g=c(6954),h=c(40648);function i({expanded:a,onToggle:b,durationLabel:c,isStreaming:e=!1,leading:f,label:j="Thinking",buttonStyle:k,labelStyle:l,durationStyle:m}){return(0,d.jsxs)(g.R,{expanded:a,onToggle:b,buttonStyle:{width:"100%",display:"flex",alignItems:"center",gap:7,minWidth:0,textAlign:"left",cursor:"pointer",border:"none",background:"transparent",color:"var(--text-muted)",...k},children:[f,(0,d.jsx)("span",{style:{fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,flex:1,...l},children:e?(0,d.jsx)(h.n,{children:j}):j}),c&&(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",fontVariantNumeric:"tabular-nums",flexShrink:0,...m},children:c})]})}function j({content:a,contentStyle:b}){return(0,d.jsx)(f.p,{style:{color:"var(--text-muted)",fontSize:12,lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word",...b},children:(0,d.jsx)("div",{style:{padding:"8px 10px"},children:a})})}function k({content:a,durationLabel:b,isStreaming:c=!1,leading:g,label:h="Thinking",containerStyle:l,buttonStyle:m,labelStyle:n,durationStyle:o,contentStyle:p,deferred:q=!1,blockIndex:r,entryId:s,sessionId:t}){let[u,v]=(0,e.useState)(!1),[w,x]=(0,e.useState)(null),[y,z]=(0,e.useState)(!1),[A,B]=(0,e.useState)(null),C=q&&""===a.trim()&&null===w,D=async()=>{let a=!u;if(v(a),a&&C&&!y){if(!t||!s||void 0===r)return void B("Thinking is unavailable");z(!0),B(null);try{let a=new URLSearchParams({kind:"thinking",entryId:s,blockIndex:String(r)}),b=await fetch(`/api/sessions/${encodeURIComponent(t)}/media?${a.toString()}`,{cache:"no-store"}),c=await b.json();if(!b.ok)throw Error(c.error??`HTTP ${b.status}`);x(c.thinking??"")}catch(a){B(a instanceof Error?a.message:String(a))}finally{z(!1)}}},E=w??a;return(0,d.jsxs)(f.t,{kind:"thinking",style:l,children:[(0,d.jsx)(i,{expanded:u,onToggle:D,durationLabel:b,isStreaming:c,leading:g,label:h,buttonStyle:m,labelStyle:n,durationStyle:o}),u&&(0,d.jsx)(j,{content:y?"Loading thinking…":A??E,contentStyle:p})]})}},78335:()=>{},80251:(a,b,c)=>{"use strict";function d(a,b){for(let c of b){let b=a[c];if(null!=b&&""!==b)return String(b)}return null}function e(a,b=60){let c=a.replace(/\s+/g," ").trim();return c.length<=b?c:`${c.slice(0,Math.max(0,b-3))}...`}function f(a){let b=a.toLowerCase().split("__").filter(Boolean);return b[b.length-1]??a.toLowerCase()}function g(a,b=120){let c=Object.keys(a);return 0===c.length?"":"command"in a?String(a.command).slice(0,b):"cmd"in a?String(a.cmd).slice(0,b):"path"in a?String(a.path).slice(0,b):"file_path"in a?String(a.file_path).slice(0,b):"pattern"in a?String(a.pattern).slice(0,b):"query"in a?String(a.query).slice(0,b):String(a[c[0]]).slice(0,b)}function h(a){let b=a.toolName||"tool",c=f(b),g=a.input??{};if(["bash","execute","run","shell","exec_command","execute_command"].includes(c))return{canonicalName:c,kind:"terminal",label:"Shell",summary:e(d(g,["command","cmd"])??b,60)};if(["read","readfile","read_file"].includes(c))return{canonicalName:c,kind:"read",label:"Read",summary:e(d(g,["file_path","path"])??b,60)};if(["write","edit","write_file","create_file","notebook_edit"].includes(c)){let a,f=d(g,["file_path","path","notebook_path","filename"]);return{canonicalName:c,kind:"edit",label:"Edit",summary:e(f?(a=f.split(/[\\/]/).filter(Boolean))[a.length-1]??f:b,60)}}if(["search","grep","glob","find","find_files","websearch"].includes(c))return{canonicalName:c,kind:"search",label:"Search",summary:e(d(g,["pattern","query","glob"])??b,60)};if(["subagent","agent"].includes(c))return{canonicalName:c,kind:"agent",label:"Agent",summary:e([d(g,["agent","name","agentName"]),d(g,["prompt","task","message"])].filter(Boolean).join(": ")||b,60)};let h=d(g,["command","cmd","path","file_path","pattern","query","glob","prompt","description"])??function(a){try{return JSON.stringify(a)}catch{return String(a)}}(g)??b;return{canonicalName:c,kind:"tool",label:e(b,60),summary:e(h,60)}}c.d(b,{WI:()=>f,Wm:()=>g,wS:()=>h})},82704:()=>{},84153:(a,b,c)=>{Promise.resolve().then(c.bind(c,85034))},84963:(a,b,c)=>{"use strict";c.d(b,{D:()=>R});var d=c(48249),e=c(67484),f=c(51415),g=c(40648),h=c(73383),i=c(8033),j=c(41044),k=c(129),l=c(31218),m=c(7952);function n({block:a,toolResults:b,isStreaming:c,streamingDuration:e,toolCallDurations:f,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t}){if("text"===a.type)return(0,d.jsx)(o,{block:a,isStreaming:c,onSendMessage:g,renderVisualCodeBlocks:h,cwd:i,activeFilePath:j,agentRunning:l,onApplyToFile:m,onRunCode:p,onOpenFileAtLine:q,onAcceptDiff:t});if("image"===a.type)return(0,d.jsx)(k.O7,{images:[a]});if("thinking"===a.type)return(0,d.jsx)(r,{block:a,duration:e,isStreaming:c});let u=b?.get(a.toolCallId),v=f?.get(a.toolCallId);return(0,d.jsx)(s,{block:a,result:u,duration:v,isStreaming:c,cwd:i})}function o({block:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}){let r=a.text,s=(0,m.aH)(r);if(!s.some(a=>"widget"===a.type)){if(b&&(0,m.qk)(r)){let a=s.filter(a=>"text"===a.type).map(a=>a.content).join("\n\n");return(0,d.jsxs)(d.Fragment,{children:[a&&(0,d.jsx)(p,{text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n}),(0,d.jsx)(q,{})]})}return(0,d.jsx)(p,{text:r,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n})}return(0,d.jsx)(d.Fragment,{children:s.map((a,m)=>"text"===a.type?(0,d.jsx)(p,{text:a.content,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:e,cwd:f,activeFilePath:g,agentRunning:h,onApplyToFile:i,onRunCode:j,onOpenFileAtLine:k,onAcceptDiff:n},m):(0,d.jsx)(l.u,{code:a.code,isStreaming:!!a.partial,title:a.title,showOverlay:a.showOverlay,onSendMessage:c},m))})}function p({text:a,isStreaming:b,onSendMessage:c,renderVisualCodeBlocks:g,cwd:h,activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}){let q=(0,e.useMemo)(()=>(0,k.qn)(a,h),[h,a]);return(0,d.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:8*(q.length>0)},children:[(0,d.jsx)(f.T,{content:a,cwd:h,onWidgetSendMessage:c,renderVisualCodeBlocks:g,isStreaming:b,renderer:"streamdown",activeFilePath:i,agentRunning:j,onApplyToFile:l,onRunCode:m,onOpenFileAtLine:n,onAcceptDiff:o}),q.length>0&&(0,d.jsx)(k.eR,{imagePaths:q})]})}function q(){return(0,d.jsx)(g.r,{height:88,style:{border:"1px solid var(--border)"}})}function r({block:a,duration:b,isStreaming:c}){return(0,d.jsx)(h.pm,{content:a.thinking,durationLabel:void 0!==b?`${b}s`:null,isStreaming:c,buttonStyle:{width:"100%",padding:"6px 10px",fontSize:12},containerStyle:{fontSize:13},contentStyle:{background:"var(--bg-panel)"}})}function s({block:a,result:b,duration:c,isStreaming:e,cwd:f}){let g=(0,j.s2)(b,e),h=(0,j.Gb)(g),k="bash"===a.toolName;return(0,d.jsx)(i.Dm,{tool:a,result:b,status:g,durationLabel:void 0!==c?`${c}s`:null,cwd:f,titleStyle:{color:h},collapsedPreviewBackground:`color-mix(in srgb, ${h} 5%, transparent)`,buttonStyle:{display:"flex",alignItems:"center",gap:7,width:"100%",padding:"6px 10px",background:"none",border:"none",color:"var(--text-muted)",cursor:"pointer",fontSize:12,textAlign:"left",minWidth:0},containerStyle:{border:`1px solid color-mix(in srgb, ${h} 38%, transparent)`,background:`color-mix(in srgb, ${h} 8%, transparent)`},notebookStyle:k})}var t=c(39868);function u(a=768){let[b,c]=(0,e.useState)(!1);return b}function v({children:a,hovered:b,onHoverChange:c,style:e}){return(0,d.jsx)("div",{style:e,onMouseEnter:()=>c?.(!0),onMouseLeave:()=>c?.(!1),"data-message-hovered":b?"true":"false",children:a})}function w({children:a,justify:b="flex-start",style:c}){let e=u();return(0,d.jsx)("div",{"data-message-surface":"footer",style:{display:"flex",alignItems:"center",justifyContent:b,gap:e?4:6,marginTop:4,...c},children:a})}function x({children:a,alignEnd:b=!1,style:c}){return(0,d.jsx)("span",{"data-message-surface":"timestamp",style:{fontSize:10,color:"var(--text-dim)",marginLeft:b?"auto":void 0,...c},children:a})}function y({children:a,visible:b,style:c}){return(0,d.jsx)("div",{style:{display:"flex",gap:3,opacity:+!!b,pointerEvents:b?"auto":"none",transition:"opacity 0.12s",...c},children:a})}function z({children:a,onClick:b,disabled:c=!1,title:e,active:f=!1,style:g,onMouseEnterColor:h="var(--accent)",onMouseLeaveColor:i="var(--text-dim)",iconOnlyOnMobile:j=!1}){let k=u();return(0,d.jsx)("button",{onClick:b,disabled:c,title:e,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:c?"not-allowed":"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...g},onMouseEnter:a=>{c||(a.currentTarget.style.color=h)},onMouseLeave:a=>{c||(a.currentTarget.style.color=i)},children:j&&k&&Array.isArray(a)?a[0]:a})}function A({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16,display:"flex",flexDirection:"column",alignItems:"flex-end"},children:a})}function B({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",alignItems:"flex-end",gap:b?4:6,maxWidth:b?"92%":"85%"},children:(0,d.jsx)("div",{style:{flex:1,minWidth:0,background:"var(--user-bg)",border:"1px solid rgba(59,130,246,0.2)",borderRadius:12,padding:b?"7px 10px":"8px 12px",fontSize:14,lineHeight:1.6,color:"var(--text)",whiteSpace:"pre-wrap",wordBreak:"break-word"},children:a})})}function C({children:a,hasBody:b=!1}){let c=u();return(0,d.jsx)("div",{style:{display:"flex",gap:c?4:6,flexWrap:"wrap",marginBottom:b?c?6:8:0},children:a})}function D({children:a,hovered:b,onHoverChange:c}){let e=u();return(0,d.jsx)(v,{hovered:b,onHoverChange:c,style:{marginBottom:e?12:16},children:a})}function E({children:a}){let b=u();return(0,d.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:b?6:8},children:a})}function F({children:a,accent:b="default"}){let c="subagent"===b;return(0,d.jsx)("div",{"data-message-surface":"custom-card","data-message-accent":b,style:{padding:"8px 14px",borderRadius:8,border:`1px solid ${c?"rgba(99,102,241,0.25)":"var(--border)"}`,background:c?"rgba(99,102,241,0.05)":"var(--bg-panel)",fontSize:13,lineHeight:1.6,color:"var(--text-muted)"},children:a})}function G({icon:a,children:b}){return(0,d.jsxs)("div",{"data-message-surface":"custom-icon-row",style:{display:"flex",alignItems:"flex-start",gap:8},children:[(0,d.jsx)("span",{style:{flexShrink:0,fontSize:14},children:a}),(0,d.jsx)("div",{style:{flex:1,minWidth:0},children:b})]})}function H({text:a,title:b="Copy message",style:c}){let[f,g]=(0,e.useState)(!1),h=u();return(0,d.jsxs)("button",{onClick:()=>{(0,t.D)(a).then(()=>{g(!0),setTimeout(()=>g(!1),1500)})},title:b,style:{display:"flex",alignItems:"center",gap:4,padding:"3px 8px",height:22,background:"none",border:"none",borderRadius:5,color:f?"var(--accent)":"var(--text-dim)",cursor:"pointer",fontSize:11,fontWeight:400,whiteSpace:"nowrap",transition:"color 0.12s",...c},onMouseEnter:a=>{f||(a.currentTarget.style.color="var(--accent)")},onMouseLeave:a=>{f||(a.currentTarget.style.color="var(--text-dim)")},children:[f?(0,d.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("polyline",{points:"20 6 9 17 4 12"})}):(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),(0,d.jsx)("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),(0,d.jsx)("span",{style:h?{display:"none"}:void 0,children:f?"Copied":"Copy"})]})}function I({provider:a,model:b,modelNames:c,isStreaming:e=!1,estimatedTokens:f=0,tps:g=null}){let h=a&&b?c?.[`${a}:${b}`]??c?.[b]??b:null;return(0,d.jsxs)("div",{style:{fontSize:11,color:"var(--text-dim)",marginBottom:4,display:"flex",alignItems:"center",gap:6},children:[h&&(0,d.jsx)("span",{children:h}),e&&f>0&&(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:4,color:"var(--text)"},title:"预估 token 数(流式接收中)",children:[(0,d.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:2,fontSize:11,fontWeight:400},children:[(0,d.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 10 10",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"5",y1:"1.5",x2:"5",y2:"8.5"}),(0,d.jsx)("polyline",{points:"2 6 5 8.5 8 6"})]}),f]}),null!==g&&(0,d.jsxs)("span",{style:{marginLeft:6,padding:"1px 6px",borderRadius:4,background:g>=50?"#53b3cb":g>=30?"#9bc53d":g>=15?"#f9c22e":"#e01a4f",color:"#fff",fontSize:11,fontWeight:400},children:[g.toFixed(1)," t/s"]})]})]})}var J=c(27563);function K({files:a,onOpenFile:b}){return 0===a.length?null:(0,d.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:5,margin:"4px 0 2px"},children:[(0,d.jsx)("span",{style:{fontSize:10,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.06em"},children:"Files"}),a.map(a=>{let c=a.relativePath.split("/").pop()??a.relativePath;return(0,d.jsxs)("button",{type:"button",title:a.filePath,onClick:()=>b?.(a.filePath,c),style:{display:"inline-flex",alignItems:"center",gap:4,maxWidth:260,padding:"2px 7px",fontSize:10.5,color:"var(--text-muted)",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:999,cursor:b?"pointer":"default"},children:[(0,d.jsxs)("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[(0,d.jsx)("path",{d:"M14.5 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7.5L14.5 2z"}),(0,d.jsx)("polyline",{points:"14 2 14 8 20 8"})]}),(0,d.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",fontFamily:"var(--font-mono)"},children:a.relativePath})]},a.filePath)})]})}var L=c(1453);let M=new Set(["write","edit","multi_edit","str_replace_editor","create_file"]),N=[],O=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function P(a){return a.toString().padStart(2,"0")}function Q(a){if(!a)return null;let b=new Date(a),c=new Date,d=b.getFullYear()===c.getFullYear()&&b.getMonth()===c.getMonth()&&b.getDate()===c.getDate(),e=`${P(b.getHours())}:${P(b.getMinutes())}`;if(d)return e;let f=[`${O[b.getMonth()]} ${b.getDate()}`];b.getFullYear()!==c.getFullYear()&&f.push(String(b.getFullYear()));let g=f.join(", ");return`${g} ${e}`}function R({message:a,isStreaming:b,toolResults:c,modelNames:e,entryId:f,sessionId:g,onFork:h,forking:i,onNavigate:j,prevAssistantEntryId:k,onEditContent:l,onSendMessage:m,showTimestamp:n,prevTimestamp:o,renderVisualCodeBlocks:p,cwd:q,onOpenImage:r,activeFilePath:s,agentRunning:t,onApplyToFile:u,onRunCode:v,onOpenFileAtLine:w,onAcceptDiff:x,compactionShadowCount:y,onLoadShadowed:z,forkFresh:A}){return"user"===a.role?(0,d.jsx)(S,{message:a,entryId:f,onFork:h,forking:i,onNavigate:j,prevAssistantEntryId:k,onEditContent:l,onOpenImage:r,compactionShadowCount:y,onLoadShadowed:z}):"assistant"===a.role?(0,d.jsx)(T,{message:a,isStreaming:b,toolResults:c,modelNames:e,entryId:f,sessionId:g,onSendMessage:m,showTimestamp:n,prevTimestamp:o,renderVisualCodeBlocks:p,cwd:q,activeFilePath:s,agentRunning:t,onApplyToFile:u,onRunCode:v,onOpenFileAtLine:w,onAcceptDiff:x,forkFresh:A}):"bashExecution"===a.role?(0,d.jsx)(U,{message:a}):"toolResult"===a.role?null:"custom"===a.role?(0,d.jsx)(V,{message:a,showTimestamp:n}):null}function S({message:a,entryId:b,onFork:c,forking:g,onNavigate:h,prevAssistantEntryId:i,onEditContent:j,onOpenImage:l,compactionShadowCount:m,onLoadShadowed:n}){let[o,p]=(0,e.useState)(!1),[q,r]=(0,e.useState)(null),[s,t]=(0,e.useState)(!1),u="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),v="string"==typeof a.content?[]:a.content.filter(a=>"image"===a.type),D=v.flatMap(a=>{let b=(0,k.h5)(a);return b?[{src:b}]:[]}),E=Q(a.timestamp),F=!!b&&!!c,G=!!i&&!!h;return(0,d.jsxs)(A,{hovered:o,onHoverChange:p,children:[(0,d.jsxs)(B,{children:[v.length>0&&(0,d.jsx)(C,{hasBody:!!u,children:v.map((a,b)=>{let c=(0,k.h5)(a);if(!c)return null;let e=a.path&&c.startsWith("/api/files/");return(0,d.jsx)("a",{href:c,target:e||!l?"_blank":void 0,rel:e||!l?"noreferrer":void 0,title:"Open image",style:{display:"block",cursor:"zoom-in"},onClick:a=>{l&&(a.preventDefault(),l(c,void 0,D))},children:(0,d.jsx)("img",{src:c,alt:"",style:{maxWidth:240,maxHeight:240,borderRadius:6,objectFit:"contain",display:"block",border:"1px solid rgba(59,130,246,0.15)"}})},b)})}),u]}),null!=m&&m>0&&(0,d.jsx)("div",{style:{marginTop:4,textAlign:"left"},children:null===q?(0,d.jsx)("button",{onClick:()=>{s||null!==q||(t(!0),(b&&n?n(b):Promise.resolve([])).then(a=>r(a)).catch(()=>r([])).finally(()=>t(!1)))},disabled:s,style:{padding:"5px 12px",fontSize:12,color:"var(--accent)",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:6,cursor:s?"wait":"pointer"},children:s?"Loading…":`Show ${m} compacted message${1===m?"":"s"}`}):(0,d.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:7,background:"var(--bg-panel)",padding:"8px 10px",maxHeight:360,overflowY:"auto"},children:[(0,d.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:6},children:[(0,d.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Compacted history"}),(0,d.jsx)("button",{onClick:()=>r(null),style:{padding:"2px 8px",fontSize:11,color:"var(--text-dim)",background:"transparent",border:"1px solid var(--border)",borderRadius:5,cursor:"pointer"},children:"Hide"})]}),0===q.length&&(0,d.jsx)("div",{style:{fontSize:12,color:"var(--text-muted)"},children:"No earlier messages to show."}),q.map((a,b)=>{let c,e="string"==typeof(c=a.content)?c:Array.isArray(c)?c.filter(a=>!!a&&"object"==typeof a&&"text"===a.type&&"string"==typeof a.text).map(a=>a.text).join("\n"):"";if(!e.trim())return null;let g="user"===a.role?"User":"assistant"===a.role?"Assistant":"Tool";return(0,d.jsxs)("div",{style:{marginBottom:8,paddingBottom:8,borderBottom:b===q.length-1?"none":"1px solid var(--border)"},children:[(0,d.jsx)("div",{style:{fontSize:10,color:"var(--text-dim)",marginBottom:2},children:g}),(0,d.jsx)(f.T,{content:e,style:{fontSize:12.5}})]},b)})]})}),(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[(0,d.jsx)(y,{visible:o,children:(0,d.jsx)(H,{text:u})}),(F||G)&&(0,d.jsxs)(y,{visible:o||!!g,children:[G&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{h(i),j?.(u)},title:"Edit from here — branches within this session",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("polyline",{points:"15 10 20 15 15 20"}),(0,d.jsx)("path",{d:"M4 4v7a4 4 0 0 0 4 4h12"})]}),"Edit from here"]}),F&&(0,d.jsxs)(z,{iconOnlyOnMobile:!0,onClick:()=>{c(b)},disabled:g,active:!!g,title:g?"Creating new session…":"New session — creates an independent copy from here",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,d.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),g?"Creating…":"New session"]})]}),E&&(0,d.jsx)(x,{children:E})]})]})}function T({message:a,isStreaming:b,toolResults:c,modelNames:f,entryId:g,sessionId:h,onSendMessage:i,showTimestamp:j,prevTimestamp:k,renderVisualCodeBlocks:l,cwd:m,activeFilePath:o,agentRunning:p,onApplyToFile:q,onRunCode:r,onOpenFileAtLine:s,onAcceptDiff:t,forkFresh:u}){var v,A;let B,C=j?Q(a.timestamp):null,F=a.content??N,[G,L]=(0,e.useState)(!1);(0,e.useRef)(null),(0,e.useRef)(new Map);let O=(0,e.useRef)(F),[P,R]=(0,e.useState)(null),[S,U]=(0,e.useState)(new Map);O.current=F;let V=(0,e.useMemo)(()=>{if(!a.timestamp||!k)return;let b=Math.round((a.timestamp-k)/1e3);return b>0?b:void 0},[a.timestamp,k]),W=(0,e.useMemo)(()=>(function(a,b){let c=new Map;if(!a||!b)return c;for(let[d,e]of a){if(!e.timestamp)continue;let a=Math.round((e.timestamp-b)/1e3);a>0&&c.set(d,a)}return c})(c,a.timestamp),[c,a.timestamp]),X=(0,e.useMemo)(()=>(function(a,b,c,d={}){let e=[],f=[],g=[];for(let[h,i]of a.entries()){if("thinking"===i.type){f.push({content:i.thinking,duration:b.get(h)??c,...i.deferred?{deferred:!0,blockIndex:h,entryId:d.entryId,sessionId:d.sessionId??void 0}:{}});continue}if("toolCall"===i.type){e.push(i);continue}g.push(i)}return{tools:e,thinkingBlocks:f,visibleBlocks:g}})(F,S,V,{entryId:g,sessionId:h}),[F,S,V,g,h]),Y=(0,e.useMemo)(()=>(function(a,b,c){if(!a?.length)return[];let d=new Set,e=[];for(let f of a){if("toolCall"!==f.type||!M.has(f.toolName))continue;let a=b?.get(f.toolCallId);if(!a||a.isError)continue;let g=function(a){if(!a)return null;let b=a.file_path??a.path??a.filePath??a.target_file;return"string"==typeof b&&b.trim()?b:null}(f.input);if(!g)continue;let h=function(a,b){let c=a.trim().replace(/\\/g,"/");return c.startsWith("/")||/^[A-Za-z]:\//.test(c)||!b?c:`${b.replace(/\/+$/,"")}/${c.replace(/^\.\//,"")}`}(g,c);if(d.has(h))continue;d.add(h);let i=c?`${c.replace(/\/+$/,"")}/`:"",j=i&&h.startsWith(i)?h.slice(i.length):h;e.push({filePath:h,relativePath:j})}return e})(F,c,m),[F,c,m]),Z=(0,e.useMemo)(()=>F.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),[F]),$=(0,e.useMemo)(()=>Math.round(function(a){let b=0;for(let c of a){if("text"===c.type){b+=c.text.length;continue}if("thinking"===c.type){b+=c.thinking.length;continue}"toolCall"===c.type&&(b+=JSON.stringify(c.input??{}).length)}return b}(F)/4),[F]);return(0,d.jsxs)(D,{hovered:G,onHoverChange:L,children:[(0,d.jsx)(I,{provider:a.provider,model:a.model,modelNames:f,isStreaming:b,estimatedTokens:$,tps:P}),(0,d.jsxs)(E,{children:[!b&&"error"===a.stopReason&&a.errorMessage?.trim()&&(0,d.jsxs)("div",{role:"alert","data-message-surface":"assistant-error",style:{border:"1px solid rgba(248,113,113,0.35)",borderRadius:6,background:"rgba(248,113,113,0.07)",padding:"8px 10px",color:"#f87171",fontSize:12,lineHeight:1.5,overflowWrap:"anywhere"},children:[(0,d.jsx)("strong",{style:{display:"block",marginBottom:2,fontWeight:600},children:"Model response failed"}),a.errorMessage.trim(),(v=a.errorMessage,/unknown system error -122\b|\berrno\s*-?122\b|\bEDQUOT\b|disk quota exceeded/i.test(v)&&(0,d.jsxs)("div",{style:{marginTop:6,color:"var(--text-muted)"},children:["This is EDQUOT (disk quota exceeded, errno 122), not a missing file. Free space/quota in your home directory and retry. Useful checks: ",(0,d.jsx)("code",{children:"quota -s"}),", ",(0,d.jsx)("code",{children:"df -h ~"}),", ",(0,d.jsx)("code",{children:"df -i ~"}),", ",(0,d.jsx)("code",{children:"du -sh ~/.pi ~/.npm ~/.cache"}),"."]}))]}),(X.tools.length>0||X.thinkingBlocks.length>0)&&(0,d.jsx)(J.kD,{tools:X.tools,results:c,durations:W,thinkingBlocks:X.thinkingBlocks,isStreaming:b,cwd:m}),X.visibleBlocks.map((a,e)=>(0,d.jsx)(n,{block:a,toolResults:c,isStreaming:b,toolCallDurations:W,onSendMessage:i,renderVisualCodeBlocks:l,cwd:m,activeFilePath:o,agentRunning:p,onApplyToFile:q,onRunCode:r,onOpenFileAtLine:s,onAcceptDiff:t},e))]}),!b&&(0,d.jsx)(K,{files:Y,onOpenFile:s?(a,b)=>s(a,b):void 0}),(0,d.jsxs)(w,{style:{gap:8},children:[a.usage&&!b&&(0,d.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:(A=a.usage,B=[],A.input&&B.push(`${A.input.toLocaleString()} in`),A.output&&B.push(`${A.output.toLocaleString()} out`),A.cacheRead&&B.push(`${A.cacheRead.toLocaleString()} cache`),B.join(" \xb7 "))}),Z&&!b&&(0,d.jsx)(y,{visible:G,children:(0,d.jsx)(H,{text:Z})}),u?.show&&!b&&(0,d.jsxs)(d.Fragment,{children:[u.error&&(0,d.jsx)("span",{style:{fontSize:11,color:"#f87171"},children:u.error}),(0,d.jsxs)(z,{onClick:u.onFork,disabled:u.busy,title:"Fork 新会话 — 携带精简摘要,避免每次提问都等待模型 prefill 变慢",children:[(0,d.jsxs)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,d.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,d.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,d.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),u.busy?"Forking…":"Fork 新会话"]})]}),C&&(0,d.jsx)(x,{alignEnd:!0,children:C})]})]})}function U({message:a}){let b=Q(a.timestamp),c=void 0!==a.exitCode&&0!==a.exitCode,e=a.cancelled?"cancelled":void 0!==a.exitCode?`exit ${a.exitCode}`:null;return(0,d.jsxs)("div",{style:{marginBottom:12},children:[(0,d.jsxs)("div",{style:{border:"1px solid var(--border)",borderRadius:8,overflow:"hidden",background:"var(--bg-panel)"},children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:7,padding:"6px 10px",borderBottom:"1px solid var(--border)",fontFamily:"var(--font-mono)",fontSize:12,lineHeight:1.45},children:[(0,d.jsx)("span",{style:{color:"var(--accent)",flexShrink:0},children:"$"}),(0,d.jsx)("span",{style:{flex:1,minWidth:0,whiteSpace:"pre-wrap",wordBreak:"break-word",color:"var(--text)"},children:a.command}),a.excludeFromContext&&(0,d.jsx)("span",{title:"Output is not sent to the model on the next turn",style:{flexShrink:0,padding:"0 5px",fontSize:9.5,color:"var(--text-dim)",border:"1px solid var(--border)",borderRadius:3},children:"not in context"}),e&&(0,d.jsx)("span",{style:{flexShrink:0,fontSize:10.5,color:c?"#f87171":"var(--text-dim)"},children:e})]}),(0,d.jsx)(L.m,{text:a.output||"(no output)",maxHeight:360,collapsible:!0,background:"var(--bg)",textColor:c?"#f87171":"var(--text-muted)"}),a.truncated&&a.fullOutputPath&&(0,d.jsxs)("div",{style:{padding:"4px 10px",fontSize:10.5,color:"var(--text-dim)",borderTop:"1px solid var(--border)"},children:["Output truncated \xb7 ",a.fullOutputPath]})]}),b&&(0,d.jsx)(w,{justify:"flex-end",style:{marginTop:3},children:(0,d.jsx)(x,{children:b})})]})}function V({message:a,showTimestamp:b}){if(!a.display)return null;let c=b?Q(a.timestamp):null,e="string"==typeof a.content?a.content:a.content.filter(a=>"text"===a.type).map(a=>a.text).join("\n"),g="subagent-notify"===a.customType,h="branch-summary"===a.customType,i=e.match(/^Background task (completed|failed|paused):\s*\*\*(.+?)\*\*/),j=i?"completed"===i[1]?"✅":"failed"===i[1]?"❌":"⏸":h?"⑂":g?"\uD83E\uDD16":"ℹ";return(0,d.jsxs)("div",{style:{marginBottom:12},children:[(0,d.jsx)(F,{accent:g?"subagent":"default",children:(0,d.jsx)(G,{icon:j,children:(0,d.jsx)("div",{"data-message-surface":"custom-body",children:(0,d.jsx)(f.T,{content:e,style:{fontSize:13}})})})}),(c||i)&&(0,d.jsxs)(w,{justify:"flex-end",style:{marginTop:3},children:[i&&(0,d.jsx)(x,{children:i[2]}),c&&(0,d.jsx)(x,{children:c})]})]})}},85034:(a,b,c)=>{"use strict";c.r(b),c.d(b,{default:()=>d});let d=(0,c(77943).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/annovibe/annovibe/app/error.tsx\" from the server, but it's on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"/home/runner/work/annovibe/annovibe/app/error.tsx","default")},86364:(a,b,c)=>{"use strict";function d(){return[{type:"image/svg+xml",sizes:"any",url:"/icon.svg?6eceb6fbd1a5bb90"}]}c.r(b),c.d(b,{default:()=>d})},90427:(a,b,c)=>{Promise.resolve().then(c.t.bind(c,60440,23)),Promise.resolve().then(c.t.bind(c,84342,23)),Promise.resolve().then(c.t.bind(c,82265,23)),Promise.resolve().then(c.t.bind(c,35421,23)),Promise.resolve().then(c.t.bind(c,61335,23)),Promise.resolve().then(c.t.bind(c,70664,23)),Promise.resolve().then(c.bind(c,74661))},96487:()=>{},97305:(a,b,c)=>{Promise.resolve().then(c.bind(c,2420))}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
globalThis.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-42372ed130431b0a.js"],devFiles:[],lowPriorityFiles:["static/993-z3SwOS_AuLBpkiyRr/_buildManifest.js","static/993-z3SwOS_AuLBpkiyRr/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-a60990aaf3b13e7a.js","static/chunks/4bd1b696-8cd12253b448cc13.js","static/chunks/3794-fba3f76785a3c234.js","static/chunks/main-app-a8a207cb34d209aa.js"],rootMainFilesTree:{},pages:{"/_app":[]}};
|