@alook/app 0.0.131 → 0.0.132

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/bundled/email-worker/index.js +1 -0
  2. package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
  3. package/bundled/web/.open-next/assets/BUILD_ID +1 -1
  4. package/bundled/web/.open-next/assets/_next/static/chunks/{2c1vr49swqk4_.js → 184t7di0k1wt-.js} +1 -1
  5. package/bundled/web/.open-next/assets/_next/static/chunks/1iux65sajp19w.js +1 -0
  6. package/bundled/web/.open-next/assets/_next/static/chunks/{431_0ohnxkfsj.js → 27b6m6derdf5b.js} +5 -5
  7. package/bundled/web/.open-next/assets/_next/static/chunks/{0xbml6v726n7w.js → 2_5gjqjt8nmq2.js} +3 -3
  8. package/bundled/web/.open-next/assets/_next/static/chunks/3bfk44a51kg4q.js +1 -0
  9. package/bundled/web/.open-next/cache/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/_global-error.cache +1 -1
  10. package/bundled/web/.open-next/cache/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/_not-found.cache +1 -1
  11. package/bundled/web/.open-next/cache/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/device.cache +1 -1
  12. package/bundled/web/.open-next/cache/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/privacy.cache +1 -1
  13. package/bundled/web/.open-next/cache/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/sitemap.xml.cache +1 -1
  14. package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
  15. package/bundled/web/.open-next/cloudflare/init.js +1 -1
  16. package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
  17. package/bundled/web/.open-next/middleware/handler.mjs +3 -3
  18. package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
  19. package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
  20. package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
  21. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
  22. 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
  23. 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
  24. 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
  25. 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
  26. 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
  27. 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
  28. 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
  29. 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
  30. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
  31. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
  32. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
  33. 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
  34. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
  35. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
  36. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
  37. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
  38. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
  39. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/[traceId]/page_client-reference-manifest.js +1 -1
  40. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/traces/page_client-reference-manifest.js +1 -1
  41. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
  42. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page/react-loadable-manifest.json +1 -1
  43. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
  44. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0gm1sdi._.js +1 -1
  45. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0v95a0y._.js +1 -1
  46. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_139j3zh._.js +1 -1
  47. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_13jq647._.js +1 -1
  48. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_1nfaney._.js +1 -1
  49. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__1-ckpz1._.js +1 -1
  50. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0h0_aut._.js +1 -1
  51. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0p54okk._.js +1 -1
  52. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1n93_m_._.js +1 -1
  53. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_1wqw0ro._.js +1 -1
  54. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_0-s5b_y._.js +1 -1
  55. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
  56. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
  57. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
  58. package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
  59. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +13 -13
  60. package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +64 -64
  61. package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +3 -3
  62. package/bundled/ws-do/index.js +1 -0
  63. package/package.json +1 -1
  64. package/bundled/web/.open-next/assets/_next/static/chunks/0ym6b1b5nwlot.js +0 -1
  65. package/bundled/web/.open-next/assets/_next/static/chunks/17gwfzv2za_o6.js +0 -1
  66. /package/bundled/web/.open-next/assets/_next/static/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/_buildManifest.js +0 -0
  67. /package/bundled/web/.open-next/assets/_next/static/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/_clientMiddlewareManifest.js +0 -0
  68. /package/bundled/web/.open-next/assets/_next/static/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/_ssgManifest.js +0 -0
  69. /package/bundled/web/.open-next/cache/{ulJviq2YWkZQXIBN6Wysn → LwRrk9IiQO-kR73n2jKLg}/robots.txt.cache +0 -0
@@ -59,6 +59,6 @@ module.exports=[136876,a=>{"use strict";let b=(0,a.i(410732).default)("circle-x"
59
59
  - Every interaction builds trust. Be empathetic, accurate, and efficient — resolve on first response when possible.
60
60
  - Lead with acknowledgment, then solution or clear next steps. Use simple language.
61
61
  - If you can't resolve immediately, set realistic expectations: what you'll do, by when.
62
- - Track open issues proactively. Escalate complex or sensitive cases with full context.`;a.s(["SCENARIO_PRESETS",0,[{id:"software-dev",label:"Software Development",description:"Build and ship code with a coordinated dev team",icon:"🖥",members:[{role:"leader",description:"Coordinates work, summarizes results, and replies to you",instructions:d},{role:"engineer",description:"Writes code, runs tests, and verifies implementations",instructions:i,relationship:"Delegate coding tasks with: clear requirement description, acceptance criteria (3-5 specific testable items), relevant file paths, existing patterns to follow, and context from research findings if applicable.\n\nReport back with: implementation status, files changed, acceptance criteria checklist (pass/fail each), test results, and self-review concerns. After implementation, send work to the reviewer if one exists."},{role:"researcher",description:"Reads code, explores APIs, and gathers technical context",instructions:f,relationship:"Delegate technical research with: what to investigate, what decision it informs, scope boundary, and relevant file paths or code pointers.\n\nReport back with: technical summary, evidence (file paths, doc URLs, code snippets), recommendation, and confidence level (High/Medium/Low). Flag anything unverified."}]},{id:"content-research",label:"Content & Research",description:"Research topics, write content, and manage publishing",icon:"📝",members:[{role:"leader",description:"Coordinates work, shapes content direction, and delivers output",instructions:d},{role:"researcher",description:"Finds sources, verifies facts, and organizes references",instructions:g,relationship:"Delegate content research with: topic or claim to investigate, target content format (article, report, social), depth needed, and specific sources to check if any.\n\nReport back with: key facts for the writer, organized source list (URL, date, reliability), verification gaps, framing suggestion, and per-claim confidence."},{role:"assistant",description:"Handles formatting, publishing workflows, and follow-ups",instructions:j,relationship:"Delegate content operations with: what content to format or publish, target platform, deadline, and style requirements.\n\nReport back with: what was done (formatted, published, submitted), next step (awaiting review, scheduled date), and blockers if any."}]},{id:"personal-assistant",label:"Personal Assistant",description:"One AI that handles your everyday tasks and communications",icon:"🤖",members:[{role:"leader",description:"Handles all tasks directly — emails, research, scheduling, and more",instructions:e}]},{id:"sales-outreach",label:"Sales & Outreach",description:"Prospect, follow up, and close deals as a team",icon:"📈",members:[{role:"leader",description:"Coordinates outreach strategy and manages deal flow",instructions:d},{role:"researcher",description:"Researches prospects, companies, and market intelligence",instructions:h,relationship:"Delegate prospect research with: target criteria, market or industry focus, what intelligence is needed, and how it will be used (outreach, pitch, proposal).\n\nReport back with: prioritized prospect list (name, role, company, relevance, suggested angle), market signals, and confidence per finding."},{role:"assistant",description:"Handles outreach emails, follow-ups, and pipeline tracking",instructions:k,relationship:"Delegate outreach with: who to contact, messaging angle, follow-up cadence, and desired outcome.\n\nReport back with: emails sent or scheduled, responses received, pipeline updates, and deals needing escalation."}]},{id:"customer-support",label:"Customer Support",description:"Handle tickets, draft replies, and track resolutions",icon:"🎧",members:[{role:"leader",description:"Coordinates support queue and handles escalations",instructions:d},{role:"assistant",description:"Drafts customer responses and tracks open issues",instructions:l,relationship:"Delegate support tasks with: customer issue summary, urgency level, prior interaction context, and resolution approach.\n\nReport back with: response drafted or sent, resolution status, follow-up schedule, and recurring patterns to flag."}]},{id:"custom",label:"Custom",description:"Build your own team from scratch",icon:"✨",members:[{role:"leader",description:"Coordinates work and replies to you",instructions:d}]}],"shuffleMembers",0,function(a){let d=new Set,e=[];for(let f=0;f<a;f++){let a,f=0;do a=(0,b.uniqueNamesGenerator)({dictionaries:[b.names],length:1,style:"capital"}),f++;while(d.has(a)&&f<100)d.add(a),e.push({name:a,avatarUrl:(0,c.serializeAvatarConfig)((0,c.randomConfig)())})}return e}])},212484,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(762276);a.s(["ScenarioPicker",0,function({selected:a,onSelect:e,onBrowseTemplates:f}){return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"What will your company focus on?"}),f&&(0,b.jsxs)("button",{type:"button",onClick:f,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:["Browse templates ",(0,b.jsx)("span",{"aria-hidden":"true",children:"›"})]})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:d.SCENARIO_PRESETS.map(d=>(0,b.jsxs)("button",{onClick:()=>e(d.id),className:(0,c.cn)("flex flex-col items-start gap-1 rounded-lg border p-4 text-left transition-all hover:border-foreground/30",a===d.id?"border-foreground/50 bg-muted/50":"border-border"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,b.jsx)("span",{className:"text-lg",children:d.icon}),(0,b.jsxs)("span",{className:"text-[10px] text-muted-foreground/70",children:[d.members.length," agent",d.members.length>1?"s":""]})]}),(0,b.jsx)("span",{className:"text-sm font-medium",children:d.label}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-tight",children:d.description})]},d.id))})]})}])},263233,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(732254),e=a.i(439882),f=a.i(674899);a.i(735132);var g=a.i(325848),h=a.i(354498),i=a.i(74414);a.i(974936);var j=a.i(911509);let k={leader:"Lead",researcher:"Researcher",engineer:"Engineer",assistant:"Assistant"};a.s(["TeamPreview",0,function({members:a,runtimes:l,onShuffle:m,onAssignRuntime:n}){let o=l.length>1&&n;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Your company"}),(0,b.jsxs)(d.Button,{variant:"ghost",size:"sm",onClick:m,className:"h-7 text-xs gap-1.5",children:[(0,b.jsx)(f.RefreshCw,{className:"size-3"}),"Shuffle"]})]}),(0,b.jsx)("div",{className:(0,c.cn)("grid gap-3 grid-cols-1",2===a.length&&"sm:grid-cols-2",3===a.length&&"sm:grid-cols-2 md:grid-cols-3",a.length>=4&&"sm:grid-cols-2 md:grid-cols-4"),children:a.map((a,c)=>{let d,f=a.avatarUrl?(0,g.parseAvatarUrl)(a.avatarUrl):null;return(0,b.jsxs)(e.Card,{size:"sm",className:"flex flex-col px-3 py-4 gap-2 h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5",children:[f?(0,b.jsx)(g.AvatarRenderer,{config:f,size:36,className:"rounded-xl shrink-0"}):(0,b.jsx)("div",{className:"size-9 rounded-xl bg-muted flex items-center justify-center text-sm font-semibold shrink-0",children:a.name.charAt(0)}),(0,b.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:a.name}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground bg-muted/60 px-1.5 py-0.5 rounded",children:k[a.role]})]})]}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground/70 font-mono truncate",children:(0,j.toAlookAddress)(a.emailHandle||a.name.toLowerCase())}),(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug flex-1",children:a.description}),o&&(d=l.find(b=>b.id===a.runtimeId),(0,b.jsx)("div",{className:"mt-1",children:(0,b.jsxs)(h.Select,{value:a.runtimeId,onValueChange:a=>{a&&n(c,a)},children:[(0,b.jsx)(h.SelectTrigger,{className:"h-7 text-[11px]",children:(0,b.jsxs)("div",{className:"flex items-center gap-1.5 truncate",children:[d&&(0,b.jsx)(i.ProviderLogo,{provider:d.provider||"",className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:d?.provider||d?.runtime_mode||"Select"})]})}),(0,b.jsx)(h.SelectContent,{children:l.map(a=>(0,b.jsx)(h.SelectItem,{value:a.id,children:a.provider||a.runtime_mode},a.id))})]})}))]},c)})})]})}])},927981,a=>a.a(async(b,c)=>{try{var d=a.i(616612),e=a.i(734803),f=a.i(630991),g=a.i(732254),h=a.i(334235),i=a.i(84096),j=a.i(402656),k=a.i(136876),l=a.i(69379),m=a.i(598169),n=a.i(689560),o=a.i(780956),p=a.i(454607),q=a.i(562706),r=a.i(946621),s=a.i(892691),t=a.i(561101),u=a.i(212484),v=a.i(263233),w=a.i(762276);a.i(974936);var x=a.i(372822),y=a.i(588339),z=a.i(881503),A=b([p]);[p]=A.then?(await A)():A,a.s(["StudioOnboardingClient",0,function({workspaceId:a,workspaceSlug:b,workspaceName:c,initialTemplate:A}){let B=(0,f.useRouter)(),C=!a,[D,E]=(0,e.useState)(a),F=(0,e.useRef)(D);(0,e.useEffect)(()=>{F.current=D},[D]);let[G,H]=(0,e.useState)([]),I=(0,e.useRef)(G);(0,e.useEffect)(()=>{I.current=G},[G]);let[J,K]=(0,e.useState)(!!a),[L,M]=(0,e.useState)(A?A.baseScenario:null),[N,O]=(0,e.useState)(C||"Personal"===c?"":c),[P,Q]=(0,e.useState)(null),[R,S]=(0,e.useState)(!1),[T,U]=(0,e.useState)(!1),[V,W]=(0,e.useState)([]),[X,Y]=(0,e.useState)(!1),[Z,$]=(0,e.useState)(""),[_,aa]=(0,e.useState)(!1),[ab,ac]=(0,e.useState)(!1),[ad,ae]=(0,e.useState)(!1),af=(0,x.isTauri)()&&(0,x.isDesktop)(),ag=G.filter(a=>"online"===a.status),ah=af?G:ag,ai=ag.length>0,aj=new Set(ag.map(a=>a.daemon_id).filter(Boolean)).size;(0,e.useEffect)(()=>{D&&(0,y.listRuntimes)(D).then(H).catch(()=>{}).finally(()=>K(!1))},[D]),(0,e.useEffect)(()=>{let a=async a=>{let b=await (0,x.tauriInvoke)("register_cli",{token:a});if(!b.success)return void o.toast.error(b.message||"Auto-registration failed — please check CLI installation");ac(!0);let c=await (0,y.getMachineTokenStatus)();c.runtimes?.length&&(H(c.runtimes.map(a=>({id:a.id,workspace_id:"",daemon_id:c.hostname||null,runtime_mode:"local",provider:a.type,status:c.daemon_online?"online":"offline",device_info:c.hostname||"",metadata:{version:a.version},last_seen_at:null,created_at:"",updated_at:""}))),c.daemon_online&&ae(!0))};(0,y.getMachineTokenStatus)().then(async b=>{if(af)if("registered"===b.status)ac(!0),b.daemon_online&&ae(!0),b.runtimes?.length&&H(b.runtimes.map(a=>({id:a.id,workspace_id:"",daemon_id:b.hostname||null,runtime_mode:"local",provider:a.type,status:a.status,device_info:b.hostname||"",metadata:{version:a.version},last_seen_at:null,created_at:"",updated_at:""})));else if("pending"===b.status)try{let{token:b}=await (0,y.createMachineToken)("cli");await a(b)}catch{o.toast.error("Failed to auto-register CLI — please check that Claude or Codex is installed")}else try{let{token:b}=await (0,y.createMachineToken)("cli");await a(b)}catch{o.toast.error("Failed to auto-register CLI — please check that Claude or Codex is installed")}else if("registered"===b.status||"active"===b.status){if(C&&b.workspace_id)return;ac(!0),b.daemon_online&&ae(!0),b.runtimes?.length&&H(b.runtimes.map(a=>({id:a.id,workspace_id:"",daemon_id:b.hostname||null,runtime_mode:"local",provider:a.type,status:a.status,device_info:b.hostname||"",metadata:{version:a.version},last_seen_at:null,created_at:"",updated_at:""})))}}).catch(()=>{})},[]);let ak=(0,e.useCallback)(a=>{let b=F.current;if("machine.registered"===a.type)ac(!0),0===I.current.length&&(0,y.getMachineTokenStatus)().then(a=>{a.runtimes?.length&&H(a.runtimes.map(b=>({id:b.id,workspace_id:"",daemon_id:a.hostname||null,runtime_mode:"local",provider:b.type,status:a.daemon_online?"online":"offline",device_info:a.hostname||"",metadata:{version:b.version},last_seen_at:null,created_at:"",updated_at:""}))),a.daemon_online&&ae(!0)}).catch(()=>{});else if("runtime.registered"===a.type){ac(!0);let c=a.workspaceId;c&&!b?(E(c),(0,y.listRuntimes)(c).then(H).catch(()=>{})):b&&(0,y.listRuntimes)(b).then(H).catch(()=>{})}else if("runtime.status"===a.type&&"online"===a.status){ae(!0),0===I.current.length?(0,y.getMachineTokenStatus)().then(a=>{a.runtimes?.length&&H(a.runtimes.map(b=>({id:b.id,workspace_id:"",daemon_id:a.hostname||null,runtime_mode:"local",provider:b.type,status:"online",device_info:a.hostname||"",metadata:{version:b.version},last_seen_at:null,created_at:"",updated_at:""})))}).catch(()=>{}):H(a=>a.map(a=>({...a,status:"online"})));let a=F.current;a&&(0,y.listRuntimes)(a).then(H).catch(()=>{})}else"runtime.status"===a.type&&"offline"===a.status&&(ae(!1),H(a=>a.map(a=>({...a,status:"offline"}))))},[]);(0,z.useUserWs)(ak),(0,e.useEffect)(()=>{let a=ah[0]?.id;a&&W(b=>0!==b.length&&b.some(a=>!a.runtimeId)?b.map(b=>b.runtimeId?b:{...b,runtimeId:a}):b)},[ah]);let al=(0,e.useCallback)(async a=>{try{let b=await fetch("/api/studios/check-handles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:a})});if(!b.ok)return null;return await b.json()}catch{return null}},[]);(0,e.useEffect)(()=>{if(!A||J||V.length>0)return;let a=(0,w.shuffleMembers)(A.members.length),b=ah[0]?.id||"",c=A.members.map((c,d)=>({name:a[d].name,role:c.role,description:c.description,instructions:c.instructions,avatarUrl:a[d].avatarUrl,runtimeId:b,relationship:c.relationship}));W(c),al(c.map(a=>a.name)).then(a=>{a&&W(b=>b.map(b=>{let c=a.find(a=>a.name===b.name);return c?{...b,emailHandle:c.handle}:b}))})},[A,J]);let am=async a=>{M(a);let b=w.SCENARIO_PRESETS.find(b=>b.id===a),c=(0,w.shuffleMembers)(b.members.length),d=ah[0]?.id||"",e=b.members.map((a,b)=>({name:c[b].name,role:a.role,description:a.description,instructions:a.instructions,avatarUrl:c[b].avatarUrl,runtimeId:d,relationship:a.relationship}));W(e);let f=await al(e.map(a=>a.name));f&&W(a=>a.map(a=>{let b=f.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},an=async()=>{let a=(0,w.shuffleMembers)(V.length),b=V.map((b,c)=>({...b,name:a[c].name,avatarUrl:a[c].avatarUrl,emailHandle:void 0}));W(b);let c=await al(b.map(a=>a.name));c&&W(a=>a.map(a=>{let b=c.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},ao=async()=>{if(N.trim()){U(!0),Q(null);try{let a=D?`/api/studios/check-name?name=${encodeURIComponent(N.trim())}&workspace_id=${D}`:`/api/studios/check-name?name=${encodeURIComponent(N.trim())}`,b=await fetch(a);if(!b.ok){let a=await b.json().catch(()=>({}));o.toast.error(a.error||"Invalid company name"),Q(!1);return}let c=await b.json();Q(c.available),c.available&&S(!0)}catch{Q(null),o.toast.error("Failed to check name availability")}finally{U(!1)}}},ap=(0,e.useCallback)(async()=>{aa(!0);try{let a=await (0,y.createMachineToken)("cli",F.current||void 0);$(a.token)}catch{o.toast.error("Failed to generate token")}finally{aa(!1)}},[]),aq=async()=>{Y(!0);try{let b=D;if(!b){let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:N.trim()||"Personal",slug:(N.trim()||"personal").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")})});if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error||"Failed to create workspace")}b=(await a.json()).id,E(b);let c=await fetch("/api/machine-tokens/bind-workspace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_id:b})});if(!c.ok){await fetch(`/api/workspaces/${b}`,{method:"DELETE"}).catch(()=>{}),E(null);let a=await c.json().catch(()=>({}));throw Error(a.error||"Failed to bind workspace")}}if(!b){o.toast.error("Please connect a computer first"),Y(!1);return}let c=V;if(V.some(a=>!a.runtimeId||a.runtimeId.startsWith("temp_"))){let a=0,d=[];for(;a<10&&!(d=await (0,y.listRuntimes)(b)).some(a=>"online"===a.status);)await new Promise(a=>setTimeout(a,1e3)),a++;let e=d.filter(a=>"online"===a.status);if(e.length>0&&(c=V.map(a=>{if(!a.runtimeId||a.runtimeId.startsWith("temp_")){let b=G.find(b=>b.id===a.runtimeId)?.provider,c=e.find(a=>a.provider===b)||e[0];return{...a,runtimeId:c.id}}return a})),c.some(a=>!a.runtimeId||a.runtimeId.startsWith("temp_"))){o.toast.error("Waiting for runtime — please ensure the daemon is running"),Y(!1);return}}let d=await fetch("/api/studios",{method:"POST",headers:{"Content-Type":"application/json","X-Workspace-ID":b},body:JSON.stringify({name:N.trim()||void 0,scenario:L,members:c.map(a=>({name:a.name,role:a.role,runtime_id:a.runtimeId,description:a.description,instructions:a.instructions,avatar_url:a.avatarUrl||null,email_handle:a.emailHandle||void 0,relationship:a.relationship||void 0}))})});if(!d.ok){let a=await d.json();throw Error(a.error||"Failed to create company")}let e=await d.json();a||(0,r.trackWorkspaceCreated)("onboarding"),(0,r.trackOnboardingCompleted)({template_used:L??void 0,agent_count:c.length});for(let a=0;a<c.length;a++)(0,r.trackAgentCreated)({is_first_agent:0===a,has_email:!!c[a].emailHandle});o.toast.success("Company created!"),B.push(`/w/${e.workspace.slug}/agents/${e.leader_agent_id}`)}catch(a){o.toast.error(a instanceof Error?a.message:"Failed to create company"),Y(!1)}},ar=C?N.trim()&&!0===P:!1!==P,as=L&&V.length>0&&(af||C||V.every(a=>a.runtimeId))&&ar&&(ai||ab&&ad&&G.length>0||af);return L?(0,d.jsx)(s.PublicLayout,{leftSlot:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>B.push("/workspaces"),children:[(0,d.jsx)(n.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),(0,d.jsx)("span",{className:"text-muted-foreground/40",children:"/"}),(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>M(null),children:[(0,d.jsx)(m.ArrowLeft,{className:"size-3 mr-1.5"}),"Back"]})]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,q.clearAllCache)(),(0,p.signOut)({fetchOptions:{onSuccess:()=>B.push("/sign-in")}})},children:[(0,d.jsx)(l.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-3xl space-y-10 px-6 py-14",children:[(0,d.jsx)("div",{className:"text-center",children:(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"Build your company"})}),J?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(i.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Company name"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.Input,{value:N,onChange:a=>{O(a.target.value),Q(null)},placeholder:"e.g. Atlas Lab",className:"text-sm",disabled:R}),R?(0,d.jsx)(g.Button,{variant:"outline",size:"sm",onClick:()=>{S(!1),Q(null)},className:"shrink-0",children:"Edit"}):(0,d.jsx)(g.Button,{variant:"outline",size:"sm",onClick:ao,disabled:!N.trim()||T,className:"shrink-0",children:T?(0,d.jsx)(i.Loader2,{className:"size-3 animate-spin"}):"Check"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[!0===P&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-emerald-600 flex items-center gap-0.5",children:[(0,d.jsx)(j.CheckCircle2,{className:"size-3"})," Available"]}),(0,d.jsx)("span",{children:"·"})]}),C?(0,d.jsx)("span",{children:"Required — pick a name for your company."}):(0,d.jsx)("span",{children:"Optional — you can always rename later."})]}),!1===P&&(0,d.jsxs)("span",{className:"text-red-500 flex items-center gap-1 ml-auto",children:[(0,d.jsx)(k.XCircle,{className:"size-3"})," Name is taken, try another"]})]})]}),(0,d.jsx)(v.TeamPreview,{members:V,runtimes:ah,onShuffle:an,onAssignRuntime:(a,b)=>{W(c=>c.map((c,d)=>d===a?{...c,runtimeId:b}:c))}}),!af&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Connect a computer"}),ai||ab&&ad&&G.length>0?(0,d.jsxs)("p",{className:"text-xs text-emerald-600 flex items-center gap-1",children:[(0,d.jsx)(j.CheckCircle2,{className:"size-3"})," ",aj||1," computer",(aj||1)>1?"s":""," connected"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your company needs a connected computer to run tasks."}),(0,d.jsx)("div",{className:"rounded-xl bg-muted/40 p-5",children:(0,d.jsx)(t.ConnectMachineSteps,{generatedToken:Z,generatingToken:_,onGenerateToken:ap,registered:ab,daemonOnline:ad})})]})]}),(0,d.jsx)(g.Button,{onClick:aq,disabled:!as||X,className:"w-full",size:"lg",children:X?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.Loader2,{className:"size-4 animate-spin mr-2"}),"Launching..."]}):C&&!1===P?"Name unavailable":C&&!0!==P?"Check company name first":"Launch company"})]})]})}):(0,d.jsx)(s.PublicLayout,{leftSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>B.push("/workspaces"),children:[(0,d.jsx)(n.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,q.clearAllCache)(),(0,p.signOut)({fetchOptions:{onSuccess:()=>B.push("/sign-in")}})},children:[(0,d.jsx)(l.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),mainClassName:"flex items-center justify-center",children:(0,d.jsxs)("div",{className:"w-full max-w-3xl space-y-8 px-6 py-6",children:[(0,d.jsxs)("div",{className:"text-center space-y-2",children:[(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"What will your company do?"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick a focus area. You can always add more agents later."})]}),(0,d.jsx)(u.ScenarioPicker,{selected:L,onSelect:am,onBrowseTemplates:()=>B.push(D?`/templates?workspace_id=${D}`:"/templates")}),D&&(0,d.jsx)("div",{className:"flex justify-center pt-2",children:(0,d.jsx)("button",{type:"button",onClick:()=>{document.cookie=`skip_init=${D};path=/;max-age=86400`,B.push(`/w/${b}/home`)},className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})})]})})}]),c()}catch(a){c(a)}},!1)];
62
+ - Track open issues proactively. Escalate complex or sensitive cases with full context.`;a.s(["SCENARIO_PRESETS",0,[{id:"software-dev",label:"Software Development",description:"Build and ship code with a coordinated dev team",icon:"🖥",members:[{role:"leader",description:"Coordinates work, summarizes results, and replies to you",instructions:d},{role:"engineer",description:"Writes code, runs tests, and verifies implementations",instructions:i,relationship:"Delegate coding tasks with: clear requirement description, acceptance criteria (3-5 specific testable items), relevant file paths, existing patterns to follow, and context from research findings if applicable.\n\nReport back with: implementation status, files changed, acceptance criteria checklist (pass/fail each), test results, and self-review concerns. After implementation, send work to the reviewer if one exists."},{role:"researcher",description:"Reads code, explores APIs, and gathers technical context",instructions:f,relationship:"Delegate technical research with: what to investigate, what decision it informs, scope boundary, and relevant file paths or code pointers.\n\nReport back with: technical summary, evidence (file paths, doc URLs, code snippets), recommendation, and confidence level (High/Medium/Low). Flag anything unverified."}]},{id:"content-research",label:"Content & Research",description:"Research topics, write content, and manage publishing",icon:"📝",members:[{role:"leader",description:"Coordinates work, shapes content direction, and delivers output",instructions:d},{role:"researcher",description:"Finds sources, verifies facts, and organizes references",instructions:g,relationship:"Delegate content research with: topic or claim to investigate, target content format (article, report, social), depth needed, and specific sources to check if any.\n\nReport back with: key facts for the writer, organized source list (URL, date, reliability), verification gaps, framing suggestion, and per-claim confidence."},{role:"assistant",description:"Handles formatting, publishing workflows, and follow-ups",instructions:j,relationship:"Delegate content operations with: what content to format or publish, target platform, deadline, and style requirements.\n\nReport back with: what was done (formatted, published, submitted), next step (awaiting review, scheduled date), and blockers if any."}]},{id:"personal-assistant",label:"Personal Assistant",description:"One AI that handles your everyday tasks and communications",icon:"🤖",members:[{role:"leader",description:"Handles all tasks directly — emails, research, scheduling, and more",instructions:e}]},{id:"sales-outreach",label:"Sales & Outreach",description:"Prospect, follow up, and close deals as a team",icon:"📈",members:[{role:"leader",description:"Coordinates outreach strategy and manages deal flow",instructions:d},{role:"researcher",description:"Researches prospects, companies, and market intelligence",instructions:h,relationship:"Delegate prospect research with: target criteria, market or industry focus, what intelligence is needed, and how it will be used (outreach, pitch, proposal).\n\nReport back with: prioritized prospect list (name, role, company, relevance, suggested angle), market signals, and confidence per finding."},{role:"assistant",description:"Handles outreach emails, follow-ups, and pipeline tracking",instructions:k,relationship:"Delegate outreach with: who to contact, messaging angle, follow-up cadence, and desired outcome.\n\nReport back with: emails sent or scheduled, responses received, pipeline updates, and deals needing escalation."}]},{id:"customer-support",label:"Customer Support",description:"Handle tickets, draft replies, and track resolutions",icon:"🎧",members:[{role:"leader",description:"Coordinates support queue and handles escalations",instructions:d},{role:"assistant",description:"Drafts customer responses and tracks open issues",instructions:l,relationship:"Delegate support tasks with: customer issue summary, urgency level, prior interaction context, and resolution approach.\n\nReport back with: response drafted or sent, resolution status, follow-up schedule, and recurring patterns to flag."}]},{id:"custom",label:"Custom",description:"Build your own team from scratch",icon:"✨",members:[{role:"leader",description:"Coordinates work and replies to you",instructions:d}]}],"shuffleMembers",0,function(a){let d=new Set,e=[];for(let f=0;f<a;f++){let a,f=0;do a=(0,b.uniqueNamesGenerator)({dictionaries:[b.names],length:1,style:"capital"}),f++;while(d.has(a)&&f<100)d.add(a),e.push({name:a,avatarUrl:(0,c.serializeAvatarConfig)((0,c.randomConfig)())})}return e}])},212484,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(762276);a.s(["ScenarioPicker",0,function({selected:a,onSelect:e,onBrowseTemplates:f}){return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"What will your company focus on?"}),f&&(0,b.jsxs)("button",{type:"button",onClick:f,className:"text-[11px] text-muted-foreground hover:text-foreground transition-colors underline underline-offset-2",children:["Browse templates ",(0,b.jsx)("span",{"aria-hidden":"true",children:"›"})]})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:d.SCENARIO_PRESETS.map(d=>(0,b.jsxs)("button",{onClick:()=>e(d.id),className:(0,c.cn)("flex flex-col items-start gap-1 rounded-lg border p-4 text-left transition-all hover:border-foreground/30",a===d.id?"border-foreground/50 bg-muted/50":"border-border"),children:[(0,b.jsxs)("div",{className:"flex items-center justify-between w-full",children:[(0,b.jsx)("span",{className:"text-lg",children:d.icon}),(0,b.jsxs)("span",{className:"text-[10px] text-muted-foreground/70",children:[d.members.length," agent",d.members.length>1?"s":""]})]}),(0,b.jsx)("span",{className:"text-sm font-medium",children:d.label}),(0,b.jsx)("span",{className:"text-xs text-muted-foreground leading-tight",children:d.description})]},d.id))})]})}])},263233,a=>{"use strict";var b=a.i(616612),c=a.i(75118),d=a.i(732254),e=a.i(439882),f=a.i(674899);a.i(735132);var g=a.i(325848),h=a.i(354498),i=a.i(74414);a.i(974936);var j=a.i(911509);let k={leader:"Lead",researcher:"Researcher",engineer:"Engineer",assistant:"Assistant"};a.s(["TeamPreview",0,function({members:a,runtimes:l,onShuffle:m,onAssignRuntime:n}){let o=l.length>1&&n;return(0,b.jsxs)("div",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Your company"}),(0,b.jsxs)(d.Button,{variant:"ghost",size:"sm",onClick:m,className:"h-7 text-xs gap-1.5",children:[(0,b.jsx)(f.RefreshCw,{className:"size-3"}),"Shuffle"]})]}),(0,b.jsx)("div",{className:(0,c.cn)("grid gap-3 grid-cols-1",2===a.length&&"sm:grid-cols-2",3===a.length&&"sm:grid-cols-2 md:grid-cols-3",a.length>=4&&"sm:grid-cols-2 md:grid-cols-4"),children:a.map((a,c)=>{let d,f=a.avatarUrl?(0,g.parseAvatarUrl)(a.avatarUrl):null;return(0,b.jsxs)(e.Card,{size:"sm",className:"flex flex-col px-3 py-4 gap-2 h-full",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5",children:[f?(0,b.jsx)(g.AvatarRenderer,{config:f,size:36,className:"rounded-xl shrink-0"}):(0,b.jsx)("div",{className:"size-9 rounded-xl bg-muted flex items-center justify-center text-sm font-semibold shrink-0",children:a.name.charAt(0)}),(0,b.jsxs)("div",{className:"flex flex-col items-start gap-0.5",children:[(0,b.jsx)("span",{className:"text-sm font-medium",children:a.name}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground bg-muted/60 px-1.5 py-0.5 rounded",children:k[a.role]})]})]}),(0,b.jsx)("p",{className:"text-[10px] text-muted-foreground/70 font-mono truncate",children:(0,j.toAlookAddress)(a.emailHandle||a.name.toLowerCase())}),(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground leading-snug flex-1",children:a.description}),o&&(d=l.find(b=>b.id===a.runtimeId),(0,b.jsx)("div",{className:"mt-1",children:(0,b.jsxs)(h.Select,{value:a.runtimeId,onValueChange:a=>{a&&n(c,a)},children:[(0,b.jsx)(h.SelectTrigger,{className:"h-7 text-[11px]",children:(0,b.jsxs)("div",{className:"flex items-center gap-1.5 truncate",children:[d&&(0,b.jsx)(i.ProviderLogo,{provider:d.provider||"",className:"size-3 shrink-0"}),(0,b.jsx)("span",{className:"truncate",children:d?.provider||d?.runtime_mode||"Select"})]})}),(0,b.jsx)(h.SelectContent,{children:l.map(a=>(0,b.jsx)(h.SelectItem,{value:a.id,children:a.provider||a.runtime_mode},a.id))})]})}))]},c)})})]})}])},927981,a=>a.a(async(b,c)=>{try{var d=a.i(616612),e=a.i(734803),f=a.i(630991),g=a.i(732254),h=a.i(334235),i=a.i(84096),j=a.i(402656),k=a.i(136876),l=a.i(69379),m=a.i(598169),n=a.i(689560),o=a.i(780956),p=a.i(454607),q=a.i(562706),r=a.i(946621),s=a.i(892691),t=a.i(561101),u=a.i(212484),v=a.i(263233),w=a.i(762276);a.i(974936);var x=a.i(372822),y=a.i(588339),z=a.i(881503),A=b([p]);[p]=A.then?(await A)():A,a.s(["StudioOnboardingClient",0,function({workspaceId:a,workspaceSlug:b,workspaceName:c,initialTemplate:A}){let B=(0,f.useRouter)(),C=!a,[D,E]=(0,e.useState)(a),F=(0,e.useRef)(D);(0,e.useEffect)(()=>{F.current=D},[D]);let[G,H]=(0,e.useState)([]),I=(0,e.useRef)(G);(0,e.useEffect)(()=>{I.current=G},[G]);let J=(0,e.useRef)(()=>{}),[K,L]=(0,e.useState)(!!a),[M,N]=(0,e.useState)(A?A.baseScenario:null),[O,P]=(0,e.useState)(C||"Personal"===c?"":c),[Q,R]=(0,e.useState)(null),[S,T]=(0,e.useState)(!1),[U,V]=(0,e.useState)(!1),[W,X]=(0,e.useState)([]),[Y,Z]=(0,e.useState)(!1),$=(0,e.useRef)(!1),[_,aa]=(0,e.useState)(""),[ab,ac]=(0,e.useState)(!1),[ad,ae]=(0,e.useState)(!1),[af,ag]=(0,e.useState)(!1),ah=(0,x.isTauri)()&&(0,x.isDesktop)(),ai=G.filter(a=>"online"===a.status),aj=ah?G:ai,ak=ai.length>0,al=new Set(ai.map(a=>a.daemon_id).filter(Boolean)).size;(0,e.useEffect)(()=>{D&&(0,y.listRuntimes)(D).then(H).catch(()=>{}).finally(()=>L(!1))},[D]),(0,e.useEffect)(()=>{let a=async a=>{let b=await (0,x.tauriInvoke)("register_cli",{token:a});if(!b.success)return void o.toast.error(b.message||"Auto-registration failed — please check CLI installation");ae(!0);let c=await (0,y.getMachineTokenStatus)();c.runtimes?.length&&(H(c.runtimes.map(a=>({id:a.id,workspace_id:"",daemon_id:c.hostname||null,runtime_mode:"local",provider:a.type,status:c.daemon_online?"online":"offline",device_info:c.hostname||"",metadata:{version:a.version},last_seen_at:null,created_at:"",updated_at:""}))),c.daemon_online&&ag(!0))};(0,y.getMachineTokenStatus)().then(async b=>{if(ah)if("registered"===b.status)ae(!0),b.daemon_online&&ag(!0),b.runtimes?.length&&H(b.runtimes.map(a=>({id:a.id,workspace_id:"",daemon_id:b.hostname||null,runtime_mode:"local",provider:a.type,status:a.status,device_info:b.hostname||"",metadata:{version:a.version},last_seen_at:null,created_at:"",updated_at:""})));else if("pending"===b.status&&b.token)try{await a(b.token)}catch{o.toast.error("Failed to auto-register CLI — please check that Claude or Codex is installed")}else try{let{token:b}=await (0,y.createMachineToken)("cli");await a(b)}catch{o.toast.error("Failed to auto-register CLI — please check that Claude or Codex is installed")}else if("registered"===b.status||"active"===b.status){if(C&&b.workspace_id)return;ae(!0),b.daemon_online&&ag(!0),b.runtimes?.length&&H(b.runtimes.map(a=>({id:a.id,workspace_id:"",daemon_id:b.hostname||null,runtime_mode:"local",provider:a.type,status:a.status,device_info:b.hostname||"",metadata:{version:a.version},last_seen_at:null,created_at:"",updated_at:""})))}}).catch(()=>{})},[]);let am=(0,e.useCallback)(a=>{if($.current)return;let b=F.current;if("machine.registered"===a.type)ae(!0),0===I.current.length&&(0,y.getMachineTokenStatus)().then(a=>{a.runtimes?.length&&H(a.runtimes.map(b=>({id:b.id,workspace_id:"",daemon_id:a.hostname||null,runtime_mode:"local",provider:b.type,status:a.daemon_online?"online":"offline",device_info:a.hostname||"",metadata:{version:b.version},last_seen_at:null,created_at:"",updated_at:""}))),a.daemon_online&&ag(!0)}).catch(()=>{}),J.current({type:"check_daemon_status"});else if("runtime.registered"===a.type){ae(!0);let c=a.workspaceId;!c||b||C?b&&(0,y.listRuntimes)(b).then(H).catch(()=>{}):(E(c),(0,y.listRuntimes)(c).then(H).catch(()=>{}))}else if("runtime.status"===a.type&&"online"===a.status){ag(!0);let a=F.current;0===I.current.length?a?(0,y.listRuntimes)(a).then(H).catch(()=>{}):(0,y.getMachineTokenStatus)().then(a=>{a.runtimes?.length&&H(a.runtimes.map(b=>({id:b.id,workspace_id:"",daemon_id:a.hostname||null,runtime_mode:"local",provider:b.type,status:"online",device_info:a.hostname||"",metadata:{version:b.version},last_seen_at:null,created_at:"",updated_at:""})))}).catch(()=>{}):a?(0,y.listRuntimes)(a).then(H).catch(()=>{}):H(a=>a.map(a=>({...a,status:"online"})))}else"runtime.status"===a.type&&"offline"===a.status&&(ag(!1),H(a=>a.map(a=>({...a,status:"offline"}))))},[C]),{send:an}=(0,z.useUserWs)(am);(0,e.useEffect)(()=>{J.current=an},[an]),(0,e.useEffect)(()=>{let a=aj[0]?.id;a&&X(b=>0!==b.length&&b.some(a=>!a.runtimeId)?b.map(b=>b.runtimeId?b:{...b,runtimeId:a}):b)},[aj]);let ao=(0,e.useCallback)(async a=>{try{let b=await fetch("/api/studios/check-handles",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({names:a})});if(!b.ok)return null;return await b.json()}catch{return null}},[]);(0,e.useEffect)(()=>{if(!A||K||W.length>0)return;let a=(0,w.shuffleMembers)(A.members.length),b=aj[0]?.id||"",c=A.members.map((c,d)=>({name:a[d].name,role:c.role,description:c.description,instructions:c.instructions,avatarUrl:a[d].avatarUrl,runtimeId:b,relationship:c.relationship}));X(c),ao(c.map(a=>a.name)).then(a=>{a&&X(b=>b.map(b=>{let c=a.find(a=>a.name===b.name);return c?{...b,emailHandle:c.handle}:b}))})},[A,K]);let ap=async a=>{N(a);let b=w.SCENARIO_PRESETS.find(b=>b.id===a),c=(0,w.shuffleMembers)(b.members.length),d=aj[0]?.id||"",e=b.members.map((a,b)=>({name:c[b].name,role:a.role,description:a.description,instructions:a.instructions,avatarUrl:c[b].avatarUrl,runtimeId:d,relationship:a.relationship}));X(e);let f=await ao(e.map(a=>a.name));f&&X(a=>a.map(a=>{let b=f.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},aq=async()=>{let a=(0,w.shuffleMembers)(W.length),b=W.map((b,c)=>({...b,name:a[c].name,avatarUrl:a[c].avatarUrl,emailHandle:void 0}));X(b);let c=await ao(b.map(a=>a.name));c&&X(a=>a.map(a=>{let b=c.find(b=>b.name===a.name);return b?{...a,emailHandle:b.handle}:a}))},ar=async()=>{if(O.trim()){V(!0),R(null);try{let a=D?`/api/studios/check-name?name=${encodeURIComponent(O.trim())}&workspace_id=${D}`:`/api/studios/check-name?name=${encodeURIComponent(O.trim())}`,b=await fetch(a);if(!b.ok){let a=await b.json().catch(()=>({}));o.toast.error(a.error||"Invalid company name"),R(!1);return}let c=await b.json();R(c.available),c.available&&T(!0)}catch{R(null),o.toast.error("Failed to check name availability")}finally{V(!1)}}},as=(0,e.useCallback)(async()=>{ac(!0);try{let a=await (0,y.createMachineToken)("cli",F.current||void 0);aa(a.token)}catch{o.toast.error("Failed to generate token")}finally{ac(!1)}},[]),at=async()=>{Z(!0),$.current=!0;try{let b=D;if(!b){let a=await fetch("/api/workspaces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:O.trim()||"Personal",slug:(O.trim()||"personal").toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")})});if(!a.ok){let b=await a.json().catch(()=>({}));throw Error(b.error||"Failed to create workspace")}b=(await a.json()).id,E(b);let c=await fetch("/api/machine-tokens/bind-workspace",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({workspace_id:b})});if(!c.ok){await fetch(`/api/workspaces/${b}`,{method:"DELETE"}).catch(()=>{}),E(null);let a=await c.json().catch(()=>({}));throw Error(a.error||"Failed to bind workspace")}}if(!b){o.toast.error("Please connect a computer first"),$.current=!1,Z(!1);return}let c=W;if(W.some(a=>!a.runtimeId||a.runtimeId.startsWith("temp_"))){let a=0,d=[];for(;a<10&&!(d=await (0,y.listRuntimes)(b)).some(a=>"online"===a.status);)await new Promise(a=>setTimeout(a,1e3)),a++;let e=d.filter(a=>"online"===a.status);if(e.length>0&&(c=W.map(a=>{if(!a.runtimeId||a.runtimeId.startsWith("temp_")){let b=G.find(b=>b.id===a.runtimeId)?.provider,c=e.find(a=>a.provider===b)||e[0];return{...a,runtimeId:c.id}}return a})),c.some(a=>!a.runtimeId||a.runtimeId.startsWith("temp_"))){o.toast.error("Waiting for runtime — please ensure the daemon is running"),$.current=!1,Z(!1);return}}let d=await fetch("/api/studios",{method:"POST",headers:{"Content-Type":"application/json","X-Workspace-ID":b},body:JSON.stringify({name:O.trim()||void 0,scenario:M,members:c.map(a=>({name:a.name,role:a.role,runtime_id:a.runtimeId,description:a.description,instructions:a.instructions,avatar_url:a.avatarUrl||null,email_handle:a.emailHandle||void 0,relationship:a.relationship||void 0}))})});if(!d.ok){let a=await d.json();throw Error(a.error||"Failed to create company")}let e=await d.json();a||(0,r.trackWorkspaceCreated)("onboarding"),(0,r.trackOnboardingCompleted)({template_used:M??void 0,agent_count:c.length});for(let a=0;a<c.length;a++)(0,r.trackAgentCreated)({is_first_agent:0===a,has_email:!!c[a].emailHandle});o.toast.success("Company created!"),B.push(`/w/${e.workspace.slug}/agents/${e.leader_agent_id}`)}catch(a){o.toast.error(a instanceof Error?a.message:"Failed to create company"),$.current=!1,Z(!1)}},au=C?O.trim()&&!0===Q:!1!==Q,av=M&&W.length>0&&(ah||C||W.every(a=>a.runtimeId))&&au&&(ak||ad&&af&&G.length>0||ah&&G.length>0);return M?(0,d.jsx)(s.PublicLayout,{leftSlot:(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>B.push("/workspaces"),children:[(0,d.jsx)(n.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),(0,d.jsx)("span",{className:"text-muted-foreground/40",children:"/"}),(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>N(null),children:[(0,d.jsx)(m.ArrowLeft,{className:"size-3 mr-1.5"}),"Back"]})]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,q.clearAllCache)(),(0,p.signOut)({fetchOptions:{onSuccess:()=>B.push("/sign-in")}})},children:[(0,d.jsx)(l.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),children:(0,d.jsxs)("div",{className:"mx-auto w-full max-w-3xl space-y-10 px-6 py-14",children:[(0,d.jsx)("div",{className:"text-center",children:(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"Build your company"})}),K?(0,d.jsx)("div",{className:"flex justify-center py-8",children:(0,d.jsx)(i.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("div",{className:"space-y-2",children:[(0,d.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Company name"}),(0,d.jsxs)("div",{className:"flex gap-2",children:[(0,d.jsx)(h.Input,{value:O,onChange:a=>{P(a.target.value),R(null)},placeholder:"e.g. Atlas Lab",className:"text-sm",disabled:S}),S?(0,d.jsx)(g.Button,{variant:"outline",size:"sm",onClick:()=>{T(!1),R(null)},className:"shrink-0",children:"Edit"}):(0,d.jsx)(g.Button,{variant:"outline",size:"sm",onClick:ar,disabled:!O.trim()||U,className:"shrink-0",children:U?(0,d.jsx)(i.Loader2,{className:"size-3 animate-spin"}):"Check"})]}),(0,d.jsxs)("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[(0,d.jsxs)("span",{className:"flex items-center gap-1.5",children:[!0===Q&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)("span",{className:"text-emerald-600 flex items-center gap-0.5",children:[(0,d.jsx)(j.CheckCircle2,{className:"size-3"})," Available"]}),(0,d.jsx)("span",{children:"·"})]}),C?(0,d.jsx)("span",{children:"Required — pick a name for your company."}):(0,d.jsx)("span",{children:"Optional — you can always rename later."})]}),!1===Q&&(0,d.jsxs)("span",{className:"text-red-500 flex items-center gap-1 ml-auto",children:[(0,d.jsx)(k.XCircle,{className:"size-3"})," Name is taken, try another"]})]})]}),(0,d.jsx)(v.TeamPreview,{members:W,runtimes:aj,onShuffle:aq,onAssignRuntime:(a,b)=>{X(c=>c.map((c,d)=>d===a?{...c,runtimeId:b}:c))}}),!ah&&(0,d.jsxs)("div",{className:"space-y-3",children:[(0,d.jsx)("h2",{className:"text-base font-semibold tracking-tight",children:"Connect a computer"}),ak||ad&&af&&G.length>0?(0,d.jsxs)("p",{className:"text-xs text-emerald-600 flex items-center gap-1",children:[(0,d.jsx)(j.CheckCircle2,{className:"size-3"})," ",al||1," computer",(al||1)>1?"s":""," connected"]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("p",{className:"text-xs text-muted-foreground",children:"Your company needs a connected computer to run tasks."}),(0,d.jsx)("div",{className:"rounded-xl bg-muted/40 p-5",children:(0,d.jsx)(t.ConnectMachineSteps,{generatedToken:_,generatingToken:ab,onGenerateToken:as,registered:ad,daemonOnline:af})})]})]}),(0,d.jsx)(g.Button,{onClick:at,disabled:!av||Y,className:"w-full",size:"lg",children:Y?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(i.Loader2,{className:"size-4 animate-spin mr-2"}),"Launching..."]}):C&&!1===Q?"Name unavailable":C&&!0!==Q?"Check company name first":"Launch company"})]})]})}):(0,d.jsx)(s.PublicLayout,{leftSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:()=>B.push("/workspaces"),children:[(0,d.jsx)(n.LayoutGrid,{className:"size-3 mr-1.5"}),"Workspaces"]}),rightSlot:(0,d.jsxs)(g.Button,{variant:"ghost",size:"sm",className:"text-xs text-muted-foreground",onClick:async()=>{await (0,q.clearAllCache)(),(0,p.signOut)({fetchOptions:{onSuccess:()=>B.push("/sign-in")}})},children:[(0,d.jsx)(l.LogOut,{className:"size-3 mr-1.5"}),"Sign out"]}),mainClassName:"flex items-center justify-center",children:(0,d.jsxs)("div",{className:"w-full max-w-3xl space-y-8 px-6 py-6",children:[(0,d.jsxs)("div",{className:"text-center space-y-2",children:[(0,d.jsx)("h1",{className:"text-2xl font-semibold tracking-tight",style:{fontFamily:"var(--font-news)"},children:"What will your company do?"}),(0,d.jsx)("p",{className:"text-sm text-muted-foreground",children:"Pick a focus area. You can always add more agents later."})]}),(0,d.jsx)(u.ScenarioPicker,{selected:M,onSelect:ap,onBrowseTemplates:()=>B.push(D?`/templates?workspace_id=${D}`:"/templates")}),D&&(0,d.jsx)("div",{className:"flex justify-center pt-2",children:(0,d.jsx)("button",{type:"button",onClick:()=>{document.cookie=`skip_init=${D};path=/;max-age=86400`,B.push(`/w/${b}/home`)},className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Skip for now"})})]})})}]),c()}catch(a){c(a)}},!1)];
63
63
 
64
64
  //# sourceMappingURL=_1n93_m_._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[881503,a=>{"use strict";var b=a.i(734803);let c=(0,a.i(75118).isLocalMode)(),d=Number(process.env.NEXT_PUBLIC_WS_DO_PORT)||8789,e=Number(process.env.NEXT_PUBLIC_WS_RECONNECT_DELAY_MS)||1e3,f=Number(process.env.NEXT_PUBLIC_WS_RECONNECT_MAX_DELAY_MS)||3e4;a.s(["useUserWs",0,function(a,g){let h=(0,b.useRef)(null),i=(0,b.useRef)(e),j=(0,b.useRef)(a),k=(0,b.useRef)(g?.onReconnect),l=(0,b.useRef)(null),m=(0,b.useRef)(!1),n=(0,b.useRef)(0),o=(0,b.useRef)(null),p=(0,b.useRef)(null);(0,b.useEffect)(()=>{j.current=a},[a]),(0,b.useEffect)(()=>{k.current=g?.onReconnect},[g?.onReconnect]);let q=(0,b.useRef)(null),r=(0,b.useCallback)(()=>{let a=Math.min(i.current,f);i.current=Math.min(2*a,f),l.current=setTimeout(()=>{q.current?.()},a+500*Math.random())},[]),s=(0,b.useCallback)(async()=>{let a,b,f,g=d;try{let c=await fetch("/api/ws/token");if(!c.ok){console.warn("[ws] token fetch failed:",c.status),r();return}let d=await c.json();a=d.userId,b=d.token,d.wsPort&&(g=d.wsPort)}catch(a){console.warn("[ws] token fetch error:",a),r();return}let l=c?`ws://localhost:${g}/?userId=${a}`:`${location.origin.replace("http","ws")}/api/ws/user?userId=${a}`;try{f=new WebSocket(l)}catch(a){console.warn("[ws] WebSocket creation failed:",a),r();return}h.current=f,f.onopen=()=>{i.current=e,f.send(JSON.stringify({type:"auth",token:b})),m.current&&k.current?.(),m.current=!0,n.current=Date.now(),o.current=setInterval(()=>{f.readyState===WebSocket.OPEN&&f.send("ping")},25e3),p.current=setInterval(()=>{Date.now()-n.current>3e4&&f.close()},5e3)},f.onmessage=a=>{n.current=Date.now();try{let b=JSON.parse(a.data);if("auth.ok"===b.type)return void f.send(JSON.stringify({type:"check_daemon_status"}));j.current(b)}catch{}},f.onerror=()=>{},f.onclose=()=>{f===h.current&&(o.current&&(clearInterval(o.current),o.current=null),p.current&&(clearInterval(p.current),p.current=null),r())}},[r]);(0,b.useEffect)(()=>{q.current=s},[s]),(0,b.useEffect)(()=>(s(),()=>{null!==l.current&&(clearTimeout(l.current),l.current=null),o.current&&(clearInterval(o.current),o.current=null),p.current&&(clearInterval(p.current),p.current=null);let a=h.current;h.current=null,a?.close()}),[s])}])},752792,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(588339),e=a.i(780956),f=a.i(881503);let g=(0,c.createContext)(null);a.s(["AgentProvider",0,function({workspaceId:a,children:h}){let[i,j]=(0,c.useState)([]),[k,l]=(0,c.useState)([]),[m,n]=(0,c.useState)(!0),[o,p]=(0,c.useState)({}),[q,r]=(0,c.useState)([]),s=(0,c.useRef)(!1),[t,u]=(0,c.useState)([]),[v,w]=(0,c.useState)(null),x=(0,c.useCallback)(()=>w(null),[]),[y,z]=(0,c.useState)(new Map),[A,B]=(0,c.useState)(new Map),C=(0,c.useRef)(!1),D=(0,c.useRef)(new Set),E=(0,c.useRef)(new Set),F=(0,c.useRef)(!0),G=(0,c.useRef)(!1),H=(0,c.useCallback)(a=>(D.current.add(a),()=>{D.current.delete(a)}),[]),I=(0,c.useCallback)(a=>(E.current.add(a),()=>{E.current.delete(a)}),[]),J=(0,c.useRef)(!1),K=(0,c.useCallback)(async()=>{if(!J.current){J.current=!0;try{if(s.current){let b=await (0,d.listWorkspaceActiveTasks)(a);if(!F.current)return;r(b.tasks);let c={};for(let a of b.tasks)c[a.agent_id]=(c[a.agent_id]??0)+1;p(c),s.current=b.tasks.length>0}else{let b=await (0,d.listAgentActiveTaskCounts)(a);if(!F.current)return;if(p(b.counts),Object.values(b.counts).some(a=>a>0)){s.current=!0;let b=await (0,d.listWorkspaceActiveTasks)(a);F.current&&r(b.tasks)}else r([])}}catch{}finally{J.current=!1}}},[a]);(0,c.useEffect)(()=>{F.current=!0,K();let a=setInterval(K,15e3);return()=>{F.current=!1,clearInterval(a)}},[K]);let L=(0,c.useCallback)(async()=>{try{let[b,c,e,f]=await Promise.all([(0,d.listAgents)(a),(0,d.listRuntimes)(a),(0,d.listAgentPins)(a),(0,d.listAgentLinks)(a)]);j(b),l(c),u(f),z(new Map(e.pins.map(a=>[a.agent_id,{created_at:a.created_at,position:a.position}]))),B(new Map(e.sidebar_order.map(a=>[a.agent_id,a.position])))}catch(a){e.toast.error(a instanceof Error?a.message:"Failed to load data")}finally{n(!1),C.current=!0}},[a]),M=(0,c.useCallback)(async()=>{if(!G.current){G.current=!0;try{let b=await (0,d.listRuntimes)(a);l(b)}catch{}finally{G.current=!1}}},[a]);(0,c.useEffect)(()=>{L()},[L]),(0,c.useEffect)(()=>{let a=null,b=setInterval(()=>{"visible"===document.visibilityState&&M()},3e4),c=()=>{"visible"===document.visibilityState&&(a=setTimeout(()=>M(),2e3*Math.random()))};return document.addEventListener("visibilitychange",c),()=>{clearInterval(b),a&&clearTimeout(a),document.removeEventListener("visibilitychange",c)}},[M]);let N=(0,c.useCallback)(b=>{for(let a of D.current)a(b);switch(b.type){case"runtime.registered":if(b.workspaceId!==a)break;L();break;case"runtime.deleted":L();break;case"runtime.status":if(b.workspaceId!==a)break;M();break;case"agent.created":if(b.workspaceId!==a)break;w({agentId:b.agentId,parentAgentId:b.parentAgentId}),L();break;case"task.updated":K()}},[L,M,K,a]),O=(0,c.useCallback)(()=>{for(let a of(M(),E.current))a()},[M]);(0,f.useUserWs)(N,{onReconnect:O});let P=(0,c.useCallback)(async b=>{try{let c=await (0,d.createAgent)(b,a);return await L(),c}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to create agent"),null}},[L,a]),Q=(0,c.useCallback)(async(b,c)=>{try{return await (0,d.updateAgent)(b,c,a),await L(),!0}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to update agent"),!1}},[L,a]),R=(0,c.useCallback)(async b=>{try{return await (0,d.deleteAgent)(b,a),await L(),!0}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to remove agent"),!1}},[L,a]),S=(0,c.useCallback)(async b=>{z(a=>{let c=Math.max(-1,...[...a.values()].map(a=>a.position));return new Map(a).set(b,{created_at:new Date().toISOString(),position:c+1})});try{await (0,d.pinAgent)(a,b)}catch{z(a=>{let c=new Map(a);return c.delete(b),c}),e.toast.error("Failed to pin agent")}},[a]),T=(0,c.useCallback)(async b=>{let c;z(a=>{c=a.get(b);let d=new Map(a);return d.delete(b),d});try{await (0,d.unpinAgent)(a,b)}catch{void 0!==c&&z(a=>new Map(a).set(b,c)),e.toast.error("Failed to unpin agent")}},[a]),U=(0,c.useCallback)(async b=>{let c=new Map(y);z(a=>{let c=new Map(a);return b.forEach((a,b)=>{let d=c.get(a);d&&c.set(a,{...d,position:b})}),c});try{await (0,d.reorderAgentPins)(a,b)}catch{z(c),e.toast.error("Failed to reorder pins")}},[a,y]),V=(0,c.useCallback)(async b=>{let c=new Map(A);B(new Map(b.map((a,b)=>[a,b])));try{await (0,d.reorderUnpinnedAgents)(a,b)}catch{B(c),e.toast.error("Failed to reorder agents")}},[a,A]),W=(0,c.useCallback)(()=>{let a=k.find(a=>"online"===a.status);return a?.id??""},[k]),X=(0,c.useCallback)(async()=>{try{return(await (0,d.createMachineToken)("cli",a)).token}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to generate token"),null}},[a]),Y=(0,c.useCallback)(async b=>{try{return await (0,d.deleteMachine)(b,a),await L(),!0}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to remove machine"),!1}},[L,a]);return(0,b.jsx)(g.Provider,{value:{workspaceId:a,agents:i,agentLinks:t,runtimes:k,loading:m,activeTaskCounts:o,activeTaskDetails:q,pendingNewAgent:v,clearPendingNewAgent:x,pins:y,reload:L,subscribeWs:H,subscribeReconnect:I,handleCreateAgent:P,handleUpdateAgent:Q,handleDeleteAgent:R,handlePinAgent:S,handleUnpinAgent:T,handleReorderPins:U,unpinnedOrder:A,handleReorderUnpinned:V,getFirstOnlineRuntimeId:W,handleGenerateToken:X,handleDeleteMachine:Y},children:h})},"useAgentContext",0,function(){let a=(0,c.useContext)(g);if(!a)throw Error("useAgentContext must be used within AgentProvider");return a},"useAgentContextSafe",0,function(){return(0,c.useContext)(g)}])},911509,a=>{"use strict";let b=`@${process.env.ALOOK_DOMAIN||"alook.ai"}`,c=/^[a-zA-Z0-9-]{3,}$/,d=new Set(["no-reply","noreply","admin","support","help","info","postmaster","abuse","security","mailer-daemon","root","webmaster","hostmaster","system","alook"]);a.s(["isValidHandle",0,function(a){return c.test(a)&&!d.has(a.toLowerCase())},"parseEmailHandle",0,function(a){return a.endsWith(b)?a.slice(0,-b.length):""},"toAlookAddress",0,function(a){return`${a}${b}`}])},893256,a=>{"use strict";let b=(0,a.i(410732).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);a.s(["default",0,b])},84096,a=>{"use strict";let b=(0,a.i(410732).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);a.s(["Loader2",0,b],84096)},7455,a=>{"use strict";var b=a.i(616612),c=a.i(651735),d=a.i(75118),e=a.i(732254),f=a.i(929328);function g({...a}){return(0,b.jsx)(c.Dialog.Portal,{"data-slot":"sheet-portal",...a})}function h({className:a,...e}){return(0,b.jsx)(c.Dialog.Backdrop,{"data-slot":"sheet-overlay",className:(0,d.cn)("fixed inset-0 z-50 bg-black/20 backdrop-blur-[2px] transition-[opacity,backdrop-filter] duration-200 ease-out data-ending-style:opacity-0 data-ending-style:backdrop-blur-none data-starting-style:opacity-0 data-starting-style:backdrop-blur-none",a),...e})}a.s(["Sheet",0,function({...a}){return(0,b.jsx)(c.Dialog.Root,{"data-slot":"sheet",...a})},"SheetBody",0,function({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-body",className:(0,d.cn)("flex-1 overflow-y-auto thin-scrollbar px-4 sm:px-6 py-5",a),...c})},"SheetClose",0,function({...a}){return(0,b.jsx)(c.Dialog.Close,{"data-slot":"sheet-close",...a})},"SheetContent",0,function({className:a,children:i,side:j="right",showCloseButton:k=!0,...l}){return(0,b.jsxs)(g,{children:[(0,b.jsx)(h,{forceRender:!0}),(0,b.jsxs)(c.Dialog.Popup,{"data-slot":"sheet-content","data-side":j,className:(0,d.cn)("fixed z-50 flex flex-col bg-background shadow-xl outline-none transition duration-300 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0","data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-full data-[side=right]:max-w-md data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-10 data-[side=right]:data-starting-style:translate-x-10","data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-full data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:-translate-x-10 data-[side=left]:data-starting-style:-translate-x-10","data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:-translate-y-10 data-[side=top]:data-starting-style:-translate-y-10","data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-10 data-[side=bottom]:data-starting-style:translate-y-10",a),...l,children:[i,k&&(0,b.jsxs)(c.Dialog.Close,{"data-slot":"sheet-close",render:(0,b.jsx)(e.Button,{variant:"ghost",className:"absolute top-3 right-3 z-10",size:"icon-sm"}),children:[(0,b.jsx)(f.XIcon,{}),(0,b.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"SheetDescription",0,function({className:a,...e}){return(0,b.jsx)(c.Dialog.Description,{"data-slot":"sheet-description",className:(0,d.cn)("text-sm text-muted-foreground",a),...e})},"SheetFooter",0,function({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-footer",className:(0,d.cn)("flex flex-col-reverse gap-2 border-t bg-muted/50 px-4 sm:px-6 py-4 sm:flex-row sm:justify-end",a),...c})},"SheetHeader",0,function({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-header",className:(0,d.cn)("flex flex-col gap-1 border-b px-4 sm:px-6 py-5",a),...c})},"SheetTitle",0,function({className:a,...e}){return(0,b.jsx)(c.Dialog.Title,{"data-slot":"sheet-title",className:(0,d.cn)("font-heading text-lg leading-tight font-semibold",a),...e})},"SheetTrigger",0,function({...a}){return(0,b.jsx)(c.Dialog.Trigger,{"data-slot":"sheet-trigger",...a})}])},27647,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(75118);let e=a=>{a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)},f=c.forwardRef(({className:a,onChange:f,...g},h)=>{let i=c.useRef(null),j=c.useCallback(a=>{i.current=a,"function"==typeof h?h(a):h&&(h.current=a),e(a)},[h]);return c.useEffect(()=>{e(i.current)},[g.value]),(0,b.jsx)("textarea",{ref:j,className:(0,d.cn)("resize-none overflow-hidden",a),onChange:a=>{e(a.target),f?.(a)},...g})});f.displayName="AutoResizeTextarea",a.s(["AutoResizeTextarea",0,f])}];
1
+ module.exports=[881503,a=>{"use strict";var b=a.i(734803);let c=(0,a.i(75118).isLocalMode)(),d=Number(process.env.NEXT_PUBLIC_WS_DO_PORT)||8789,e=Number(process.env.NEXT_PUBLIC_WS_RECONNECT_DELAY_MS)||1e3,f=Number(process.env.NEXT_PUBLIC_WS_RECONNECT_MAX_DELAY_MS)||3e4;a.s(["useUserWs",0,function(a,g){let h=(0,b.useRef)(null),i=(0,b.useRef)(e),j=(0,b.useRef)(a),k=(0,b.useRef)(g?.onReconnect),l=(0,b.useRef)(null),m=(0,b.useRef)(!1),n=(0,b.useRef)(0),o=(0,b.useRef)(null),p=(0,b.useRef)(null);(0,b.useEffect)(()=>{j.current=a},[a]),(0,b.useEffect)(()=>{k.current=g?.onReconnect},[g?.onReconnect]);let q=(0,b.useRef)(null),r=(0,b.useCallback)(()=>{let a=Math.min(i.current,f);i.current=Math.min(2*a,f),l.current=setTimeout(()=>{q.current?.()},a+500*Math.random())},[]),s=(0,b.useCallback)(async()=>{let a,b,f,g=d;try{let c=await fetch("/api/ws/token");if(!c.ok){console.warn("[ws] token fetch failed:",c.status),r();return}let d=await c.json();a=d.userId,b=d.token,d.wsPort&&(g=d.wsPort)}catch(a){console.warn("[ws] token fetch error:",a),r();return}let l=c?`ws://localhost:${g}/?userId=${a}`:`${location.origin.replace("http","ws")}/api/ws/user?userId=${a}`;try{f=new WebSocket(l)}catch(a){console.warn("[ws] WebSocket creation failed:",a),r();return}h.current=f,f.onopen=()=>{i.current=e,f.send(JSON.stringify({type:"auth",token:b})),m.current&&k.current?.(),m.current=!0,n.current=Date.now(),o.current=setInterval(()=>{f.readyState===WebSocket.OPEN&&f.send("ping")},25e3),p.current=setInterval(()=>{Date.now()-n.current>3e4&&f.close()},5e3)},f.onmessage=a=>{n.current=Date.now();try{let b=JSON.parse(a.data);if("auth.ok"===b.type)return void f.send(JSON.stringify({type:"check_daemon_status"}));j.current(b)}catch{}},f.onerror=()=>{},f.onclose=()=>{f===h.current&&(o.current&&(clearInterval(o.current),o.current=null),p.current&&(clearInterval(p.current),p.current=null),r())}},[r]);return(0,b.useEffect)(()=>{q.current=s},[s]),(0,b.useEffect)(()=>(s(),()=>{null!==l.current&&(clearTimeout(l.current),l.current=null),o.current&&(clearInterval(o.current),o.current=null),p.current&&(clearInterval(p.current),p.current=null);let a=h.current;h.current=null,a?.close()}),[s]),{send:(0,b.useCallback)(a=>{let b=h.current;b&&b.readyState===WebSocket.OPEN&&b.send(JSON.stringify(a))},[])}}])},752792,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(588339),e=a.i(780956),f=a.i(881503);let g=(0,c.createContext)(null);a.s(["AgentProvider",0,function({workspaceId:a,children:h}){let[i,j]=(0,c.useState)([]),[k,l]=(0,c.useState)([]),[m,n]=(0,c.useState)(!0),[o,p]=(0,c.useState)({}),[q,r]=(0,c.useState)([]),s=(0,c.useRef)(!1),[t,u]=(0,c.useState)([]),[v,w]=(0,c.useState)(null),x=(0,c.useCallback)(()=>w(null),[]),[y,z]=(0,c.useState)(new Map),[A,B]=(0,c.useState)(new Map),C=(0,c.useRef)(!1),D=(0,c.useRef)(new Set),E=(0,c.useRef)(new Set),F=(0,c.useRef)(!0),G=(0,c.useRef)(!1),H=(0,c.useCallback)(a=>(D.current.add(a),()=>{D.current.delete(a)}),[]),I=(0,c.useCallback)(a=>(E.current.add(a),()=>{E.current.delete(a)}),[]),J=(0,c.useRef)(!1),K=(0,c.useCallback)(async()=>{if(!J.current){J.current=!0;try{if(s.current){let b=await (0,d.listWorkspaceActiveTasks)(a);if(!F.current)return;r(b.tasks);let c={};for(let a of b.tasks)c[a.agent_id]=(c[a.agent_id]??0)+1;p(c),s.current=b.tasks.length>0}else{let b=await (0,d.listAgentActiveTaskCounts)(a);if(!F.current)return;if(p(b.counts),Object.values(b.counts).some(a=>a>0)){s.current=!0;let b=await (0,d.listWorkspaceActiveTasks)(a);F.current&&r(b.tasks)}else r([])}}catch{}finally{J.current=!1}}},[a]);(0,c.useEffect)(()=>{F.current=!0,K();let a=setInterval(K,15e3);return()=>{F.current=!1,clearInterval(a)}},[K]);let L=(0,c.useCallback)(async()=>{try{let[b,c,e,f]=await Promise.all([(0,d.listAgents)(a),(0,d.listRuntimes)(a),(0,d.listAgentPins)(a),(0,d.listAgentLinks)(a)]);j(b),l(c),u(f),z(new Map(e.pins.map(a=>[a.agent_id,{created_at:a.created_at,position:a.position}]))),B(new Map(e.sidebar_order.map(a=>[a.agent_id,a.position])))}catch(a){e.toast.error(a instanceof Error?a.message:"Failed to load data")}finally{n(!1),C.current=!0}},[a]),M=(0,c.useCallback)(async()=>{if(!G.current){G.current=!0;try{let b=await (0,d.listRuntimes)(a);l(b)}catch{}finally{G.current=!1}}},[a]);(0,c.useEffect)(()=>{L()},[L]),(0,c.useEffect)(()=>{let a=null,b=setInterval(()=>{"visible"===document.visibilityState&&M()},3e4),c=()=>{"visible"===document.visibilityState&&(a=setTimeout(()=>M(),2e3*Math.random()))};return document.addEventListener("visibilitychange",c),()=>{clearInterval(b),a&&clearTimeout(a),document.removeEventListener("visibilitychange",c)}},[M]);let N=(0,c.useCallback)(b=>{for(let a of D.current)a(b);switch(b.type){case"runtime.registered":if(b.workspaceId!==a)break;L();break;case"runtime.deleted":L();break;case"runtime.status":if(b.workspaceId!==a)break;M();break;case"agent.created":if(b.workspaceId!==a)break;w({agentId:b.agentId,parentAgentId:b.parentAgentId}),L();break;case"task.updated":K()}},[L,M,K,a]),O=(0,c.useCallback)(()=>{for(let a of(M(),E.current))a()},[M]);(0,f.useUserWs)(N,{onReconnect:O});let P=(0,c.useCallback)(async b=>{try{let c=await (0,d.createAgent)(b,a);return await L(),c}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to create agent"),null}},[L,a]),Q=(0,c.useCallback)(async(b,c)=>{try{return await (0,d.updateAgent)(b,c,a),await L(),!0}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to update agent"),!1}},[L,a]),R=(0,c.useCallback)(async b=>{try{return await (0,d.deleteAgent)(b,a),await L(),!0}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to remove agent"),!1}},[L,a]),S=(0,c.useCallback)(async b=>{z(a=>{let c=Math.max(-1,...[...a.values()].map(a=>a.position));return new Map(a).set(b,{created_at:new Date().toISOString(),position:c+1})});try{await (0,d.pinAgent)(a,b)}catch{z(a=>{let c=new Map(a);return c.delete(b),c}),e.toast.error("Failed to pin agent")}},[a]),T=(0,c.useCallback)(async b=>{let c;z(a=>{c=a.get(b);let d=new Map(a);return d.delete(b),d});try{await (0,d.unpinAgent)(a,b)}catch{void 0!==c&&z(a=>new Map(a).set(b,c)),e.toast.error("Failed to unpin agent")}},[a]),U=(0,c.useCallback)(async b=>{let c=new Map(y);z(a=>{let c=new Map(a);return b.forEach((a,b)=>{let d=c.get(a);d&&c.set(a,{...d,position:b})}),c});try{await (0,d.reorderAgentPins)(a,b)}catch{z(c),e.toast.error("Failed to reorder pins")}},[a,y]),V=(0,c.useCallback)(async b=>{let c=new Map(A);B(new Map(b.map((a,b)=>[a,b])));try{await (0,d.reorderUnpinnedAgents)(a,b)}catch{B(c),e.toast.error("Failed to reorder agents")}},[a,A]),W=(0,c.useCallback)(()=>{let a=k.find(a=>"online"===a.status);return a?.id??""},[k]),X=(0,c.useCallback)(async()=>{try{return(await (0,d.createMachineToken)("cli",a)).token}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to generate token"),null}},[a]),Y=(0,c.useCallback)(async b=>{try{return await (0,d.deleteMachine)(b,a),await L(),!0}catch(a){return e.toast.error(a instanceof Error?a.message:"Failed to remove machine"),!1}},[L,a]);return(0,b.jsx)(g.Provider,{value:{workspaceId:a,agents:i,agentLinks:t,runtimes:k,loading:m,activeTaskCounts:o,activeTaskDetails:q,pendingNewAgent:v,clearPendingNewAgent:x,pins:y,reload:L,subscribeWs:H,subscribeReconnect:I,handleCreateAgent:P,handleUpdateAgent:Q,handleDeleteAgent:R,handlePinAgent:S,handleUnpinAgent:T,handleReorderPins:U,unpinnedOrder:A,handleReorderUnpinned:V,getFirstOnlineRuntimeId:W,handleGenerateToken:X,handleDeleteMachine:Y},children:h})},"useAgentContext",0,function(){let a=(0,c.useContext)(g);if(!a)throw Error("useAgentContext must be used within AgentProvider");return a},"useAgentContextSafe",0,function(){return(0,c.useContext)(g)}])},911509,a=>{"use strict";let b=`@${process.env.ALOOK_DOMAIN||"alook.ai"}`,c=/^[a-zA-Z0-9-]{3,}$/,d=new Set(["no-reply","noreply","admin","support","help","info","postmaster","abuse","security","mailer-daemon","root","webmaster","hostmaster","system","alook"]);a.s(["isValidHandle",0,function(a){return c.test(a)&&!d.has(a.toLowerCase())},"parseEmailHandle",0,function(a){return a.endsWith(b)?a.slice(0,-b.length):""},"toAlookAddress",0,function(a){return`${a}${b}`}])},893256,a=>{"use strict";let b=(0,a.i(410732).default)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);a.s(["default",0,b])},84096,a=>{"use strict";let b=(0,a.i(410732).default)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);a.s(["Loader2",0,b],84096)},7455,a=>{"use strict";var b=a.i(616612),c=a.i(651735),d=a.i(75118),e=a.i(732254),f=a.i(929328);function g({...a}){return(0,b.jsx)(c.Dialog.Portal,{"data-slot":"sheet-portal",...a})}function h({className:a,...e}){return(0,b.jsx)(c.Dialog.Backdrop,{"data-slot":"sheet-overlay",className:(0,d.cn)("fixed inset-0 z-50 bg-black/20 backdrop-blur-[2px] transition-[opacity,backdrop-filter] duration-200 ease-out data-ending-style:opacity-0 data-ending-style:backdrop-blur-none data-starting-style:opacity-0 data-starting-style:backdrop-blur-none",a),...e})}a.s(["Sheet",0,function({...a}){return(0,b.jsx)(c.Dialog.Root,{"data-slot":"sheet",...a})},"SheetBody",0,function({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-body",className:(0,d.cn)("flex-1 overflow-y-auto thin-scrollbar px-4 sm:px-6 py-5",a),...c})},"SheetClose",0,function({...a}){return(0,b.jsx)(c.Dialog.Close,{"data-slot":"sheet-close",...a})},"SheetContent",0,function({className:a,children:i,side:j="right",showCloseButton:k=!0,...l}){return(0,b.jsxs)(g,{children:[(0,b.jsx)(h,{forceRender:!0}),(0,b.jsxs)(c.Dialog.Popup,{"data-slot":"sheet-content","data-side":j,className:(0,d.cn)("fixed z-50 flex flex-col bg-background shadow-xl outline-none transition duration-300 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0","data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-full data-[side=right]:max-w-md data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-10 data-[side=right]:data-starting-style:translate-x-10","data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-full data-[side=left]:max-w-md data-[side=left]:border-r data-[side=left]:data-ending-style:-translate-x-10 data-[side=left]:data-starting-style:-translate-x-10","data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:-translate-y-10 data-[side=top]:data-starting-style:-translate-y-10","data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-10 data-[side=bottom]:data-starting-style:translate-y-10",a),...l,children:[i,k&&(0,b.jsxs)(c.Dialog.Close,{"data-slot":"sheet-close",render:(0,b.jsx)(e.Button,{variant:"ghost",className:"absolute top-3 right-3 z-10",size:"icon-sm"}),children:[(0,b.jsx)(f.XIcon,{}),(0,b.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})},"SheetDescription",0,function({className:a,...e}){return(0,b.jsx)(c.Dialog.Description,{"data-slot":"sheet-description",className:(0,d.cn)("text-sm text-muted-foreground",a),...e})},"SheetFooter",0,function({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-footer",className:(0,d.cn)("flex flex-col-reverse gap-2 border-t bg-muted/50 px-4 sm:px-6 py-4 sm:flex-row sm:justify-end",a),...c})},"SheetHeader",0,function({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"sheet-header",className:(0,d.cn)("flex flex-col gap-1 border-b px-4 sm:px-6 py-5",a),...c})},"SheetTitle",0,function({className:a,...e}){return(0,b.jsx)(c.Dialog.Title,{"data-slot":"sheet-title",className:(0,d.cn)("font-heading text-lg leading-tight font-semibold",a),...e})},"SheetTrigger",0,function({...a}){return(0,b.jsx)(c.Dialog.Trigger,{"data-slot":"sheet-trigger",...a})}])},27647,a=>{"use strict";var b=a.i(616612),c=a.i(734803),d=a.i(75118);let e=a=>{a&&(a.style.height="auto",a.style.height=`${a.scrollHeight}px`)},f=c.forwardRef(({className:a,onChange:f,...g},h)=>{let i=c.useRef(null),j=c.useCallback(a=>{i.current=a,"function"==typeof h?h(a):h&&(h.current=a),e(a)},[h]);return c.useEffect(()=>{e(i.current)},[g.value]),(0,b.jsx)("textarea",{ref:j,className:(0,d.cn)("resize-none overflow-hidden",a),onChange:a=>{e(a.target),f?.(a)},...g})});f.displayName="AutoResizeTextarea",a.s(["AutoResizeTextarea",0,f])}];
2
2
 
3
3
  //# sourceMappingURL=_1wqw0ro._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[542168,a=>{"use strict";a.i(846208);var b=a.i(892409),c=a.i(346125),d=a.i(963481),e=a.i(274960),f=a.i(397016),g=a.i(679289),h=a.i(549196),i=a.i(88948),j=a.i(17177),k=a.i(6018),l=a.i(700555),m=a.i(178957),n=a.i(364625),o=a.i(147861),p=a.i(61337),q=a.i(732231),r=a.i(309425),s=a.i(379351),t=a.i(307659),u=a.i(527029),v=a.i(935186),w=a.i(27502),x=a.i(781590),y=a.i(120717),z=a.i(924946),A=a.i(986306),B=a.i(130496),C=a.i(922382),D=a.i(975036),E=a.i(328039),F=a.i(855312),G=a.i(79908);a.s(["agent",0,e,"agentAccess",0,t,"agentLink",0,C,"agentPin",0,u,"agentSidebarOrder",0,v,"agentSkill",0,A,"artifact",0,q,"calendarEvent",0,p,"channel",0,y,"conversation",0,g,"conversationMap",0,B,"email",0,n,"emailAccount",0,r,"inbox",0,D,"issue",0,E,"issueComment",0,F,"machine",0,k,"machineToken",0,l,"meetingSession",0,x,"member",0,d,"message",0,h,"messageFlag",0,G,"overview",0,w,"runtime",0,f,"session",0,o,"task",0,i,"taskMessage",0,j,"user",0,b,"whitelist",0,m,"workspace",0,c,"workspaceFileRequest",0,z,"workspaceInvite",0,s],395780);var H=a.i(395780);a.s(["queries",0,H],542168)},696826,a=>{"use strict";a.i(250195);var b=a.i(544979);a.s(["getDb",0,function(a){let c=a.withSession("first-unconstrained");return(0,b.createDb)(c)}])},885135,a=>{"use strict";a.s(["WorkspaceProvider",()=>c,"useWorkspace",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceProvider() from the server but WorkspaceProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx <module evaluation>","WorkspaceProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useWorkspace() from the server but useWorkspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx <module evaluation>","useWorkspace")},27504,a=>{"use strict";a.s(["WorkspaceProvider",()=>c,"useWorkspace",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceProvider() from the server but WorkspaceProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx","WorkspaceProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useWorkspace() from the server but useWorkspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx","useWorkspace")},452149,a=>{"use strict";a.i(885135);var b=a.i(27504);a.n(b)},584236,a=>{"use strict";a.s(["AgentProvider",()=>c,"useAgentContext",()=>d,"useAgentContextSafe",()=>e]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call AgentProvider() from the server but AgentProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx <module evaluation>","AgentProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContext() from the server but useAgentContext is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx <module evaluation>","useAgentContext"),e=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContextSafe() from the server but useAgentContextSafe is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx <module evaluation>","useAgentContextSafe")},861849,a=>{"use strict";a.s(["AgentProvider",()=>c,"useAgentContext",()=>d,"useAgentContextSafe",()=>e]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call AgentProvider() from the server but AgentProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx","AgentProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContext() from the server but useAgentContext is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx","useAgentContext"),e=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContextSafe() from the server but useAgentContextSafe is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx","useAgentContextSafe")},498915,a=>{"use strict";a.i(584236);var b=a.i(861849);a.n(b)},991013,a=>{"use strict";a.s(["ChannelProvider",()=>c,"useChannel",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ChannelProvider() from the server but ChannelProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx <module evaluation>","ChannelProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useChannel() from the server but useChannel is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx <module evaluation>","useChannel")},906430,a=>{"use strict";a.s(["ChannelProvider",()=>c,"useChannel",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ChannelProvider() from the server but ChannelProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx","ChannelProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useChannel() from the server but useChannel is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx","useChannel")},150409,a=>{"use strict";a.i(991013);var b=a.i(906430);a.n(b)},632146,a=>{"use strict";a.s(["InboxCountProvider",()=>c,"useInboxCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call InboxCountProvider() from the server but InboxCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx <module evaluation>","InboxCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useInboxCount() from the server but useInboxCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx <module evaluation>","useInboxCount")},269150,a=>{"use strict";a.s(["InboxCountProvider",()=>c,"useInboxCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call InboxCountProvider() from the server but InboxCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx","InboxCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useInboxCount() from the server but useInboxCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx","useInboxCount")},143131,a=>{"use strict";a.i(632146);var b=a.i(269150);a.n(b)},778759,a=>{"use strict";a.s(["FlagCountProvider",()=>c,"useFlagCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call FlagCountProvider() from the server but FlagCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx <module evaluation>","FlagCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useFlagCount() from the server but useFlagCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx <module evaluation>","useFlagCount")},292542,a=>{"use strict";a.s(["FlagCountProvider",()=>c,"useFlagCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call FlagCountProvider() from the server but FlagCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx","FlagCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useFlagCount() from the server but useFlagCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx","useFlagCount")},97859,a=>{"use strict";a.i(778759);var b=a.i(292542);a.n(b)},578647,a=>{"use strict";a.s(["WorkspaceShell",()=>c,"useSidebarTrigger",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceShell() from the server but WorkspaceShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx <module evaluation>","WorkspaceShell"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useSidebarTrigger() from the server but useSidebarTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx <module evaluation>","useSidebarTrigger")},383843,a=>{"use strict";a.s(["WorkspaceShell",()=>c,"useSidebarTrigger",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceShell() from the server but WorkspaceShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx","WorkspaceShell"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useSidebarTrigger() from the server but useSidebarTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx","useSidebarTrigger")},877617,a=>{"use strict";a.i(578647);var b=a.i(383843);a.n(b)},678399,a=>a.a(async(b,c)=>{try{var d=a.i(722148),e=a.i(811953);a.i(52707);var f=a.i(594497),g=a.i(301786);a.i(250195);var h=a.i(542168),i=a.i(696826),j=a.i(678327),k=a.i(452149),l=a.i(498915),m=a.i(150409),n=a.i(143131),o=a.i(97859),p=a.i(877617),q=b([j]);async function r({children:a,params:b}){let c=await (0,j.getSession)();c||(0,f.redirect)("/sign-in");let{slug:q}=await b,{env:s}=await (0,g.getCloudflareContext)({async:!0}),t=(0,i.getDb)(s.DB),u=await h.queries.workspace.getWorkspaceBySlug(t,q);u||(0,f.redirect)("/workspaces"),await h.queries.member.getMemberByUserAndWorkspace(t,c.user.id,u.id)||(0,f.redirect)("/workspaces");let v=await h.queries.agent.listAgents(t,u.id,c.user.id);if(0===v.length){let a=(await (0,e.headers)()).get("cookie")||"",b=Object.fromEntries(a.split(";").map(a=>{let[b,...c]=a.trim().split("=");return[b,c.join("=")]}));b.skip_init&&b.skip_init===u.id||(0,f.redirect)(`/studio/new?workspace_id=${u.id}`)}return(0,d.jsx)(k.WorkspaceProvider,{workspaceId:u.id,slug:q,children:(0,d.jsx)(l.AgentProvider,{workspaceId:u.id,children:(0,d.jsx)(n.InboxCountProvider,{children:(0,d.jsx)(o.FlagCountProvider,{children:(0,d.jsx)(m.ChannelProvider,{workspaceId:u.id,children:(0,d.jsx)(p.WorkspaceShell,{children:a})})})})})})}[j]=q.then?(await q)():q,a.s(["default",0,r]),c()}catch(a){c(a)}},!1),234278,a=>{a.n(a.i(678399))}];
1
+ module.exports=[542168,a=>{"use strict";a.i(846208);var b=a.i(892409),c=a.i(346125),d=a.i(963481),e=a.i(274960),f=a.i(397016),g=a.i(679289),h=a.i(549196),i=a.i(88948),j=a.i(17177),k=a.i(6018),l=a.i(700555),m=a.i(178957),n=a.i(364625),o=a.i(147861),p=a.i(61337),q=a.i(732231),r=a.i(309425),s=a.i(379351),t=a.i(307659),u=a.i(527029),v=a.i(935186),w=a.i(27502),x=a.i(781590),y=a.i(120717),z=a.i(924946),A=a.i(986306),B=a.i(130496),C=a.i(922382),D=a.i(975036),E=a.i(328039),F=a.i(855312),G=a.i(79908);a.s(["agent",0,e,"agentAccess",0,t,"agentLink",0,C,"agentPin",0,u,"agentSidebarOrder",0,v,"agentSkill",0,A,"artifact",0,q,"calendarEvent",0,p,"channel",0,y,"conversation",0,g,"conversationMap",0,B,"email",0,n,"emailAccount",0,r,"inbox",0,D,"issue",0,E,"issueComment",0,F,"machine",0,k,"machineToken",0,l,"meetingSession",0,x,"member",0,d,"message",0,h,"messageFlag",0,G,"overview",0,w,"runtime",0,f,"session",0,o,"task",0,i,"taskMessage",0,j,"user",0,b,"whitelist",0,m,"workspace",0,c,"workspaceFileRequest",0,z,"workspaceInvite",0,s],395780);var H=a.i(395780);a.s(["queries",0,H],542168)},696826,a=>{"use strict";a.i(250195);var b=a.i(544979);a.s(["getDb",0,function(a){let c=a.withSession("first-unconstrained");return(0,b.createDb)(c)}])},885135,a=>{"use strict";a.s(["WorkspaceProvider",()=>c,"useWorkspace",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceProvider() from the server but WorkspaceProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx <module evaluation>","WorkspaceProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useWorkspace() from the server but useWorkspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx <module evaluation>","useWorkspace")},27504,a=>{"use strict";a.s(["WorkspaceProvider",()=>c,"useWorkspace",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceProvider() from the server but WorkspaceProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx","WorkspaceProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useWorkspace() from the server but useWorkspace is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/workspace-context.tsx","useWorkspace")},452149,a=>{"use strict";a.i(885135);var b=a.i(27504);a.n(b)},584236,a=>{"use strict";a.s(["AgentProvider",()=>c,"useAgentContext",()=>d,"useAgentContextSafe",()=>e]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call AgentProvider() from the server but AgentProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx <module evaluation>","AgentProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContext() from the server but useAgentContext is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx <module evaluation>","useAgentContext"),e=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContextSafe() from the server but useAgentContextSafe is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx <module evaluation>","useAgentContextSafe")},861849,a=>{"use strict";a.s(["AgentProvider",()=>c,"useAgentContext",()=>d,"useAgentContextSafe",()=>e]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call AgentProvider() from the server but AgentProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx","AgentProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContext() from the server but useAgentContext is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx","useAgentContext"),e=(0,b.registerClientReference)(function(){throw Error("Attempted to call useAgentContextSafe() from the server but useAgentContextSafe is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/agent-context.tsx","useAgentContextSafe")},498915,a=>{"use strict";a.i(584236);var b=a.i(861849);a.n(b)},991013,a=>{"use strict";a.s(["ChannelProvider",()=>c,"useChannel",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ChannelProvider() from the server but ChannelProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx <module evaluation>","ChannelProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useChannel() from the server but useChannel is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx <module evaluation>","useChannel")},906430,a=>{"use strict";a.s(["ChannelProvider",()=>c,"useChannel",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ChannelProvider() from the server but ChannelProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx","ChannelProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useChannel() from the server but useChannel is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/channel-context.tsx","useChannel")},150409,a=>{"use strict";a.i(991013);var b=a.i(906430);a.n(b)},632146,a=>{"use strict";a.s(["InboxCountProvider",()=>c,"useInboxCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call InboxCountProvider() from the server but InboxCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx <module evaluation>","InboxCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useInboxCount() from the server but useInboxCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx <module evaluation>","useInboxCount")},269150,a=>{"use strict";a.s(["InboxCountProvider",()=>c,"useInboxCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call InboxCountProvider() from the server but InboxCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx","InboxCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useInboxCount() from the server but useInboxCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/inbox-count-context.tsx","useInboxCount")},143131,a=>{"use strict";a.i(632146);var b=a.i(269150);a.n(b)},778759,a=>{"use strict";a.s(["FlagCountProvider",()=>c,"useFlagCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call FlagCountProvider() from the server but FlagCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx <module evaluation>","FlagCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useFlagCount() from the server but useFlagCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx <module evaluation>","useFlagCount")},292542,a=>{"use strict";a.s(["FlagCountProvider",()=>c,"useFlagCount",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call FlagCountProvider() from the server but FlagCountProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx","FlagCountProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useFlagCount() from the server but useFlagCount is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/contexts/flag-count-context.tsx","useFlagCount")},97859,a=>{"use strict";a.i(778759);var b=a.i(292542);a.n(b)},578647,a=>{"use strict";a.s(["WorkspaceShell",()=>c,"useSidebarTrigger",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceShell() from the server but WorkspaceShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx <module evaluation>","WorkspaceShell"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useSidebarTrigger() from the server but useSidebarTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx <module evaluation>","useSidebarTrigger")},383843,a=>{"use strict";a.s(["WorkspaceShell",()=>c,"useSidebarTrigger",()=>d]);var b=a.i(957557);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call WorkspaceShell() from the server but WorkspaceShell is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx","WorkspaceShell"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useSidebarTrigger() from the server but useSidebarTrigger is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/web/src/components/workspace-shell.tsx","useSidebarTrigger")},877617,a=>{"use strict";a.i(578647);var b=a.i(383843);a.n(b)},678399,a=>a.a(async(b,c)=>{try{var d=a.i(722148),e=a.i(811953);a.i(52707);var f=a.i(594497),g=a.i(301786);a.i(250195);var h=a.i(542168),i=a.i(696826),j=a.i(678327),k=a.i(452149),l=a.i(498915),m=a.i(150409),n=a.i(143131),o=a.i(97859),p=a.i(877617),q=b([j]);async function r({children:a,params:b}){let c=await (0,j.getSession)();c||(0,f.redirect)("/sign-in");let{slug:q}=await b,{env:s}=await (0,g.getCloudflareContext)({async:!0}),t=(0,i.getDb)(s.DB),u=await h.queries.workspace.getWorkspaceBySlug(t,q);u||(0,f.redirect)("/workspaces"),await h.queries.member.getMemberByUserAndWorkspace(t,c.user.id,u.id)||(0,f.redirect)("/workspaces");let v=await h.queries.agent.listAgents(t,u.id);if(0===v.length){let a=(await (0,e.headers)()).get("cookie")||"",b=Object.fromEntries(a.split(";").map(a=>{let[b,...c]=a.trim().split("=");return[b,c.join("=")]}));b.skip_init&&b.skip_init===u.id||(0,f.redirect)(`/studio/new?workspace_id=${u.id}`)}return(0,d.jsx)(k.WorkspaceProvider,{workspaceId:u.id,slug:q,children:(0,d.jsx)(l.AgentProvider,{workspaceId:u.id,children:(0,d.jsx)(n.InboxCountProvider,{children:(0,d.jsx)(o.FlagCountProvider,{children:(0,d.jsx)(m.ChannelProvider,{workspaceId:u.id,children:(0,d.jsx)(p.WorkspaceShell,{children:a})})})})})})}[j]=q.then?(await q)():q,a.s(["default",0,r]),c()}catch(a){c(a)}},!1),234278,a=>{a.n(a.i(678399))}];
2
2
 
3
3
  //# sourceMappingURL=src_0-s5b_y._.js.map
@@ -7,9 +7,9 @@ globalThis.__BUILD_MANIFEST = {
7
7
  "static/chunks/0cz1d0mv5g_q7.js"
8
8
  ],
9
9
  "lowPriorityFiles": [
10
- "static/ulJviq2YWkZQXIBN6Wysn/_buildManifest.js",
11
- "static/ulJviq2YWkZQXIBN6Wysn/_ssgManifest.js",
12
- "static/ulJviq2YWkZQXIBN6Wysn/_clientMiddlewareManifest.js"
10
+ "static/LwRrk9IiQO-kR73n2jKLg/_buildManifest.js",
11
+ "static/LwRrk9IiQO-kR73n2jKLg/_ssgManifest.js",
12
+ "static/LwRrk9IiQO-kR73n2jKLg/_clientMiddlewareManifest.js"
13
13
  ],
14
14
  "rootMainFiles": [
15
15
  "static/chunks/3drpmcjhmx9ln.js",
@@ -25,11 +25,11 @@
25
25
  "wasm": [],
26
26
  "assets": [],
27
27
  "env": {
28
- "__NEXT_BUILD_ID": "ulJviq2YWkZQXIBN6Wysn",
29
- "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "tw9CTA/nxS023Ypfyt5GPxGJU3H7OZOk4odmurrqW6w=",
30
- "__NEXT_PREVIEW_MODE_ID": "03b5bbd7d69e99906ea2842b0c7e1262",
31
- "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "7b4155e6f8ce82d3b73898ba5dc49669e789f4a86863a4a3efa5ea02d4fa40c1",
32
- "__NEXT_PREVIEW_MODE_SIGNING_KEY": "c7ab5f6cf1a45af787b978c5499b85fb45061fb1d868ed8d8d8b0551eee05665"
28
+ "__NEXT_BUILD_ID": "LwRrk9IiQO-kR73n2jKLg",
29
+ "NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "wkDbSoaayELkO4Jmt3027sJdj8lBmeYbqhoxBZcAam8=",
30
+ "__NEXT_PREVIEW_MODE_ID": "f483357099be0d2b3c2c1f100e89fca2",
31
+ "__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "c7bb272225da96c22017d428489988fa3e31a59effbd281d9d60a046129d9251",
32
+ "__NEXT_PREVIEW_MODE_SIGNING_KEY": "eb14840c23e38e74170500a3405cdd63ff2a1363955f642b3f714f8b06488e1a"
33
33
  }
34
34
  }
35
35
  },
@@ -1 +1 @@
1
- self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"tw9CTA/nxS023Ypfyt5GPxGJU3H7OZOk4odmurrqW6w=\"\n}"
1
+ self.__RSC_SERVER_MANIFEST="{\n \"node\": {},\n \"edge\": {},\n \"encryptionKey\": \"wkDbSoaayELkO4Jmt3027sJdj8lBmeYbqhoxBZcAam8=\"\n}"
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "node": {},
3
3
  "edge": {},
4
- "encryptionKey": "tw9CTA/nxS023Ypfyt5GPxGJU3H7OZOk4odmurrqW6w="
4
+ "encryptionKey": "wkDbSoaayELkO4Jmt3027sJdj8lBmeYbqhoxBZcAam8="
5
5
  }