@agent-spaces/server 0.2.1 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/app.js +2 -1
  2. package/dist/package.json +1 -1
  3. package/dist/web/404.html +1 -1
  4. package/dist/web/__next.__PAGE__.txt +4 -4
  5. package/dist/web/__next._full.txt +16 -16
  6. package/dist/web/__next._head.txt +4 -4
  7. package/dist/web/__next._index.txt +9 -9
  8. package/dist/web/__next._tree.txt +2 -2
  9. package/dist/web/_next/static/chunks/08fqgb~~a~4ck.js +1 -0
  10. package/dist/web/_next/static/chunks/{0-245kun-watp.js → 0an2wvcgfh4yg.js} +2 -2
  11. package/dist/web/_next/static/chunks/0dpsi68hqjuon.js +1 -0
  12. package/dist/web/_next/static/chunks/0j282o9qw3fnz.css +1 -0
  13. package/dist/web/_next/static/chunks/0lgk.w8y-3ppq.js +1 -0
  14. package/dist/web/_next/static/chunks/0o4m39hw4fb_j.js +1 -0
  15. package/dist/web/_next/static/chunks/{0tta_56qj1z8-.js → 0qyjxx0y7rzuu.js} +1 -1
  16. package/dist/web/_next/static/chunks/{0dctkv_2d2r0g.js → 0v4atb3hml5fn.js} +2 -2
  17. package/dist/web/_next/static/chunks/{0q_scqkk9.t53.js → 0vwzzneidqvbo.js} +2 -2
  18. package/dist/web/_next/static/chunks/18bgtswajrg9e.js +179 -0
  19. package/dist/web/_not-found/__next._full.txt +26 -24
  20. package/dist/web/_not-found/__next._head.txt +4 -4
  21. package/dist/web/_not-found/__next._index.txt +9 -9
  22. package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
  23. package/dist/web/_not-found/__next._not-found.txt +3 -3
  24. package/dist/web/_not-found/__next._tree.txt +2 -2
  25. package/dist/web/_not-found.html +1 -1
  26. package/dist/web/_not-found.txt +26 -24
  27. package/dist/web/index.html +1 -1
  28. package/dist/web/index.txt +16 -16
  29. package/dist/web/login/__next._full.txt +20 -19
  30. package/dist/web/login/__next._head.txt +4 -4
  31. package/dist/web/login/__next._index.txt +9 -9
  32. package/dist/web/login/__next._tree.txt +2 -2
  33. package/dist/web/login/__next.login.__PAGE__.txt +4 -4
  34. package/dist/web/login/__next.login.txt +3 -3
  35. package/dist/web/login.html +1 -1
  36. package/dist/web/login.txt +20 -19
  37. package/dist/web/settings/__next._full.txt +22 -20
  38. package/dist/web/settings/__next._head.txt +4 -4
  39. package/dist/web/settings/__next._index.txt +9 -9
  40. package/dist/web/settings/__next._tree.txt +2 -2
  41. package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
  42. package/dist/web/settings/__next.settings.txt +5 -5
  43. package/dist/web/settings/agents/__next._full.txt +29 -28
  44. package/dist/web/settings/agents/__next._head.txt +4 -4
  45. package/dist/web/settings/agents/__next._index.txt +9 -9
  46. package/dist/web/settings/agents/__next._tree.txt +2 -2
  47. package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
  48. package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
  49. package/dist/web/settings/agents/__next.settings.txt +5 -5
  50. package/dist/web/settings/agents.html +1 -1
  51. package/dist/web/settings/agents.txt +29 -28
  52. package/dist/web/settings/mcps/__next._full.txt +29 -28
  53. package/dist/web/settings/mcps/__next._head.txt +4 -4
  54. package/dist/web/settings/mcps/__next._index.txt +9 -9
  55. package/dist/web/settings/mcps/__next._tree.txt +2 -2
  56. package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
  57. package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
  58. package/dist/web/settings/mcps/__next.settings.txt +5 -5
  59. package/dist/web/settings/mcps.html +1 -1
  60. package/dist/web/settings/mcps.txt +29 -28
  61. package/dist/web/settings/models/__next._full.txt +29 -28
  62. package/dist/web/settings/models/__next._head.txt +4 -4
  63. package/dist/web/settings/models/__next._index.txt +9 -9
  64. package/dist/web/settings/models/__next._tree.txt +2 -2
  65. package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
  66. package/dist/web/settings/models/__next.settings.models.txt +3 -3
  67. package/dist/web/settings/models/__next.settings.txt +5 -5
  68. package/dist/web/settings/models.html +1 -1
  69. package/dist/web/settings/models.txt +29 -28
  70. package/dist/web/settings/providers/__next._full.txt +29 -28
  71. package/dist/web/settings/providers/__next._head.txt +4 -4
  72. package/dist/web/settings/providers/__next._index.txt +9 -9
  73. package/dist/web/settings/providers/__next._tree.txt +2 -2
  74. package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
  75. package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
  76. package/dist/web/settings/providers/__next.settings.txt +5 -5
  77. package/dist/web/settings/providers.html +1 -1
  78. package/dist/web/settings/providers.txt +29 -28
  79. package/dist/web/settings/skills/__next._full.txt +29 -28
  80. package/dist/web/settings/skills/__next._head.txt +4 -4
  81. package/dist/web/settings/skills/__next._index.txt +9 -9
  82. package/dist/web/settings/skills/__next._tree.txt +2 -2
  83. package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
  84. package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
  85. package/dist/web/settings/skills/__next.settings.txt +5 -5
  86. package/dist/web/settings/skills.html +1 -1
  87. package/dist/web/settings/skills.txt +29 -28
  88. package/dist/web/settings.html +1 -1
  89. package/dist/web/settings.txt +22 -20
  90. package/dist/web/workflows/__next._full.txt +23 -23
  91. package/dist/web/workflows/__next._head.txt +4 -4
  92. package/dist/web/workflows/__next._index.txt +9 -9
  93. package/dist/web/workflows/__next._tree.txt +2 -2
  94. package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
  95. package/dist/web/workflows/__next.workflows.txt +3 -3
  96. package/dist/web/workflows.html +1 -1
  97. package/dist/web/workflows.txt +23 -23
  98. package/dist/web/workspace/_/__next._full.txt +20 -20
  99. package/dist/web/workspace/_/__next._head.txt +4 -4
  100. package/dist/web/workspace/_/__next._index.txt +9 -9
  101. package/dist/web/workspace/_/__next._tree.txt +2 -2
  102. package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
  103. package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
  104. package/dist/web/workspace/_/__next.workspace.txt +3 -3
  105. package/dist/web/workspace/_.html +1 -1
  106. package/dist/web/workspace/_.txt +20 -20
  107. package/dist/web/workspaces/__next._full.txt +20 -19
  108. package/dist/web/workspaces/__next._head.txt +4 -4
  109. package/dist/web/workspaces/__next._index.txt +9 -9
  110. package/dist/web/workspaces/__next._tree.txt +2 -2
  111. package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
  112. package/dist/web/workspaces/__next.workspaces.txt +3 -3
  113. package/dist/web/workspaces.html +1 -1
  114. package/dist/web/workspaces.txt +20 -19
  115. package/dist/ws/agent-prompt.js +39 -5
  116. package/package.json +1 -1
  117. package/dist/web/_next/static/chunks/088q-5_51dsrw.js +0 -1
  118. package/dist/web/_next/static/chunks/09_ki3dc5cfwv.css +0 -1
  119. package/dist/web/_next/static/chunks/0efgv37kxyht8.js +0 -1
  120. package/dist/web/_next/static/chunks/0g_b4t~000.o~.js +0 -179
  121. package/dist/web/_next/static/chunks/0ni5ot2603_28.js +0 -1
  122. /package/dist/web/_next/static/{MpJepsgfsHGGcc7rwFU8Y → CW6M37hm3VxkelXPKGgw3}/_buildManifest.js +0 -0
  123. /package/dist/web/_next/static/{MpJepsgfsHGGcc7rwFU8Y → CW6M37hm3VxkelXPKGgw3}/_clientMiddlewareManifest.js +0 -0
  124. /package/dist/web/_next/static/{MpJepsgfsHGGcc7rwFU8Y → CW6M37hm3VxkelXPKGgw3}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,837121,(e,t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0}),Object.defineProperty(s,"warnOnce",{enumerable:!0,get:function(){return a}});let a=e=>{}},989484,905724,e=>{"use strict";let t=(0,e.i(433721).default)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);e.s(["default",0,t],905724),e.s(["FileText",0,t],989484)},517432,e=>{"use strict";var t=e.i(56032),s=e.i(863728);function a(){return s.NOOP}function i(){return!1}function n(){return!0}e.s(["useIsHydrating",0,function(){return(0,t.useSyncExternalStore)(a,i,n)}])},950396,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(799543);let i=(0,s.createContext)({theme:"system",setTheme:()=>{},resolvedTheme:"light"}),n="agent-spaces-theme";function l(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function r(e){let t="system"===e?l():e,s=document.documentElement;s.classList.remove("light","dark"),s.classList.add(t),s.style.colorScheme=t}e.s(["ThemeProvider",0,function({children:e,defaultTheme:o="system"}){(0,a.useServerInsertedHTML)(()=>(0,t.jsx)("script",{dangerouslySetInnerHTML:{__html:`(function(){try{var t=localStorage.getItem('${n}');var d=t==='dark'||((!t||t==='system')&&matchMedia('(prefers-color-scheme:dark)').matches);document.documentElement.classList.add(d?'dark':'light');document.documentElement.style.colorScheme=d?'dark':'light'}catch(e){}})()`}},"theme-init"));let c=(0,s.useSyncExternalStore)(e=>{let t=window.matchMedia("(prefers-color-scheme: dark)");return t.addEventListener("change",e),()=>t.removeEventListener("change",e)},()=>l(),()=>"light"),d=(0,s.useSyncExternalStore)(e=>(window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)),()=>localStorage.getItem(n)||o,()=>o),m="system"===d?c:d,u=(0,s.useCallback)(e=>{localStorage.setItem(n,e),r(e),window.dispatchEvent(new StorageEvent("storage",{key:n}))},[]);return(0,s.useEffect)(()=>{r(d)},[d,c]),(0,t.jsx)(i.Provider,{value:{theme:d,setTheme:u,resolvedTheme:m},children:e})},"useTheme",0,function(){return(0,s.useContext)(i)}])},799773,e=>{"use strict";let t=(0,e.i(433721).default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);e.s(["User",0,t],799773)},92457,e=>{"use strict";let t=(0,e.i(433721).default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);e.s(["Monitor",0,t],92457)},267624,e=>{"use strict";let t=(0,e.i(433721).default)("layout-grid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);e.s(["LayoutGrid",0,t],267624)},757106,e=>{"use strict";let t=(0,e.i(433721).default)("brain",[["path",{d:"M12 18V5",key:"adv99a"}],["path",{d:"M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4",key:"1e3is1"}],["path",{d:"M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5",key:"1gqd8o"}],["path",{d:"M17.997 5.125a4 4 0 0 1 2.526 5.77",key:"iwvgf7"}],["path",{d:"M18 18a4 4 0 0 0 2-7.464",key:"efp6ie"}],["path",{d:"M19.967 17.483A4 4 0 1 1 12 18a4 4 0 1 1-7.967-.517",key:"1gq6am"}],["path",{d:"M6 18a4 4 0 0 1-2-7.464",key:"k1g0md"}],["path",{d:"M6.003 5.125a4 4 0 0 0-2.526 5.77",key:"q97ue3"}]]);e.s(["default",0,t])},990336,e=>{"use strict";var t=e.i(757106);e.s(["Brain",()=>t.default])},307858,e=>{"use strict";let t=(0,e.i(433721).default)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);e.s(["ExternalLink",0,t],307858)},549705,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(209988),n=e.i(260218),l=e.i(681622),r=e.i(562918),o=e.i(767467),c=e.i(100559),d=e.i(953700),m=e.i(137340),u=e.i(990336),x=e.i(307858),h=e.i(368942);let p={vision:"bg-blue-500/10 text-blue-600 border-blue-200",reasoning:"bg-purple-500/10 text-purple-600 border-purple-200",embedding:"bg-green-500/10 text-green-600 border-green-200"};function f({providers:e,providerModels:s,onEdit:i,onDelete:l,onAddModel:o}){let d=(0,a.useTranslations)("providers");return(0,t.jsxs)("div",{className:"flex flex-col p-2",children:[e.map(e=>{let a=s.find(t=>t.id===e.id),h=a?.models??[];return(0,t.jsxs)("div",{className:"group rounded-lg px-3 py-2.5 hover:bg-muted/50 cursor-pointer transition-colors",onClick:()=>i(e),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("div",{className:"flex size-8 items-center justify-center rounded-lg bg-primary/10",children:(0,t.jsx)(c.Server,{className:"size-4 text-primary"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("span",{className:"text-sm font-medium",children:e.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:e.apiBase||d("list.noApiBase")})]}),(0,t.jsxs)(r.Badge,{variant:"outline",className:"text-[10px] h-4 px-1.5",children:[h.length," ",d("list.modelsCount")]}),(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-xs",className:"opacity-0 group-hover:opacity-100 transition-opacity",onClick:t=>{t.stopPropagation(),l(e.id)},children:(0,t.jsx)(m.Trash2,{className:"size-3 text-destructive"})})]}),h.length>0&&(0,t.jsx)("div",{className:"mt-2 ml-11 flex flex-wrap gap-1",children:h.map(e=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 text-[11px] text-muted-foreground",children:[(0,t.jsx)(u.Brain,{className:"size-3"}),e.name,["vision","reasoning","embedding"].map(s=>e[s]?(0,t.jsx)("span",{className:`inline-block rounded px-1 text-[9px] font-medium border ${p[s]}`,children:s[0].toUpperCase()},s):null)]},e.id))}),(0,t.jsxs)(n.Button,{variant:"ghost",size:"xs",className:"mt-1 ml-11 h-6 text-[11px] text-muted-foreground",onClick:t=>{t.stopPropagation(),o(e.name)},children:[(0,t.jsx)(x.ExternalLink,{className:"size-3"}),d("list.addModel")]})]},e.id)}),0===e.length&&(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-muted-foreground",children:[(0,t.jsx)(c.Server,{className:"size-10 mb-2 opacity-30"}),(0,t.jsx)("p",{className:"text-sm",children:d("list.empty")})]})]})}function g({draft:e,onChange:s}){let i=(0,a.useTranslations)("providers");return(0,t.jsx)("div",{className:"flex flex-col gap-5 p-5",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:i("form.connection")}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.name")}),(0,t.jsx)(l.Input,{value:e.name||"",onChange:e=>s("name",e.target.value),placeholder:i("form.namePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiBase")}),(0,t.jsx)(l.Input,{value:e.apiBase||"",onChange:e=>s("apiBase",e.target.value),placeholder:i("form.apiBasePlaceholder")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:i("form.apiKey")}),(0,t.jsx)(l.Input,{type:"password",value:e.apiKey||"",onChange:e=>s("apiKey",e.target.value),placeholder:i("form.apiKeyPlaceholder")})]})]})})}e.s(["ProvidersDialog",0,function({open:e,onOpenChange:l,onAddModel:r,standalone:c}){let m=(0,a.useTranslations)("providers"),u=(0,a.useTranslations)("common"),{models:x,providers:p,ensure:j,addProvider:v,updateProvider:y,removeProvider:N}=(0,h.useLLMStore)(),[k,w]=(0,s.useState)(null),[b,S]=(0,s.useState)(null),[C,z]=(0,s.useState)(!1),[D,T]=(0,s.useState)(!1),[I,A]=(0,s.useState)(null);(0,s.useEffect)(()=>{e&&(z(!0),A(null),j().finally(()=>z(!1)))},[e,j]);let $=()=>{w(null),S(null)},M=async()=>{if(b&&b.name){T(!0),A(null);try{let e=!k,t=await fetch(e?"/api/providers":`/api/providers/${k.id}`,{method:e?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)});if(!t.ok)throw Error();let s=await t.json();e?v(s):y(s),$()}catch{A(m("error.saveFailed"))}finally{T(!1)}}},B=async e=>{if(confirm(m("confirm.delete"))){T(!0);try{if(!(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok)throw Error();N(e),k?.id===e&&$()}catch{A(m("error.deleteFailed"))}finally{T(!1)}}},P=(0,t.jsxs)(t.Fragment,{children:[!c&&(0,t.jsxs)("div",{className:"flex items-center gap-3 border-b px-5 py-4",children:[b&&(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:$,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)(i.DialogHeader,{className:"flex-1 space-y-0",children:[(0,t.jsx)(i.DialogTitle,{className:"text-base",children:b?k?m("dialog.editTitle"):m("dialog.addTitle"):m("dialog.title")}),(0,t.jsx)(i.DialogDescription,{className:"text-xs",children:b?m("dialog.editDescription"):m("dialog.listDescription")})]}),!b&&(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:()=>{w(null),S({name:"",apiBase:"",apiKey:""})},className:"mr-6",children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),m("dialog.add")]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[I&&(0,t.jsx)("div",{className:"mx-5 mt-4 rounded-md border border-destructive/30 bg-destructive/10 px-3 py-2 text-xs text-destructive",children:I}),C?(0,t.jsx)("div",{className:"py-12 text-center text-sm text-muted-foreground",children:m("dialog.loading")}):b?(0,t.jsx)(g,{draft:b,onChange:(e,t)=>{S(s=>s?{...s,[e]:t}:s)}}):(0,t.jsx)(f,{providers:p,providerModels:p.map(e=>{let t;return{id:e.id,models:(t=e.name,x.filter(e=>e.provider===t))}}),onEdit:e=>{w(e),S({...e})},onDelete:B,onAddModel:e=>{c||l(!1),r(e)}})]}),b&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 border-t px-5 py-3",children:[(0,t.jsx)(n.Button,{variant:"outline",size:"sm",onClick:$,disabled:D,children:u("cancel")}),(0,t.jsx)(n.Button,{size:"sm",onClick:M,disabled:D||!b.name,children:u(D?"saving":"save")})]})]});return c?(0,t.jsx)("div",{className:"h-full flex flex-col",children:P}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||$(),l(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:P})})}])},523592,e=>{"use strict";var t=e.i(8890);let s="agent-spaces-servers",a="agent-spaces-active-server",i="active-server";function n(){let e=t.default.env.NEXT_PUBLIC_SERVER_URL?.trim();if(e)return e.replace(/\/$/,"");let{hostname:s,port:a}=window.location;return"localhost"!==s&&"127.0.0.1"!==s?"http://localhost:3100":"3000"===a?`http://${s}:3100`:window.location.origin}let l=[{id:"default",name:"Default",url:n()}];function r(){try{let e=localStorage.getItem(s);return e?JSON.parse(e).map(e=>"default"!==e.id||e.url?e:{...e,url:n()}):l}catch{return l}}function o(){return localStorage.getItem(a)||"default"}function c(){let e=r(),t=o();return e.find(e=>e.id===t)||e[0]||null}e.s(["getActiveServer",0,c,"getActiveServerUrl",0,function(){return c()?.url??null},"loadActiveId",0,o,"loadServers",0,r,"saveActiveId",0,function(e){localStorage.setItem(a,e)},"saveServers",0,function(e){localStorage.setItem(s,JSON.stringify(e))},"setActiveServerCookie",0,function(e){e?document.cookie=`${i}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`:document.cookie=`${i}=; path=/; max-age=0`}])},233297,515104,e=>{"use strict";function t(){return"tauri.localhost"===window.location.hostname||"__TAURI_INTERNALS__"in window}async function s(){return t()?r():"Notification"in window?l(Notification.permission):"unsupported"}async function a(){return t()?o():n()}async function i(e,s){var a,i;return t()?c(e,s):(a=e,i=s,void("Notification"in window&&"granted"===Notification.permission&&new Notification(a,{body:i,icon:"/favicon.ico"})))}async function n(){return"Notification"in window?l(await Notification.requestPermission()):"unsupported"}function l(e){switch(e){case"granted":return"granted";case"denied":return"denied";default:return"default"}}async function r(){try{let{isPermissionGranted:t}=await e.A(678001);return await t()?"granted":"default"}catch{return"unsupported"}}async function o(){try{let{requestPermission:t,isPermissionGranted:s}=await e.A(678001),a=await t();if("granted"===a||await s())return"granted";return"denied"}catch{return"unsupported"}}async function c(t,s){try{let{sendNotification:a,isPermissionGranted:i}=await e.A(678001);if(!await i())return;a({title:t,body:s})}catch{}}function d(e){let[t,s=""]=e.split("#",2),[a,i=""]=t.split("?",2);if(!a.startsWith("/")||a.startsWith("/api/"))return e;if("/"===a)return`/${i?`?${i}`:""}${s?`#${s}`:""}`;if(a.startsWith("/workspace/")){let e=a.slice(11).split("/")[0],t=new URLSearchParams(i);return t.set("workspaceId",e),`/workspace/_.html${t.toString()?`?${t.toString()}`:""}${s?`#${s}`:""}`}let n=a.endsWith(".html")?a:`${a}.html`;return`${n}${i?`?${i}`:""}${s?`#${s}`:""}`}e.i(8890),e.s(["getNotificationPermission",0,s,"isTauriEnvironment",0,t,"requestNotificationPermission",0,a,"sendNativeNotification",0,i],515104),e.s(["tauriNavigate",0,function(e,t,s=!1){t=d(t),s?window.location.replace(t):window.location.href=t},"toStaticHref",0,d],233297)},437122,286117,e=>{"use strict";var t=e.i(523592),s=e.i(233297);function a(e){return"/index.html"===e?"/":e.endsWith(".html")?e.slice(0,-5):e}function i(e){return"/login"===a(e)}e.s(["isLoginPath",0,i,"isWorkspacePath",0,function(e){return a(e).startsWith("/workspace/")},"workspaceIdFromLocation",0,function(e,t){let s=new URLSearchParams(t).get("workspaceId");if(s)return s;let i=a(e).match(/^\/workspace\/([^/]+)/);return i?.[1]??null}],286117);let n="agent-spaces-token",l="agent-spaces-auth-verified";function r(){let e=localStorage.getItem(n);if(null!==e)return e;let s=(0,t.getActiveServer)()?.secret;return void 0!==s?s:null}function o(){localStorage.removeItem(n),localStorage.removeItem(l)}function c(){let e=r();return null===e?{}:{Authorization:`Bearer ${e}`}}async function d(e,a){let n=function(e){if("string"!=typeof e||e.startsWith("http"))return e;let s=(0,t.getActiveServerUrl)();return s?`${s}${e.startsWith("/")?"":"/"}${e}`:e}(e),l={...c(),...a?.headers},r=await fetch(n,{...a,headers:l});return(401===r.status||403===r.status)&&(o(),i(window.location.pathname)||window.location.replace((0,s.toStaticHref)("/login"))),r}e.s(["authHeaders",0,c,"fetchWithAuth",0,d,"getToken",0,r,"isAuthenticated",0,function(){return"1"===localStorage.getItem(l)},"removeToken",0,o,"setToken",0,function(e){localStorage.setItem(n,e),localStorage.setItem(l,"1")}],437122)},962562,e=>{"use strict";let t=(0,e.i(433721).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,t],962562)},210,e=>{"use strict";let t=(0,e.i(433721).default)("settings-2",[["path",{d:"M14 17H5",key:"gfn3mx"}],["path",{d:"M19 7h-9",key:"6i9tg"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);e.s(["Settings2",0,t],210)},100559,e=>{"use strict";let t=(0,e.i(433721).default)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);e.s(["Server",0,t],100559)},894920,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(209988),i=e.i(260218),n=e.i(681622),l=e.i(344118),r=e.i(962562),o=e.i(953700),c=e.i(100559),d=e.i(137340),m=e.i(244073);e.s(["ServerManagerDialog",0,function({open:e,onOpenChange:u,servers:x,activeId:h,onUpdate:p,onRemove:f,onSwitch:g}){let j=(0,m.useTranslations)("sidebar"),v=(0,m.useTranslations)("common"),[y,N]=s.useState(null),[k,w]=s.useState(""),[b,S]=s.useState(""),[C,z]=s.useState(""),[D,T]=s.useState(""),[I,A]=s.useState(""),[$,M]=s.useState(""),B=()=>{N(null),w(""),S(""),z("")},P=()=>{if(!k.trim()||!b.trim())return;let e=b.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),p(x.map(t=>t.id===y?{...t,name:k.trim(),url:e,secret:C.trim()||void 0}:t)),B()};return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:e=>{u(e),e||B()},children:(0,t.jsxs)(a.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(a.DialogHeader,{children:[(0,t.jsx)(a.DialogTitle,{children:j("server.manageServers")}),(0,t.jsx)(a.DialogDescription,{children:j("server.manageDescription")})]}),(0,t.jsx)("div",{className:"space-y-1",children:x.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,t.jsx)(c.Server,{className:"size-4 shrink-0 text-muted-foreground"}),y===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-1",value:k,onChange:e=>w(e.target.value),placeholder:"Name",autoFocus:!0}),(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-[1.5]",value:b,onChange:e=>S(e.target.value),placeholder:"http://...",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:P,className:"h-7 px-2",children:v("save")}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:B,className:"h-7 px-2",children:v("cancel")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>{e.id!==h&&g(e)},children:[(0,t.jsx)("div",{className:"text-sm font-medium truncate",children:e.name}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground truncate",children:e.url})]}),e.id===h?(0,t.jsx)(l.Check,{className:"size-4 shrink-0 text-primary"}):(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:()=>g(e),className:"h-7 px-2 text-xs shrink-0",children:j("server.switch")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Pencil,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>{N(e.id),w(e.name),S(e.url),z(e.secret||"")}}),"default"!==e.id&&(0,t.jsx)(d.Trash2,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-destructive",onClick:()=>f(e.id)})]})]})]},e.id))}),null===y&&(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground mb-2",children:j("server.newServer")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Input,{className:"h-8 text-sm",value:D,onChange:e=>T(e.target.value),placeholder:"Name"}),(0,t.jsx)(i.Button,{size:"sm",onClick:()=>{if(!D.trim()||!I.trim())return;let e=I.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),p([...x,{id:Date.now().toString(),name:D.trim(),url:e,secret:$.trim()||void 0}]),T(""),A(""),M("")},disabled:!D.trim()||!I.trim(),children:(0,t.jsx)(o.Plus,{className:"size-4"})})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(n.Input,{className:"h-8 text-sm flex-1",value:I,onChange:e=>A(e.target.value),placeholder:"http://..."})}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsx)(n.Input,{className:"h-8 text-sm flex-1",type:"password",value:$,onChange:e=>M(e.target.value),placeholder:j("server.secretOptionalPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})})]})]})})}])},111343,e=>{"use strict";let t=(0,e.i(433721).default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);e.s(["Save",0,t],111343)},255742,973767,401058,977694,e=>{"use strict";var t=e.i(433721);let s=(0,t.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);e.s(["Star",0,s],255742);let a=(0,t.default)("star-off",[["path",{d:"m10.344 4.688 1.181-2.393a.53.53 0 0 1 .95 0l2.31 4.679a2.12 2.12 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.237 3.152",key:"19ctli"}],["path",{d:"m17.945 17.945.43 2.505a.53.53 0 0 1-.771.56l-4.618-2.428a2.12 2.12 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a8 8 0 0 0 .4-.099",key:"ptqqvy"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);e.s(["StarOff",0,a],973767);let i=(0,t.default)("ellipsis-vertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);e.s(["MoreVertical",0,i],401058);let n=(0,t.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);e.s(["Rocket",0,n],977694)},22906,191202,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(887836),n=e.i(209988),l=e.i(260218),r=e.i(681622),o=e.i(788010),c=e.i(191118),d=e.i(917955),m=e.i(996652),u=e.i(188815),x=e.i(611176),h=e.i(255742),p=e.i(973767),f=e.i(129981),g=e.i(887354);let j=(0,e.i(433721).default)("plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]]);e.s(["Plug",0,j],191202);var v=e.i(972846),y=e.i(401058),N=e.i(137340),k=e.i(977694),w=e.i(111343),b=e.i(465458);e.i(462506);let S=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["McpsDialog",0,function({open:e,onOpenChange:i,standalone:C}){let z=(0,a.useTranslations)("mcps"),D=(0,a.useTranslations)("common"),[T,I]=(0,s.useState)([]),[A,$]=(0,s.useState)([]),[M,B]=(0,s.useState)(!1),[P,L]=(0,s.useState)(""),[U,O]=(0,s.useState)("all"),[E,F]=(0,s.useState)(""),[H,R]=(0,s.useState)(!1),[J,q]=(0,s.useState)(""),[W,_]=(0,s.useState)(""),[V,K]=(0,s.useState)(null),[X,G]=(0,s.useState)([]),[Q,Y]=(0,s.useState)(null),[Z,ee]=(0,s.useState)(""),et=(0,s.useCallback)(async()=>{B(!0);try{let e=await fetch("/api/mcps");e.ok&&I(await e.json())}catch{}B(!1)},[]),es=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();$(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||C)&&(et(),es())},[e,C,et,es]);let ea=async e=>{try{let t=await fetch(`/api/mcps/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();I(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},ei=async()=>{_("");try{JSON.parse(J)}catch{_(z("importInvalidJson"));return}try{let e=await fetch("/api/mcps/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonText:J})});if(e.ok)q(""),R(!1),et();else{let t=await e.json();_(t.error||z("importFailed"))}}catch{_(z("importFailed"))}},en=async()=>{let e;if(Q){try{e=JSON.parse(Z)}catch{return}try{(await fetch(`/api/mcps/${encodeURIComponent(Q.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({config:e})})).ok&&(I(t=>t.map(t=>t.name===Q.name?{...t,config:e}:t)),Y(null))}catch{}}},el=async e=>{try{(await fetch(`/api/mcps/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&I(t=>t.filter(t=>t.name!==e.name))}catch{}},er=async()=>{if(V){for(let e of A){let t=V.boundAgents.some(t=>t.id===e.id),s=X.includes(e.id);if(t&&!s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=s.mcps||{},i={...a.mcpServers||{}};delete i[V.name],await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,mcps:{...a,mcpServers:i}})})}else if(!t&&s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=s.mcps||{},i={...a.mcpServers||{}};V.name in i||(i[V.name]=V.config,await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,mcps:{...a,mcpServers:i}})}))}}K(null),et()}},eo=e=>{G(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ec=T.filter(e=>{if(P){let t=P.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.description.toLowerCase().includes(t))return!1}return("favorites"!==U||!!e.favorited)&&("agent"!==U||!E||!!e.boundAgents.some(e=>e.id===E))}),ed=(C||e)&&!V&&!Q,em=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-end pr-8 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[C?(0,t.jsx)("h2",{className:"text-base font-semibold",children:z("title")}):(0,t.jsx)(n.DialogTitle,{children:z("title")}),C?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:z("description")}):(0,t.jsx)(n.DialogDescription,{children:z("description")})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:(0,t.jsxs)(m.Popover,{open:H,onOpenChange:R,children:[(0,t.jsx)(m.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(f.Upload,{className:"size-3.5 mr-1"}),z("import")]})}),(0,t.jsx)(m.PopoverContent,{className:"w-96",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:z("importTitle")}),(0,t.jsx)(o.Textarea,{value:J,onChange:e=>{q(e.target.value),_("")},placeholder:'{\n "mcpServers": {\n "server-name": {\n "command": "npx",\n "args": ["-y", "package"],\n "env": {}\n }\n }\n}',className:"font-mono text-xs min-h-[180px] resize-none"}),W&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:W}),(0,t.jsx)(l.Button,{size:"sm",onClick:ei,disabled:!J.trim(),className:"w-full",children:z("importConfirm")})]})})]})})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(l.Button,{variant:"all"===U?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{O("all"),F("")},children:[(0,t.jsx)(j,{className:"size-3.5 mr-1.5"}),z("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===U?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{O("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3.5 mr-1.5"}),z("filterFavorites")]})]}),A.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:z("filterByAgent")}),(0,t.jsx)(c.ScrollArea,{className:"max-h-48",children:A.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===U&&E===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{O("agent"),F(e.id)},children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:P,onChange:e=>L(e.target.value),placeholder:z("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,b.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===U?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{O("all"),F("")},children:z("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,b.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===U?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{O("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),z("filterFavorites")]})]}),A.length>0&&(0,t.jsx)(u.SearchSelect,{value:"agent"===U?E:"",onChange:e=>{e?(O("agent"),F(e)):(O("all"),F(""))},options:A.map(e=>({value:e.id,label:e.name})),placeholder:z("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(g.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:P,onChange:e=>L(e.target.value),placeholder:z("search"),className:"pl-8"})]}),(0,t.jsx)(c.ScrollArea,{className:"flex-1",children:M?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:D("loading")}):0===ec.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:z("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:ec.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Y(e),ee(JSON.stringify(e.config,null,2))},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)(j,{className:"size-3.5 text-muted-foreground"}),(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent",onClick:t=>{t.stopPropagation(),ea(e)},children:e.favorited?(0,t.jsx)(h.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(p.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.config.command||e.config.url||JSON.stringify(e.config).slice(0,100)})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{K(e),G(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(k.Rocket,{className:"size-3.5 mr-1"}),z("apply")]}),(0,t.jsxs)(d.DropdownMenu,{children:[(0,t.jsx)(d.DropdownMenuTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(y.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(d.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(d.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>el(e),children:[(0,t.jsx)(N.Trash2,{className:"size-3.5 mr-1.5"}),z("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[C&&ed&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:em}),!C&&(0,t.jsx)(n.Dialog,{open:ed,onOpenChange:i,children:(0,t.jsx)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:em})}),(0,t.jsx)(n.Dialog,{open:!!Q,onOpenChange:e=>{e||Y(null)},children:(0,t.jsxs)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.DialogTitle,{children:z("editTitle",{name:Q?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:z("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:en,children:[(0,t.jsx)(w.Save,{className:"size-3.5 mr-1"}),D("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(S,{height:"100%",language:"json",value:Z,onChange:e=>ee(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on",formatOnPaste:!0}})})]})}),(0,t.jsx)(n.Dialog,{open:!!V,onOpenChange:e=>{e||K(null)},children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:z("bindTitle",{name:V?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:z("bindDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto space-y-0.5",children:A.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>eo(e.id),className:(0,b.cn)("flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors"),children:[(0,t.jsx)(x.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,b.cn)("flex items-center justify-center size-4 rounded border shrink-0",X.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),X.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:X.map(e=>{let s=A.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,t.jsx)(x.AgentIcon,{agentId:e,name:s?.name,className:"size-3.5 rounded-full"}),s?.name||e,(0,t.jsx)("button",{type:"button",onClick:()=>eo(e),className:"hover:text-destructive",children:(0,t.jsx)(v.X,{className:"size-3"})})]},e)})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>K(null),children:D("cancel")}),(0,t.jsx)(l.Button,{onClick:er,children:D("confirm")})]})]})]})})]})}],22906)},625873,e=>{"use strict";var t=e.i(344180),s=e.i(764556),a=e.i(244073),i=e.i(887836),n=e.i(209988),l=e.i(260218),r=e.i(681622),o=e.i(191118),c=e.i(917955),d=e.i(996652),m=e.i(898822),u=e.i(129981),x=e.i(972846),h=e.i(984178),p=e.i(465458);let f=0;function g({value:e=[],onChange:a,accept:i,maxFiles:n=0,maxSize:l,disabled:r=!1,className:o,placeholder:c}){let[d,j]=(0,s.useState)(null),v=(0,s.useCallback)((t,s)=>{if(j(null),s.length>0){let e=s[0].errors[0]?.message;e&&j(e)}if(0===t.length)return;let i=t.map(e=>{let t={id:`upload-${++f}`,file:e};return e.type.startsWith("image/")&&(t.preview=URL.createObjectURL(e)),t}),l=n>0?[...e,...i].slice(0,n):[...e,...i];a?.(l)},[e,a,n]),y=(0,s.useCallback)(t=>{let s=e.find(e=>e.id===t);s?.preview&&URL.revokeObjectURL(s.preview),a?.(e.filter(e=>e.id!==t))},[e,a]),{getRootProps:N,getInputProps:k,isDragActive:w,open:b}=(0,m.useDropzone)({onDrop:v,accept:i,maxFiles:n||void 0,maxSize:l,disabled:r,noClick:!1});return(0,t.jsxs)("div",{className:(0,p.cn)("space-y-3",o),children:[(0,t.jsxs)("div",{...N(),className:(0,p.cn)("relative flex flex-col items-center justify-center gap-2 rounded-xl border-2 border-dashed px-6 py-8 transition-colors cursor-pointer",w?"border-primary bg-primary/5":"border-border hover:border-primary/50 hover:bg-accent/50",r&&"pointer-events-none opacity-50"),children:[(0,t.jsx)("input",{...k()}),(0,t.jsx)(u.Upload,{className:"size-8 text-muted-foreground"}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:c??(w?"松开即可上传":"拖拽文件到此处,或点击选择")}),!w&&(0,t.jsxs)("p",{className:"mt-1 text-xs text-muted-foreground",children:["支持多文件",l?`,单文件最大 ${(l/1024/1024).toFixed(0)}MB`:""]})]})]}),d&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:d}),e.length>0&&(0,t.jsx)("div",{className:"flex flex-col gap-2",children:e.map(e=>{var s;return(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-background px-3 py-2",children:[e.preview?(0,t.jsx)("img",{src:e.preview,alt:"",className:"size-10 rounded-md object-cover"}):(0,t.jsx)("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted",children:(0,t.jsx)(h.FileIcon,{className:"size-5 text-muted-foreground"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("p",{className:"truncate text-sm",children:e.file.name}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(s=e.file.size)<1024?`${s} B`:s<1048576?`${(s/1024).toFixed(1)} KB`:`${(s/1024/1024).toFixed(1)} MB`})]}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),y(e.id)},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",children:(0,t.jsx)(x.X,{className:"size-4 text-muted-foreground"})})]},e.id)})})]})}var j=e.i(188815),v=e.i(611176),y=e.i(255742),N=e.i(973767),k=e.i(887354),w=e.i(989484),b=e.i(401058),S=e.i(137340),C=e.i(977694),z=e.i(111343),D=e.i(601039);e.i(462506);let T=(0,i.default)(()=>e.A(863812).then(e=>e.default),{loadableGenerated:{modules:[158480]},ssr:!1,loading:()=>(0,t.jsx)("div",{className:"flex items-center justify-center h-full text-muted-foreground text-sm",children:"Loading editor..."})});e.s(["SkillsDialog",0,function({open:e,onOpenChange:i,standalone:m}){let h=(0,a.useTranslations)("skills"),f=(0,a.useTranslations)("common"),[I,A]=(0,s.useState)([]),[$,M]=(0,s.useState)([]),[B,P]=(0,s.useState)(!1),[L,U]=(0,s.useState)(""),[O,E]=(0,s.useState)("all"),[F,H]=(0,s.useState)(""),[R,J]=(0,s.useState)(!1),[q,W]=(0,s.useState)([]),[_,V]=(0,s.useState)(null),[K,X]=(0,s.useState)([]),[G,Q]=(0,s.useState)(null),[Y,Z]=(0,s.useState)(""),[ee,et]=(0,s.useState)([]),[es,ea]=(0,s.useState)(new Set),[ei,en]=(0,s.useState)(!1),[el,er]=(0,s.useState)(!1),eo=(0,s.useCallback)(async()=>{P(!0);try{let e=await fetch("/api/skills");e.ok&&A(await e.json())}catch{}P(!1)},[]),ec=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();M(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||m)&&(eo(),ec())},[e,m,eo,ec]);let ed=async e=>{try{let t=await fetch(`/api/skills/${encodeURIComponent(e.name)}/favorite`,{method:"POST"});if(t.ok){let{favorited:s}=await t.json();A(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},em=async()=>{for(let e of q){let t=await e.file.text();await fetch("/api/skills/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:e.file.name,content:t})})}W([]),J(!1),eo()},eu=async()=>{if(G)try{(await fetch(`/api/skills/${encodeURIComponent(G.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:Y})})).ok&&(A(e=>e.map(e=>e.name===G.name?{...e,content:Y}:e)),Q(null))}catch{}},ex=async e=>{try{(await fetch(`/api/skills/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&A(t=>t.filter(t=>t.name!==e.name))}catch{}},eh=async()=>{if(_){for(let e of $){let t=_.boundAgents.some(t=>t.id===e.id),s=K.includes(e.id);if(t&&!s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json(),a=(s.skills||[]).filter(e=>e.replace(/\.md$/i,"")!==_.name);console.log("[skills] remove skill",_.name,"from agent",e.name,"updatedSkills:",a),await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:a})})}else if(!t&&s){let t=await fetch(`/api/agents/presets/${e.id}`);if(!t.ok)continue;let s=await t.json();if(!(s.skills||[]).map(e=>e.replace(/\.md$/i,"")).includes(_.name)){let t=[...s.skills||[],`${_.name}.md`];console.log("[skills] add skill",_.name,"to agent",e.name,"updatedSkills:",t),await fetch(`/api/agents/presets/${e.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...s,skills:t})})}}}V(null),eo()}},ep=e=>{X(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ef=async()=>{er(!0);try{let e=await fetch("/api/skills/sync-check");if(e.ok){let t=await e.json();et(t),ea(new Set(t.map(e=>`${e.agentId}::${e.skillName}`))),en(!0)}}catch{}er(!1)},eg=async()=>{let e=ee.filter(e=>es.has(`${e.agentId}::${e.skillName}`));if(0!==e.length)try{(await fetch("/api/skills/sync",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({items:e.map(e=>({agentId:e.agentId,skillName:e.skillName}))})})).ok&&(en(!1),eo())}catch{}},ej=I.filter(e=>{if(L){let t=L.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.content.toLowerCase().includes(t))return!1}return("favorites"!==O||!!e.favorited)&&("agent"!==O||!F||!!e.boundAgents.some(e=>e.id===F))}),ev=(m||e)&&!_&&!G,ey=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{className:"hidden md:block",children:[m?(0,t.jsx)("h2",{className:"text-base font-semibold",children:h("title")}):(0,t.jsx)(n.DialogTitle,{children:h("title")}),m?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:h("description")}):(0,t.jsx)(n.DialogDescription,{children:h("description")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 ml-auto shrink-0 pt-2",children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:ef,disabled:el,children:[(0,t.jsx)(D.RefreshCw,{className:(0,p.cn)("size-3.5 mr-1",el&&"animate-spin")}),h("syncToAgents")]}),(0,t.jsxs)(d.Popover,{open:R,onOpenChange:J,children:[(0,t.jsx)(d.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(u.Upload,{className:"size-3.5 mr-1"}),h("import")]})}),(0,t.jsx)(d.PopoverContent,{className:"w-80",align:"end",children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)("p",{className:"text-sm font-medium",children:h("importTitle")}),(0,t.jsx)(g,{value:q,onChange:W,accept:{"text/markdown":[".md"],"":[".md"]},placeholder:h("importPlaceholder"),maxFiles:10}),(0,t.jsx)(l.Button,{size:"sm",onClick:em,disabled:0===q.length,className:"w-full",children:h("importConfirm")})]})})]})]})]})}),(0,t.jsxs)("div",{className:"flex flex-1 min-h-0 gap-4 pt-2",children:[(0,t.jsxs)("div",{className:"hidden md:flex w-44 shrink-0 flex-col gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsxs)(l.Button,{variant:"all"===O?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("all"),H("")},children:[(0,t.jsx)(w.FileText,{className:"size-3.5 mr-1.5"}),h("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===O?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("favorites"),H("")},children:[(0,t.jsx)(y.Star,{className:"size-3.5 mr-1.5"}),h("filterFavorites")]})]}),$.length>0&&(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("p",{className:"text-xs font-medium text-muted-foreground px-2",children:h("filterByAgent")}),(0,t.jsx)(o.ScrollArea,{className:"max-h-48",children:$.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===O&&F===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("agent"),H(e.id)},children:[(0,t.jsx)(v.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-4 mr-1.5 rounded-full"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col gap-3",children:[(0,t.jsxs)("div",{className:"flex md:hidden flex-col gap-2",children:[(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(k.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:L,onChange:e=>U(e.target.value),placeholder:h("search"),className:"pl-8"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("div",{className:"flex rounded-lg border border-input p-0.5",children:[(0,t.jsx)("button",{type:"button",className:(0,p.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","all"===O?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{E("all"),H("")},children:h("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,p.cn)("px-2.5 py-1 rounded-md text-xs font-medium transition-colors","favorites"===O?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{E("favorites"),H("")},children:[(0,t.jsx)(y.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),h("filterFavorites")]})]}),$.length>0&&(0,t.jsx)(j.SearchSelect,{value:"agent"===O?F:"",onChange:e=>{e?(E("agent"),H(e)):(E("all"),H(""))},options:$.map(e=>({value:e.id,label:e.name})),placeholder:h("filterByAgent"),allowCustom:!1,className:"flex-1 min-w-0"})]})]}),(0,t.jsxs)("div",{className:"hidden md:block relative",children:[(0,t.jsx)(k.Search,{className:"size-3.5 absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground"}),(0,t.jsx)(r.Input,{value:L,onChange:e=>U(e.target.value),placeholder:h("search"),className:"pl-8"})]}),(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:B?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:f("loading")}):0===ej.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:h("empty")}):(0,t.jsx)("div",{className:"grid grid-cols-1 gap-3 pr-2",children:ej.map(e=>(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-background p-4 hover:bg-accent/30 transition-colors cursor-pointer",onClick:()=>{Q(e),Z(e.content)},children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e.name}),(0,t.jsx)("button",{type:"button",className:"flex items-center justify-center size-5 rounded hover:bg-accent",onClick:t=>{t.stopPropagation(),ed(e)},children:e.favorited?(0,t.jsx)(y.Star,{className:"size-3.5 text-yellow-500 fill-yellow-500"}):(0,t.jsx)(N.StarOff,{className:"size-3.5 text-muted-foreground"})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:e.description||e.content.slice(0,120).replace(/^#\s+/,"")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",onClick:e=>e.stopPropagation(),children:[(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",onClick:()=>{V(e),X(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(C.Rocket,{className:"size-3.5 mr-1"}),h("apply")]}),(0,t.jsxs)(c.DropdownMenu,{children:[(0,t.jsx)(c.DropdownMenuTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"size-7"}),children:(0,t.jsx)(b.MoreVertical,{className:"size-3.5"})}),(0,t.jsx)(c.DropdownMenuContent,{align:"end",children:(0,t.jsxs)(c.DropdownMenuItem,{className:"text-destructive focus:text-destructive",onClick:()=>ex(e),children:[(0,t.jsx)(S.Trash2,{className:"size-3.5 mr-1.5"}),h("delete")]})})]})]})]}),e.boundAgents.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mt-2.5 pt-2.5 border-t border-border/50",children:[e.boundAgents.map(e=>(0,t.jsx)(v.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"},e.id)),(0,t.jsx)("span",{className:"text-xs text-muted-foreground ml-1",children:e.boundAgents.length})]})]},e.name))})})]})]})]});return(0,t.jsxs)(t.Fragment,{children:[m&&ev&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:ey}),!m&&(0,t.jsx)(n.Dialog,{open:ev,onOpenChange:i,children:(0,t.jsx)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:ey})}),(0,t.jsx)(n.Dialog,{open:!!G,onOpenChange:e=>{e||Q(null)},children:(0,t.jsxs)(n.DialogContent,{className:"!w-[80vw] !max-w-[80vw] !h-[80vh] flex flex-col",children:[(0,t.jsx)(n.DialogHeader,{children:(0,t.jsxs)("div",{className:"flex items-center justify-between pr-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(n.DialogTitle,{children:h("editTitle",{name:G?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:h("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:eu,children:[(0,t.jsx)(z.Save,{className:"size-3.5 mr-1"}),f("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(T,{height:"100%",language:"markdown",value:Y,onChange:e=>Z(e||""),theme:"vs-dark",options:{fontSize:13,minimap:{enabled:!1},scrollBeyondLastLine:!1,padding:{top:8},renderLineHighlight:"gutter",wordWrap:"on"}})})]})}),(0,t.jsx)(n.Dialog,{open:!!_,onOpenChange:e=>{e||V(null)},children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:h("bindTitle",{name:_?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:h("bindDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[(0,t.jsx)("div",{className:"max-h-52 overflow-y-auto space-y-0.5",children:$.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>ep(e.id),className:(0,p.cn)("flex items-center gap-2 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors"),children:[(0,t.jsx)(v.AgentIcon,{agentId:e.id,name:e.name,avatarUrl:e.avatarUrl,className:"size-5 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsx)("span",{className:"block truncate",children:e.name}),e.description&&(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.description})]}),(0,t.jsx)("div",{className:(0,p.cn)("flex items-center justify-center size-4 rounded border shrink-0",K.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),K.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:K.map(e=>{let s=$.find(t=>t.id===e);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:[(0,t.jsx)(v.AgentIcon,{agentId:e,name:s?.name,className:"size-3.5 rounded-full"}),s?.name||e,(0,t.jsx)("button",{type:"button",onClick:()=>ep(e),className:"hover:text-destructive",children:(0,t.jsx)(x.X,{className:"size-3"})})]},e)})}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>V(null),children:f("cancel")}),(0,t.jsx)(l.Button,{onClick:eh,children:f("confirm")})]})]})]})}),(0,t.jsx)(n.Dialog,{open:ei,onOpenChange:en,children:(0,t.jsxs)(n.DialogContent,{className:"sm:max-w-lg",children:[(0,t.jsxs)(n.DialogHeader,{children:[(0,t.jsx)(n.DialogTitle,{children:h("syncTitle")}),(0,t.jsx)(n.DialogDescription,{children:h("syncDescription")})]}),(0,t.jsxs)("div",{className:"space-y-3 pt-2",children:[0===ee.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-8 text-muted-foreground text-sm",children:h("syncEmpty")}):(0,t.jsx)(o.ScrollArea,{className:"max-h-72",children:(0,t.jsx)("div",{className:"space-y-1",children:ee.map(e=>{let s=`${e.agentId}::${e.skillName}`;return(0,t.jsxs)("button",{type:"button",onClick:()=>{var t,s;let a;return t=e.agentId,s=e.skillName,a=`${t}::${s}`,void ea(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t})},className:"flex items-center gap-3 w-full px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[(0,t.jsx)("div",{className:(0,p.cn)("flex items-center justify-center size-4 rounded border shrink-0",es.has(s)?"bg-primary border-primary text-primary-foreground":"border-input")}),(0,t.jsx)(v.AgentIcon,{agentId:e.agentId,name:e.agentName,className:"size-5 rounded-full"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.agentName}),(0,t.jsxs)("span",{className:"text-muted-foreground text-xs shrink-0",children:[e.skillName,".md"]})]},s)})})}),ee.length>0&&(0,t.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[(0,t.jsx)(l.Button,{variant:"outline",onClick:()=>en(!1),children:f("cancel")}),(0,t.jsx)(l.Button,{onClick:eg,disabled:0===es.size,children:h("syncConfirm")})]})]})]})})]})}],625873)},678001,e=>{e.v(t=>Promise.all(["static/chunks/0zl19l5tuoppw.js"].map(t=>e.l(t))).then(()=>t(228394)))},863812,e=>{e.v(t=>Promise.all(["static/chunks/168ojsxhm7ypc.js"].map(t=>e.l(t))).then(()=>t(158480)))}]);