@mcpc-tech/unplugin-dev-inspector-mcp 0.0.12 → 0.0.13

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.
@@ -689,10 +689,6 @@ ${t}
689
689
  pointer-events: none;
690
690
  }
691
691
 
692
- .collapse {
693
- visibility: collapse;
694
- }
695
-
696
692
  .visible {
697
693
  visibility: visible;
698
694
  }
@@ -6936,7 +6932,7 @@ ${e.themeCSS}`),e.fontFamily!==void 0&&(n+=`
6936
6932
  `)||(e.endsWith("```\n")||e.endsWith("```"))&&t%2==0)return e;let r=e.match(Mtn);if(r&&!n){let t=r[2];if(!t||z7.test(t))return e;if(Jtn(e)%2==1)return`${e}\``}return e},Xtn=e=>{let t=e.match(Ntn);if(t){let n=t[2];if(!n||z7.test(n))return e;if((e.match(/~~/g)||[]).length%2==1)return`${e}~~`}return e},Ztn=e=>{if((e.match(/\$\$/g)||[]).length%2==0)return e;let t=e.indexOf(`$$`);return t!==-1&&e.indexOf(`
6937
6933
  `,t)!==-1&&!e.endsWith(`
6938
6934
  `)?`${e}
6939
- $$`:`${e}$$`},Qtn=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},$tn=e=>{if(V7(e)||Rtn.test(e))return e;let t=e.match(ktn);if(t){let n=t[2];if(!n||z7.test(n))return e;if(Qtn(e)%2==1)return`${e}***`}return e},enn=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=ztn(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=$tn(t),t=Btn(t),t=Vtn(t),t=Utn(t),t=Ktn(t),t=Ytn(t),t=Xtn(t),t=Ztn(t),t)},tnn={harden:[ehe,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:BSe,katex:[Dve,{errorColor:`var(--color-muted-foreground)`}]},nnn={gfm:[aEe,{}],math:[_Ee,{singleDollarTextMath:!1}],cjkFriendly:[yCe,{}],cjkFriendlyGfmStrikethrough:[xCe,{}]},rnn=(0,_.createContext)([`github-light`,`github-dark`]),inn=(0,_.createContext)(void 0),ann=(0,_.createContext)(!0),H7=(0,_.createContext)({isAnimating:!1}),onn=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?enn(e.trim()):e,[e,t]);return(0,S.jsx)(Yme,{...n,children:r})},(e,t)=>e.content===t.content);onn.displayName=`Block`;var snn=[`github-light`,`github-dark`],cnn=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(tnn),remarkPlugins:i=Object.values(nnn),className:a,shikiTheme:o=snn,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=onn,parseMarkdownIntoBlocksFn:m=Ttn,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===Dve:e===Dve)&&Promise.resolve().then(()=>p(ben(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(rnn.Provider,{value:o,children:(0,S.jsx)(inn.Provider,{value:s,children:(0,S.jsx)(ann.Provider,{value:l,children:(0,S.jsx)(H7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:F7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...btn,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);cnn.displayName=`Streamdown`;let lnn=(0,_.createContext)(null),unn=()=>{let e=(0,_.useContext)(lnn);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},dnn=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=ht({prop:n,defaultProp:r,onChange:i}),[d,f]=ht({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(lnn.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(Hi,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),fnn=(e,t)=>e||t===0?(0,S.jsx)(Uce,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),pnn=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=unn();return(0,S.jsx)(Ui,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)($r,{className:`size-4`}),fnn(r,a),(0,S.jsx)(ei,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),mnn=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Wi,{className:nt(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,S.jsx)(cnn,{...n,children:t})}));dnn.displayName=`Reasoning`,pnn.displayName=`ReasoningTrigger`,mnn.displayName=`ReasoningContent`,(0,_.createContext)(null);let hnn=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(cnn,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);hnn.displayName=`MessageResponse`;let gnn=(0,_.createContext)({code:``}),_nn={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function vnn(e,t,n=!1){let r=n?[_nn]:[];return await Promise.all([xXe(e,{lang:t,theme:`one-light`,transformers:r}),xXe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(vnn(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(gnn.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,S.jsx)(`div`,{className:`hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},ynn=({className:e,...t})=>(0,S.jsx)(Hi,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),bnn=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(si,{className:`size-4`}),"input-available":(0,S.jsx)(ci,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(ci,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(ii,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(ii,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(oi,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(oi,{className:`size-4 text-orange-600`})}[e],t[e]]})},xnn=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(Ui,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(bi,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),bnn(r)]}),(0,S.jsx)(ei,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),Snn=({className:e,...t})=>(0,S.jsx)(Wi,{className:nt(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),Cnn=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),wnn=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(U7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function Tnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function Enn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function Dnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let Onn=(0,_.createContext)(null),knn=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(Onn.Provider,{value:{isStreaming:t},children:(0,S.jsx)(Hi,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(Tnn,{className:nt(`shadow-none`,e),children:n})})}),Ann=({className:e,...t})=>(0,S.jsx)(Enn,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),jnn=e=>(0,S.jsx)(Wi,{asChild:!0,children:(0,S.jsx)(Dnn,{"data-slot":`plan-content`,...e})}),Mnn=({className:e,...t})=>(0,S.jsx)(Ui,{asChild:!0,children:(0,S.jsxs)(Oi,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(ni,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function Nnn(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function Pnn(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(hnn,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(dnn,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(pnn,{}),(0,S.jsx)(mnn,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(knn,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(Ann,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(Mnn,{className:`mb-2`})]})}),(0,S.jsx)(jnn,{children:(0,S.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(Nnn(e)){let r=e.input,i=r.toolName,a=e.state,o=a===`output-available`||a===`output-error`;return(0,S.jsxs)(ynn,{defaultOpen:o,children:[(0,S.jsx)(xnn,{title:i.length>20?`${i.slice(0,20)}...`:i,type:i,state:a}),(0,S.jsxs)(Snn,{children:[e.input!==void 0&&(0,S.jsx)(Cnn,{input:r}),o&&(0,S.jsx)(wnn,{output:e.output?(0,S.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let Fnn=({messages:e,status:t,selectedAgent:n})=>{let r=dd.find(e=>e.name===(n||fd))||dd[0];return(0,S.jsxs)(tle,{className:`w-full h-full`,children:[(0,S.jsxs)(nle,{className:`p-3 space-y-3`,children:[e.length===0?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):e.map(e=>(0,S.jsxs)(Ile,{className:`items-start`,from:e.role,children:[(0,S.jsx)(Lle,{children:e.parts.map((n,r)=>Pnn(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(Rle,{name:r.name,src:r.meta?.icon??``})]},e.id)),t===`submitted`&&e.length===0&&(0,S.jsx)(Ble,{})]}),(0,S.jsx)(rle,{})]})};function Inn(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function Lnn({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,_.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,_.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let Rnn=`AI_SELECTED_AGENT`,znn=e=>{let[t,n]=(0,_.useState)(e);return(0,_.useEffect)(()=>{typeof window<`u`&&_d().then(e=>{if(e&&e!==fd)n(e);else{let e=localStorage.getItem(Rnn);e&&n(e)}})},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(Rnn,e):localStorage.removeItem(Rnn))}}},Bnn=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{}})=>{let[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(`none`),[b,x]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(!0),{agent:D,setAgent:O}=znn(fd),[k,A]=(0,_.useState)(!1),j=dd.find(e=>e.name===D)||dd[0],{elementRef:M,isDragging:N,handleMouseDown:P}=Lnn(),[F,I]=(0,_.useState)(null),[L,R]=(0,_.useState)(``),ee=Inn(L,i,50),[te,z]=(0,_.useState)(``),B=(0,_.useRef)(``),ne=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=ee,t=B.current;if(e.length<t.length||!e.startsWith(t)){z(e),B.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&z(n),B.current=e}},[ee]);let re=(0,_.useRef)(null),ie=(0,_.useRef)(null),ae=(0,_.useRef)(null),oe=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(a.length===0){R(``),g(null),ae.current=null,oe.current=!1,z(``),B.current=``;return}let e=a[a.length-1];if(e.role!==`assistant`)return;let t=Kce(e),{displayText:n,toolCall:r}=Jce(e,t||ae.current);R(n||``),t&&(ae.current=t),r?(ie.current&&=(clearTimeout(ie.current),null),g(r),oe.current=!0):oe.current=!1},[a]),(0,_.useEffect)(()=>{te!==ne.current&&(oe.current||g(null),ne.current=te)},[te]),(0,_.useEffect)(()=>{d&&re.current&&re.current.focus()},[d]),(0,_.useEffect)(()=>{if(!i&&C){x(!1),w(!1),E(!1);let e=setTimeout(()=>{E(!0)},2e3);return()=>clearTimeout(e)}},[i,C]),(0,_.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;I({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;I({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let se=e=>{e.preventDefault(),p.trim()&&(ie.current&&=(clearTimeout(ie.current),null),g(null),R(``),ae.current=null,x(!0),w(!0),n(p,D),m(``),v===`none`&&(f(!1),re.current?.blur()))},ce=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se(e)),e.key===`Escape`&&(f(!1),re.current?.blur())},le=o===`error`,ue=a.length>0,de=d&&!b,fe=(!d||b)&&(i||ue||F);return(0,S.jsxs)(`div`,{ref:M,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,d?`w-[450px]`:fe?`w-auto min-w-[200px] max-w-[450px]`:`w-[160px]`,N?`cursor-grabbing`:`cursor-grab`),onMouseDown:P,onMouseEnter:()=>{N||(i||C?(f(!0),y(`chat`)):T&&f(!0))},onMouseLeave:()=>{!p.trim()&&!C&&!N&&(f(!1),y(`none`)),E(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,d?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,v===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,le&&!d&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,de?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(gi,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3`,children:`Hover to inspect`})]}),fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(gi,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):F?F.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(vi,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):F.status===`completed`?(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):le?(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:F&&F.status===`in-progress`&&F.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,F.currentStep.index,`/`,F.currentStep.total,`: `,F.currentStep.title]})]}):F?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:F.message}):h?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:h})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:i&&!te?(0,S.jsx)(Uce,{duration:2,spread:2,children:o===`submitted`&&j?.command===`npx`?`Starting ${j.name}... This may take a moment.`:`Thinking...`}):te||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,de?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`button`,{onClick:t,className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector`,children:(0,S.jsx)(li,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),s>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,v===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(ui,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:se,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>A(!k),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:dd.find(e=>e.name===D)?.meta?.icon,alt:D,className:`w-3.5 h-3.5`})}),k&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>A(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-48 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:dd.map(e=>(0,S.jsxs)(`button`,{onClick:()=>{O(e.name),A(!1)},className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-accent transition-colors`,D===e.name&&`bg-accent/50 font-medium`),children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4`}),e.name]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:re,type:`text`,value:p,onChange:e=>m(e.target.value),onKeyDown:ce,placeholder:`Ask ${D}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:i}),(a.length>0||i||C)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,v===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:v===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(ti,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,v===`chat`&&`rotate-180`)})}),i?(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,S.jsx)(_i,{className:`w-3 h-3`})}):(0,S.jsx)(`button`,{type:`submit`,disabled:!p.trim(),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,p.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,S.jsx)(Qr,{className:`w-3.5 h-3.5`})})]})]})]}),v!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[v===`inspections`&&l.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(ea,{items:l,onRemove:u})}),v===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(Fnn,{messages:a,status:o,selectedAgent:D})})]})})]})};var Vnn=`vercel.ai.error`,Hnn=Symbol.for(Vnn),Unn,Wnn=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Unn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Vnn)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Unn=Hnn;var W7=Wnn;function Gnn(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var Knn=`AI_InvalidArgumentError`,qnn=`vercel.ai.error.${Knn}`,Jnn=Symbol.for(qnn),Ynn,Xnn=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:Knn,message:e,cause:t}),this[Ynn]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,qnn)}};Ynn=Jnn;var Znn=`AI_JSONParseError`,Qnn=`vercel.ai.error.${Znn}`,$nn=Symbol.for(Qnn),ern,trn=class extends W7{constructor({text:e,cause:t}){super({name:Znn,message:`JSON parsing failed: Text: ${e}.
6935
+ $$`:`${e}$$`},Qtn=e=>{let t=0,n=e.match(/\*+/g)||[];for(let e of n){let n=e.length;n>=3&&(t+=Math.floor(n/3))}return t},$tn=e=>{if(V7(e)||Rtn.test(e))return e;let t=e.match(ktn);if(t){let n=t[2];if(!n||z7.test(n))return e;if(Qtn(e)%2==1)return`${e}***`}return e},enn=e=>{if(!e||typeof e!=`string`)return e;let t=e,n=ztn(t);return n.endsWith(`](streamdown:incomplete-link)`)?n:(t=n,t=$tn(t),t=Btn(t),t=Vtn(t),t=Utn(t),t=Ktn(t),t=Ytn(t),t=Xtn(t),t=Ztn(t),t)},tnn={harden:[ehe,{allowedImagePrefixes:[`*`],allowedLinkPrefixes:[`*`],defaultOrigin:void 0,allowDataImages:!0}],raw:BSe,katex:[Dve,{errorColor:`var(--color-muted-foreground)`}]},nnn={gfm:[aEe,{}],math:[_Ee,{singleDollarTextMath:!1}],cjkFriendly:[yCe,{}],cjkFriendlyGfmStrikethrough:[xCe,{}]},rnn=(0,_.createContext)([`github-light`,`github-dark`]),inn=(0,_.createContext)(void 0),ann=(0,_.createContext)(!0),H7=(0,_.createContext)({isAnimating:!1}),onn=(0,_.memo)(({content:e,shouldParseIncompleteMarkdown:t,...n})=>{let r=(0,_.useMemo)(()=>typeof e==`string`&&t?enn(e.trim()):e,[e,t]);return(0,S.jsx)(Yme,{...n,children:r})},(e,t)=>e.content===t.content);onn.displayName=`Block`;var snn=[`github-light`,`github-dark`],cnn=(0,_.memo)(({children:e,parseIncompleteMarkdown:t=!0,components:n,rehypePlugins:r=Object.values(tnn),remarkPlugins:i=Object.values(nnn),className:a,shikiTheme:o=snn,mermaidConfig:s,controls:l=!0,isAnimating:u=!1,urlTransform:d=e=>e,BlockComponent:f=onn,parseMarkdownIntoBlocksFn:m=Ttn,...h})=>{let g=(0,_.useId)(),v=(0,_.useMemo)(()=>m(typeof e==`string`?e:``),[e,m]);(0,_.useEffect)(()=>{Array.isArray(r)&&r.some(e=>Array.isArray(e)?e[0]===Dve:e===Dve)&&Promise.resolve().then(()=>p(ben(),1))},[r]);let y=(0,_.useMemo)(()=>({isAnimating:u}),[u]);return(0,S.jsx)(rnn.Provider,{value:o,children:(0,S.jsx)(inn.Provider,{value:s,children:(0,S.jsx)(ann.Provider,{value:l,children:(0,S.jsx)(H7.Provider,{value:y,children:(0,S.jsx)(`div`,{className:F7(`space-y-4`,a),children:v.map((e,a)=>(0,S.jsx)(f,{components:{...btn,...n},content:e,index:a,rehypePlugins:r,remarkPlugins:i,shouldParseIncompleteMarkdown:t,urlTransform:d,...h},`${g}-block-${a}`))})})})})})},(e,t)=>e.children===t.children&&e.shikiTheme===t.shikiTheme&&e.isAnimating===t.isAnimating);cnn.displayName=`Streamdown`;let lnn=(0,_.createContext)(null),unn=()=>{let e=(0,_.useContext)(lnn);if(!e)throw Error(`Reasoning components must be used within Reasoning`);return e},dnn=(0,_.memo)(({className:e,isStreaming:t=!1,open:n,defaultOpen:r=!0,onOpenChange:i,duration:a,children:o,...s})=>{let[l,u]=ht({prop:n,defaultProp:r,onChange:i}),[d,f]=ht({prop:a,defaultProp:void 0}),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null);return(0,_.useEffect)(()=>{t?h===null&&g(Date.now()):h!==null&&(f(Math.ceil((Date.now()-h)/1e3)),g(null))},[t,h,f]),(0,_.useEffect)(()=>{if(r&&!t&&l&&!p){let e=setTimeout(()=>{u(!1),m(!0)},1e3);return()=>clearTimeout(e)}},[t,l,r,u,p]),(0,S.jsx)(lnn.Provider,{value:{isStreaming:t,isOpen:l,setIsOpen:u,duration:d},children:(0,S.jsx)(Hi,{className:nt(`not-prose mb-4`,e),onOpenChange:e=>{u(e)},open:l,...s,children:o})})}),fnn=(e,t)=>e||t===0?(0,S.jsx)(Uce,{duration:1,children:`Thinking...`}):t===void 0?(0,S.jsx)(`p`,{children:`Thought for a few seconds`}):(0,S.jsxs)(`p`,{children:[`Thought for `,t,` seconds`]}),pnn=(0,_.memo)(({className:e,children:t,...n})=>{let{isStreaming:r,isOpen:i,duration:a}=unn();return(0,S.jsx)(Ui,{className:nt(`flex w-full items-center gap-2 text-muted-foreground text-sm transition-colors hover:text-foreground`,e),...n,children:t??(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)($r,{className:`size-4`}),fnn(r,a),(0,S.jsx)(ei,{className:nt(`size-4 transition-transform`,i?`rotate-180`:`rotate-0`)})]})})}),mnn=(0,_.memo)(({className:e,children:t,...n})=>(0,S.jsx)(Wi,{className:nt(`mt-4 text-sm`,`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-muted-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...n,children:(0,S.jsx)(cnn,{...n,children:t})}));dnn.displayName=`Reasoning`,pnn.displayName=`ReasoningTrigger`,mnn.displayName=`ReasoningContent`,(0,_.createContext)(null);let hnn=(0,_.memo)(({className:e,...t})=>(0,S.jsx)(cnn,{className:nt(`size-full [&>*:first-child]:mt-0 [&>*:last-child]:mb-0`,e),...t}),(e,t)=>e.children===t.children);hnn.displayName=`MessageResponse`;let gnn=(0,_.createContext)({code:``}),_nn={name:`line-numbers`,line(e,t){e.children.unshift({type:`element`,tagName:`span`,properties:{className:[`inline-block`,`min-w-10`,`mr-4`,`text-right`,`select-none`,`text-muted-foreground`]},children:[{type:`text`,value:String(t)}]})}};async function vnn(e,t,n=!1){let r=n?[_nn]:[];return await Promise.all([xXe(e,{lang:t,theme:`one-light`,transformers:r}),xXe(e,{lang:t,theme:`one-dark-pro`,transformers:r})])}let U7=({code:e,language:t,showLineNumbers:n=!1,className:r,children:i,...a})=>{let[o,s]=(0,_.useState)(``),[l,u]=(0,_.useState)(``),d=(0,_.useRef)(!1);return(0,_.useEffect)(()=>(vnn(e,t,n).then(([e,t])=>{d.current||=(s(e),u(t),!0)}),()=>{d.current=!1}),[e,t,n]),(0,S.jsx)(gnn.Provider,{value:{code:e},children:(0,S.jsx)(`div`,{className:nt(`group relative w-full overflow-hidden rounded-md border bg-background text-foreground`,r),...a,children:(0,S.jsxs)(`div`,{className:`relative`,children:[(0,S.jsx)(`div`,{className:`overflow-hidden dark:hidden [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:o}}),(0,S.jsx)(`div`,{className:`hidden overflow-hidden dark:block [&>pre]:m-0 [&>pre]:bg-background! [&>pre]:p-4 [&>pre]:text-foreground! [&>pre]:text-sm [&_code]:font-mono [&_code]:text-sm`,dangerouslySetInnerHTML:{__html:l}}),i&&(0,S.jsx)(`div`,{className:`absolute top-2 right-2 flex items-center gap-2`,children:i})]})})})},ynn=({className:e,...t})=>(0,S.jsx)(Hi,{className:nt(`not-prose mb-4 w-full rounded-md border`,e),...t}),bnn=e=>{let t={"input-streaming":`Pending`,"input-available":`Running`,"approval-requested":`Awaiting Approval`,"approval-responded":`Responded`,"output-available":`Completed`,"output-error":`Error`,"output-denied":`Denied`};return(0,S.jsxs)(it,{className:`gap-1.5 rounded-full text-xs`,variant:`secondary`,children:[{"input-streaming":(0,S.jsx)(si,{className:`size-4`}),"input-available":(0,S.jsx)(ci,{className:`size-4 animate-pulse`}),"approval-requested":(0,S.jsx)(ci,{className:`size-4 text-yellow-600`}),"approval-responded":(0,S.jsx)(ii,{className:`size-4 text-blue-600`}),"output-available":(0,S.jsx)(ii,{className:`size-4 text-green-600`}),"output-error":(0,S.jsx)(oi,{className:`size-4 text-red-600`}),"output-denied":(0,S.jsx)(oi,{className:`size-4 text-orange-600`})}[e],t[e]]})},xnn=({className:e,title:t,type:n,state:r,...i})=>(0,S.jsxs)(Ui,{className:nt(`flex w-full items-center justify-between gap-4 p-3`,e),...i,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(bi,{className:`size-4 text-muted-foreground`}),(0,S.jsx)(`span`,{className:`font-medium text-sm`,children:t??n.split(`-`).slice(1).join(`-`)}),bnn(r)]}),(0,S.jsx)(ei,{className:`size-4 text-muted-foreground transition-transform group-data-[state=open]:rotate-180`})]}),Snn=({className:e,...t})=>(0,S.jsx)(Wi,{className:nt(`data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 text-popover-foreground outline-none data-[state=closed]:animate-out data-[state=open]:animate-in`,e),...t}),Cnn=({className:e,input:t,...n})=>(0,S.jsxs)(`div`,{className:nt(`space-y-2 overflow-hidden p-4`,e),...n,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:`Parameters`}),(0,S.jsx)(`div`,{className:`rounded-md bg-muted/50`,children:(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`})})]}),wnn=({className:e,output:t,errorText:n,...r})=>{if(!(t||n))return null;let i=(0,S.jsx)(`div`,{children:t});return typeof t==`object`&&!(0,_.isValidElement)(t)?i=(0,S.jsx)(U7,{code:JSON.stringify(t,null,2),language:`json`}):typeof t==`string`&&(i=(0,S.jsx)(U7,{code:t,language:`json`})),(0,S.jsxs)(`div`,{className:nt(`space-y-2 p-4`,e),...r,children:[(0,S.jsx)(`h4`,{className:`font-medium text-muted-foreground text-xs uppercase tracking-wide`,children:n?`Error`:`Result`}),(0,S.jsxs)(`div`,{className:nt(`overflow-x-auto rounded-md text-xs [&_table]:w-full`,n?`bg-destructive/10 text-destructive`:`bg-muted/50 text-foreground`),children:[n&&(0,S.jsx)(`div`,{children:n}),i]})]})};function Tnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card`,className:nt(`bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm`,e),...t})}function Enn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-header`,className:nt(`@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-2 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6`,e),...t})}function Dnn({className:e,...t}){return(0,S.jsx)(`div`,{"data-slot":`card-content`,className:nt(`px-6`,e),...t})}let Onn=(0,_.createContext)(null),knn=({className:e,isStreaming:t=!1,children:n,...r})=>(0,S.jsx)(Onn.Provider,{value:{isStreaming:t},children:(0,S.jsx)(Hi,{asChild:!0,"data-slot":`plan`,...r,children:(0,S.jsx)(Tnn,{className:nt(`shadow-none`,e),children:n})})}),Ann=({className:e,...t})=>(0,S.jsx)(Enn,{className:nt(`flex items-start justify-between`,e),"data-slot":`plan-header`,...t}),jnn=e=>(0,S.jsx)(Wi,{asChild:!0,children:(0,S.jsx)(Dnn,{"data-slot":`plan-content`,...e})}),Mnn=({className:e,...t})=>(0,S.jsx)(Ui,{asChild:!0,children:(0,S.jsxs)(Oi,{className:nt(`size-8`,e),"data-slot":`plan-trigger`,size:`icon`,variant:`ghost`,...t,children:[(0,S.jsx)(ni,{className:`size-4`}),(0,S.jsx)(`span`,{className:`sr-only`,children:`Toggle plan`})]})});function Nnn(e){let t=e;return typeof t.type==`string`&&t.type.startsWith(`tool-`)&&`state`in t}function Pnn(e,t,n,r,i){if(e.type===`text`&&e.text)return(0,S.jsx)(hnn,{className:`whitespace-pre-wrap`,children:e.text},`${t}-${n}`);if(e.type===`reasoning`)return(0,S.jsxs)(dnn,{className:`w-full`,isStreaming:r,children:[(0,S.jsx)(pnn,{}),(0,S.jsx)(mnn,{children:e.text})]},`${t}-${n}`);let a=i?.plan;if(a&&n===0)return(0,S.jsx)(`div`,{className:`w-full`,children:(0,S.jsxs)(knn,{defaultOpen:!0,isStreaming:r,children:[(0,S.jsx)(Ann,{className:`flex flex-row items-center`,children:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`h1`,{className:`text-base`,children:`Agent Plan`}),(0,S.jsx)(Mnn,{className:`mb-2`})]})}),(0,S.jsx)(jnn,{children:(0,S.jsx)(`ul`,{className:`space-y-2`,children:a.map((e,t)=>{let n=e.content||JSON.stringify(e),r=e.priority,i=e.status;return(0,S.jsxs)(`li`,{className:`flex items-start justify-between gap-3`,children:[(0,S.jsxs)(`div`,{className:`flex-1`,children:[(0,S.jsx)(`div`,{className:`text-sm ${i===`done`?`line-through text-muted-foreground`:`text-foreground`}`,children:n}),r&&(0,S.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[`Priority: `,r]})]}),(0,S.jsx)(`div`,{className:`shrink-0 text-xs`,children:(0,S.jsx)(`span`,{className:`px-2 py-1 rounded-full font-medium text-[10px] uppercase tracking-wide ${i===`pending`?`bg-muted text-muted-foreground`:`bg-primary/10 text-primary`}`,children:i??`pending`})})]},`plan-${t}`)})})})]})},`${t}-plan`);if(Nnn(e)){let r=e.input,i=r.toolName,a=e.state,o=a===`output-available`||a===`output-error`;return(0,S.jsxs)(ynn,{defaultOpen:o,children:[(0,S.jsx)(xnn,{title:i.length>20?`${i.slice(0,20)}...`:i,type:i,state:a}),(0,S.jsxs)(Snn,{children:[e.input!==void 0&&(0,S.jsx)(Cnn,{input:r}),o&&(0,S.jsx)(wnn,{output:e.output?(0,S.jsx)(U7,{code:JSON.stringify(e.output,null,2),language:`json`}):null,errorText:e.errorText})]})]},`${t}-${n}`)}return null}let Fnn=({messages:e,status:t,selectedAgent:n})=>{let r=dd.find(e=>e.name===(n||fd))||dd[0];return(0,S.jsxs)(tle,{className:`w-full h-full`,children:[(0,S.jsxs)(nle,{className:`p-3 space-y-3`,children:[e.length===0?(0,S.jsx)(`div`,{className:`flex items-center justify-center h-full text-muted-foreground`,children:(0,S.jsxs)(`div`,{className:`text-center`,children:[(0,S.jsx)(`p`,{className:`text-sm`,children:`No messages yet`}),(0,S.jsx)(`p`,{className:`text-xs mt-1`,children:`Enter a question below to start`})]})}):e.map(e=>(0,S.jsxs)(Ile,{className:`items-start`,from:e.role,children:[(0,S.jsx)(Lle,{children:e.parts.map((n,r)=>Pnn(n,e.id,r,t===`streaming`,e.metadata))}),e.role===`assistant`&&(0,S.jsx)(Rle,{name:r.name,src:r.meta?.icon??``})]},e.id)),t===`submitted`&&e.length===0&&(0,S.jsx)(Ble,{})]}),(0,S.jsx)(rle,{})]})};function Inn(e,t,n=50){let[r,i]=(0,_.useState)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(``);return(0,_.useEffect)(()=>{if(e.length<r.length||r&&!e.startsWith(r.slice(0,Math.min(r.length,20)))){i(e),o.current=e,a.current=Date.now();return}if(!t){r!==e&&(i(e),o.current=e);return}let s=e.slice(o.current.length);if(!s)return;let l=Date.now();if(l-a.current<n)return;let u=/[.?!。?!](\s|$)|[\n]/.test(s),d=s.length>50,f=s.trim().length<5;(u&&!f||d)&&(i(e),o.current=e,a.current=l)},[e,t,n,r]),r}function Lnn({initialOffset:e={x:0,y:0}}={}){let t=(0,_.useRef)(null),[n,r]=(0,_.useState)(!1),i=(0,_.useRef)(e),a=(0,_.useRef)({x:0,y:0}),o=(0,_.useRef)({x:0,y:0}),s=(0,_.useCallback)(()=>{if(t.current){let{x:e,y:n}=i.current;t.current.style.transform=`translate3d(calc(-50% + ${e}px), ${n}px, 0)`}},[]),l=(0,_.useCallback)(e=>{e.target.closest(`button, input, a, [data-no-drag]`)||(e.preventDefault(),r(!0),a.current={x:e.clientX,y:e.clientY},o.current={...i.current})},[]);return(0,_.useEffect)(()=>{let e=e=>{if(!n)return;let t=e.clientX-a.current.x,r=e.clientY-a.current.y;i.current={x:o.current.x+t,y:o.current.y+r},s()},t=()=>{r(!1)};return n&&(window.addEventListener(`mousemove`,e,{passive:!0}),window.addEventListener(`mouseup`,t)),()=>{window.removeEventListener(`mousemove`,e),window.removeEventListener(`mouseup`,t)}},[n,s]),(0,_.useEffect)(()=>{s()},[s]),{elementRef:t,isDragging:n,handleMouseDown:l}}let Rnn=`AI_SELECTED_AGENT`,znn=e=>{let[t,n]=(0,_.useState)(e);return(0,_.useEffect)(()=>{typeof window<`u`&&_d().then(e=>{if(e&&e!==fd)n(e);else{let e=localStorage.getItem(Rnn);e&&n(e)}})},[]),{agent:t,setAgent:e=>{n(e),!(typeof window>`u`)&&(e?.trim()?localStorage.setItem(Rnn,e):localStorage.removeItem(Rnn))}}},Bnn=({isActive:e,onToggleInspector:t,onSubmitAgent:n,onCancel:r,isAgentWorking:i,messages:a,status:o,inspectionCount:s=0,inspectionItems:l=[],onRemoveInspection:u=()=>{}})=>{let[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(`none`),[b,x]=(0,_.useState)(!1),[C,w]=(0,_.useState)(!1),[T,E]=(0,_.useState)(!0),{agent:D,setAgent:O}=znn(fd),[k,A]=(0,_.useState)(!1),j=dd.find(e=>e.name===D)||dd[0],{elementRef:M,isDragging:N,handleMouseDown:P}=Lnn(),[F,I]=(0,_.useState)(null),[L,R]=(0,_.useState)(``),ee=Inn(L,i,50),[te,z]=(0,_.useState)(``),B=(0,_.useRef)(``),ne=(0,_.useRef)(``);(0,_.useEffect)(()=>{let e=ee,t=B.current;if(e.length<t.length||!e.startsWith(t)){z(e),B.current=e;return}if(e.length>t.length){let n=e.slice(t.length).trim();n&&z(n),B.current=e}},[ee]);let re=(0,_.useRef)(null),ie=(0,_.useRef)(null),ae=(0,_.useRef)(null),oe=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(a.length===0){R(``),g(null),ae.current=null,oe.current=!1,z(``),B.current=``;return}let e=a[a.length-1];if(e.role!==`assistant`)return;let t=Kce(e),{displayText:n,toolCall:r}=Jce(e,t||ae.current);R(n||``),t&&(ae.current=t),r?(ie.current&&=(clearTimeout(ie.current),null),g(r),oe.current=!0):oe.current=!1},[a]),(0,_.useEffect)(()=>{te!==ne.current&&(oe.current||g(null),ne.current=te)},[te]),(0,_.useEffect)(()=>{d&&re.current&&re.current.focus()},[d]),(0,_.useEffect)(()=>{if(!i&&C){x(!1),w(!1),E(!1);let e=setTimeout(()=>{E(!0)},2e3);return()=>clearTimeout(e)}},[i,C]),(0,_.useEffect)(()=>{function e(e){let{plan:t,inspectionId:n}=e.detail;if(t?.steps){let e=t.steps.find(e=>e.status===`in-progress`),r=t.steps.filter(e=>e.status===`completed`).length;I({id:n,status:`in-progress`,currentStep:e?{title:e.title,index:r+1,total:t.steps.length}:void 0})}}function t(e){let{status:t,result:n,inspectionId:r}=e.detail;I({id:r,status:t,message:n?.message||n})}return window.addEventListener(`plan-progress-reported`,e),window.addEventListener(`inspection-result-received`,t),()=>{window.removeEventListener(`plan-progress-reported`,e),window.removeEventListener(`inspection-result-received`,t)}},[]);let se=e=>{e.preventDefault(),p.trim()&&(ie.current&&=(clearTimeout(ie.current),null),g(null),R(``),ae.current=null,x(!0),w(!0),n(p,D),m(``),f(!0),y(`chat`))},ce=e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),se(e)),e.key===`Escape`&&(f(!1),re.current?.blur())},le=o===`error`,ue=a.length>0,de=d&&!b,fe=(!d||b)&&(i||ue||F);return(0,S.jsxs)(`div`,{ref:M,className:nt(`fixed bottom-8 left-1/2 z-[999999]`,`transition-all duration-300 ease-[cubic-bezier(0.23,1,0.32,1)]`,d?`w-[450px]`:fe?`w-auto min-w-[200px] max-w-[450px]`:`w-[160px]`,N?`cursor-grabbing`:`cursor-grab`),onMouseDown:P,onMouseEnter:()=>{N||(i||C?(f(!0),y(`chat`)):T&&f(!0))},onMouseLeave:()=>{!p.trim()&&!C&&!N&&(f(!1),y(`none`)),E(!0)},children:[(0,S.jsxs)(`div`,{className:nt(`relative flex items-center backdrop-blur-xl shadow-2xl border border-border`,`transition-[width,height,padding,background-color,border-color] duration-200 ease-out`,d?`h-12 p-2 pl-4`:`h-9 px-2 py-1`,v===`none`?`bg-muted/90 rounded-full`:`bg-muted/95 rounded-b-lg rounded-t-none border-t-0`,le&&!d&&`bg-destructive/10 border-destructive/20`),children:[(0,S.jsxs)(`div`,{className:nt(`flex items-center transition-opacity duration-300 w-full relative`,de?`absolute left-3 opacity-0 pointer-events-none`:`relative opacity-100`),children:[!fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:(0,S.jsx)(gi,{className:`w-3.5 h-3.5 text-foreground`})}),(0,S.jsx)(`span`,{className:`text-xs text-muted-foreground/70 ml-3`,children:`Hover to inspect`})]}),fe&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-3 flex-shrink-0`,children:[(0,S.jsx)(`div`,{className:`relative flex items-center justify-center w-6 h-6 rounded-full bg-accent flex-shrink-0`,children:i?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-foreground`}),(0,S.jsx)(gi,{className:`w-3.5 h-3.5 animate-pulse text-foreground`})]}):F?F.status===`in-progress`?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`absolute inset-0 rounded-full border-2 border-current opacity-20 animate-ping text-blue-500`}),(0,S.jsx)(vi,{className:`w-3.5 h-3.5 animate-pulse text-blue-500`})]}):F.status===`completed`?(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`}):(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):le?(0,S.jsx)(oi,{className:`w-5 h-5 text-red-500`}):(0,S.jsx)(ai,{className:`w-5 h-5 text-green-500`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsx)(`div`,{className:`flex-1 flex justify-center min-w-0 pl-2`,children:(0,S.jsx)(`div`,{className:`flex flex-col min-w-0 max-w-full pr-2 max-h-[24px] overflow-hidden`,children:F&&F.status===`in-progress`&&F.currentStep?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsxs)(`span`,{className:`truncate min-w-0`,children:[`Step `,F.currentStep.index,`/`,F.currentStep.total,`: `,F.currentStep.title]})]}):F?.message?(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:F.message}):h?(0,S.jsxs)(`div`,{className:`flex items-center gap-1.5 text-sm font-medium text-foreground min-w-0`,children:[(0,S.jsx)(vi,{className:`w-4 h-4 flex-shrink-0`}),(0,S.jsx)(`span`,{className:`truncate min-w-0`,children:h})]}):(0,S.jsx)(`div`,{className:`text-sm font-medium leading-[1.4] text-foreground truncate min-w-0`,children:i&&!te?(0,S.jsx)(Uce,{duration:2,spread:2,children:o===`submitted`&&j?.command===`npx`?`Starting ${j.name}... This may take a moment.`:`Thinking...`}):te||`Processing...`})})})]})]}),(0,S.jsxs)(`div`,{className:nt(`flex items-center w-full gap-3 transition-all duration-500 delay-75`,de?`opacity-100 translate-y-0 relative pointer-events-auto`:`opacity-0 translate-y-4 pointer-events-none absolute top-2 left-4 right-2`),onClick:e=>e.stopPropagation(),children:[(0,S.jsx)(`button`,{onClick:t,className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,e?`bg-blue-500 text-white shadow-[0_0_15px_rgba(59,130,246,0.5)]`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:`Toggle Inspector`,children:(0,S.jsx)(li,{className:`w-3.5 h-3.5`})}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`}),s>0&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`button`,{type:`button`,onClick:()=>y(e=>e===`inspections`?`none`:`inspections`),className:nt(`relative flex items-center justify-center w-7 h-7 rounded-full transition-colors flex-shrink-0`,`hover:bg-accent/50`,v===`inspections`&&`bg-accent/50 text-foreground`),title:`View Inspections`,children:[(0,S.jsx)(ui,{className:`w-3.5 h-3.5`}),(0,S.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 flex items-center justify-center min-w-[12px] h-[12px] px-0.5 text-[8px] font-bold text-white bg-red-500 rounded-full border border-background shadow-sm leading-none`,children:s>99?`99+`:s})]}),(0,S.jsx)(`div`,{className:`w-px h-4 bg-border flex-shrink-0`})]}),(0,S.jsxs)(`form`,{onSubmit:se,className:`flex-1 flex items-center gap-2 min-w-0`,onClick:e=>e.stopPropagation(),children:[(0,S.jsxs)(`div`,{className:`relative flex-shrink-0`,children:[(0,S.jsx)(`button`,{type:`button`,onClick:()=>A(!k),className:`flex items-center justify-center w-7 h-7 rounded-full hover:bg-accent/50 transition-colors`,title:`Select Agent`,children:(0,S.jsx)(`img`,{src:dd.find(e=>e.name===D)?.meta?.icon,alt:D,className:`w-3.5 h-3.5`})}),k&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`div`,{className:`fixed inset-0 z-[999998]`,onClick:()=>A(!1)}),(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 mb-2 w-48 bg-popover border border-border rounded-lg shadow-lg overflow-hidden z-[999999] animate-in fade-in zoom-in-95 duration-200`,children:dd.map(e=>(0,S.jsxs)(`button`,{onClick:()=>{O(e.name),A(!1)},className:nt(`w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-accent transition-colors`,D===e.name&&`bg-accent/50 font-medium`),children:[e.meta?.icon&&(0,S.jsx)(`img`,{src:e.meta.icon,alt:``,className:`w-4 h-4`}),e.name]},e.name))})]})]}),(0,S.jsx)(`input`,{ref:re,type:`text`,value:p,onChange:e=>m(e.target.value),onKeyDown:ce,placeholder:`Ask ${D}...`,className:`w-full bg-transparent border-none outline-none text-foreground placeholder-muted-foreground text-sm h-7 disabled:opacity-50`,tabIndex:0,disabled:i}),(a.length>0||i||C)&&(0,S.jsx)(`button`,{type:`button`,onClick:()=>y(e=>e===`chat`?`none`:`chat`),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,v===`chat`?`bg-foreground text-background`:`bg-accent text-muted-foreground hover:bg-accent/80 hover:text-foreground`),title:v===`chat`?`Collapse`:`Expand messages`,children:(0,S.jsx)(ti,{className:nt(`w-3.5 h-3.5 transition-transform duration-300`,v===`chat`&&`rotate-180`)})}),i?(0,S.jsx)(`button`,{type:`button`,onClick:r,className:`flex items-center justify-center w-7 h-7 rounded-full bg-destructive text-destructive-foreground transition-all flex-shrink-0 hover:bg-destructive/90`,title:`Cancel request`,children:(0,S.jsx)(_i,{className:`w-3 h-3`})}):(0,S.jsx)(`button`,{type:`submit`,disabled:!p.trim(),className:nt(`flex items-center justify-center w-7 h-7 rounded-full transition-all flex-shrink-0`,p.trim()?`bg-foreground text-background scale-100`:`bg-accent text-muted-foreground/50 scale-90`),children:(0,S.jsx)(Qr,{className:`w-3.5 h-3.5`})})]})]})]}),v!==`none`&&(0,S.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 pointer-events-auto max-w-[450px] mx-auto animate-panel-in`,children:(0,S.jsxs)(`div`,{className:`bg-muted/95 backdrop-blur-xl rounded-t-xl border border-border border-b-0 shadow-2xl overflow-hidden`,children:[v===`inspections`&&l.length>0&&(0,S.jsx)(`div`,{className:`border-b border-border`,children:(0,S.jsx)(ea,{items:l,onRemove:u})}),v===`chat`&&(0,S.jsx)(`div`,{className:`h-[500px]`,children:(0,S.jsx)(Fnn,{messages:a,status:o,selectedAgent:D})})]})})]})};var Vnn=`vercel.ai.error`,Hnn=Symbol.for(Vnn),Unn,Wnn=class e extends Error{constructor({name:e,message:t,cause:n}){super(t),this[Unn]=!0,this.name=e,this.cause=n}static isInstance(t){return e.hasMarker(t,Vnn)}static hasMarker(e,t){let n=Symbol.for(t);return typeof e==`object`&&!!e&&n in e&&typeof e[n]==`boolean`&&e[n]===!0}};Unn=Hnn;var W7=Wnn;function Gnn(e){return e==null?`unknown error`:typeof e==`string`?e:e instanceof Error?e.message:JSON.stringify(e)}var Knn=`AI_InvalidArgumentError`,qnn=`vercel.ai.error.${Knn}`,Jnn=Symbol.for(qnn),Ynn,Xnn=class extends W7{constructor({message:e,cause:t,argument:n}){super({name:Knn,message:e,cause:t}),this[Ynn]=!0,this.argument=n}static isInstance(e){return W7.hasMarker(e,qnn)}};Ynn=Jnn;var Znn=`AI_JSONParseError`,Qnn=`vercel.ai.error.${Znn}`,$nn=Symbol.for(Qnn),ern,trn=class extends W7{constructor({text:e,cause:t}){super({name:Znn,message:`JSON parsing failed: Text: ${e}.
6940
6936
  Error message: ${Gnn(t)}`,cause:t}),this[ern]=!0,this.text=e}static isInstance(e){return W7.hasMarker(e,Qnn)}};ern=$nn;var nrn=`AI_TypeValidationError`,rrn=`vercel.ai.error.${nrn}`,irn=Symbol.for(rrn),arn,orn=class e extends W7{constructor({value:e,cause:t}){super({name:nrn,message:`Type validation failed: Value: ${JSON.stringify(e)}.
6941
6937
  Error message: ${Gnn(t)}`,cause:t}),this[arn]=!0,this.value=e}static isInstance(e){return W7.hasMarker(e,rrn)}static wrap({value:t,cause:n}){return e.isInstance(n)&&n.value===t?n:new e({value:t,cause:n})}};arn=irn;var G7=orn,srn=class extends TransformStream{constructor({onError:e,onRetry:t,onComment:n}={}){let r;super({start(i){r=Cl({onEvent:e=>{i.enqueue(e)},onError(t){e===`terminate`?i.error(t):typeof e==`function`&&e(t)},onRetry:t,onComment:n})},transform(e){r.feed(e)}})}};Object.freeze({status:`aborted`});function K7(e,t,n){function r(n,r){var i;for(let a in Object.defineProperty(n,`_zod`,{value:n._zod??{},enumerable:!1}),(i=n._zod).traits??(i.traits=new Set),n._zod.traits.add(e),t(n,r),o.prototype)a in n||Object.defineProperty(n,a,{value:o.prototype[a].bind(n)});n._zod.constr=o,n._zod.def=r}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,`name`,{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,`init`,{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,`name`,{value:e}),o}var q7=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}};let crn={};function J7(e){return e&&Object.assign(crn,e),crn}function lrn(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function urn(e,t){return typeof t==`bigint`?t.toString():t}function drn(e){return{get value(){{let t=e();return Object.defineProperty(this,`value`,{value:t}),t}throw Error(`cached value already set`)}}}function frn(e){return e==null}function prn(e){let t=e.startsWith(`^`)?1:0,n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function mrn(e,t){let n=(e.toString().split(`.`)[1]||``).length,r=(t.toString().split(`.`)[1]||``).length,i=n>r?n:r;return Number.parseInt(e.toFixed(i).replace(`.`,``))%Number.parseInt(t.toFixed(i).replace(`.`,``))/10**i}function Y7(e,t,n){Object.defineProperty(e,t,{get(){{let r=n();return e[t]=r,r}throw Error(`cached value already set`)},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function X7(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Z7(e){return JSON.stringify(e)}let hrn=Error.captureStackTrace?Error.captureStackTrace:(...e)=>{};function Q7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}let grn=drn(()=>{if(typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function $7(e){if(Q7(e)===!1)return!1;let t=e.constructor;if(t===void 0)return!0;let n=t.prototype;return!(Q7(n)===!1||Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)===!1)}let _rn=new Set([`string`,`number`,`symbol`]);function e9(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function t9(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function n9(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function vrn(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}let yrn={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function brn(e,t){let n={},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&(n[e]=r.shape[e])}return t9(e,{...e._zod.def,shape:n,checks:[]})}function xrn(e,t){let n={...e._zod.def.shape},r=e._zod.def;for(let e in t){if(!(e in r.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete n[e]}return t9(e,{...e._zod.def,shape:n,checks:[]})}function Srn(e,t){if(!$7(t))throw Error(`Invalid input to extend: expected a plain object`);return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t};return X7(this,`shape`,n),n},checks:[]})}function Crn(e,t){return t9(e,{...e._zod.def,get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return X7(this,`shape`,n),n},catchall:t._zod.def.catchall,checks:[]})}function wrn(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return t9(t,{...t._zod.def,shape:i,checks:[]})}function Trn(e,t,n){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return t9(t,{...t._zod.def,shape:i,checks:[]})}function r9(e,t=0){for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function i9(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function a9(e){return typeof e==`string`?e:e?.message}function o9(e,t,n){let r={...e,path:e.path??[]};return e.message||(r.message=a9(e.inst?._zod.def?.error?.(e))??a9(t?.error?.(e))??a9(n.customError?.(e))??a9(n.localeError?.(e))??`Invalid input`),delete r.inst,delete r.continue,t?.reportInput||delete r.input,r}function Ern(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function s9(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}let Drn=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,`_zod`,{value:e._zod,enumerable:!1}),Object.defineProperty(e,`issues`,{value:t,enumerable:!1}),Object.defineProperty(e,`message`,{get(){return JSON.stringify(t,urn,2)},enumerable:!0}),Object.defineProperty(e,`toString`,{value:()=>e.message,enumerable:!1})},Orn=K7(`$ZodError`,Drn),krn=K7(`$ZodError`,Drn,{Parent:Error});function Arn(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function jrn(e,t){let n=t||function(e){return e.message},r={_errors:[]},i=e=>{for(let t of e.issues)if(t.code===`invalid_union`&&t.errors.length)t.errors.map(e=>i({issues:e}));else if(t.code===`invalid_key`)i({issues:t.issues});else if(t.code===`invalid_element`)i({issues:t.issues});else if(t.path.length===0)r._errors.push(n(t));else{let e=r,i=0;for(;i<t.path.length;){let r=t.path[i];i===t.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(n(t))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(e),r}let Mrn=e=>(t,n,r,i)=>{let a=r?Object.assign(r,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new q7;if(o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw hrn(t,i?.callee),t}return o.value},Nrn=e=>async(t,n,r,i)=>{let a=r?Object.assign(r,{async:!0}):{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new(i?.Err??e)(o.issues.map(e=>o9(e,a,J7())));throw hrn(t,i?.callee),t}return o.value},Prn=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new q7;return a.issues.length?{success:!1,error:new(e??Orn)(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Frn=Prn(krn),Irn=e=>async(t,n,r)=>{let i=r?Object.assign(r,{async:!0}):{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>o9(e,i,J7())))}:{success:!0,data:a.value}},Lrn=Irn(krn),Rrn=/^[cC][^\s-]{8,}$/,zrn=/^[0-9a-z]+$/,Brn=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Vrn=/^[0-9a-vA-V]{20}$/,Hrn=/^[A-Za-z0-9]{27}$/,Urn=/^[a-zA-Z0-9_-]{21}$/,Wrn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Grn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Krn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000)$/,qrn=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;function Jrn(){return RegExp(`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`,`u`)}let Yrn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Xrn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})$/,Zrn=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Qrn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,$rn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ein=/^[A-Za-z0-9_-]*$/,tin=/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/,nin=/^\+(?:[0-9]){6,14}[0-9]$/,rin=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,iin=RegExp(`^${rin}$`);function ain(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function oin(e){return RegExp(`^${ain(e)}$`)}function sin(e){let t=ain({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-]\\d{2}:\\d{2})`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${rin}T(?:${r})$`)}let cin=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},lin=/^\d+$/,uin=/^-?\d+(?:\.\d+)?/i,din=/true|false/i,fin=/null/i,pin=/^[^A-Z]*$/,min=/^[^a-z]*$/,c9=K7(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),hin={number:`number`,bigint:`bigint`,object:`date`},gin=K7(`$ZodCheckLessThan`,(e,t)=>{c9.init(e,t);let n=hin[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),_in=K7(`$ZodCheckGreaterThan`,(e,t)=>{c9.init(e,t);let n=hin[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),vin=K7(`$ZodCheckMultipleOf`,(e,t)=>{c9.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):mrn(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),yin=K7(`$ZodCheckNumberFormat`,(e,t)=>{c9.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=yrn[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=lin)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inst:e})}}),bin=K7(`$ZodCheckMaxLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!frn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ern(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),xin=K7(`$ZodCheckMinLength`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!frn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ern(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Sin=K7(`$ZodCheckLengthEquals`,(e,t)=>{var n;c9.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!frn(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ern(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),l9=K7(`$ZodCheckStringFormat`,(e,t)=>{var n,r;c9.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Cin=K7(`$ZodCheckRegex`,(e,t)=>{l9.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),win=K7(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=pin,l9.init(e,t)}),Tin=K7(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=min,l9.init(e,t)}),Ein=K7(`$ZodCheckIncludes`,(e,t)=>{c9.init(e,t);let n=e9(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Din=K7(`$ZodCheckStartsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`^${e9(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Oin=K7(`$ZodCheckEndsWith`,(e,t)=>{c9.init(e,t);let n=RegExp(`.*${e9(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),kin=K7(`$ZodCheckOverwrite`,(e,t)=>{c9.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});var Ain=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
6942
6938
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
package/dist/index.cjs CHANGED
@@ -1,8 +1,45 @@
1
1
  const require_chunk = require('./chunk.cjs');
2
2
  const require_config_updater = require('./config-updater.cjs');
3
3
  const require_vue_transform = require('./vue-transform.cjs');
4
+ let __modelcontextprotocol_sdk_client_index_js = require("@modelcontextprotocol/sdk/client/index.js");
5
+ let __modelcontextprotocol_sdk_client_sse_js = require("@modelcontextprotocol/sdk/client/sse.js");
4
6
  let unplugin = require("unplugin");
5
7
 
8
+ //#region src/utils/browser-launcher.ts
9
+ /**
10
+ * Launch browser via Chrome DevTools MCP
11
+ * Uses MCP Client to connect to the MCP server endpoint
12
+ */
13
+ async function launchBrowserWithDevTools(options) {
14
+ const { url, serverContext } = options;
15
+ const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host || "localhost"}:${serverContext.port || 5173}/__mcp__/sse?clientId=auto-browser`;
16
+ let client = null;
17
+ try {
18
+ client = new __modelcontextprotocol_sdk_client_index_js.Client({
19
+ name: "dev-inspector-auto-browser",
20
+ version: "1.0.0"
21
+ });
22
+ const transport = new __modelcontextprotocol_sdk_client_sse_js.SSEClientTransport(new URL(sseUrl));
23
+ await client.connect(transport);
24
+ await client.callTool({
25
+ name: "chrome_devtools",
26
+ arguments: {
27
+ useTool: "chrome_navigate_page",
28
+ hasDefinitions: ["chrome_navigate_page"],
29
+ chrome_navigate_page: { url }
30
+ }
31
+ });
32
+ await new Promise((resolve) => setTimeout(resolve, 500));
33
+ return true;
34
+ } catch (error) {
35
+ console.error(`[dev-inspector] ⚠️ Failed to auto-open browser:`, error instanceof Error ? error.message : String(error));
36
+ return false;
37
+ } finally {
38
+ if (client) await client.close().catch(() => {});
39
+ }
40
+ }
41
+
42
+ //#endregion
6
43
  //#region src/core.ts
7
44
  const unplugin$1 = (0, unplugin.createUnplugin)((options = {}) => {
8
45
  const enabled = options.enabled ?? process.env.NODE_ENV !== "production";
@@ -117,7 +154,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
117
154
  host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
118
155
  port: options.port ?? server.config.server.port ?? 5173
119
156
  };
120
- const baseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse`;
157
+ const displayHost = serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host;
158
+ const baseUrl = `http://${displayHost}:${serverContext.port}/__mcp__/sse`;
121
159
  console.log(`[dev-inspector] 📡 MCP: ${baseUrl}\n`);
122
160
  await require_config_updater.setupMcpMiddleware(server.middlewares, serverContext);
123
161
  require_config_updater.setupAcpMiddleware(server.middlewares, serverContext, {
@@ -132,6 +170,19 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
132
170
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
133
171
  customEditors: options.customEditors
134
172
  });
173
+ if (options.autoOpenBrowser ?? true) {
174
+ const targetUrl = options.browserUrl ?? `http://${displayHost}:${serverContext.port}`;
175
+ setTimeout(async () => {
176
+ if (await launchBrowserWithDevTools({
177
+ url: targetUrl,
178
+ serverContext
179
+ })) console.log(`[dev-inspector] 🌐 Browser opened: ${targetUrl}`);
180
+ else console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to open browser manually.\n`);
181
+ }, 1e3);
182
+ } else {
183
+ console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
184
+ console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to enable.\n`);
185
+ }
135
186
  }
136
187
  require_config_updater.setupInspectorMiddleware(server.middlewares, {
137
188
  agents: options.agents,
@@ -163,7 +214,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
163
214
  port
164
215
  };
165
216
  if (enableMcp) {
166
- const baseUrl = `http://${host === "0.0.0.0" ? "localhost" : host}:${port}/__mcp__/sse`;
217
+ const displayHost = host === "0.0.0.0" ? "localhost" : host;
218
+ const baseUrl = `http://${displayHost}:${port}/__mcp__/sse`;
167
219
  console.log(`[dev-inspector] 📡 MCP (Standalone): ${baseUrl}\n`);
168
220
  require_config_updater.setupMcpMiddleware(server, serverContext);
169
221
  require_config_updater.setupAcpMiddleware(server, serverContext, {
@@ -178,6 +230,19 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
178
230
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
179
231
  customEditors: options.customEditors
180
232
  });
233
+ if (options.autoOpenBrowser ?? true) {
234
+ const targetUrl = options.browserUrl ?? `http://${displayHost}:${port}`;
235
+ setTimeout(async () => {
236
+ if (await launchBrowserWithDevTools({
237
+ url: targetUrl,
238
+ serverContext
239
+ })) console.log(`[dev-inspector] 🌐 Browser opened: ${targetUrl}`);
240
+ else console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to open browser manually.\n`);
241
+ }, 1e3);
242
+ } else {
243
+ console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
244
+ console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to enable.\n`);
245
+ }
181
246
  }
182
247
  require_config_updater.setupInspectorMiddleware(server, {
183
248
  agents: options.agents,
package/dist/index.d.cts CHANGED
@@ -118,6 +118,18 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
118
118
  * @example "virtual:my-inspector" or "virtual:custom-mcp"
119
119
  */
120
120
  virtualModuleName?: string;
121
+ /**
122
+ * Automatically open browser with Chrome DevTools when dev server starts
123
+ * Uses Chrome DevTools Protocol for full debugging capabilities (console, network, etc.)
124
+ * @default true when enableMcp is true
125
+ */
126
+ autoOpenBrowser?: boolean;
127
+ /**
128
+ * Custom browser launch URL
129
+ * If not specified, uses the dev server URL (e.g., http://localhost:5173)
130
+ * @example "http://localhost:5173/dashboard"
131
+ */
132
+ browserUrl?: string;
121
133
  }
122
134
  declare const unplugin: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
123
135
  //#endregion
package/dist/index.d.ts CHANGED
@@ -118,6 +118,18 @@ interface DevInspectorOptions extends McpConfigOptions, AcpOptions {
118
118
  * @example "virtual:my-inspector" or "virtual:custom-mcp"
119
119
  */
120
120
  virtualModuleName?: string;
121
+ /**
122
+ * Automatically open browser with Chrome DevTools when dev server starts
123
+ * Uses Chrome DevTools Protocol for full debugging capabilities (console, network, etc.)
124
+ * @default true when enableMcp is true
125
+ */
126
+ autoOpenBrowser?: boolean;
127
+ /**
128
+ * Custom browser launch URL
129
+ * If not specified, uses the dev server URL (e.g., http://localhost:5173)
130
+ * @example "http://localhost:5173/dashboard"
131
+ */
132
+ browserUrl?: string;
121
133
  }
122
134
  declare const unplugin: unplugin0.UnpluginInstance<DevInspectorOptions | undefined, boolean>;
123
135
  //#endregion
package/dist/index.js CHANGED
@@ -1,7 +1,44 @@
1
1
  import { i as setupMcpMiddleware, n as setupAcpMiddleware, r as setupInspectorMiddleware, t as updateMcpConfigs } from "./config-updater.js";
2
2
  import { n as transformJSX, t as compileVue } from "./vue-transform.js";
3
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
+ import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3
5
  import { createUnplugin } from "unplugin";
4
6
 
7
+ //#region src/utils/browser-launcher.ts
8
+ /**
9
+ * Launch browser via Chrome DevTools MCP
10
+ * Uses MCP Client to connect to the MCP server endpoint
11
+ */
12
+ async function launchBrowserWithDevTools(options) {
13
+ const { url, serverContext } = options;
14
+ const sseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host || "localhost"}:${serverContext.port || 5173}/__mcp__/sse?clientId=auto-browser`;
15
+ let client = null;
16
+ try {
17
+ client = new Client({
18
+ name: "dev-inspector-auto-browser",
19
+ version: "1.0.0"
20
+ });
21
+ const transport = new SSEClientTransport(new URL(sseUrl));
22
+ await client.connect(transport);
23
+ await client.callTool({
24
+ name: "chrome_devtools",
25
+ arguments: {
26
+ useTool: "chrome_navigate_page",
27
+ hasDefinitions: ["chrome_navigate_page"],
28
+ chrome_navigate_page: { url }
29
+ }
30
+ });
31
+ await new Promise((resolve) => setTimeout(resolve, 500));
32
+ return true;
33
+ } catch (error) {
34
+ console.error(`[dev-inspector] ⚠️ Failed to auto-open browser:`, error instanceof Error ? error.message : String(error));
35
+ return false;
36
+ } finally {
37
+ if (client) await client.close().catch(() => {});
38
+ }
39
+ }
40
+
41
+ //#endregion
5
42
  //#region src/core.ts
6
43
  const unplugin = createUnplugin((options = {}) => {
7
44
  const enabled = options.enabled ?? process.env.NODE_ENV !== "production";
@@ -116,7 +153,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
116
153
  host: options.host ?? (typeof viteHost === "string" ? viteHost : viteHost === true ? "0.0.0.0" : "localhost"),
117
154
  port: options.port ?? server.config.server.port ?? 5173
118
155
  };
119
- const baseUrl = `http://${serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host}:${serverContext.port}/__mcp__/sse`;
156
+ const displayHost = serverContext.host === "0.0.0.0" ? "localhost" : serverContext.host;
157
+ const baseUrl = `http://${displayHost}:${serverContext.port}/__mcp__/sse`;
120
158
  console.log(`[dev-inspector] 📡 MCP: ${baseUrl}\n`);
121
159
  await setupMcpMiddleware(server.middlewares, serverContext);
122
160
  setupAcpMiddleware(server.middlewares, serverContext, {
@@ -131,6 +169,19 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
131
169
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
132
170
  customEditors: options.customEditors
133
171
  });
172
+ if (options.autoOpenBrowser ?? true) {
173
+ const targetUrl = options.browserUrl ?? `http://${displayHost}:${serverContext.port}`;
174
+ setTimeout(async () => {
175
+ if (await launchBrowserWithDevTools({
176
+ url: targetUrl,
177
+ serverContext
178
+ })) console.log(`[dev-inspector] 🌐 Browser opened: ${targetUrl}`);
179
+ else console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to open browser manually.\n`);
180
+ }, 1e3);
181
+ } else {
182
+ console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
183
+ console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to enable.\n`);
184
+ }
134
185
  }
135
186
  setupInspectorMiddleware(server.middlewares, {
136
187
  agents: options.agents,
@@ -162,7 +213,8 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
162
213
  port
163
214
  };
164
215
  if (enableMcp) {
165
- const baseUrl = `http://${host === "0.0.0.0" ? "localhost" : host}:${port}/__mcp__/sse`;
216
+ const displayHost = host === "0.0.0.0" ? "localhost" : host;
217
+ const baseUrl = `http://${displayHost}:${port}/__mcp__/sse`;
166
218
  console.log(`[dev-inspector] 📡 MCP (Standalone): ${baseUrl}\n`);
167
219
  setupMcpMiddleware(server, serverContext);
168
220
  setupAcpMiddleware(server, serverContext, {
@@ -177,6 +229,19 @@ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
177
229
  updateConfigAdditionalServers: options.updateConfigAdditionalServers,
178
230
  customEditors: options.customEditors
179
231
  });
232
+ if (options.autoOpenBrowser ?? true) {
233
+ const targetUrl = options.browserUrl ?? `http://${displayHost}:${port}`;
234
+ setTimeout(async () => {
235
+ if (await launchBrowserWithDevTools({
236
+ url: targetUrl,
237
+ serverContext
238
+ })) console.log(`[dev-inspector] 🌐 Browser opened: ${targetUrl}`);
239
+ else console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to open browser manually.\n`);
240
+ }, 1e3);
241
+ } else {
242
+ console.log(`[dev-inspector] ⚠️ autoOpenBrowser: false - Console/Network context unavailable`);
243
+ console.log(`[dev-inspector] 💡 Use "launch_chrome_devtools" prompt to enable.\n`);
244
+ }
180
245
  }
181
246
  setupInspectorMiddleware(server, {
182
247
  agents: options.agents,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpc-tech/unplugin-dev-inspector-mcp",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "description": "Universal dev inspector plugin for React/Vue - inspect component sources and API calls in any bundler",
5
5
  "type": "module",
6
6
  "license": "MIT",