dexto 1.2.0 → 1.2.1
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/README.md +5 -3
- package/dist/webui/.next/standalone/.next/static/chunks/{419-6d449dcb2b056299.js → 419-a07413b585273a24.js} +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/BUILD_ID +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/app-build-manifest.json +2 -2
- package/dist/webui/.next/standalone/packages/webui/.next/build-manifest.json +2 -2
- package/dist/webui/.next/standalone/packages/webui/.next/prerender-manifest.json +3 -3
- package/dist/webui/.next/standalone/packages/webui/.next/required-server-files.json +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/app/chat/[sessionId]/page_client-reference-manifest.js +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/app/playground/page_client-reference-manifest.js +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/chunks/1.js +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/pages/500.html +1 -1
- package/dist/webui/.next/standalone/packages/webui/.next/server/server-reference-manifest.json +1 -1
- package/dist/webui/.next/{static/chunks/419-6d449dcb2b056299.js → standalone/packages/webui/.next/static/chunks/419-a07413b585273a24.js} +1 -1
- package/dist/webui/.next/standalone/packages/webui/package.json +1 -1
- package/dist/webui/.next/standalone/packages/webui/server.js +1 -1
- package/dist/webui/.next/{standalone/packages/webui/.next/static/chunks/419-6d449dcb2b056299.js → static/chunks/419-a07413b585273a24.js} +1 -1
- package/dist/webui/package.json +1 -1
- package/package.json +2 -2
- /package/dist/webui/.next/standalone/.next/static/{uqfH8SY_uhwdc0ZkpMwCO → b_pyEEg2sitTwMzZWW7vE}/_buildManifest.js +0 -0
- /package/dist/webui/.next/standalone/.next/static/{uqfH8SY_uhwdc0ZkpMwCO → b_pyEEg2sitTwMzZWW7vE}/_ssgManifest.js +0 -0
- /package/dist/webui/.next/standalone/packages/webui/.next/static/{uqfH8SY_uhwdc0ZkpMwCO → b_pyEEg2sitTwMzZWW7vE}/_buildManifest.js +0 -0
- /package/dist/webui/.next/standalone/packages/webui/.next/static/{uqfH8SY_uhwdc0ZkpMwCO → b_pyEEg2sitTwMzZWW7vE}/_ssgManifest.js +0 -0
- /package/dist/webui/.next/static/{uqfH8SY_uhwdc0ZkpMwCO → b_pyEEg2sitTwMzZWW7vE}/_buildManifest.js +0 -0
- /package/dist/webui/.next/static/{uqfH8SY_uhwdc0ZkpMwCO → b_pyEEg2sitTwMzZWW7vE}/_ssgManifest.js +0 -0
|
@@ -9,4 +9,4 @@ Content-Type=application/json`,rows:4,className:"flex w-full rounded-md border b
|
|
|
9
9
|
transition-transform transform
|
|
10
10
|
translate-x-0.5 data-[state=checked]:translate-x-[1.375rem]
|
|
11
11
|
bg-white dark:bg-gray-100
|
|
12
|
-
`,children:g?(0,d.jsx)(cS.A,{className:"w-3.5 h-3.5 text-gray-700"}):(0,d.jsx)(cT.A,{className:"w-3.5 h-3.5 text-yellow-500"})})})}),(0,d.jsx)(w,{children:g?"Switch to light mode":"Switch to dark mode"})]})}):(0,d.jsx)("div",{className:"w-12 h-6 bg-gray-300 dark:bg-gray-700 rounded-full"})}var cV=c(74985);function cW({active:a=!1}){let{voices:b,selected:c,setSelected:f}=function(){let[a,b]=(0,e.useState)(E.getVoices()),[c,d]=(0,e.useState)(E.getPreferredVoiceName());return{voices:a,selected:c,setSelected:a=>{E.setPreferredVoice(a),d(E.getPreferredVoiceName())}}}(),[g,h]=(0,e.useState)(!1);return a?(0,d.jsxs)(cV.l6,{value:c??"auto",onValueChange:a=>{f("auto"===a?null:a)},children:[(0,d.jsx)(cV.bq,{className:"h-8 w-[12rem] text-xs",children:(0,d.jsx)(cV.yv,{placeholder:"Voice"})}),(0,d.jsxs)(cV.gC,{children:[(0,d.jsx)(cV.eb,{value:"auto",children:"Auto (best available)"}),g&&b.map(a=>(0,d.jsxs)(cV.eb,{value:a.name,children:[a.name," (",a.lang,")"]},`${a.name}-${a.lang}`))]})]}):null}function cX({isOpen:a,onClose:b}){return(0,d.jsx)(aN.lG,{open:a,onOpenChange:a=>!a&&b(),children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-lg",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsx)(aN.L3,{children:"Settings"}),(0,d.jsx)(aN.rr,{children:"Configure preferences for speech and more."})]}),(0,d.jsx)("div",{className:"space-y-6 py-2",children:(0,d.jsxs)("section",{className:"space-y-2",children:[(0,d.jsx)(aQ.J,{className:"text-xs uppercase text-muted-foreground",children:"Voice"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose a preferred text-to-speech voice. “Auto” selects the best available voice on your device."}),(0,d.jsx)(cW,{active:a})]})})]})})}var cY=c(26960),cZ=c(71436);let c$={id:"",name:"",description:"",author:"",tags:""},c_={llm:{provider:"openai",model:"gpt-5",apiKey:""},systemPrompt:{contributors:[{id:"primary",type:"static",priority:0,enabled:!0,content:""}]}};function c0({open:a,onOpenChange:b,onAgentCreated:c}){let[f,h]=(0,e.useState)(c$),[i,j]=(0,e.useState)(c_),[k,l]=(0,e.useState)({}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)({basic:!0,llm:!0,systemPrompt:!0}),s=a=>{r(b=>({...b,[a]:!b[a]}))},t=(a,b)=>{h(c=>({...c,[a]:b})),k[a]&&l(b=>{let c={...b};return delete c[a],c})},u=async()=>{if((()=>{let a={};f.id.trim()?/^[a-z0-9-]+$/.test(f.id)||(a.id="Agent ID must contain only lowercase letters, numbers, and hyphens"):a.id="Agent ID is required",f.name.trim()||(a.name="Agent name is required"),f.description.trim()||(a.description="Description is required"),i.llm?.provider||(a["llm.provider"]="Provider is required"),i.llm?.model?.trim()||(a["llm.model"]="Model is required");let b=i.systemPrompt;if(b&&"object"==typeof b&&"contributors"in b){let c=b.contributors;Array.isArray(c)&&(c.some(a=>!!("static"===a.type&&"string"==typeof a.content&&a.content.trim()))||(a.systemPrompt="At least one static contributor with content is required"))}else"string"!=typeof b||b.trim()||(a.systemPrompt="System prompt is required");return l(a),0===Object.keys(a).length})()){n(!0),p(null);try{let a="";if(i.systemPrompt&&"object"==typeof i.systemPrompt&&"contributors"in i.systemPrompt){let b=i.systemPrompt.contributors;if(Array.isArray(b)){let c=b.find(a=>"static"===a.type&&a.content);c&&"content"in c&&"string"==typeof c.content&&(a=c.content.trim())}}else"string"==typeof i.systemPrompt&&(a=i.systemPrompt.trim());a||(a="You are a helpful AI assistant.");let d=await fetch(`${(0,g.e)()}/api/agents/custom/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f.id.trim(),name:f.name.trim(),description:f.description.trim(),author:f.author.trim()||void 0,tags:f.tags.split(",").map(a=>a.trim()).filter(Boolean),llm:{provider:i.llm?.provider,model:i.llm?.model?.trim(),...i.llm?.apiKey?.trim()&&{apiKey:i.llm.apiKey.trim()}},systemPrompt:a})});if(!d.ok){let a=await d.json().catch(()=>({error:"Failed to create agent"}));throw Error(a.message||a.error||`Creation failed: ${d.statusText}`)}let e=await d.json();h(c$),j(c_),l({}),b(!1),c&&e.id&&c(e.id)}catch(a){p(a instanceof Error?a.message:"An unexpected error occurred")}finally{n(!1)}}};return(0,d.jsx)(aN.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(aN.Cf,{className:"max-w-2xl max-h-[90vh] flex flex-col",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsx)(aN.L3,{children:"Create New Agent"}),(0,d.jsxs)(aN.rr,{children:["Create a custom agent with your own configuration.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"You can add more advanced configuration after creating the agent using the Edit Agent button."]})]}),o&&(0,d.jsxs)("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-3 flex items-start gap-2",children:[(0,d.jsx)(bc.A,{className:"h-4 w-4 text-destructive mt-0.5 flex-shrink-0"}),(0,d.jsx)("div",{className:"text-sm text-destructive",children:o})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-4 pr-2",children:[(0,d.jsx)(b2,{title:"Basic Information",open:q.basic,onOpenChange:()=>s("basic"),children:(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-id",tooltip:"Unique identifier for this agent (lowercase, no spaces, hyphens only)",children:"Agent ID *"}),(0,d.jsx)(aP.p,{id:"agent-id",value:f.id,onChange:a=>t("id",a.target.value),placeholder:"my-custom-agent","aria-invalid":!!k.id}),k.id&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:k.id})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-name",tooltip:"Display name for this agent (shown in UI)",children:"Agent Name *"}),(0,d.jsx)(aP.p,{id:"agent-name",value:f.name,onChange:a=>t("name",a.target.value),placeholder:"My Custom Agent","aria-invalid":!!k.name}),k.name&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:k.name})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-description",tooltip:"Brief description of what this agent does",children:"Description *"}),(0,d.jsx)(aP.p,{id:"agent-description",value:f.description,onChange:a=>t("description",a.target.value),placeholder:"A custom agent for specific tasks","aria-invalid":!!k.description}),k.description&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:k.description})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-author",tooltip:"Your name or organization",children:"Author"}),(0,d.jsx)(aP.p,{id:"agent-author",value:f.author,onChange:a=>t("author",a.target.value),placeholder:"Your Name"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-tags",tooltip:"Comma-separated tags for categorization",children:"Tags"}),(0,d.jsx)(aP.p,{id:"agent-tags",value:f.tags,onChange:a=>t("tags",a.target.value),placeholder:"coding, custom, specialized"})]})]})}),(0,d.jsx)(b7,{value:i.llm||{provider:"openai",model:"gpt-5",apiKey:""},onChange:a=>j(b=>({...b,llm:a})),errors:k,open:q.llm,onOpenChange:()=>s("llm"),errorCount:0,sectionErrors:[]}),(0,d.jsx)(b9,{value:"object"==typeof i.systemPrompt&&"contributors"in i.systemPrompt?{contributors:i.systemPrompt.contributors||[]}:{contributors:[]},onChange:a=>j(b=>({...b,systemPrompt:a})),errors:k,open:q.systemPrompt,onOpenChange:()=>s("systemPrompt"),errorCount:0,sectionErrors:[]})]}),(0,d.jsxs)(aN.Es,{children:[(0,d.jsx)(x.$,{variant:"outline",onClick:()=>{h(c$),j(c_),l({}),p(null),b(!1)},disabled:m,children:"Cancel"}),(0,d.jsxs)(x.$,{onClick:u,disabled:m,children:[m&&(0,d.jsx)(N.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Agent"]})]})]})})}let c1="dexto:recentAgents";function c2({mode:a="default"}){let b=(0,h.useRouter)(),{returnToWelcome:c}=(0,i.v)(),[f,j]=(0,e.useState)([]),[k,l]=(0,e.useState)([]),[m,n]=(0,e.useState)(null),[p,r]=(0,e.useState)(null),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(!1),[w,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),D=(0,e.useCallback)(()=>{try{let a=localStorage.getItem(c1);if(!a)return[];return JSON.parse(a).sort((a,b)=>b.lastUsed-a.lastUsed).slice(0,5)}catch(a){return console.error("Failed to load recent agents:",a),localStorage.removeItem(c1),[]}},[]),E=(0,e.useCallback)(a=>{try{let b=D().filter(b=>b.path!==a.path),c=[{...a,lastUsed:Date.now()},...b].slice(0,5);localStorage.setItem(c1,JSON.stringify(c)),t(c)}catch(a){console.error("Failed to save recent agent:",a)}},[D]),F=(0,e.useCallback)(async()=>{try{let a=await fetch(`${(0,g.e)()}/api/agents`);if(!a.ok)throw Error("Failed to fetch agents");let b=await a.json();j(b.installed||[]),l(b.available||[]),n(b.current.id);try{let a=await fetch(`${(0,g.e)()}/api/agent/path`);if(a.ok){let b=await a.json();r(b),b.path&&b.name&&E({id:b.name,name:b.name,path:b.path})}}catch(a){console.error("Failed to fetch agent path:",a)}return b}catch(a){return console.error(`AgentSelector load error: ${a}`),null}},[E]),G=(0,e.useCallback)(async a=>{try{y(!0);let d=f.find(b=>b.id===a);if(!d)throw console.error(`Agent not found in installed list: ${a}`),Error(`Agent '${a}' not found. Please refresh the agents list.`);let e=await fetch(`${(0,g.e)()}/api/agents/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!e.ok){let a=await e.json().catch(()=>({}));throw console.error(`Agent switch failed: ${JSON.stringify(a)}`),Error(a.error||a.message||`Switch failed: ${e.status} ${e.statusText}`)}n(a),A(!1),await F();try{window.dispatchEvent(new CustomEvent("dexto:agentSwitched",{detail:{id:a,name:d.name}}))}catch{}c(),b.push("/")}catch(b){console.error(`Switch agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to switch agent";alert(`Failed to switch agent: ${a}`)}finally{y(!1)}},[c,f,F,b]),H=(0,e.useCallback)(async a=>{try{y(!0);let d=await fetch(`${(0,g.e)()}/api/agents/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id,path:a.path})});if(!d.ok){let a=await d.json().catch(()=>({}));throw console.error(`Agent switch failed: ${JSON.stringify(a)}`),Error(a.error||a.message||`Switch failed: ${d.status} ${d.statusText}`)}n(a.id),A(!1),await F(),E(a);try{window.dispatchEvent(new CustomEvent("dexto:agentSwitched",{detail:{id:a.id,name:a.name}}))}catch{}c(),b.push("/")}catch(b){console.error(`Switch agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to switch agent";alert(`Failed to switch agent: ${a}`)}finally{y(!1)}},[c,E,F,b]),I=(0,e.useCallback)(async a=>{try{y(!0);let b=await fetch(`${(0,g.e)()}/api/agents/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!b.ok){let a=await b.json().catch(()=>({}));throw Error(a.error||`Install failed: ${b.status}`)}let d=await F();if(!d)throw Error("Failed to reload agents list after installation");let e=d.installed.find(b=>b.id===a);if(!e)throw console.error(`Agent not found in fresh installed list: ${a}`),Error(`Agent '${a}' not found after installation. Please refresh.`);let f=await fetch(`${(0,g.e)()}/api/agents/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!f.ok){let a=await f.json().catch(()=>({}));throw console.error(`Agent switch failed: ${JSON.stringify(a)}`),Error(a.error||a.message||`Switch failed: ${f.status} ${f.statusText}`)}n(a),A(!1);try{window.dispatchEvent(new CustomEvent("dexto:agentSwitched",{detail:{id:a,name:e.name}}))}catch{}c()}catch(b){console.error(`Install agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to install agent";alert(`Failed to install agent: ${a}`)}finally{y(!1)}},[F,c]),J=(0,e.useCallback)(async(a,b)=>{if(b.stopPropagation(),confirm(`Are you sure you want to delete the custom agent "${a.name}"?`))try{y(!0);let b=await fetch(`${(0,g.e)()}/api/agents/uninstall`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id})});if(!b.ok){let a=await b.json().catch(()=>({}));throw Error(a.error||`Delete failed: ${b.status}`)}let c=await F();c?.current.id===a.id&&n(null)}catch(b){console.error(`Delete agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to delete agent";alert(`Failed to delete agent: ${a}`)}finally{y(!1)}},[m,F]),K=(0,e.useCallback)(async a=>{await new Promise(a=>setTimeout(a,1e3)),await F()},[F]),L=(0,e.useMemo)(()=>{if(!m)return"Choose Agent";let a=f.find(a=>a.id===m)||k.find(a=>a.id===m);return a?.name??m},[k,m,f]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aD,{open:z,onOpenChange:A,children:[(0,d.jsx)(aE,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"badge"===a?"outline":"default",size:"sm",className:(a=>{let b="transition-all duration-200 shadow-lg hover:shadow-xl font-semibold rounded-full";switch(a){case"badge":return`h-9 px-4 text-xs border border-teal-500 bg-teal-500/20 text-teal-600 hover:bg-teal-500/40 hover:border-teal-500 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 dark:hover:border-teal-300 min-w-[100px] max-w-[140px] md:min-w-[140px] md:max-w-[240px] lg:max-w-[400px] xl:max-w-[500px] ${b}`;case"title":return`h-11 px-4 text-lg font-bold bg-gradient-to-r from-teal-500/30 to-teal-500/40 text-teal-600 hover:from-teal-500/50 hover:to-teal-500/60 hover:text-teal-700 focus-visible:ring-2 focus-visible:ring-teal-500/50 focus-visible:ring-offset-2 border border-teal-500/40 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 ${b}`;default:return`h-10 px-3 text-sm bg-teal-500/40 text-teal-600 hover:bg-teal-500/50 hover:text-teal-700 focus-visible:ring-2 focus-visible:ring-teal-500/50 focus-visible:ring-offset-2 border border-teal-500/50 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 ${b}`}})(a),disabled:w,children:(0,d.jsxs)("div",{className:"flex items-center justify-between w-full min-w-0",children:[(0,d.jsx)(aZ.A,{className:"w-4 h-4 mr-2 flex-shrink-0"}),(0,d.jsx)("span",{className:"flex-1 text-center truncate min-w-0 px-1",children:w?"Switching...":"title"===a?`Agent: ${L}`:L}),(0,d.jsx)(o.A,{className:"w-4 h-4 ml-2 flex-shrink-0"})]})})}),(0,d.jsxs)(aF,{align:"start",className:"w-80 max-h-96 overflow-y-auto",children:[u&&(0,d.jsx)(aG,{disabled:!0,className:"text-center text-muted-foreground",children:"Loading agents..."}),!u&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aG,{onClick:()=>{C(!0),A(!1)},disabled:w,className:"cursor-pointer py-3 bg-gradient-to-r from-purple-500/10 to-purple-500/5 hover:from-purple-500/20 hover:to-purple-500/10 border-b border-purple-500/20",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,d.jsx)(aU.A,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),(0,d.jsx)("span",{className:"font-semibold text-purple-600 dark:text-purple-400",children:"New Agent"})]})}),p&&!f.some(a=>a.id===p.name)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-teal-600 dark:text-teal-400 uppercase tracking-wider",children:"Currently Active"}),(0,d.jsx)(aG,{onClick:()=>H({id:p.name,name:p.name,path:p.path}),disabled:w||m===p.name,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:p.name}),m===p.name&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:"Loaded from file"})]})})}),(0,d.jsx)(aH,{})]}),s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Recent"}),s.filter(a=>!f.some(b=>b.id===a.id)&&a.id!==p?.name&&!a.path.includes("/.dexto/")).slice(0,3).map(a=>(0,d.jsx)(aG,{onClick:()=>H(a),disabled:w||a.id===m,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),a.id===m&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",title:a.path,children:a.path})]})})},a.path)),(0,d.jsx)(aH,{})]}),f.filter(a=>"custom"===a.type).length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"px-2 py-1.5 text-xs font-semibold text-purple-600 dark:text-purple-400 uppercase tracking-wider flex items-center gap-1",children:[(0,d.jsx)(cY.A,{className:"w-3 h-3"}),"Custom Agents"]}),f.filter(a=>"custom"===a.type).map(a=>(0,d.jsx)(aG,{onClick:()=>G(a.id),disabled:w||a.id===m,className:"cursor-pointer py-3",children:(0,d.jsxs)("div",{className:"flex items-center justify-between w-full gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),a.id===m&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description}),a.author&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",a.author]})]}),(0,d.jsx)("button",{onClick:b=>J(a,b),disabled:w,className:"p-1 hover:bg-red-100 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete custom agent",children:(0,d.jsx)(bj.A,{className:"w-4 h-4 text-red-600 dark:text-red-400"})})]})},a.id))]}),f.filter(a=>"builtin"===a.type).length>0&&(0,d.jsxs)(d.Fragment,{children:[f.filter(a=>"custom"===a.type).length>0&&(0,d.jsx)(aH,{}),(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Installed"}),f.filter(a=>"builtin"===a.type).map(a=>(0,d.jsx)(aG,{onClick:()=>G(a.id),disabled:w||a.id===m,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),a.id===m&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description}),a.author&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",a.author]})]})})},a.id))]}),k.filter(a=>"builtin"===a.type).length>0&&(0,d.jsxs)(d.Fragment,{children:[f.length>0&&(0,d.jsx)(aH,{}),(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Available"}),k.filter(a=>"builtin"===a.type).map(a=>(0,d.jsx)(aG,{onClick:()=>I(a.id),disabled:w,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),(0,d.jsx)(cZ.A,{className:"w-4 h-4 text-blue-600 flex-shrink-0"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description}),a.author&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",a.author]})]})})},a.id))]}),!u&&0===f.length&&0===k.length&&(0,d.jsx)(aG,{disabled:!0,className:"text-center text-muted-foreground",children:"No agents found"})]})]})]}),(0,d.jsx)(c0,{open:B,onOpenChange:C,onAgentCreated:K})]})}function c3({sessionId:a}={}){let b=(0,h.useRouter)(),[c,k]=(0,e.useState)(!1),{messages:l,sendMessage:n,currentSessionId:p,switchSession:r,isWelcomeState:s,returnToWelcome:t,websocket:y,activeError:z,clearError:A,processing:B,cancel:C,greeting:D,isStreaming:E,setStreaming:F}=(0,i.v)(),[G,H]=(0,e.useState)(!1),[I,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),S=f().useRef(!0),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(!1),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)("dexto-config"),[ad,ae]=(0,e.useState)(null),[af,ag]=(0,e.useState)(""),[ah,ai]=(0,e.useState)(!1),[aj,ak]=(0,e.useState)(null),[al,am]=(0,e.useState)(!1),[an,ao]=(0,e.useState)(!1),[aq,ar]=(0,e.useState)(!1),[as,at]=(0,e.useState)(null),[au,aw]=(0,e.useState)(!1),[ay,az]=(0,e.useState)(!1),[aA,aB]=(0,e.useState)(null),[aC,aI]=(0,e.useState)(null),[aJ,aK]=(0,e.useState)([]),[aL,aM]=(0,e.useState)(!1),[aR,aS]=(0,e.useState)(0),aT=f().useRef(null),aU=f().useRef(null),[aV,aW]=(0,e.useState)(!0),[aZ,a$]=(0,e.useState)(!1),[a_,a0]=(0,e.useState)(!1);f().useRef(0);let[a1,a2]=(0,e.useState)(!1);f().useRef(null);let[a3,a4]=(0,e.useState)(0),[a5,a6]=(0,e.useState)(null),[a7,a8]=(0,e.useState)(!1);(0,e.useCallback)(()=>{let a=aT.current;a&&aW(a.scrollHeight-a.scrollTop<=a.clientHeight+1)},[]);let a9=(0,e.useCallback)((a="auto")=>{let b=aT.current;b&&(a$(!0),b.scrollTo({top:b.scrollHeight,behavior:a}),requestAnimationFrame(()=>a$(!1)))},[]),ba=(0,e.useCallback)(()=>{let a=aT.current;if(!a)return;let b=a.querySelectorAll('[data-role="user"]'),c=b[b.length-1];if(!c)return void a9("auto");let d=a.getBoundingClientRect(),e=Math.max(c.getBoundingClientRect().top-d.top+a.scrollTop-16,0);a$(!0),a.scrollTo({top:e,behavior:"auto"}),requestAnimationFrame(()=>a$(!1))},[a9]),bb=(0,e.useCallback)(async()=>{try{let a=p?`${(0,g.e)()}/api/agent/config/export?sessionId=${p}`:`${(0,g.e)()}/api/agent/config/export`,b=await fetch(a);if(!b.ok)throw Error("Failed to fetch configuration");let c=await b.text(),d=new Blob([c],{type:"application/x-yaml"}),e=URL.createObjectURL(d),f=document.createElement("a");f.href=e,f.download=p?`${ab}-${p}.yml`:`${ab}.yml`,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(e)}catch(a){console.error("Download failed:",a),ae(a instanceof Error?a.message:"Download failed")}},[ab,p]),bc=(0,e.useCallback)(async()=>{try{await navigator.clipboard.writeText(af),ai(!0),setTimeout(()=>ai(!1),2e3)}catch(a){console.error("Copy failed:",a),ae("Failed to copy to clipboard")}},[af]),bd=(0,e.useCallback)(async(a,b,c)=>{ao(!0),at(null);try{await n(a,b,c),setTimeout(()=>{ba(),a0(!0)},0)}catch(a){console.error("Failed to send message:",a),at(a instanceof Error?a.message:"Failed to send message"),setTimeout(()=>at(null),5e3)}finally{ao(!1)}},[n,ba]),be=(0,e.useCallback)(a=>{a0(!1),a2(!1),b.push(`/chat/${a}`)},[b]),bf=(0,e.useCallback)(()=>{a0(!1),a2(!1),t(),b.push("/")},[b,t]),bg=(0,e.useCallback)(async a=>{let b=bL(a),c="stdio"===b.type&&Object.keys(b.env||{}).length>0&&bK(b.env||{}),d=("sse"===b.type||"http"===b.type)&&"headers"in b&&Object.keys(b.headers||{}).length>0&&bK(b.headers||{});if(c||d)return a6({name:a.name,config:b,lockName:!0,registryEntryId:a.id,onCloseRegistryModal:a.onCloseRegistryModal??(()=>L(!1))}),H(!0),"requires-input";try{a8(!0);let c=await fetch(`${(0,g.e)()}/api/mcp/servers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.name,config:b,persistToAgent:!1})}),d=await c.json();if(!c.ok)throw Error(d.error||`Server returned status ${c.status}`);if(a.id)try{await br.setInstalled(a.id,!0)}catch(a){console.warn("Failed to mark registry entry installed:",a)}return a4(a=>a+1),ak(`Added ${a.name}`),setTimeout(()=>ak(null),4e3),L(!1),"connected"}catch(a){throw Error(a instanceof Error?a.message:"Failed to install server")}finally{a8(!1)}},[L,H,a6,a4,ak,a8]),bi=(0,e.useCallback)(()=>{P(!O)},[O,M]),bk=(0,e.useCallback)(()=>{N(!M)},[M,O]),bl=(0,e.useCallback)(async()=>{if(p){az(!0);try{if(!(await fetch(`${(0,g.e)()}/api/sessions/${p}`,{method:"DELETE"})).ok)throw Error("Failed to delete conversation");aw(!1),bf()}catch(a){console.error("Failed to delete conversation:",a),at(a instanceof Error?a.message:"Failed to delete conversation"),setTimeout(()=>at(null),5e3)}finally{az(!1)}}},[p,bf]),bm=f().useMemo(()=>[{title:"Help me get started",description:"Show me what you can do",action:()=>bd("I'm new to Dexto. Can you show me your capabilities and help me understand how to work with you effectively?"),icon:"\uD83D\uDE80"},{title:"Create Snake Game",description:"Build a game and open it",action:()=>bd("Create a snake game in a new directory with HTML, CSS, and JavaScript, then open it in the browser for me to play."),icon:"\uD83D\uDC0D"},{title:"Connect new tools",description:"Browse and add MCP servers",action:()=>N(!0),icon:"\uD83D\uDD27"},{title:"Demonstrate tools",description:"Show me your capabilities",action:()=>bd("Pick one of your most interesting tools and demonstrate it with a practical example. Show me what it can do."),icon:"⚡"}],[bd,N]),bp=f().useMemo(()=>{if(!aL)return bm.map(a=>({description:`${a.icon} ${a.title}`,tooltip:a.description,action:a.action}));let a=aJ.length>0?[]:bm.map(a=>({description:`${a.icon} ${a.title}`,tooltip:a.description,action:a.action}));return aJ.forEach(b=>{let c=b.title||b.description||"Starter prompt",d=b.description;if(b?.name==="starter:connect-tools")a.push({description:c,tooltip:d,action:()=>N(!0)});else{let e=b.metadata?.prompt||`/${b.name}`;a.push({description:c,tooltip:d,action:()=>bd(e)})}}),a},[aJ,aL,bm,bd,N]);return(0,d.jsxs)("div",{className:"flex w-full bg-background",style:{height:"var(--app-viewport-height, 100vh)",minHeight:"var(--app-viewport-height, 100vh)"},children:[(0,d.jsx)("div",{className:(0,j.cn)("hidden md:block shrink-0 border-r border-border/50 bg-card/50 backdrop-blur-sm",!S.current&&"transition-all duration-300 ease-in-out",O?"w-80":"w-0 overflow-hidden"),suppressHydrationWarning:!0,children:O&&(0,d.jsx)(bR,{isOpen:O,onClose:()=>P(!1),currentSessionId:p,onSessionChange:be,returnToWelcome:bf,variant:"inline",onSearchOpen:()=>U(!0),onNewChat:bf})}),(0,d.jsx)("div",{className:"md:hidden",children:(0,d.jsx)(bR,{isOpen:O,onClose:()=>P(!1),currentSessionId:p,onSessionChange:be,returnToWelcome:bf,variant:"overlay",onSearchOpen:()=>U(!0),onNewChat:bf})}),(0,d.jsxs)("main",{className:"flex-1 flex flex-col relative min-w-0",style:{"--thread-max-width":"54rem"},children:[null,(0,d.jsxs)("header",{className:"shrink-0 border-b border-border/50 bg-background/95 backdrop-blur-xl shadow-sm relative",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 shrink-0",children:[(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:bi,className:(0,j.cn)("h-8 w-8 p-0 transition-colors",O&&"bg-muted"),children:(0,d.jsx)(cM.A,{className:"h-4 w-4"})})}),(0,d.jsx)(w,{children:"Chat History (⌘H)"})]}),!O&&(0,d.jsx)("div",{className:"hidden md:block",children:(0,d.jsx)(bQ,{onClick:bf})}),(0,d.jsxs)("a",{href:"https://dexto.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center hover:opacity-80 transition-opacity shrink-0",children:[(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo_icon.svg",alt:"Dexto",className:"h-9 w-9 md:hidden"}),(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo_light.svg",alt:"Dexto",className:"h-11 w-auto hidden md:block dark:md:hidden"}),(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo.svg",alt:"Dexto",className:"h-11 w-auto hidden dark:md:block"}),(0,d.jsx)("span",{className:"sr-only",children:"Dexto"})]})]}),(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2",children:[(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:()=>$(!Z),className:(0,j.cn)("h-8 w-8 p-0",Z&&"bg-muted"),"aria-label":"Customize agent",children:(0,d.jsx)(cN.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Customize Agent (⌘E)"})]}),(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:bk,className:(0,j.cn)("h-8 w-8 p-0 transition-colors",M&&"bg-muted"),"aria-label":"Toggle tools panel",children:(0,d.jsx)(J.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Toggle tools panel (⌘J)"})]}),(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:()=>aa(!_),className:(0,j.cn)("h-8 w-8 p-0 transition-colors",_&&"bg-muted"),"aria-label":"Toggle memories panel",children:(0,d.jsx)(K.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Toggle memories panel (⌘M)"})]}),(0,d.jsx)(cU,{}),(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:()=>Y(!0),className:"h-8 w-8 p-0","aria-label":"Open settings",children:(0,d.jsx)(bW.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Settings"})]}),(0,d.jsxs)(aD,{children:[(0,d.jsx)(aE,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:(0,d.jsx)(cO.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsxs)(aF,{align:"end",children:[(0,d.jsxs)(aG,{onClick:()=>L(!0),children:[(0,d.jsx)(bw.A,{className:"h-4 w-4 mr-2"}),"Connect MCPs"]}),(0,d.jsxs)(aG,{onClick:()=>window.open("/playground","_blank"),children:[(0,d.jsx)(aY.A,{className:"h-4 w-4 mr-2"}),"MCP Playground"]}),(0,d.jsxs)(aG,{onClick:()=>W(!0),children:[(0,d.jsx)(cP.A,{className:"h-4 w-4 mr-2"}),"Export Config"]}),(0,d.jsxs)(aG,{onClick:()=>ar(!0),children:[(0,d.jsx)(cQ.A,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),p&&!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aH,{}),(0,d.jsxs)(aG,{onClick:()=>aw(!0),className:"text-destructive focus:text-destructive",children:[(0,d.jsx)(bj.A,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})]}),(0,d.jsx)("div",{className:"flex md:hidden",children:(0,d.jsxs)(aD,{open:al,onOpenChange:am,children:[(0,d.jsx)(aE,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":"Open menu",children:(0,d.jsx)(cR.A,{className:"h-4 w-4"})})}),(0,d.jsxs)(aF,{align:"end",children:[(0,d.jsxs)(aG,{onClick:()=>{$(!Z),am(!1)},children:[(0,d.jsx)(cN.A,{className:"h-4 w-4 mr-2"}),"Customize Agent"]}),(0,d.jsxs)(aG,{onClick:()=>{bk(),am(!1)},children:[(0,d.jsx)(J.A,{className:"h-4 w-4 mr-2"}),"Tools"]}),(0,d.jsxs)(aG,{onClick:()=>{aa(!_),am(!1)},children:[(0,d.jsx)(K.A,{className:"h-4 w-4 mr-2"}),"Memories"]}),(0,d.jsxs)(aG,{onClick:()=>{let a=document.documentElement.classList.contains("dark")?"light":"dark";document.documentElement.classList.toggle("dark","dark"===a),localStorage.setItem("theme",a),document.cookie=`theme=${a}; Path=/; Max-Age=31536000; SameSite=Lax`,am(!1)},children:[(0,d.jsx)("span",{className:"h-4 w-4 mr-2",children:"\uD83C\uDF19"}),"Toggle Theme"]}),(0,d.jsxs)(aG,{onClick:()=>{Y(!0),am(!1)},children:[(0,d.jsx)(bW.A,{className:"h-4 w-4 mr-2"}),"Settings"]}),(0,d.jsxs)(aG,{onClick:a=>{a.preventDefault(),F(!E)},className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[(0,d.jsx)(av.A,{className:"h-4 w-4 mr-2"}),"Streaming"]}),(0,d.jsx)(ax,{checked:E,onCheckedChange:F,onClick:a=>a.stopPropagation()})]}),(0,d.jsx)(aH,{}),(0,d.jsxs)(aG,{onClick:()=>{L(!0),am(!1)},children:[(0,d.jsx)(bw.A,{className:"h-4 w-4 mr-2"}),"Connect MCPs"]}),(0,d.jsxs)(aG,{onClick:()=>{window.open("/playground","_blank"),am(!1)},children:[(0,d.jsx)(aY.A,{className:"h-4 w-4 mr-2"}),"MCP Playground"]}),(0,d.jsxs)(aG,{onClick:()=>{W(!0),am(!1)},children:[(0,d.jsx)(cP.A,{className:"h-4 w-4 mr-2"}),"Export Config"]}),(0,d.jsxs)(aG,{onClick:()=>{ar(!0),am(!1)},children:[(0,d.jsx)(cQ.A,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),p&&!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aH,{}),(0,d.jsxs)(aG,{onClick:()=>{aw(!0),am(!1)},className:"text-destructive focus:text-destructive",children:[(0,d.jsx)(bj.A,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})})]}),(0,d.jsx)("div",{className:"absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2",children:(0,d.jsx)("div",{className:"w-full max-w-[180px] md:max-w-[260px]",children:(0,d.jsx)(c2,{mode:"badge"})})})]}),(0,d.jsxs)("div",{className:"flex-1 flex overflow-hidden min-w-0",children:[aj&&(0,d.jsxs)("div",{className:"fixed bottom-4 right-4 z-50 border border-border/60 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-foreground px-3 py-2 rounded-md shadow-md inline-flex items-center gap-2",children:[(0,d.jsx)(q.A,{className:"h-4 w-4 text-green-600"}),(0,d.jsx)("span",{className:"text-sm",children:aj})]}),as&&(0,d.jsx)("div",{className:"absolute top-4 right-4 z-50 bg-destructive text-destructive-foreground px-4 py-2 rounded-md shadow-lg",children:as}),(0,d.jsx)("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:s?(0,d.jsx)("div",{className:"flex-1 flex flex-col justify-end sm:justify-center p-6 sm:-mt-20",children:(0,d.jsxs)("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-auto space-y-6 pb-safe",children:[(0,d.jsxs)("div",{className:"text-center space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo_icon.svg",alt:"Dexto",className:"h-12 w-auto"}),(0,d.jsx)("h2",{className:"text-2xl font-bold font-mono tracking-tight bg-gradient-to-r from-primary to-primary/70 bg-clip-text",children:D||"Welcome to Dexto"})]}),(0,d.jsx)("p",{className:"text-base text-muted-foreground max-w-xl mx-auto leading-relaxed",children:"Your AI assistant with powerful tools. Ask anything or connect new capabilities."})]}),(0,d.jsx)("div",{className:"flex flex-wrap justify-center gap-2 max-w-full sm:max-w-[var(--thread-max-width)] mx-auto",children:bp.map((a,b)=>{let c=(0,d.jsx)("button",{onClick:a.action,className:"group px-3 py-2 text-left rounded-full bg-primary/5 hover:bg-primary/10 transition-all duration-200 hover:shadow-sm hover:scale-105",children:(0,d.jsx)("span",{className:"font-medium text-sm text-primary group-hover:text-primary/80 transition-colors",children:a.description})},b);return a.tooltip?(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:c}),(0,d.jsx)(w,{children:a.tooltip})]},b):c})}),(0,d.jsx)("div",{className:"max-w-full sm:max-w-[var(--thread-max-width)] mx-auto",children:(0,d.jsx)(bn,{onSend:bd,isSending:an,variant:"welcome"})}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground space-y-1 text-center",children:(0,d.jsxs)("p",{children:["\uD83D\uDCA1 Try",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘K"})," for new chat,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘J"})," for tools,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘L"})," for playground,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:c?"⌘⌫":"Ctrl+⌫"})," to delete session,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘/"})," for shortcuts"]})})]})}):(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden min-w-0",children:(0,d.jsx)("div",{ref:aT,className:"h-full overflow-y-auto overflow-x-hidden overscroll-contain relative min-w-0",children:(0,d.jsxs)("div",{className:"min-h-full grid grid-cols-1 grid-rows-[1fr_auto] min-w-0",children:[(0,d.jsx)("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-0 sm:mx-auto min-w-0",children:(0,d.jsx)(ap,{messages:l,processing:B,activeError:z,onDismissError:A,outerRef:aU,pendingApproval:aA,onApprovalApprove:aC?.onApprove,onApprovalDeny:aC?.onDeny})}),(0,d.jsxs)("div",{className:"sticky bottom-0 z-10 px-0 sm:px-4 pt-2 pb-2 bg-background relative",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 0.5rem)",marginBottom:"calc(env(safe-area-inset-bottom, 0px) * -1)"},children:[a1&&(0,d.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 -top-3 z-20 pointer-events-none",children:(0,d.jsxs)("button",{onClick:()=>{a2(!1),a9("smooth")},className:"pointer-events-auto px-3 py-1.5 rounded-full shadow-sm bg-background/95 border border-border/60 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{children:"Scroll to bottom"}),(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"})]})}),(0,d.jsx)("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-0 sm:mx-auto pointer-events-auto",children:(0,d.jsx)(bn,{onSend:bd,isSending:an,variant:"chat"})})]})]})})})}),(0,d.jsx)("div",{className:(0,j.cn)("hidden md:block shrink-0 transition-all duration-300 ease-in-out border-l border-border/50 bg-card/50 backdrop-blur-sm",M?"w-80":"w-0 overflow-hidden"),children:M&&(0,d.jsx)(bN,{isOpen:M,onClose:()=>N(!1),onOpenConnectModal:()=>H(!0),onOpenConnectWithPrefill:a=>{a6(a),H(!0)},onServerConnected:a=>{a4(a=>a+1),ak(`Added ${a}`),setTimeout(()=>ak(null),4e3)},variant:"inline",refreshTrigger:a3})}),(0,d.jsx)("div",{className:"md:hidden",children:(0,d.jsx)(bN,{isOpen:M,onClose:()=>N(!1),onOpenConnectModal:()=>H(!0),onOpenConnectWithPrefill:a=>{a6(a),H(!0)},onServerConnected:a=>{a4(a=>a+1),ak(`Added ${a}`),setTimeout(()=>ak(null),4e3)},variant:"overlay",refreshTrigger:a3})})]}),(0,d.jsx)(cL,{isOpen:Z,onClose:()=>$(!1),variant:"overlay"}),(0,d.jsx)(bo.A,{isOpen:G,onClose:()=>{H(!1),a8(!1),a6(null)},onServerConnected:async()=>{if(a5?.registryEntryId)try{await br.setInstalled(a5.registryEntryId,!0)}catch(a){console.warn("Failed to mark registry entry installed:",a)}a4(a=>a+1);let a=a5?.name||"Server";ak(`Added ${a}`),setTimeout(()=>ak(null),4e3),a5?.onCloseRegistryModal?.(),a8(!1),a6(null)},initialName:a5?.name,initialConfig:a5?.config,lockName:a5?.lockName}),(0,d.jsx)(bC,{isOpen:I,onClose:()=>L(!1),onInstallServer:bg,onOpenConnectModal:()=>H(!0),refreshTrigger:a3,disableClose:a7}),(0,d.jsx)(aN.lG,{open:V,onOpenChange:W,children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-2xl",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsxs)(aN.L3,{className:"flex items-center space-x-2",children:[(0,d.jsx)(cP.A,{className:"h-5 w-5"}),(0,d.jsx)("span",{children:"Export Configuration"})]}),(0,d.jsxs)(aN.rr,{children:["Download your tool configuration for Claude Desktop or other MCP clients",p&&(0,d.jsxs)("span",{className:"block mt-1 text-sm text-muted-foreground",children:["Including session-specific settings for: ",(0,d.jsx)("span",{className:"font-mono",children:p})]})]})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(aQ.J,{htmlFor:"filename",children:"File name"}),(0,d.jsx)(aP.p,{id:"filename",value:ab,onChange:a=>ac(a.target.value),placeholder:"dexto-config",className:"font-mono"})]}),ad&&(0,d.jsxs)(aO.Fc,{variant:"destructive",children:[(0,d.jsx)(m.A,{className:"h-4 w-4"}),(0,d.jsx)(aO.XL,{children:"Export Error"}),(0,d.jsx)(aO.TN,{children:ad})]}),af&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(aQ.J,{children:"Configuration Preview"}),(0,d.jsx)(bh.T,{value:af,readOnly:!0,className:"h-32 font-mono text-xs bg-muted/30"})]})]}),(0,d.jsxs)(aN.Es,{children:[(0,d.jsx)(x.$,{variant:"outline",onClick:bc,className:"flex items-center space-x-2",children:(0,d.jsx)("span",{children:ah?"Copied!":"Copy"})}),(0,d.jsxs)(x.$,{onClick:bb,className:"flex items-center space-x-2",children:[(0,d.jsx)(cP.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{children:"Download"})]})]})]})}),(0,d.jsx)(cX,{isOpen:X,onClose:()=>Y(!1)}),(0,d.jsx)(bU,{isOpen:_,onClose:()=>aa(!1),variant:"modal"}),(0,d.jsx)(aN.lG,{open:au,onOpenChange:aw,children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsxs)(aN.L3,{className:"flex items-center space-x-2",children:[(0,d.jsx)(bj.A,{className:"h-5 w-5 text-destructive"}),(0,d.jsx)("span",{children:"Delete Conversation"})]}),(0,d.jsxs)(aN.rr,{children:["This will permanently delete this conversation and all its messages. This action cannot be undone.",p&&(0,d.jsxs)("span",{className:"block mt-2 font-medium",children:["Session: ",(0,d.jsx)("span",{className:"font-mono",children:p})]})]})]}),(0,d.jsxs)(aN.Es,{children:[(0,d.jsx)(x.$,{variant:"outline",onClick:()=>aw(!1),children:"Cancel"}),(0,d.jsxs)(x.$,{variant:"destructive",onClick:bl,disabled:ay,className:"flex items-center space-x-2",children:[(0,d.jsx)(bj.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{children:ay?"Deleting...":"Delete Conversation"})]})]})]})}),(0,d.jsx)(aN.lG,{open:aq,onOpenChange:ar,children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-md",children:[(0,d.jsx)(aN.c7,{children:(0,d.jsxs)(aN.L3,{className:"flex items-center space-x-2",children:[(0,d.jsx)(cQ.A,{className:"h-5 w-5"}),(0,d.jsx)("span",{children:"Keyboard Shortcuts"})]})}),(0,d.jsx)("div",{className:"space-y-3",children:[{key:"⌘H",desc:"Toggle chat history panel"},{key:"⌘K",desc:"Create new chat"},{key:"⌘J",desc:"Toggle tools panel"},{key:"⌘M",desc:"Toggle memories panel"},{key:"⌘E",desc:"Customize agent"},{key:"⌘⇧S",desc:"Search conversations"},{key:"⌘L",desc:"Open MCP playground"},{key:"⌘⇧E",desc:"Export config"},{key:"⌘/",desc:"Show shortcuts"},{key:c?"⌘⌫":"Ctrl+⌫",desc:"Delete current session"},{key:"Esc",desc:"Close panels"}].map((a,b)=>(0,d.jsxs)("div",{className:"flex justify-between items-center py-1",children:[(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:a.desc}),(0,d.jsx)(aX.E,{variant:"outline",className:"font-mono text-xs",children:a.key})]},b))}),(0,d.jsx)(aN.Es,{children:(0,d.jsx)(aN.HM,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"outline",children:"Close"})})})]})})]}),(0,d.jsx)(bY,{isOpen:T,onClose:()=>U(!1),onNavigateToSession:(a,c)=>{b.push(`/chat/${a}`),U(!1)}}),(0,d.jsx)(bV,{websocket:y,onApprovalRequest:aB,onHandlersReady:aI})]})}},62973:(a,b,c)=>{Promise.resolve().then(c.bind(c,49977))},70253:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(95364).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/dexto/dexto/packages/webui/components/ChatApp.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/dexto/dexto/packages/webui/components/ChatApp.tsx","default")},76477:(a,b,c)=>{Promise.resolve().then(c.bind(c,70253))}};
|
|
12
|
+
`,children:g?(0,d.jsx)(cS.A,{className:"w-3.5 h-3.5 text-gray-700"}):(0,d.jsx)(cT.A,{className:"w-3.5 h-3.5 text-yellow-500"})})})}),(0,d.jsx)(w,{children:g?"Switch to light mode":"Switch to dark mode"})]})}):(0,d.jsx)("div",{className:"w-12 h-6 bg-gray-300 dark:bg-gray-700 rounded-full"})}var cV=c(74985);function cW({active:a=!1}){let{voices:b,selected:c,setSelected:f}=function(){let[a,b]=(0,e.useState)(E.getVoices()),[c,d]=(0,e.useState)(E.getPreferredVoiceName());return{voices:a,selected:c,setSelected:a=>{E.setPreferredVoice(a),d(E.getPreferredVoiceName())}}}(),[g,h]=(0,e.useState)(!1);return a?(0,d.jsxs)(cV.l6,{value:c??"auto",onValueChange:a=>{f("auto"===a?null:a)},children:[(0,d.jsx)(cV.bq,{className:"h-8 w-[12rem] text-xs",children:(0,d.jsx)(cV.yv,{placeholder:"Voice"})}),(0,d.jsxs)(cV.gC,{children:[(0,d.jsx)(cV.eb,{value:"auto",children:"Auto (best available)"}),g&&b.map(a=>(0,d.jsxs)(cV.eb,{value:a.name,children:[a.name," (",a.lang,")"]},`${a.name}-${a.lang}`))]})]}):null}function cX({isOpen:a,onClose:b}){return(0,d.jsx)(aN.lG,{open:a,onOpenChange:a=>!a&&b(),children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-lg",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsx)(aN.L3,{children:"Settings"}),(0,d.jsx)(aN.rr,{children:"Configure preferences for speech and more."})]}),(0,d.jsx)("div",{className:"space-y-6 py-2",children:(0,d.jsxs)("section",{className:"space-y-2",children:[(0,d.jsx)(aQ.J,{className:"text-xs uppercase text-muted-foreground",children:"Voice"}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Choose a preferred text-to-speech voice. “Auto” selects the best available voice on your device."}),(0,d.jsx)(cW,{active:a})]})})]})})}var cY=c(26960),cZ=c(71436);let c$={id:"",name:"",description:"",author:"",tags:""},c_={llm:{provider:"openai",model:"gpt-5",apiKey:""},systemPrompt:{contributors:[{id:"primary",type:"static",priority:0,enabled:!0,content:""}]}};function c0({open:a,onOpenChange:b,onAgentCreated:c}){let[f,h]=(0,e.useState)(c$),[i,j]=(0,e.useState)(c_),[k,l]=(0,e.useState)({}),[m,n]=(0,e.useState)(!1),[o,p]=(0,e.useState)(null),[q,r]=(0,e.useState)({basic:!0,llm:!0,systemPrompt:!0}),s=a=>{r(b=>({...b,[a]:!b[a]}))},t=(a,b)=>{h(c=>({...c,[a]:b})),k[a]&&l(b=>{let c={...b};return delete c[a],c})},u=async()=>{if((()=>{let a={};f.id.trim()?/^[a-z0-9-]+$/.test(f.id)||(a.id="Agent ID must contain only lowercase letters, numbers, and hyphens"):a.id="Agent ID is required",f.name.trim()||(a.name="Agent name is required"),f.description.trim()||(a.description="Description is required"),i.llm?.provider||(a["llm.provider"]="Provider is required"),i.llm?.model?.trim()||(a["llm.model"]="Model is required");let b=i.systemPrompt;if(b&&"object"==typeof b&&"contributors"in b){let c=b.contributors;Array.isArray(c)&&(c.some(a=>!!("static"===a.type&&"string"==typeof a.content&&a.content.trim()))||(a.systemPrompt="At least one static contributor with content is required"))}else"string"!=typeof b||b.trim()||(a.systemPrompt="System prompt is required");return l(a),0===Object.keys(a).length})()){n(!0),p(null);try{let a="";if(i.systemPrompt&&"object"==typeof i.systemPrompt&&"contributors"in i.systemPrompt){let b=i.systemPrompt.contributors;if(Array.isArray(b)){let c=b.find(a=>"static"===a.type&&a.content);c&&"content"in c&&"string"==typeof c.content&&(a=c.content.trim())}}else"string"==typeof i.systemPrompt&&(a=i.systemPrompt.trim());a||(a="You are a helpful AI assistant.");let d=await fetch(`${(0,g.e)()}/api/agents/custom/create`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:f.id.trim(),name:f.name.trim(),description:f.description.trim(),author:f.author.trim()||void 0,tags:f.tags.split(",").map(a=>a.trim()).filter(Boolean),llm:{provider:i.llm?.provider,model:i.llm?.model?.trim(),...i.llm?.apiKey?.trim()&&{apiKey:i.llm.apiKey.trim()}},systemPrompt:a})});if(!d.ok){let a=await d.json().catch(()=>({error:"Failed to create agent"}));throw Error(a.message||a.error||`Creation failed: ${d.statusText}`)}let e=await d.json();h(c$),j(c_),l({}),b(!1),c&&e.id&&c(e.id)}catch(a){p(a instanceof Error?a.message:"An unexpected error occurred")}finally{n(!1)}}};return(0,d.jsx)(aN.lG,{open:a,onOpenChange:b,children:(0,d.jsxs)(aN.Cf,{className:"max-w-2xl max-h-[90vh] flex flex-col",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsx)(aN.L3,{children:"Create New Agent"}),(0,d.jsxs)(aN.rr,{children:["Create a custom agent with your own configuration.",(0,d.jsx)("br",{}),(0,d.jsx)("br",{}),"You can add more advanced configuration after creating the agent using the Edit Agent button."]})]}),o&&(0,d.jsxs)("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-3 flex items-start gap-2",children:[(0,d.jsx)(bc.A,{className:"h-4 w-4 text-destructive mt-0.5 flex-shrink-0"}),(0,d.jsx)("div",{className:"text-sm text-destructive",children:o})]}),(0,d.jsxs)("div",{className:"flex-1 overflow-y-auto space-y-4 pr-2",children:[(0,d.jsx)(b2,{title:"Basic Information",open:q.basic,onOpenChange:()=>s("basic"),children:(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-id",tooltip:"Unique identifier for this agent (lowercase, no spaces, hyphens only)",children:"Agent ID *"}),(0,d.jsx)(aP.p,{id:"agent-id",value:f.id,onChange:a=>t("id",a.target.value),placeholder:"my-custom-agent","aria-invalid":!!k.id}),k.id&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:k.id})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-name",tooltip:"Display name for this agent (shown in UI)",children:"Agent Name *"}),(0,d.jsx)(aP.p,{id:"agent-name",value:f.name,onChange:a=>t("name",a.target.value),placeholder:"My Custom Agent","aria-invalid":!!k.name}),k.name&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:k.name})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-description",tooltip:"Brief description of what this agent does",children:"Description *"}),(0,d.jsx)(aP.p,{id:"agent-description",value:f.description,onChange:a=>t("description",a.target.value),placeholder:"A custom agent for specific tasks","aria-invalid":!!k.description}),k.description&&(0,d.jsx)("p",{className:"text-xs text-destructive mt-1",children:k.description})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-author",tooltip:"Your name or organization",children:"Author"}),(0,d.jsx)(aP.p,{id:"agent-author",value:f.author,onChange:a=>t("author",a.target.value),placeholder:"Your Name"})]}),(0,d.jsxs)("div",{children:[(0,d.jsx)(a9,{htmlFor:"agent-tags",tooltip:"Comma-separated tags for categorization",children:"Tags"}),(0,d.jsx)(aP.p,{id:"agent-tags",value:f.tags,onChange:a=>t("tags",a.target.value),placeholder:"coding, custom, specialized"})]})]})}),(0,d.jsx)(b7,{value:i.llm||{provider:"openai",model:"gpt-5",apiKey:""},onChange:a=>j(b=>({...b,llm:a})),errors:k,open:q.llm,onOpenChange:()=>s("llm"),errorCount:0,sectionErrors:[]}),(0,d.jsx)(b9,{value:"object"==typeof i.systemPrompt&&"contributors"in i.systemPrompt?{contributors:i.systemPrompt.contributors||[]}:{contributors:[]},onChange:a=>j(b=>({...b,systemPrompt:a})),errors:k,open:q.systemPrompt,onOpenChange:()=>s("systemPrompt"),errorCount:0,sectionErrors:[]})]}),(0,d.jsxs)(aN.Es,{children:[(0,d.jsx)(x.$,{variant:"outline",onClick:()=>{h(c$),j(c_),l({}),p(null),b(!1)},disabled:m,children:"Cancel"}),(0,d.jsxs)(x.$,{onClick:u,disabled:m,children:[m&&(0,d.jsx)(N.A,{className:"mr-2 h-4 w-4 animate-spin"}),"Create Agent"]})]})]})})}let c1="dexto:recentAgents";function c2({mode:a="default"}){let b=(0,h.useRouter)(),{returnToWelcome:c}=(0,i.v)(),[f,j]=(0,e.useState)([]),[k,l]=(0,e.useState)([]),[m,n]=(0,e.useState)(null),[p,r]=(0,e.useState)(null),[s,t]=(0,e.useState)([]),[u,v]=(0,e.useState)(!1),[w,y]=(0,e.useState)(!1),[z,A]=(0,e.useState)(!1),[B,C]=(0,e.useState)(!1),D=(0,e.useCallback)(()=>{try{let a=localStorage.getItem(c1);if(!a)return[];return JSON.parse(a).sort((a,b)=>b.lastUsed-a.lastUsed).slice(0,5)}catch(a){return console.error("Failed to load recent agents:",a),localStorage.removeItem(c1),[]}},[]),E=(0,e.useCallback)(a=>{try{let b=D().filter(b=>b.path!==a.path),c=[{...a,lastUsed:Date.now()},...b].slice(0,5);localStorage.setItem(c1,JSON.stringify(c)),t(c)}catch(a){console.error("Failed to save recent agent:",a)}},[D]),F=(0,e.useCallback)(async()=>{try{let a=await fetch(`${(0,g.e)()}/api/agents`);if(!a.ok)throw Error("Failed to fetch agents");let b=await a.json();j(b.installed||[]),l(b.available||[]),n(b.current.id);try{let a=await fetch(`${(0,g.e)()}/api/agent/path`);if(a.ok){let b=await a.json();r(b),b.path&&b.name&&E({id:b.name,name:b.name,path:b.path})}}catch(a){console.error("Failed to fetch agent path:",a)}return b}catch(a){return console.error(`AgentSelector load error: ${a}`),null}},[E]),G=(0,e.useCallback)(async a=>{try{y(!0);let d=f.find(b=>b.id===a);if(!d)throw console.error(`Agent not found in installed list: ${a}`),Error(`Agent '${a}' not found. Please refresh the agents list.`);let e=await fetch(`${(0,g.e)()}/api/agents/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!e.ok){let a=await e.json().catch(()=>({}));throw console.error(`Agent switch failed: ${JSON.stringify(a)}`),Error(a.error||a.message||`Switch failed: ${e.status} ${e.statusText}`)}n(a),A(!1),await F();try{window.dispatchEvent(new CustomEvent("dexto:agentSwitched",{detail:{id:a,name:d.name}}))}catch{}c(),b.push("/")}catch(b){console.error(`Switch agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to switch agent";alert(`Failed to switch agent: ${a}`)}finally{y(!1)}},[c,f,F,b]),H=(0,e.useCallback)(async a=>{try{y(!0);let d=await fetch(`${(0,g.e)()}/api/agents/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id,path:a.path})});if(!d.ok){let a=await d.json().catch(()=>({}));throw console.error(`Agent switch failed: ${JSON.stringify(a)}`),Error(a.error||a.message||`Switch failed: ${d.status} ${d.statusText}`)}n(a.id),A(!1),await F(),E(a);try{window.dispatchEvent(new CustomEvent("dexto:agentSwitched",{detail:{id:a.id,name:a.name}}))}catch{}c(),b.push("/")}catch(b){console.error(`Switch agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to switch agent";alert(`Failed to switch agent: ${a}`)}finally{y(!1)}},[c,E,F,b]),I=(0,e.useCallback)(async a=>{try{y(!0);let b=await fetch(`${(0,g.e)()}/api/agents/install`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!b.ok){let a=await b.json().catch(()=>({}));throw Error(a.error||`Install failed: ${b.status}`)}let d=await F();if(!d)throw Error("Failed to reload agents list after installation");let e=d.installed.find(b=>b.id===a);if(!e)throw console.error(`Agent not found in fresh installed list: ${a}`),Error(`Agent '${a}' not found after installation. Please refresh.`);let f=await fetch(`${(0,g.e)()}/api/agents/switch`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a})});if(!f.ok){let a=await f.json().catch(()=>({}));throw console.error(`Agent switch failed: ${JSON.stringify(a)}`),Error(a.error||a.message||`Switch failed: ${f.status} ${f.statusText}`)}n(a),A(!1);try{window.dispatchEvent(new CustomEvent("dexto:agentSwitched",{detail:{id:a,name:e.name}}))}catch{}c()}catch(b){console.error(`Install agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to install agent";alert(`Failed to install agent: ${a}`)}finally{y(!1)}},[F,c]),J=(0,e.useCallback)(async(a,b)=>{if(b.stopPropagation(),confirm(`Are you sure you want to delete the custom agent "${a.name}"?`))try{y(!0);let b=await fetch(`${(0,g.e)()}/api/agents/uninstall`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:a.id})});if(!b.ok){let a=await b.json().catch(()=>({}));throw Error(a.error||`Delete failed: ${b.status}`)}let c=await F();c?.current.id===a.id&&n(null)}catch(b){console.error(`Delete agent failed: ${b instanceof Error?b.message:String(b)}`);let a=b instanceof Error?b.message:"Failed to delete agent";alert(`Failed to delete agent: ${a}`)}finally{y(!1)}},[m,F]),K=(0,e.useCallback)(async a=>{await new Promise(a=>setTimeout(a,1e3)),await F()},[F]),L=(0,e.useMemo)(()=>{if(!m)return"Choose Agent";let a=f.find(a=>a.id===m)||k.find(a=>a.id===m);return a?.name??m},[k,m,f]);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(aD,{open:z,onOpenChange:A,children:[(0,d.jsx)(aE,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"badge"===a?"outline":"default",size:"sm",className:(a=>{let b="transition-all duration-200 shadow-lg hover:shadow-xl font-semibold rounded-full";switch(a){case"badge":return`h-9 px-4 text-xs border border-teal-500 bg-teal-500/20 text-teal-600 hover:bg-teal-500/40 hover:border-teal-500 hover:text-teal-700 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 dark:hover:border-teal-300 min-w-[100px] max-w-[140px] md:min-w-[140px] md:max-w-[240px] lg:max-w-[400px] xl:max-w-[500px] ${b}`;case"title":return`h-11 px-4 text-lg font-bold bg-gradient-to-r from-teal-500/30 to-teal-500/40 text-teal-600 hover:from-teal-500/50 hover:to-teal-500/60 hover:text-teal-700 focus-visible:ring-2 focus-visible:ring-teal-500/50 focus-visible:ring-offset-2 border border-teal-500/40 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 ${b}`;default:return`h-10 px-3 text-sm bg-teal-500/40 text-teal-600 hover:bg-teal-500/50 hover:text-teal-700 focus-visible:ring-2 focus-visible:ring-teal-500/50 focus-visible:ring-offset-2 border border-teal-500/50 dark:text-teal-400 dark:hover:text-teal-300 dark:border-teal-400 ${b}`}})(a),disabled:w,children:(0,d.jsxs)("div",{className:"flex items-center justify-between w-full min-w-0",children:[(0,d.jsx)(aZ.A,{className:"w-4 h-4 mr-2 flex-shrink-0"}),(0,d.jsx)("span",{className:"flex-1 text-center truncate min-w-0 px-1",children:w?"Switching...":"title"===a?`Agent: ${L}`:L}),(0,d.jsx)(o.A,{className:"w-4 h-4 ml-2 flex-shrink-0"})]})})}),(0,d.jsxs)(aF,{align:"start",className:"w-80 max-h-96 overflow-y-auto",children:[u&&(0,d.jsx)(aG,{disabled:!0,className:"text-center text-muted-foreground",children:"Loading agents..."}),!u&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aG,{onClick:()=>{C(!0),A(!1)},disabled:w,className:"cursor-pointer py-3 bg-gradient-to-r from-purple-500/10 to-purple-500/5 hover:from-purple-500/20 hover:to-purple-500/10 border-b border-purple-500/20",children:(0,d.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,d.jsx)(aU.A,{className:"w-4 h-4 text-purple-600 dark:text-purple-400"}),(0,d.jsx)("span",{className:"font-semibold text-purple-600 dark:text-purple-400",children:"New Agent"})]})}),p&&!f.some(a=>a.id===p.name)&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-teal-600 dark:text-teal-400 uppercase tracking-wider",children:"Currently Active"}),(0,d.jsx)(aG,{onClick:()=>H({id:p.name,name:p.name,path:p.path}),disabled:w||m===p.name,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:p.name}),m===p.name&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:"Loaded from file"})]})})}),(0,d.jsx)(aH,{})]}),s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Recent"}),s.filter(a=>!f.some(b=>b.id===a.id)&&a.id!==p?.name&&!a.path.includes("/.dexto/")).slice(0,3).map(a=>(0,d.jsx)(aG,{onClick:()=>H(a),disabled:w||a.id===m,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),a.id===m&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",title:a.path,children:a.path})]})})},a.path)),(0,d.jsx)(aH,{})]}),f.filter(a=>"custom"===a.type).length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"px-2 py-1.5 text-xs font-semibold text-purple-600 dark:text-purple-400 uppercase tracking-wider flex items-center gap-1",children:[(0,d.jsx)(cY.A,{className:"w-3 h-3"}),"Custom Agents"]}),f.filter(a=>"custom"===a.type).map(a=>(0,d.jsx)(aG,{onClick:()=>G(a.id),disabled:w||a.id===m,className:"cursor-pointer py-3",children:(0,d.jsxs)("div",{className:"flex items-center justify-between w-full gap-2",children:[(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),a.id===m&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description}),a.author&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",a.author]})]}),(0,d.jsx)("button",{onClick:b=>J(a,b),disabled:w,className:"p-1 hover:bg-red-100 dark:hover:bg-red-900/30 rounded transition-colors",title:"Delete custom agent",children:(0,d.jsx)(bj.A,{className:"w-4 h-4 text-red-600 dark:text-red-400"})})]})},a.id))]}),f.filter(a=>"builtin"===a.type).length>0&&(0,d.jsxs)(d.Fragment,{children:[f.filter(a=>"custom"===a.type).length>0&&(0,d.jsx)(aH,{}),(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Installed"}),f.filter(a=>"builtin"===a.type).map(a=>(0,d.jsx)(aG,{onClick:()=>G(a.id),disabled:w||a.id===m,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),a.id===m&&(0,d.jsx)(q.A,{className:"w-4 h-4 text-green-600 flex-shrink-0 animate-in fade-in duration-200"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description}),a.author&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",a.author]})]})})},a.id))]}),k.filter(a=>"builtin"===a.type).length>0&&(0,d.jsxs)(d.Fragment,{children:[f.length>0&&(0,d.jsx)(aH,{}),(0,d.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Available"}),k.filter(a=>"builtin"===a.type).map(a=>(0,d.jsx)(aG,{onClick:()=>I(a.id),disabled:w,className:"cursor-pointer py-3",children:(0,d.jsx)("div",{className:"flex items-center justify-between w-full",children:(0,d.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2",children:[(0,d.jsx)("span",{className:"font-medium text-sm truncate",children:a.name}),(0,d.jsx)(cZ.A,{className:"w-4 h-4 text-blue-600 flex-shrink-0"})]}),(0,d.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:a.description}),a.author&&(0,d.jsxs)("p",{className:"text-xs text-muted-foreground/80 mt-0.5",children:["by ",a.author]})]})})},a.id))]}),!u&&0===f.length&&0===k.length&&(0,d.jsx)(aG,{disabled:!0,className:"text-center text-muted-foreground",children:"No agents found"})]})]})]}),(0,d.jsx)(c0,{open:B,onOpenChange:C,onAgentCreated:K})]})}function c3({sessionId:a}={}){let b=(0,h.useRouter)(),[c,k]=(0,e.useState)(!1),{messages:l,sendMessage:n,currentSessionId:p,switchSession:r,isWelcomeState:s,returnToWelcome:t,websocket:y,activeError:z,clearError:A,processing:B,cancel:C,greeting:D,isStreaming:E,setStreaming:F}=(0,i.v)(),[G,H]=(0,e.useState)(!1),[I,L]=(0,e.useState)(!1),[M,N]=(0,e.useState)(!1),[O,P]=(0,e.useState)(!1),[Q,R]=(0,e.useState)(!1),S=f().useRef(!0),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)(!1),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(!1),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)("dexto-config"),[ad,ae]=(0,e.useState)(null),[af,ag]=(0,e.useState)(""),[ah,ai]=(0,e.useState)(!1),[aj,ak]=(0,e.useState)(null),[al,am]=(0,e.useState)(!1),[an,ao]=(0,e.useState)(!1),[aq,ar]=(0,e.useState)(!1),[as,at]=(0,e.useState)(null),[au,aw]=(0,e.useState)(!1),[ay,az]=(0,e.useState)(!1),[aA,aB]=(0,e.useState)(null),[aC,aI]=(0,e.useState)(null),[aJ,aK]=(0,e.useState)([]),[aL,aM]=(0,e.useState)(!1),[aR,aS]=(0,e.useState)(0),aT=f().useRef(null),aU=f().useRef(null),[aV,aW]=(0,e.useState)(!0),[aZ,a$]=(0,e.useState)(!1),[a_,a0]=(0,e.useState)(!1);f().useRef(0);let[a1,a2]=(0,e.useState)(!1);f().useRef(null);let[a3,a4]=(0,e.useState)(0),[a5,a6]=(0,e.useState)(null),[a7,a8]=(0,e.useState)(!1);(0,e.useCallback)(()=>{let a=aT.current;a&&aW(a.scrollHeight-a.scrollTop<=a.clientHeight+1)},[]);let a9=(0,e.useCallback)((a="auto")=>{let b=aT.current;b&&(a$(!0),b.scrollTo({top:b.scrollHeight,behavior:a}),requestAnimationFrame(()=>a$(!1)))},[]),ba=(0,e.useCallback)(()=>{let a=aT.current;if(!a)return;let b=a.querySelectorAll('[data-role="user"]'),c=b[b.length-1];if(!c)return void a9("auto");let d=a.getBoundingClientRect(),e=Math.max(c.getBoundingClientRect().top-d.top+a.scrollTop-16,0);a$(!0),a.scrollTo({top:e,behavior:"auto"}),requestAnimationFrame(()=>a$(!1))},[a9]),bb=(0,e.useCallback)(async()=>{try{let a=p?`${(0,g.e)()}/api/agent/config/export?sessionId=${p}`:`${(0,g.e)()}/api/agent/config/export`,b=await fetch(a);if(!b.ok)throw Error("Failed to fetch configuration");let c=await b.text(),d=new Blob([c],{type:"application/x-yaml"}),e=URL.createObjectURL(d),f=document.createElement("a");f.href=e,f.download=p?`${ab}-${p}.yml`:`${ab}.yml`,document.body.appendChild(f),f.click(),document.body.removeChild(f),URL.revokeObjectURL(e)}catch(a){console.error("Download failed:",a),ae(a instanceof Error?a.message:"Download failed")}},[ab,p]),bc=(0,e.useCallback)(async()=>{try{await navigator.clipboard.writeText(af),ai(!0),setTimeout(()=>ai(!1),2e3)}catch(a){console.error("Copy failed:",a),ae("Failed to copy to clipboard")}},[af]),bd=(0,e.useCallback)(async(a,b,c)=>{ao(!0),at(null);try{await n(a,b,c),setTimeout(()=>{ba(),a0(!0)},0)}catch(a){console.error("Failed to send message:",a),at(a instanceof Error?a.message:"Failed to send message"),setTimeout(()=>at(null),5e3)}finally{ao(!1)}},[n,ba]),be=(0,e.useCallback)(a=>{a0(!1),a2(!1),b.push(`/chat/${a}`)},[b]),bf=(0,e.useCallback)(()=>{a0(!1),a2(!1),t(),b.push("/")},[b,t]),bg=(0,e.useCallback)(async a=>{let b=bL(a),c="stdio"===b.type&&Object.keys(b.env||{}).length>0&&bK(b.env||{}),d=("sse"===b.type||"http"===b.type)&&"headers"in b&&Object.keys(b.headers||{}).length>0&&bK(b.headers||{});if(c||d)return a6({name:a.name,config:b,lockName:!0,registryEntryId:a.id,onCloseRegistryModal:a.onCloseRegistryModal??(()=>L(!1))}),H(!0),"requires-input";try{a8(!0);let c=await fetch(`${(0,g.e)()}/api/mcp/servers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:a.name,config:b,persistToAgent:!1})}),d=await c.json();if(!c.ok)throw Error(d.error||`Server returned status ${c.status}`);if(a.id)try{await br.setInstalled(a.id,!0)}catch(a){console.warn("Failed to mark registry entry installed:",a)}return a4(a=>a+1),ak(`Added ${a.name}`),setTimeout(()=>ak(null),4e3),L(!1),"connected"}catch(a){throw Error(a instanceof Error?a.message:"Failed to install server")}finally{a8(!1)}},[L,H,a6,a4,ak,a8]),bi=(0,e.useCallback)(()=>{P(!O)},[O,M]),bk=(0,e.useCallback)(()=>{N(!M)},[M,O]),bl=(0,e.useCallback)(async()=>{if(p){az(!0);try{if(!(await fetch(`${(0,g.e)()}/api/sessions/${p}`,{method:"DELETE"})).ok)throw Error("Failed to delete conversation");aw(!1),bf()}catch(a){console.error("Failed to delete conversation:",a),at(a instanceof Error?a.message:"Failed to delete conversation"),setTimeout(()=>at(null),5e3)}finally{az(!1)}}},[p,bf]),bm=f().useMemo(()=>[{title:"Help me get started",description:"Show me what you can do",action:()=>bd("I'm new to Dexto. Can you show me your capabilities and help me understand how to work with you effectively?"),icon:"\uD83D\uDE80"},{title:"Create Snake Game",description:"Build a game and open it",action:()=>bd("Create a snake game in a new directory with HTML, CSS, and JavaScript, then open it in the browser for me to play."),icon:"\uD83D\uDC0D"},{title:"Connect new tools",description:"Browse and add MCP servers",action:()=>N(!0),icon:"\uD83D\uDD27"},{title:"Demonstrate tools",description:"Show me your capabilities",action:()=>bd("Pick one of your most interesting tools and demonstrate it with a practical example. Show me what it can do."),icon:"⚡"}],[bd,N]),bp=f().useMemo(()=>{if(!aL)return bm.map(a=>({description:`${a.icon} ${a.title}`,tooltip:a.description,action:a.action}));let a=aJ.length>0?[]:bm.map(a=>({description:`${a.icon} ${a.title}`,tooltip:a.description,action:a.action}));return aJ.forEach(b=>{let c=b.title||b.description||"Starter prompt",d=b.description;b?.name==="starter:connect-tools"?a.push({description:c,tooltip:d,action:()=>N(!0)}):a.push({description:c,tooltip:d,action:async()=>{try{let a=new URL(`${(0,g.e)()}/api/prompts/${encodeURIComponent(b.name)}/resolve`),c=await fetch(a.toString());if(c.ok){let a=await c.json(),d="string"==typeof a?.text?a.text:"";d.trim()?bd(d.trim()):bd(`/${b.name}`)}else bd(`/${b.name}`)}catch(a){console.error(`Failed to resolve starter prompt ${b.name}:`,a),bd(`/${b.name}`)}}})}),a},[aJ,aL,bm,bd,N]);return(0,d.jsxs)("div",{className:"flex w-full bg-background",style:{height:"var(--app-viewport-height, 100vh)",minHeight:"var(--app-viewport-height, 100vh)"},children:[(0,d.jsx)("div",{className:(0,j.cn)("hidden md:block shrink-0 border-r border-border/50 bg-card/50 backdrop-blur-sm",!S.current&&"transition-all duration-300 ease-in-out",O?"w-80":"w-0 overflow-hidden"),suppressHydrationWarning:!0,children:O&&(0,d.jsx)(bR,{isOpen:O,onClose:()=>P(!1),currentSessionId:p,onSessionChange:be,returnToWelcome:bf,variant:"inline",onSearchOpen:()=>U(!0),onNewChat:bf})}),(0,d.jsx)("div",{className:"md:hidden",children:(0,d.jsx)(bR,{isOpen:O,onClose:()=>P(!1),currentSessionId:p,onSessionChange:be,returnToWelcome:bf,variant:"overlay",onSearchOpen:()=>U(!0),onNewChat:bf})}),(0,d.jsxs)("main",{className:"flex-1 flex flex-col relative min-w-0",style:{"--thread-max-width":"54rem"},children:[null,(0,d.jsxs)("header",{className:"shrink-0 border-b border-border/50 bg-background/95 backdrop-blur-xl shadow-sm relative",children:[(0,d.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 gap-3",children:[(0,d.jsxs)("div",{className:"flex items-center gap-2.5 shrink-0",children:[(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:bi,className:(0,j.cn)("h-8 w-8 p-0 transition-colors",O&&"bg-muted"),children:(0,d.jsx)(cM.A,{className:"h-4 w-4"})})}),(0,d.jsx)(w,{children:"Chat History (⌘H)"})]}),!O&&(0,d.jsx)("div",{className:"hidden md:block",children:(0,d.jsx)(bQ,{onClick:bf})}),(0,d.jsxs)("a",{href:"https://dexto.ai",target:"_blank",rel:"noopener noreferrer",className:"flex items-center hover:opacity-80 transition-opacity shrink-0",children:[(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo_icon.svg",alt:"Dexto",className:"h-9 w-9 md:hidden"}),(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo_light.svg",alt:"Dexto",className:"h-11 w-auto hidden md:block dark:md:hidden"}),(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo.svg",alt:"Dexto",className:"h-11 w-auto hidden dark:md:block"}),(0,d.jsx)("span",{className:"sr-only",children:"Dexto"})]})]}),(0,d.jsxs)("div",{className:"hidden md:flex items-center gap-2",children:[(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:()=>$(!Z),className:(0,j.cn)("h-8 w-8 p-0",Z&&"bg-muted"),"aria-label":"Customize agent",children:(0,d.jsx)(cN.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Customize Agent (⌘E)"})]}),(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:bk,className:(0,j.cn)("h-8 w-8 p-0 transition-colors",M&&"bg-muted"),"aria-label":"Toggle tools panel",children:(0,d.jsx)(J.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Toggle tools panel (⌘J)"})]}),(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:()=>aa(!_),className:(0,j.cn)("h-8 w-8 p-0 transition-colors",_&&"bg-muted"),"aria-label":"Toggle memories panel",children:(0,d.jsx)(K.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Toggle memories panel (⌘M)"})]}),(0,d.jsx)(cU,{}),(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",onClick:()=>Y(!0),className:"h-8 w-8 p-0","aria-label":"Open settings",children:(0,d.jsx)(bW.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsx)(w,{children:"Settings"})]}),(0,d.jsxs)(aD,{children:[(0,d.jsx)(aE,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:(0,d.jsx)(cO.A,{className:"h-3.5 w-3.5"})})}),(0,d.jsxs)(aF,{align:"end",children:[(0,d.jsxs)(aG,{onClick:()=>L(!0),children:[(0,d.jsx)(bw.A,{className:"h-4 w-4 mr-2"}),"Connect MCPs"]}),(0,d.jsxs)(aG,{onClick:()=>window.open("/playground","_blank"),children:[(0,d.jsx)(aY.A,{className:"h-4 w-4 mr-2"}),"MCP Playground"]}),(0,d.jsxs)(aG,{onClick:()=>W(!0),children:[(0,d.jsx)(cP.A,{className:"h-4 w-4 mr-2"}),"Export Config"]}),(0,d.jsxs)(aG,{onClick:()=>ar(!0),children:[(0,d.jsx)(cQ.A,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),p&&!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aH,{}),(0,d.jsxs)(aG,{onClick:()=>aw(!0),className:"text-destructive focus:text-destructive",children:[(0,d.jsx)(bj.A,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})]}),(0,d.jsx)("div",{className:"flex md:hidden",children:(0,d.jsxs)(aD,{open:al,onOpenChange:am,children:[(0,d.jsx)(aE,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0","aria-label":"Open menu",children:(0,d.jsx)(cR.A,{className:"h-4 w-4"})})}),(0,d.jsxs)(aF,{align:"end",children:[(0,d.jsxs)(aG,{onClick:()=>{$(!Z),am(!1)},children:[(0,d.jsx)(cN.A,{className:"h-4 w-4 mr-2"}),"Customize Agent"]}),(0,d.jsxs)(aG,{onClick:()=>{bk(),am(!1)},children:[(0,d.jsx)(J.A,{className:"h-4 w-4 mr-2"}),"Tools"]}),(0,d.jsxs)(aG,{onClick:()=>{aa(!_),am(!1)},children:[(0,d.jsx)(K.A,{className:"h-4 w-4 mr-2"}),"Memories"]}),(0,d.jsxs)(aG,{onClick:()=>{let a=document.documentElement.classList.contains("dark")?"light":"dark";document.documentElement.classList.toggle("dark","dark"===a),localStorage.setItem("theme",a),document.cookie=`theme=${a}; Path=/; Max-Age=31536000; SameSite=Lax`,am(!1)},children:[(0,d.jsx)("span",{className:"h-4 w-4 mr-2",children:"\uD83C\uDF19"}),"Toggle Theme"]}),(0,d.jsxs)(aG,{onClick:()=>{Y(!0),am(!1)},children:[(0,d.jsx)(bW.A,{className:"h-4 w-4 mr-2"}),"Settings"]}),(0,d.jsxs)(aG,{onClick:a=>{a.preventDefault(),F(!E)},className:"flex items-center justify-between",children:[(0,d.jsxs)("div",{className:"flex items-center",children:[(0,d.jsx)(av.A,{className:"h-4 w-4 mr-2"}),"Streaming"]}),(0,d.jsx)(ax,{checked:E,onCheckedChange:F,onClick:a=>a.stopPropagation()})]}),(0,d.jsx)(aH,{}),(0,d.jsxs)(aG,{onClick:()=>{L(!0),am(!1)},children:[(0,d.jsx)(bw.A,{className:"h-4 w-4 mr-2"}),"Connect MCPs"]}),(0,d.jsxs)(aG,{onClick:()=>{window.open("/playground","_blank"),am(!1)},children:[(0,d.jsx)(aY.A,{className:"h-4 w-4 mr-2"}),"MCP Playground"]}),(0,d.jsxs)(aG,{onClick:()=>{W(!0),am(!1)},children:[(0,d.jsx)(cP.A,{className:"h-4 w-4 mr-2"}),"Export Config"]}),(0,d.jsxs)(aG,{onClick:()=>{ar(!0),am(!1)},children:[(0,d.jsx)(cQ.A,{className:"h-4 w-4 mr-2"}),"Shortcuts"]}),p&&!s&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(aH,{}),(0,d.jsxs)(aG,{onClick:()=>{aw(!0),am(!1)},className:"text-destructive focus:text-destructive",children:[(0,d.jsx)(bj.A,{className:"h-4 w-4 mr-2"}),"Delete Conversation"]})]})]})]})})]}),(0,d.jsx)("div",{className:"absolute left-1/2 top-1/2 transform -translate-x-1/2 -translate-y-1/2",children:(0,d.jsx)("div",{className:"w-full max-w-[180px] md:max-w-[260px]",children:(0,d.jsx)(c2,{mode:"badge"})})})]}),(0,d.jsxs)("div",{className:"flex-1 flex overflow-hidden min-w-0",children:[aj&&(0,d.jsxs)("div",{className:"fixed bottom-4 right-4 z-50 border border-border/60 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-foreground px-3 py-2 rounded-md shadow-md inline-flex items-center gap-2",children:[(0,d.jsx)(q.A,{className:"h-4 w-4 text-green-600"}),(0,d.jsx)("span",{className:"text-sm",children:aj})]}),as&&(0,d.jsx)("div",{className:"absolute top-4 right-4 z-50 bg-destructive text-destructive-foreground px-4 py-2 rounded-md shadow-lg",children:as}),(0,d.jsx)("div",{className:"flex-1 flex flex-col min-h-0 min-w-0",children:s?(0,d.jsx)("div",{className:"flex-1 flex flex-col justify-end sm:justify-center p-6 sm:-mt-20",children:(0,d.jsxs)("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-auto space-y-6 pb-safe",children:[(0,d.jsxs)("div",{className:"text-center space-y-3",children:[(0,d.jsxs)("div",{className:"flex items-center justify-center gap-3",children:[(0,d.jsx)("img",{src:"/logos/dexto/dexto_logo_icon.svg",alt:"Dexto",className:"h-12 w-auto"}),(0,d.jsx)("h2",{className:"text-2xl font-bold font-mono tracking-tight bg-gradient-to-r from-primary to-primary/70 bg-clip-text",children:D||"Welcome to Dexto"})]}),(0,d.jsx)("p",{className:"text-base text-muted-foreground max-w-xl mx-auto leading-relaxed",children:"Your AI assistant with powerful tools. Ask anything or connect new capabilities."})]}),(0,d.jsx)("div",{className:"flex flex-wrap justify-center gap-2 max-w-full sm:max-w-[var(--thread-max-width)] mx-auto",children:bp.map((a,b)=>{let c=(0,d.jsx)("button",{onClick:a.action,className:"group px-3 py-2 text-left rounded-full bg-primary/5 hover:bg-primary/10 transition-all duration-200 hover:shadow-sm hover:scale-105",children:(0,d.jsx)("span",{className:"font-medium text-sm text-primary group-hover:text-primary/80 transition-colors",children:a.description})},b);return a.tooltip?(0,d.jsxs)(u,{children:[(0,d.jsx)(v,{asChild:!0,children:c}),(0,d.jsx)(w,{children:a.tooltip})]},b):c})}),(0,d.jsx)("div",{className:"max-w-full sm:max-w-[var(--thread-max-width)] mx-auto",children:(0,d.jsx)(bn,{onSend:bd,isSending:an,variant:"welcome"})}),(0,d.jsx)("div",{className:"text-xs text-muted-foreground space-y-1 text-center",children:(0,d.jsxs)("p",{children:["\uD83D\uDCA1 Try",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘K"})," for new chat,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘J"})," for tools,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘L"})," for playground,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:c?"⌘⌫":"Ctrl+⌫"})," to delete session,",(0,d.jsx)("kbd",{className:"px-1 py-0.5 bg-muted rounded text-xs ml-1",children:"⌘/"})," for shortcuts"]})})]})}):(0,d.jsx)("div",{className:"flex-1 min-h-0 overflow-hidden min-w-0",children:(0,d.jsx)("div",{ref:aT,className:"h-full overflow-y-auto overflow-x-hidden overscroll-contain relative min-w-0",children:(0,d.jsxs)("div",{className:"min-h-full grid grid-cols-1 grid-rows-[1fr_auto] min-w-0",children:[(0,d.jsx)("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-0 sm:mx-auto min-w-0",children:(0,d.jsx)(ap,{messages:l,processing:B,activeError:z,onDismissError:A,outerRef:aU,pendingApproval:aA,onApprovalApprove:aC?.onApprove,onApprovalDeny:aC?.onDeny})}),(0,d.jsxs)("div",{className:"sticky bottom-0 z-10 px-0 sm:px-4 pt-2 pb-2 bg-background relative",style:{paddingBottom:"calc(env(safe-area-inset-bottom, 0px) + 0.5rem)",marginBottom:"calc(env(safe-area-inset-bottom, 0px) * -1)"},children:[a1&&(0,d.jsx)("div",{className:"absolute left-1/2 -translate-x-1/2 -top-3 z-20 pointer-events-none",children:(0,d.jsxs)("button",{onClick:()=>{a2(!1),a9("smooth")},className:"pointer-events-auto px-3 py-1.5 rounded-full shadow-sm bg-background/95 border border-border/60 backdrop-blur supports-[backdrop-filter]:bg-background/80 text-sm text-muted-foreground hover:text-foreground transition-colors inline-flex items-center gap-1.5",children:[(0,d.jsx)("span",{children:"Scroll to bottom"}),(0,d.jsx)(o.A,{className:"h-3.5 w-3.5"})]})}),(0,d.jsx)("div",{className:"w-full max-w-full sm:max-w-[var(--thread-max-width)] mx-0 sm:mx-auto pointer-events-auto",children:(0,d.jsx)(bn,{onSend:bd,isSending:an,variant:"chat"})})]})]})})})}),(0,d.jsx)("div",{className:(0,j.cn)("hidden md:block shrink-0 transition-all duration-300 ease-in-out border-l border-border/50 bg-card/50 backdrop-blur-sm",M?"w-80":"w-0 overflow-hidden"),children:M&&(0,d.jsx)(bN,{isOpen:M,onClose:()=>N(!1),onOpenConnectModal:()=>H(!0),onOpenConnectWithPrefill:a=>{a6(a),H(!0)},onServerConnected:a=>{a4(a=>a+1),ak(`Added ${a}`),setTimeout(()=>ak(null),4e3)},variant:"inline",refreshTrigger:a3})}),(0,d.jsx)("div",{className:"md:hidden",children:(0,d.jsx)(bN,{isOpen:M,onClose:()=>N(!1),onOpenConnectModal:()=>H(!0),onOpenConnectWithPrefill:a=>{a6(a),H(!0)},onServerConnected:a=>{a4(a=>a+1),ak(`Added ${a}`),setTimeout(()=>ak(null),4e3)},variant:"overlay",refreshTrigger:a3})})]}),(0,d.jsx)(cL,{isOpen:Z,onClose:()=>$(!1),variant:"overlay"}),(0,d.jsx)(bo.A,{isOpen:G,onClose:()=>{H(!1),a8(!1),a6(null)},onServerConnected:async()=>{if(a5?.registryEntryId)try{await br.setInstalled(a5.registryEntryId,!0)}catch(a){console.warn("Failed to mark registry entry installed:",a)}a4(a=>a+1);let a=a5?.name||"Server";ak(`Added ${a}`),setTimeout(()=>ak(null),4e3),a5?.onCloseRegistryModal?.(),a8(!1),a6(null)},initialName:a5?.name,initialConfig:a5?.config,lockName:a5?.lockName}),(0,d.jsx)(bC,{isOpen:I,onClose:()=>L(!1),onInstallServer:bg,onOpenConnectModal:()=>H(!0),refreshTrigger:a3,disableClose:a7}),(0,d.jsx)(aN.lG,{open:V,onOpenChange:W,children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-2xl",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsxs)(aN.L3,{className:"flex items-center space-x-2",children:[(0,d.jsx)(cP.A,{className:"h-5 w-5"}),(0,d.jsx)("span",{children:"Export Configuration"})]}),(0,d.jsxs)(aN.rr,{children:["Download your tool configuration for Claude Desktop or other MCP clients",p&&(0,d.jsxs)("span",{className:"block mt-1 text-sm text-muted-foreground",children:["Including session-specific settings for: ",(0,d.jsx)("span",{className:"font-mono",children:p})]})]})]}),(0,d.jsxs)("div",{className:"space-y-4",children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(aQ.J,{htmlFor:"filename",children:"File name"}),(0,d.jsx)(aP.p,{id:"filename",value:ab,onChange:a=>ac(a.target.value),placeholder:"dexto-config",className:"font-mono"})]}),ad&&(0,d.jsxs)(aO.Fc,{variant:"destructive",children:[(0,d.jsx)(m.A,{className:"h-4 w-4"}),(0,d.jsx)(aO.XL,{children:"Export Error"}),(0,d.jsx)(aO.TN,{children:ad})]}),af&&(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)(aQ.J,{children:"Configuration Preview"}),(0,d.jsx)(bh.T,{value:af,readOnly:!0,className:"h-32 font-mono text-xs bg-muted/30"})]})]}),(0,d.jsxs)(aN.Es,{children:[(0,d.jsx)(x.$,{variant:"outline",onClick:bc,className:"flex items-center space-x-2",children:(0,d.jsx)("span",{children:ah?"Copied!":"Copy"})}),(0,d.jsxs)(x.$,{onClick:bb,className:"flex items-center space-x-2",children:[(0,d.jsx)(cP.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{children:"Download"})]})]})]})}),(0,d.jsx)(cX,{isOpen:X,onClose:()=>Y(!1)}),(0,d.jsx)(bU,{isOpen:_,onClose:()=>aa(!1),variant:"modal"}),(0,d.jsx)(aN.lG,{open:au,onOpenChange:aw,children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-md",children:[(0,d.jsxs)(aN.c7,{children:[(0,d.jsxs)(aN.L3,{className:"flex items-center space-x-2",children:[(0,d.jsx)(bj.A,{className:"h-5 w-5 text-destructive"}),(0,d.jsx)("span",{children:"Delete Conversation"})]}),(0,d.jsxs)(aN.rr,{children:["This will permanently delete this conversation and all its messages. This action cannot be undone.",p&&(0,d.jsxs)("span",{className:"block mt-2 font-medium",children:["Session: ",(0,d.jsx)("span",{className:"font-mono",children:p})]})]})]}),(0,d.jsxs)(aN.Es,{children:[(0,d.jsx)(x.$,{variant:"outline",onClick:()=>aw(!1),children:"Cancel"}),(0,d.jsxs)(x.$,{variant:"destructive",onClick:bl,disabled:ay,className:"flex items-center space-x-2",children:[(0,d.jsx)(bj.A,{className:"h-4 w-4"}),(0,d.jsx)("span",{children:ay?"Deleting...":"Delete Conversation"})]})]})]})}),(0,d.jsx)(aN.lG,{open:aq,onOpenChange:ar,children:(0,d.jsxs)(aN.Cf,{className:"sm:max-w-md",children:[(0,d.jsx)(aN.c7,{children:(0,d.jsxs)(aN.L3,{className:"flex items-center space-x-2",children:[(0,d.jsx)(cQ.A,{className:"h-5 w-5"}),(0,d.jsx)("span",{children:"Keyboard Shortcuts"})]})}),(0,d.jsx)("div",{className:"space-y-3",children:[{key:"⌘H",desc:"Toggle chat history panel"},{key:"⌘K",desc:"Create new chat"},{key:"⌘J",desc:"Toggle tools panel"},{key:"⌘M",desc:"Toggle memories panel"},{key:"⌘E",desc:"Customize agent"},{key:"⌘⇧S",desc:"Search conversations"},{key:"⌘L",desc:"Open MCP playground"},{key:"⌘⇧E",desc:"Export config"},{key:"⌘/",desc:"Show shortcuts"},{key:c?"⌘⌫":"Ctrl+⌫",desc:"Delete current session"},{key:"Esc",desc:"Close panels"}].map((a,b)=>(0,d.jsxs)("div",{className:"flex justify-between items-center py-1",children:[(0,d.jsx)("span",{className:"text-sm text-muted-foreground",children:a.desc}),(0,d.jsx)(aX.E,{variant:"outline",className:"font-mono text-xs",children:a.key})]},b))}),(0,d.jsx)(aN.Es,{children:(0,d.jsx)(aN.HM,{asChild:!0,children:(0,d.jsx)(x.$,{variant:"outline",children:"Close"})})})]})})]}),(0,d.jsx)(bY,{isOpen:T,onClose:()=>U(!1),onNavigateToSession:(a,c)=>{b.push(`/chat/${a}`),U(!1)}}),(0,d.jsx)(bV,{websocket:y,onApprovalRequest:aB,onHandlersReady:aI})]})}},62973:(a,b,c)=>{Promise.resolve().then(c.bind(c,49977))},70253:(a,b,c)=>{"use strict";c.d(b,{default:()=>d});let d=(0,c(95364).registerClientReference)(function(){throw Error("Attempted to call the default export of \"/home/runner/work/dexto/dexto/packages/webui/components/ChatApp.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/dexto/dexto/packages/webui/components/ChatApp.tsx","default")},76477:(a,b,c)=>{Promise.resolve().then(c.bind(c,70253))}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-7229fd0786f0483c.js" defer=""></script><script src="/_next/static/chunks/framework-6873d9e7016e0d56.js" defer=""></script><script src="/_next/static/chunks/main-7decd42f62688419.js" defer=""></script><script src="/_next/static/chunks/pages/_app-46db88469de84370.js" defer=""></script><script src="/_next/static/chunks/pages/_error-162d61367b59fad2.js" defer=""></script><script src="/_next/static/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-7229fd0786f0483c.js" defer=""></script><script src="/_next/static/chunks/framework-6873d9e7016e0d56.js" defer=""></script><script src="/_next/static/chunks/main-7decd42f62688419.js" defer=""></script><script src="/_next/static/chunks/pages/_app-46db88469de84370.js" defer=""></script><script src="/_next/static/chunks/pages/_error-162d61367b59fad2.js" defer=""></script><script src="/_next/static/b_pyEEg2sitTwMzZWW7vE/_buildManifest.js" defer=""></script><script src="/_next/static/b_pyEEg2sitTwMzZWW7vE/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"b_pyEEg2sitTwMzZWW7vE","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
package/dist/webui/.next/standalone/packages/webui/.next/server/server-reference-manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"rfmXf0hYWemhin4PwAA+SMn/YkCnmtOTUHi9bpt4Kxg="}
|