@alook/app 0.0.77 → 0.0.79
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/email-worker/index.js +2 -1
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/.build/open-next.config.edge.mjs +146 -5
- package/bundled/web/.open-next/.build/open-next.config.mjs +140 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/031m-eb429hj4.js +2 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{0d2ptea7.h139.js → 05~4tl0zgrol5.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/07-fakltbt2a2.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/07zixwn.53xcm.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0_i1v2~_w-_jk.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0bwptiqeu8.61.js +325 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0e32q02m3ewux.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0h_a9~1fp7ago.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{00vv.te1qu_1m.js → 0ie.u1iu3pwrm.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{0alt4g70q0kns.js → 0ivn_32mz4lhv.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0jahw0dpk9vgc.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{0zeouhtn0hbkx.js → 0kcuw_83491vk.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0mntmjgjntb7y.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{0t2w-7.88r2xw.js → 0oh4spqzj65-a.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{0.ow13_gacl1n.js → 0p-5xcfjcbn~s.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0v3.4j_hftqix.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0x8emvplqk0j_.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0y.7dv.ck31vl.css +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0~xam~jpkm~vn.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/106i157mnp0ro.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/11r7n17iffcwi.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/17gxqoer2p0mw.js +22 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/1816-z_y9qndk.js +1 -0
- package/bundled/web/.open-next/assets/gallery/calendar.png +0 -0
- package/bundled/web/.open-next/assets/gallery/collaboration.png +0 -0
- package/bundled/web/.open-next/assets/gallery/email.png +0 -0
- package/bundled/web/.open-next/assets/gallery/issues.png +0 -0
- package/bundled/web/.open-next/assets/gallery/local-agent.png +0 -0
- package/bundled/web/.open-next/assets/gallery/org.png +0 -0
- package/bundled/web/.open-next/cache/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/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/dynamodb-provider/open-next.config.mjs +140 -5
- package/bundled/web/.open-next/middleware/handler.mjs +4 -4
- package/bundled/web/.open-next/middleware/open-next.config.mjs +146 -5
- 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/api/calendar/route.js +6 -5
- 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/0b5f_next_dist_esm_build_templates_app-route_08rz-qa.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +13 -11
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0266t8u._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_03t_17c._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_09j_99x._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0drn_ol._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0exm5_w._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0h3guve._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0w6dw.t._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_12wxdg1._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/0b-r_unique-names-generator_dist_index_m_10n7h-y.js +4 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__03fsn3f._.js +13 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__091lwu-._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__099etsu._.js → [root-of-the-server]__0esiqa8._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__0r2s1aj._.js → [root-of-the-server]__0rdn-xi._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +13 -11
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0vv9cr4._.js → _02qoj2p._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_063q-hj._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0ilz5db._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0n4z71y._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_05wa4wr._.js → _0rgicks._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0tu039y._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_11h_8jo._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_12e18r-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_13__3im._.js +21 -22
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0ioufd8._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_10wwsme._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0~23g-y._.js +2 -2
- 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]_layout_tsx_0juu2um._.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_home_home-page_tsx_0to84tv._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_lib_api_ts_0uf2r1p._.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 +83 -83
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +261 -214
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/open-next.config.mjs +146 -5
- package/bundled/ws-do/index.js +2 -1
- package/dist/cli/index.js +4 -1
- package/dist/cli/session-runner.js +2 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0.vi-1cgnne0e.css +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/01je4kbh.8akj.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/05rjq4guhci-w.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0fmcohc0raah~.js +0 -326
- package/bundled/web/.open-next/assets/_next/static/chunks/0ipcqq75rslc3.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0khqgglj_9zdp.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0lf4c2v9ftogx.js +0 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/0m~et1blru7_u.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0npw723ph39ai.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0pig4vcvoqn0w.js +0 -20
- package/bundled/web/.open-next/assets/_next/static/chunks/0pijx0.ayvlyr.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0sp16c8-thn5e.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0uht5kak3uat9.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0ypg5.fp9-.a2.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0zoi2a2-ucmjh.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/112_xk40~~_sr.js +0 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/173os6ji32qc1.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/182fqror32n8n.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0x7m_vj._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0.a2670._.js +0 -13
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0nava3-._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_091qk6t._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0xcw94t._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0d6x0l6._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/node_modules__pnpm_0o~nukr._.js +0 -3
- /package/bundled/web/.open-next/assets/_next/static/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{eq06ANXMuNGifrnr5Hg7O → 3zHg2EwefkGKUXp1h2jId}/robots.txt.cache +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[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(647651).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(73270),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)},137993,370085,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(16831),l=a.i(606896),m=a.i(877014),n=a.i(123047),o=a.i(940723),p=a.i(143984),q=a.i(73270);let r=(0,a.i(647651).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],370085);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)}];
|
|
1
|
+
module.exports=[224226,984078,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(354498),h=a.i(432340),i=a.i(74414);function j({value:a,onValueChange:c,runtimes:d,disabled:e,triggerProps:f}){let h=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),k=e||0===d.length||d.every(a=>"online"!==a.status);return(0,b.jsxs)(g.Select,{value:a,onValueChange:a=>{a&&c(a)},disabled:k,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)(g.SelectTrigger,{...f,children:(0,b.jsx)(g.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)(g.SelectPopup,{children:Array.from(h.entries()).map(([a,c])=>(0,b.jsxs)(g.SelectGroup,{children:[(0,b.jsx)(g.SelectGroupLabel,{className:"truncate",children:c.label}),c.runtimes.map(a=>(0,b.jsx)(g.SelectItem,{value:a.id,disabled:"online"!==a.status,children:(0,b.jsxs)("span",{className:"flex items-center gap-2",children:[(0,b.jsx)(i.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.s(["RuntimeSelect",0,j],984078),a.i(974936),process.env.ALOOK_DOMAIN;let k=/^[a-zA-Z0-9-]{3,}$/,l=new Set(["no-reply","noreply","admin","support","help","info","postmaster","abuse","security","mailer-daemon","root","webmaster","hostmaster","system","alook"]);function m(a){return k.test(a)&&!l.has(a.toLowerCase())}var n=a.i(75118),o=a.i(647651);let p=(0,o.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(73270);let r=(0,o.default)("dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);var s=a.i(28429),t=a.i(506180),u=a.i(588339);a.i(752792);var v=a.i(446827),w=a.i(921584);function x({children:a}){let[d,e]=(0,c.useState)(!1);return(0,b.jsxs)("div",{className:"pt-1",children:[(0,b.jsxs)("button",{type:"button",onClick:()=>e(!d),className:"flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[(0,b.jsx)(s.ChevronDown,{className:(0,n.cn)("size-3.5 transition-transform",d&&"rotate-180")}),"Advanced"]}),d&&(0,b.jsx)("div",{className:"mt-3 space-y-4",children:a})]})}a.s(["AgentAccessTab",0,function({agentId:e,ownerId:f}){let{workspaceId:i}=(0,t.useWorkspace)(),[j,k]=(0,c.useState)("private"),[l,m]=(0,c.useState)(!1),[o,p]=(0,c.useState)([]),[r,s]=(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,u.listAgentAccess)(i,e),(0,u.listMembers)(i)]).then(([b,c])=>{a||(p(b),s(c))}).catch(b=>{a||(b instanceof v.ApiError&&403===b.status?A(b.message):A("Failed to load access list"))}).finally(()=>{a||y(!1)}),()=>{a=!0}},[i,e]),(0,c.useEffect)(()=>{a.A(81396).then(({listAgents:a})=>{a(i).then(a=>{let b=a.find(a=>a.id===e);b&&k(b.visibility??"private")}).catch(()=>{})})},[i,e]);let J=async a=>{k(a),m(!0);try{await (0,u.updateAgent)(e,{visibility:a},i),w.toast.success("public"===a?"Agent is now public":"Agent is now private")}catch{k(j),w.toast.error("Failed to update visibility")}finally{m(!1)}},K=r.find(a=>a.user_id===f),L=new Set(o.map(a=>a.user_id)),M=r.filter(a=>!L.has(a.user_id)&&a.user_id!==f),N=async a=>{if(a&&!D){E(!0),A(null);try{await (0,u.grantAgentAccess)(i,e,a);let b=r.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(""),w.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,u.revokeAgentAccess)(i,e,F.user_id,H),w.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"===j?"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:l?"Saving…":"public"===j?"Public":"Private"}),(0,b.jsx)("input",{type:"checkbox",checked:"public"===j,onChange:a=>J(a.target.checked?"public":"private"),disabled:l,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,n.cn)("absolute left-0.5 top-0.5 w-4 h-4 bg-background rounded-full transition-transform","public"===j?"translate-x-4":"translate-x-0")})})]})]})}),"private"===j&&(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)(g.Select,{value:B,onValueChange:a=>{a&&(C(a),N(a))},children:[(0,b.jsx)(g.SelectTrigger,{className:"flex-1 text-xs",children:(0,b.jsx)(g.SelectValue,{placeholder:"Add a member..."})}),(0,b.jsx)(g.SelectPopup,{children:M.map(a=>(0,b.jsx)(g.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)(h.Dialog,{open:!!F,onOpenChange:a=>{a||G(null)},children:(0,b.jsxs)(h.DialogContent,{children:[(0,b.jsxs)(h.DialogHeader,{children:[(0,b.jsx)(h.DialogTitle,{children:"Remove Member Access"}),(0,b.jsxs)(h.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)(h.DialogFooter,{children:[(0,b.jsx)(h.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,t.useWorkspace)(),[g,h]=(0,c.useState)([]),[i,j]=(0,c.useState)(""),[k,l]=(0,c.useState)(!0),[m,n]=(0,c.useState)(!1),[o,r]=(0,c.useState)(null),[s,v]=(0,c.useState)(!1);(0,c.useEffect)(()=>{let b=!1;return l(!0),(0,u.listWhitelist)(a,f).then(a=>{b||h(a)}).catch(()=>{b||r("Failed to load whitelist")}).finally(()=>{b||l(!1)}),()=>{b=!0}},[a,f]),(0,c.useEffect)(()=>{let b=!1;return(0,u.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),r(null);try{let b=await (0,u.addWhitelistEmail)(a,i.toLowerCase(),f);h(a=>[...a,b]),j("")}catch(a){r(a instanceof Error?a.message:"Failed to add email")}finally{n(!1)}}},y=async b=>{h(a=>a.filter(a=>a.id!==b)),r(null);try{await (0,u.removeWhitelistEmail)(a,b,f)}catch{h(g),r("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)."}),s&&(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 e=a||d,g=e&&!m(e)?"Must be 3+ characters, letters/numbers/hyphens only":"";return(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(f.Label,{className:"text-xs text-muted-foreground",children:"Email"}),(0,b.jsxs)("div",{className:"flex items-center",children:[(0,b.jsx)("input",{id:"agent-handle",value:a,onChange:a=>c(a.target.value.toLowerCase()),placeholder:d||"my-agent",className:"w-full border-0 bg-transparent px-0 py-0.5 text-sm text-foreground shadow-none outline-none placeholder:text-muted-foreground/40 focus-visible:ring-0"}),(0,b.jsx)("span",{className:"shrink-0 text-sm text-muted-foreground/70",children:"@alook.ai"})]}),g&&(0,b.jsx)("p",{className:"text-xs text-destructive",children:g})]})},"GeneralFields",0,function({name:a,setName:c,description:d,setDescription:e,instructions:g,setInstructions:h,model:k,setModel:l,runtimeId:m,setRuntimeId:o,runtimes:p,providerModels:q,errors:s,runtimeAsRadio:t=!1,onShuffle:u,emailHandleSlot:v,advancedSection:w}){return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)("input",{id:"agent-name",value:a,onChange:a=>c(a.target.value),placeholder:"Agent name",required:!0,autoFocus:!0,"aria-invalid":!!s?.name,"aria-describedby":s?.name?"agent-name-error":void 0,className:"w-full border-0 bg-transparent px-0 py-1 text-2xl font-medium leading-[1.2] tracking-tight shadow-none outline-none placeholder:text-muted-foreground/40 placeholder:font-normal focus-visible:ring-0"}),u&&(0,b.jsx)("button",{type:"button",onClick:u,"aria-label":"Randomize name",className:"absolute right-0 top-1/2 -translate-y-1/2 rounded p-1.5 text-muted-foreground/50 hover:text-foreground hover:bg-accent transition-colors",children:(0,b.jsx)(r,{className:"size-4"})})]}),s?.name&&(0,b.jsx)("p",{id:"agent-name-error",className:"text-xs text-destructive mt-1",children:s.name})]}),(0,b.jsx)("textarea",{id:"agent-description",value:d,onChange:a=>{e(a.target.value),a.target.style.height="auto",a.target.style.height=`${a.target.scrollHeight}px`},ref:a=>{a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)},placeholder:"Add a description…",rows:1,className:"w-full resize-none overflow-hidden border-0 bg-transparent px-0 py-0.5 text-sm text-foreground shadow-none outline-none placeholder:text-muted-foreground/40 focus-visible:ring-0"}),v,(t||p.length>0)&&(0,b.jsxs)("div",{id:"agent-runtime-select",className:"space-y-1.5",children:[(0,b.jsx)(f.Label,{className:"text-xs text-muted-foreground",children:"Runtime"}),t?(0,b.jsx)("div",{className:"space-y-1.5",role:"radiogroup","aria-label":"Runtime",children:0===p.length?(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:"No runtimes — start a daemon first"}):p.map(a=>{let c="online"===a.status,d=m===a.id,e="string"==typeof a.device_info?a.device_info:"";return(0,b.jsxs)("label",{className:(0,n.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/50 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=p.find(a=>a.id===m)?.provider,c=a.provider;o(a.id),b&&b!==c&&l("")},className:"accent-primary size-3.5"}),(0,b.jsx)(i.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)(j,{value:m,onValueChange:a=>{let b=p.find(a=>a.id===m)?.provider,c=p.find(b=>b.id===a)?.provider;o(a),b&&b!==c&&l("")},runtimes:p,triggerProps:{"aria-invalid":!!s?.runtimeId,"aria-describedby":s?.runtimeId?"agent-runtime-error":void 0}}),s?.runtimeId&&(0,b.jsx)("p",{id:"agent-runtime-error",className:"text-xs text-destructive",children:s.runtimeId})]}),(h||w)&&(0,b.jsxs)(x,{children:[h&&(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(f.Label,{className:"text-xs text-muted-foreground",children:"Instructions"}),(0,b.jsx)("textarea",{id:"agent-instructions",value:g??"",onChange:a=>{h(a.target.value),a.target.style.height="auto",a.target.style.height=`${a.target.scrollHeight}px`},ref:a=>{a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)},placeholder:"System prompt or instructions...",rows:3,className:"w-full resize-none overflow-hidden border-0 bg-transparent px-0 py-1 text-sm text-foreground shadow-none outline-none placeholder:text-muted-foreground/40 focus-visible:ring-0"})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)(f.Label,{className:"text-xs text-muted-foreground",children:"Model"}),(0,b.jsx)("input",{id:"agent-model",value:k,onChange:a=>l(a.target.value),placeholder:"Default (runtime model)",list:"agent-model-options",className:"w-full border-0 bg-transparent px-0 py-0.5 text-sm text-foreground shadow-none outline-none placeholder:text-muted-foreground/40 focus-visible:ring-0"}),q.length>0&&(0,b.jsx)("datalist",{id:"agent-model-options",children:q.map(a=>(0,b.jsx)("option",{value:a},a))})]}),w]})]})},"getHandleError",0,function(a){return a&&!m(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)},137993,370085,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(16831),l=a.i(606896),m=a.i(877014),n=a.i(123047),o=a.i(940723),p=a.i(143984),q=a.i(73270);let r=(0,a.i(647651).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],370085);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)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=src_web_src_components_0nj0euq._.js.map
|