@alook/app 0.0.61 → 0.0.62
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/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0-mpehtea82gj.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0.2cm-frpsn46.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/02l4ozfj-bus0.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/02m~kr41yqpgu.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/02oywn5r~vty4.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/037bobdy3gbd3.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/05pjee3c_08ry.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/09fl.5j3fsb-~.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/09g3tf250sygu.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0_.5~wi4~pwek.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0b~ih_tyx7kz2.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0e68yx9h-f6.4.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0h--f0f9fru_b.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{0ckywgfha.zc8.js → 0ioy_kjd42n1w.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0khqgglj_9zdp.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0l-ma4.~.hl0g.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0mq7ossd6d7or.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0ojkmo0k890x0.js +63 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{05x9e8ndr.o12.js → 0pg7cnm39yoom.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0q8gx414vnsur.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0uht5kak3uat9.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0v5mv7gpv3g0e.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0v~f5hjxbtvse.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0wehjlyi0zl04.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0ypg5.fp9-.a2.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0zplaqwk4a-ro.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/1053vndt~uadk.js +2 -0
- package/bundled/web/.open-next/cache/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/sitemap.xml.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/[traceId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +11 -13
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0jkll-p._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0tpn293._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +11 -13
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_00tia4h._.js +65 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_01-aa1p._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_06cffai._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_07nc8as._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0_gdn-k._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0grgpqw._.js → _0icffya._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0xd~7d0._.js → _0l89059._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_07nfm8a._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0d6x0l6._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0ivfx3i._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0o~nukr._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0dvds67._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0stugv_._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_activity_page_tsx_0sthpjy._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_email_page_tsx_09mq1-g._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_files_page_tsx_11eh380._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_layout_tsx_0juu2um._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_flags_page_tsx_01u6ba1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_home_page_tsx_0lkx78f._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_issues_page_tsx_0_k5j03._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_settings_page_tsx_0fdcupy._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_threads_[traceId]_page_tsx_00bx721._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_00xgo_-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_0nj0euq._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_avatar_index_ts_0v3qm09._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_issues_issue-sheet_tsx_02fma1.._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_ui_tooltip_tsx_01x-izi._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_workspace-shell_tsx_0479plk._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +31 -31
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +202 -238
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +3 -3
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0.sz8uokz4r3z.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/02eur_~.0beq1.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0897z5r~zf_64.js +0 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/09cf5_rxgdweq.js +0 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/09g0nda2m8qs6.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/09xlaawkmeo-1.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0_r2q9b0p3~43.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0cevbp17ckdk8.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0cfcuvz1i5ib-.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0d_~94mojr73c.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0fv1xxx5~japv.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0h3_qte--w1zd.js +0 -2
- package/bundled/web/.open-next/assets/_next/static/chunks/0kv3zo-jlu8ys.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0ns6eebx34b7y.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0s.jfkn9-ghod.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0tzluwv791ius.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0v1r-i08gf2_r.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0vy6bvkl._5cz.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0wh92yl8ru81f.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0wiz11twa9nza.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0xgmeffaed_g1.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/11awu4cnrpf_2.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/13ghp4pyj_rtr.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/15b8tj5zgbyem.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/17vrtnfkomuz6.js +0 -63
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/0r03_@base-ui_react_esm_0rw~qhg._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__07kw94m._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0j4zfi1._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_00lrpyh._.js +0 -65
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0388irl._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0cq9vt9._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0rb2_75._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0rkr3t4._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_01s8r3n._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0r.85x_._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0rwgvis._.js +0 -3
- /package/bundled/web/.open-next/assets/_next/static/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{ouY0UJDBkwSzFlKOVDaoD → SuuOnXXAS0ccoLD99O2QP}/robots.txt.cache +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[731633,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(135733),e=a.i(249453),f=a.i(790090);let g=(0,f.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),h=(0,f.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var i=a.i(527779),j=a.i(911057),k=a.i(695004),l=a.i(506180),m=a.i(752792),n=a.i(588339),o=a.i(732254),p=a.i(464830),q=a.i(25668);a.i(735132);var r=a.i(325848),s=a.i(764190),t=a.i(525132),u=a.i(75118),v=a.i(921584),w=a.i(914211),x=a.i(963744);let y=[{id:"todo",label:"Todo",statuses:["todo"]},{id:"in_progress",label:"In Progress",statuses:["in_progress"]},{id:"review",label:"Review",statuses:["review"]},{id:"completed",label:"Completed",statuses:["done","closed","canceled","failed"]}];function z({agent:a,size:c=24}){let d=(0,r.parseAvatarUrl)(a?.avatar_url);return d?(0,b.jsx)(r.AvatarRenderer,{config:d,size:c,className:"shrink-0 rounded-full"}):(0,b.jsx)("span",{className:"flex shrink-0 items-center justify-center rounded-full border border-border bg-muted text-[11px] font-medium text-muted-foreground",style:{width:c,height:c},children:(a?.name??"?").slice(0,1).toUpperCase()})}function A({issue:a,selected:d,onClick:e,onDelete:f,agent:g,agentsById:h,compact:j=!1}){var l;let m=(0,c.useMemo)(()=>{let b=a.thread_agent_ids;if(!b||b.length<2||!h)return null;let c=a.agent_id;return(c?[c,...b.filter(a=>a!==c)]:b).map(a=>h.get(a)).filter(a=>!!a)},[a.thread_agent_ids,a.agent_id,h]);return(0,b.jsxs)(s.ContextMenu,{children:[(0,b.jsx)(s.ContextMenuTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:e,className:(0,u.cn)("w-full rounded-lg border bg-background/75 p-3 text-left transition-colors cursor-pointer","hover:bg-accent/70 hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",d?"border-foreground/30 bg-accent":"border-border/60")}),children:(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsx)("div",{className:"line-clamp-2 min-w-0 text-sm font-medium leading-5 text-foreground",children:a.title}),"in_progress"===a.status&&(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:[(0,b.jsx)(i.Loader2,{className:"size-2.5 animate-spin"})," Working"]}),"review"===a.status&&(0,b.jsx)("span",{className:"shrink-0 rounded bg-yellow-500/10 px-1.5 py-0.5 text-[10px] font-medium text-yellow-600 dark:text-yellow-400",children:"Review"}),"failed"===a.status&&(0,b.jsx)("span",{className:"shrink-0 rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] font-medium text-destructive",children:"Failed"})]}),a.description?(0,b.jsx)("div",{className:(0,u.cn)("mt-1 text-xs leading-4 text-muted-foreground",j?"line-clamp-1":"line-clamp-2"),children:a.description}):null,(0,b.jsxs)("div",{className:"mt-2 flex min-w-0 items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[m&&m.length>=2?(0,b.jsxs)("span",{className:"flex items-center",children:[m.slice(0,3).map((a,c)=>(0,b.jsx)("span",{className:(0,u.cn)("rounded-full border-2 border-background",c>0&&"-ml-1.5"),children:(0,b.jsx)(z,{agent:a,size:16})},a.id)),m.length>3&&(0,b.jsxs)("span",{className:"flex items-center justify-center rounded-full border-2 border-background bg-muted text-[9px] font-medium text-muted-foreground -ml-1.5",style:{width:16,height:16},children:["+",m.length-3]})]}):g?(0,b.jsxs)("span",{className:"flex items-center gap-1 truncate",children:[(0,b.jsx)(z,{agent:g,size:14}),(0,b.jsx)("span",{className:"truncate",children:g.name})]}):(0,b.jsx)("span",{className:"truncate text-muted-foreground/60",children:a.agent_id?"":"Unassigned"}),(0,b.jsx)("span",{className:"shrink-0",children:(l=a.updated_at)?new Date(l).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})]})]})}),f&&(0,b.jsx)(s.ContextMenuContent,{children:(0,b.jsxs)(s.ContextMenuItem,{className:"text-destructive",onClick:f,children:[(0,b.jsx)(k.Trash2,{className:"size-3.5 mr-1.5"}),"Delete"]})})]})}function B({id:a,children:c,className:d}){let{isOver:e,setNodeRef:f}=(0,w.useDroppable)({id:a});return(0,b.jsx)("div",{ref:f,className:(0,u.cn)("flex min-h-0 flex-col rounded-lg border bg-card/60 transition-colors",e?"ring-2 ring-primary/40 bg-primary/5 border-primary/30":"border-border/60",d),children:c})}function C({activeDragId:a,completedCount:c,onExpand:d}){let{isOver:e,setNodeRef:f}=(0,w.useDroppable)({id:"completed"});return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("div",{ref:f,role:"button",tabIndex:0,"aria-label":"Show completed column",onClick:()=>{a||d()},onKeyDown:b=>{"Enter"!==b.key&&" "!==b.key||a||(b.preventDefault(),d())},className:(0,u.cn)("flex h-full items-center justify-center rounded-lg border transition-colors",e?"ring-2 ring-primary/40 bg-primary/5 border-primary/30":"border-dashed border-border/60 bg-muted/20 cursor-pointer hover:bg-muted/40")}),children:(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 h-full py-3",children:[(0,b.jsx)(g,{className:"size-3.5 text-muted-foreground/60 shrink-0"}),(0,b.jsxs)("span",{className:"text-xs font-medium text-muted-foreground",style:{writingMode:"vertical-rl"},children:["Completed (",c,")"]})]})}),(0,b.jsx)(t.TooltipContent,{children:a?"Drop to complete":"Show completed"})]})}function D({issue:a,selected:c,onClick:d,onDelete:e,agent:f,agentsById:g,compact:h=!1}){let{attributes:i,listeners:j,setNodeRef:k,transform:l,isDragging:m}=(0,w.useDraggable)({id:a.id}),n={transform:l?`translate3d(${l.x}px, ${l.y}px, 0)`:void 0,opacity:m?.4:1,cursor:m?"grabbing":"grab"};return(0,b.jsx)("div",{ref:k,style:n,...j,...i,children:(0,b.jsx)(A,{issue:a,selected:c,onClick:d,onDelete:e,agent:f,agentsById:g,compact:h})})}a.s(["default",0,function(){let a,{workspaceId:f,slug:i}=(0,l.useWorkspace)(),{agents:k,loading:r,subscribeWs:s}=(0,m.useAgentContext)(),[z,E]=(0,d.useLocalStorage)(`issue-recent-agent-id-${f}`,""),[F,G]=(0,d.useLocalStorage)(`issue-draft-${f}`,{title:"",description:"",agentId:""}),[H,I]=(0,d.useLocalStorage)("issues-show-completed",!0),[J,K]=(0,c.useState)([]),L=(0,c.useRef)([]);L.current=J;let[M,N]=(0,c.useState)(!0),[O,P]=(0,c.useState)(!1),[Q,R]=(0,c.useState)(!1),[S,T]=(0,c.useState)(null),[U,V]=(0,c.useState)(null),[W,X]=(0,c.useState)(!1),[Y,Z]=(0,c.useState)(null),[$,_]=(0,c.useState)(448),[aa,ab]=(0,c.useState)(null),[ac,ad]=(0,c.useState)(null),ae=(0,c.useRef)(null),af=(0,c.useRef)(0),ag=(0,c.useRef)(null),ah=(0,w.useSensors)((0,w.useSensor)(w.PointerSensor,{activationConstraint:{distance:8}})),ai=(0,c.useMemo)(()=>new Map(k.map(a=>[a.id,a])),[k]);async function aj(){N(!0);try{let[a,b]=await Promise.all([(0,n.listIssues)(f,{terminal:!1}),(0,n.listIssues)(f,{terminal:!0})]);K([...a,...b])}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to load issues")}finally{N(!1)}}async function ak(){try{let[a,b]=await Promise.all([(0,n.listIssues)(f,{terminal:!1}),(0,n.listIssues)(f,{terminal:!0})]);K([...a,...b])}catch{}}let al=(0,c.useRef)(null),am=(0,c.useRef)(!1);function an(){al.current&&clearTimeout(al.current),al.current=setTimeout(()=>{al.current=null,ak().catch(()=>{}),am.current&&(ag.current&&ap(ag.current).catch(()=>{}),am.current=!1)},300)}async function ao(a){T(a),ag.current=a,R(!0),X(!0),ab(null);try{let b=await (0,n.getIssue)(f,a);V(b),b.issue.trace_id&&(0,n.getTrace)(b.issue.trace_id,f).then(a=>ab(a.tasks)).catch(()=>ab(null))}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to load issue")}finally{X(!1)}}async function ap(a){let b=++af.current;try{let c=await (0,n.getIssue)(f,a);if(b!==af.current||ag.current!==a)return;V(c),c.issue.trace_id&&(0,n.getTrace)(c.issue.trace_id,f).then(c=>{b===af.current&&ag.current===a&&ab(c.tasks)}).catch(()=>{});let d=c.issue.latest_task_id;d&&(0,n.getTask)(d,f).then(c=>{b===af.current&&ag.current===a&&Z(c)}).catch(()=>{})}catch(a){a?.status===404&&aA(!1)}}(0,c.useEffect)(()=>{aj()},[f]);let aq=U?.issue.conversation_id??null,ar=(0,c.useRef)(null);ar.current=aq;let as=U?.issue.latest_task_id??null,at=(0,c.useRef)(null);at.current=as;let au=U?.issue.agent_id??null,av=(0,c.useRef)(null);av.current=au,(0,c.useEffect)(()=>{if(!as)return void Z(null);let a=!1;return(0,n.getTask)(as,f).then(b=>{a||Z(b)}).catch(()=>{}),()=>{a=!0}},[as,f]),Y&&["completed","failed","cancelled","superseded"].includes(Y.status),aa?.some(a=>["queued","dispatched","running"].includes(a.status)),(0,c.useEffect)(()=>{let a=s(a=>{if("conversation.message"===a.type&&ar.current&&a.conversationId===ar.current&&(V(b=>!b||b.messages.some(b=>b.id===a.message.id)?b:{...b,messages:[...b.messages,a.message]}),"event"===a.message.role&&a.message.content.startsWith("Issue status changed:")&&!ae.current)){let b=a.message.content.match(/-> (\w+)/);if(b){let c=b[1];V(a=>a?{...a,issue:{...a.issue,status:c}}:a),K(b=>b.map(b=>b.conversation_id===ar.current?{...b,status:c,updated_at:a.message.created_at}:b))}}if("conversation.message"===a.type&&"event"===a.message.role&&a.message.content.startsWith("Issue status changed:")&&!ae.current&&a.conversationId!==ar.current){let b=a.message.content.match(/-> (\w+)/);if(b){let c=b[1];K(b=>b.map(b=>b.conversation_id===a.conversationId?{...b,status:c,updated_at:a.message.created_at}:b))}}if("issue.comment"===a.type&&ag.current===a.issueId&&V(b=>!b||b.comments.some(b=>b.id===a.comment.id)?b:{...b,comments:[...b.comments,a.comment]}),"task.updated"===a.type&&("running"===a.status||"completed"===a.status||"failed"===a.status)){if(ae.current)return;let b=L.current;if(0===b.length)return void an();let c=new Set(b.map(a=>a.agent_id).filter(a=>!!a)),d=new Set(b.map(a=>a.latest_task_id).filter(a=>!!a));if(!c.has(a.agentId)&&!d.has(a.taskId))return;(a.taskId===at.current||a.agentId===av.current)&&(am.current=!0),an()}});return()=>{a(),al.current&&(clearTimeout(al.current),al.current=null)}},[s]);let aw=(0,c.useCallback)(async a=>{P(!0);try{let b=await (0,n.createIssue)(f,{agent_id:a.agent_id,title:a.title,description:a.description});K(a=>[b.issue,...a]),a.agent_id&&E(a.agent_id),G({title:"",description:"",agentId:""}),T(b.issue.id),ag.current=b.issue.id,ao(b.issue.id),v.toast.success("Issue created")}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to create issue")}finally{P(!1)}},[f]),ax=(0,c.useCallback)(async(a,b)=>{try{let c=await (0,n.updateIssue)(f,a,b);K(d=>d.map(d=>d.id===a?{...d,...b,updated_at:c.updated_at}:d)),V(d=>d&&d.issue.id===a?{...d,issue:{...d.issue,...b,updated_at:c.updated_at}}:d)}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to update issue")}},[f]),ay=(0,c.useCallback)(async(a,b)=>{let c=J.find(b=>b.id===a);if(!c)return;let d=c.status;if(b===d)return;let e=new Date().toISOString();K(c=>c.map(c=>c.id===a?{...c,status:b,updated_at:e}:c)),U?.issue.id===a&&V(a=>a?{...a,issue:{...a.issue,status:b,updated_at:e}}:a),ae.current=a;try{await (0,n.updateIssue)(f,a,{status:b})}catch(b){K(b=>b.map(b=>b.id===a?{...b,status:d}:b)),U?.issue.id===a&&V(a=>a?{...a,issue:{...a.issue,status:d}}:a),v.toast.error(b instanceof Error?b.message:"Failed to update issue status")}finally{ae.current=null}},[f,J,U]),az=(0,c.useCallback)(async a=>{try{await (0,n.deleteIssue)(f,a),K(b=>b.filter(b=>b.id!==a)),S===a&&(T(null),ag.current=null,R(!1),V(null)),v.toast.success("Issue deleted")}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to delete issue")}},[f,S]),aA=(0,c.useCallback)(a=>{R(a),a||(T(null),ag.current=null,V(null),Z(null),ab(null))},[]);async function aB(a){ad(null);let{active:b,over:c}=a;if(!c)return;let d=b.id,e=c.id,g=J.find(a=>a.id===d);if(!g)return;let h=y.find(a=>a.id===e);if(!h||h.statuses.includes(g.status))return;if("todo"===g.status&&!g.agent_id&&"todo"!==e&&"completed"!==e)return void v.toast.error("Assign an agent first to run this issue");let i="completed"===e?"done":e,j=g.status,k=new Date().toISOString();K(a=>a.map(a=>a.id===d?{...a,status:i,updated_at:k}:a)),U?.issue.id===d&&V(a=>a?{...a,issue:{...a.issue,status:i,updated_at:k}}:a),ae.current=d;try{await (0,n.updateIssue)(f,d,{status:i})}catch(a){K(a=>a.map(a=>a.id===d?{...a,status:j}:a)),U?.issue.id===d&&V(a=>a?{...a,issue:{...a.issue,status:j}}:a),v.toast.error(a instanceof Error?a.message:"Failed to update issue status")}finally{ae.current=null}}let aC=M||r,aD=S?J.find(a=>a.id===S)??null:null;return(0,b.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col bg-background/30",children:[(0,b.jsxs)("div",{className:"flex shrink-0 flex-col gap-3 border-b border-border/60 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5 sm:py-4",children:[(0,b.jsx)("div",{className:"min-w-0",children:(0,b.jsx)("h1",{className:"text-base font-semibold tracking-normal",children:"Issues"})}),(0,b.jsx)("div",{className:"flex items-center gap-2",children:(0,b.jsxs)(o.Button,{size:"sm",className:"w-full sm:w-auto",onClick:()=>{T(null),ag.current=null,R(!0)},children:[(0,b.jsx)(j.Plus,{className:"size-4"}),"New issue"]})})]}),(0,b.jsx)("div",{className:"hidden min-h-0 flex-1 lg:block overflow-y-auto thin-scrollbar p-4",children:aC?(0,b.jsxs)("div",{className:(0,u.cn)("grid h-full gap-4",H?"grid-cols-4":"grid-cols-[1fr_1fr_1fr_36px]"),children:[[3,2,2,...H?[2]:[]].map((a,c)=>(0,b.jsxs)("div",{className:"flex min-h-0 flex-col rounded-lg border border-border/60 bg-card/60",children:[(0,b.jsx)("div",{className:"border-b border-border/60 bg-muted/30 px-3 py-2",children:(0,b.jsx)(q.Skeleton,{className:"h-3 w-16"})}),(0,b.jsx)("div",{className:"min-h-0 flex-1 space-y-2 p-2",children:Array.from({length:a}).map((a,c)=>(0,b.jsxs)("div",{className:"rounded-lg border bg-background/75 p-3",children:[(0,b.jsx)(q.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(q.Skeleton,{className:"mt-1 h-3 w-1/2"}),(0,b.jsx)(q.Skeleton,{className:"mt-2 h-3 w-1/3"})]},c))})]},c)),!H&&(0,b.jsx)("div",{className:"h-full rounded-lg border border-dashed border-border/60 bg-muted/20"})]}):0===J.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(e.CircleDot,{className:"size-8 text-muted-foreground mb-3"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No issues"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create one to get started."})]}):(0,b.jsxs)(w.DndContext,{sensors:ah,onDragStart:function(a){ad(a.active.id)},onDragEnd:aB,children:[(0,b.jsxs)("div",{className:(0,u.cn)("grid h-full gap-4 animate-[fade-up_200ms_ease-out_both]",H?"grid-cols-4":"grid-cols-[1fr_1fr_1fr_36px]"),children:[y.filter(a=>"completed"!==a.id||H).map(a=>{let c=J.filter(b=>a.statuses.includes(b.status));return(0,b.jsxs)(B,{id:a.id,children:[(0,b.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 bg-muted/30 px-3 py-2 text-xs font-medium text-muted-foreground",children:[(0,b.jsx)("span",{children:a.label}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)("span",{children:c.length}),"completed"===a.id&&(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button","aria-label":"Hide completed column",disabled:!!ac,onClick:()=>I(!1),className:"rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-muted hover:text-muted-foreground disabled:opacity-40"}),children:(0,b.jsx)(h,{className:"size-3.5"})}),(0,b.jsx)(t.TooltipContent,{children:"Hide completed"})]})]})]}),(0,b.jsx)("div",{className:(0,u.cn)("min-h-0 flex-1 space-y-2 overflow-y-auto thin-scrollbar p-2","completed"===a.id&&"animate-[fade-up_300ms_ease-out_both]"),children:0===c.length?(0,b.jsx)("div",{className:"flex h-full min-h-20 items-center justify-center rounded-lg border border-dashed border-border/45 text-xs text-muted-foreground/70",children:"Empty"}):c.map(a=>(0,b.jsx)(D,{issue:a,selected:S===a.id,onClick:()=>ao(a.id),onDelete:()=>az(a.id),agent:ai.get(a.agent_id??"")??null,agentsById:ai},a.id))})]},a.id)}),!H&&(0,b.jsx)(C,{activeDragId:ac,completedCount:J.filter(a=>y[3].statuses.includes(a.status)).length,onExpand:()=>I(!0)})]}),(0,b.jsx)(w.DragOverlay,{style:{zIndex:9999},children:ac&&(a=J.find(a=>a.id===ac))?(0,b.jsx)(A,{issue:a,selected:!1,onClick:()=>{},agent:ai.get(a.agent_id??"")??null,agentsById:ai}):null})]})}),(0,b.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto thin-scrollbar p-3 lg:hidden",children:aC?(0,b.jsxs)("div",{className:"space-y-4",children:[[0,1,2].map(a=>(0,b.jsxs)("div",{className:"rounded-lg border border-border/60 bg-card/60",children:[(0,b.jsx)("div",{className:"border-b border-border/50 px-3 py-2",children:(0,b.jsx)(q.Skeleton,{className:"h-4 w-20"})}),(0,b.jsx)("div",{className:"space-y-2 p-3",children:Array.from({length:2}).map((a,c)=>(0,b.jsxs)("div",{className:"rounded-lg border bg-background/75 p-3",children:[(0,b.jsx)(q.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(q.Skeleton,{className:"mt-1 h-3 w-1/2"}),(0,b.jsx)(q.Skeleton,{className:"mt-2 h-3 w-1/3"})]},c))})]},a)),(0,b.jsx)("div",{className:"rounded-lg border border-dashed border-border/60 px-3 py-2.5",children:(0,b.jsx)(q.Skeleton,{className:"h-4 w-32"})})]}):0===J.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(e.CircleDot,{className:"size-8 text-muted-foreground mb-3"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No issues yet"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create one to get started."})]}):(0,b.jsxs)("div",{className:"space-y-4 animate-[fade-up_200ms_ease-out_both]",children:[y.map(a=>{if("completed"===a.id&&!H)return null;let c=J.filter(b=>a.statuses.includes(b.status));return 0===c.length?null:(0,b.jsxs)("section",{className:"rounded-lg border border-border/60 bg-card/60",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 py-2 text-sm font-medium",children:[(0,b.jsx)("span",{children:a.label}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)(p.Badge,{variant:"outline",children:c.length}),"completed"===a.id&&(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button","aria-label":"Hide completed column",onClick:()=>I(!1),className:"rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-muted hover:text-muted-foreground"}),children:(0,b.jsx)(h,{className:"size-3.5"})}),(0,b.jsx)(t.TooltipContent,{children:"Hide completed"})]})]})]}),(0,b.jsx)("div",{className:"space-y-2 p-3",children:c.map(a=>(0,b.jsx)(A,{issue:a,selected:S===a.id,onClick:()=>ao(a.id),onDelete:()=>az(a.id),agent:ai.get(a.agent_id??"")??null,agentsById:ai,compact:!0},a.id))})]},a.id)}),!H&&(0,b.jsxs)("div",{role:"button",tabIndex:0,"aria-label":"Show completed issues",onClick:()=>I(!0),onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),I(!0))},className:"flex cursor-pointer items-center gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted/30",children:[(0,b.jsx)(g,{className:"size-3.5"}),(0,b.jsxs)("span",{children:["Show Completed (",J.filter(a=>y[3].statuses.includes(a.status)).length,")"]})]})]})}),(0,b.jsx)(x.IssueSheet,{open:Q,onOpenChange:aA,agents:k,issue:aD,detail:U?{messages:U.messages,comments:U.comments,artifacts:U.artifacts,traceId:U.issue.trace_id}:null,detailLoading:W,activeTask:Y,traceTasks:aa,submitting:O,defaultAgentId:z,slug:i,workspaceId:f,width:$,onWidthChange:_,draft:F,onDraftChange:G,onCreate:aw,onUpdate:ax,onStatusChange:ay,onCommented:()=>S&&ao(S),onDispatched:a=>{ak(),ao(a)}})]})}],731633)}];
|
|
1
|
+
module.exports=[731633,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(135733),e=a.i(249453),f=a.i(790090);let g=(0,f.default)("eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]),h=(0,f.default)("eye-off",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);var i=a.i(527779),j=a.i(911057),k=a.i(695004),l=a.i(506180),m=a.i(752792),n=a.i(588339),o=a.i(732254),p=a.i(464830),q=a.i(25668);a.i(735132);var r=a.i(325848),s=a.i(764190),t=a.i(525132),u=a.i(75118),v=a.i(921584),w=a.i(914211),x=a.i(963744),y=a.i(207461),z=a.i(698824);let A=[{id:"todo",label:"Todo",statuses:["todo"]},{id:"in_progress",label:"In Progress",statuses:["in_progress"]},{id:"review",label:"Review",statuses:["review"]},{id:"completed",label:"Completed",statuses:["done","closed","canceled","failed"]}];function B({agent:a,size:c=24}){let d=(0,r.parseAvatarUrl)(a?.avatar_url);return d?(0,b.jsx)(r.AvatarRenderer,{config:d,size:c,className:"shrink-0 rounded-full"}):(0,b.jsx)("span",{className:"flex shrink-0 items-center justify-center rounded-full border border-border bg-muted text-[11px] font-medium text-muted-foreground",style:{width:c,height:c},children:(a?.name??"?").slice(0,1).toUpperCase()})}function C({issue:a,selected:d,onClick:e,onDelete:f,agent:g,agentsById:h,compact:j=!1}){var l;let m=(0,c.useMemo)(()=>{let b=a.thread_agent_ids;if(!b||b.length<2||!h)return null;let c=a.agent_id;return(c?[c,...b.filter(a=>a!==c)]:b).map(a=>h.get(a)).filter(a=>!!a)},[a.thread_agent_ids,a.agent_id,h]);return(0,b.jsxs)(s.ContextMenu,{children:[(0,b.jsx)(s.ContextMenuTrigger,{render:(0,b.jsx)("button",{type:"button",onClick:e,className:(0,u.cn)("w-full rounded-lg border bg-background/75 p-3 text-left transition-colors cursor-pointer","hover:bg-accent/70 hover:border-border focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",d?"border-foreground/30 bg-accent":"border-border/60")}),children:(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,b.jsx)("div",{className:"line-clamp-2 min-w-0 text-sm font-medium leading-5 text-foreground",children:a.title}),"in_progress"===a.status&&(0,b.jsxs)("span",{className:"flex shrink-0 items-center gap-0.5 rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium text-primary",children:[(0,b.jsx)(i.Loader2,{className:"size-2.5 animate-spin"})," Working"]}),"review"===a.status&&(0,b.jsx)("span",{className:"shrink-0 rounded bg-yellow-500/10 px-1.5 py-0.5 text-[10px] font-medium text-yellow-600 dark:text-yellow-400",children:"Review"}),"failed"===a.status&&(0,b.jsx)("span",{className:"shrink-0 rounded bg-destructive/10 px-1.5 py-0.5 text-[10px] font-medium text-destructive",children:"Failed"})]}),a.description?(0,b.jsx)("div",{className:(0,u.cn)("mt-1 text-xs leading-4 text-muted-foreground",j?"line-clamp-1":"line-clamp-2"),children:a.description}):null,(0,b.jsxs)("div",{className:"mt-2 flex min-w-0 items-center justify-between gap-2 text-[11px] text-muted-foreground",children:[m&&m.length>=2?(0,b.jsxs)("span",{className:"flex items-center",children:[m.slice(0,3).map((a,c)=>(0,b.jsx)("span",{className:(0,u.cn)("rounded-full border-2 border-background",c>0&&"-ml-1.5"),children:(0,b.jsx)(B,{agent:a,size:16})},a.id)),m.length>3&&(0,b.jsxs)("span",{className:"flex items-center justify-center rounded-full border-2 border-background bg-muted text-[9px] font-medium text-muted-foreground -ml-1.5",style:{width:16,height:16},children:["+",m.length-3]})]}):g?(0,b.jsxs)("span",{className:"flex items-center gap-1 truncate",children:[(0,b.jsx)(B,{agent:g,size:14}),(0,b.jsx)("span",{className:"truncate",children:g.name})]}):(0,b.jsx)("span",{className:"truncate text-muted-foreground/60",children:a.agent_id?"":"Unassigned"}),(0,b.jsx)("span",{className:"shrink-0",children:(l=a.updated_at)?new Date(l).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""})]})]})}),f&&(0,b.jsx)(s.ContextMenuContent,{children:(0,b.jsxs)(s.ContextMenuItem,{className:"text-destructive",onClick:f,children:[(0,b.jsx)(k.Trash2,{className:"size-3.5 mr-1.5"}),"Delete"]})})]})}function D({id:a,children:c,className:d}){let{isOver:e,setNodeRef:f}=(0,w.useDroppable)({id:a});return(0,b.jsx)("div",{ref:f,className:(0,u.cn)("flex min-h-0 flex-col rounded-lg border bg-card/60 transition-colors",e?"ring-2 ring-primary/40 bg-primary/5 border-primary/30":"border-border/60",d),children:c})}function E({activeDragId:a,completedCount:c,onExpand:d}){let{isOver:e,setNodeRef:f}=(0,w.useDroppable)({id:"completed"});return(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("div",{ref:f,role:"button",tabIndex:0,"aria-label":"Show completed column",onClick:()=>{a||d()},onKeyDown:b=>{"Enter"!==b.key&&" "!==b.key||a||(b.preventDefault(),d())},className:(0,u.cn)("flex h-full items-center justify-center rounded-lg border transition-colors",e?"ring-2 ring-primary/40 bg-primary/5 border-primary/30":"border-dashed border-border/60 bg-muted/20 cursor-pointer hover:bg-muted/40")}),children:(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 h-full py-3",children:[(0,b.jsx)(g,{className:"size-3.5 text-muted-foreground/60 shrink-0"}),(0,b.jsxs)("span",{className:"text-xs font-medium text-muted-foreground",style:{writingMode:"vertical-rl"},children:["Completed (",c,")"]})]})}),(0,b.jsx)(t.TooltipContent,{children:a?"Drop to complete":"Show completed"})]})}function F({issue:a,selected:c,onClick:d,onDelete:e,agent:f,agentsById:g,compact:h=!1}){let{attributes:i,listeners:j,setNodeRef:k,transform:l,isDragging:m}=(0,w.useDraggable)({id:a.id}),n={transform:l?`translate3d(${l.x}px, ${l.y}px, 0)`:void 0,opacity:m?.4:1,cursor:m?"grabbing":"grab"};return(0,b.jsx)("div",{ref:k,style:n,...j,...i,children:(0,b.jsx)(C,{issue:a,selected:c,onClick:d,onDelete:e,agent:f,agentsById:g,compact:h})})}a.s(["default",0,function(){let a,{workspaceId:f,slug:i}=(0,l.useWorkspace)(),{agents:k,loading:r,subscribeWs:s}=(0,m.useAgentContext)(),[B,G]=(0,d.useLocalStorage)(`issue-recent-agent-id-${f}`,""),[H,I]=(0,d.useLocalStorage)(`issue-draft-${f}`,{title:"",description:"",agentId:""}),[J,K]=(0,d.useLocalStorage)("issues-show-completed",!0),[L,M]=(0,c.useState)([]),N=(0,c.useRef)([]);N.current=L;let[O,P]=(0,c.useState)(!0),[Q,R]=(0,c.useState)(!1),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(null),[W,X]=(0,c.useState)(null),[Y,Z]=(0,c.useState)(!1),[$,_]=(0,c.useState)(null),[aa,ab]=(0,c.useState)(448),[ac,ad]=(0,c.useState)(null),[ae,af]=(0,c.useState)(null),[ag,ah]=(0,c.useState)(!1),[ai,aj]=(0,c.useState)(null),ak=(0,c.useRef)(null),al=(0,c.useRef)(0),am=(0,c.useRef)(null),an=(0,w.useSensors)((0,w.useSensor)(w.PointerSensor,{activationConstraint:{distance:8}})),ao=(0,c.useMemo)(()=>new Map(k.map(a=>[a.id,a])),[k]),ap=(0,c.useMemo)(()=>W?.artifacts??[],[W?.artifacts]),{versionMap:aq,duplicateFilenames:ar}=(0,c.useMemo)(()=>(0,z.computeArtifactVersions)(ap),[ap]),as=(0,c.useCallback)(a=>{(0,z.isPreviewable)(a)?(aj(a),ah(!0)):window.open((0,z.getArtifactUrl)(a.id,f,!0),"_blank")},[f]);async function at(){P(!0);try{let[a,b]=await Promise.all([(0,n.listIssues)(f,{terminal:!1}),(0,n.listIssues)(f,{terminal:!0})]);M([...a,...b])}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to load issues")}finally{P(!1)}}async function au(){try{let[a,b]=await Promise.all([(0,n.listIssues)(f,{terminal:!1}),(0,n.listIssues)(f,{terminal:!0})]);M([...a,...b])}catch{}}let av=(0,c.useRef)(null),aw=(0,c.useRef)(!1);function ax(){av.current&&clearTimeout(av.current),av.current=setTimeout(()=>{av.current=null,au().catch(()=>{}),aw.current&&(am.current&&az(am.current).catch(()=>{}),aw.current=!1)},300)}async function ay(a){V(a),am.current=a,T(!0),Z(!0),ad(null);try{let b=await (0,n.getIssue)(f,a);X(b),b.issue.trace_id&&(0,n.getTrace)(b.issue.trace_id,f).then(a=>ad(a.tasks)).catch(()=>ad(null))}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to load issue")}finally{Z(!1)}}async function az(a){let b=++al.current;try{let c=await (0,n.getIssue)(f,a);if(b!==al.current||am.current!==a)return;X(c),c.issue.trace_id&&(0,n.getTrace)(c.issue.trace_id,f).then(c=>{b===al.current&&am.current===a&&ad(c.tasks)}).catch(()=>{});let d=c.issue.latest_task_id;d&&(0,n.getTask)(d,f).then(c=>{b===al.current&&am.current===a&&_(c)}).catch(()=>{})}catch(a){a?.status===404&&aK(!1)}}(0,c.useEffect)(()=>{at()},[f]);let aA=W?.issue.conversation_id??null,aB=(0,c.useRef)(null);aB.current=aA;let aC=W?.issue.latest_task_id??null,aD=(0,c.useRef)(null);aD.current=aC;let aE=W?.issue.agent_id??null,aF=(0,c.useRef)(null);aF.current=aE,(0,c.useEffect)(()=>{if(!aC)return void _(null);let a=!1;return(0,n.getTask)(aC,f).then(b=>{a||_(b)}).catch(()=>{}),()=>{a=!0}},[aC,f]),$&&["completed","failed","cancelled","superseded"].includes($.status),ac?.some(a=>["queued","dispatched","running"].includes(a.status)),(0,c.useEffect)(()=>{let a=s(a=>{if("conversation.message"===a.type&&aB.current&&a.conversationId===aB.current&&(X(b=>!b||b.messages.some(b=>b.id===a.message.id)?b:{...b,messages:[...b.messages,a.message]}),"event"===a.message.role&&a.message.content.startsWith("Issue status changed:")&&!ak.current)){let b=a.message.content.match(/-> (\w+)/);if(b){let c=b[1];X(a=>a?{...a,issue:{...a.issue,status:c}}:a),M(b=>b.map(b=>b.conversation_id===aB.current?{...b,status:c,updated_at:a.message.created_at}:b))}}if("conversation.message"===a.type&&"event"===a.message.role&&a.message.content.startsWith("Issue status changed:")&&!ak.current&&a.conversationId!==aB.current){let b=a.message.content.match(/-> (\w+)/);if(b){let c=b[1];M(b=>b.map(b=>b.conversation_id===a.conversationId?{...b,status:c,updated_at:a.message.created_at}:b))}}if("issue.comment"===a.type&&am.current===a.issueId&&X(b=>!b||b.comments.some(b=>b.id===a.comment.id)?b:{...b,comments:[...b.comments,a.comment]}),"task.updated"===a.type&&("running"===a.status||"completed"===a.status||"failed"===a.status)){if(ak.current)return;let b=N.current;if(0===b.length)return void ax();let c=new Set(b.map(a=>a.agent_id).filter(a=>!!a)),d=new Set(b.map(a=>a.latest_task_id).filter(a=>!!a));if(!c.has(a.agentId)&&!d.has(a.taskId))return;(a.taskId===aD.current||a.agentId===aF.current)&&(aw.current=!0),ax()}});return()=>{a(),av.current&&(clearTimeout(av.current),av.current=null)}},[s]);let aG=(0,c.useCallback)(async a=>{R(!0);try{let b=await (0,n.createIssue)(f,{agent_id:a.agent_id,title:a.title,description:a.description});M(a=>[b.issue,...a]),a.agent_id&&G(a.agent_id),I({title:"",description:"",agentId:""}),V(b.issue.id),am.current=b.issue.id,ay(b.issue.id),v.toast.success("Issue created")}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to create issue")}finally{R(!1)}},[f]),aH=(0,c.useCallback)(async(a,b)=>{try{let c=await (0,n.updateIssue)(f,a,b);M(d=>d.map(d=>d.id===a?{...d,...b,updated_at:c.updated_at}:d)),X(d=>d&&d.issue.id===a?{...d,issue:{...d.issue,...b,updated_at:c.updated_at}}:d)}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to update issue")}},[f]),aI=(0,c.useCallback)(async(a,b)=>{let c=L.find(b=>b.id===a);if(!c)return;let d=c.status;if(b===d)return;let e=new Date().toISOString();M(c=>c.map(c=>c.id===a?{...c,status:b,updated_at:e}:c)),W?.issue.id===a&&X(a=>a?{...a,issue:{...a.issue,status:b,updated_at:e}}:a),ak.current=a;try{await (0,n.updateIssue)(f,a,{status:b})}catch(b){M(b=>b.map(b=>b.id===a?{...b,status:d}:b)),W?.issue.id===a&&X(a=>a?{...a,issue:{...a.issue,status:d}}:a),v.toast.error(b instanceof Error?b.message:"Failed to update issue status")}finally{ak.current=null}},[f,L,W]),aJ=(0,c.useCallback)(async a=>{try{await (0,n.deleteIssue)(f,a),M(b=>b.filter(b=>b.id!==a)),U===a&&(V(null),am.current=null,T(!1),X(null)),v.toast.success("Issue deleted")}catch(a){v.toast.error(a instanceof Error?a.message:"Failed to delete issue")}},[f,U]),aK=(0,c.useCallback)(a=>{T(a),a||(V(null),am.current=null,X(null),_(null),ad(null))},[]);async function aL(a){af(null);let{active:b,over:c}=a;if(!c)return;let d=b.id,e=c.id,g=L.find(a=>a.id===d);if(!g)return;let h=A.find(a=>a.id===e);if(!h||h.statuses.includes(g.status))return;if("todo"===g.status&&!g.agent_id&&"todo"!==e&&"completed"!==e)return void v.toast.error("Assign an agent first to run this issue");let i="completed"===e?"done":e,j=g.status,k=new Date().toISOString();M(a=>a.map(a=>a.id===d?{...a,status:i,updated_at:k}:a)),W?.issue.id===d&&X(a=>a?{...a,issue:{...a.issue,status:i,updated_at:k}}:a),ak.current=d;try{await (0,n.updateIssue)(f,d,{status:i})}catch(a){M(a=>a.map(a=>a.id===d?{...a,status:j}:a)),W?.issue.id===d&&X(a=>a?{...a,issue:{...a.issue,status:j}}:a),v.toast.error(a instanceof Error?a.message:"Failed to update issue status")}finally{ak.current=null}}let aM=O||r,aN=U?L.find(a=>a.id===U)??null:null;return(0,b.jsxs)("div",{className:"relative flex h-full min-h-0 flex-col bg-background/30",children:[(0,b.jsxs)("div",{className:"flex shrink-0 flex-col gap-3 border-b border-border/60 px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5 sm:py-4",children:[(0,b.jsx)("div",{className:"min-w-0",children:(0,b.jsx)("h1",{className:"text-base font-semibold tracking-normal",children:"Issues"})}),(0,b.jsx)("div",{className:"flex items-center gap-2",children:(0,b.jsxs)(o.Button,{size:"sm",className:"w-full sm:w-auto",onClick:()=>{V(null),am.current=null,T(!0)},children:[(0,b.jsx)(j.Plus,{className:"size-4"}),"New issue"]})})]}),(0,b.jsx)("div",{className:"hidden min-h-0 flex-1 lg:block overflow-y-auto thin-scrollbar p-4",children:aM?(0,b.jsxs)("div",{className:(0,u.cn)("grid h-full gap-4",J?"grid-cols-4":"grid-cols-[1fr_1fr_1fr_36px]"),children:[[3,2,2,...J?[2]:[]].map((a,c)=>(0,b.jsxs)("div",{className:"flex min-h-0 flex-col rounded-lg border border-border/60 bg-card/60",children:[(0,b.jsx)("div",{className:"border-b border-border/60 bg-muted/30 px-3 py-2",children:(0,b.jsx)(q.Skeleton,{className:"h-3 w-16"})}),(0,b.jsx)("div",{className:"min-h-0 flex-1 space-y-2 p-2",children:Array.from({length:a}).map((a,c)=>(0,b.jsxs)("div",{className:"rounded-lg border bg-background/75 p-3",children:[(0,b.jsx)(q.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(q.Skeleton,{className:"mt-1 h-3 w-1/2"}),(0,b.jsx)(q.Skeleton,{className:"mt-2 h-3 w-1/3"})]},c))})]},c)),!J&&(0,b.jsx)("div",{className:"h-full rounded-lg border border-dashed border-border/60 bg-muted/20"})]}):0===L.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(e.CircleDot,{className:"size-8 text-muted-foreground mb-3"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No issues"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create one to get started."})]}):(0,b.jsxs)(w.DndContext,{sensors:an,onDragStart:function(a){af(a.active.id)},onDragEnd:aL,children:[(0,b.jsxs)("div",{className:(0,u.cn)("grid h-full gap-4 animate-[fade-up_200ms_ease-out_both]",J?"grid-cols-4":"grid-cols-[1fr_1fr_1fr_36px]"),children:[A.filter(a=>"completed"!==a.id||J).map(a=>{let c=L.filter(b=>a.statuses.includes(b.status));return(0,b.jsxs)(D,{id:a.id,children:[(0,b.jsxs)("div",{className:"flex shrink-0 items-center justify-between border-b border-border/60 bg-muted/30 px-3 py-2 text-xs font-medium text-muted-foreground",children:[(0,b.jsx)("span",{children:a.label}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)("span",{children:c.length}),"completed"===a.id&&(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button","aria-label":"Hide completed column",disabled:!!ae,onClick:()=>K(!1),className:"rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-muted hover:text-muted-foreground disabled:opacity-40"}),children:(0,b.jsx)(h,{className:"size-3.5"})}),(0,b.jsx)(t.TooltipContent,{children:"Hide completed"})]})]})]}),(0,b.jsx)("div",{className:(0,u.cn)("min-h-0 flex-1 space-y-2 overflow-y-auto thin-scrollbar p-2","completed"===a.id&&"animate-[fade-up_300ms_ease-out_both]"),children:0===c.length?(0,b.jsx)("div",{className:"flex h-full min-h-20 items-center justify-center rounded-lg border border-dashed border-border/45 text-xs text-muted-foreground/70",children:"Empty"}):c.map(a=>(0,b.jsx)(F,{issue:a,selected:U===a.id,onClick:()=>ay(a.id),onDelete:()=>aJ(a.id),agent:ao.get(a.agent_id??"")??null,agentsById:ao},a.id))})]},a.id)}),!J&&(0,b.jsx)(E,{activeDragId:ae,completedCount:L.filter(a=>A[3].statuses.includes(a.status)).length,onExpand:()=>K(!0)})]}),(0,b.jsx)(w.DragOverlay,{style:{zIndex:9999},children:ae&&(a=L.find(a=>a.id===ae))?(0,b.jsx)(C,{issue:a,selected:!1,onClick:()=>{},agent:ao.get(a.agent_id??"")??null,agentsById:ao}):null})]})}),(0,b.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto thin-scrollbar p-3 lg:hidden",children:aM?(0,b.jsxs)("div",{className:"space-y-4",children:[[0,1,2].map(a=>(0,b.jsxs)("div",{className:"rounded-lg border border-border/60 bg-card/60",children:[(0,b.jsx)("div",{className:"border-b border-border/50 px-3 py-2",children:(0,b.jsx)(q.Skeleton,{className:"h-4 w-20"})}),(0,b.jsx)("div",{className:"space-y-2 p-3",children:Array.from({length:2}).map((a,c)=>(0,b.jsxs)("div",{className:"rounded-lg border bg-background/75 p-3",children:[(0,b.jsx)(q.Skeleton,{className:"h-4 w-3/4"}),(0,b.jsx)(q.Skeleton,{className:"mt-1 h-3 w-1/2"}),(0,b.jsx)(q.Skeleton,{className:"mt-2 h-3 w-1/3"})]},c))})]},a)),(0,b.jsx)("div",{className:"rounded-lg border border-dashed border-border/60 px-3 py-2.5",children:(0,b.jsx)(q.Skeleton,{className:"h-4 w-32"})})]}):0===L.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center h-full animate-[fade-up_400ms_ease-out_both]",children:[(0,b.jsx)(e.CircleDot,{className:"size-8 text-muted-foreground mb-3"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"No issues yet"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60 mt-1",children:"Create one to get started."})]}):(0,b.jsxs)("div",{className:"space-y-4 animate-[fade-up_200ms_ease-out_both]",children:[A.map(a=>{if("completed"===a.id&&!J)return null;let c=L.filter(b=>a.statuses.includes(b.status));return 0===c.length?null:(0,b.jsxs)("section",{className:"rounded-lg border border-border/60 bg-card/60",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 py-2 text-sm font-medium",children:[(0,b.jsx)("span",{children:a.label}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)(p.Badge,{variant:"outline",children:c.length}),"completed"===a.id&&(0,b.jsxs)(t.Tooltip,{children:[(0,b.jsx)(t.TooltipTrigger,{render:(0,b.jsx)("button",{type:"button","aria-label":"Hide completed column",onClick:()=>K(!1),className:"rounded p-0.5 text-muted-foreground/60 transition-colors hover:bg-muted hover:text-muted-foreground"}),children:(0,b.jsx)(h,{className:"size-3.5"})}),(0,b.jsx)(t.TooltipContent,{children:"Hide completed"})]})]})]}),(0,b.jsx)("div",{className:"space-y-2 p-3",children:c.map(a=>(0,b.jsx)(C,{issue:a,selected:U===a.id,onClick:()=>ay(a.id),onDelete:()=>aJ(a.id),agent:ao.get(a.agent_id??"")??null,agentsById:ao,compact:!0},a.id))})]},a.id)}),!J&&(0,b.jsxs)("div",{role:"button",tabIndex:0,"aria-label":"Show completed issues",onClick:()=>K(!0),onKeyDown:a=>{("Enter"===a.key||" "===a.key)&&(a.preventDefault(),K(!0))},className:"flex cursor-pointer items-center gap-2 rounded-lg border border-dashed border-border/60 px-3 py-2.5 text-sm text-muted-foreground transition-colors hover:bg-muted/30",children:[(0,b.jsx)(g,{className:"size-3.5"}),(0,b.jsxs)("span",{children:["Show Completed (",L.filter(a=>A[3].statuses.includes(a.status)).length,")"]})]})]})}),(0,b.jsx)(x.IssueSheet,{open:S,onOpenChange:aK,agents:k,issue:aN,detail:W?{messages:W.messages,comments:W.comments,artifacts:W.artifacts,traceId:W.issue.trace_id}:null,detailLoading:Y,activeTask:$,traceTasks:ac,submitting:Q,defaultAgentId:B,slug:i,workspaceId:f,width:aa,onWidthChange:ab,draft:H,onDraftChange:I,onCreate:aG,onUpdate:aH,onStatusChange:aI,onCommented:()=>U&&ay(U),onDispatched:a=>{au(),ay(a)},onArtifactClick:as}),(0,b.jsx)(y.ArtifactSheet,{open:ag,onOpenChange:a=>{ah(a),a||setTimeout(()=>aj(null),300)},artifacts:ap,workspaceId:f,initialArtifact:ai,versionMap:aq,duplicateFilenames:ar})]})}],731633)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_app_%28app%29_w_%5Bslug%5D_issues_page_tsx_0_k5j03._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[294526,a=>{"use strict";var b,c=a.i(749314),d=a.i(437199),e=a.i(654461),f=a.i(75118),g=a.i(921584),h=a.i(207058),i=a.i(506180),j=a.i(454607),k=a.i(588339),l=a.i(732254),m=a.i(334235),n=a.i(76592),o=a.i(25668),p=a.i(390248);function q(){let{workspaceId:a,slug:b}=(0,i.useWorkspace)(),e=(0,j.useSession)(),f=(0,h.useRouter)(),[q,r]=(0,d.useState)(""),[s,t]=(0,d.useState)(!0),[u,v]=(0,d.useState)(""),[w,x]=(0,d.useState)(""),[y,z]=(0,d.useState)(""),[A,B]=(0,d.useState)(""),[C,D]=(0,d.useState)(!1),[E,F]=(0,d.useState)({}),[G,H]=(0,d.useState)(""),[I,J]=(0,d.useState)(!1),K=(0,d.useCallback)(async()=>{t(!0);try{let b=e.data?.user?.id,[c,d]=await Promise.all([(0,k.listMembers)(a),(0,k.listWorkspaces)()]),f=c.find(a=>a.user_id===b);r(f?.role??"");let g=d.find(b=>b.id===a);g&&(v(g.name),x(g.slug),z(g.name),B(g.slug))}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to load workspace info")}finally{t(!1)}},[a,e.data?.user?.id]);(0,d.useEffect)(()=>{e.data&&K()},[K,e.data]);let L=u!==y||w!==A,M=async()=>{let c=(0,p.validateWorkspaceForm)({name:u,slug:w});if(F(c),!(0,p.hasWorkspaceFormErrors)(c)){D(!0);try{let c=await (0,k.updateWorkspace)(a,{name:u.trim(),slug:w.trim()});z(c.name),B(c.slug),g.toast.success("Workspace updated"),c.slug!==b&&f.replace(`/w/${c.slug}/settings`)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to update workspace")}finally{D(!1)}}},N=async()=>{if(G===y){J(!0);try{await (0,k.deleteWorkspace)(a,y),g.toast.success("Workspace deleted"),f.replace("/workspaces")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to delete workspace")}finally{J(!1)}}};return s?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-4 w-32"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"})]}):"owner"!==q?(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Only workspace owners can edit workspace settings."}):(0,c.jsxs)("div",{className:"space-y-10",children:[(0,c.jsxs)("section",{className:"space-y-4",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Workspace"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"space-y-1.5",children:[(0,c.jsx)(n.Label,{htmlFor:"workspace-name",children:"Name"}),(0,c.jsx)(m.Input,{id:"workspace-name",value:u,onChange:a=>{let b=a.target.value;v(b),E.name&&b.trim()&&F(a=>({...a,name:void 0}))},placeholder:"Workspace name","aria-invalid":!!E.name,"aria-describedby":E.name?"workspace-name-error":void 0}),E.name&&(0,c.jsx)("p",{id:"workspace-name-error",className:"text-xs text-destructive",children:E.name})]}),(0,c.jsxs)("div",{className:"space-y-1.5",children:[(0,c.jsx)(n.Label,{htmlFor:"workspace-slug",children:"Slug"}),(0,c.jsx)(m.Input,{id:"workspace-slug",value:w,onChange:a=>{let b=a.target.value;x(b),E.slug&&b.trim()&&F(a=>({...a,slug:void 0}))},placeholder:"workspace-slug","aria-invalid":!!E.slug,"aria-describedby":E.slug?"workspace-slug-error":void 0}),E.slug&&(0,c.jsx)("p",{id:"workspace-slug-error",className:"text-xs text-destructive",children:E.slug}),(0,c.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:["Used in URLs: /w/",w,"/"]})]})]}),(0,c.jsx)(l.Button,{size:"sm",onClick:M,disabled:!L||C,children:C?"Saving…":"Save"})]}),(0,c.jsxs)("section",{className:"space-y-4",children:[(0,c.jsx)("h2",{className:"text-sm font-medium text-destructive",children:"Danger Zone"}),(0,c.jsxs)("div",{className:"rounded-md border border-destructive/30 p-4 space-y-3",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Deleting this workspace is permanent and cannot be undone. All agents, conversations, and data will be lost."}),(0,c.jsxs)("div",{className:"space-y-1.5",children:[(0,c.jsxs)(n.Label,{htmlFor:"delete-confirm",className:"text-xs",children:["Type ",(0,c.jsx)("span",{className:"font-medium text-foreground",children:y})," to confirm"]}),(0,c.jsx)(m.Input,{id:"delete-confirm",value:G,onChange:a=>H(a.target.value),placeholder:y})]}),(0,c.jsx)(l.Button,{size:"sm",variant:"destructive",onClick:N,disabled:G!==y||I,children:I?"Deleting…":"Delete Workspace"})]})]})]})}var r=a.i(889624);function s({ratio:a,size:b=16,stroke:d=1.5}){let e=(b-d)/2,g=2*Math.PI*e,h=(a<=0?0:a>=1?1:Math.log1p(99*a)/Math.log(100))*g;return(0,c.jsxs)("svg",{width:b,height:b,className:"shrink-0 -rotate-90","aria-hidden":!0,children:[(0,c.jsx)("circle",{cx:b/2,cy:b/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,className:"text-border"}),(0,c.jsx)("circle",{cx:b/2,cy:b/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,strokeDasharray:`${h} ${g-h}`,strokeLinecap:"round",className:(0,f.cn)("transition-all duration-300",a>.9?"text-destructive/70":a>.7?"text-yellow-500/50":"text-muted-foreground/30")})]})}function t(){let{workspaceId:a}=(0,i.useWorkspace)(),[b,e]=(0,d.useState)(""),[f,h]=(0,d.useState)(""),[j,l]=(0,d.useState)(!0),m=(0,d.useRef)(b);(0,d.useEffect)(()=>{m.current=b},[b]);let n=(0,d.useRef)(f);(0,d.useEffect)(()=>{n.current=f},[f]);let p=(0,d.useRef)(null),q=(0,d.useRef)(!1),t=(0,d.useCallback)(async()=>{l(!0);try{let b=await (0,k.getMemberMe)(a);e(b.global_instruction),h(b.global_instruction)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to load settings")}finally{l(!1)}},[a]);(0,d.useEffect)(()=>{t()},[t]);let u=(0,d.useRef)(()=>{}),v=(0,d.useCallback)(async()=>{if(q.current)return;let b=m.current;if(b!==n.current){q.current=!0;try{let c=await (0,k.updateMemberMe)(a,b);h(c.global_instruction)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to save")}finally{q.current=!1,m.current!==n.current&&u.current()}}},[a]),w=(0,d.useCallback)(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(v,500)},[v]);(0,d.useEffect)(()=>{u.current=w},[w]);let x=(0,d.useCallback)(a=>{e(a),w()},[w]);(0,d.useEffect)(()=>{let b=()=>{if(p.current&&clearTimeout(p.current),m.current!==n.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:m.current}),keepalive:!0})}};return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[a]),(0,d.useEffect)(()=>()=>{if(p.current&&clearTimeout(p.current),m.current!==n.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:m.current}),keepalive:!0})}},[a]);let y=b.length/5e4;return j?(0,c.jsxs)("div",{className:"px-6 py-6 space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-4 w-48"}),(0,c.jsx)(o.Skeleton,{className:"h-40 w-full"})]}):(0,c.jsxs)("div",{className:"flex flex-col h-full",children:[(0,c.jsx)("div",{className:"flex-1 px-6 pt-4 pb-4",children:(0,c.jsx)(r.MarkdownEditor,{value:b,onChange:x,placeholder:"Write instructions that every agent you own will follow...",minHeight:"calc(100vh - 240px)",contentType:"markdown",variant:"seamless"})}),(0,c.jsxs)("div",{className:"flex items-center gap-2 px-6 py-3",children:[(0,c.jsx)(s,{ratio:y}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"This instruction is prepended to every agent's individual instruction."})]})]})}var u=a.i(166776),v=a.i(695004),w=a.i(911057),x=a.i(790090);let y=(0,x.default)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);function z(a){return`${window.location.origin}/invite/${a}`}function A(){let{workspaceId:a}=(0,i.useWorkspace)(),b=(0,j.useSession)(),e=b.data?.user?.id,[h,m]=(0,d.useState)([]),[n,p]=(0,d.useState)([]),[q,r]=(0,d.useState)(!0),[s,t]=(0,d.useState)(!1),x=h.find(a=>a.user_id===e)?.role==="owner",A=(0,d.useCallback)(async()=>{r(!0);try{let[b,c]=await Promise.all([(0,k.listMembers)(a),(0,k.listInvites)(a).catch(()=>[])]);m(b),p(c)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to load members")}finally{r(!1)}},[a]);(0,d.useEffect)(()=>{A()},[A]);let B=async()=>{t(!0);try{let b=await (0,k.createInvite)(a);p(a=>[...a,b]);let c=z(b.token);await navigator.clipboard.writeText(c),g.toast.success("Invite link copied to clipboard")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to generate invite")}finally{t(!1)}},C=async a=>{let b=z(a);try{await navigator.clipboard.writeText(b),g.toast.success("Invite link copied")}catch{g.toast.error("Failed to copy link")}},D=async b=>{try{await (0,k.revokeInvite)(a,b),p(a=>a.filter(a=>a.id!==b)),g.toast.success("Invite revoked")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to revoke invite")}},E=async b=>{try{await (0,k.removeMember)(a,b),m(a=>a.filter(a=>a.id!==b)),g.toast.success("Member removed")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to remove member")}};return q?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-4 w-24"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-4 w-24 mt-6"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"})]}):(0,c.jsxs)("div",{className:"space-y-8",children:[x&&(0,c.jsxs)("section",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Pending Invites"}),(0,c.jsxs)(l.Button,{size:"sm",variant:"outline",onClick:B,disabled:s,children:[(0,c.jsx)(w.Plus,{className:"size-3.5 mr-1"}),s?"Generating…":"Generate invite link"]})]}),0===n.length?(0,c.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:"No active invite links. Generate one to invite someone to this workspace."}):(0,c.jsx)("div",{className:"space-y-1.5",children:n.map(a=>{let b=new Date(a.expires_at),d=b<new Date;return(0,c.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2 text-xs",children:[(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("p",{className:(0,f.cn)("font-mono truncate",d&&"text-muted-foreground line-through"),children:["/invite/",a.token.slice(0,12),"…"]}),(0,c.jsx)("p",{className:(0,f.cn)("text-muted-foreground/70 mt-0.5",d&&"text-destructive/70"),children:d?"Expired":`Expires ${b.toLocaleDateString()}`})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1 ml-2 shrink-0",children:[!d&&(0,c.jsx)(l.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>C(a.token),title:"Copy invite link",children:(0,c.jsx)(u.Copy,{className:"size-3.5"})}),(0,c.jsx)(l.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>D(a.id),title:"Revoke invite",children:(0,c.jsx)(v.Trash2,{className:"size-3.5"})})]})]},a.id)})})]}),(0,c.jsxs)("section",{className:"space-y-3",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Members"}),(0,c.jsx)("div",{className:"space-y-1.5",children:h.map(a=>{let b=a.user_id===e,d=a.name?a.name.split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase():a.email.slice(0,2).toUpperCase();return(0,c.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/50 px-3 py-2",children:[(0,c.jsx)("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground shrink-0 overflow-hidden",children:a.image?(0,c.jsx)("img",{src:a.image,alt:a.name,className:"size-full object-cover"}):d}),(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("p",{className:"text-sm font-medium truncate leading-tight",children:[a.name||a.email,b&&(0,c.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"(you)"})]}),a.name&&(0,c.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:a.email})]}),(0,c.jsx)("span",{className:(0,f.cn)("text-xs px-1.5 py-0.5 rounded shrink-0","owner"===a.role?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.role}),x&&!b&&(0,c.jsx)(l.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:()=>E(a.id),title:"Remove member",children:(0,c.jsx)(y,{className:"size-3.5"})})]},a.id)})})]})]})}var B=a.i(951687);a.s([],443440),a.i(443440);var C=a.i(520950),D=a.i(935469),E=a.i(556053),F=a.i(901496),G=a.i(207116),H=a.i(181749),I=a.i(147909),J=a.i(991367),K=a.i(423994),L=a.i(367183),M=a.i(485177);let N=d.createContext(void 0);var O=a.i(621907);let P=((b={}).checked="data-checked",b.unchecked="data-unchecked",b.disabled="data-disabled",b.readonly="data-readonly",b.required="data-required",b.valid="data-valid",b.invalid="data-invalid",b.touched="data-touched",b.dirty="data-dirty",b.filled="data-filled",b.focused="data-focused",b),Q={...O.fieldValidityMapping,checked:a=>a?{[P.checked]:""}:{[P.unchecked]:""}};var R=a.i(874417),S=a.i(336789),T=a.i(582050),U=a.i(63462),V=a.i(117906),W=a.i(140295),X=a.i(331700),Y=a.i(874514),Z=a.i(36136);let $=d.forwardRef(function(a,b){let{checked:e,className:f,defaultChecked:g,"aria-labelledby":h,form:i,id:j,inputRef:k,name:l,nativeButton:m=!1,onCheckedChange:n,readOnly:o=!1,required:p=!1,disabled:q=!1,render:r,uncheckedValue:s,value:t,style:u,...v}=a,{clearErrors:w}=(0,T.useFormContext)(),{state:x,setTouched:y,setDirty:z,validityData:A,setFilled:B,setFocused:M,shouldValidateOnChange:O,validationMode:P,disabled:$,name:_,validation:aa}=(0,R.useFieldRootContext)(),{labelId:ab}=(0,U.useLabelableContext)(),ac=$||q,ad=_??l,ae=(0,D.useStableCallback)(n),af=d.useRef(null),ag=(0,E.useMergedRefs)(af,k,aa.inputRef),ah=d.useRef(null),ai=(0,K.useBaseUiId)(),aj=(0,W.useLabelableId)({id:j,implicit:!1,controlRef:ah}),ak=m?void 0:aj,[al,am]=(0,C.useControlled)({controlled:e,default:!!g,name:"Switch",state:"checked"});(0,S.useRegisterFieldControl)(ah,{id:ai,value:al}),(0,F.useIsoLayoutEffect)(()=>{af.current&&B(af.current.checked)},[af,B]),(0,Z.useValueChanged)(al,()=>{w(ad),z(al!==A.initialValue),B(al),O()?aa.commit(al):aa.commit(al,!0)});let{getButtonProps:an,buttonRef:ao}=(0,L.useButton)({disabled:ac,native:m}),ap=(0,V.useAriaLabelledBy)(h,ab,af,!m,ak),aq=d.useMemo(()=>(0,J.mergeProps)({checked:al,disabled:ac,form:i,id:ak,name:ad,required:p,style:ad?G.visuallyHiddenInput:G.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:ag,onChange(a){if(a.nativeEvent.defaultPrevented)return;if(o)return void a.preventDefault();let b=a.currentTarget.checked,c=(0,X.createChangeEventDetails)(Y.REASONS.none,a.nativeEvent);ae?.(b,c),c.isCanceled||am(b)},onFocus(){ah.current?.focus()}},aa.getInputValidationProps,void 0!==t?{value:t}:H.EMPTY_OBJECT),[al,ac,i,ag,ak,ad,ae,o,p,am,aa,t]),ar=d.useMemo(()=>({...x,checked:al,disabled:ac,readOnly:o,required:p}),[x,al,ac,o,p]),as=(0,I.useRenderElement)("span",a,{state:ar,ref:[b,ah,ao],props:[{id:m?aj:ai,role:"switch","aria-checked":al,"aria-readonly":o||void 0,"aria-required":p||void 0,"aria-labelledby":ap,onFocus(){ac||M(!0)},onBlur(){let a=af.current;a&&!ac&&(y(!0),M(!1),"onBlur"===P&&aa.commit(a.checked))},onClick(a){o||ac||(a.preventDefault(),af.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:a.shiftKey,ctrlKey:a.ctrlKey,altKey:a.altKey,metaKey:a.metaKey})))}},aa.getValidationProps,v,an],stateAttributesMapping:Q});return(0,c.jsxs)(N.Provider,{value:ar,children:[as,!al&&ad&&void 0!==s&&(0,c.jsx)("input",{type:"hidden",form:i,name:ad,value:s}),(0,c.jsx)("input",{...aq,suppressHydrationWarning:!0})]})}),_=d.forwardRef(function(a,b){let{render:c,className:e,style:f,...g}=a,{state:h}=(0,R.useFieldRootContext)(),i=function(){let a=d.useContext(N);if(void 0===a)throw Error((0,M.default)(63));return a}(),j={...h,...i};return(0,I.useRenderElement)("span",a,{state:j,ref:b,stateAttributesMapping:Q,props:g})});a.s(["Root",0,$,"Thumb",0,_],795013);var aa=a.i(795013),aa=aa;function ab({className:a,size:b="default",...d}){return(0,c.jsx)(aa.Root,{"data-slot":"switch","data-size":b,className:(0,f.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",a),...d,children:(0,c.jsx)(aa.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}var ac=a.i(626806);function ad(){let[a,b]=(0,d.useState)(!1),[e,f]=(0,d.useState)([...ac.NOTIFICATION_EVENTS]),[h,i]=(0,d.useState)(!0),[j,k]=(0,d.useState)(!1);(0,d.useEffect)(()=>{i((0,ac.isNotificationSupported)()),b((0,ac.getNotificationEnabled)()),f((0,ac.getNotificationEvents)()),(0,ac.isNotificationSupported)()&&k("denied"===Notification.permission)},[]);let l=async a=>{if(!a){b(!1),(0,ac.setNotificationEnabled)(!1);return}await (0,ac.requestNotificationPermission)()?(b(!0),(0,ac.setNotificationEnabled)(!0)):(k(!0),g.toast.error("Notification permission denied. Please enable it in browser settings."))};return h?(0,c.jsx)("div",{className:"space-y-6",children:(0,c.jsxs)("section",{className:"space-y-4",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Browser Notifications"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"space-y-0.5",children:[(0,c.jsx)("p",{className:"text-sm",children:"Enable notifications"}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get notified when tasks finish while the tab is in the background"})]}),(0,c.jsx)(ab,{checked:a,onCheckedChange:l,disabled:j&&!a})]}),j&&!a&&(0,c.jsx)("p",{className:"text-xs text-destructive",children:"Notification permission was denied. Please allow it in your browser settings."}),a&&(0,c.jsxs)("div",{className:"space-y-2 pl-0.5",children:[(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Notify me when:"}),ac.NOTIFICATION_EVENTS.map(a=>(0,c.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[(0,c.jsx)(B.Checkbox,{checked:e.includes(a),onCheckedChange:()=>{f(b=>{let c=b.includes(a)?b.filter(b=>b!==a):[...b,a];return(0,ac.setNotificationEvents)(c),c})}}),ac.NOTIFICATION_EVENT_LABELS[a]]},a))]})]})]})}):(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your browser does not support notifications."})}var ae=a.i(752792),af=a.i(439882),ag=a.i(464830);let ah=(0,x.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var ai=a.i(918768),aj=a.i(292948);let ak=(0,x.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);var al=a.i(385539);let am=(0,x.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function an({icon:a,label:b,value:d,sub:e}){return(0,c.jsx)(af.Card,{size:"sm",children:(0,c.jsxs)(af.CardContent,{className:"flex items-center gap-3",children:[(0,c.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,c.jsx)(a,{className:"size-4"})}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,c.jsx)("p",{className:"text-2xl font-semibold leading-none tracking-tight",children:d}),e&&(0,c.jsx)(ag.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4 font-normal",children:e})]}),(0,c.jsx)("p",{className:"mt-1 text-xs text-muted-foreground truncate",children:b})]})]})})}function ao({agents:a,runtimes:b,activeTaskCounts:d,overview:e}){let f=new Map;for(let a of b){let b=a.daemon_id??a.id;f.set(b,f.get(b)||"online"===a.status)}let g=f.size,h=[...f.values()].filter(Boolean).length,i=Object.values(d).reduce((a,b)=>a+b,0),j=a.filter(a=>{let c=b.find(b=>b.id===a.runtime_id);return c?.status==="online"}).length;return(0,c.jsxs)("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",children:[(0,c.jsx)(an,{icon:al.Monitor,label:"Machines",value:`${h}/${g}`,sub:"online"}),(0,c.jsx)(an,{icon:ah,label:"Agents",value:a.length,sub:`${j} online`}),(0,c.jsx)(an,{icon:ak,label:"Members",value:e.members.length,sub:e.pending_invites>0?`${e.pending_invites} pending`:void 0}),(0,c.jsx)(an,{icon:am,label:"Active Tasks",value:i,sub:e.task_stats.queued>0?`${e.task_stats.queued} queued`:void 0}),(0,c.jsx)(an,{icon:aj.Send,label:"Emails Sent",value:e.email_stats.outbound,sub:`${e.email_stats.unread} unread`}),(0,c.jsx)(an,{icon:ai.Mail,label:"Custom Emails",value:e.email_accounts.length})]})}function ap({overview:a}){let{completed:b,failed:d,cancelled:e,queued:f,stale:g}=a.task_stats,h=b+d,i=h>0?(d/h*100).toFixed(1):"0";return(0,c.jsxs)(af.Card,{children:[(0,c.jsx)(af.CardHeader,{children:(0,c.jsx)(af.CardTitle,{children:"Task Health (Today)"})}),(0,c.jsx)(af.CardContent,{children:(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,c.jsx)(aq,{label:"Completed",value:b}),(0,c.jsx)(aq,{label:"Failed",value:d,className:d>0?"text-destructive":void 0}),(0,c.jsx)(aq,{label:"Cancelled",value:e}),(0,c.jsx)(aq,{label:"Failure Rate",value:`${i}%`,className:Number(i)>10?"text-destructive":void 0}),(0,c.jsx)(aq,{label:"Queue Backlog",value:f,className:f>10?"text-amber-500":void 0}),(0,c.jsx)(aq,{label:"Stale Tasks",value:g,className:g>0?"text-destructive":void 0})]})})]})}function aq({label:a,value:b,className:d}){return(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:`text-xl font-semibold ${d??""}`,children:b}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:a})]})}var ar=a.i(525132);function as({overview:a,agents:b}){let{inbound:d,outbound:e,unread:f,rejected:g}=a.email_stats,h=new Map(b.map(a=>[a.id,a.name]));return(0,c.jsxs)(af.Card,{children:[(0,c.jsx)(af.CardHeader,{children:(0,c.jsx)(af.CardTitle,{children:"Email Summary"})}),(0,c.jsxs)(af.CardContent,{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-xl font-semibold",children:d}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Received"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-xl font-semibold",children:e}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sent"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:`text-xl font-semibold ${f>0?"text-primary":""}`,children:f}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Unread"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:`text-xl font-semibold ${g>0?"text-amber-500":""}`,children:g}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Untrust"})]})]}),a.email_accounts.length>0&&(0,c.jsxs)("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[(0,c.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Custom Mailboxes"}),a.email_accounts.map(a=>(0,c.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,c.jsxs)(ar.Tooltip,{children:[(0,c.jsx)(ar.TooltipTrigger,{render:(0,c.jsx)("span",{className:`size-1.5 shrink-0 rounded-full ${"active"===a.status?"bg-emerald-500":"bg-destructive"}`})}),(0,c.jsx)(ar.TooltipContent,{side:"top",children:"active"===a.status?"Active":`Error: ${a.error_message||"inactive"}`})]}),(0,c.jsx)("span",{className:"truncate",children:a.email_address})]}),(0,c.jsx)("span",{className:"text-muted-foreground shrink-0",children:h.get(a.agent_id)??"—"})]},a.id))]})]})]})}var at=a.i(578894);function au({runtimes:a,agents:b}){let d=(0,h.useRouter)(),{slug:e}=(0,i.useWorkspace)(),f=new Map;for(let b of a){let a=b.daemon_id??b.id;f.has(a)||f.set(a,{runtimes:[],deviceInfo:b.device_info??""}),f.get(a).runtimes.push(b)}let g=[...f.entries()];return 0===g.length?(0,c.jsxs)(af.Card,{children:[(0,c.jsxs)(af.CardHeader,{children:[(0,c.jsx)(af.CardTitle,{children:"Machines"}),(0,c.jsx)(af.CardAction,{children:(0,c.jsx)("button",{type:"button",onClick:()=>d.push(`/w/${e}/runtimes`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,c.jsx)(at.ArrowUpRight,{className:"size-4"})})})]}),(0,c.jsx)(af.CardContent,{children:(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"No machines connected."})})]}):(0,c.jsxs)(af.Card,{children:[(0,c.jsx)(af.CardHeader,{children:(0,c.jsx)(af.CardTitle,{children:"Machines"})}),(0,c.jsx)(af.CardContent,{className:"space-y-3",children:g.map(([a,d])=>{let e=d.runtimes.some(a=>"online"===a.status),f=d.runtimes.map(a=>a.last_seen_at).filter(Boolean).sort().reverse()[0],g=b.filter(a=>d.runtimes.some(b=>b.id===a.runtime_id)),h=d.runtimes.some(a=>a.pending_update_version),i=d.runtimes.find(a=>a.pending_update_version)?.pending_update_version;return(0,c.jsxs)("div",{className:"flex items-start gap-3 text-xs",children:[(0,c.jsxs)(ar.Tooltip,{children:[(0,c.jsx)(ar.TooltipTrigger,{render:(0,c.jsx)("span",{className:`mt-1 size-2 shrink-0 rounded-full ${e?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,c.jsx)(ar.TooltipContent,{side:"top",children:e?"Online":"Offline"})]}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"font-medium truncate",children:d.deviceInfo||a.slice(0,12)}),h&&(0,c.jsxs)(ar.Tooltip,{children:[(0,c.jsx)(ar.TooltipTrigger,{render:(0,c.jsx)("span",{children:(0,c.jsx)(ag.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-amber-500 border-amber-500/30",children:"update"})})}),(0,c.jsxs)(ar.TooltipContent,{side:"top",children:["Pending update to v",i]})]})]}),(0,c.jsxs)("div",{className:"text-muted-foreground mt-0.5",children:[g.length>0?g.map(a=>a.name).join(", "):"No agents"," · ",function(a){if(!a)return"never";let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}(f??null)]})]})]},a)})})]})}function av({overview:a}){let b=(0,h.useRouter)(),{slug:d}=(0,i.useWorkspace)(),{members:e,pending_invites:f}=a;return(0,c.jsxs)(af.Card,{children:[(0,c.jsxs)(af.CardHeader,{children:[(0,c.jsx)(af.CardAction,{children:(0,c.jsx)("button",{type:"button",onClick:()=>b.push(`/w/${d}/settings`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,c.jsx)(at.ArrowUpRight,{className:"size-4"})})}),(0,c.jsxs)(af.CardTitle,{children:["Team",f>0&&(0,c.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:["(",f," pending invite",f>1?"s":"",")"]})]})]}),(0,c.jsx)(af.CardContent,{className:"p-0",children:(0,c.jsx)("div",{className:"divide-y divide-border/50",children:[...e].sort((a,b)=>"owner"===a.role?-1:+("owner"===b.role)).map(a=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[a.image?(0,c.jsx)("img",{src:a.image,alt:a.name,className:"size-7 rounded-full shrink-0"}):(0,c.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-medium",children:(a.name||a.email).charAt(0).toUpperCase()}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("span",{className:"text-sm font-medium truncate block",children:a.name||a.email}),a.name&&(0,c.jsx)("span",{className:"text-xs text-muted-foreground truncate block",children:a.email})]}),(0,c.jsx)(ag.Badge,{variant:"owner"===a.role?"default":"secondary",className:"text-[10px] px-1.5 py-0 shrink-0",children:a.role})]},a.id))})})]})}function aw(){let{agents:a,runtimes:b,loading:e,activeTaskCounts:f}=(0,ae.useAgentContext)(),{workspaceId:g}=(0,i.useWorkspace)(),[h,j]=(0,d.useState)(null),[l,m]=(0,d.useState)(!1);return((0,d.useEffect)(()=>{if(e)return;let a=!1;return m(!0),(0,k.getWorkspaceOverview)(g).then(b=>{a||j(b)}).catch(()=>{}).finally(()=>{a||m(!1)}),()=>{a=!0}},[e,g]),l||!h)?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"}),(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"}),(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"}),(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"})]}):(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(ao,{agents:a,runtimes:b,activeTaskCounts:f,overview:h}),(0,c.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,c.jsx)(ap,{overview:h}),(0,c.jsx)(as,{overview:h,agents:a})]}),(0,c.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,c.jsx)(au,{runtimes:b,agents:a}),(0,c.jsx)(av,{overview:h})]})]})}let ax=[{id:"general",label:"General"},{id:"instruction",label:"Global Instruction"},{id:"notifications",label:"Notifications"},{id:"members",label:"Members"},{id:"usages",label:"Usages"}];a.s(["default",0,function(){let[a,b]=(0,d.useState)("general");return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 md:px-5 py-2.5 gap-3",children:(0,c.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,c.jsx)("h1",{className:"text-sm font-medium",children:"Settings"})})}),(0,c.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,c.jsx)("nav",{className:"w-48 shrink-0 border-r border-border/50 py-3 px-2 hidden md:block",children:ax.map(d=>(0,c.jsx)("button",{onClick:()=>b(d.id),className:(0,f.cn)("w-full rounded-md px-2.5 py-1.5 text-left text-sm transition-colors",a===d.id?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:d.label},d.id))}),(0,c.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,c.jsx)("div",{className:"px-4 pt-2 md:hidden",children:(0,c.jsx)(e.Tabs,{className:"items-center",value:a,onValueChange:a=>b(a),children:(0,c.jsx)(e.TabsList,{className:"h-auto gap-1",children:ax.map(a=>(0,c.jsx)(e.TabsTrigger,{value:a.id,children:a.label},a.id))})})}),(0,c.jsx)("div",{className:(0,f.cn)("flex-1 overflow-y-auto thin-scrollbar","instruction"!==a&&"px-5 py-5"),children:"instruction"===a?(0,c.jsx)(t,{}):"usages"===a?(0,c.jsx)(aw,{}):(0,c.jsxs)("div",{className:"mx-auto max-w-md",children:["general"===a&&(0,c.jsx)(q,{}),"notifications"===a&&(0,c.jsx)(ad,{}),"members"===a&&(0,c.jsx)(A,{})]})})]})]})]})}],294526)}];
|
|
1
|
+
module.exports=[294526,a=>{"use strict";var b,c=a.i(749314),d=a.i(437199),e=a.i(654461),f=a.i(75118),g=a.i(921584),h=a.i(207058),i=a.i(506180),j=a.i(454607),k=a.i(588339),l=a.i(732254),m=a.i(334235),n=a.i(76592),o=a.i(25668),p=a.i(390248);function q(){let{workspaceId:a,slug:b}=(0,i.useWorkspace)(),e=(0,j.useSession)(),f=(0,h.useRouter)(),[q,r]=(0,d.useState)(""),[s,t]=(0,d.useState)(!0),[u,v]=(0,d.useState)(""),[w,x]=(0,d.useState)(""),[y,z]=(0,d.useState)(""),[A,B]=(0,d.useState)(""),[C,D]=(0,d.useState)(!1),[E,F]=(0,d.useState)({}),[G,H]=(0,d.useState)(""),[I,J]=(0,d.useState)(!1),K=(0,d.useCallback)(async()=>{t(!0);try{let b=e.data?.user?.id,[c,d]=await Promise.all([(0,k.listMembers)(a),(0,k.listWorkspaces)()]),f=c.find(a=>a.user_id===b);r(f?.role??"");let g=d.find(b=>b.id===a);g&&(v(g.name),x(g.slug),z(g.name),B(g.slug))}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to load workspace info")}finally{t(!1)}},[a,e.data?.user?.id]);(0,d.useEffect)(()=>{e.data&&K()},[K,e.data]);let L=u!==y||w!==A,M=async()=>{let c=(0,p.validateWorkspaceForm)({name:u,slug:w});if(F(c),!(0,p.hasWorkspaceFormErrors)(c)){D(!0);try{let c=await (0,k.updateWorkspace)(a,{name:u.trim(),slug:w.trim()});z(c.name),B(c.slug),g.toast.success("Workspace updated"),c.slug!==b&&f.replace(`/w/${c.slug}/settings`)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to update workspace")}finally{D(!1)}}},N=async()=>{if(G===y){J(!0);try{await (0,k.deleteWorkspace)(a,y),g.toast.success("Workspace deleted"),f.replace("/workspaces")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to delete workspace")}finally{J(!1)}}};return s?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-4 w-32"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"})]}):"owner"!==q?(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Only workspace owners can edit workspace settings."}):(0,c.jsxs)("div",{className:"space-y-10",children:[(0,c.jsxs)("section",{className:"space-y-4",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Workspace"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"space-y-1.5",children:[(0,c.jsx)(n.Label,{htmlFor:"workspace-name",children:"Name"}),(0,c.jsx)(m.Input,{id:"workspace-name",value:u,onChange:a=>{let b=a.target.value;v(b),E.name&&b.trim()&&F(a=>({...a,name:void 0}))},placeholder:"Workspace name","aria-invalid":!!E.name,"aria-describedby":E.name?"workspace-name-error":void 0}),E.name&&(0,c.jsx)("p",{id:"workspace-name-error",className:"text-xs text-destructive",children:E.name})]}),(0,c.jsxs)("div",{className:"space-y-1.5",children:[(0,c.jsx)(n.Label,{htmlFor:"workspace-slug",children:"Slug"}),(0,c.jsx)(m.Input,{id:"workspace-slug",value:w,onChange:a=>{let b=a.target.value;x(b),E.slug&&b.trim()&&F(a=>({...a,slug:void 0}))},placeholder:"workspace-slug","aria-invalid":!!E.slug,"aria-describedby":E.slug?"workspace-slug-error":void 0}),E.slug&&(0,c.jsx)("p",{id:"workspace-slug-error",className:"text-xs text-destructive",children:E.slug}),(0,c.jsxs)("p",{className:"text-xs text-muted-foreground/70",children:["Used in URLs: /w/",w,"/"]})]})]}),(0,c.jsx)(l.Button,{size:"sm",onClick:M,disabled:!L||C,children:C?"Saving…":"Save"})]}),(0,c.jsxs)("section",{className:"space-y-4",children:[(0,c.jsx)("h2",{className:"text-sm font-medium text-destructive",children:"Danger Zone"}),(0,c.jsxs)("div",{className:"rounded-md border border-destructive/30 p-4 space-y-3",children:[(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Deleting this workspace is permanent and cannot be undone. All agents, conversations, and data will be lost."}),(0,c.jsxs)("div",{className:"space-y-1.5",children:[(0,c.jsxs)(n.Label,{htmlFor:"delete-confirm",className:"text-xs",children:["Type ",(0,c.jsx)("span",{className:"font-medium text-foreground",children:y})," to confirm"]}),(0,c.jsx)(m.Input,{id:"delete-confirm",value:G,onChange:a=>H(a.target.value),placeholder:y})]}),(0,c.jsx)(l.Button,{size:"sm",variant:"destructive",onClick:N,disabled:G!==y||I,children:I?"Deleting…":"Delete Workspace"})]})]})]})}var r=a.i(889624);function s({ratio:a,size:b=16,stroke:d=1.5}){let e=(b-d)/2,g=2*Math.PI*e,h=(a<=0?0:a>=1?1:Math.log1p(99*a)/Math.log(100))*g;return(0,c.jsxs)("svg",{width:b,height:b,className:"shrink-0 -rotate-90","aria-hidden":!0,children:[(0,c.jsx)("circle",{cx:b/2,cy:b/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,className:"text-border"}),(0,c.jsx)("circle",{cx:b/2,cy:b/2,r:e,fill:"none",stroke:"currentColor",strokeWidth:d,strokeDasharray:`${h} ${g-h}`,strokeLinecap:"round",className:(0,f.cn)("transition-all duration-300",a>.9?"text-destructive/70":a>.7?"text-yellow-500/50":"text-muted-foreground/30")})]})}function t(){let{workspaceId:a}=(0,i.useWorkspace)(),[b,e]=(0,d.useState)(""),[f,h]=(0,d.useState)(""),[j,l]=(0,d.useState)(!0),m=(0,d.useRef)(b);(0,d.useEffect)(()=>{m.current=b},[b]);let n=(0,d.useRef)(f);(0,d.useEffect)(()=>{n.current=f},[f]);let p=(0,d.useRef)(null),q=(0,d.useRef)(!1),t=(0,d.useCallback)(async()=>{l(!0);try{let b=await (0,k.getMemberMe)(a);e(b.global_instruction),h(b.global_instruction)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to load settings")}finally{l(!1)}},[a]);(0,d.useEffect)(()=>{t()},[t]);let u=(0,d.useRef)(()=>{}),v=(0,d.useCallback)(async()=>{if(q.current)return;let b=m.current;if(b!==n.current){q.current=!0;try{let c=await (0,k.updateMemberMe)(a,b);h(c.global_instruction)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to save")}finally{q.current=!1,m.current!==n.current&&u.current()}}},[a]),w=(0,d.useCallback)(()=>{p.current&&clearTimeout(p.current),p.current=setTimeout(v,500)},[v]);(0,d.useEffect)(()=>{u.current=w},[w]);let x=(0,d.useCallback)(a=>{e(a),w()},[w]);(0,d.useEffect)(()=>{let b=()=>{if(p.current&&clearTimeout(p.current),m.current!==n.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:m.current}),keepalive:!0})}};return window.addEventListener("beforeunload",b),()=>window.removeEventListener("beforeunload",b)},[a]),(0,d.useEffect)(()=>()=>{if(p.current&&clearTimeout(p.current),m.current!==n.current){let b=new URLSearchParams({workspace_id:a});fetch(`/api/members/me?${b}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({global_instruction:m.current}),keepalive:!0})}},[a]);let y=b.length/5e4;return j?(0,c.jsxs)("div",{className:"px-6 py-6 space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-4 w-48"}),(0,c.jsx)(o.Skeleton,{className:"h-40 w-full"})]}):(0,c.jsxs)("div",{className:"flex flex-col h-full",children:[(0,c.jsx)("div",{className:"flex-1 px-6 pt-4 pb-4",children:(0,c.jsx)(r.MarkdownEditor,{value:b,onChange:x,placeholder:"Write instructions that every agent you own will follow...",minHeight:"calc(100vh - 240px)",contentType:"markdown",variant:"seamless"})}),(0,c.jsxs)("div",{className:"flex items-center gap-2 px-6 py-3",children:[(0,c.jsx)(s,{ratio:y}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"This instruction is prepended to every agent's individual instruction."})]})]})}var u=a.i(166776),v=a.i(695004),w=a.i(911057),x=a.i(790090);let y=(0,x.default)("user-minus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);var z=a.i(525132);function A(a){return`${window.location.origin}/invite/${a}`}function B(){let{workspaceId:a}=(0,i.useWorkspace)(),b=(0,j.useSession)(),e=b.data?.user?.id,[h,m]=(0,d.useState)([]),[n,p]=(0,d.useState)([]),[q,r]=(0,d.useState)(!0),[s,t]=(0,d.useState)(!1),x=h.find(a=>a.user_id===e)?.role==="owner",B=(0,d.useCallback)(async()=>{r(!0);try{let[b,c]=await Promise.all([(0,k.listMembers)(a),(0,k.listInvites)(a).catch(()=>[])]);m(b),p(c)}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to load members")}finally{r(!1)}},[a]);(0,d.useEffect)(()=>{B()},[B]);let C=async()=>{t(!0);try{let b=await (0,k.createInvite)(a);p(a=>[...a,b]);let c=A(b.token);await navigator.clipboard.writeText(c),g.toast.success("Invite link copied to clipboard")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to generate invite")}finally{t(!1)}},D=async a=>{let b=A(a);try{await navigator.clipboard.writeText(b),g.toast.success("Invite link copied")}catch{g.toast.error("Failed to copy link")}},E=async b=>{try{await (0,k.revokeInvite)(a,b),p(a=>a.filter(a=>a.id!==b)),g.toast.success("Invite revoked")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to revoke invite")}},F=async b=>{try{await (0,k.removeMember)(a,b),m(a=>a.filter(a=>a.id!==b)),g.toast.success("Member removed")}catch(a){g.toast.error(a instanceof Error?a.message:"Failed to remove member")}};return q?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-4 w-24"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-4 w-24 mt-6"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"}),(0,c.jsx)(o.Skeleton,{className:"h-10 w-full"})]}):(0,c.jsxs)("div",{className:"space-y-8",children:[x&&(0,c.jsxs)("section",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Pending Invites"}),(0,c.jsxs)(l.Button,{size:"sm",variant:"outline",onClick:C,disabled:s,children:[(0,c.jsx)(w.Plus,{className:"size-3.5 mr-1"}),s?"Generating…":"Generate invite link"]})]}),0===n.length?(0,c.jsx)("p",{className:"text-xs text-muted-foreground py-2",children:"No active invite links. Generate one to invite someone to this workspace."}):(0,c.jsx)("div",{className:"space-y-1.5",children:n.map(a=>{let b=new Date(a.expires_at),d=b<new Date;return(0,c.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2 text-xs",children:[(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("p",{className:(0,f.cn)("font-mono truncate",d&&"text-muted-foreground line-through"),children:["/invite/",a.token.slice(0,12),"…"]}),(0,c.jsx)("p",{className:(0,f.cn)("text-muted-foreground/70 mt-0.5",d&&"text-destructive/70"),children:d?"Expired":`Expires ${b.toLocaleDateString()}`})]}),(0,c.jsxs)("div",{className:"flex items-center gap-1 ml-2 shrink-0",children:[!d&&(0,c.jsxs)(z.Tooltip,{children:[(0,c.jsx)(z.TooltipTrigger,{render:(0,c.jsx)(l.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0",onClick:()=>D(a.token)}),children:(0,c.jsx)(u.Copy,{className:"size-3.5"})}),(0,c.jsx)(z.TooltipContent,{children:"Copy invite link"})]}),(0,c.jsxs)(z.Tooltip,{children:[(0,c.jsx)(z.TooltipTrigger,{render:(0,c.jsx)(l.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-destructive hover:text-destructive",onClick:()=>E(a.id)}),children:(0,c.jsx)(v.Trash2,{className:"size-3.5"})}),(0,c.jsx)(z.TooltipContent,{children:"Revoke invite"})]})]})]},a.id)})})]}),(0,c.jsxs)("section",{className:"space-y-3",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Members"}),(0,c.jsx)("div",{className:"space-y-1.5",children:h.map(a=>{let b=a.user_id===e,d=a.name?a.name.split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase():a.email.slice(0,2).toUpperCase();return(0,c.jsxs)("div",{className:"flex items-center gap-3 rounded-md border border-border/50 px-3 py-2",children:[(0,c.jsx)("div",{className:"size-7 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground shrink-0 overflow-hidden",children:a.image?(0,c.jsx)("img",{src:a.image,alt:a.name,className:"size-full object-cover"}):d}),(0,c.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,c.jsxs)("p",{className:"text-sm font-medium truncate leading-tight",children:[a.name||a.email,b&&(0,c.jsx)("span",{className:"ml-1.5 text-xs text-muted-foreground font-normal",children:"(you)"})]}),a.name&&(0,c.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:a.email})]}),(0,c.jsx)("span",{className:(0,f.cn)("text-xs px-1.5 py-0.5 rounded shrink-0","owner"===a.role?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"),children:a.role}),x&&!b&&(0,c.jsxs)(z.Tooltip,{children:[(0,c.jsx)(z.TooltipTrigger,{render:(0,c.jsx)(l.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-muted-foreground hover:text-destructive shrink-0",onClick:()=>F(a.id)}),children:(0,c.jsx)(y,{className:"size-3.5"})}),(0,c.jsx)(z.TooltipContent,{children:"Remove member"})]})]},a.id)})})]})]})}var C=a.i(951687);a.s([],443440),a.i(443440);var D=a.i(520950),E=a.i(935469),F=a.i(556053),G=a.i(901496),H=a.i(207116),I=a.i(181749),J=a.i(147909),K=a.i(991367),L=a.i(423994),M=a.i(367183),N=a.i(485177);let O=d.createContext(void 0);var P=a.i(621907);let Q=((b={}).checked="data-checked",b.unchecked="data-unchecked",b.disabled="data-disabled",b.readonly="data-readonly",b.required="data-required",b.valid="data-valid",b.invalid="data-invalid",b.touched="data-touched",b.dirty="data-dirty",b.filled="data-filled",b.focused="data-focused",b),R={...P.fieldValidityMapping,checked:a=>a?{[Q.checked]:""}:{[Q.unchecked]:""}};var S=a.i(874417),T=a.i(336789),U=a.i(582050),V=a.i(63462),W=a.i(117906),X=a.i(140295),Y=a.i(331700),Z=a.i(874514),$=a.i(36136);let _=d.forwardRef(function(a,b){let{checked:e,className:f,defaultChecked:g,"aria-labelledby":h,form:i,id:j,inputRef:k,name:l,nativeButton:m=!1,onCheckedChange:n,readOnly:o=!1,required:p=!1,disabled:q=!1,render:r,uncheckedValue:s,value:t,style:u,...v}=a,{clearErrors:w}=(0,U.useFormContext)(),{state:x,setTouched:y,setDirty:z,validityData:A,setFilled:B,setFocused:C,shouldValidateOnChange:N,validationMode:P,disabled:Q,name:_,validation:aa}=(0,S.useFieldRootContext)(),{labelId:ab}=(0,V.useLabelableContext)(),ac=Q||q,ad=_??l,ae=(0,E.useStableCallback)(n),af=d.useRef(null),ag=(0,F.useMergedRefs)(af,k,aa.inputRef),ah=d.useRef(null),ai=(0,L.useBaseUiId)(),aj=(0,X.useLabelableId)({id:j,implicit:!1,controlRef:ah}),ak=m?void 0:aj,[al,am]=(0,D.useControlled)({controlled:e,default:!!g,name:"Switch",state:"checked"});(0,T.useRegisterFieldControl)(ah,{id:ai,value:al}),(0,G.useIsoLayoutEffect)(()=>{af.current&&B(af.current.checked)},[af,B]),(0,$.useValueChanged)(al,()=>{w(ad),z(al!==A.initialValue),B(al),N()?aa.commit(al):aa.commit(al,!0)});let{getButtonProps:an,buttonRef:ao}=(0,M.useButton)({disabled:ac,native:m}),ap=(0,W.useAriaLabelledBy)(h,ab,af,!m,ak),aq=d.useMemo(()=>(0,K.mergeProps)({checked:al,disabled:ac,form:i,id:ak,name:ad,required:p,style:ad?H.visuallyHiddenInput:H.visuallyHidden,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:ag,onChange(a){if(a.nativeEvent.defaultPrevented)return;if(o)return void a.preventDefault();let b=a.currentTarget.checked,c=(0,Y.createChangeEventDetails)(Z.REASONS.none,a.nativeEvent);ae?.(b,c),c.isCanceled||am(b)},onFocus(){ah.current?.focus()}},aa.getInputValidationProps,void 0!==t?{value:t}:I.EMPTY_OBJECT),[al,ac,i,ag,ak,ad,ae,o,p,am,aa,t]),ar=d.useMemo(()=>({...x,checked:al,disabled:ac,readOnly:o,required:p}),[x,al,ac,o,p]),as=(0,J.useRenderElement)("span",a,{state:ar,ref:[b,ah,ao],props:[{id:m?aj:ai,role:"switch","aria-checked":al,"aria-readonly":o||void 0,"aria-required":p||void 0,"aria-labelledby":ap,onFocus(){ac||C(!0)},onBlur(){let a=af.current;a&&!ac&&(y(!0),C(!1),"onBlur"===P&&aa.commit(a.checked))},onClick(a){o||ac||(a.preventDefault(),af.current?.dispatchEvent(new PointerEvent("click",{bubbles:!0,shiftKey:a.shiftKey,ctrlKey:a.ctrlKey,altKey:a.altKey,metaKey:a.metaKey})))}},aa.getValidationProps,v,an],stateAttributesMapping:R});return(0,c.jsxs)(O.Provider,{value:ar,children:[as,!al&&ad&&void 0!==s&&(0,c.jsx)("input",{type:"hidden",form:i,name:ad,value:s}),(0,c.jsx)("input",{...aq,suppressHydrationWarning:!0})]})}),aa=d.forwardRef(function(a,b){let{render:c,className:e,style:f,...g}=a,{state:h}=(0,S.useFieldRootContext)(),i=function(){let a=d.useContext(O);if(void 0===a)throw Error((0,N.default)(63));return a}(),j={...h,...i};return(0,J.useRenderElement)("span",a,{state:j,ref:b,stateAttributesMapping:R,props:g})});a.s(["Root",0,_,"Thumb",0,aa],795013);var ab=a.i(795013),ab=ab;function ac({className:a,size:b="default",...d}){return(0,c.jsx)(ab.Root,{"data-slot":"switch","data-size":b,className:(0,f.cn)("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",a),...d,children:(0,c.jsx)(ab.Thumb,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}var ad=a.i(626806);function ae(){let[a,b]=(0,d.useState)(!1),[e,f]=(0,d.useState)([...ad.NOTIFICATION_EVENTS]),[h,i]=(0,d.useState)(!0),[j,k]=(0,d.useState)(!1);(0,d.useEffect)(()=>{i((0,ad.isNotificationSupported)()),b((0,ad.getNotificationEnabled)()),f((0,ad.getNotificationEvents)()),(0,ad.isNotificationSupported)()&&k("denied"===Notification.permission)},[]);let l=async a=>{if(!a){b(!1),(0,ad.setNotificationEnabled)(!1);return}await (0,ad.requestNotificationPermission)()?(b(!0),(0,ad.setNotificationEnabled)(!0)):(k(!0),g.toast.error("Notification permission denied. Please enable it in browser settings."))};return h?(0,c.jsx)("div",{className:"space-y-6",children:(0,c.jsxs)("section",{className:"space-y-4",children:[(0,c.jsx)("h2",{className:"text-sm font-medium",children:"Browser Notifications"}),(0,c.jsxs)("div",{className:"space-y-3",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between",children:[(0,c.jsxs)("div",{className:"space-y-0.5",children:[(0,c.jsx)("p",{className:"text-sm",children:"Enable notifications"}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Get notified when tasks finish while the tab is in the background"})]}),(0,c.jsx)(ac,{checked:a,onCheckedChange:l,disabled:j&&!a})]}),j&&!a&&(0,c.jsx)("p",{className:"text-xs text-destructive",children:"Notification permission was denied. Please allow it in your browser settings."}),a&&(0,c.jsxs)("div",{className:"space-y-2 pl-0.5",children:[(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Notify me when:"}),ad.NOTIFICATION_EVENTS.map(a=>(0,c.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer select-none",children:[(0,c.jsx)(C.Checkbox,{checked:e.includes(a),onCheckedChange:()=>{f(b=>{let c=b.includes(a)?b.filter(b=>b!==a):[...b,a];return(0,ad.setNotificationEvents)(c),c})}}),ad.NOTIFICATION_EVENT_LABELS[a]]},a))]})]})]})}):(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your browser does not support notifications."})}var af=a.i(752792),ag=a.i(439882),ah=a.i(464830);let ai=(0,x.default)("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);var aj=a.i(918768),ak=a.i(292948);let al=(0,x.default)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);var am=a.i(385539);let an=(0,x.default)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);function ao({icon:a,label:b,value:d,sub:e}){return(0,c.jsx)(ag.Card,{size:"sm",children:(0,c.jsxs)(ag.CardContent,{className:"flex items-center gap-3",children:[(0,c.jsx)("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:(0,c.jsx)(a,{className:"size-4"})}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,c.jsx)("p",{className:"text-2xl font-semibold leading-none tracking-tight",children:d}),e&&(0,c.jsx)(ah.Badge,{variant:"secondary",className:"text-[10px] px-1.5 h-4 font-normal",children:e})]}),(0,c.jsx)("p",{className:"mt-1 text-xs text-muted-foreground truncate",children:b})]})]})})}function ap({agents:a,runtimes:b,activeTaskCounts:d,overview:e}){let f=new Map;for(let a of b){let b=a.daemon_id??a.id;f.set(b,f.get(b)||"online"===a.status)}let g=f.size,h=[...f.values()].filter(Boolean).length,i=Object.values(d).reduce((a,b)=>a+b,0),j=a.filter(a=>{let c=b.find(b=>b.id===a.runtime_id);return c?.status==="online"}).length;return(0,c.jsxs)("div",{className:"grid gap-3 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6",children:[(0,c.jsx)(ao,{icon:am.Monitor,label:"Machines",value:`${h}/${g}`,sub:"online"}),(0,c.jsx)(ao,{icon:ai,label:"Agents",value:a.length,sub:`${j} online`}),(0,c.jsx)(ao,{icon:al,label:"Members",value:e.members.length,sub:e.pending_invites>0?`${e.pending_invites} pending`:void 0}),(0,c.jsx)(ao,{icon:an,label:"Active Tasks",value:i,sub:e.task_stats.queued>0?`${e.task_stats.queued} queued`:void 0}),(0,c.jsx)(ao,{icon:ak.Send,label:"Emails Sent",value:e.email_stats.outbound,sub:`${e.email_stats.unread} unread`}),(0,c.jsx)(ao,{icon:aj.Mail,label:"Custom Emails",value:e.email_accounts.length})]})}function aq({overview:a}){let{completed:b,failed:d,cancelled:e,queued:f,stale:g}=a.task_stats,h=b+d,i=h>0?(d/h*100).toFixed(1):"0";return(0,c.jsxs)(ag.Card,{children:[(0,c.jsx)(ag.CardHeader,{children:(0,c.jsx)(ag.CardTitle,{children:"Task Health (Today)"})}),(0,c.jsx)(ag.CardContent,{children:(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,c.jsx)(ar,{label:"Completed",value:b}),(0,c.jsx)(ar,{label:"Failed",value:d,className:d>0?"text-destructive":void 0}),(0,c.jsx)(ar,{label:"Cancelled",value:e}),(0,c.jsx)(ar,{label:"Failure Rate",value:`${i}%`,className:Number(i)>10?"text-destructive":void 0}),(0,c.jsx)(ar,{label:"Queue Backlog",value:f,className:f>10?"text-amber-500":void 0}),(0,c.jsx)(ar,{label:"Stale Tasks",value:g,className:g>0?"text-destructive":void 0})]})})]})}function ar({label:a,value:b,className:d}){return(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:`text-xl font-semibold ${d??""}`,children:b}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:a})]})}function as({overview:a,agents:b}){let{inbound:d,outbound:e,unread:f,rejected:g}=a.email_stats,h=new Map(b.map(a=>[a.id,a.name]));return(0,c.jsxs)(ag.Card,{children:[(0,c.jsx)(ag.CardHeader,{children:(0,c.jsx)(ag.CardTitle,{children:"Email Summary"})}),(0,c.jsxs)(ag.CardContent,{className:"space-y-4",children:[(0,c.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-xl font-semibold",children:d}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Received"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:"text-xl font-semibold",children:e}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Sent"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:`text-xl font-semibold ${f>0?"text-primary":""}`,children:f}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Unread"})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)("p",{className:`text-xl font-semibold ${g>0?"text-amber-500":""}`,children:g}),(0,c.jsx)("p",{className:"text-xs text-muted-foreground",children:"Untrust"})]})]}),a.email_accounts.length>0&&(0,c.jsxs)("div",{className:"space-y-2 pt-2 border-t border-border/50",children:[(0,c.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:"Custom Mailboxes"}),a.email_accounts.map(a=>(0,c.jsxs)("div",{className:"flex items-center justify-between gap-2 text-xs",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,c.jsxs)(z.Tooltip,{children:[(0,c.jsx)(z.TooltipTrigger,{render:(0,c.jsx)("span",{className:`size-1.5 shrink-0 rounded-full ${"active"===a.status?"bg-emerald-500":"bg-destructive"}`})}),(0,c.jsx)(z.TooltipContent,{side:"top",children:"active"===a.status?"Active":`Error: ${a.error_message||"inactive"}`})]}),(0,c.jsx)("span",{className:"truncate",children:a.email_address})]}),(0,c.jsx)("span",{className:"text-muted-foreground shrink-0",children:h.get(a.agent_id)??"—"})]},a.id))]})]})]})}var at=a.i(578894);function au({runtimes:a,agents:b}){let d=(0,h.useRouter)(),{slug:e}=(0,i.useWorkspace)(),f=new Map;for(let b of a){let a=b.daemon_id??b.id;f.has(a)||f.set(a,{runtimes:[],deviceInfo:b.device_info??""}),f.get(a).runtimes.push(b)}let g=[...f.entries()];return 0===g.length?(0,c.jsxs)(ag.Card,{children:[(0,c.jsxs)(ag.CardHeader,{children:[(0,c.jsx)(ag.CardTitle,{children:"Machines"}),(0,c.jsx)(ag.CardAction,{children:(0,c.jsx)("button",{type:"button",onClick:()=>d.push(`/w/${e}/runtimes`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,c.jsx)(at.ArrowUpRight,{className:"size-4"})})})]}),(0,c.jsx)(ag.CardContent,{children:(0,c.jsx)("p",{className:"text-sm text-muted-foreground",children:"No machines connected."})})]}):(0,c.jsxs)(ag.Card,{children:[(0,c.jsx)(ag.CardHeader,{children:(0,c.jsx)(ag.CardTitle,{children:"Machines"})}),(0,c.jsx)(ag.CardContent,{className:"space-y-3",children:g.map(([a,d])=>{let e=d.runtimes.some(a=>"online"===a.status),f=d.runtimes.map(a=>a.last_seen_at).filter(Boolean).sort().reverse()[0],g=b.filter(a=>d.runtimes.some(b=>b.id===a.runtime_id)),h=d.runtimes.some(a=>a.pending_update_version),i=d.runtimes.find(a=>a.pending_update_version)?.pending_update_version;return(0,c.jsxs)("div",{className:"flex items-start gap-3 text-xs",children:[(0,c.jsxs)(z.Tooltip,{children:[(0,c.jsx)(z.TooltipTrigger,{render:(0,c.jsx)("span",{className:`mt-1 size-2 shrink-0 rounded-full ${e?"bg-emerald-500":"bg-muted-foreground/30"}`})}),(0,c.jsx)(z.TooltipContent,{side:"top",children:e?"Online":"Offline"})]}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsxs)("div",{className:"flex items-center gap-2",children:[(0,c.jsx)("span",{className:"font-medium truncate",children:d.deviceInfo||a.slice(0,12)}),h&&(0,c.jsxs)(z.Tooltip,{children:[(0,c.jsx)(z.TooltipTrigger,{render:(0,c.jsx)("span",{children:(0,c.jsx)(ah.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0 text-amber-500 border-amber-500/30",children:"update"})})}),(0,c.jsxs)(z.TooltipContent,{side:"top",children:["Pending update to v",i]})]})]}),(0,c.jsxs)("div",{className:"text-muted-foreground mt-0.5",children:[g.length>0?g.map(a=>a.name).join(", "):"No agents"," · ",function(a){if(!a)return"never";let b=Math.floor((Date.now()-new Date(a).getTime())/1e3);if(b<60)return`${b}s ago`;let c=Math.floor(b/60);if(c<60)return`${c}m ago`;let d=Math.floor(c/60);return d<24?`${d}h ago`:`${Math.floor(d/24)}d ago`}(f??null)]})]})]},a)})})]})}function av({overview:a}){let b=(0,h.useRouter)(),{slug:d}=(0,i.useWorkspace)(),{members:e,pending_invites:f}=a;return(0,c.jsxs)(ag.Card,{children:[(0,c.jsxs)(ag.CardHeader,{children:[(0,c.jsx)(ag.CardAction,{children:(0,c.jsx)("button",{type:"button",onClick:()=>b.push(`/w/${d}/settings`),className:"text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:(0,c.jsx)(at.ArrowUpRight,{className:"size-4"})})}),(0,c.jsxs)(ag.CardTitle,{children:["Team",f>0&&(0,c.jsxs)("span",{className:"ml-2 text-xs text-muted-foreground font-normal",children:["(",f," pending invite",f>1?"s":"",")"]})]})]}),(0,c.jsx)(ag.CardContent,{className:"p-0",children:(0,c.jsx)("div",{className:"divide-y divide-border/50",children:[...e].sort((a,b)=>"owner"===a.role?-1:+("owner"===b.role)).map(a=>(0,c.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5",children:[a.image?(0,c.jsx)("img",{src:a.image,alt:a.name,className:"size-7 rounded-full shrink-0"}):(0,c.jsx)("div",{className:"flex size-7 shrink-0 items-center justify-center rounded-full bg-secondary text-xs font-medium",children:(a.name||a.email).charAt(0).toUpperCase()}),(0,c.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,c.jsx)("span",{className:"text-sm font-medium truncate block",children:a.name||a.email}),a.name&&(0,c.jsx)("span",{className:"text-xs text-muted-foreground truncate block",children:a.email})]}),(0,c.jsx)(ah.Badge,{variant:"owner"===a.role?"default":"secondary",className:"text-[10px] px-1.5 py-0 shrink-0",children:a.role})]},a.id))})})]})}function aw(){let{agents:a,runtimes:b,loading:e,activeTaskCounts:f}=(0,af.useAgentContext)(),{workspaceId:g}=(0,i.useWorkspace)(),[h,j]=(0,d.useState)(null),[l,m]=(0,d.useState)(!1);return((0,d.useEffect)(()=>{if(e)return;let a=!1;return m(!0),(0,k.getWorkspaceOverview)(g).then(b=>{a||j(b)}).catch(()=>{}).finally(()=>{a||m(!1)}),()=>{a=!0}},[e,g]),l||!h)?(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"}),(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"}),(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"}),(0,c.jsx)(o.Skeleton,{className:"h-44 rounded-xl"})]}):(0,c.jsxs)("div",{className:"space-y-4",children:[(0,c.jsx)(ap,{agents:a,runtimes:b,activeTaskCounts:f,overview:h}),(0,c.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,c.jsx)(aq,{overview:h}),(0,c.jsx)(as,{overview:h,agents:a})]}),(0,c.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,c.jsx)(au,{runtimes:b,agents:a}),(0,c.jsx)(av,{overview:h})]})]})}let ax=[{id:"general",label:"General"},{id:"instruction",label:"Global Instruction"},{id:"notifications",label:"Notifications"},{id:"members",label:"Members"},{id:"usages",label:"Usages"}];a.s(["default",0,function(){let[a,b]=(0,d.useState)("general");return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)("div",{className:"flex items-center justify-between border-b border-border/50 px-3 md:px-5 py-2.5 gap-3",children:(0,c.jsx)("div",{className:"flex items-center gap-3 min-w-0",children:(0,c.jsx)("h1",{className:"text-sm font-medium",children:"Settings"})})}),(0,c.jsxs)("div",{className:"flex flex-1 min-h-0",children:[(0,c.jsx)("nav",{className:"w-48 shrink-0 border-r border-border/50 py-3 px-2 hidden md:block",children:ax.map(d=>(0,c.jsx)("button",{onClick:()=>b(d.id),className:(0,f.cn)("w-full rounded-md px-2.5 py-1.5 text-left text-sm transition-colors",a===d.id?"bg-accent text-foreground font-medium":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:d.label},d.id))}),(0,c.jsxs)("div",{className:"flex-1 min-w-0 flex flex-col",children:[(0,c.jsx)("div",{className:"px-4 pt-2 md:hidden",children:(0,c.jsx)(e.Tabs,{className:"items-center",value:a,onValueChange:a=>b(a),children:(0,c.jsx)(e.TabsList,{className:"h-auto gap-1",children:ax.map(a=>(0,c.jsx)(e.TabsTrigger,{value:a.id,children:a.label},a.id))})})}),(0,c.jsx)("div",{className:(0,f.cn)("flex-1 overflow-y-auto thin-scrollbar","instruction"!==a&&"px-5 py-5"),children:"instruction"===a?(0,c.jsx)(t,{}):"usages"===a?(0,c.jsx)(aw,{}):(0,c.jsxs)("div",{className:"mx-auto max-w-md",children:["general"===a&&(0,c.jsx)(q,{}),"notifications"===a&&(0,c.jsx)(ae,{}),"members"===a&&(0,c.jsx)(B,{})]})})]})]})]})}],294526)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_app_%28app%29_w_%5Bslug%5D_settings_page_tsx_0fdcupy._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[677017,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(207058),e=a.i(26822),f=a.i(
|
|
1
|
+
module.exports=[677017,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(207058),e=a.i(26822),f=a.i(525132),g=a.i(506180),h=a.i(588339),i=a.i(25668),j=a.i(143788);a.i(735132);var k=a.i(325848);function l({status:a}){return(0,b.jsx)("span",{className:`size-1.5 rounded-full shrink-0 ${"completed"===a?"bg-[oklch(0.72_0.19_145)]":"failed"===a?"bg-destructive":"running"===a?"bg-primary animate-pulse":"bg-muted-foreground/40"}`})}let m={queued:"Queued",dispatched:"Queued",running:"Running",completed:"Completed",failed:"Failed",cancelled:"Cancelled",superseded:"Cancelled"};function n({name:a,avatarUrl:c,size:d=14}){let e=(0,k.parseAvatarUrl)(c);return e?(0,b.jsx)(k.AvatarRenderer,{config:e,size:d,className:"rounded-full shrink-0"}):(0,b.jsx)("span",{className:"flex items-center justify-center rounded-full bg-secondary text-[8px] font-medium shrink-0",style:{width:d,height:d},children:(a??"?").charAt(0).toUpperCase()})}function o({node:a,slug:c}){let d=function(a,b){if(!b)return null;let c=Math.max(0,Math.floor((new Date(b).getTime()-new Date(a).getTime())/1e3));if(c>=3600){let a=Math.floor(c/3600),b=Math.floor(c%3600/60);return`${a}h ${b}m`}if(c>=60){let a=Math.floor(c/60);return`${a}m ${c%60}s`}return`${c}s`}(a.created_at,a.completed_at);return(0,b.jsx)(e.default,{href:`/w/${c}/agents/${a.agent_id}?task=${a.id}&conv=${a.conversation_id}`,className:"block px-4 py-3 border-b border-border/30 hover:bg-accent/30 transition-colors duration-150 cursor-pointer",style:{paddingLeft:`${1+1.5*a.depth}rem`},children:(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(n,{name:a.agent?.name,avatarUrl:a.agent?.avatarUrl,size:32}),(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)("span",{className:"text-sm text-foreground truncate flex-1 min-w-0",children:a.prompt.split("\n")[0]}),(0,b.jsxs)(f.Tooltip,{children:[(0,b.jsx)(f.TooltipTrigger,{render:(0,b.jsx)("span",{className:"text-xs text-muted-foreground shrink-0 ml-2"}),children:function(a){let b=new Date(a),c=Math.floor((new Date().getTime()-b.getTime())/6e4);if(c<1)return"just now";if(c<60)return`${c}m ago`;let d=Math.floor(c/60);if(d<24)return`${d}h ago`;let e=Math.floor(d/24);return e<7?`${e}d ago`:b.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(a.created_at)}),(0,b.jsx)(f.TooltipContent,{children:new Date(a.created_at).toLocaleString()})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[a.agent?.name&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:a.agent.name}),(0,b.jsx)("span",{className:"text-muted-foreground/40",children:"·"})]}),(0,b.jsx)(l,{status:a.status}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:m[a.status]??a.status}),d&&(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"text-muted-foreground/40",children:"·"}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:d})]})]})]})]})})}a.s(["default",0,function(){let a=(0,d.useParams)(),{slug:f,workspaceId:k}=(0,g.useWorkspace)(),l=a.traceId,[m,n]=(0,c.useState)([]),[p,q]=(0,c.useState)("default"),[r,s]=(0,c.useState)(!0);(0,c.useEffect)(()=>{s(!0),(0,h.getTrace)(l,k).then(a=>{n(a.tasks),q(a.channel)}).catch(()=>{}).finally(()=>s(!1))},[l,k]);let t=function(a){let b=[];for(let c of a)!function a(c){for(let d of(b.push(c),c.children))a(d)}(c);return b}(function(a){let b=new Map;for(let c of a)b.set(c.id,{...c,children:[],depth:0});let c=[];for(let a of b.values())a.parent_task_id&&b.has(a.parent_task_id)?b.get(a.parent_task_id).children.push(a):c.push(a);for(let a of c)!function a(b,c){for(let d of(b.depth=c,b.children))a(d,c+1)}(a,0);return c}(m));return(0,b.jsxs)("div",{className:"flex flex-col h-full",children:[(0,b.jsxs)("div",{className:"sticky top-0 z-10 flex items-center gap-2 px-4 py-2.5 border-b border-border/30",children:[(0,b.jsx)(e.default,{href:`/w/${f}/threads`,className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:(0,b.jsx)(j.ArrowLeft,{className:"size-3.5"})}),(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["#",p]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:r?(0,b.jsx)("div",{className:"flex flex-col",children:[40,55,48].map((a,c)=>(0,b.jsxs)("div",{className:"px-4 py-3 border-b border-border/30",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(i.Skeleton,{className:"h-3.5 w-4 rounded-full shrink-0"}),(0,b.jsx)(i.Skeleton,{className:"h-3.5 rounded",style:{width:`${a}%`}}),(0,b.jsx)(i.Skeleton,{className:"h-2.5 w-10 rounded shrink-0 ml-auto"})]}),(0,b.jsx)("div",{className:"flex items-center gap-1.5 mt-1 ml-5.5",children:(0,b.jsx)(i.Skeleton,{className:"h-2.5 w-20 rounded-full"})})]},c))}):0===t.length?(0,b.jsx)("div",{className:"flex flex-col items-center justify-center h-full",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Trace not found"})}):(0,b.jsx)("div",{className:"flex flex-col animate-[fade-up_400ms_ease-out_both]",children:t.map(a=>(0,b.jsx)(o,{node:a,slug:f},a.id))})})]})}])}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_app_%28app%29_w_%5Bslug%5D_threads_%5BtraceId%5D_page_tsx_00bx721._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[137993,22239,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(732254),e=a.i(334235),f=a.i(76592),g=a.i(7455),h=a.i(75118),i=a.i(588339),j=a.i(527779),k=a.i(918768),l=a.i(461794),m=a.i(180222),n=a.i(67196),o=a.i(95590),p=a.i(942854);let q=(0,a.i(790090).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);a.s(["CircleHelp",0,q],22239);var r=a.i(921584),s=a.i(506180),t=a.i(390248);let u={Gmail:{imapHost:"imap.gmail.com",imapPort:993,smtpHost:"smtp.gmail.com",smtpPort:587},Outlook:{imapHost:"outlook.office365.com",imapPort:993,smtpHost:"smtp.office365.com",smtpPort:587},Yahoo:{imapHost:"imap.mail.yahoo.com",imapPort:993,smtpHost:"smtp.mail.yahoo.com",smtpPort:587}};function v({fields:a,applyPreset:c,errors:g,onClearError:h}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"flex gap-1.5",children:Object.keys(u).map(a=>(0,b.jsx)(d.Button,{type:"button",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>c(a),children:a},a))}),(0,b.jsxs)("div",{className:"grid gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(f.Label,{className:"text-xs",children:"Email Address *"}),(0,b.jsx)(e.Input,{placeholder:"you@gmail.com",value:a.emailAddress,onChange:b=>{a.setEmailAddress(b.target.value),b.target.value.trim()&&h("emailAddress")},"aria-invalid":!!g.emailAddress,"aria-describedby":g.emailAddress?"custom-email-address-error":void 0,className:"h-8 text-sm"}),g.emailAddress&&(0,b.jsx)("p",{id:"custom-email-address-error",className:"mt-1 text-xs text-destructive",children:g.emailAddress})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(f.Label,{className:"text-xs",children:"Display Name"}),(0,b.jsx)(e.Input,{placeholder:"My Agent",value:a.displayName,onChange:b=>a.setDisplayName(b.target.value),className:"h-8 text-sm"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(f.Label,{className:"text-xs font-medium",children:"IMAP (Receive)"}),(0,b.jsx)(e.Input,{placeholder:"imap.gmail.com",value:a.imapHost,onChange:b=>{a.setImapHost(b.target.value),b.target.value.trim()&&h("imapHost")},"aria-invalid":!!g.imapHost,"aria-describedby":g.imapHost?"custom-email-imap-host-error":void 0,className:"h-8 text-sm"}),g.imapHost&&(0,b.jsx)("p",{id:"custom-email-imap-host-error",className:"text-xs text-destructive",children:g.imapHost}),(0,b.jsx)(e.Input,{type:"number",placeholder:"993",value:a.imapPort,onChange:b=>a.setImapPort(Number(b.target.value)),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{placeholder:a.emailAddress||"Username (defaults to email)",value:a.imapUsername,onChange:b=>a.setImapUsername(b.target.value),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{type:"password",placeholder:"App Password",value:a.imapPassword,onChange:b=>{a.setImapPassword(b.target.value),b.target.value.trim()&&h("imapPassword")},"aria-invalid":!!g.imapPassword,"aria-describedby":g.imapPassword?"custom-email-imap-password-error":void 0,className:"h-8 text-sm"}),g.imapPassword&&(0,b.jsx)("p",{id:"custom-email-imap-password-error",className:"text-xs text-destructive",children:g.imapPassword})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(f.Label,{className:"text-xs font-medium",children:"SMTP (Send)"}),(0,b.jsx)(e.Input,{placeholder:"smtp.gmail.com",value:a.smtpHost,onChange:b=>{a.setSmtpHost(b.target.value),b.target.value.trim()&&h("smtpHost")},"aria-invalid":!!g.smtpHost,"aria-describedby":g.smtpHost?"custom-email-smtp-host-error":void 0,className:"h-8 text-sm"}),g.smtpHost&&(0,b.jsx)("p",{id:"custom-email-smtp-host-error",className:"text-xs text-destructive",children:g.smtpHost}),(0,b.jsx)(e.Input,{type:"number",placeholder:"587",value:a.smtpPort,onChange:b=>a.setSmtpPort(Number(b.target.value)),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{placeholder:a.emailAddress||"Username (defaults to email)",value:a.smtpUsername,onChange:b=>a.setSmtpUsername(b.target.value),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{type:"password",placeholder:"App Password",value:a.smtpPassword,onChange:b=>{a.setSmtpPassword(b.target.value),b.target.value.trim()&&h("smtpPassword")},"aria-invalid":!!g.smtpPassword,"aria-describedby":g.smtpPassword?"custom-email-smtp-password-error":void 0,className:"h-8 text-sm"}),g.smtpPassword&&(0,b.jsx)("p",{id:"custom-email-smtp-password-error",className:"text-xs text-destructive",children:g.smtpPassword})]})]})]})}a.s(["CustomEmailForm",0,function({agentId:a,workspaceId:e,onDataChange:f,getDataRef:w}){let{slug:x}=(0,s.useWorkspace)(),y=!a,[z,A]=(0,c.useState)(!1),[B,C]=(0,c.useState)([]),[D,E]=(0,c.useState)(!y),[F,G]=(0,c.useState)(!1),[H,I]=(0,c.useState)(!1),[J,K]=(0,c.useState)(!1),[L,M]=(0,c.useState)({}),{fields:N,applyPreset:O,buildData:P}=function(){let[a,b]=(0,c.useState)(""),[d,e]=(0,c.useState)(""),[f,g]=(0,c.useState)(""),[h,i]=(0,c.useState)(993),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(587),[r,s]=(0,c.useState)(""),[t,v]=(0,c.useState)(""),w=j||a,x=r||a;return{fields:{emailAddress:a,setEmailAddress:b,displayName:d,setDisplayName:e,imapHost:f,setImapHost:g,imapPort:h,setImapPort:i,imapUsername:j,setImapUsername:k,imapPassword:l,setImapPassword:m,smtpHost:n,setSmtpHost:o,smtpPort:p,setSmtpPort:q,smtpUsername:r,setSmtpUsername:s,smtpPassword:t,setSmtpPassword:v},applyPreset:function(a){let b=u[a];b&&(g(b.imapHost),i(b.imapPort),o(b.smtpHost),q(b.smtpPort))},buildData:function(){return a&&f&&w&&l&&n&&x&&t?{emailAddress:a,displayName:d,imapHost:f,imapPort:h,imapUsername:w,imapPassword:l,imapTls:!0,smtpHost:n,smtpPort:p,smtpUsername:x,smtpPassword:t,smtpTls:1,pollIntervalSeconds:60}:null}}}(),Q=N.imapUsername||N.emailAddress,R=N.smtpUsername||N.emailAddress,S=(0,c.useCallback)(a=>{M(b=>({...b,[a]:void 0}))},[]);(0,c.useEffect)(()=>{w&&(w.current=P)}),(0,c.useEffect)(()=>{y&&f?.(P())},[y,P,f,N.emailAddress,N.displayName,N.imapHost,N.imapPort,N.imapUsername,N.imapPassword,N.smtpHost,N.smtpPort,N.smtpUsername,N.smtpPassword]);let T=(0,c.useCallback)(async()=>{if(!y)try{let b=await (0,i.listEmailAccounts)(a,e);C(b)}catch{}finally{E(!1)}},[a,e,y]);(0,c.useEffect)(()=>{T()},[T]);let U=B[0]??null;async function V(){let b=(0,t.validateCustomEmailFields)({emailAddress:N.emailAddress,imapHost:N.imapHost,imapUsername:Q,imapPassword:N.imapPassword,smtpHost:N.smtpHost,smtpUsername:R,smtpPassword:N.smtpPassword});if(M(b),(0,t.hasCustomEmailErrors)(b))return;let c=P();if(c&&a){G(!0);try{await (0,i.createEmailAccount)(a,c,e),r.toast.success("Custom email configured"),A(!1),await T()}catch(a){r.toast.error(a instanceof Error?a.message:"Failed to save")}finally{G(!1)}}}async function W(){if(U&&a){K(!0);try{await (0,i.deleteEmailAccount)(a,U.id,e),r.toast.success("Custom email removed"),C([])}catch(a){r.toast.error(a instanceof Error?a.message:"Failed to remove")}finally{K(!1)}}}async function X(){if(U&&a){I(!0);try{await (0,i.syncEmailAccount)(a,U.id,e),r.toast.success("Sync triggered"),setTimeout(()=>T(),2e3)}catch(a){r.toast.error(a instanceof Error?a.message:"Sync failed")}finally{I(!1)}}}let Y=y?N.emailAddress?N.emailAddress:"Connect your own mailbox via IMAP/SMTP":D?"Loading...":U?U.email_address:"Connect your own mailbox via IMAP/SMTP";return(0,b.jsxs)(g.Sheet,{open:z,onOpenChange:A,children:[(0,b.jsxs)(g.SheetTrigger,{render:(0,b.jsx)("button",{type:"button",className:"flex w-full items-center justify-between rounded-lg border border-border/50 bg-muted/30 px-4 py-3 text-left transition-colors hover:bg-muted/50"}),children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:"Custom Email"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:Y})]}),!y&&U?(0,b.jsxs)("span",{className:(0,h.cn)("inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full font-medium shrink-0","active"===U.status?"bg-green-500/10 text-green-600":"error"===U.status?"bg-red-500/10 text-red-600":"bg-yellow-500/10 text-yellow-600"),children:["active"===U.status?(0,b.jsx)(n.CheckCircle2,{className:"size-2.5"}):"error"===U.status?(0,b.jsx)(m.AlertCircle,{className:"size-2.5"}):null,U.status]}):(0,b.jsx)(o.ChevronRight,{className:"size-4 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(g.SheetContent,{side:"right",className:"data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border",children:[(0,b.jsx)(g.SheetTitle,{className:"sr-only",children:"Custom Email"}),(0,b.jsx)(g.SheetBody,{className:"px-8 pt-10 pb-6",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("h2",{className:"font-heading text-lg font-semibold",children:"Custom Email"}),(0,b.jsx)("a",{href:`/w/${x}/help/email-setup`,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors",title:"How to get IMAP/SMTP credentials",children:(0,b.jsx)(q,{className:"size-4"})})]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Connect your own mailbox to send and receive email as your identity."})]}),!y&&U?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(k.Mail,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm truncate",children:U.email_address})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,b.jsx)("button",{type:"button",onClick:X,disabled:H,title:"Sync now",className:"rounded-full p-1 text-muted-foreground hover:bg-muted transition-colors",children:(0,b.jsx)(l.RefreshCw,{className:(0,h.cn)("size-3.5",H&&"animate-spin")})}),(0,b.jsx)("button",{type:"button",onClick:W,disabled:J,title:"Remove",className:"rounded-full p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",children:J?(0,b.jsx)(j.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(p.XIcon,{className:"size-3.5"})})]})]}),U.error_message&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:U.error_message}),U.last_synced_at&&(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Last synced: ",new Date(U.last_synced_at).toLocaleString()]}),(0,b.jsxs)("div",{className:"rounded-md border border-border/50 px-3 py-2 text-xs text-muted-foreground space-y-1",children:[(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{children:"IMAP"}),(0,b.jsxs)("span",{children:[U.imap_host,":",U.imap_port]})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{children:"SMTP"}),(0,b.jsxs)("span",{children:[U.smtp_host,":",U.smtp_port]})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{children:"Poll interval"}),(0,b.jsxs)("span",{children:[U.poll_interval_seconds,"s"]})]})]})]}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)(v,{fields:N,applyPreset:O,errors:L,onClearError:S}),!y&&(0,b.jsxs)(d.Button,{type:"button",size:"sm",className:"w-full",onClick:V,disabled:F,children:[F&&(0,b.jsx)(j.Loader2,{className:"size-3 animate-spin mr-1"}),"Save & Connect"]}),y&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Will be connected after creating the agent."})]})]})})]})]})}],137993)},224226,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(732254),e=a.i(334235),f=a.i(76592),g=a.i(75118);function h({className:a,...c}){return(0,b.jsx)("textarea",{"data-slot":"textarea",className:(0,g.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...c})}var i=a.i(354498),j=a.i(432340),k=a.i(74414);function l({value:a,onValueChange:c,runtimes:d,disabled:e,triggerProps:f}){let g=function(a){let b=new Map;for(let c of a){let a=c.daemon_id||c.id;b.has(a)||b.set(a,{label:("string"==typeof c.device_info?c.device_info:"")||a,runtimes:[]}),b.get(a).runtimes.push(c)}return b}(d),h=e||0===d.length||d.every(a=>"online"!==a.status);return(0,b.jsxs)(i.Select,{value:a,onValueChange:a=>{a&&c(a)},disabled:h,items:d.map(a=>{let b=("string"==typeof a.device_info?a.device_info:"")||"",c=b?`${a.provider} (${b})`:a.provider;return{value:a.id,label:c}}),children:[(0,b.jsx)(i.SelectTrigger,{...f,children:(0,b.jsx)(i.SelectValue,{placeholder:0===d.length?"No runtimes — start a daemon first":d.every(a=>"online"!==a.status)?"All runtimes offline":"Select a runtime"})}),(0,b.jsx)(i.SelectPopup,{children:Array.from(g.entries()).map(([a,c])=>(0,b.jsxs)(i.SelectGroup,{children:[(0,b.jsx)(i.SelectGroupLabel,{className:"truncate",children:c.label}),c.runtimes.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,disabled:"online"!==a.status,children:(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)(k.ProviderLogo,{provider:a.provider,className:"h-4 w-4"}),(0,b.jsx)("span",{children:a.provider}),(0,b.jsxs)("span",{className:"text-muted-foreground text-xs",children:["(",a.status,")"]})]})},a.id))]},a))})]})}a.i(974936),process.env.ALOOK_DOMAIN;let m=/^[a-zA-Z0-9-]{3,}$/,n=new Set(["no-reply","noreply","admin","support","help","info","postmaster","abuse","security","mailer-daemon","root","webmaster","hostmaster","system","alook"]);function o(a){return m.test(a)&&!n.has(a.toLowerCase())}let p=(0,a.i(790090).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var q=a.i(942854),r=a.i(506180),s=a.i(588339),t=a.i(752792),u=a.i(446827),v=a.i(921584);a.s(["AgentAccessTab",0,function({agentId:e,ownerId:f}){let{workspaceId:h}=(0,r.useWorkspace)(),[k,l]=(0,c.useState)("private"),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)([]),[t,w]=(0,c.useState)([]),[x,y]=(0,c.useState)(!0),[z,A]=(0,c.useState)(null),[B,C]=(0,c.useState)(""),[D,E]=(0,c.useState)(!1),[F,G]=(0,c.useState)(null),[H,I]=(0,c.useState)(!0);(0,c.useEffect)(()=>{let a=!1;return y(!0),Promise.all([(0,s.listAgentAccess)(h,e),(0,s.listMembers)(h)]).then(([b,c])=>{a||(p(b),w(c))}).catch(b=>{a||(b instanceof u.ApiError&&403===b.status?A(b.message):A("Failed to load access list"))}).finally(()=>{a||y(!1)}),()=>{a=!0}},[h,e]),(0,c.useEffect)(()=>{a.A(81396).then(({listAgents:a})=>{a(h).then(a=>{let b=a.find(a=>a.id===e);b&&l(b.visibility??"private")}).catch(()=>{})})},[h,e]);let J=async a=>{l(a),n(!0);try{await (0,s.updateAgent)(e,{visibility:a},h),v.toast.success("public"===a?"Agent is now public":"Agent is now private")}catch{l(k),v.toast.error("Failed to update visibility")}finally{n(!1)}},K=t.find(a=>a.user_id===f),L=new Set(o.map(a=>a.user_id)),M=t.filter(a=>!L.has(a.user_id)&&a.user_id!==f),N=async a=>{if(a&&!D){E(!0),A(null);try{await (0,s.grantAgentAccess)(h,e,a);let b=t.find(b=>b.user_id===a);b&&p(c=>[...c,{id:a,user_id:b.user_id,name:b.name,email:b.email,created_at:new Date().toISOString()}]),C(""),v.toast.success("Access granted")}catch(a){A(a instanceof Error?a.message:"Failed to grant access")}finally{E(!1)}}},O=async()=>{if(F){p(a=>a.filter(a=>a.user_id!==F.user_id)),G(null),A(null);try{await (0,s.revokeAgentAccess)(h,e,F.user_id,H),v.toast.success(H?"Access revoked and removed from whitelist":"Access revoked")}catch{p(o),A("Failed to revoke access")}}};return(0,b.jsxs)("div",{className:"mx-auto max-w-md space-y-6",children:[(0,b.jsx)("div",{className:"space-y-4 rounded-lg border border-border/50 p-4",children:(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Visibility"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"public"===k?"All workspace members can use this agent":"Only authorized members can use this agent"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:m?"Saving…":"public"===k?"Public":"Private"}),(0,b.jsx)("input",{type:"checkbox",checked:"public"===k,onChange:a=>J(a.target.checked?"public":"private"),disabled:m,className:"sr-only peer"}),(0,b.jsx)("div",{className:"relative w-9 h-5 bg-muted rounded-full peer-checked:bg-primary transition-colors",children:(0,b.jsx)("div",{className:(0,g.cn)("absolute left-0.5 top-0.5 w-4 h-4 bg-background rounded-full transition-transform","public"===k?"translate-x-4":"translate-x-0")})})]})]})}),"private"===k&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Authorized Members"}),z&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:z}),x?(0,b.jsx)("div",{className:"space-y-2",children:[1,2].map(a=>(0,b.jsx)("span",{className:"block h-10 animate-pulse rounded-md bg-muted"},a))}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[K&&(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"text-xs font-medium truncate",children:K.name||K.email}),K.name&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:K.email})]}),(0,b.jsx)("span",{className:"ml-2 shrink-0 text-xs text-muted-foreground",children:"Owner"})]}),o.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"text-xs font-medium truncate",children:a.name||a.email}),a.name&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:a.email})]}),(0,b.jsx)("button",{type:"button",onClick:()=>{var b;let c;return b=a.user_id,void((c=o.find(a=>a.user_id===b))&&(G(c),I(!0)))},className:"ml-2 shrink-0 rounded-full p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",children:(0,b.jsx)(q.XIcon,{className:"size-3.5"})})]},a.user_id))]}),M.length>0?(0,b.jsx)("div",{className:"flex items-center gap-2",children:(0,b.jsxs)(i.Select,{value:B,onValueChange:a=>{a&&(C(a),N(a))},children:[(0,b.jsx)(i.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)(i.SelectValue,{placeholder:"Add a member..."})}),(0,b.jsx)(i.SelectPopup,{children:M.map(a=>(0,b.jsx)(i.SelectItem,{value:a.user_id,children:a.name||a.email},a.user_id))})]})}):(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"All workspace members have been added. Invite new members from workspace settings."})]})]}),(0,b.jsx)(j.Dialog,{open:!!F,onOpenChange:a=>{a||G(null)},children:(0,b.jsxs)(j.DialogContent,{children:[(0,b.jsxs)(j.DialogHeader,{children:[(0,b.jsx)(j.DialogTitle,{children:"Remove Member Access"}),(0,b.jsxs)(j.DialogDescription,{children:["Remove"," ",(0,b.jsx)("span",{className:"font-medium text-foreground",children:F?.name||F?.email})," ","from this agent?"]})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer px-1",children:[(0,b.jsx)("input",{type:"checkbox",checked:H,onChange:a=>I(a.target.checked),className:"size-4 rounded border-border accent-primary"}),(0,b.jsx)("span",{className:"text-sm",children:"Also remove from email whitelist"})]}),(0,b.jsxs)(j.DialogFooter,{children:[(0,b.jsx)(j.DialogClose,{render:(0,b.jsx)(d.Button,{variant:"outline",size:"sm"}),children:"Cancel"}),(0,b.jsx)(d.Button,{size:"sm",variant:"destructive",onClick:O,children:"Remove"})]})]})})]})},"AllowedSendersTab",0,function({agentId:a}){let{workspaceId:f}=(0,r.useWorkspace)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,t]=(0,c.useState)(null),[u,v]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let b=!1;return l(!0),(0,s.listWhitelist)(a,f).then(a=>{b||h(a)}).catch(()=>{b||t("Failed to load whitelist")}).finally(()=>{b||l(!1)}),()=>{b=!0}},[a,f]),(0,c.useEffect)(()=>{let b=!1;return(0,s.listAgents)(f).then(c=>{b||v(c.filter(b=>b.id!==a&&b.email_handle).length>0)}).catch(()=>{}),()=>{b=!0}},[a,f]);let w=i.includes("@")&&i.trim().length>0,x=async()=>{if(w&&!m){n(!0),t(null);try{let b=await (0,s.addWhitelistEmail)(a,i.toLowerCase(),f);h(a=>[...a,b]),j("")}catch(a){t(a instanceof Error?a.message:"Failed to add email")}finally{n(!1)}}},y=async b=>{h(a=>a.filter(a=>a.id!==b)),t(null);try{await (0,s.removeWhitelistEmail)(a,b,f)}catch{h(g),t("Failed to remove email")}};return(0,b.jsxs)("div",{className:"mx-auto max-w-md space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Allowed Senders"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Only emails from these addresses will trigger this agent. Applies to all configured email addresses (alook.ai handle and custom email)."}),u&&(0,b.jsxs)("p",{className:"text-xs text-muted-foreground/70 mt-1.5 flex items-center gap-1",children:[(0,b.jsx)(p,{className:"size-3 shrink-0"}),"Agents in this workspace can already email each other — no whitelist entry needed."]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(e.Input,{value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),x())},placeholder:"user@example.com",type:"email",className:"flex-1"}),(0,b.jsx)(d.Button,{type:"button",size:"sm",variant:"secondary",disabled:!w||m,onClick:x,children:m?"Adding...":"Add"})]}),o&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:o}),k?(0,b.jsx)("div",{className:"space-y-2",children:[1,2,3].map(a=>(0,b.jsx)("span",{className:"block h-8 animate-pulse rounded-md bg-muted"},a))}):0===g.length?(0,b.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No allowed senders — all inbound emails will be rejected."}):(0,b.jsx)("div",{className:"space-y-1.5",children:g.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2",children:[(0,b.jsx)("span",{className:"text-sm",children:a.email}),(0,b.jsx)("button",{type:"button",onClick:()=>y(a.id),className:"rounded-full p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",children:(0,b.jsx)(q.XIcon,{className:"size-3.5"})})]},a.id))})]})},"EmailHandleField",0,function({emailHandle:a,setEmailHandle:c,derivedHandle:d}){let h=a||d,i=h&&!o(h)?"Must be 3+ characters, letters/numbers/hyphens only":"";return(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-handle",children:"Email Handle"}),(0,b.jsxs)("div",{className:"flex items-center gap-0",children:[(0,b.jsx)(e.Input,{id:"agent-handle",value:a,onChange:a=>c(a.target.value.toLowerCase()),placeholder:d||"my-agent",className:"rounded-r-none"}),(0,b.jsx)("span",{className:"inline-flex h-8 items-center rounded-r-lg border border-l-0 border-input bg-muted px-2.5 text-sm text-muted-foreground",children:"@alook.ai"})]}),h&&(0,b.jsx)("p",{className:(0,g.cn)("text-xs",i?"text-destructive":"text-muted-foreground"),children:i||`${h}@alook.ai`}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"This cannot be changed after creation."})]})},"GeneralFields",0,function({name:a,setName:c,description:d,setDescription:i,instructions:j,setInstructions:m,model:n,setModel:o,runtimeId:p,setRuntimeId:q,runtimes:r,providerModels:s,errors:t,runtimeAsRadio:u=!1}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsxs)(f.Label,{htmlFor:"agent-name",children:["Name ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(e.Input,{id:"agent-name",value:a,onChange:a=>c(a.target.value),placeholder:"My Agent",required:!0,"aria-invalid":!!t?.name,"aria-describedby":t?.name?"agent-name-error":void 0}),t?.name&&(0,b.jsx)("p",{id:"agent-name-error",className:"text-xs text-destructive",children:t.name})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-description",children:"Description"}),(0,b.jsx)(e.Input,{id:"agent-description",value:d,onChange:a=>i(a.target.value),placeholder:"What does this agent do?"})]}),m&&(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-instructions",children:"Instructions"}),(0,b.jsx)(h,{id:"agent-instructions",value:j??"",onChange:a=>m(a.target.value),placeholder:"System prompt or instructions...",rows:6})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-model",children:"Model"}),(0,b.jsx)(e.Input,{id:"agent-model",value:n,onChange:a=>o(a.target.value),placeholder:"Default (runtime model)",list:"agent-model-options"}),s.length>0&&(0,b.jsx)("datalist",{id:"agent-model-options",children:s.map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"Optional. Leave blank to use the runtime's default model."})]}),(0,b.jsxs)("div",{id:"agent-runtime-select",className:"space-y-1.5",children:[(0,b.jsxs)(f.Label,{children:["Runtime ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),u?(0,b.jsx)("div",{className:"space-y-1.5",role:"radiogroup","aria-label":"Runtime",children:0===r.length?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"No runtimes — start a daemon first"}):r.map(a=>{let c="online"===a.status,d=p===a.id,e="string"==typeof a.device_info?a.device_info:"";return(0,b.jsxs)("label",{className:(0,g.cn)("flex items-center gap-2.5 rounded-lg border p-2.5 cursor-pointer transition-colors",d?"border-primary bg-primary/5":"border-border hover:border-foreground/20",!c&&"opacity-40 pointer-events-none"),children:[(0,b.jsx)("input",{type:"radio",name:"runtime",value:a.id,checked:d,disabled:!c,onChange:()=>{let b=r.find(a=>a.id===p)?.provider,c=a.provider;q(a.id),b&&b!==c&&o("")},className:"accent-primary size-3.5"}),(0,b.jsx)(k.ProviderLogo,{provider:a.provider,className:"h-4 w-4 shrink-0"}),(0,b.jsx)("span",{className:"text-sm",children:a.provider}),e&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),!c&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground ml-auto",children:"offline"})]},a.id)})}):(0,b.jsx)(l,{value:p,onValueChange:a=>{let b=r.find(a=>a.id===p)?.provider,c=r.find(b=>b.id===a)?.provider;q(a),b&&b!==c&&o("")},runtimes:r,triggerProps:{"aria-invalid":!!t?.runtimeId,"aria-describedby":t?.runtimeId?"agent-runtime-error":void 0}}),t?.runtimeId&&(0,b.jsx)("p",{id:"agent-runtime-error",className:"text-xs text-destructive",children:t.runtimeId})]})]})},"PinToggle",0,function({agentId:a}){let{pins:d,handlePinAgent:e,handleUnpinAgent:f}=(0,t.useAgentContext)(),h=d.has(a),[i,j]=(0,c.useState)(!1),k=async()=>{j(!0);try{h?await f(a):await e(a)}finally{j(!1)}};return(0,b.jsxs)("div",{className:"space-y-4 rounded-lg border border-border/50 p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Pin to Sidebar"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:h?"This agent is pinned to the top of the sidebar":"Pin this agent to the top of the sidebar"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i?"Saving…":h?"Pinned":"Unpinned"}),(0,b.jsx)("input",{type:"checkbox",checked:h,onChange:k,disabled:i,className:"sr-only peer"}),(0,b.jsx)("div",{className:"relative w-9 h-5 bg-muted rounded-full peer-checked:bg-primary transition-colors",children:(0,b.jsx)("div",{className:(0,g.cn)("absolute left-0.5 top-0.5 w-4 h-4 bg-background rounded-full transition-transform",h?"translate-x-4":"translate-x-0")})})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"Tip: You can also right-click an agent in the sidebar to pin or unpin it."})]})},"getHandleError",0,function(a){return a&&!o(a)?"Must be 3+ characters, letters/numbers/hyphens only":""},"nameToHandle",0,function(a){return a.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-|-$/g,"")}],224226)}];
|
|
1
|
+
module.exports=[137993,22239,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(732254),e=a.i(334235),f=a.i(76592),g=a.i(7455),h=a.i(525132),i=a.i(75118),j=a.i(588339),k=a.i(527779),l=a.i(918768),m=a.i(461794),n=a.i(180222),o=a.i(67196),p=a.i(95590),q=a.i(942854);let r=(0,a.i(790090).default)("circle-question-mark",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);a.s(["CircleHelp",0,r],22239);var s=a.i(921584),t=a.i(506180),u=a.i(390248);let v={Gmail:{imapHost:"imap.gmail.com",imapPort:993,smtpHost:"smtp.gmail.com",smtpPort:587},Outlook:{imapHost:"outlook.office365.com",imapPort:993,smtpHost:"smtp.office365.com",smtpPort:587},Yahoo:{imapHost:"imap.mail.yahoo.com",imapPort:993,smtpHost:"smtp.mail.yahoo.com",smtpPort:587}};function w({fields:a,applyPreset:c,errors:g,onClearError:h}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"flex gap-1.5",children:Object.keys(v).map(a=>(0,b.jsx)(d.Button,{type:"button",variant:"outline",size:"sm",className:"h-6 text-[10px] px-2",onClick:()=>c(a),children:a},a))}),(0,b.jsxs)("div",{className:"grid gap-3",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(f.Label,{className:"text-xs",children:"Email Address *"}),(0,b.jsx)(e.Input,{placeholder:"you@gmail.com",value:a.emailAddress,onChange:b=>{a.setEmailAddress(b.target.value),b.target.value.trim()&&h("emailAddress")},"aria-invalid":!!g.emailAddress,"aria-describedby":g.emailAddress?"custom-email-address-error":void 0,className:"h-8 text-sm"}),g.emailAddress&&(0,b.jsx)("p",{id:"custom-email-address-error",className:"mt-1 text-xs text-destructive",children:g.emailAddress})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(f.Label,{className:"text-xs",children:"Display Name"}),(0,b.jsx)(e.Input,{placeholder:"My Agent",value:a.displayName,onChange:b=>a.setDisplayName(b.target.value),className:"h-8 text-sm"})]})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(f.Label,{className:"text-xs font-medium",children:"IMAP (Receive)"}),(0,b.jsx)(e.Input,{placeholder:"imap.gmail.com",value:a.imapHost,onChange:b=>{a.setImapHost(b.target.value),b.target.value.trim()&&h("imapHost")},"aria-invalid":!!g.imapHost,"aria-describedby":g.imapHost?"custom-email-imap-host-error":void 0,className:"h-8 text-sm"}),g.imapHost&&(0,b.jsx)("p",{id:"custom-email-imap-host-error",className:"text-xs text-destructive",children:g.imapHost}),(0,b.jsx)(e.Input,{type:"number",placeholder:"993",value:a.imapPort,onChange:b=>a.setImapPort(Number(b.target.value)),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{placeholder:a.emailAddress||"Username (defaults to email)",value:a.imapUsername,onChange:b=>a.setImapUsername(b.target.value),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{type:"password",placeholder:"App Password",value:a.imapPassword,onChange:b=>{a.setImapPassword(b.target.value),b.target.value.trim()&&h("imapPassword")},"aria-invalid":!!g.imapPassword,"aria-describedby":g.imapPassword?"custom-email-imap-password-error":void 0,className:"h-8 text-sm"}),g.imapPassword&&(0,b.jsx)("p",{id:"custom-email-imap-password-error",className:"text-xs text-destructive",children:g.imapPassword})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)(f.Label,{className:"text-xs font-medium",children:"SMTP (Send)"}),(0,b.jsx)(e.Input,{placeholder:"smtp.gmail.com",value:a.smtpHost,onChange:b=>{a.setSmtpHost(b.target.value),b.target.value.trim()&&h("smtpHost")},"aria-invalid":!!g.smtpHost,"aria-describedby":g.smtpHost?"custom-email-smtp-host-error":void 0,className:"h-8 text-sm"}),g.smtpHost&&(0,b.jsx)("p",{id:"custom-email-smtp-host-error",className:"text-xs text-destructive",children:g.smtpHost}),(0,b.jsx)(e.Input,{type:"number",placeholder:"587",value:a.smtpPort,onChange:b=>a.setSmtpPort(Number(b.target.value)),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{placeholder:a.emailAddress||"Username (defaults to email)",value:a.smtpUsername,onChange:b=>a.setSmtpUsername(b.target.value),className:"h-8 text-sm"}),(0,b.jsx)(e.Input,{type:"password",placeholder:"App Password",value:a.smtpPassword,onChange:b=>{a.setSmtpPassword(b.target.value),b.target.value.trim()&&h("smtpPassword")},"aria-invalid":!!g.smtpPassword,"aria-describedby":g.smtpPassword?"custom-email-smtp-password-error":void 0,className:"h-8 text-sm"}),g.smtpPassword&&(0,b.jsx)("p",{id:"custom-email-smtp-password-error",className:"text-xs text-destructive",children:g.smtpPassword})]})]})]})}a.s(["CustomEmailForm",0,function({agentId:a,workspaceId:e,onDataChange:f,getDataRef:x}){let{slug:y}=(0,t.useWorkspace)(),z=!a,[A,B]=(0,c.useState)(!1),[C,D]=(0,c.useState)([]),[E,F]=(0,c.useState)(!z),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(!1),[M,N]=(0,c.useState)({}),{fields:O,applyPreset:P,buildData:Q}=function(){let[a,b]=(0,c.useState)(""),[d,e]=(0,c.useState)(""),[f,g]=(0,c.useState)(""),[h,i]=(0,c.useState)(993),[j,k]=(0,c.useState)(""),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(587),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),w=j||a,x=r||a;return{fields:{emailAddress:a,setEmailAddress:b,displayName:d,setDisplayName:e,imapHost:f,setImapHost:g,imapPort:h,setImapPort:i,imapUsername:j,setImapUsername:k,imapPassword:l,setImapPassword:m,smtpHost:n,setSmtpHost:o,smtpPort:p,setSmtpPort:q,smtpUsername:r,setSmtpUsername:s,smtpPassword:t,setSmtpPassword:u},applyPreset:function(a){let b=v[a];b&&(g(b.imapHost),i(b.imapPort),o(b.smtpHost),q(b.smtpPort))},buildData:function(){return a&&f&&w&&l&&n&&x&&t?{emailAddress:a,displayName:d,imapHost:f,imapPort:h,imapUsername:w,imapPassword:l,imapTls:!0,smtpHost:n,smtpPort:p,smtpUsername:x,smtpPassword:t,smtpTls:1,pollIntervalSeconds:60}:null}}}(),R=O.imapUsername||O.emailAddress,S=O.smtpUsername||O.emailAddress,T=(0,c.useCallback)(a=>{N(b=>({...b,[a]:void 0}))},[]);(0,c.useEffect)(()=>{x&&(x.current=Q)}),(0,c.useEffect)(()=>{z&&f?.(Q())},[z,Q,f,O.emailAddress,O.displayName,O.imapHost,O.imapPort,O.imapUsername,O.imapPassword,O.smtpHost,O.smtpPort,O.smtpUsername,O.smtpPassword]);let U=(0,c.useCallback)(async()=>{if(!z)try{let b=await (0,j.listEmailAccounts)(a,e);D(b)}catch{}finally{F(!1)}},[a,e,z]);(0,c.useEffect)(()=>{U()},[U]);let V=C[0]??null;async function W(){let b=(0,u.validateCustomEmailFields)({emailAddress:O.emailAddress,imapHost:O.imapHost,imapUsername:R,imapPassword:O.imapPassword,smtpHost:O.smtpHost,smtpUsername:S,smtpPassword:O.smtpPassword});if(N(b),(0,u.hasCustomEmailErrors)(b))return;let c=Q();if(c&&a){H(!0);try{await (0,j.createEmailAccount)(a,c,e),s.toast.success("Custom email configured"),B(!1),await U()}catch(a){s.toast.error(a instanceof Error?a.message:"Failed to save")}finally{H(!1)}}}async function X(){if(V&&a){L(!0);try{await (0,j.deleteEmailAccount)(a,V.id,e),s.toast.success("Custom email removed"),D([])}catch(a){s.toast.error(a instanceof Error?a.message:"Failed to remove")}finally{L(!1)}}}async function Y(){if(V&&a){J(!0);try{await (0,j.syncEmailAccount)(a,V.id,e),s.toast.success("Sync triggered"),setTimeout(()=>U(),2e3)}catch(a){s.toast.error(a instanceof Error?a.message:"Sync failed")}finally{J(!1)}}}let Z=z?O.emailAddress?O.emailAddress:"Connect your own mailbox via IMAP/SMTP":E?"Loading...":V?V.email_address:"Connect your own mailbox via IMAP/SMTP";return(0,b.jsxs)(g.Sheet,{open:A,onOpenChange:B,children:[(0,b.jsxs)(g.SheetTrigger,{render:(0,b.jsx)("button",{type:"button",className:"flex w-full items-center justify-between rounded-lg border border-border/50 bg-muted/30 px-4 py-3 text-left transition-colors hover:bg-muted/50"}),children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:"Custom Email"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:Z})]}),!z&&V?(0,b.jsxs)("span",{className:(0,i.cn)("inline-flex items-center gap-1 text-[10px] px-1.5 py-0.5 rounded-full font-medium shrink-0","active"===V.status?"bg-green-500/10 text-green-600":"error"===V.status?"bg-red-500/10 text-red-600":"bg-yellow-500/10 text-yellow-600"),children:["active"===V.status?(0,b.jsx)(o.CheckCircle2,{className:"size-2.5"}):"error"===V.status?(0,b.jsx)(n.AlertCircle,{className:"size-2.5"}):null,V.status]}):(0,b.jsx)(p.ChevronRight,{className:"size-4 text-muted-foreground shrink-0"})]}),(0,b.jsxs)(g.SheetContent,{side:"right",className:"data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border",children:[(0,b.jsx)(g.SheetTitle,{className:"sr-only",children:"Custom Email"}),(0,b.jsx)(g.SheetBody,{className:"px-8 pt-10 pb-6",children:(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("h2",{className:"font-heading text-lg font-semibold",children:"Custom Email"}),(0,b.jsxs)(h.Tooltip,{children:[(0,b.jsx)(h.TooltipTrigger,{render:(0,b.jsx)("a",{href:`/w/${y}/help/email-setup`,target:"_blank",rel:"noopener noreferrer",className:"text-muted-foreground hover:text-foreground transition-colors"}),children:(0,b.jsx)(r,{className:"size-4"})}),(0,b.jsx)(h.TooltipContent,{children:"How to get IMAP/SMTP credentials"})]})]}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground mt-1",children:"Connect your own mailbox to send and receive email as your identity."})]}),!z&&V?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,b.jsx)(l.Mail,{className:"size-3.5 text-muted-foreground shrink-0"}),(0,b.jsx)("span",{className:"text-sm truncate",children:V.email_address})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:[(0,b.jsxs)(h.Tooltip,{children:[(0,b.jsx)(h.TooltipTrigger,{render:(0,b.jsx)(d.Button,{variant:"ghost",size:"icon-xs",onClick:Y,disabled:I,className:"rounded-full text-muted-foreground"}),children:(0,b.jsx)(m.RefreshCw,{className:(0,i.cn)("size-3.5",I&&"animate-spin")})}),(0,b.jsx)(h.TooltipContent,{children:"Sync now"})]}),(0,b.jsxs)(h.Tooltip,{children:[(0,b.jsx)(h.TooltipTrigger,{render:(0,b.jsx)(d.Button,{variant:"ghost",size:"icon-xs",onClick:X,disabled:K,className:"rounded-full text-muted-foreground hover:bg-destructive/10 hover:text-destructive"}),children:K?(0,b.jsx)(k.Loader2,{className:"size-3.5 animate-spin"}):(0,b.jsx)(q.XIcon,{className:"size-3.5"})}),(0,b.jsx)(h.TooltipContent,{children:"Remove"})]})]})]}),V.error_message&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:V.error_message}),V.last_synced_at&&(0,b.jsxs)("p",{className:"text-xs text-muted-foreground",children:["Last synced: ",new Date(V.last_synced_at).toLocaleString()]}),(0,b.jsxs)("div",{className:"rounded-md border border-border/50 px-3 py-2 text-xs text-muted-foreground space-y-1",children:[(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{children:"IMAP"}),(0,b.jsxs)("span",{children:[V.imap_host,":",V.imap_port]})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{children:"SMTP"}),(0,b.jsxs)("span",{children:[V.smtp_host,":",V.smtp_port]})]}),(0,b.jsxs)("div",{className:"flex justify-between",children:[(0,b.jsx)("span",{children:"Poll interval"}),(0,b.jsxs)("span",{children:[V.poll_interval_seconds,"s"]})]})]})]}):(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)(w,{fields:O,applyPreset:P,errors:M,onClearError:T}),!z&&(0,b.jsxs)(d.Button,{type:"button",size:"sm",className:"w-full",onClick:W,disabled:G,children:[G&&(0,b.jsx)(k.Loader2,{className:"size-3 animate-spin mr-1"}),"Save & Connect"]}),z&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"Will be connected after creating the agent."})]})]})})]})]})}],137993)},224226,a=>{"use strict";var b=a.i(749314),c=a.i(437199),d=a.i(732254),e=a.i(334235),f=a.i(76592),g=a.i(75118);function h({className:a,...c}){return(0,b.jsx)("textarea",{"data-slot":"textarea",className:(0,g.cn)("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",a),...c})}var i=a.i(354498),j=a.i(432340),k=a.i(74414);function l({value:a,onValueChange:c,runtimes:d,disabled:e,triggerProps:f}){let g=function(a){let b=new Map;for(let c of a){let a=c.daemon_id||c.id;b.has(a)||b.set(a,{label:("string"==typeof c.device_info?c.device_info:"")||a,runtimes:[]}),b.get(a).runtimes.push(c)}return b}(d),h=e||0===d.length||d.every(a=>"online"!==a.status);return(0,b.jsxs)(i.Select,{value:a,onValueChange:a=>{a&&c(a)},disabled:h,items:d.map(a=>{let b=("string"==typeof a.device_info?a.device_info:"")||"",c=b?`${a.provider} (${b})`:a.provider;return{value:a.id,label:c}}),children:[(0,b.jsx)(i.SelectTrigger,{...f,children:(0,b.jsx)(i.SelectValue,{placeholder:0===d.length?"No runtimes — start a daemon first":d.every(a=>"online"!==a.status)?"All runtimes offline":"Select a runtime"})}),(0,b.jsx)(i.SelectPopup,{children:Array.from(g.entries()).map(([a,c])=>(0,b.jsxs)(i.SelectGroup,{children:[(0,b.jsx)(i.SelectGroupLabel,{className:"truncate",children:c.label}),c.runtimes.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,disabled:"online"!==a.status,children:(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)(k.ProviderLogo,{provider:a.provider,className:"h-4 w-4"}),(0,b.jsx)("span",{children:a.provider}),(0,b.jsxs)("span",{className:"text-muted-foreground text-xs",children:["(",a.status,")"]})]})},a.id))]},a))})]})}a.i(974936),process.env.ALOOK_DOMAIN;let m=/^[a-zA-Z0-9-]{3,}$/,n=new Set(["no-reply","noreply","admin","support","help","info","postmaster","abuse","security","mailer-daemon","root","webmaster","hostmaster","system","alook"]);function o(a){return m.test(a)&&!n.has(a.toLowerCase())}let p=(0,a.i(790090).default)("info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var q=a.i(942854),r=a.i(506180),s=a.i(588339),t=a.i(752792),u=a.i(446827),v=a.i(921584);a.s(["AgentAccessTab",0,function({agentId:e,ownerId:f}){let{workspaceId:h}=(0,r.useWorkspace)(),[k,l]=(0,c.useState)("private"),[m,n]=(0,c.useState)(!1),[o,p]=(0,c.useState)([]),[t,w]=(0,c.useState)([]),[x,y]=(0,c.useState)(!0),[z,A]=(0,c.useState)(null),[B,C]=(0,c.useState)(""),[D,E]=(0,c.useState)(!1),[F,G]=(0,c.useState)(null),[H,I]=(0,c.useState)(!0);(0,c.useEffect)(()=>{let a=!1;return y(!0),Promise.all([(0,s.listAgentAccess)(h,e),(0,s.listMembers)(h)]).then(([b,c])=>{a||(p(b),w(c))}).catch(b=>{a||(b instanceof u.ApiError&&403===b.status?A(b.message):A("Failed to load access list"))}).finally(()=>{a||y(!1)}),()=>{a=!0}},[h,e]),(0,c.useEffect)(()=>{a.A(81396).then(({listAgents:a})=>{a(h).then(a=>{let b=a.find(a=>a.id===e);b&&l(b.visibility??"private")}).catch(()=>{})})},[h,e]);let J=async a=>{l(a),n(!0);try{await (0,s.updateAgent)(e,{visibility:a},h),v.toast.success("public"===a?"Agent is now public":"Agent is now private")}catch{l(k),v.toast.error("Failed to update visibility")}finally{n(!1)}},K=t.find(a=>a.user_id===f),L=new Set(o.map(a=>a.user_id)),M=t.filter(a=>!L.has(a.user_id)&&a.user_id!==f),N=async a=>{if(a&&!D){E(!0),A(null);try{await (0,s.grantAgentAccess)(h,e,a);let b=t.find(b=>b.user_id===a);b&&p(c=>[...c,{id:a,user_id:b.user_id,name:b.name,email:b.email,created_at:new Date().toISOString()}]),C(""),v.toast.success("Access granted")}catch(a){A(a instanceof Error?a.message:"Failed to grant access")}finally{E(!1)}}},O=async()=>{if(F){p(a=>a.filter(a=>a.user_id!==F.user_id)),G(null),A(null);try{await (0,s.revokeAgentAccess)(h,e,F.user_id,H),v.toast.success(H?"Access revoked and removed from whitelist":"Access revoked")}catch{p(o),A("Failed to revoke access")}}};return(0,b.jsxs)("div",{className:"mx-auto max-w-md space-y-6",children:[(0,b.jsx)("div",{className:"space-y-4 rounded-lg border border-border/50 p-4",children:(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Visibility"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:"public"===k?"All workspace members can use this agent":"Only authorized members can use this agent"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:m?"Saving…":"public"===k?"Public":"Private"}),(0,b.jsx)("input",{type:"checkbox",checked:"public"===k,onChange:a=>J(a.target.checked?"public":"private"),disabled:m,className:"sr-only peer"}),(0,b.jsx)("div",{className:"relative w-9 h-5 bg-muted rounded-full peer-checked:bg-primary transition-colors",children:(0,b.jsx)("div",{className:(0,g.cn)("absolute left-0.5 top-0.5 w-4 h-4 bg-background rounded-full transition-transform","public"===k?"translate-x-4":"translate-x-0")})})]})]})}),"private"===k&&(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Authorized Members"}),z&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:z}),x?(0,b.jsx)("div",{className:"space-y-2",children:[1,2].map(a=>(0,b.jsx)("span",{className:"block h-10 animate-pulse rounded-md bg-muted"},a))}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[K&&(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"text-xs font-medium truncate",children:K.name||K.email}),K.name&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:K.email})]}),(0,b.jsx)("span",{className:"ml-2 shrink-0 text-xs text-muted-foreground",children:"Owner"})]}),o.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"text-xs font-medium truncate",children:a.name||a.email}),a.name&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground truncate",children:a.email})]}),(0,b.jsx)("button",{type:"button",onClick:()=>{var b;let c;return b=a.user_id,void((c=o.find(a=>a.user_id===b))&&(G(c),I(!0)))},className:"ml-2 shrink-0 rounded-full p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",children:(0,b.jsx)(q.XIcon,{className:"size-3.5"})})]},a.user_id))]}),M.length>0?(0,b.jsx)("div",{className:"flex items-center gap-2",children:(0,b.jsxs)(i.Select,{value:B,onValueChange:a=>{a&&(C(a),N(a))},children:[(0,b.jsx)(i.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)(i.SelectValue,{placeholder:"Add a member..."})}),(0,b.jsx)(i.SelectPopup,{children:M.map(a=>(0,b.jsx)(i.SelectItem,{value:a.user_id,children:a.name||a.email},a.user_id))})]})}):(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"All workspace members have been added. Invite new members from workspace settings."})]})]}),(0,b.jsx)(j.Dialog,{open:!!F,onOpenChange:a=>{a||G(null)},children:(0,b.jsxs)(j.DialogContent,{children:[(0,b.jsxs)(j.DialogHeader,{children:[(0,b.jsx)(j.DialogTitle,{children:"Remove Member Access"}),(0,b.jsxs)(j.DialogDescription,{children:["Remove"," ",(0,b.jsx)("span",{className:"font-medium text-foreground",children:F?.name||F?.email})," ","from this agent?"]})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer px-1",children:[(0,b.jsx)("input",{type:"checkbox",checked:H,onChange:a=>I(a.target.checked),className:"size-4 rounded border-border accent-primary"}),(0,b.jsx)("span",{className:"text-sm",children:"Also remove from email whitelist"})]}),(0,b.jsxs)(j.DialogFooter,{children:[(0,b.jsx)(j.DialogClose,{render:(0,b.jsx)(d.Button,{variant:"outline",size:"sm"}),children:"Cancel"}),(0,b.jsx)(d.Button,{size:"sm",variant:"destructive",onClick:O,children:"Remove"})]})]})})]})},"AllowedSendersTab",0,function({agentId:a}){let{workspaceId:f}=(0,r.useWorkspace)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,t]=(0,c.useState)(null),[u,v]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let b=!1;return l(!0),(0,s.listWhitelist)(a,f).then(a=>{b||h(a)}).catch(()=>{b||t("Failed to load whitelist")}).finally(()=>{b||l(!1)}),()=>{b=!0}},[a,f]),(0,c.useEffect)(()=>{let b=!1;return(0,s.listAgents)(f).then(c=>{b||v(c.filter(b=>b.id!==a&&b.email_handle).length>0)}).catch(()=>{}),()=>{b=!0}},[a,f]);let w=i.includes("@")&&i.trim().length>0,x=async()=>{if(w&&!m){n(!0),t(null);try{let b=await (0,s.addWhitelistEmail)(a,i.toLowerCase(),f);h(a=>[...a,b]),j("")}catch(a){t(a instanceof Error?a.message:"Failed to add email")}finally{n(!1)}}},y=async b=>{h(a=>a.filter(a=>a.id!==b)),t(null);try{await (0,s.removeWhitelistEmail)(a,b,f)}catch{h(g),t("Failed to remove email")}};return(0,b.jsxs)("div",{className:"mx-auto max-w-md space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Allowed Senders"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-1",children:"Only emails from these addresses will trigger this agent. Applies to all configured email addresses (alook.ai handle and custom email)."}),u&&(0,b.jsxs)("p",{className:"text-xs text-muted-foreground/70 mt-1.5 flex items-center gap-1",children:[(0,b.jsx)(p,{className:"size-3 shrink-0"}),"Agents in this workspace can already email each other — no whitelist entry needed."]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(e.Input,{value:i,onChange:a=>j(a.target.value),onKeyDown:a=>{"Enter"===a.key&&(a.preventDefault(),x())},placeholder:"user@example.com",type:"email",className:"flex-1"}),(0,b.jsx)(d.Button,{type:"button",size:"sm",variant:"secondary",disabled:!w||m,onClick:x,children:m?"Adding...":"Add"})]}),o&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:o}),k?(0,b.jsx)("div",{className:"space-y-2",children:[1,2,3].map(a=>(0,b.jsx)("span",{className:"block h-8 animate-pulse rounded-md bg-muted"},a))}):0===g.length?(0,b.jsx)("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No allowed senders — all inbound emails will be rejected."}):(0,b.jsx)("div",{className:"space-y-1.5",children:g.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-md border border-border/50 px-3 py-2",children:[(0,b.jsx)("span",{className:"text-sm",children:a.email}),(0,b.jsx)("button",{type:"button",onClick:()=>y(a.id),className:"rounded-full p-1 text-muted-foreground hover:bg-destructive/10 hover:text-destructive transition-colors",children:(0,b.jsx)(q.XIcon,{className:"size-3.5"})})]},a.id))})]})},"EmailHandleField",0,function({emailHandle:a,setEmailHandle:c,derivedHandle:d}){let h=a||d,i=h&&!o(h)?"Must be 3+ characters, letters/numbers/hyphens only":"";return(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-handle",children:"Email Handle"}),(0,b.jsxs)("div",{className:"flex items-center gap-0",children:[(0,b.jsx)(e.Input,{id:"agent-handle",value:a,onChange:a=>c(a.target.value.toLowerCase()),placeholder:d||"my-agent",className:"rounded-r-none"}),(0,b.jsx)("span",{className:"inline-flex h-8 items-center rounded-r-lg border border-l-0 border-input bg-muted px-2.5 text-sm text-muted-foreground",children:"@alook.ai"})]}),h&&(0,b.jsx)("p",{className:(0,g.cn)("text-xs",i?"text-destructive":"text-muted-foreground"),children:i||`${h}@alook.ai`}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"This cannot be changed after creation."})]})},"GeneralFields",0,function({name:a,setName:c,description:d,setDescription:i,instructions:j,setInstructions:m,model:n,setModel:o,runtimeId:p,setRuntimeId:q,runtimes:r,providerModels:s,errors:t,runtimeAsRadio:u=!1}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsxs)(f.Label,{htmlFor:"agent-name",children:["Name ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,b.jsx)(e.Input,{id:"agent-name",value:a,onChange:a=>c(a.target.value),placeholder:"My Agent",required:!0,"aria-invalid":!!t?.name,"aria-describedby":t?.name?"agent-name-error":void 0}),t?.name&&(0,b.jsx)("p",{id:"agent-name-error",className:"text-xs text-destructive",children:t.name})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-description",children:"Description"}),(0,b.jsx)(e.Input,{id:"agent-description",value:d,onChange:a=>i(a.target.value),placeholder:"What does this agent do?"})]}),m&&(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-instructions",children:"Instructions"}),(0,b.jsx)(h,{id:"agent-instructions",value:j??"",onChange:a=>m(a.target.value),placeholder:"System prompt or instructions...",rows:6})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{htmlFor:"agent-model",children:"Model"}),(0,b.jsx)(e.Input,{id:"agent-model",value:n,onChange:a=>o(a.target.value),placeholder:"Default (runtime model)",list:"agent-model-options"}),s.length>0&&(0,b.jsx)("datalist",{id:"agent-model-options",children:s.map(a=>(0,b.jsx)("option",{value:a},a))}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"Optional. Leave blank to use the runtime's default model."})]}),(0,b.jsxs)("div",{id:"agent-runtime-select",className:"space-y-1.5",children:[(0,b.jsxs)(f.Label,{children:["Runtime ",(0,b.jsx)("span",{className:"text-destructive",children:"*"})]}),u?(0,b.jsx)("div",{className:"space-y-1.5",role:"radiogroup","aria-label":"Runtime",children:0===r.length?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"No runtimes — start a daemon first"}):r.map(a=>{let c="online"===a.status,d=p===a.id,e="string"==typeof a.device_info?a.device_info:"";return(0,b.jsxs)("label",{className:(0,g.cn)("flex items-center gap-2.5 rounded-lg border p-2.5 cursor-pointer transition-colors",d?"border-primary bg-primary/5":"border-border hover:border-foreground/20",!c&&"opacity-40 pointer-events-none"),children:[(0,b.jsx)("input",{type:"radio",name:"runtime",value:a.id,checked:d,disabled:!c,onChange:()=>{let b=r.find(a=>a.id===p)?.provider,c=a.provider;q(a.id),b&&b!==c&&o("")},className:"accent-primary size-3.5"}),(0,b.jsx)(k.ProviderLogo,{provider:a.provider,className:"h-4 w-4 shrink-0"}),(0,b.jsx)("span",{className:"text-sm",children:a.provider}),e&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:e}),!c&&(0,b.jsx)("span",{className:"text-xs text-muted-foreground ml-auto",children:"offline"})]},a.id)})}):(0,b.jsx)(l,{value:p,onValueChange:a=>{let b=r.find(a=>a.id===p)?.provider,c=r.find(b=>b.id===a)?.provider;q(a),b&&b!==c&&o("")},runtimes:r,triggerProps:{"aria-invalid":!!t?.runtimeId,"aria-describedby":t?.runtimeId?"agent-runtime-error":void 0}}),t?.runtimeId&&(0,b.jsx)("p",{id:"agent-runtime-error",className:"text-xs text-destructive",children:t.runtimeId})]})]})},"PinToggle",0,function({agentId:a}){let{pins:d,handlePinAgent:e,handleUnpinAgent:f}=(0,t.useAgentContext)(),h=d.has(a),[i,j]=(0,c.useState)(!1),k=async()=>{j(!0);try{h?await f(a):await e(a)}finally{j(!1)}};return(0,b.jsxs)("div",{className:"space-y-4 rounded-lg border border-border/50 p-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-medium",children:"Pin to Sidebar"}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:h?"This agent is pinned to the top of the sidebar":"Pin this agent to the top of the sidebar"})]}),(0,b.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground",children:i?"Saving…":h?"Pinned":"Unpinned"}),(0,b.jsx)("input",{type:"checkbox",checked:h,onChange:k,disabled:i,className:"sr-only peer"}),(0,b.jsx)("div",{className:"relative w-9 h-5 bg-muted rounded-full peer-checked:bg-primary transition-colors",children:(0,b.jsx)("div",{className:(0,g.cn)("absolute left-0.5 top-0.5 w-4 h-4 bg-background rounded-full transition-transform",h?"translate-x-4":"translate-x-0")})})]})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground/70",children:"Tip: You can also right-click an agent in the sidebar to pin or unpin it."})]})},"getHandleError",0,function(a){return a&&!o(a)?"Must be 3+ characters, letters/numbers/hyphens only":""},"nameToHandle",0,function(a){return a.toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-{2,}/g,"-").replace(/^-|-$/g,"")}],224226)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_components_00xgo_-._.js.map
|