@agent-spaces/server 0.3.1 → 0.3.3
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/dist/agents/agent-message-parts.js +2 -2
- package/dist/agents/issue-agent-runner.js +0 -1
- package/dist/app.js +0 -2
- package/dist/package.json +1 -1
- package/dist/routes/issue.js +12 -0
- package/dist/routes/speech-recognition.js +21 -2
- package/dist/services/issue.js +11 -2
- package/dist/services/speech-recognition/tencent.js +6 -1
- package/dist/storage/speech-recognition-store.js +4 -1
- package/dist/web/404.html +1 -1
- package/dist/web/__next.__PAGE__.txt +4 -4
- package/dist/web/__next._full.txt +27 -31
- package/dist/web/__next._head.txt +4 -4
- package/dist/web/__next._index.txt +13 -17
- package/dist/web/__next._tree.txt +2 -2
- package/dist/web/_next/static/chunks/002-dxhags4dj.js +2 -0
- package/dist/web/_next/static/chunks/{02unyp1obddyn.js → 0_g3irbniww6d.js} +1 -1
- package/dist/web/_next/static/chunks/{0d.v1csiyl.1~.js → 0anuxr11yn5iv.js} +2 -2
- package/dist/web/_next/static/chunks/0cwvdk55mrt_9.css +1 -0
- package/dist/web/_next/static/chunks/0e.z4v3cd78dx.js +1 -0
- package/dist/web/_next/static/chunks/0gczc8mmde5my.js +1 -0
- package/dist/web/_next/static/chunks/0j2w71psq6w9u.js +1 -0
- package/dist/web/_next/static/chunks/0lmeh15xwcj0s.js +204 -0
- package/dist/web/_next/static/chunks/0puhc.l_.mc99.js +1 -0
- package/dist/web/_next/static/chunks/0v7nmghv8ieef.js +1 -0
- package/dist/web/_next/static/chunks/{0~xn0gfqxa20r.js → 0w1iudd1d46sw.js} +3 -3
- package/dist/web/_next/static/chunks/0wekj7h15h7z7.js +5 -0
- package/dist/web/_next/static/chunks/0xwqf.llmm_u2.js +31 -0
- package/dist/web/_next/static/chunks/145qu5b0tgm9w.js +1 -0
- package/dist/web/_next/static/chunks/{turbopack-0kcwat8.leugk.js → turbopack-0lrdxynxb9-1t.js} +1 -1
- package/dist/web/_not-found/__next._full.txt +30 -34
- package/dist/web/_not-found/__next._head.txt +4 -4
- package/dist/web/_not-found/__next._index.txt +13 -17
- package/dist/web/_not-found/__next._not-found.__PAGE__.txt +2 -2
- package/dist/web/_not-found/__next._not-found.txt +3 -3
- package/dist/web/_not-found/__next._tree.txt +2 -2
- package/dist/web/_not-found.html +1 -1
- package/dist/web/_not-found.txt +30 -34
- package/dist/web/index.html +1 -1
- package/dist/web/index.txt +27 -31
- package/dist/web/login/__next._full.txt +30 -35
- package/dist/web/login/__next._head.txt +4 -4
- package/dist/web/login/__next._index.txt +13 -17
- package/dist/web/login/__next._tree.txt +2 -2
- package/dist/web/login/__next.login.__PAGE__.txt +4 -4
- package/dist/web/login/__next.login.txt +3 -3
- package/dist/web/login.html +1 -1
- package/dist/web/login.txt +30 -35
- package/dist/web/settings/__next._full.txt +31 -36
- package/dist/web/settings/__next._head.txt +4 -4
- package/dist/web/settings/__next._index.txt +13 -17
- package/dist/web/settings/__next._tree.txt +2 -2
- package/dist/web/settings/__next.settings.__PAGE__.txt +4 -4
- package/dist/web/settings/__next.settings.txt +5 -5
- package/dist/web/settings/agents/__next._full.txt +35 -39
- package/dist/web/settings/agents/__next._head.txt +4 -4
- package/dist/web/settings/agents/__next._index.txt +13 -17
- package/dist/web/settings/agents/__next._tree.txt +2 -2
- package/dist/web/settings/agents/__next.settings.agents.__PAGE__.txt +4 -4
- package/dist/web/settings/agents/__next.settings.agents.txt +3 -3
- package/dist/web/settings/agents/__next.settings.txt +5 -5
- package/dist/web/settings/agents.html +1 -1
- package/dist/web/settings/agents.txt +35 -39
- package/dist/web/settings/mcps/__next._full.txt +35 -39
- package/dist/web/settings/mcps/__next._head.txt +4 -4
- package/dist/web/settings/mcps/__next._index.txt +13 -17
- package/dist/web/settings/mcps/__next._tree.txt +2 -2
- package/dist/web/settings/mcps/__next.settings.mcps.__PAGE__.txt +4 -4
- package/dist/web/settings/mcps/__next.settings.mcps.txt +3 -3
- package/dist/web/settings/mcps/__next.settings.txt +5 -5
- package/dist/web/settings/mcps.html +1 -1
- package/dist/web/settings/mcps.txt +35 -39
- package/dist/web/settings/models/__next._full.txt +35 -39
- package/dist/web/settings/models/__next._head.txt +4 -4
- package/dist/web/settings/models/__next._index.txt +13 -17
- package/dist/web/settings/models/__next._tree.txt +2 -2
- package/dist/web/settings/models/__next.settings.models.__PAGE__.txt +4 -4
- package/dist/web/settings/models/__next.settings.models.txt +3 -3
- package/dist/web/settings/models/__next.settings.txt +5 -5
- package/dist/web/settings/models.html +1 -1
- package/dist/web/settings/models.txt +35 -39
- package/dist/web/settings/providers/__next._full.txt +35 -39
- package/dist/web/settings/providers/__next._head.txt +4 -4
- package/dist/web/settings/providers/__next._index.txt +13 -17
- package/dist/web/settings/providers/__next._tree.txt +2 -2
- package/dist/web/settings/providers/__next.settings.providers.__PAGE__.txt +4 -4
- package/dist/web/settings/providers/__next.settings.providers.txt +3 -3
- package/dist/web/settings/providers/__next.settings.txt +5 -5
- package/dist/web/settings/providers.html +1 -1
- package/dist/web/settings/providers.txt +35 -39
- package/dist/web/settings/skills/__next._full.txt +35 -39
- package/dist/web/settings/skills/__next._head.txt +4 -4
- package/dist/web/settings/skills/__next._index.txt +13 -17
- package/dist/web/settings/skills/__next._tree.txt +2 -2
- package/dist/web/settings/skills/__next.settings.skills.__PAGE__.txt +4 -4
- package/dist/web/settings/skills/__next.settings.skills.txt +3 -3
- package/dist/web/settings/skills/__next.settings.txt +5 -5
- package/dist/web/settings/skills.html +1 -1
- package/dist/web/settings/skills.txt +35 -39
- package/dist/web/settings.html +1 -1
- package/dist/web/settings.txt +31 -36
- package/dist/web/workflows/__next._full.txt +32 -36
- package/dist/web/workflows/__next._head.txt +4 -4
- package/dist/web/workflows/__next._index.txt +13 -17
- package/dist/web/workflows/__next._tree.txt +2 -2
- package/dist/web/workflows/__next.workflows.__PAGE__.txt +4 -4
- package/dist/web/workflows/__next.workflows.txt +3 -3
- package/dist/web/workflows.html +1 -1
- package/dist/web/workflows.txt +32 -36
- package/dist/web/workspace/_/__next._full.txt +34 -39
- package/dist/web/workspace/_/__next._head.txt +4 -4
- package/dist/web/workspace/_/__next._index.txt +13 -17
- package/dist/web/workspace/_/__next._tree.txt +2 -2
- package/dist/web/workspace/_/__next.workspace.$d$id.__PAGE__.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.$d$id.txt +3 -3
- package/dist/web/workspace/_/__next.workspace.txt +3 -3
- package/dist/web/workspace/_.html +1 -1
- package/dist/web/workspace/_.txt +34 -39
- package/dist/web/workspaces/__next._full.txt +31 -35
- package/dist/web/workspaces/__next._head.txt +4 -4
- package/dist/web/workspaces/__next._index.txt +13 -17
- package/dist/web/workspaces/__next._tree.txt +2 -2
- package/dist/web/workspaces/__next.workspaces.__PAGE__.txt +4 -4
- package/dist/web/workspaces/__next.workspaces.txt +3 -3
- package/dist/web/workspaces.html +1 -1
- package/dist/web/workspaces.txt +31 -35
- package/dist/ws/agent-runner.js +6 -2
- package/dist/ws/message-parts.js +2 -2
- package/package.json +1 -1
- package/dist/web/_next/static/chunks/0-mtp2au0a0nh.js +0 -189
- package/dist/web/_next/static/chunks/00amm3dvu3po9.js +0 -31
- package/dist/web/_next/static/chunks/0e~0o6v_awcod.js +0 -1
- package/dist/web/_next/static/chunks/0fpf.rso9mhc0.js +0 -1
- package/dist/web/_next/static/chunks/0glol5jdarfma.js +0 -2
- package/dist/web/_next/static/chunks/0m1ud--um8kjh.js +0 -1
- package/dist/web/_next/static/chunks/0o6w-uw2p.phy.js +0 -5
- package/dist/web/_next/static/chunks/0os7q6w~-tmg7.css +0 -1
- package/dist/web/_next/static/chunks/0vesz93a98px4.js +0 -1
- package/dist/web/_next/static/chunks/0xtmr0y4vo-~p.js +0 -1
- package/dist/web/_next/static/chunks/0~3uikgc074il.js +0 -1
- package/dist/web/_next/static/chunks/11ozf700niy2z.js +0 -1
- /package/dist/web/_next/static/{4dBAEZ275uRqcyeaRmXSx → gN3O86ki0NGTvGTqE2Ibh}/_buildManifest.js +0 -0
- /package/dist/web/_next/static/{4dBAEZ275uRqcyeaRmXSx → gN3O86ki0NGTvGTqE2Ibh}/_clientMiddlewareManifest.js +0 -0
- /package/dist/web/_next/static/{4dBAEZ275uRqcyeaRmXSx → gN3O86ki0NGTvGTqE2Ibh}/_ssgManifest.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
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)},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,C]=(0,s.useState)(null),[S,z]=(0,s.useState)(!1),[T,D]=(0,s.useState)(!1),[$,I]=(0,s.useState)(null);(0,s.useEffect)(()=>{e&&(z(!0),I(null),j().finally(()=>z(!1)))},[e,j]);let A=()=>{w(null),C(null)},M=()=>{w(null),C({name:"",apiBase:"",apiKey:""})},P=async()=>{if(b&&b.name){D(!0),I(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),A()}catch{I(m("error.saveFailed"))}finally{D(!1)}}},B=async e=>{if(confirm(m("confirm.delete"))){D(!0);try{if(!(await fetch(`/api/providers/${e}`,{method:"DELETE"})).ok)throw Error();N(e),k?.id===e&&A()}catch{I(m("error.deleteFailed"))}finally{D(!1)}}},O=(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:A,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:M,className:"mr-6",children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),m("dialog.add")]})]}),c&&!b&&(0,t.jsx)("div",{className:"flex items-center justify-end px-5 py-3 border-b",children:(0,t.jsxs)(n.Button,{variant:"outline",size:"sm",onClick:M,children:[(0,t.jsx)(d.Plus,{className:"size-3.5"}),m("dialog.add")]})}),c&&b&&(0,t.jsxs)("div",{className:"flex items-center gap-3 px-5 py-3 border-b",children:[(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",onClick:A,children:(0,t.jsx)(o.ArrowLeft,{className:"size-4"})}),(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("h2",{className:"text-base font-medium truncate",children:k?m("dialog.editTitle"):m("dialog.addTitle")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:m("dialog.editDescription")})]})]}),(0,t.jsxs)("div",{className:"flex-1 overflow-y-auto",children:[$&&(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:$}),S?(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)=>{C(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),C({...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:A,disabled:T,children:u("cancel")}),(0,t.jsx)(n.Button,{size:"sm",onClick:P,disabled:T||!b.name,children:u(T?"saving":"save")})]})]});return c?(0,t.jsx)("div",{className:"h-full flex flex-col",children:O}):(0,t.jsx)(i.Dialog,{open:e,onOpenChange:e=>{e||A(),l(e)},children:(0,t.jsx)(i.DialogContent,{className:"sm:max-w-2xl max-h-[85vh] flex flex-col p-0 gap-0",children:O})})}])},515104,e=>{"use strict";function t(){return"__FLUTTER_INTERNALS__"in window}function s(){return t()&&"u">typeof navigator&&/android/i.test(navigator.userAgent)}async function a(){return t()?d():"Notification"in window?o(Notification.permission):"unsupported"}async function i(){return t()?m():r()}async function n(e,s,a={}){var i,l;return t()?u(e,s):(i=e,l=s,void("Notification"in window&&"granted"===Notification.permission&&new Notification(i,{body:l,icon:"/favicon.ico"})))}async function l(e){if(s())return n("Agent Spaces",e,{id:10001,ongoing:!0})}async function r(){return"Notification"in window?o(await Notification.requestPermission()):"unsupported"}function o(e){switch(e){case"granted":return"granted";case"denied":return"denied";default:return"default"}}function c(){return window.__flutterBridge??null}async function d(){try{let e=c();if(!e)return"unsupported";let t=await e.invoke("getNotificationPermission",null);return!0===t?"granted":"default"}catch{return"unsupported"}}async function m(){try{let e=c();if(!e)return"unsupported";let t=await e.invoke("requestNotificationPermission",null);return!0===t?"granted":"denied"}catch{return"unsupported"}}async function u(e,t){try{let s=c();if(!s)return;await s.invoke("sendNotification",{title:e,body:t})}catch{}}e.s(["getNotificationPermission",0,a,"isFlutterEnvironment",0,t,"isNativeAndroidEnvironment",0,s,"isNativeEnvironment",0,function(){return t()},"requestNotificationPermission",0,i,"sendAndroidOngoingTaskNotification",0,l,"sendNativeNotification",0,n])},437122,233297,286117,e=>{"use strict";var t=e.i(523592);function s(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}`:""}`}function a(e){return"/index.html"===e?"/":e.endsWith(".html")?e.slice(0,-5):e}function i(e){return"/login"===a(e)}e.i(8890),e.i(515104),e.s(["tauriNavigate",0,function(e,t,a=!1){t=s(t),a?window.location.replace(t):window.location.href=t},"toStaticHref",0,s],233297),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(){return`${n}:${(0,t.loadActiveId)()}`}function o(){let e=localStorage.getItem(r());if(null!==e)return e;let s=(0,t.getActiveServer)()?.secret;return void 0!==s?s:null}function c(){localStorage.removeItem(r()),localStorage.removeItem(l)}function d(){let e=o();return null===e?{}:{Authorization:`Bearer ${e}`}}async function m(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={...d(),...a?.headers},r=await fetch(n,{...a,headers:l});return(401===r.status||403===r.status)&&(c(),i(window.location.pathname)||window.location.replace(s("/login"))),r}e.s(["authHeaders",0,d,"fetchWithAuth",0,m,"getToken",0,o,"isAuthenticated",0,function(){return"1"===localStorage.getItem(l)},"removeToken",0,c,"setToken",0,function(e){localStorage.setItem(r(),e),localStorage.setItem(l,"1"),localStorage.removeItem(n)}],437122)},962562,995684,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(["default",0,t],995684),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(788010),r=e.i(344118),o=e.i(962562),c=e.i(953700),d=e.i(100559),m=e.i(137340);let u=(0,e.i(433721).default)("wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);var x=e.i(244073);e.s(["ServerManagerDialog",0,function({open:e,onOpenChange:h,servers:p,activeId:f,onUpdate:g,onRemove:j,onSwitch:v}){let y=(0,x.useTranslations)("sidebar"),N=(0,x.useTranslations)("common"),[k,w]=s.useState(null),[b,C]=s.useState(""),[S,z]=s.useState(""),[T,D]=s.useState(""),[$,I]=s.useState(""),[A,M]=s.useState(""),[P,B]=s.useState(""),[O,L]=s.useState(""),[U,E]=s.useState(null),F=()=>{w(null),C(""),z(""),D("")},H=()=>{if(!b.trim()||!S.trim())return;let e=S.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),g(p.map(t=>t.id===k?{...t,name:b.trim(),url:e,secret:T.trim()||void 0}:t)),F()},R=s.useCallback(e=>{console.log(`[server-diagnostic] ${e}`),L(t=>`${t}${t?"\n":""}${e}`)},[]),_=async e=>{E(e.id),L("");let t=e.url.replace(/\/$/,""),s=`${t}/api/health`,a=new URL("/ws",t);a.protocol="https:"===a.protocol?"wss:":"ws:",a.searchParams.set("workspaceId","__diagnostic__"),a.searchParams.set("token",e.secret||"__diagnostic__"),R(`time: ${new Date().toISOString()}`),R(`window.origin: ${window.location.origin}`),R(`window.href: ${window.location.href}`),R(`navigator.onLine: ${navigator.onLine}`),R(`target: ${t}`),R(`health: ${s}`);let i=performance.now();try{let e=new AbortController,t=window.setTimeout(()=>e.abort(),1e4),a=await fetch(s,{method:"GET",cache:"no-store",mode:"cors",signal:e.signal});window.clearTimeout(t);let n=await a.text();R(`fetch /api/health: OK ${a.status} ${a.statusText} (${Math.round(performance.now()-i)}ms)`),R(`fetch response: ${n.slice(0,500)||"<empty>"}`)}catch(t){let e=t instanceof Error?t:Error(String(t));R(`fetch /api/health: FAILED ${e.name}: ${e.message} (${Math.round(performance.now()-i)}ms)`)}R(`websocket: ${a.toString()}`),await new Promise(e=>{let t=performance.now(),s=!1,i=(a,i)=>{if(!s){s=!0,R(`${a} (${Math.round(performance.now()-t)}ms)`);try{i?.close()}catch{}e()}};try{let e=new WebSocket(a.toString()),t=window.setTimeout(()=>i("websocket: TIMEOUT",e),1e4);e.onopen=()=>{window.clearTimeout(t),i("websocket: OPEN",e)},e.onerror=()=>{window.clearTimeout(t),i("websocket: ERROR",e)},e.onclose=s=>{window.clearTimeout(t),i(`websocket: CLOSE code=${s.code} reason=${s.reason||"<empty>"}`,e)}}catch(t){let e=t instanceof Error?t:Error(String(t));i(`websocket: FAILED ${e.name}: ${e.message}`)}}),E(null)};return(0,t.jsx)(a.Dialog,{open:e,onOpenChange:e=>{h(e),e||F()},children:(0,t.jsxs)(a.DialogContent,{className:"max-w-md",children:[(0,t.jsxs)(a.DialogHeader,{children:[(0,t.jsx)(a.DialogTitle,{children:y("server.manageServers")}),(0,t.jsx)(a.DialogDescription,{children:y("server.manageDescription")})]}),(0,t.jsx)("div",{className:"space-y-1",children:p.map(e=>(0,t.jsxs)("div",{className:"flex items-center gap-3 rounded-md border px-3 py-2",children:[(0,t.jsx)(d.Server,{className:"size-4 shrink-0 text-muted-foreground"}),k===e.id?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-1",value:b,onChange:e=>C(e.target.value),placeholder:"Name",autoFocus:!0}),(0,t.jsx)(n.Input,{className:"h-7 text-sm flex-[1.5]",value:S,onChange:e=>z(e.target.value),placeholder:"http://...",onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:H,className:"h-7 px-2",children:N("save")}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:F,className:"h-7 px-2",children:N("cancel")})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>{e.id!==f&&v(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===f?(0,t.jsx)(r.Check,{className:"size-4 shrink-0 text-primary"}):(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",onClick:()=>v(e),className:"h-7 px-2 text-xs shrink-0",children:y("server.switch")}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>_(e)}),(0,t.jsx)(o.Pencil,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-foreground",onClick:()=>{w(e.id),C(e.name),z(e.url),D(e.secret||"")}}),"default"!==e.id&&(0,t.jsx)(m.Trash2,{className:"size-3.5 shrink-0 text-muted-foreground cursor-pointer hover:text-destructive",onClick:()=>j(e.id)})]})]})]},e.id))}),null===k&&(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:y("server.newServer")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(n.Input,{className:"h-8 text-sm",value:$,onChange:e=>I(e.target.value),placeholder:"Name"}),(0,t.jsx)(i.Button,{size:"sm",onClick:()=>{if(!$.trim()||!A.trim())return;let e=A.trim().replace(/\/$/,"");/^https?:\/\//.test(e)||(e="http://"+e),g([...p,{id:Date.now().toString(),name:$.trim(),url:e,secret:P.trim()||void 0}]),I(""),M(""),B("")},disabled:!$.trim()||!A.trim(),children:(0,t.jsx)(c.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:A,onChange:e=>M(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:P,onChange:e=>B(e.target.value),placeholder:y("server.secretOptionalPlaceholder"),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()})})]}),(0,t.jsxs)("div",{className:"border-t pt-3 mt-2 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("div",{className:"text-xs font-medium text-muted-foreground",children:"Network diagnostics"}),(0,t.jsx)(i.Button,{size:"sm",variant:"ghost",className:"h-7 px-2 text-xs",disabled:!p.find(e=>e.id===f)||null!==U,onClick:()=>{let e=p.find(e=>e.id===f);e&&_(e)},children:U?"Testing...":"Test active"})]}),(0,t.jsx)(l.Textarea,{readOnly:!0,value:O||"Tap the Wi-Fi icon next to a server, or use Test active.",className:"h-36 resize-none font-mono text-[11px]"})]})]})})}],894920)},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 C=(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:S}){let z=(0,a.useTranslations)("mcps"),T=(0,a.useTranslations)("common"),[D,$]=(0,s.useState)([]),[I,A]=(0,s.useState)([]),[M,P]=(0,s.useState)(!1),[B,O]=(0,s.useState)(""),[L,U]=(0,s.useState)("all"),[E,F]=(0,s.useState)(""),[H,R]=(0,s.useState)(!1),[_,J]=(0,s.useState)(""),[q,W]=(0,s.useState)(""),[V,K]=(0,s.useState)(null),[G,X]=(0,s.useState)([]),[Q,Y]=(0,s.useState)(null),[Z,ee]=(0,s.useState)(""),et=(0,s.useCallback)(async()=>{P(!0);try{let e=await fetch("/api/mcps");e.ok&&$(await e.json())}catch{}P(!1)},[]),es=(0,s.useCallback)(async()=>{try{let e=await fetch("/api/agents/presets");if(e.ok){let t=await e.json();A(t.map(e=>({id:e.id,name:e.name,avatarUrl:e.avatarUrl,description:e.description})))}}catch{}},[]);(0,s.useEffect)(()=>{(e||S)&&(et(),es())},[e,S,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();$(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},ei=async()=>{W("");try{JSON.parse(_)}catch{W(z("importInvalidJson"));return}try{let e=await fetch("/api/mcps/import",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonText:_})});if(e.ok)J(""),R(!1),et();else{let t=await e.json();W(t.error||z("importFailed"))}}catch{W(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&&($(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&&$(t=>t.filter(t=>t.name!==e.name))}catch{}},er=async()=>{if(V){for(let e of I){let t=V.boundAgents.some(t=>t.id===e.id),s=G.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=>{X(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},ec=D.filter(e=>{if(B){let t=B.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.description.toLowerCase().includes(t))return!1}return("favorites"!==L||!!e.favorited)&&("agent"!==L||!E||!!e.boundAgents.some(e=>e.id===E))}),ed=(S||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:[S?(0,t.jsx)("h2",{className:"text-base font-semibold",children:z("title")}):(0,t.jsx)(n.DialogTitle,{children:z("title")}),S?(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:_,onChange:e=>{J(e.target.value),W("")},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"}),q&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:q}),(0,t.jsx)(l.Button,{size:"sm",onClick:ei,disabled:!_.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"===L?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{U("all"),F("")},children:[(0,t.jsx)(j,{className:"size-3.5 mr-1.5"}),z("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===L?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{U("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3.5 mr-1.5"}),z("filterFavorites")]})]}),I.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:I.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===L&&E===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{U("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:B,onChange:e=>O(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"===L?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{U("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"===L?"bg-muted":"text-muted-foreground hover:text-foreground"),onClick:()=>{U("favorites"),F("")},children:[(0,t.jsx)(h.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),z("filterFavorites")]})]}),I.length>0&&(0,t.jsx)(u.SearchSelect,{value:"agent"===L?E:"",onChange:e=>{e?(U("agent"),F(e)):(U("all"),F(""))},options:I.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:B,onChange:e=>O(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:T("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),X(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:[S&&ed&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:em}),!S&&(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"}),T("save")]})]})}),(0,t.jsx)("div",{className:"flex-1 min-h-0 pt-2",children:(0,t.jsx)(C,{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:I.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",G.includes(e.id)?"bg-primary border-primary text-primary-foreground":"border-input")})]},e.id))}),G.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:G.map(e=>{let s=I.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:T("cancel")}),(0,t.jsx)(l.Button,{onClick:er,children:T("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(460578),u=e.i(188815),x=e.i(611176),h=e.i(255742),p=e.i(973767),f=e.i(129981),g=e.i(887354),j=e.i(989484),v=e.i(972846),y=e.i(401058),N=e.i(137340),k=e.i(977694),w=e.i(111343),b=e.i(601039),C=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(["SkillsDialog",0,function({open:e,onOpenChange:i,standalone:z}){let T=(0,a.useTranslations)("skills"),D=(0,a.useTranslations)("common"),[$,I]=(0,s.useState)([]),[A,M]=(0,s.useState)([]),[P,B]=(0,s.useState)(!1),[O,L]=(0,s.useState)(""),[U,E]=(0,s.useState)("all"),[F,H]=(0,s.useState)(""),[R,_]=(0,s.useState)(!1),[J,q]=(0,s.useState)([]),[W,V]=(0,s.useState)(null),[K,G]=(0,s.useState)([]),[X,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()=>{B(!0);try{let e=await fetch("/api/skills");e.ok&&I(await e.json())}catch{}B(!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||z)&&(eo(),ec())},[e,z,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();I(t=>t.map(t=>t.name===e.name?{...t,favorited:s}:t))}}catch{}},em=async()=>{for(let e of J){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})})}q([]),_(!1),eo()},eu=async()=>{if(X)try{(await fetch(`/api/skills/${encodeURIComponent(X.name)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:Y})})).ok&&(I(e=>e.map(e=>e.name===X.name?{...e,content:Y}:e)),Q(null))}catch{}},ex=async e=>{try{(await fetch(`/api/skills/${encodeURIComponent(e.name)}`,{method:"DELETE"})).ok&&I(t=>t.filter(t=>t.name!==e.name))}catch{}},eh=async()=>{if(W){for(let e of A){let t=W.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,"")!==W.name);console.log("[skills] remove skill",W.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(W.name)){let t=[...s.skills||[],`${W.name}.md`];console.log("[skills] add skill",W.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=>{G(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=$.filter(e=>{if(O){let t=O.toLowerCase();if(!e.name.toLowerCase().includes(t)&&!e.content.toLowerCase().includes(t))return!1}return("favorites"!==U||!!e.favorited)&&("agent"!==U||!F||!!e.boundAgents.some(e=>e.id===F))}),ev=(z||e)&&!W&&!X,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:[z?(0,t.jsx)("h2",{className:"text-base font-semibold",children:T("title")}):(0,t.jsx)(n.DialogTitle,{children:T("title")}),z?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:T("description")}):(0,t.jsx)(n.DialogDescription,{children:T("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)(b.RefreshCw,{className:(0,C.cn)("size-3.5 mr-1",el&&"animate-spin")}),T("syncToAgents")]}),(0,t.jsxs)(d.Popover,{open:R,onOpenChange:_,children:[(0,t.jsx)(d.PopoverTrigger,{render:(0,t.jsxs)(l.Button,{variant:"outline",size:"sm",children:[(0,t.jsx)(f.Upload,{className:"size-3.5 mr-1"}),T("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:T("importTitle")}),(0,t.jsx)(m.FileUpload,{value:J,onChange:q,accept:{"text/markdown":[".md"],"":[".md"]},placeholder:T("importPlaceholder"),maxFiles:10}),(0,t.jsx)(l.Button,{size:"sm",onClick:em,disabled:0===J.length,className:"w-full",children:T("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:()=>{E("all"),H("")},children:[(0,t.jsx)(j.FileText,{className:"size-3.5 mr-1.5"}),T("filterAll")]}),(0,t.jsxs)(l.Button,{variant:"favorites"===U?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("favorites"),H("")},children:[(0,t.jsx)(h.Star,{className:"size-3.5 mr-1.5"}),T("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:T("filterByAgent")}),(0,t.jsx)(o.ScrollArea,{className:"max-h-48",children:A.map(e=>(0,t.jsxs)(l.Button,{variant:"agent"===U&&F===e.id?"secondary":"ghost",size:"sm",className:"w-full justify-start",onClick:()=>{E("agent"),H(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:O,onChange:e=>L(e.target.value),placeholder:T("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,C.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:()=>{E("all"),H("")},children:T("filterAll")}),(0,t.jsxs)("button",{type:"button",className:(0,C.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:()=>{E("favorites"),H("")},children:[(0,t.jsx)(h.Star,{className:"size-3 inline-block mr-0.5 -mt-px"}),T("filterFavorites")]})]}),A.length>0&&(0,t.jsx)(u.SearchSelect,{value:"agent"===U?F:"",onChange:e=>{e?(E("agent"),H(e)):(E("all"),H(""))},options:A.map(e=>({value:e.id,label:e.name})),placeholder:T("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:O,onChange:e=>L(e.target.value),placeholder:T("search"),className:"pl-8"})]}),(0,t.jsx)(o.ScrollArea,{className:"flex-1",children:P?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:D("loading")}):0===ej.length?(0,t.jsx)("div",{className:"flex items-center justify-center py-12 text-muted-foreground text-sm",children:T("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)(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.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),G(e.boundAgents.map(e=>e.id))},children:[(0,t.jsx)(k.Rocket,{className:"size-3.5 mr-1"}),T("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)(y.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)(N.Trash2,{className:"size-3.5 mr-1.5"}),T("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:[z&&ev&&(0,t.jsx)("div",{className:"h-full flex flex-col",children:ey}),!z&&(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:!!X,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:T("editTitle",{name:X?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:T("editDescription")})]}),(0,t.jsxs)(l.Button,{size:"sm",onClick:eu,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:"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:!!W,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:T("bindTitle",{name:W?.name||""})}),(0,t.jsx)(n.DialogDescription,{children:T("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:()=>ep(e.id),className:(0,C.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,C.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=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:()=>ep(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:()=>V(null),children:D("cancel")}),(0,t.jsx)(l.Button,{onClick:eh,children:D("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:T("syncTitle")}),(0,t.jsx)(n.DialogDescription,{children:T("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:T("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,C.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)(x.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:D("cancel")}),(0,t.jsx)(l.Button,{onClick:eg,disabled:0===es.size,children:T("syncConfirm")})]})]})]})})]})}])},863812,e=>{e.v(t=>Promise.all(["static/chunks/168ojsxhm7ypc.js"].map(t=>e.l(t))).then(()=>t(158480)))},930010,e=>{e.v(e=>Promise.resolve().then(()=>e(360112)))}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,523592,e=>{"use strict";var t=e.i(8890);let a="agent-spaces-servers",r="agent-spaces-active-server",n="active-server";function s(){let e=t.default.env.NEXT_PUBLIC_SERVER_URL?.trim();if(e)return e.replace(/\/$/,"");let{hostname:a,port:r}=window.location;return("localhost"===a||"127.0.0.1"===a)&&"3000"===r?`http://${a}:3100`:window.location.origin}let i=[{id:"default",name:"Default",url:s()}];function o(){try{let e=localStorage.getItem(a);return e?JSON.parse(e).map(e=>"default"!==e.id||e.url?e:{...e,url:s()}):i}catch{return i}}function l(){return localStorage.getItem(r)||"default"}function d(){let e=o(),t=l();return e.find(e=>e.id===t)||e[0]||null}function c(){return d()?.url??null}e.s(["getActiveServer",0,d,"getActiveServerUrl",0,c,"loadActiveId",0,l,"loadServers",0,o,"resolveServerAssetUrl",0,function(e){if(!e)return"";if(/^(?:[a-z][a-z\d+\-.]*:)?\/\//i.test(e)||e.startsWith("data:")||e.startsWith("blob:"))return e;let t=c();return t?`${t.replace(/\/$/,"")}${e.startsWith("/")?"":"/"}${e}`:e},"saveActiveId",0,function(e){localStorage.setItem(r,e)},"saveServers",0,function(e){localStorage.setItem(a,JSON.stringify(e))},"setActiveServerCookie",0,function(e){e?document.cookie=`${n}=${encodeURIComponent(e)}; path=/; max-age=31536000; SameSite=Lax`:document.cookie=`${n}=; path=/; max-age=0`}])},344118,50153,e=>{"use strict";let t=(0,e.i(433721).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);e.s(["default",0,t],50153),e.s(["Check",0,t],344118)},355819,e=>{"use strict";let t=(0,e.i(816709).create)((e,t)=>({agents:[],loaded:!1,loading:!1,ensure:async()=>{let{loaded:a,loading:r}=t();if(!a&&!r){e({loading:!0});try{let t=await fetch("/api/agents/presets");if(!t.ok)return;let a=await t.json();e({agents:a,loaded:!0})}catch{}finally{e({loading:!1})}}},toggleEnabled:async a=>{let r=t().agents.find(e=>e.id===a);if(!r)return;let n=!r.enabled;e(e=>({agents:e.agents.map(e=>e.id===a?{...e,enabled:n}:e)}));try{(await fetch(`/api/agents/presets/${a}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({...r,enabled:n})})).ok||e(e=>({agents:e.agents.map(e=>e.id===a?{...e,enabled:r.enabled}:e)}))}catch{e(e=>({agents:e.agents.map(e=>e.id===a?{...e,enabled:r.enabled}:e)}))}}}));e.s(["findAgentById",0,function(e){return t.getState().agents.find(t=>t.id===e)},"useAgentStore",0,t])},942917,e=>{"use strict";let t=(0,e.i(433721).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["default",0,t])},972846,e=>{"use strict";var t=e.i(912248);e.s(["X",()=>t.default])},451534,680422,e=>{"use strict";let t=(0,e.i(433721).default)("folder-open",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);e.s(["default",0,t],680422),e.s(["FolderOpen",0,t],451534)},193251,e=>{"use strict";let t=(0,e.i(433721).default)("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);e.s(["Download",0,t],193251)},411649,e=>{"use strict";let t=(0,e.i(433721).default)("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]]);e.s(["Home",0,t],411649)},62669,e=>{"use strict";let t=(0,e.i(433721).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);e.s(["Loader2",0,t],62669)},511800,612505,e=>{"use strict";let t=(0,e.i(433721).default)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);e.s(["default",0,t],612505),e.s(["AlertCircle",0,t],511800)},550080,e=>{"use strict";var t=e.i(144988);e.s(["File",()=>t.default])},220336,e=>{"use strict";let t=(0,e.i(433721).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["default",0,t])},973370,e=>{"use strict";var t=e.i(220336);e.s(["Folder",()=>t.default])},992764,e=>{"use strict";var t=e.i(942917);e.s(["ChevronRight",()=>t.default])},378371,e=>{"use strict";let t=(0,e.i(433721).default)("arrow-up",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);e.s(["ArrowUp",0,t],378371)},198699,e=>{"use strict";let t=(0,e.i(433721).default)("folder-plus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["FolderPlus",0,t],198699)},434805,660748,e=>{"use strict";var t,a=e.i(344180),r=e.i(764556),n=e.i(244073),s=e.i(550080),i=e.i(973370),o=e.i(451534),l=e.i(992764),d=e.i(378371),c=e.i(411649),u=e.i(62669),m=e.i(198699),h=e.i(344118),p=e.i(972846),f=e.i(433721);let g=(0,f.default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]),x=(0,f.default)("shield-alert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]),y=(0,f.default)("shield-off",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);var b=e.i(465458),v=e.i(681622);e.s(["FolderPicker",0,function({value:e,onChange:t,className:f,placeholder:j="/path/to/project",allowFiles:w=!1,fileFilter:k}){let[N,C]=(0,r.useState)(!1),[M,S]=(0,r.useState)(e||""),[D,F]=(0,r.useState)([]),[P,W]=(0,r.useState)([]),z=(0,n.useTranslations)("folderPicker"),[A,T]=(0,r.useState)(null),[R,I]=(0,r.useState)(!1),[E,O]=(0,r.useState)(""),[$,H]=(0,r.useState)(!1),[L,U]=(0,r.useState)(""),[J,V]=(0,r.useState)(null),[B,q]=(0,r.useState)(!1),X=(0,r.useRef)(null),Y=(0,r.useRef)(null),K=(0,r.useRef)(null),Q=(0,r.useCallback)(async e=>{if(!e)return void V(null);q(!0);try{let t=await fetch(`/api/folder/check-permissions?path=${encodeURIComponent(e)}`);if(!t.ok)return void V(null);let a=await t.json();V(a)}catch{V(null)}finally{q(!1)}},[]),G=(0,r.useCallback)(async e=>{I(!0),O("");try{let t=`/api/folder/browse?path=${encodeURIComponent(e)}`;w&&(t+="&files=1",k&&(t+=`&fileFilter=${encodeURIComponent(k)}`));let a=await fetch(t);if(!a.ok)throw Error((await a.json()).error||"Failed to browse");let r=await a.json();S(r.path),F(r.directories),W(r.files??[]),T(r.parent),Q(r.path)}catch(e){O(e.message)}finally{I(!1)}},[Q,w,k]);(0,r.useEffect)(()=>{N&&G(e||"")},[N]),(0,r.useEffect)(()=>{$&&K.current&&K.current.focus()},[$]);let _=e=>{G(e)},Z=async()=>{let e=L.trim();if(!e)return;let a=M.includes("/")?"/":"\\",r=M?`${M}${a}${e}`:e;try{let e=await fetch("/api/folder/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:r})});if(!e.ok)throw Error((await e.json()).error||"Failed to create folder");H(!1),U(""),t(r),S(r),C(!1)}catch(e){O(e.message)}},ee=D.length>0||P.length>0;return(0,a.jsxs)("div",{className:(0,b.cn)("relative",f),children:[(0,a.jsxs)("div",{className:"flex gap-1.5",children:[(0,a.jsx)(v.Input,{className:"rounded-xl py-2.5",placeholder:j,value:e,onChange:e=>{t(e.target.value)},onKeyDown:t=>{"Enter"===t.key&&(t.preventDefault(),G(e))},ref:X}),(0,a.jsxs)("button",{type:"button",onClick:()=>{N?(C(!1),H(!1),U("")):C(!0)},className:(0,b.cn)("flex items-center gap-1.5 rounded-xl border px-3 py-2.5 text-sm transition-colors",N?"border-primary bg-primary/5 text-primary":"border-border bg-background text-muted-foreground hover:bg-accent hover:text-accent-foreground"),children:[(0,a.jsx)(o.FolderOpen,{className:"size-4"}),"Browse"]})]}),N&&(0,a.jsxs)("div",{className:"absolute left-0 right-0 top-full z-50 mt-1 flex flex-col rounded-xl border border-border bg-popover shadow-lg",style:{height:360},children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 border-b border-border px-3 py-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>_(""),className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",title:"Home",children:(0,a.jsx)(c.Home,{className:"size-3.5"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{A&&G(A)},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",title:"Go up",children:(0,a.jsx)(d.ArrowUp,{className:"size-3.5"})}),(0,a.jsx)(v.Input,{className:"truncate bg-muted text-xs text-muted-foreground font-mono focus-visible:bg-background h-7",value:M,onChange:e=>S(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),G(M))}}),(0,a.jsx)("button",{type:"button",onClick:()=>{H(!0),U("")},className:"flex size-7 items-center justify-center rounded-md hover:bg-accent transition-colors",title:z("newFolder"),children:(0,a.jsx)(m.FolderPlus,{className:"size-3.5"})}),!w&&(0,a.jsx)("button",{type:"button",onClick:()=>{t(M),C(!1)},className:"rounded-lg bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:z("select")})]}),$&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 border-b border-border px-3 py-1.5",children:[(0,a.jsx)(m.FolderPlus,{className:"size-4 text-muted-foreground shrink-0"}),(0,a.jsx)(v.Input,{ref:K,className:"flex-1 h-7 text-sm",placeholder:z("folderNamePlaceholder"),value:L,onChange:e=>U(e.target.value),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),Z()):"Escape"===e.key&&(H(!1),U(""))}}),(0,a.jsx)("button",{type:"button",onClick:Z,className:"flex size-6 items-center justify-center rounded-md hover:bg-accent transition-colors",disabled:!L.trim(),children:(0,a.jsx)(h.Check,{className:"size-3.5 text-primary"})}),(0,a.jsx)("button",{type:"button",onClick:()=>{H(!1),U("")},className:"flex size-6 items-center justify-center rounded-md hover:bg-accent transition-colors",children:(0,a.jsx)(p.X,{className:"size-3.5 text-muted-foreground"})})]}),(0,a.jsx)("div",{ref:Y,className:"flex-1 overflow-y-auto p-1.5",children:R?(0,a.jsxs)("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:[(0,a.jsx)(u.Loader2,{className:"size-4 animate-spin mr-2"}),"Loading..."]}):E?(0,a.jsx)("div",{className:"px-3 py-8 text-center text-xs text-destructive",children:E}):ee?(0,a.jsxs)(a.Fragment,{children:[D.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>_(e.path),onDoubleClick:()=>{t(e.path),C(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm hover:bg-accent transition-colors text-left",children:[(0,a.jsx)(i.Folder,{className:"size-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"flex-1 truncate",children:e.name}),(0,a.jsx)(l.ChevronRight,{className:"size-3 text-muted-foreground shrink-0"})]},e.path)),P.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{t(e.path),C(!1)},className:"flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-sm hover:bg-accent transition-colors text-left",children:[(0,a.jsx)(s.File,{className:"size-4 text-muted-foreground shrink-0"}),(0,a.jsx)("span",{className:"flex-1 truncate font-mono text-xs",children:e.name})]},e.path))]}):(0,a.jsx)("div",{className:"px-3 py-8 text-center text-xs text-muted-foreground",children:"No subdirectories"})}),(0,a.jsx)("div",{className:"border-t border-border px-3 py-1.5 flex items-center gap-2 text-xs",children:B?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Loader2,{className:"size-3 animate-spin text-muted-foreground"}),(0,a.jsx)("span",{className:"text-muted-foreground",children:"Checking permissions..."})]}):J?(0,a.jsx)(a.Fragment,{children:J.readable&&J.writable?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g,{className:"size-3.5 text-green-500"}),(0,a.jsx)("span",{className:"text-green-600 dark:text-green-400",children:"Read/Write"})]}):J.readable&&!J.writable?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(x,{className:"size-3.5 text-amber-500"}),(0,a.jsx)("span",{className:"text-amber-600 dark:text-amber-400",children:"Read-only — files cannot be written here"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y,{className:"size-3.5 text-destructive"}),(0,a.jsx)("span",{className:"text-destructive",children:J.error||"No access"})]})}):(0,a.jsx)("span",{className:"text-muted-foreground",children:z("selectDirectory")})})]})]})}],434805),e.s([],606106),e.i(606106),e.i(8890);var j=e.i(106045),w=e.i(236706),k=e.i(842809),N=e.i(969490),C=e.i(267805);let M=r.createContext(void 0);function S(){let e=r.useContext(M);if(void 0===e)throw Error((0,C.default)(51));return e}let D=((t={}).complete="data-complete",t.indeterminate="data-indeterminate",t.progressing="data-progressing",t),F={status:e=>"progressing"===e?{[D.progressing]:""}:"complete"===e?{[D.complete]:""}:"indeterminate"===e?{[D.indeterminate]:""}:null};function P(e,t){return null==t?"indeterminate progress":e||`${t}%`}let W=r.forwardRef(function(e,t){let{format:n,getAriaValueText:s=P,locale:i,max:o=100,min:l=0,value:d,render:c,className:u,children:m,style:h,...p}=e,[f,g]=r.useState(),x=(0,j.useValueAsRef)(n),y="indeterminate";Number.isFinite(d)&&(y=d===o?"complete":"progressing");let b=(0,k.formatNumberValue)(d,i,x.current),v=r.useMemo(()=>({status:y}),[y]),C={"aria-labelledby":f,"aria-valuemax":o,"aria-valuemin":l,"aria-valuenow":d??void 0,"aria-valuetext":s(b,d),role:"progressbar",children:(0,a.jsxs)(r.Fragment,{children:[m,(0,a.jsx)("span",{role:"presentation",style:w.visuallyHidden,children:"x"})]})},S=r.useMemo(()=>({formattedValue:b,max:o,min:l,setLabelId:g,state:v,status:y,value:d}),[b,o,l,g,v,y,d]),D=(0,N.useRenderElement)("div",e,{state:v,ref:t,props:[C,p],stateAttributesMapping:F});return(0,a.jsx)(M.Provider,{value:S,children:D})}),z=r.forwardRef(function(e,t){let{render:a,className:r,style:n,...s}=e,{state:i}=S();return(0,N.useRenderElement)("div",e,{state:i,ref:t,props:s,stateAttributesMapping:F})});var A=e.i(203922);let T=r.forwardRef(function(e,t){let{render:a,className:n,style:s,...i}=e,{max:o,min:l,value:d,state:c}=S(),u=Number.isFinite(d)&&null!==d?(0,A.valueToPercent)(d,l,o):null,m=r.useCallback(()=>null==u?{}:{insetInlineStart:0,height:"inherit",width:`${u}%`},[u]);return(0,N.useRenderElement)("div",e,{state:c,ref:t,props:[{style:m()},i],stateAttributesMapping:F})}),R=r.forwardRef(function(e,t){let{className:a,render:r,children:n,style:s,...i}=e,{value:o,formattedValue:l,state:d}=S(),c=null==o?"indeterminate":l,u=null==o?null:l;return(0,N.useRenderElement)("span",e,{state:d,ref:t,props:[{"aria-hidden":!0,children:"function"==typeof n?n(c,o):u},i],stateAttributesMapping:F})});var I=e.i(559713);let E=r.forwardRef(function(e,t){let{render:a,className:r,style:n,id:s,...i}=e,{setLabelId:o,state:l}=S(),d=(0,I.useRegisteredLabelId)(s,o);return(0,N.useRenderElement)("span",e,{state:l,ref:t,props:[{id:d,role:"presentation"},i],stateAttributesMapping:F})});e.s(["Indicator",0,T,"Label",0,E,"Root",0,W,"Track",0,z,"Value",0,R],729535);var O=e.i(729535),O=O;function $({className:e,...t}){return(0,a.jsx)(O.Track,{className:(0,b.cn)("relative flex h-1 w-full items-center overflow-x-hidden rounded-full bg-muted",e),"data-slot":"progress-track",...t})}function H({className:e,...t}){return(0,a.jsx)(O.Indicator,{"data-slot":"progress-indicator",className:(0,b.cn)("h-full bg-primary transition-all",e),...t})}e.s(["Progress",0,function({className:e,children:t,value:r,...n}){return(0,a.jsxs)(O.Root,{value:r,"data-slot":"progress",className:(0,b.cn)("flex flex-wrap gap-3",e),...n,children:[t,(0,a.jsx)($,{children:(0,a.jsx)(H,{})})]})},"ProgressIndicator",0,H,"ProgressLabel",0,function({className:e,...t}){return(0,a.jsx)(O.Label,{className:(0,b.cn)("text-sm font-medium",e),"data-slot":"progress-label",...t})},"ProgressTrack",0,$],660748)},361031,e=>{"use strict";let t=(0,e.i(816709).create)(e=>({workspaces:[],setWorkspaces:t=>e({workspaces:t}),upsertWorkspace:t=>{e(e=>{let a=e.workspaces.findIndex(e=>e.id===t.id);if(-1===a)return{workspaces:[...e.workspaces,t]};let r=[...e.workspaces];return r[a]=t,{workspaces:r}})},removeWorkspace:t=>{e(e=>({workspaces:e.workspaces.filter(e=>e.id!==t)}))}}));e.s(["useWorkspaceStore",0,t])},524,e=>{"use strict";var t=e.i(344180),a=e.i(764556),r=e.i(209988),n=e.i(260218),s=e.i(355819),i=e.i(193251),o=e.i(62669),l=e.i(511800),d=e.i(681622),c=e.i(434805),u=e.i(660748),m=e.i(244073);function h({open:e,onOpenChange:p,workspace:f,onSubmit:g}){let x=(0,m.useTranslations)("workspace"),y=(0,m.useTranslations)("common"),b=(0,s.useAgentStore)(e=>e.agents),[v,j]=(0,a.useState)(f?.name??""),[w,k]=(0,a.useState)(f?.boundDirs[0]??""),[N,C]=(0,a.useState)(!1),[M,S]=(0,a.useState)(!1),[D,F]=(0,a.useState)(""),[P,W]=(0,a.useState)(!1),[z,A]=(0,a.useState)(null),T=!!f,R=async()=>{if(v&&w){C(!0);try{await g({name:v,boundDirs:[w]}),p(!1)}finally{C(!1)}}},I=(0,a.useCallback)(async()=>{if(D&&w){W(!0),A(null);try{let e=await fetch("/api/workspaces/clone",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:D,targetDir:w})});if(!e.ok){let t=await e.json();A({phase:"error",progress:0,error:t.error||x("clone.cloneFailed")}),W(!1);return}let t=e.body?.getReader();if(!t){A({phase:"error",progress:0,error:x("clone.noResponseBody")}),W(!1);return}let a=new TextDecoder,r="";for(;;){let{done:e,value:n}=await t.read();if(e)break;let s=(r+=a.decode(n,{stream:!0})).split("\n");for(let e of(r=s.pop()||"",s))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));A(t),("done"===t.phase||"error"===t.phase)&&(W(!1),"done"===t.phase&&t.cloneDir&&(k(t.cloneDir),v||j(D.split("/").pop()?.replace(".git","")||""),S(!1),F(""),A(null)))}catch{}}}catch(e){A({phase:"error",progress:0,error:e.message}),W(!1)}}},[D,w,v,x]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(r.Dialog,{open:e,onOpenChange:p,children:(0,t.jsxs)(r.DialogContent,{children:[(0,t.jsxs)(r.DialogHeader,{children:[(0,t.jsx)(r.DialogTitle,{children:T?x("dialog.editTitle"):x("dialog.newTitle")}),(0,t.jsx)(r.DialogDescription,{children:T?x("dialog.editDescription"):x("dialog.newDescription")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,t.jsx)(d.Input,{className:"rounded-xl py-2.5",placeholder:x("dialog.namePlaceholder"),value:v,onChange:e=>j(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault()}),(0,t.jsx)("div",{children:(0,t.jsx)(c.FolderPicker,{value:w,onChange:k,placeholder:"/path/to/project"})}),!T&&(0,t.jsxs)(n.Button,{type:"button",variant:"outline",size:"sm",className:"w-full gap-1.5",onClick:()=>S(!0),disabled:!w,title:w?x("clone.fromGitTooltip"):x("clone.selectFolderFirst"),children:[(0,t.jsx)(i.Download,{className:"size-4"}),x("clone.createFromGit")]}),T&&b.length>0&&(0,t.jsxs)("div",{className:"rounded-xl border border-border p-3",children:[(0,t.jsxs)("div",{className:"mb-2 flex items-center gap-2 text-sm font-medium",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:b.length}),(0,t.jsx)("span",{children:x("agents")})]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:b.map(e=>(0,t.jsx)("span",{className:"inline-flex items-center gap-1 rounded-md bg-muted px-2 py-0.5 text-xs",children:e.name||e.role},e.id))})]})]}),(0,t.jsxs)(r.DialogFooter,{children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:()=>p(!1),disabled:N,children:y("cancel")}),(0,t.jsx)(n.Button,{onClick:R,disabled:!v||!w||N,children:y(T?"save":"create")})]})]})}),(0,t.jsx)(r.Dialog,{open:M,onOpenChange:e=>{P||S(e)},children:(0,t.jsxs)(r.DialogContent,{children:[(0,t.jsxs)(r.DialogHeader,{children:[(0,t.jsx)(r.DialogTitle,{children:x("clone.title")}),(0,t.jsx)(r.DialogDescription,{children:x("clone.description")})]}),(0,t.jsxs)("div",{className:"flex flex-col gap-3 py-2",children:[(0,t.jsx)(d.Input,{className:"rounded-xl py-2.5",placeholder:"https://github.com/user/repo.git",value:D,onChange:e=>F(e.target.value),onKeyDown:e=>"Enter"===e.key&&e.preventDefault(),disabled:P}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[x("clone.cloneTo"),w,"/",D?D.split("/").pop()?.replace(".git","")||"repo":"..."]}),z&&"done"!==z.phase&&"error"!==z.phase&&(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsxs)(u.Progress,{value:z.progress,children:[(0,t.jsx)(u.ProgressLabel,{children:x(`clone.phase.${z.phase}`)}),(0,t.jsxs)("span",{className:"ml-auto text-sm text-muted-foreground tabular-nums",children:[z.progress,"%"]}),(0,t.jsx)(u.ProgressTrack,{children:(0,t.jsx)(u.ProgressIndicator,{})})]}),null!=z.received&&null!=z.total&&(0,t.jsxs)("p",{className:"text-xs text-muted-foreground",children:[z.received," / ",z.total," ",x("clone.objects")]})]}),z?.phase==="error"&&(0,t.jsxs)("div",{className:"flex items-start gap-2 rounded-lg border border-destructive/50 bg-destructive/5 p-3",children:[(0,t.jsx)(l.AlertCircle,{className:"size-4 mt-0.5 shrink-0 text-destructive"}),(0,t.jsx)("p",{className:"text-sm text-destructive",children:z.error})]})]}),(0,t.jsxs)(r.DialogFooter,{children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:()=>{P||S(!1)},disabled:P,children:y("cancel")}),(0,t.jsx)(n.Button,{onClick:I,disabled:!D||P,children:P?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Loader2,{className:"size-4 animate-spin"}),x("clone.cloning")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(i.Download,{className:"size-4"}),x("clone.clone")]})})]})]})})]})}e.s(["WorkspaceDialog",0,function({open:e,onOpenChange:a,workspace:r,onSubmit:n}){return(0,t.jsx)(h,{open:e,onOpenChange:a,workspace:r,onSubmit:n},e?r?.id??"new":"closed")}])},487122,511518,e=>{"use strict";let t=Symbol.for("constructDateFrom");e.s(["constructFromSymbol",0,t,"millisecondsInDay",0,864e5,"millisecondsInWeek",0,6048e5,"minutesInDay",0,1440,"minutesInMonth",0,43200],511518),e.s(["constructFrom",0,function(e,a){return"function"==typeof e?e(a):e&&"object"==typeof e&&t in e?e[t](a):e instanceof Date?new e.constructor(a):new Date(a)}],487122)},238153,244874,e=>{"use strict";var t;let a={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}};function r(e){return (t={})=>{let a=t.width?String(t.width):e.defaultWidth;return e.formats[a]||e.formats[e.defaultWidth]}}let n={date:r({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:r({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:r({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},s={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"};function i(e){return(t,a)=>{let r;if("formatting"===(a?.context?String(a.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,n=a?.width?String(a.width):t;r=e.formattingValues[n]||e.formattingValues[t]}else{let t=e.defaultWidth,n=a?.width?String(a.width):e.defaultWidth;r=e.values[n]||e.values[t]}return r[e.argumentCallback?e.argumentCallback(t):t]}}function o(e){return(t,a={})=>{let r,n=a.width,s=n&&e.matchPatterns[n]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;let o=i[0],l=n&&e.parsePatterns[n]||e.parsePatterns[e.defaultParseWidth],d=Array.isArray(l)?function(e,t){for(let a=0;a<e.length;a++)if(t(e[a]))return a}(l,e=>e.test(o)):function(e,t){for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)&&t(e[a]))return a}(l,e=>e.test(o));return r=e.valueCallback?e.valueCallback(d):d,{value:r=a.valueCallback?a.valueCallback(r):r,rest:t.slice(o.length)}}}let l={code:"en-US",formatDistance:(e,t,r)=>{let n,s=a[e];if(n="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),r?.addSuffix)if(r.comparison&&r.comparison>0)return"in "+n;else return n+" ago";return n},formatLong:n,formatRelative:(e,t,a,r)=>s[e],localize:{ordinalNumber:(e,t)=>{let a=Number(e),r=a%100;if(r>20||r<10)switch(r%10){case 1:return a+"st";case 2:return a+"nd";case 3:return a+"rd"}return a+"th"},era:i({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:i({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:i({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:i({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:i({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})},match:{ordinalNumber:(t={matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)},(e,a={})=>{let r=e.match(t.matchPattern);if(!r)return null;let n=r[0],s=e.match(t.parsePattern);if(!s)return null;let i=t.valueCallback?t.valueCallback(s[0]):s[0];return{value:i=a.valueCallback?a.valueCallback(i):i,rest:e.slice(n.length)}}),era:o({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:o({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:o({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:o({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:o({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},options:{weekStartsOn:0,firstWeekContainsDate:1}};e.s(["enUS",0,l],244874),e.s(["defaultLocale",0,l],238153)},492421,e=>{"use strict";let t={};e.s(["getDefaultOptions",0,function(){return t}])},632713,516467,e=>{"use strict";var t=e.i(487122);function a(e,a){return(0,t.constructFrom)(a||e,e)}e.s(["toDate",0,a],516467),e.s(["getTimezoneOffsetInMilliseconds",0,function(e){let t=a(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),e-r}],632713)},539392,e=>{"use strict";var t=e.i(487122);e.s(["normalizeDates",0,function(e,...a){let r=t.constructFrom.bind(null,e||a.find(e=>"object"==typeof e));return a.map(r)}])},731285,e=>{"use strict";var t=e.i(539392);e.s(["differenceInCalendarMonths",0,function(e,a,r){let[n,s]=(0,t.normalizeDates)(r?.in,e,a);return 12*(n.getFullYear()-s.getFullYear())+(n.getMonth()-s.getMonth())}])},936765,e=>{"use strict";var t=e.i(516467);e.s(["endOfMonth",0,function(e,a){let r=(0,t.toDate)(e,a?.in),n=r.getMonth();return r.setFullYear(r.getFullYear(),n+1,0),r.setHours(23,59,59,999),r}])}]);
|