@alook/app 0.0.117 → 0.0.119
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundled/email-worker/index.js +219 -207
- package/bundled/web/.open-next/.build/durable-objects/queue.js +5 -5
- package/bundled/web/.open-next/assets/BUILD_ID +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{0quc_lvg3c4wu.js → 0-xdwhncj5-wf.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/018pin4~.wsr7.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/028fjo.mmn73u.js +7 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{0tw05tsn2c~1m.js → 02j9o2uuj_oc8.js} +15 -15
- package/bundled/web/.open-next/assets/_next/static/chunks/06-zhqf9ypqns.css +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0d3l0nm-qcu53.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0fw7efx7cy195.js +62 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0kk1judky0sd5.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{12bd-kqbplx9m.js → 0nj24~vvlulgh.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/0r8zw56k96o0q.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{042a4jeudcp22.js → 0u64son5-k77n.js} +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/{110sy1mmp9v~7.js → 0x14heey9lt7d.js} +3 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/0xaxg3kh619o8.js +1 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0z4n3xpn4dp13.js +63 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/0~r1l8ej-9p~h.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/110epmmtnkv9w.js +3 -0
- package/bundled/web/.open-next/assets/_next/static/chunks/{118ani.qejoy9.js → 12tz.n~x91ghm.js} +1 -1
- package/bundled/web/.open-next/cache/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/_global-error.cache +1 -1
- package/bundled/web/.open-next/cache/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/_not-found.cache +1 -1
- package/bundled/web/.open-next/cache/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/device.cache +1 -1
- package/bundled/web/.open-next/cache/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/privacy.cache +1 -1
- package/bundled/web/.open-next/cache/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/sitemap.xml.cache +1 -1
- package/bundled/web/.open-next/cloudflare/cache-assets-manifest.sql +1 -1
- package/bundled/web/.open-next/cloudflare/init.js +1 -1
- package/bundled/web/.open-next/dynamodb-provider/dynamodb-cache.json +1 -1
- package/bundled/web/.open-next/middleware/handler.mjs +8 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/BUILD_ID +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/app-path-routes-manifest.json +1 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/build-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/prerender-manifest.json +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/routes-manifest.json +8 -17
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/invite/[token]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/studio/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/activity/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/[convId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/chat/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/email/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/files/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/meetings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/new/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/agents/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/calendar/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/flags/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/help/email-setup/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/home/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/issues/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/runtimes/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/settings/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/[traceId]/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/[traceId]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/threads/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page/react-loadable-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/w/[slug]/unread/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(app)/workspaces/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/(auth)/sign-in/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/[id]/chat-init/route.js +6 -7
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/[id]/whitelist/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/agents/route.js +4 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/active-task/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/init/route.js +6 -7
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/messages/route.js +8 -9
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/{conversations/[id]/buffered-messages/[messageId] → daemon/conversations/[id]/messages}/route.js +8 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/conversations/[id]/messages/route_client-reference-manifest.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/register/route.js +3 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/sweep/route.js +5 -7
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/complete/route.js +6 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/fail/route.js +6 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/messages/route.js +3 -4
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/start/route.js +6 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/[taskId]/supersede/route.js +6 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/daemon/tasks/poll/route.js +5 -7
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/email/notify/route.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/issues/[id]/comments/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/issues/[id]/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/issues/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/studios/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/tasks/[id]/retry/route.js +7 -8
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/device/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page/react-loadable-manifest.json +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/privacy/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/[id]/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/templates/page_client-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app-paths-manifest.json +1 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/05hd_server_app_api_daemon_conversations_[id]_messages_route_actions_0.iz1u1.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0-63.yt._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__010~hln._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__01pm5bg._.js +58 -70
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__08oq0ro._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0arm85_._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0gp~w40._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{[root-of-the-server]__088o0os._.js → [root-of-the-server]__0hz_j32._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0i0ukpl._.js +58 -70
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0j5fdu2._.js +58 -70
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0syz.lm._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/{[root-of-the-server]__0sf_9ve._.js → [root-of-the-server]__0vi97bn._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0x8e1~2._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[turbopack]_runtime.js +39 -44
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0.gkbx8._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_00-p7_0._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_03gwxos._.js +5 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_03t_17c._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_06mrt6t._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_08xh_f8._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_09ivzvb._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0_21cs4._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0huk3rm._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0jj44iu._.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0l1m9wf._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0m4uqwa._.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0mibx4k._.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0ow_nxn._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0r.02hx._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0thudj4._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0wbaduy._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0yzq1gx._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0zyolvu._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_12-_-5g._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_12-v7sn._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/src_0wkbw.-._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__04mf.th._.js +54 -66
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{[root-of-the-server]__10nperb._.js → [root-of-the-server]__0_3cckh._.js} +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0e65njz._.js +54 -66
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[root-of-the-server]__0i8fzgr._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/[turbopack]_runtime.js +39 -44
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0bt_5pi._.js → _055~~zq._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0bti.y.._.js → _05kh57s._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{_0iiagkx._.js → _09rh54w._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0_.06ux._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0asq_j3._.js +65 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0im0q-g._.js +9 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0owr40y._.js +3 -0
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0r_ppn9._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0vtcof8._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_04xzk.p._.js → node_modules__pnpm_0-7t060._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0y6wy4c._.js → node_modules__pnpm_0emry~3._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_02vp72~._.js → node_modules__pnpm_0lqu_u4._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0k_ahqs._.js → node_modules__pnpm_0ml9n-.._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0t783t_._.js → node_modules__pnpm_0qmml4f._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0j~49hk._.js → node_modules__pnpm_0vztztj._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0.jtjpe._.js → node_modules__pnpm_0wu1nx-._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/{node_modules__pnpm_0i183cf._.js → node_modules__pnpm_11id~ub._.js} +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_0liq_10._.js +54 -66
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_0~23g-y._.js +2 -2
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_app_(app)_w_[slug]_agents_[id]_meetings_page_tsx_073~u~-._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_components_home_home-page_tsx_0to84tv._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/src_web_src_lib_api_ts_0uf2r1p._.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-build-manifest.js +3 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/middleware-manifest.json +5 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.js +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/server-reference-manifest.json +1 -1
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs +492 -534
- package/bundled/web/.open-next/server-functions/default/src/web/handler.mjs.meta.json +1025 -841
- package/bundled/web/.open-next/server-functions/default/src/web/index.mjs +5 -5
- package/bundled/web/migrations/0037_inbox_unread_table.sql +43 -0
- package/bundled/web/wrangler.toml +1 -1
- package/bundled/ws-do/index.js +174 -174
- package/dist/cli/index.js +368 -68
- package/dist/cli/session-runner.js +68 -9
- package/dist/index.js +23 -2
- package/package.json +1 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0_7t-ouonb08v.js +0 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/0fme52sqdtk.p.js +0 -3
- package/bundled/web/.open-next/assets/_next/static/chunks/0h5tl-yh9wijv.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0j5gd-ljh6ao_.js +0 -62
- package/bundled/web/.open-next/assets/_next/static/chunks/0lus0pm79r-7o.js +0 -7
- package/bundled/web/.open-next/assets/_next/static/chunks/0m-e05qz5c6a..js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0s-pai_2464mg.css +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/0u8cu1dfn9~01.js +0 -63
- package/bundled/web/.open-next/assets/_next/static/chunks/0xg02n4bo4.1m.js +0 -1
- package/bundled/web/.open-next/assets/_next/static/chunks/18b_fy7re_rp..js +0 -1
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/buffered-messages/[messageId]/route_client-reference-manifest.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/buffered-messages/route.js +0 -17
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/app/api/conversations/[id]/buffered-messages/route_client-reference-manifest.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/00~o_app_api_conversations_[id]_buffered-messages_[messageId]_route_actions_0e338dt.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/05hd_server_app_api_conversations_[id]_buffered-messages_route_actions_0mf5n8a.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/[root-of-the-server]__0d0_qit._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_00_9pus._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_02.f31i._.js +0 -5
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_025fm6r._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_03ju0js._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_06imn.m._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_07hpwgw._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_08y2ta9._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0_kfe3c._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0ahwrti._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0b4pq8.._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0d6rwbr._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0gqpz7w._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0h-fa04._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0il0z_b._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0l1rr.g._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0p_10om._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0r04wj_._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0ri6_n4._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0zk1_mu._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_0zt3sdk._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_102qunz._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_12i.jt7._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/_13lep.0._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/src_web_src_lib_services_0yvxfxt._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_004q5tu._.js +0 -3
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0g~0u9h._.js +0 -65
- package/bundled/web/.open-next/server-functions/default/src/web/.next/server/chunks/ssr/_0kv_hld._.js +0 -9
- /package/bundled/web/.open-next/assets/_next/static/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/_buildManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/_clientMiddlewareManifest.js +0 -0
- /package/bundled/web/.open-next/assets/_next/static/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/_ssgManifest.js +0 -0
- /package/bundled/web/.open-next/cache/{FjNKGEvkF0L0MRIiOb2vT → bwwUBlSnuSEyz1RNfFbW9}/robots.txt.cache +0 -0
|
@@ -14631,6 +14631,10 @@ var CreateAgentLinkRequestSchema = exports_external.object({
|
|
|
14631
14631
|
var UpdateAgentLinkRequestSchema = exports_external.object({
|
|
14632
14632
|
instruction: exports_external.string()
|
|
14633
14633
|
});
|
|
14634
|
+
var UpsertAgentLinkRequestSchema = exports_external.object({
|
|
14635
|
+
target_agent_id: exports_external.string().min(1, "target_agent_id is required"),
|
|
14636
|
+
instruction: exports_external.string()
|
|
14637
|
+
});
|
|
14634
14638
|
var AddWhitelistRequestSchema = exports_external.object({
|
|
14635
14639
|
email: exports_external.string().email()
|
|
14636
14640
|
});
|
|
@@ -14661,8 +14665,9 @@ var CreateConversationRequestSchema = exports_external.object({
|
|
|
14661
14665
|
var CreateMessageRequestSchema = exports_external.object({
|
|
14662
14666
|
content: exports_external.string().min(1, "content is required")
|
|
14663
14667
|
});
|
|
14664
|
-
var
|
|
14665
|
-
content: exports_external.string().min(1, "content is required")
|
|
14668
|
+
var AgentDmRequestSchema = exports_external.object({
|
|
14669
|
+
content: exports_external.string().min(1, "content is required"),
|
|
14670
|
+
task_id: exports_external.string().min(1).optional()
|
|
14666
14671
|
});
|
|
14667
14672
|
var EmailAttachmentSchema = exports_external.object({
|
|
14668
14673
|
key: exports_external.string().min(1),
|
|
@@ -16725,6 +16730,22 @@ var agentSkill = sqliteTable("agent_skill", {
|
|
|
16725
16730
|
foreignColumns: [agent.id, agent.workspaceId]
|
|
16726
16731
|
}).onDelete("cascade")
|
|
16727
16732
|
]);
|
|
16733
|
+
var inboxUnread = sqliteTable("inbox_unread", {
|
|
16734
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
16735
|
+
conversationId: text("conversation_id").notNull().references(() => conversation.id, { onDelete: "cascade" }),
|
|
16736
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
16737
|
+
workspaceId: text("workspace_id").notNull(),
|
|
16738
|
+
agentId: text("agent_id").notNull(),
|
|
16739
|
+
taskId: text("task_id").notNull(),
|
|
16740
|
+
taskType: text("task_type").notNull(),
|
|
16741
|
+
taskStatus: text("task_status").notNull(),
|
|
16742
|
+
taskPrompt: text("task_prompt"),
|
|
16743
|
+
completedAt: text("completed_at").notNull(),
|
|
16744
|
+
latestMessageId: text("latest_message_id")
|
|
16745
|
+
}, (t) => [
|
|
16746
|
+
unique("inbox_unread_conv_user").on(t.conversationId, t.userId),
|
|
16747
|
+
index("idx_inbox_unread_user_ws").on(t.userId, t.workspaceId, t.taskType, t.completedAt)
|
|
16748
|
+
]);
|
|
16728
16749
|
// ../shared/src/db/queries/task.ts
|
|
16729
16750
|
var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
|
|
16730
16751
|
var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
|
|
@@ -18007,6 +18028,7 @@ class OpenCodeBackend {
|
|
|
18007
18028
|
case "error": {
|
|
18008
18029
|
const content = event.message || event.content || part?.error || "";
|
|
18009
18030
|
lastError = content;
|
|
18031
|
+
resultStatus = "failed";
|
|
18010
18032
|
pushMessage({ type: "error", content });
|
|
18011
18033
|
turnDone();
|
|
18012
18034
|
break;
|
|
@@ -18288,6 +18310,7 @@ The CLI auto-detects your identity from the environment. No need to pass \`--age
|
|
|
18288
18310
|
### Command quick reference
|
|
18289
18311
|
| Capability | Command |
|
|
18290
18312
|
|---|---|
|
|
18313
|
+
| Send a message to the user | \`${cmdPrefix()} sync send-dm\` |
|
|
18291
18314
|
| Schedule / list / edit tasks | \`${cmdPrefix()} calendar set\` (also list, show, update, delete) |
|
|
18292
18315
|
| Upload a file for your owner | \`${cmdPrefix()} sync upload-artifact\` |
|
|
18293
18316
|
| Recruit a colleague agent | \`${cmdPrefix()} agent recruit\` |
|
|
@@ -18375,6 +18398,26 @@ Upload files for your owner to review in the app.
|
|
|
18375
18398
|
- You response will be rendered in remote server, so don't output link format with local path in your response (cause user can click it and jump to nowheres)
|
|
18376
18399
|
- If you think user may need to know any file detail, use upload-artifact tool to send the file to user.
|
|
18377
18400
|
|
|
18401
|
+
### Talking to the user
|
|
18402
|
+
You're texting a colleague, not filing a report. The only thing the user sees is what you send with \`${cmdPrefix()} sync send-dm\` — your task output, reasoning, and tool calls are all off-screen. If you finish without sending, they got silence.
|
|
18403
|
+
|
|
18404
|
+
\`${cmdPrefix()} sync send-dm\` sends a message to **the user** (your owner), not to a colleague agent. This is how you communicate with the human who gave you the task. Use email to talk to colleague agents.
|
|
18405
|
+
|
|
18406
|
+
Message at milestones, the way a person would: acknowledge when you pick something up, share a real step forward or a fork in the road, and deliver the result. A quick task is often one message; a long one is a few well-spaced check-ins. Trust your read of the moment — don't narrate every small step, and don't go dark for a long stretch on something they're waiting on.
|
|
18407
|
+
|
|
18408
|
+
Say what a colleague would say, not a transcript — the answer in your own voice. (Email- and calendar-triggered tasks have no one watching the chat; use email there.)
|
|
18409
|
+
|
|
18410
|
+
**A real person is waiting on the other end.** Send updates at every milestone of your work — not just the final result. For any task longer than a minute:
|
|
18411
|
+
1. **Before you start**: tell them your plan ("I'll research X, then modify Y and Z")
|
|
18412
|
+
2. **During work**: update when you find something important, change direction, or hit a blocker ("Found the issue — it's in the auth module, fixing now")
|
|
18413
|
+
3. **When done**: deliver the clear result
|
|
18414
|
+
|
|
18415
|
+
Don't bundle everything into one giant message at the end. The user shouldn't have to sit in silence wondering what's happening. A one-line progress update costs nothing and keeps the human in the loop. But don't send repetitive or near-identical messages — each update should carry new information, not just restate what you already said.
|
|
18416
|
+
|
|
18417
|
+
**If the user sends you a message while you're working** — especially questions like "are you there?", "what's the status?", or unrelated requests — **respond to them immediately**. Don't finish your current task first and then reply. The user reached out because they need your attention NOW. Acknowledge them right away, then resume your work.
|
|
18418
|
+
|
|
18419
|
+
\`${cmdPrefix()} sync send-dm --message "…"\` for short messages. For longer or markdown-rich messages, write to a file first and use \`--message-file <path>\` — this preserves formatting and avoids shell escaping issues. The conversation is in $ALOOK_CONVERSATION_ID, so you usually need no flags. You can send several times in one task.
|
|
18420
|
+
|
|
18378
18421
|
### Attachments
|
|
18379
18422
|
When your task includes attachments, their local paths are listed in the prompt JSON under "attachments".
|
|
18380
18423
|
Use your Read tool to open them. Images and PDFs are read visually.
|
|
@@ -18394,6 +18437,15 @@ Recruit new colleague agents directly from the CLI. The server auto-generates a
|
|
|
18394
18437
|
- Example: '${cmdPrefix()} agent recruit --instructions "You are a QA engineer..." --relationship "DELEGATE when: code is ready for review"'
|
|
18395
18438
|
- Output: 'Recruited Felix (felix@alook.ai) — ag_xK9mPq2z'
|
|
18396
18439
|
- The new agent shares your runtime, is automatically linked as your colleague, and receives a welcome task.
|
|
18440
|
+
|
|
18441
|
+
Set or update the relationship with an EXISTING colleague (create-or-replace):
|
|
18442
|
+
- Run '${cmdPrefix()} agent link --to <handleOrId> --relationship "<DELEGATION_CRITERIA>"'
|
|
18443
|
+
- '--to <handleOrId>' — target agent by email handle ('coder' or 'coder@alook.ai') or agent id ('ag_...')
|
|
18444
|
+
- '--relationship <text>' — the delegation criteria both of you see (replaces it if a link already exists)
|
|
18445
|
+
- '--relationship-file <path>' — alternative: read relationship from a file (mutually exclusive with --relationship)
|
|
18446
|
+
- '--json' — output the link object incl. a 'created' boolean
|
|
18447
|
+
- Example: '${cmdPrefix()} agent link --to coder --relationship "DELEGATE when implementation is needed"'
|
|
18448
|
+
- Output: 'Linked Felix <-> coder (created)' (or '(updated)' when an existing link was replaced).
|
|
18397
18449
|
`;
|
|
18398
18450
|
content += `
|
|
18399
18451
|
### Calendar
|
|
@@ -18748,14 +18800,14 @@ function clearKillIntent(baseDir, taskId) {
|
|
|
18748
18800
|
}
|
|
18749
18801
|
|
|
18750
18802
|
// daemon/prompt.ts
|
|
18751
|
-
var DM_RESPONSE_NOTICE = "
|
|
18803
|
+
var DM_RESPONSE_NOTICE = "Reply with `alook sync send-dm` — that's the only thing the user sees; your task output and reasoning are not shown." + " Talk to them at milestones like a colleague would, and don't end your turn without sending what they need." + " If this task will take more than 30 seconds, send a quick ack first so the user knows you're on it.";
|
|
18752
18804
|
var EMAIL_NOTICE = "This task was triggered automatically by an incoming email. There is no human in this session." + " If you need to communicate with a human, you MUST send an email using the email sending tool." + " If you need more information or confirmation from the human, send them an email asking for it and then exit." + " Do not wait — when the human replies, a new task will be triggered automatically and you will be woken up with their response.";
|
|
18753
18805
|
var CALENDAR_NOTICE = "This task was triggered by a scheduled calendar event. There is no human in this session." + " If you need to communicate with a human, you MUST send an email using the email sending tool." + " If you need more information or confirmation, send an email asking for it and then exit." + " Do not wait — when the human replies, a new task will be triggered automatically and you will be woken up with their response.";
|
|
18754
18806
|
var ISSUE_NOTICE = "This task was triggered by an assigned issue. The issue_id is provided in this message." + " Use `alook issue show --issue_id <issue_id>` to read full context." + " Use `alook issue update --issue_id <issue_id> --status <status>` to change status." + " Use `alook issue comment --issue_id <issue_id> --body <text>` to leave a comment." + " CRITICAL — You MUST manage the issue status correctly. This is NOT optional:" + " 1. Set status to 'in_progress' when you start working." + " 2. If you complete the work yourself: leave a summary comment, then set status to 'review' as your last action. 'review' means there is actual completed work (code, artifact, result) ready for the owner to look at." + " 3. If you delegated work to colleagues and are waiting for their response: KEEP status as 'in_progress' and exit. This is expected — you will be woken up when they reply. Set 'review' only after all delegated work is confirmed complete." + " 4. NEVER set 'review' unless there is concrete completed work for the owner to review. Sending a plan to a colleague is NOT completed work." + " NEVER exit without doing at least one of: updating the status, or leaving a comment explaining what you did and what you're waiting for.";
|
|
18755
18807
|
function buildDmNotice(name, email3) {
|
|
18756
18808
|
return `This task was triggered by an incoming email on a conversation with ${name} (${email3}).` + ` ${name} is present in this session — reply to them directly.` + ` If you need to communicate with anyone else, use the email sending tool.`;
|
|
18757
18809
|
}
|
|
18758
|
-
function
|
|
18810
|
+
function buildTaskObject(task, attachments) {
|
|
18759
18811
|
const createdAt = new Date(task.createdAt);
|
|
18760
18812
|
const receivedAt = Number.isNaN(createdAt.getTime()) ? localISOString() : localISOString(createdAt);
|
|
18761
18813
|
const obj = {
|
|
@@ -18821,7 +18873,10 @@ function buildPrompt(task, attachments) {
|
|
|
18821
18873
|
filename: a.filename
|
|
18822
18874
|
}));
|
|
18823
18875
|
}
|
|
18824
|
-
return
|
|
18876
|
+
return obj;
|
|
18877
|
+
}
|
|
18878
|
+
function buildPrompt(task, attachments) {
|
|
18879
|
+
return JSON.stringify(buildTaskObject(task, attachments));
|
|
18825
18880
|
}
|
|
18826
18881
|
|
|
18827
18882
|
// daemon/session-runner.ts
|
|
@@ -18926,8 +18981,8 @@ async function runSession(input) {
|
|
|
18926
18981
|
await initEntryAsync(timelineDir, createTimelineEntry(task.id, task.prompt, task.type, undefined, process.pid, provider, task.contextKey, input.logFilePath));
|
|
18927
18982
|
const { workDir, env } = prepare({ workspacesRoot, token }, task);
|
|
18928
18983
|
let killed = false;
|
|
18929
|
-
let agentPid
|
|
18930
|
-
let flushTimer
|
|
18984
|
+
let agentPid;
|
|
18985
|
+
let flushTimer;
|
|
18931
18986
|
const pendingMessages = [];
|
|
18932
18987
|
let seq = 0;
|
|
18933
18988
|
let toolCount = 0;
|
|
@@ -19013,7 +19068,7 @@ async function runSession(input) {
|
|
|
19013
19068
|
}
|
|
19014
19069
|
if (killed)
|
|
19015
19070
|
return;
|
|
19016
|
-
const prompt = buildPrompt(task, attachments);
|
|
19071
|
+
const prompt = input.promptOverride ?? buildPrompt(task, attachments);
|
|
19017
19072
|
const resumeSessionId = task.contextKey ? findResumableSessionByContextKey(timelineDir, task.contextKey, provider) ?? undefined : undefined;
|
|
19018
19073
|
if (resumeSessionId) {
|
|
19019
19074
|
log5.info(`resuming session ${resumeSessionId} (context_key: ${task.contextKey})`);
|
|
@@ -19038,6 +19093,8 @@ async function runSession(input) {
|
|
|
19038
19093
|
log5.info(JSON.stringify({ role: "user", type: "text", content: prompt }));
|
|
19039
19094
|
updateEntry(timelineDir, task.id, (entry) => {
|
|
19040
19095
|
entry.session_id = earlySessionId || null;
|
|
19096
|
+
if (earlySessionId)
|
|
19097
|
+
entry.agent_started = true;
|
|
19041
19098
|
});
|
|
19042
19099
|
flushTimer = setInterval(flushMessages, FLUSH_INTERVAL_MS);
|
|
19043
19100
|
const INACTIVITY_TIMEOUT_MS = messageInactivityTimeout ?? 5 * 60 * 1000;
|
|
@@ -19179,5 +19236,7 @@ if (isDirectExecution) {
|
|
|
19179
19236
|
export {
|
|
19180
19237
|
writeMarkerFile,
|
|
19181
19238
|
runSession,
|
|
19182
|
-
reportToServer
|
|
19239
|
+
reportToServer,
|
|
19240
|
+
downloadAttachments,
|
|
19241
|
+
cleanupAttachments
|
|
19183
19242
|
};
|
package/dist/index.js
CHANGED
|
@@ -14822,6 +14822,10 @@ var CreateAgentLinkRequestSchema = exports_external.object({
|
|
|
14822
14822
|
var UpdateAgentLinkRequestSchema = exports_external.object({
|
|
14823
14823
|
instruction: exports_external.string()
|
|
14824
14824
|
});
|
|
14825
|
+
var UpsertAgentLinkRequestSchema = exports_external.object({
|
|
14826
|
+
target_agent_id: exports_external.string().min(1, "target_agent_id is required"),
|
|
14827
|
+
instruction: exports_external.string()
|
|
14828
|
+
});
|
|
14825
14829
|
var AddWhitelistRequestSchema = exports_external.object({
|
|
14826
14830
|
email: exports_external.string().email()
|
|
14827
14831
|
});
|
|
@@ -14852,8 +14856,9 @@ var CreateConversationRequestSchema = exports_external.object({
|
|
|
14852
14856
|
var CreateMessageRequestSchema = exports_external.object({
|
|
14853
14857
|
content: exports_external.string().min(1, "content is required")
|
|
14854
14858
|
});
|
|
14855
|
-
var
|
|
14856
|
-
content: exports_external.string().min(1, "content is required")
|
|
14859
|
+
var AgentDmRequestSchema = exports_external.object({
|
|
14860
|
+
content: exports_external.string().min(1, "content is required"),
|
|
14861
|
+
task_id: exports_external.string().min(1).optional()
|
|
14857
14862
|
});
|
|
14858
14863
|
var EmailAttachmentSchema = exports_external.object({
|
|
14859
14864
|
key: exports_external.string().min(1),
|
|
@@ -16916,6 +16921,22 @@ var agentSkill = sqliteTable("agent_skill", {
|
|
|
16916
16921
|
foreignColumns: [agent.id, agent.workspaceId]
|
|
16917
16922
|
}).onDelete("cascade")
|
|
16918
16923
|
]);
|
|
16924
|
+
var inboxUnread = sqliteTable("inbox_unread", {
|
|
16925
|
+
id: text("id").primaryKey().$defaultFn(() => nanoid3()),
|
|
16926
|
+
conversationId: text("conversation_id").notNull().references(() => conversation.id, { onDelete: "cascade" }),
|
|
16927
|
+
userId: text("user_id").notNull().references(() => user.id, { onDelete: "cascade" }),
|
|
16928
|
+
workspaceId: text("workspace_id").notNull(),
|
|
16929
|
+
agentId: text("agent_id").notNull(),
|
|
16930
|
+
taskId: text("task_id").notNull(),
|
|
16931
|
+
taskType: text("task_type").notNull(),
|
|
16932
|
+
taskStatus: text("task_status").notNull(),
|
|
16933
|
+
taskPrompt: text("task_prompt"),
|
|
16934
|
+
completedAt: text("completed_at").notNull(),
|
|
16935
|
+
latestMessageId: text("latest_message_id")
|
|
16936
|
+
}, (t) => [
|
|
16937
|
+
unique("inbox_unread_conv_user").on(t.conversationId, t.userId),
|
|
16938
|
+
index("idx_inbox_unread_user_ws").on(t.userId, t.workspaceId, t.taskType, t.completedAt)
|
|
16939
|
+
]);
|
|
16919
16940
|
// ../shared/src/db/queries/task.ts
|
|
16920
16941
|
var DEFAULT_STALE_SECONDS = Number(process.env.ALOOK_STALE_DISPATCH_TIMEOUT_S) || 20;
|
|
16921
16942
|
var DEFAULT_STALE_RUNNING_SECONDS = Number(process.env.ALOOK_STALE_RUNNING_TIMEOUT_S) || 3600;
|
package/package.json
CHANGED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,821752,(e,t,n)=>{"use strict";function r({widthInt:e,heightInt:t,blurWidth:n,blurHeight:s,blurDataURL:i,objectFit:a}){let l=n?40*n:e,o=s?40*s:t,u=l&&o?`viewBox='0 0 ${l} ${o}'`:"";return`%3Csvg xmlns='http://www.w3.org/2000/svg' ${u}%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3CfeColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='${u?"none":"contain"===a?"xMidYMid":"cover"===a?"xMidYMid slice":"none"}' style='filter: url(%23b);' href='${i}'/%3E%3C/svg%3E`}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImageBlurSvg",{enumerable:!0,get:function(){return r}})},498074,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={VALID_LOADERS:function(){return i},imageConfigDefault:function(){return a}};for(var s in r)Object.defineProperty(n,s,{enumerable:!0,get:r[s]});let i=["default","imgix","cloudinary","akamai","custom"],a={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],path:"/_next/image",loader:"default",loaderFile:"",domains:[],disableStaticImages:!1,minimumCacheTTL:14400,formats:["image/webp"],maximumDiskCacheSize:void 0,maximumRedirects:3,maximumResponseBody:5e7,dangerouslyAllowLocalIP:!1,dangerouslyAllowSVG:!1,contentSecurityPolicy:"script-src 'none'; frame-src 'none'; sandbox;",contentDispositionType:"attachment",localPatterns:void 0,remotePatterns:[],qualities:[75],unoptimized:!1,customCacheHandler:!1}},355477,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"getImgProps",{enumerable:!0,get:function(){return u}}),e.r(611134);let r=e.r(641894),s=e.r(821752),i=e.r(498074),a=["-moz-initial","fill","none","scale-down",void 0];function l(e){return void 0!==e.default}function o(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function u({src:e,sizes:t,unoptimized:n=!1,priority:d=!1,preload:c=!1,loading:f,className:h,quality:m,width:p,height:g,fill:v=!1,style:x,overrideSrc:b,onLoad:j,onLoadingComplete:y,placeholder:k="empty",blurDataURL:w,fetchPriority:C,decoding:P="async",layout:_,objectFit:S,objectPosition:M,lazyBoundary:R,lazyRoot:O,...E},I){var z;let N,T,D,{imgConf:A,showAltText:q,blurComplete:L,defaultLoader:$}=I,F=A||i.imageConfigDefault;if("allSizes"in F)N=F;else{let e=[...F.deviceSizes,...F.imageSizes].sort((e,t)=>e-t),t=F.deviceSizes.sort((e,t)=>e-t),n=F.qualities?.sort((e,t)=>e-t);N={...F,allSizes:e,deviceSizes:t,qualities:n}}if(void 0===$)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let U=E.loader||$;delete E.loader,delete E.srcSet;let B="__next_img_default"in U;if(B){if("custom"===N.loader)throw Object.defineProperty(Error(`Image with src "${e}" is missing "loader" prop.
|
|
2
|
-
Read more: https://nextjs.org/docs/messages/next-image-missing-loader`),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=U;U=t=>{let{config:n,...r}=t;return e(r)}}if(_){"fill"===_&&(v=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[_];e&&(x={...x,...e});let n={responsive:"100vw",fill:"100vw"}[_];n&&!t&&(t=n)}let W="",H=o(p),G=o(g);if((z=e)&&"object"==typeof z&&(l(z)||void 0!==z.src)){let t=l(e)?e.default:e;if(!t.src)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!t.height||!t.width)throw Object.defineProperty(Error(`An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received ${JSON.stringify(t)}`),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(T=t.blurWidth,D=t.blurHeight,w=w||t.blurDataURL,W=t.src,!v)if(H||G){if(H&&!G){let e=H/t.width;G=Math.round(t.height*e)}else if(!H&&G){let e=G/t.height;H=Math.round(t.width*e)}}else H=t.width,G=t.height}let K=!d&&!c&&("lazy"===f||void 0===f);(!(e="string"==typeof e?e:W)||e.startsWith("data:")||e.startsWith("blob:"))&&(n=!0,K=!1),N.unoptimized&&(n=!0),B&&!N.dangerouslyAllowSVG&&e.split("?",1)[0].endsWith(".svg")&&(n=!0);let V=o(m),X=Object.assign(v?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:S,objectPosition:M}:{},q?{}:{color:"transparent"},x),Y=L||"empty"===k?null:"blur"===k?`url("data:image/svg+xml;charset=utf-8,${(0,s.getImageBlurSvg)({widthInt:H,heightInt:G,blurWidth:T,blurHeight:D,blurDataURL:w||"",objectFit:X.objectFit})}")`:`url("${k}")`,J=a.includes(X.objectFit)?"fill"===X.objectFit?"100% 100%":"cover":X.objectFit,Q=Y?{backgroundSize:J,backgroundPosition:X.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},Z=function({config:e,src:t,unoptimized:n,width:s,quality:i,sizes:a,loader:l}){if(n){if(t.startsWith("/")&&!t.startsWith("//")){let e=(0,r.getDeploymentId)();if(e){let n=t.indexOf("?");if(-1!==n){let r=new URLSearchParams(t.slice(n+1));r.get("dpl")||(r.append("dpl",e),t=t.slice(0,n)+"?"+r.toString())}else t+=`?dpl=${e}`}}return{src:t,srcSet:void 0,sizes:void 0}}let{widths:o,kind:u}=function({deviceSizes:e,allSizes:t},n,r){if(r){let n=/(^|\s)(1?\d?\d)vw/g,s=[];for(let e;e=n.exec(r);)s.push(parseInt(e[2]));if(s.length){let n=.01*Math.min(...s);return{widths:t.filter(t=>t>=e[0]*n),kind:"w"}}return{widths:t,kind:"w"}}return"number"!=typeof n?{widths:e,kind:"w"}:{widths:[...new Set([n,2*n].map(e=>t.find(t=>t>=e)||t[t.length-1]))],kind:"x"}}(e,s,a),d=o.length-1;return{sizes:a||"w"!==u?a:"100vw",srcSet:o.map((n,r)=>`${l({config:e,src:t,quality:i,width:n})} ${"w"===u?n:r+1}${u}`).join(", "),src:l({config:e,src:t,quality:i,width:o[d]})}}({config:N,src:e,unoptimized:n,width:H,quality:V,sizes:t,loader:U}),ee=K?"lazy":f;return{props:{...E,loading:ee,fetchPriority:C,width:H,height:G,decoding:P,className:h,style:{...X,...Q},sizes:Z.sizes,srcSet:Z.srcSet,src:b||Z.src},meta:{unoptimized:n,preload:c||d,placeholder:k,fill:v}}}},477847,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return l}});let r=e.r(298699),s="u"<typeof window,i=s?()=>{}:r.useLayoutEffect,a=s?()=>{}:r.useEffect;function l(e){let{headManager:t,reduceComponentsToState:n}=e;function l(){if(t&&t.mountedInstances){let e=r.Children.toArray(Array.from(t.mountedInstances).filter(Boolean));t.updateHead(n(e))}}return s&&(t?.mountedInstances?.add(e.children),l()),i(()=>(t?.mountedInstances?.add(e.children),()=>{t?.mountedInstances?.delete(e.children)})),i(()=>(t&&(t._pendingUpdate=l),()=>{t&&(t._pendingUpdate=l)})),a(()=>(t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null),()=>{t&&t._pendingUpdate&&(t._pendingUpdate(),t._pendingUpdate=null)})),null}},769049,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return p},defaultHead:function(){return c}};for(var s in r)Object.defineProperty(n,s,{enumerable:!0,get:r[s]});let i=e.r(481258),a=e.r(744066),l=e.r(368075),o=a._(e.r(298699)),u=i._(e.r(477847)),d=e.r(951024);function c(){return[(0,l.jsx)("meta",{charSet:"utf-8"},"charset"),(0,l.jsx)("meta",{name:"viewport",content:"width=device-width"},"viewport")]}function f(e,t){return"string"==typeof t||"number"==typeof t?e:t.type===o.default.Fragment?e.concat(o.default.Children.toArray(t.props.children).reduce((e,t)=>"string"==typeof t||"number"==typeof t?e:e.concat(t),[])):e.concat(t)}e.r(611134);let h=["name","httpEquiv","charSet","itemProp"];function m(e){let t,n,r,s;return e.reduce(f,[]).reverse().concat(c().reverse()).filter((t=new Set,n=new Set,r=new Set,s={},e=>{let i=!0,a=!1;if(e.key&&"number"!=typeof e.key&&e.key.indexOf("$")>0){a=!0;let n=e.key.slice(e.key.indexOf("$")+1);t.has(n)?i=!1:t.add(n)}switch(e.type){case"title":case"base":n.has(e.type)?i=!1:n.add(e.type);break;case"meta":for(let t=0,n=h.length;t<n;t++){let n=h[t];if(e.props.hasOwnProperty(n))if("charSet"===n)r.has(n)?i=!1:r.add(n);else{let t=e.props[n],r=s[n]||new Set;("name"!==n||!a)&&r.has(t)?i=!1:(r.add(t),s[n]=r)}}}return i})).reverse().map((e,t)=>{let n=e.key||t;return o.default.cloneElement(e,{key:n})})}let p=function({children:e}){let t=(0,o.useContext)(d.HeadManagerContext);return(0,l.jsx)(u.default,{reduceComponentsToState:m,headManager:t,children:e})};("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},703694,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"ImageConfigContext",{enumerable:!0,get:function(){return i}});let r=e.r(481258)._(e.r(298699)),s=e.r(498074),i=r.default.createContext(s.imageConfigDefault)},507585,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"RouterContext",{enumerable:!0,get:function(){return r}});let r=e.r(481258)._(e.r(298699)).default.createContext(null)},246955,(e,t,n)=>{"use strict";function r(e,t){let n=e||75;return t?.qualities?.length?t.qualities.reduce((e,t)=>Math.abs(t-n)<Math.abs(e-n)?t:e,t.qualities[0]):n}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"findClosestQuality",{enumerable:!0,get:function(){return r}})},107475,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return a}});let r=e.r(246955),s=e.r(641894);function i({config:e,src:t,width:n,quality:a}){let l=(0,s.getDeploymentId)();if(t.startsWith("/")&&!t.startsWith("//")){let e=t.indexOf("?");if(-1!==e){let n=new URLSearchParams(t.slice(e+1)),r=n.get("dpl");if(r){l=r,n.delete("dpl");let s=n.toString();t=t.slice(0,e)+(s?"?"+s:"")}}}if(t.startsWith("/")&&t.includes("?")&&e.localPatterns?.length===1&&"**"===e.localPatterns[0].pathname&&""===e.localPatterns[0].search)throw Object.defineProperty(Error(`Image with src "${t}" is using a query string which is not configured in images.localPatterns.
|
|
3
|
-
Read more: https://nextjs.org/docs/messages/next-image-unconfigured-localpatterns`),"__NEXT_ERROR_CODE",{value:"E871",enumerable:!1,configurable:!0});let o=(0,r.findClosestQuality)(a,e);return`${e.path}?url=${encodeURIComponent(t)}&w=${n}&q=${o}${t.startsWith("/")&&l?`&dpl=${l}`:""}`}i.__next_img_default=!0;let a=i},730145,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"Image",{enumerable:!0,get:function(){return j}});let r=e.r(481258),s=e.r(744066),i=e.r(368075),a=s._(e.r(298699)),l=r._(e.r(550008)),o=r._(e.r(769049)),u=e.r(355477),d=e.r(498074),c=e.r(703694);e.r(611134);let f=e.r(507585),h=r._(e.r(107475)),m=e.r(70738),p={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,n,r,s,i,a){let l=e?.src;e&&e["data-loaded-src"]!==l&&(e["data-loaded-src"]=l,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&s(!0),n?.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,s=!1;n.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>s,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{s=!0,t.stopPropagation()}})}r?.current&&r.current(e)}}))}function v(e){return a.use?{fetchPriority:e}:{fetchpriority:e}}"u"<typeof window&&(globalThis.__NEXT_IMAGE_IMPORTED=!0);let x=(0,a.forwardRef)(({src:e,srcSet:t,sizes:n,height:r,width:s,decoding:l,className:o,style:u,fetchPriority:d,placeholder:c,loading:f,unoptimized:h,fill:p,onLoadRef:x,onLoadingCompleteRef:b,setBlurComplete:j,setShowAltText:y,sizesInput:k,onLoad:w,onError:C,...P},_)=>{let S=(0,a.useCallback)(e=>{e&&(C&&(e.src=e.src),e.complete&&g(e,c,x,b,j,h,k))},[e,c,x,b,j,C,h,k]),M=(0,m.useMergedRef)(_,S);return(0,i.jsx)("img",{...P,...v(d),loading:f,width:s,height:r,decoding:l,"data-nimg":p?"fill":"1",className:o,style:u,sizes:n,srcSet:t,src:e,ref:M,onLoad:e=>{g(e.currentTarget,c,x,b,j,h,k)},onError:e=>{y(!0),"empty"!==c&&j(!0),C&&C(e)}})});function b({isAppRouter:e,imgAttributes:t}){let n={as:"image",imageSrcSet:t.srcSet,imageSizes:t.sizes,crossOrigin:t.crossOrigin,referrerPolicy:t.referrerPolicy,...v(t.fetchPriority)};return e&&l.default.preload?(l.default.preload(t.src,n),null):(0,i.jsx)(o.default,{children:(0,i.jsx)("link",{rel:"preload",href:t.srcSet?void 0:t.src,...n},"__nimg-"+t.src+t.srcSet+t.sizes)})}let j=(0,a.forwardRef)((e,t)=>{let n=(0,a.useContext)(f.RouterContext),r=(0,a.useContext)(c.ImageConfigContext),s=(0,a.useMemo)(()=>{let e=p||r||d.imageConfigDefault,t=[...e.deviceSizes,...e.imageSizes].sort((e,t)=>e-t),n=e.deviceSizes.sort((e,t)=>e-t),s=e.qualities?.sort((e,t)=>e-t);return{...e,allSizes:t,deviceSizes:n,qualities:s,localPatterns:"u"<typeof window?r?.localPatterns:e.localPatterns}},[r]),{onLoad:l,onLoadingComplete:o}=e,m=(0,a.useRef)(l);(0,a.useEffect)(()=>{m.current=l},[l]);let g=(0,a.useRef)(o);(0,a.useEffect)(()=>{g.current=o},[o]);let[v,j]=(0,a.useState)(!1),[y,k]=(0,a.useState)(!1),{props:w,meta:C}=(0,u.getImgProps)(e,{defaultLoader:h.default,imgConf:s,blurComplete:v,showAltText:y});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(x,{...w,unoptimized:C.unoptimized,placeholder:C.placeholder,fill:C.fill,onLoadRef:m,onLoadingCompleteRef:g,setBlurComplete:j,setShowAltText:k,sizesInput:e.sizes,ref:t}),C.preload?(0,i.jsx)(b,{isAppRouter:!n,imgAttributes:w}):null]})});("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},851287,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r={default:function(){return d},getImageProps:function(){return u}};for(var s in r)Object.defineProperty(n,s,{enumerable:!0,get:r[s]});let i=e.r(481258),a=e.r(355477),l=e.r(730145),o=i._(e.r(107475));function u(e){let{props:t}=(0,a.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[32,48,64,96,128,256,384],qualities:[75],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,n]of Object.entries(t))void 0===n&&delete t[e];return{props:t}}let d=l.Image},736956,(e,t,n)=>{t.exports=e.r(851287)},855062,e=>{"use strict";var t=e.i(298699);e.s(["useLocalStorage",0,function(e,n){let[r,s]=(0,t.useState)(n);return(0,t.useLayoutEffect)(()=>{try{let t=localStorage.getItem(e);t&&s(JSON.parse(t))}catch{}},[e]),[r,(0,t.useCallback)(t=>{s(n=>{let r=t instanceof Function?t(n):t;try{localStorage.setItem(e,JSON.stringify(r))}catch{}return r})},[e])]}])},323550,e=>{"use strict";let t=(0,e.i(406963).default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);e.s(["Monitor",0,t],323550)},4581,e=>{"use strict";let t=(0,e.i(406963).default)("refresh-cw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);e.s(["RefreshCw",0,t],4581)},898707,e=>{"use strict";var t=e.i(368075);e.s(["GradientBackground",0,function(){return(0,t.jsx)("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0 -z-10 overflow-hidden bg-[oklch(0.93_0.015_80)] dark:bg-transparent"})}])},970019,e=>{"use strict";let t=(0,e.i(406963).default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);e.s(["ArrowUpRight",0,t],970019)},949035,e=>{"use strict";let t=(0,e.i(406963).default)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);e.s(["Plus",0,t],949035)},676214,e=>{"use strict";let t=(0,e.i(406963).default)("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);e.s(["Trash2",0,t],676214)},142008,e=>{"use strict";var t=e.i(298699),n=e.i(352396),r=e.i(536460),s=e.i(401489);e.s(["useCompositeItem",0,function(e={}){let{highlightItemOnHover:i,highlightedIndex:a,onHighlightedIndexChange:l}=(0,r.useCompositeRootContext)(),{ref:o,index:u}=(0,s.useCompositeListItem)(e),d=a===u,c=t.useRef(null),f=(0,n.useMergedRefs)(o,c);return{compositeProps:t.useMemo(()=>({tabIndex:d?0:-1,onFocus(){l(u)},onMouseMove(){let e=c.current;if(!i||!e)return;let t=e.hasAttribute("disabled")||"true"===e.ariaDisabled;d||t||e.focus()}}),[d,l,u,i]),compositeRef:f,index:u}}])},988232,550328,140434,172635,e=>{"use strict";var t=e.i(368075),n=e.i(298699),r=e.i(949035);let s=(0,e.i(406963).default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);e.s(["Pencil",0,s],550328);var i=e.i(676214),a=e.i(371522),l=e.i(595107),o=e.i(532394);let u=e=>{let{transform:t}=e;return{...t,y:0}};function d(e,t,n){let r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function c(e){return null!==e&&e>=0}e.s(["restrictToHorizontalAxis",0,u,"restrictToVerticalAxis",0,e=>{let{transform:t}=e;return{...t,x:0}}],140434);let f={scaleX:1,scaleY:1},h=e=>{var t,n,r,s;let i,a,l,{rects:o,activeNodeRect:u,activeIndex:d,overIndex:c,index:h}=e,m=null!=(t=o[d])?t:u;if(!m)return null;let p=(n=o,r=h,s=d,i=n[r],a=n[r-1],l=n[r+1],i&&(a||l)?s<r?a?i.left-(a.left+a.width):l.left-(i.left+i.width):l?l.left-(i.left+i.width):i.left-(a.left+a.width):0);if(h===d){let e=o[c];return e?{x:d<c?e.left+e.width-(m.left+m.width):e.left-m.left,y:0,...f}:null}return h>d&&h<=c?{x:-m.width-p,y:0,...f}:h<d&&h>=c?{x:m.width+p,y:0,...f}:{x:0,y:0,...f}},m=e=>{let{rects:t,activeIndex:n,overIndex:r,index:s}=e,i=d(t,r,n),a=t[s],l=i[s];return l&&a?{x:l.left-a.left,y:l.top-a.top,scaleX:l.width/a.width,scaleY:l.height/a.height}:null},p={scaleX:1,scaleY:1},g="Sortable",v=n.default.createContext({activeIndex:-1,containerId:g,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:m,disabled:{draggable:!1,droppable:!1}});function x(e){let{children:t,id:r,items:s,strategy:i=m,disabled:a=!1}=e,{active:u,dragOverlay:d,droppableRects:c,over:f,measureDroppableContainers:h}=(0,l.useDndContext)(),p=(0,o.useUniqueId)(g,r),x=null!==d.rect,b=(0,n.useMemo)(()=>s.map(e=>"object"==typeof e&&"id"in e?e.id:e),[s]),j=null!=u,y=u?b.indexOf(u.id):-1,k=f?b.indexOf(f.id):-1,w=(0,n.useRef)(b),C=!function(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}(b,w.current),P=-1!==k&&-1===y||C,_="boolean"==typeof a?{draggable:a,droppable:a}:a;(0,o.useIsomorphicLayoutEffect)(()=>{C&&j&&h(b)},[C,b,j,h]),(0,n.useEffect)(()=>{w.current=b},[b]);let S=(0,n.useMemo)(()=>({activeIndex:y,containerId:p,disabled:_,disableTransforms:P,items:b,overIndex:k,useDragOverlay:x,sortedRects:b.reduce((e,t,n)=>{let r=c.get(t);return r&&(e[n]=r),e},Array(b.length)),strategy:i}),[y,p,_.draggable,_.droppable,P,b,k,c,x,i]);return n.default.createElement(v.Provider,{value:S},t)}let b=e=>{let{id:t,items:n,activeIndex:r,overIndex:s}=e;return d(n,r,s).indexOf(t)},j=e=>{let{containerId:t,isSorting:n,wasDragging:r,index:s,items:i,newIndex:a,previousItems:l,previousContainerId:o,transition:u}=e;return!!u&&!!r&&(l===i||s!==a)&&(!!n||a!==s&&t===o)},y={duration:200,easing:"ease"},k="transform",w=o.CSS.Transition.toString({property:k,duration:0,easing:"linear"}),C={roleDescription:"sortable"};function P(e){var t,r,s,i;let{animateLayoutChanges:a=j,attributes:u,disabled:d,data:f,getNewIndex:h=b,id:m,strategy:p,resizeObserverConfig:g,transition:x=y}=e,{items:P,containerId:_,activeIndex:S,disabled:M,disableTransforms:R,sortedRects:O,overIndex:E,useDragOverlay:I,strategy:z}=(0,n.useContext)(v),N=(t=d,r=M,"boolean"==typeof t?{draggable:t,droppable:!1}:{draggable:null!=(s=null==t?void 0:t.draggable)?s:r.draggable,droppable:null!=(i=null==t?void 0:t.droppable)?i:r.droppable}),T=P.indexOf(m),D=(0,n.useMemo)(()=>({sortable:{containerId:_,index:T,items:P},...f}),[_,f,T,P]),A=(0,n.useMemo)(()=>P.slice(P.indexOf(m)),[P,m]),{rect:q,node:L,isOver:$,setNodeRef:F}=(0,l.useDroppable)({id:m,data:D,disabled:N.droppable,resizeObserverConfig:{updateMeasurementsFor:A,...g}}),{active:U,activatorEvent:B,activeNodeRect:W,attributes:H,setNodeRef:G,listeners:K,isDragging:V,over:X,setActivatorNodeRef:Y,transform:J}=(0,l.useDraggable)({id:m,data:D,attributes:{...C,...u},disabled:N.draggable}),Q=(0,o.useCombinedRefs)(F,G),Z=!!U,ee=Z&&!R&&c(S)&&c(E),et=!I&&V,en=et&&ee?J:null,er=ee?null!=en?en:(null!=p?p:z)({rects:O,activeNodeRect:W,activeIndex:S,overIndex:E,index:T}):null,es=c(S)&&c(E)?h({id:m,items:P,activeIndex:S,overIndex:E}):T,ei=null==U?void 0:U.id,ea=(0,n.useRef)({activeId:ei,items:P,newIndex:es,containerId:_}),el=P!==ea.current.items,eo=a({active:U,containerId:_,isDragging:V,isSorting:Z,id:m,index:T,items:P,newIndex:ea.current.newIndex,previousItems:ea.current.items,previousContainerId:ea.current.containerId,transition:x,wasDragging:null!=ea.current.activeId}),eu=function(e){let{disabled:t,index:r,node:s,rect:i}=e,[a,u]=(0,n.useState)(null),d=(0,n.useRef)(r);return(0,o.useIsomorphicLayoutEffect)(()=>{if(!t&&r!==d.current&&s.current){let e=i.current;if(e){let t=(0,l.getClientRect)(s.current,{ignoreTransform:!0}),n={x:e.left-t.left,y:e.top-t.top,scaleX:e.width/t.width,scaleY:e.height/t.height};(n.x||n.y)&&u(n)}}r!==d.current&&(d.current=r)},[t,r,s,i]),(0,n.useEffect)(()=>{a&&u(null)},[a]),a}({disabled:!eo,index:T,node:L,rect:q});return(0,n.useEffect)(()=>{Z&&ea.current.newIndex!==es&&(ea.current.newIndex=es),_!==ea.current.containerId&&(ea.current.containerId=_),P!==ea.current.items&&(ea.current.items=P)},[Z,es,_,P]),(0,n.useEffect)(()=>{if(ei===ea.current.activeId)return;if(null!=ei&&null==ea.current.activeId){ea.current.activeId=ei;return}let e=setTimeout(()=>{ea.current.activeId=ei},50);return()=>clearTimeout(e)},[ei]),{active:U,activeIndex:S,attributes:H,data:D,rect:q,index:T,newIndex:es,items:P,isOver:$,isSorting:Z,isDragging:V,listeners:K,node:L,overIndex:E,over:X,setNodeRef:Q,setActivatorNodeRef:Y,setDroppableNodeRef:F,setDraggableNodeRef:G,transform:null!=eu?eu:er,transition:eu||el&&ea.current.newIndex===T?w:(!et||(0,o.isKeyboardEvent)(B))&&x&&(Z||eo)?o.CSS.Transition.toString({...x,property:k}):void 0}}l.KeyboardCode.Down,l.KeyboardCode.Right,l.KeyboardCode.Up,l.KeyboardCode.Left,e.s(["SortableContext",0,x,"arrayMove",0,d,"horizontalListSortingStrategy",0,h,"useSortable",0,P,"verticalListSortingStrategy",0,e=>{var t,n,r,s;let i,a,l,{activeIndex:o,activeNodeRect:u,index:d,rects:c,overIndex:f}=e,h=null!=(t=c[o])?t:u;if(!h)return null;if(d===o){let e=c[f];return e?{x:0,y:o<f?e.top+e.height-(h.top+h.height):e.top-h.top,...p}:null}let m=(n=c,r=d,s=o,i=n[r],a=n[r-1],l=n[r+1],i?s<r?a?i.top-(a.top+a.height):l?l.top-(i.top+i.height):0:l?l.top-(i.top+i.height):a?i.top-(a.top+a.height):0:0);return d>o&&d<=f?{x:0,y:-h.height-m,...p}:d<o&&d>=f?{x:0,y:h.height+m,...p}:{x:0,y:0,...p}}],172635);var _=e.i(872937),S=e.i(613349),M=e.i(607711),R=e.i(224950),O=e.i(329686),E=e.i(186339),I=e.i(880932);function z({id:e,disabled:n,...r}){let{attributes:s,listeners:i,setNodeRef:a,transform:l,transition:u,isDragging:d}=P({id:e,disabled:n}),c={transform:o.CSS.Transform.toString(l),transition:u,opacity:d?.5:1};return(0,t.jsx)("div",{ref:a,style:c,className:"inline-flex items-center",...s,...i,children:(0,t.jsx)(N,{id:e,...r})})}function N({name:e,active:n,deleting:r,isDeleting:l,onSelect:o,onRename:u,onDeleteRequest:d,onDeleteCancel:c,onDeleteConfirm:f}){let h="default"===e,m=(0,S.cn)("h-5 px-1.5 rounded-md text-[11px] font-medium inline-flex items-center gap-1 cursor-pointer select-none transition-colors duration-200 shrink-0","active:translate-y-px focus-visible:ring-2 focus-visible:ring-ring/50 outline-none",n?"bg-secondary text-foreground shadow-sm ring-1 ring-foreground/5":"text-muted-foreground hover:text-foreground hover:bg-accent");return h?(0,t.jsxs)("button",{onClick:o,className:m,children:["#",e]}):(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsxs)(R.Popover,{open:r,onOpenChange:e=>{e||c()},children:[(0,t.jsxs)(M.ContextMenu,{children:[(0,t.jsx)(O.TooltipTrigger,{render:(0,t.jsx)(M.ContextMenuTrigger,{className:"inline-flex"}),children:(0,t.jsxs)(R.PopoverTrigger,{render:(0,t.jsx)("button",{onClick:o,className:m}),children:["#",e]})}),(0,t.jsxs)(M.ContextMenuContent,{children:[(0,t.jsxs)(M.ContextMenuItem,{onClick:u,children:[(0,t.jsx)(s,{className:"size-3.5 mr-2"}),"Rename"]}),(0,t.jsx)(M.ContextMenuSeparator,{}),(0,t.jsxs)(M.ContextMenuItem,{onClick:d,className:"text-destructive focus:text-destructive",children:[(0,t.jsx)(i.Trash2,{className:"size-3.5 mr-2"}),"Delete"]})]})]}),(0,t.jsxs)(R.PopoverContent,{className:"w-auto p-3",align:"start",children:[(0,t.jsxs)("p",{className:"text-sm mb-3",children:["Delete “",e,"”? Its conversations will be removed."]}),(0,t.jsxs)("div",{className:"flex gap-2 justify-end",children:[(0,t.jsx)(E.Button,{variant:"ghost",size:"sm",onClick:c,disabled:l,children:"Cancel"}),(0,t.jsxs)(E.Button,{variant:"destructive",size:"sm",onClick:f,disabled:l,children:[l&&(0,t.jsx)(a.Loader2,{className:"size-3 animate-spin mr-1"}),"Delete"]})]})]})]}),(0,t.jsx)(O.TooltipContent,{side:"bottom",children:"Right-click for options"})]})}function T({loading:e,onSave:r,onCancel:s}){let i=(0,n.useRef)(null),l=(0,n.useRef)(!1),[o,u]=(0,n.useState)("");(0,n.useEffect)(()=>{i.current?.focus()},[]);let d=(0,n.useCallback)(()=>{let e=o.trim();e?(l.current=!0,r(e)):s()},[o,r,s]);return(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 shrink-0",children:[(0,t.jsx)("input",{ref:i,value:o,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&d(),"Escape"===e.key&&s()},onBlur:()=>{l.current||s()},disabled:e,placeholder:"name...",className:"h-5 w-24 px-1.5 rounded-md text-[11px] bg-transparent border border-input focus:border-ring focus:ring-2 focus:ring-ring/50 placeholder:text-muted-foreground/50 outline-none shrink-0 disabled:opacity-50"}),e&&(0,t.jsx)(a.Loader2,{className:"size-3 animate-spin text-muted-foreground"})]})}function D({currentName:e,loading:r,onSave:s,onCancel:i}){let a=(0,n.useRef)(null),l=(0,n.useRef)(!1),o=(0,n.useRef)(!1),[u,d]=(0,n.useState)(e);(0,n.useEffect)(()=>{let e=requestAnimationFrame(()=>{a.current?.focus(),a.current?.select(),o.current=!0});return()=>cancelAnimationFrame(e)},[]);let c=(0,n.useCallback)(()=>{let t=u.trim();t&&t!==e?(l.current=!0,s(t)):i()},[u,e,s,i]);return(0,t.jsx)("input",{ref:a,value:u,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"===e.key&&c(),"Escape"===e.key&&i()},onBlur:()=>{o.current&&!l.current&&i()},disabled:r,className:"h-5 w-24 px-1.5 rounded-md text-[11px] bg-transparent border border-input focus:border-ring focus:ring-2 focus:ring-ring/50 outline-none shrink-0 disabled:opacity-50"})}e.s(["ChannelBar",0,function(){let{channels:e,activeChannel:s,loading:i,creating:a,deleting:o,renaming:c,setActiveChannel:f,createChannel:m,renameChannel:p,deleteChannel:g,reorderChannels:v}=(0,_.useChannel)(),[b,j]=(0,n.useState)(!1),[y,k]=(0,n.useState)(null),[w,C]=(0,n.useState)(null),P=(0,l.useSensors)((0,l.useSensor)(l.PointerSensor,{activationConstraint:{distance:5}})),S=e.find(e=>"default"===e.name),M=e.filter(e=>"default"!==e.name),R=(0,n.useCallback)(e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=M.findIndex(e=>e.id===t.id),s=M.findIndex(e=>e.id===n.id);-1===r||-1===s||v(d(M,r,s).map(e=>e.id))},[M,v]);return i?(0,t.jsxs)("div",{className:"h-8 flex items-center gap-1.5 px-2 mb-1 shrink-0",children:[(0,t.jsx)("div",{className:"h-5 w-14 rounded-md bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-5 w-12 rounded-md bg-muted animate-pulse"}),(0,t.jsx)("div",{className:"h-5 w-16 rounded-md bg-muted animate-pulse"})]}):(0,t.jsxs)("div",{className:"h-8 flex items-center gap-1.5 px-4 md:px-5 mb-1 overflow-x-auto thin-scrollbar shrink-0",children:[S&&(0,t.jsx)(N,{id:S.id,name:S.name,active:S.name===s,deleting:!1,isDeleting:!1,onSelect:()=>f(S.name),onRename:()=>{},onDeleteRequest:()=>{},onDeleteCancel:()=>{},onDeleteConfirm:()=>{}}),(0,t.jsx)(l.DndContext,{sensors:P,collisionDetection:l.closestCenter,modifiers:[u],onDragEnd:R,children:(0,t.jsx)(x,{items:M.map(e=>e.id),strategy:h,children:M.map(e=>y===e.id?(0,t.jsx)(D,{currentName:e.name,loading:c===e.id,onSave:async t=>{try{await p(e.id,t)}catch(e){I.toast.error(e instanceof Error?e.message:"Failed to rename")}k(null)},onCancel:()=>k(null)},e.id):(0,t.jsx)(z,{id:e.id,name:e.name,active:e.name===s,deleting:w===e.id,isDeleting:o===e.id,disabled:null!==y,onSelect:()=>f(e.name),onRename:()=>k(e.id),onDeleteRequest:()=>C(e.id),onDeleteCancel:()=>C(null),onDeleteConfirm:async()=>{try{await g(e.id)}catch(e){I.toast.error(e instanceof Error?e.message:"Failed to delete")}C(null)}},e.id))})}),b?(0,t.jsx)(T,{loading:a,onSave:async e=>{try{await m(e),f(e)}catch(e){I.toast.error(e instanceof Error?e.message:"Failed to create")}j(!1)},onCancel:()=>j(!1)}):(0,t.jsxs)(O.Tooltip,{children:[(0,t.jsx)(O.TooltipTrigger,{render:(0,t.jsx)("button",{onClick:()=>j(!0),className:"h-5 w-5 rounded-md border border-dashed border-muted-foreground/30 text-muted-foreground hover:border-foreground/50 hover:text-foreground hover:bg-accent transition-colors duration-200 inline-flex items-center justify-center cursor-pointer shrink-0"}),children:(0,t.jsx)(r.Plus,{className:"size-3"})}),(0,t.jsx)(O.TooltipContent,{side:"bottom",children:"Add New Chatting Channel"})]}),(0,t.jsx)("div",{className:"shrink-0 w-1"})]})}],988232)},252304,e=>{"use strict";var t=e.i(368075),n=e.i(298699),r=e.i(208020),s=e.i(355578),i=e.i(500324),a=e.i(288329),l=e.i(332680);e.i(954194);var o=e.i(439769);e.i(400175);var u=e.i(819748),d=e.i(126366),c=e.i(988232),f=e.i(49879),h=e.i(970019),m=e.i(49695),p=e.i(186339),g=e.i(329686);function v({open:e,onOpenChange:n,agentId:x,agent:b,targetConvId:j,scrollToTaskId:y,scrollToMessageId:k}){let w,C,P,_,S,M,{runtimes:R,activeTaskCounts:O}=(0,s.useAgentContext)(),{slug:E}=(0,i.useWorkspace)(),I=(0,r.useRouter)(),{width:z,onPointerDown:N,onPointerMove:T,onPointerUp:D}=(0,a.useSheetResize)({defaultWidth:480,minWidth:320,maxWidthRatio:.8});return(0,t.jsx)(l.Sheet,{open:e,onOpenChange:n,children:(0,t.jsxs)(l.SheetContent,{side:"right",showCloseButton:!1,style:{width:`min(${z}px, 100vw)`,maxWidth:"none"},className:"data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border flex flex-col",children:[(0,t.jsx)(a.SheetResizeHandle,{onPointerDown:N,onPointerMove:T,onPointerUp:D}),(0,t.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex items-center gap-1",children:[x&&(w=new URLSearchParams,y&&w.set("task",y),k&&w.set("msg",k),j&&w.set("conv",j),C=w.toString(),P=`/w/${E}/agents/${x}${C?`?${C}`:""}`,(0,t.jsxs)(g.Tooltip,{children:[(0,t.jsx)(g.TooltipTrigger,{render:(0,t.jsx)("a",{href:P,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||(e.preventDefault(),n(!1),I.push(P))},className:(0,p.buttonVariants)({variant:"ghost",size:"icon-sm"})}),children:(0,t.jsx)(h.ArrowUpRight,{})}),(0,t.jsx)(g.TooltipContent,{children:"Open full page"})]})),(0,t.jsxs)(l.SheetClose,{render:(0,t.jsx)(p.Button,{variant:"ghost",size:"icon-sm"}),children:[(0,t.jsx)(m.XIcon,{}),(0,t.jsx)("span",{className:"sr-only",children:"Close"})]})]}),(0,t.jsx)(l.SheetHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-3 pr-16",children:[b&&(_=(0,d.parseAvatarUrl)(b.avatar_url),S=R.find(e=>e.id===b.runtime_id),M=S?.status==="online"&&(O[b.id]??0)>0,_?(0,t.jsx)(u.AnimatedAvatar,{config:_,size:28,className:"shrink-0 rounded-lg",isHovered:!1,isWorking:M}):null),(0,t.jsxs)("div",{className:"flex items-baseline gap-2 min-w-0",children:[(0,t.jsx)(l.SheetTitle,{className:"truncate shrink-0",children:b?.name??"Chat"}),b?.email_handle&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:(0,o.toAlookAddress)(b.email_handle)})]})]})}),!j&&(0,t.jsx)("div",{className:"px-4 pb-2",children:(0,t.jsx)(c.ChannelBar,{})}),x&&(0,t.jsx)("div",{className:"flex-1 overflow-hidden flex flex-col",children:(0,t.jsx)(f.AgentChatView,{agentId:x,targetConvId:j,scrollToTaskId:y,scrollToMessageId:k},`${x}-${j??""}`)})]})})}let x=(0,n.createContext)(null);e.s(["AgentChatSheetProvider",0,function({children:e}){let a=(0,r.useRouter)(),{agents:l}=(0,s.useAgentContext)(),{slug:o}=(0,i.useWorkspace)(),[u,d]=(0,n.useState)(!1),[c,f]=(0,n.useState)(null),[h,m]=(0,n.useState)(null),[p,g]=(0,n.useState)(null),[b,j]=(0,n.useState)(null),y=c?l.find(e=>e.id===c)??null:null,k=(0,n.useRef)(l);(0,n.useEffect)(()=>{k.current=l});let w=(0,n.useCallback)((e,t)=>{k.current.find(t=>t.id===e)?(f(e),m(t?.conversationId??null),g(t?.taskId??null),j(t?.messageId??null),d(!0)):a.push(`/w/${o}/agents/${e}`)},[a,o]),C=(0,n.useCallback)(e=>{d(e),e||(m(null),g(null),j(null))},[]);return(0,t.jsxs)(x.Provider,{value:{openAgentChat:w},children:[e,(0,t.jsx)(v,{open:u,onOpenChange:C,agentId:c,agent:y,targetConvId:h,scrollToTaskId:p,scrollToMessageId:b})]})},"useAgentChatSheet",0,function(){let e=(0,n.useContext)(x);if(!e)throw Error("useAgentChatSheet must be used within AgentChatSheetProvider");return e}],252304)},804865,e=>{"use strict";let t=(0,e.i(406963).default)("inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);e.s(["Inbox",0,t],804865)},907903,e=>{"use strict";e.s(["semverGte",0,function(e,t){let n=e.split(".").map(Number),r=t.split(".").map(Number);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]??0,s=r[e]??0;if(t>s)break;if(t<s)return!1}return!0}])},788666,e=>{"use strict";let t=(0,e.i(406963).default)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);e.s(["Folder",0,t],788666)},866519,e=>{"use strict";let t=(0,e.i(406963).default)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);e.s(["LogOut",0,t],866519)},643486,e=>{"use strict";var t=e.i(368075),n=e.i(298699),r=e.i(635790),s=e.i(736956),i=e.i(613349);let a={sm:{icon:28,text:"text-2xl"},lg:{icon:36,text:"text-4xl"}};e.s(["Logo",0,function({size:e="sm",className:l,iconOnly:o=!1}){let{icon:u,text:d}=a[e],{resolvedTheme:c,setTheme:f}=(0,r.useTheme)(),[h,m]=(0,n.useState)(!1),p=(0,n.useRef)(m);return(0,n.useEffect)(()=>{p.current(!0)},[]),(0,t.jsxs)("button",{type:"button",onClick:()=>{f("dark"===c?"light":"dark")},"aria-label":"Toggle theme",className:(0,i.cn)("flex items-center gap-1.5 cursor-pointer select-none transition-opacity hover:opacity-70",l),children:[h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.default,{src:"/alook.svg",alt:"Alook",width:u,height:u,className:"dark:hidden"}),(0,t.jsx)(s.default,{src:"/alook-dark.svg",alt:"Alook",width:u,height:u,className:"hidden dark:block"})]}):(0,t.jsx)("span",{style:{width:u,height:u}}),!o&&(0,t.jsx)("span",{className:(0,i.cn)(d,"font-black tracking-tight"),style:{fontFamily:"var(--font-brand)"},children:"Alook"})]})}])},640565,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"BailoutToCSR",{enumerable:!0,get:function(){return s}});let r=e.r(350947);function s({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new r.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},454320,(e,t,n)=>{"use strict";function r(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"encodeURIPath",{enumerable:!0,get:function(){return r}})},220095,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"PreloadChunks",{enumerable:!0,get:function(){return o}});let r=e.r(368075),s=e.r(550008),i=e.r(408669),a=e.r(454320),l=e.r(641894);function o({moduleIds:e}){if("u">typeof window)return null;let t=i.workAsyncStorage.getStore();if(void 0===t)return null;let n=[];if(t.reactLoadableManifest&&e){let r=t.reactLoadableManifest;for(let t of e){if(!r[t])continue;let e=r[t].files;n.push(...e)}}if(0===n.length)return null;let u=(0,l.getAssetTokenQuery)();return(0,r.jsx)(r.Fragment,{children:n.map(e=>{let n=`${t.assetPrefix}/_next/${(0,a.encodeURIPath)(e)}${u}`;return e.endsWith(".css")?(0,r.jsx)("link",{precedence:"dynamic",href:n,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,s.preload)(n,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},790961,e=>{"use strict";var t=e.i(298699);let n="alook-home-pet-settings-changed",r="alook-home-pet-enabled-v1",s={enabled:!1};function i(){let e=window.localStorage.getItem(r);return{enabled:null===e?s.enabled:"true"===e}}e.s(["readHomePetSettings",0,i,"useHomePetSettings",0,function(){let[e,a]=(0,t.useState)(s);return(0,t.useEffect)(()=>{a(i());let e=e=>{a(e.detail??i())},t=e=>{e.key===r&&a(i())};return window.addEventListener(n,e),window.addEventListener("storage",t),()=>{window.removeEventListener(n,e),window.removeEventListener("storage",t)}},[]),e},"writeHomePetSettings",0,function(e){let t={...i(),...e};return window.localStorage.setItem(r,String(t.enabled)),window.dispatchEvent(new CustomEvent(n,{detail:t})),t}])},808991,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return u}});let r=e.r(368075),s=e.r(298699),i=e.r(640565),a=e.r(220095);function l(e){return{default:e&&"default"in e?e.default:e}}let o={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},u=function(e){let t={...o,...e},n=(0,s.lazy)(()=>t.loader().then(l)),u=t.loading;function d(e){let l=u?(0,r.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,o=!t.ssr||!!t.loading,d=o?s.Suspense:s.Fragment,c=t.ssr?(0,r.jsxs)(r.Fragment,{children:["u"<typeof window?(0,r.jsx)(a.PreloadChunks,{moduleIds:t.modules}):null,(0,r.jsx)(n,{...e})]}):(0,r.jsx)(i.BailoutToCSR,{reason:"next/dynamic",children:(0,r.jsx)(n,{...e})});return(0,r.jsx)(d,{...o?{fallback:l}:{},children:c})}return d.displayName="LoadableComponent",d}},422940,(e,t,n)=>{"use strict";Object.defineProperty(n,"__esModule",{value:!0}),Object.defineProperty(n,"default",{enumerable:!0,get:function(){return s}});let r=e.r(481258)._(e.r(808991));function s(e,t){let n={};"function"==typeof e&&(n.loader=e);let s={...n,...t};return(0,r.default)({...s,modules:s.loadableGenerated?.modules})}("function"==typeof n.default||"object"==typeof n.default&&null!==n.default)&&void 0===n.default.__esModule&&(Object.defineProperty(n.default,"__esModule",{value:!0}),Object.assign(n.default,n),t.exports=n.default)},89164,e=>{"use strict";var t=e.i(368075),n=e.i(913129),r=e.i(613349);e.i(907361),e.i(26165),e.s(["DropdownMenu",0,function({...e}){return(0,t.jsx)(n.Menu.Root,{"data-slot":"dropdown-menu",...e})},"DropdownMenuContent",0,function({align:e="start",alignOffset:s=0,side:i="bottom",sideOffset:a=4,className:l,...o}){return(0,t.jsx)(n.Menu.Portal,{children:(0,t.jsx)(n.Menu.Positioner,{className:"isolate z-50 outline-none",align:e,alignOffset:s,side:i,sideOffset:a,children:(0,t.jsx)(n.Menu.Popup,{"data-slot":"dropdown-menu-content",className:(0,r.cn)("z-50 max-h-(--available-height) w-(--anchor-width) min-w-32 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-lg bg-popover p-1 text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 outline-none data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:overflow-hidden data-closed:fade-out-0 data-closed:zoom-out-95",l),...o})})})},"DropdownMenuGroup",0,function({...e}){return(0,t.jsx)(n.Menu.Group,{"data-slot":"dropdown-menu-group",...e})},"DropdownMenuItem",0,function({className:e,inset:s,variant:i="default",...a}){return(0,t.jsx)(n.Menu.Item,{"data-slot":"dropdown-menu-item","data-inset":s,"data-variant":i,className:(0,r.cn)("group/dropdown-menu-item relative flex cursor-default items-center gap-1.5 rounded-md px-1.5 py-1 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground not-data-[variant=destructive]:focus:**:text-accent-foreground data-inset:pl-7 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[variant=destructive]:*:[svg]:text-destructive",e),...a})},"DropdownMenuLabel",0,function({className:e,inset:s,...i}){return(0,t.jsx)(n.Menu.GroupLabel,{"data-slot":"dropdown-menu-label","data-inset":s,className:(0,r.cn)("px-1.5 py-1 text-xs font-medium text-muted-foreground data-inset:pl-7",e),...i})},"DropdownMenuSeparator",0,function({className:e,...s}){return(0,t.jsx)(n.Menu.Separator,{"data-slot":"dropdown-menu-separator",className:(0,r.cn)("-mx-1 my-1 h-px bg-border",e),...s})},"DropdownMenuTrigger",0,function({...e}){return(0,t.jsx)(n.Menu.Trigger,{"data-slot":"dropdown-menu-trigger",...e})}],89164)},73020,e=>{e.v(t=>Promise.all(["static/chunks/0986redjt8pwn.js"].map(t=>e.l(t))).then(()=>t(645983)))},270965,e=>{e.v(t=>Promise.all(["static/chunks/10j1hlgv.0ha8.js"].map(t=>e.l(t))).then(()=>t(750240)))},897083,e=>{e.v(t=>Promise.all(["static/chunks/05k4sobb28kt8.js"].map(t=>e.l(t))).then(()=>t(113488)))},274989,e=>{e.v(t=>Promise.all(["static/chunks/12hbx3ww7tsh~.js","static/chunks/0rm2nk__9~zed.js","static/chunks/0jln521y8xq.w.js"].map(t=>e.l(t))).then(()=>t(71485)))},619639,e=>{e.v(t=>Promise.all(["static/chunks/0_luzqd0pcc1_.js","static/chunks/0y84__7toiptb.js"].map(t=>e.l(t))).then(()=>t(163939)))},313201,e=>{e.v(t=>Promise.all(["static/chunks/0o851ow-aw-ca.js","static/chunks/07857g~8n7hi1.js"].map(t=>e.l(t))).then(()=>t(778154)))},202703,e=>{e.v(t=>Promise.all(["static/chunks/0nb.0rtnf4amk.js","static/chunks/0yq7j3u51d84-.js"].map(t=>e.l(t))).then(()=>t(261717)))},475824,e=>{e.v(t=>Promise.all(["static/chunks/15ssj-c8bachx.js"].map(t=>e.l(t))).then(()=>t(432997)))},209245,e=>{e.v(t=>Promise.all(["static/chunks/0w0lyqfn3xmg~.js","static/chunks/0hn5gekdpaaod.js","static/chunks/13sdvq-t3pxa8.js"].map(t=>e.l(t))).then(()=>t(971693)))},31795,e=>{e.v(t=>Promise.all(["static/chunks/0zbb93llopi6s.js","static/chunks/02~5ppnggwqks.js"].map(t=>e.l(t))).then(()=>t(701263)))},136922,e=>{e.v(t=>Promise.all(["static/chunks/0hu58uogos3...js","static/chunks/0hn5gekdpaaod.js","static/chunks/0w0lyqfn3xmg~.js"].map(t=>e.l(t))).then(()=>t(910393)))},927676,e=>{e.v(t=>Promise.all(["static/chunks/0titzj8m6w9kt.js","static/chunks/0hn5gekdpaaod.js","static/chunks/0w0lyqfn3xmg~.js"].map(t=>e.l(t))).then(()=>t(203233)))},976014,e=>{e.v(t=>Promise.all(["static/chunks/1098~xaryt2c9.js"].map(t=>e.l(t))).then(()=>t(501398)))},148963,e=>{e.v(t=>Promise.all(["static/chunks/0f~5jld4.hprh.js","static/chunks/0iks~0p4ys_l3.js"].map(t=>e.l(t))).then(()=>t(941311)))},6986,e=>{e.v(t=>Promise.all(["static/chunks/0i.28mn8.gvqk.js"].map(t=>e.l(t))).then(()=>t(492862)))},610535,e=>{e.v(t=>Promise.all(["static/chunks/0t~px.x10zo6v.js","static/chunks/0osss~uun~ycb.js"].map(t=>e.l(t))).then(()=>t(31839)))},671557,e=>{e.v(t=>Promise.all(["static/chunks/0lzyir43u7901.js","static/chunks/0183ht940ic-0.js"].map(t=>e.l(t))).then(()=>t(432452)))},504907,e=>{e.v(t=>Promise.all(["static/chunks/13sxbbv4njq-4.js","static/chunks/0183ht940ic-0.js"].map(t=>e.l(t))).then(()=>t(321377)))},149263,e=>{e.v(t=>Promise.all(["static/chunks/12hbx3ww7tsh~.js","static/chunks/07i_5~k3hfns2.js","static/chunks/0ahwky2xalazj.js","static/chunks/0rm2nk__9~zed.js"].map(t=>e.l(t))).then(()=>t(674237)))},712767,e=>{e.v(t=>Promise.all(["static/chunks/02v6rpb65n216.js","static/chunks/0ahwky2xalazj.js"].map(t=>e.l(t))).then(()=>t(362812)))},328987,e=>{e.v(t=>Promise.all(["static/chunks/0wiguffsm06ip.js"].map(t=>e.l(t))).then(()=>t(841507)))},351764,e=>{e.v(t=>Promise.all(["static/chunks/0.9q3a5xj9d1t.js"].map(t=>e.l(t))).then(()=>t(241012)))},317698,e=>{e.v(t=>Promise.all(["static/chunks/0txme8wtiske~.js"].map(t=>e.l(t))).then(()=>t(692719)))},385629,e=>{e.v(t=>Promise.all(["static/chunks/17m5t1-k0lcs2.js"].map(t=>e.l(t))).then(()=>t(974554)))},555021,e=>{e.v(t=>Promise.all(["static/chunks/0trlpcnpm94qg.js"].map(t=>e.l(t))).then(()=>t(98532)))},412540,e=>{e.v(t=>Promise.all(["static/chunks/0lr05q7172rv9.js","static/chunks/0hn5gekdpaaod.js","static/chunks/0w0lyqfn3xmg~.js"].map(t=>e.l(t))).then(()=>t(74004)))},899471,e=>{e.v(t=>Promise.all(["static/chunks/0h18sqhwmeout.js","static/chunks/0hn5gekdpaaod.js","static/chunks/0w0lyqfn3xmg~.js"].map(t=>e.l(t))).then(()=>t(289778)))},818422,e=>{e.v(t=>Promise.all(["static/chunks/0hkqtgo24-.un.js","static/chunks/02c6o0ho01qor.js","static/chunks/0-r9q_wknokco.js"].map(t=>e.l(t))).then(()=>t(550349)))},172936,e=>{e.v(t=>Promise.all(["static/chunks/137e-vtfdk7hs.js","static/chunks/0hn5gekdpaaod.js","static/chunks/0w0lyqfn3xmg~.js"].map(t=>e.l(t))).then(()=>t(614141)))},909838,e=>{e.v(t=>Promise.all(["static/chunks/0okz0tgzynt8h.js","static/chunks/0w0lyqfn3xmg~.js","static/chunks/0hn5gekdpaaod.js","static/chunks/0y84__7toiptb.js","static/chunks/0l8d1ppell5lx.js"].map(t=>e.l(t))).then(()=>t(553743)))},37014,e=>{e.v(t=>Promise.all(["static/chunks/0xf4u24s44gq9.js"].map(t=>e.l(t))).then(()=>t(557982)))},900698,e=>{e.v(t=>Promise.all(["static/chunks/01ywkhrncpbb9.js"].map(t=>e.l(t))).then(()=>t(46486)))},846133,e=>{e.v(t=>Promise.all(["static/chunks/0w0lyqfn3xmg~.js","static/chunks/0hn5gekdpaaod.js","static/chunks/13720d78w.39k.js"].map(t=>e.l(t))).then(()=>t(170696)))},898971,e=>{e.v(t=>Promise.all(["static/chunks/0w0lyqfn3xmg~.js","static/chunks/0hn5gekdpaaod.js","static/chunks/0kczi_iy-p~eg.js"].map(t=>e.l(t))).then(()=>t(502195)))},967422,e=>{e.v(t=>Promise.all(["static/chunks/06qocotzg37jt.css","static/chunks/0kl0qlrmp9w8y.js","static/chunks/12-46-26c1v9n.js","static/chunks/118ani.qejoy9.js"].map(t=>e.l(t))).then(()=>t(928210)))}]);
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,74348,e=>{"use strict";var t=e.i(368075),s=e.i(298699),a=e.i(222862),r=e.i(500324);let n=(0,s.createContext)(null);e.s(["FlagCountProvider",0,function({children:e}){let{workspaceId:l}=(0,r.useWorkspace)(),[i,o]=(0,s.useState)(0),c=(0,s.useCallback)(()=>{(0,a.getFlaggedCount)(l).then(e=>o(e.count)).catch(()=>{})},[l]),d=(0,s.useCallback)(()=>{o(e=>e+1)},[]),u=(0,s.useCallback)(()=>{o(e=>Math.max(0,e-1))},[]);return(0,s.useEffect)(()=>{c()},[c]),(0,t.jsx)(n.Provider,{value:{count:i,refresh:c,increment:d,decrement:u},children:e})},"useFlagCount",0,function(){let e=(0,s.useContext)(n);if(!e)throw Error("useFlagCount must be used within FlagCountProvider");return e}])},49879,618615,844010,e=>{"use strict";e.s(["AgentChatView",()=>e$,"getEventIconType",()=>eA],49879);var t=e.i(368075),s=e.i(298699),a=e.i(550008),r=e.i(208020),n=e.i(500324),l=e.i(186339),i=e.i(875061),o=e.i(613349),c=e.i(64873),d=e.i(371522);e.i(112946);var u=e.i(164300),m=e.i(418277),f=e.i(72852),h=e.i(108281),g=e.i(140483);let p={claude:"Claude Code",codex:"Codex",opencode:"OpenCode"},x="the agent runtime";function v({provider:e,message:a,onRetry:r,retrying:n}){let[l,i]=(0,s.useState)(!1),o=n??l,c=async()=>{if(r){i(!0);try{await r()}finally{i(!1)}}};return(0,t.jsxs)("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 p-2 max-w-full overflow-hidden",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsxs)("p",{className:"flex items-center gap-1.5 text-sm font-semibold text-destructive min-w-0",children:[(0,t.jsx)(h.AlertCircle,{className:"size-3.5 shrink-0"}),(0,t.jsxs)("span",{children:["Error from ",e?p[e]??x:x]})]}),r&&(0,t.jsxs)("button",{type:"button",onClick:c,disabled:o,className:"ml-auto shrink-0 text-xs text-muted-foreground hover:text-foreground transition-colors cursor-pointer disabled:opacity-50 flex items-center gap-1",children:[o?(0,t.jsx)(d.Loader2,{className:"size-3 animate-spin"}):(0,t.jsx)(g.RotateCw,{className:"size-3"}),"Retry"]})]}),(0,t.jsx)("p",{className:"mt-1.5 text-sm text-destructive/90 wrap-anywhere whitespace-pre-wrap",children:a}),(0,t.jsx)("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"This came from the agent runtime on your machine, not from Alook."})]})}function k({value:e}){let a=(0,s.useRef)(e),[r,n]=(0,s.useState)({current:e,previous:null}),[l,i]=(0,s.useState)("idle");return(0,s.useEffect)(()=>{if(e===a.current)return;let t=a.current;a.current=e,n({current:e,previous:t}),requestAnimationFrame(()=>{requestAnimationFrame(()=>{i("animating")})});let s=setTimeout(()=>{i("idle"),n(e=>({...e,previous:null}))},300);return()=>clearTimeout(s)},[e]),(0,t.jsxs)("span",{style:{display:"inline-block",position:"relative",overflow:"hidden",height:"1.2em",lineHeight:"1.2em",verticalAlign:"bottom"},children:[null!==r.previous&&(0,t.jsx)("span",{style:{display:"block",position:"absolute",inset:"0",transition:"animating"===l?"transform 250ms ease-out, opacity 250ms ease-out":"none",transform:"animating"===l?"translateY(-100%)":"translateY(0)",opacity:+("animating"!==l)},children:r.previous}),(0,t.jsx)("span",{style:{display:"block",transition:"animating"===l?"transform 250ms ease-out, opacity 250ms ease-out":"none",transform:null!==r.previous&&"animating"!==l?"translateY(100%)":"translateY(0)",opacity:+(null===r.previous||"animating"===l)},children:r.current})]})}function b({task:e,messages:a,connectionLost:r,onRetry:n,thinkingCountHint:l,onExpandThinking:h,thinkingLoading:g,provider:p}){let x=(0,s.useMemo)(()=>(function(e){let t=[];for(let s of e){let e=s.id||`seq-${s.seq}`;"text"===s.type?t.push({kind:"text",id:e,content:s.content}):"error"===s.type&&t.push({kind:"error",id:e,content:s.content||s.output})}return t})(a),[a]),j="completed"!==e.status&&"failed"!==e.status&&"cancelled"!==e.status&&"superseded"!==e.status,y=x.filter(e=>"text"===e.kind),w=x.filter(e=>"error"===e.kind),N=y.length>0?y[y.length-1]:null,C=(0,s.useRef)(null),_=(0,s.useRef)(!1);(0,s.useEffect)(()=>{j&&C.current&&(C.current.scrollTop=C.current.scrollHeight)},[y.length,j]);let S=j?y:y.slice(0,-1),T=!j&&null!==N,M=S.length>0||l&&l>0,I=S.length>0?S.length:l??0;return(0,t.jsxs)("div",{className:"space-y-3 min-w-0 max-w-full",children:[!h&&(0,t.jsx)("div",{className:"flex items-center gap-2",children:"running"===e.status?(0,t.jsxs)(i.Badge,{variant:"secondary",className:"gap-1.5 relative overflow-hidden",children:[(0,t.jsx)("span",{className:"size-1.5 rounded-full bg-primary animate-pulse"}),"Working",(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 -translate-x-full animate-[shimmer_2s_ease-in-out_infinite]",style:{background:"linear-gradient(90deg, transparent 0%, var(--shimmer) 40%, var(--shimmer-peak) 50%, var(--shimmer) 60%, transparent 100%)"}})]}):j?(0,t.jsxs)(i.Badge,{variant:"secondary",className:"relative overflow-hidden",children:[e.status,(0,t.jsx)("div",{className:"pointer-events-none absolute inset-0 -translate-x-full animate-[shimmer_2s_ease-in-out_infinite]",style:{background:"linear-gradient(90deg, transparent 0%, var(--shimmer) 40%, var(--shimmer-peak) 50%, var(--shimmer) 60%, transparent 100%)"}})]}):(0,t.jsx)(i.Badge,{variant:"secondary",children:e.status})}),M&&(0,t.jsxs)("details",{className:"group/midtext pl-1",open:!T&&!h||void 0,onToggle:e=>{e.currentTarget.open&&!_.current&&h&&(_.current=!0,h())},children:[(0,t.jsxs)("summary",{className:(0,o.cn)("flex items-center gap-1.5 py-1 cursor-pointer select-none","text-xs text-muted-foreground transition-colors duration-150","hover:text-foreground","[&::-webkit-details-marker]:hidden [&::marker]:hidden"),children:[(0,t.jsx)(c.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/60 transition-transform duration-150 group-open/midtext:rotate-90"}),(0,t.jsxs)("span",{children:[(0,t.jsx)(k,{value:I})," thinking"]})]}),(0,t.jsxs)("div",{ref:C,className:"mt-1 pl-1",children:[g&&0===S.length&&(0,t.jsxs)("div",{className:"flex items-center gap-2 py-2 text-xs text-muted-foreground",children:[(0,t.jsx)(d.Loader2,{className:"size-3 animate-spin"}),(0,t.jsx)("span",{children:"Loading..."})]}),S.map(e=>(0,t.jsx)("div",{className:"markdown max-w-full min-w-0 px-1 text-sm text-muted-foreground",children:(0,t.jsx)(u.Streamdown,{plugins:{mermaid:m.mermaid,cjk:f.cjk},controls:{code:{copy:!0,download:!1},table:{copy:!0,download:!1,fullscreen:!0}},linkSafety:{enabled:!1},children:e.content})},e.id))]})]}),T&&!h&&(0,t.jsx)("div",{className:"markdown max-w-full min-w-0 px-1 py-1 text-base text-foreground",children:(0,t.jsx)(u.Streamdown,{plugins:{mermaid:m.mermaid,cjk:f.cjk},controls:{code:{copy:!0,download:!1},table:{copy:!0,download:!1,fullscreen:!0}},linkSafety:{enabled:!1},children:N.content})}),w.length>0&&(0,t.jsx)("div",{className:"space-y-1 mt-1",children:w.map(e=>(0,t.jsx)(v,{provider:p,message:e.content},e.id))}),"failed"===e.status&&e.error&&(0,t.jsx)("div",{className:"mt-2",children:(0,t.jsx)(v,{provider:p,message:e.error,onRetry:n})}),r&&(0,t.jsx)("p",{className:"text-sm text-muted-foreground animate-pulse mt-1",children:"Connection lost — retrying..."})]})}var j=e.i(222862),y=e.i(275351),w=e.i(355578),N=e.i(875494),C=e.i(74348),_=e.i(872937),S=e.i(880932),T=e.i(728886),M=e.i(329686),I=e.i(36303),E=e.i(406963);let A=(0,E.default)("bed-double",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);var z=e.i(872057),R=e.i(6131);let D=(0,E.default)("message-square-quote",[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]]);var L=e.i(653216),F=e.i(554468),P=e.i(745925),$=e.i(937091);function q({skill:e,isSelected:s,onSelect:a}){return(0,t.jsxs)("button",{type:"button","data-slash-item":!0,className:(0,o.cn)("flex w-full flex-col gap-0.5 px-3 py-1.5 text-left text-sm transition-colors",s?"bg-accent text-accent-foreground":"hover:bg-accent/50"),onMouseDown:t=>{t.preventDefault(),a(e)},children:[(0,t.jsxs)("span",{className:"flex w-full items-center gap-2",children:[(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate font-medium",children:["/",e.name]}),e.isGlobal&&(0,t.jsx)("span",{className:"shrink-0 rounded px-1 py-0.5 text-[10px] font-medium bg-muted text-muted-foreground",children:"Global"})]}),e.description&&(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:e.description.slice(0,80)})]})}function B({isOpen:e,skills:r,selectedIndex:n,onSelect:l,anchorPos:i}){let o=(0,s.useRef)(null);if((0,s.useEffect)(()=>{if(!o.current)return;let e=o.current.querySelectorAll("[data-slash-item]")[n];e?.scrollIntoView({block:"nearest"})},[n]),!e||0===r.length)return null;let c=Math.max(8,window.innerWidth-280-8),d=Math.min(i.left,c);return(0,a.createPortal)((0,t.jsx)("div",{className:"fixed z-100 w-70 rounded-lg border border-border bg-popover text-popover-foreground shadow-md transition-opacity duration-150",style:{top:i.top-4,left:d,transform:"translateY(-100%)"},children:(0,t.jsx)("div",{ref:o,className:"max-h-60 overflow-y-auto py-1 thin-scrollbar",children:r.map((e,s)=>(0,t.jsx)(q,{skill:e,isSelected:s===n,onSelect:l},e.name))})}),document.body)}var O=e.i(944391),H=e.i(415708),W=e.i(842892),U=e.i(333556);function V(e,t){if(!t)return e;let s=t.toLowerCase(),a=[],r=[];for(let t of e){let e=t.name.toLowerCase();e.startsWith(s)?a.push(t):e.includes(s)&&r.push(t)}return[...a,...r]}var K=e.i(161767);function Y(e){return e.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&")}e.i(954194);var X=e.i(439769);let G={items:[],selectedIndex:0,command:null,rect:null};function J({state:e}){let r=(0,s.useRef)(null),{items:n,selectedIndex:l,command:i,rect:c}=e;if((0,s.useEffect)(()=>{if(!r.current)return;let e=r.current.children[l];e?.scrollIntoView({block:"nearest"})},[l]),!c||0===n.length||!i)return null;let d=Math.max(8,window.innerWidth-256-8),u=Math.min(c.left,d);return(0,a.createPortal)((0,t.jsx)("div",{className:"fixed z-100 w-64 rounded-lg border border-border bg-popover text-popover-foreground shadow-md",style:{top:c.top-4,left:u,transform:"translateY(-100%)"},children:(0,t.jsx)("div",{ref:r,className:"max-h-50 overflow-y-auto py-1 thin-scrollbar",children:n.map((e,s)=>(0,t.jsxs)("button",{type:"button",className:(0,o.cn)("flex w-full items-center gap-2 px-3 py-1.5 text-left text-sm transition-colors",s===l?"bg-accent text-accent-foreground":"hover:bg-accent/50"),onMouseDown:t=>{t.preventDefault(),i({id:e.id,label:e.name})},children:[(0,t.jsx)("span",{className:"truncate font-medium",children:e.name}),e.email_handle&&(0,t.jsx)("span",{className:"truncate text-xs text-muted-foreground",children:(0,X.toAlookAddress)(e.email_handle)})]},e.id))})}),document.body)}let Q=(0,s.forwardRef)(function({value:e,onChange:a,onEditorState:r,onSend:n,placeholder:l,disabled:i,onMultiLineChange:o,onFiles:c,agents:d,agentLinks:u,currentAgentId:m,slashIsOpen:f,onSlashKeyDown:h},g){let[p,x]=(0,s.useState)(!1),[v,k]=(0,s.useState)(G),b=(0,s.useRef)(v);(0,s.useEffect)(()=>{b.current=v},[v]);let j=(0,s.useRef)(d),y=(0,s.useRef)(u),w=(0,s.useRef)(m),N=(0,s.useRef)(n),C=(0,s.useRef)(r),_=(0,s.useRef)(a),S=(0,s.useRef)(c),T=(0,s.useRef)(f),M=(0,s.useRef)(h);(0,s.useEffect)(()=>{j.current=d},[d]),(0,s.useEffect)(()=>{y.current=u},[u]),(0,s.useEffect)(()=>{w.current=m},[m]),(0,s.useEffect)(()=>{N.current=n},[n]),(0,s.useEffect)(()=>{C.current=r},[r]),(0,s.useEffect)(()=>{_.current=a},[a]),(0,s.useEffect)(()=>{S.current=c},[c]),(0,s.useEffect)(()=>{T.current=f},[f]),(0,s.useEffect)(()=>{M.current=h},[h]);let I=e=>{C.current(e.getText(),e.state.selection.from-1)},[E]=(0,s.useState)(()=>K.default.extend({markdownName:"mention",renderMarkdown:e=>`@${e.attrs.label??e.attrs.id}`}).configure({HTMLAttributes:{class:"mention-highlight"},renderText:({node:e})=>`@${e.attrs.label??e.attrs.id}`,suggestion:{char:"@",items:({query:e})=>(function(e,t,s,a,r=20){let n=function(e,t){let s=new Set;for(let a of e)a.source_agent_id===t&&s.add(a.target_agent_id),a.target_agent_id===t&&s.add(a.source_agent_id);return s}(t,s),l=[],i=[];for(let t of e)n.has(t.id)?l.push(t):i.push(t);return[...V(l,a),...V(i,a)].slice(0,r)})(j.current,y.current,w.current,e),render:()=>({onStart:e=>{k({items:e.items??[],selectedIndex:0,command:e.command,rect:e.clientRect?.()??null})},onUpdate:e=>{k(t=>({items:e.items??[],selectedIndex:t.selectedIndex<(e.items?.length??0)?t.selectedIndex:0,command:e.command,rect:e.clientRect?.()??null}))},onKeyDown:({event:e})=>{if(e.isComposing)return!1;let t=b.current;if(0===t.items.length)return!1;if("ArrowDown"===e.key)return e.preventDefault(),k(e=>({...e,selectedIndex:(e.selectedIndex+1)%e.items.length})),!0;if("ArrowUp"===e.key)return e.preventDefault(),k(e=>({...e,selectedIndex:(e.selectedIndex-1+e.items.length)%e.items.length})),!0;if("Enter"===e.key){e.preventDefault();let s=t.items[t.selectedIndex];return s&&t.command&&t.command({id:s.id,label:s.name}),k(G),!0}return"Escape"===e.key&&(k(G),!0)},onExit:()=>k(G)})}})),A=(0,O.useEditor)({immediatelyRender:!1,content:e?e.replaceAll("\n","<br>"):void 0,editable:!i,extensions:[H.default.configure({heading:!1,blockquote:!1,codeBlock:!1,horizontalRule:!1,bold:!1,italic:!1,strike:!1,code:!1,link:!1,bulletList:!1,orderedList:!1,listItem:!1,listKeymap:!1}),W.default.configure({placeholder:l??""}),U.Markdown,E],editorProps:{attributes:{class:"outline-none",enterkeyhint:"send"},handleKeyDown:(e,t)=>(!(b.current.items.length>0)||null===b.current.command)&&(!!(T.current&&M.current({key:t.key,isComposing:t.isComposing,preventDefault:()=>t.preventDefault()}))||"Enter"===t.key&&!t.shiftKey&&!t.isComposing&&!T.current&&(t.preventDefault(),N.current(),!0)),handlePaste:(e,t)=>{let s=t.clipboardData?.items;if(!s)return!1;let a=[];for(let e=0;e<s.length;e++)if("file"===s[e].kind){let t=s[e].getAsFile();t&&a.push(t)}if(a.length>0)return t.preventDefault(),S.current?.(a),!0;let r=t.clipboardData?.getData("text/plain");return!!r&&(t.preventDefault(),e.dispatch(e.state.tr.insertText(r)),!0)},handleDrop:()=>!1},onFocus:()=>x(!0),onBlur:()=>x(!1),onUpdate:({editor:e})=>{_.current(Y(e.getMarkdown())),I(e)},onSelectionUpdate:({editor:e})=>{I(e)}});(0,s.useEffect)(()=>{A?.setEditable(!i)},[A,i]),(0,s.useEffect)(()=>{if(!A)return;let t=(e||"").trim();t!==Y(A.getMarkdown()||"").trim()&&(t?A.commands.setContent((e||"").replaceAll("\n","<br>"),{emitUpdate:!1}):A.commands.clearContent(),C.current(A.getText(),A.state.selection.from-1))},[e,A]);let z=(0,s.useRef)(null);return(0,s.useEffect)(()=>{if(!A||!o)return;let e=z.current?.querySelector(".ProseMirror");if(!e)return;let t=()=>o(e.scrollHeight>32);t();let s=new ResizeObserver(t);return s.observe(e),()=>s.disconnect()},[A,o]),(0,s.useEffect)(()=>{let e=function(e,t){let s=navigator.virtualKeyboard;if(!s)return null;s.overlaysContent=!0;let a=e()?.closest("[data-keyboard-offset]");if(!a)return null;let r=()=>{if(!t){a.style.transform="",a.removeAttribute("data-keyboard-active");return}let{height:e}=s.boundingRect;e>0?(a.style.transform=`translateY(-${e}px)`,a.setAttribute("data-keyboard-active","")):(a.style.transform="",a.removeAttribute("data-keyboard-active"))};return s.addEventListener("geometrychange",r),()=>{s.removeEventListener("geometrychange",r),a.style.transform="",a.removeAttribute("data-keyboard-active"),s.overlaysContent=!1}}(()=>z.current,p);return e||(function(e,t){let s,a=window.visualViewport;if(!a)return null;let{handler:r,cleanup:n}={handler:()=>{t&&(clearTimeout(s),s=setTimeout(()=>{let t=e();if(!t)return;let s=window.visualViewport;if(!s)return void t.scrollIntoView({block:"end",behavior:"smooth"});let a=window.innerHeight-s.height,r=t.closest("[data-keyboard-offset]");if(r&&a>0){let e=r.getBoundingClientRect().bottom-s.height-s.offsetTop;e>0?(r.style.transform=`translateY(-${e}px)`,r.setAttribute("data-keyboard-active","")):(r.style.transform="",r.removeAttribute("data-keyboard-active"))}else r?(r.style.transform="",r.removeAttribute("data-keyboard-active")):t.scrollIntoView({block:"end",behavior:"smooth"})},150))},cleanup:()=>{clearTimeout(s);let t=e();if(!t)return;let a=t.closest("[data-keyboard-offset]");a&&(a.style.transform="",a.removeAttribute("data-keyboard-active"))}};return a.addEventListener("resize",r),a.addEventListener("scroll",r),()=>{a.removeEventListener("resize",r),a.removeEventListener("scroll",r),n()}}(()=>z.current,p)??void 0)},[z,p]),(0,s.useImperativeHandle)(g,()=>({focus:()=>A?.commands.focus(),clear:()=>A?.commands.clearContent(),isEmpty:()=>A?.isEmpty??!0,coordsAtTextIndex:e=>{if(!A)return null;try{let t=A.view.coordsAtPos(e+1);return{top:t.top,left:t.left}}catch{return null}}}),[A]),(0,t.jsxs)("div",{ref:z,className:"chat-composer relative",children:[(0,t.jsx)(O.EditorContent,{editor:A,className:"max-h-44 overflow-y-auto thin-scrollbar pr-2 text-base chat-input-line-height"}),(0,t.jsx)(J,{state:v})]})});var Z=e.i(721387),ee=e.i(288329),et=e.i(332680),es=e.i(535991),ea=e.i(940931);function er({open:e,onOpenChange:a,emailId:r,workspaceId:n}){let[i,o]=(0,s.useState)(null),[c,u]=(0,s.useState)(null),[m,f]=(0,s.useState)(!1),{width:h,onPointerDown:g,onPointerMove:p,onPointerUp:x}=(0,ee.useSheetResize)({defaultWidth:500,minWidth:320,maxWidthRatio:.8}),v=(0,s.useRef)(a);(0,s.useEffect)(()=>{v.current=a}),(0,s.useEffect)(()=>{e&&r&&(f(!0),o(null),u(null),Promise.all([(0,j.getEmail)(r,n),(0,j.getEmailBody)(r,n)]).then(([e,t])=>{o(e),u(t)}).catch(()=>{S.toast.error("Email not found"),v.current(!1)}).finally(()=>f(!1)))},[e,r,n]);let k=e=>{a(e),e||setTimeout(()=>{o(null),u(null)},300)};return(0,t.jsx)(et.Sheet,{open:e,onOpenChange:k,children:(0,t.jsxs)(et.SheetContent,{side:"right",showCloseButton:!1,style:{width:`min(${h}px, 100vw)`,maxWidth:"none"},className:"data-[side=right]:sm:inset-y-2 data-[side=right]:sm:right-2 data-[side=right]:sm:h-auto data-[side=right]:sm:rounded-xl data-[side=right]:sm:border",children:[(0,t.jsx)(ee.SheetResizeHandle,{onPointerDown:g,onPointerMove:p,onPointerUp:x}),(0,t.jsx)(et.SheetHeader,{children:(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(R.Mail,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),(0,t.jsx)(et.SheetTitle,{className:"truncate flex-1",children:m?"Loading...":i?.subject||"Email"}),(0,t.jsx)(l.Button,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>k(!1),children:(0,t.jsx)($.X,{className:"h-4 w-4"})})]})}),(0,t.jsx)(et.SheetBody,{className:"flex-1 overflow-y-auto thin-scrollbar",children:m?(0,t.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,t.jsx)(d.Loader2,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):i?(0,t.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,t.jsxs)("div",{className:"text-sm space-y-1 border-b pb-3",children:[(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:"From:"}),(0,t.jsx)("span",{className:"truncate",children:i.from_email})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:"To:"}),(0,t.jsx)("span",{className:"truncate",children:i.to_email})]}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:"Date:"}),(0,t.jsx)("span",{children:new Date(i.created_at).toLocaleString()})]})]}),c?.isHtml?(0,t.jsx)(ea.EmailBodyFrame,{html:c.content,className:"max-w-full"}):(0,t.jsx)("pre",{className:"whitespace-pre-wrap text-sm font-mono",children:c?.content}),i.attachments&&i.attachments.length>0&&(0,t.jsxs)("div",{className:"border-t pt-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5 mb-2 text-xs text-muted-foreground",children:[(0,t.jsx)(F.Paperclip,{className:"size-3"}),i.attachments.length," attachment",i.attachments.length>1?"s":""]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.attachments.map((e,s)=>(0,t.jsxs)("a",{href:`/api/email/${i.id}/attachment/${s}?workspace_id=${n}`,target:"_blank",rel:"noopener noreferrer",download:e.filename,className:"flex items-center gap-1.5 rounded-md border border-border/50 bg-muted/50 px-2.5 py-1.5 text-xs hover:bg-muted transition-colors cursor-pointer",children:[(0,t.jsx)(es.File,{className:"size-3 text-muted-foreground shrink-0"}),(0,t.jsx)("span",{className:"truncate max-w-45",children:e.filename}),(0,t.jsx)("span",{className:"text-muted-foreground shrink-0",children:e.size<1024?`${e.size} B`:e.size<1048576?`${(e.size/1024).toFixed(1)} KB`:`${(e.size/1048576).toFixed(1)} MB`})]},e.key))})]})]}):null})]})})}var en=e.i(781360),el=e.i(169678),ei=e.i(364079);function eo({bufferedMessages:e,onDelete:a}){let[r,n]=(0,s.useState)(!1),l=e.length;if(0===l)return null;let i=Math.min(l,3);return(0,t.jsx)("div",{className:"relative px-5 pb-1",children:(0,t.jsx)("div",{className:"mx-auto max-w-2xl flex justify-center",children:(0,t.jsxs)("div",{className:"relative w-full max-w-lg transition-[height] duration-200 ease-out",style:{height:r?32*l+(l-1)*4:32+(i-1)*6},onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[e.map((e,s)=>{var n;let c=l-1-s,d=s>=l-i;return(0,t.jsx)("div",{className:"absolute right-0 left-0 transition-all duration-200 ease-out",style:{height:32,zIndex:s+1,bottom:r?36*c:d?6*c:0,transform:r?"scale(1)":`scale(${d?1-.03*c:.91})`,opacity:r?1:d?1-.2*c:0,pointerEvents:r||d?"auto":"none"},children:(0,t.jsxs)("div",{className:"h-full rounded-lg border bg-background/95 backdrop-blur-sm shadow-sm flex items-center gap-2 px-3",children:[(0,t.jsx)("span",{className:"shrink-0 text-[11px] text-primary/60 tabular-nums w-4 text-center",children:s+1}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 flex items-center gap-1.5",children:[(0,t.jsx)("p",{className:"text-[13px] text-muted-foreground leading-snug truncate",children:(n=e.content).length<=80?n:n.slice(0,80).trimEnd()+"…"}),e.attachment_ids&&e.attachment_ids.length>0&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-0.5 shrink-0 text-[11px] text-muted-foreground/50",children:[(0,t.jsx)(F.Paperclip,{className:"size-2.5"}),e.attachment_ids.length]})]}),(0,t.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),a(e.id)},className:(0,o.cn)("shrink-0 rounded-sm p-0.5 transition-all duration-150","text-muted-foreground/30 hover:text-foreground hover:bg-muted",r?"opacity-100":"opacity-0"),tabIndex:r?0:-1,children:(0,t.jsx)($.X,{className:"size-3"})})]})},e.id)}),!r&&l>i&&(0,t.jsxs)("span",{className:"absolute -top-4 right-1 text-[10px] text-muted-foreground/40 tabular-nums",children:["+",l-i," more"]})]})})})}var ec=e.i(219658);function ed(e,t){if(t>=e.length)return!0;let s=e.charCodeAt(t);return(!(s>=48)||!(s<=57))&&(!(s>=65)||!(s<=90))&&(!(s>=97)||!(s<=122))&&95!==s}function eu(e,t){if(!e||0===t.length||!e.includes("@"))return e;let s=t.slice().sort((e,t)=>t.name.length-e.name.length),a=[];for(let t=0;t<e.length;t++){if("@"!==e[t]||!function(e,t){if(0===t)return!0;let s=e.charCodeAt(t-1);return(!(s>=48)||!(s<=57))&&(!(s>=65)||!(s<=90))&&(!(s>=97)||!(s<=122))&&95!==s}(e,t))continue;let r=t+1;for(let n of s){let s=r+n.name.length;if(s>e.length||e.slice(r,s).toLowerCase()!==n.name.toLowerCase())continue;let l=s,i=e.slice(s).match(/^ \([a-zA-Z0-9-]+@alook\.ai\)/);if(i&&(l=s+i[0].length),(i||ed(e,s))&&(!i||ed(e,l))){if(a.some(e=>t>=e.start&&t<e.end))break;a.push({start:t,end:s,name:n.name,agentId:n.id});break}}}let r=e;for(let e=a.length-1;e>=0;e--){let t=a[e],s=r.slice(t.start,t.end);r=r.slice(0,t.start)+`<mention data-agent-id="${t.agentId}">${s}</mention>`+r.slice(t.end)}return r}let em={id:"",agent_id:"",runtime_id:"",conversation_id:"",workspace_id:"",prompt:"",status:"completed",priority:0,dispatched_at:null,started_at:null,completed_at:null,result:null,error:null,created_at:"",type:""};function ef({taskId:e,thinkingCount:a,workspaceId:r,provider:n}){let[l,i]=(0,s.useState)([]),[o,c]=(0,s.useState)(!1),[d,u]=(0,s.useState)(!1),m=(0,s.useCallback)(async()=>{if(!d&&!o){c(!0);try{let t=await (0,j.getTaskMessages)(e,r);i(t)}catch{i([])}finally{c(!1),u(!0)}}},[d,o,e,r]);return(0,t.jsx)(b,{task:em,messages:l,thinkingCountHint:a,onExpandThinking:m,thinkingLoading:o,provider:n})}var eh=e.i(983453),eg=e.i(251638);let ep=(0,E.default)("flag",[["path",{d:"M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528",key:"1jaruq"}]]);e.s(["Flag",0,ep],618615);var ex=e.i(89440),ev=e.i(541544);let ek={mention:["data-agent-id"]},eb=["mention"];function ej({content:e,conversationType:s}){let a=eA(e,s),r="h-4 w-4 mt-0.5 shrink-0";return"issue"===a?(0,t.jsx)(eg.CircleDot,{className:r}):"email"===a?(0,t.jsx)(R.Mail,{className:r}):(0,t.jsx)(eh.Calendar,{className:r})}function ey({attachmentIds:e,artifacts:s,onArtifactClick:a}){let r=e.map(e=>s.find(t=>t.id===e)).filter(e=>!!e);return 0===r.length?null:(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:r.map(e=>(0,t.jsxs)("button",{type:"button",onClick:t=>{t.stopPropagation(),a(e)},className:"inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80 hover:bg-primary-foreground/20 transition-colors cursor-pointer",children:[(0,t.jsx)(z.FileText,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate max-w-37.5",children:e.filename})]},e.id))})}function ew({pendingFiles:e,messageId:s}){let a=e.get(s);return a&&0!==a.length?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-1.5",children:a.map((e,s)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-md bg-primary-foreground/10 border border-primary-foreground/20 px-2 py-0.5 text-xs text-primary-foreground/80",children:[(0,t.jsx)(z.FileText,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate max-w-37.5",children:e.name})]},s))}):null}let eN={solo:"rounded-2xl",first:"rounded-tl-2xl rounded-tr-2xl rounded-bl-2xl rounded-br-md",middle:"rounded-tl-2xl rounded-tr-md rounded-bl-2xl rounded-br-md",last:"rounded-tl-2xl rounded-tr-md rounded-bl-2xl rounded-br-2xl"},eC=(0,s.memo)(function({msg:e,agents:a,artifacts:r,activeTask:n,taskMessages:i,connectionLost:c,isLastMessage:d,thinkingCount:h,targetConvId:g,workspaceId:p,conversationType:x,pendingFilesByMessage:k,onArtifactClick:j,onEmailClick:y,onIssueClick:w,onCalendarEventClick:N,onRetry:C,mentionComponents:_,isFlagged:T,onToggleFlag:I,groupPosition:E="solo",provider:A}){let z,R,D,L,F,P,$,{copy:q,copied:B}=function(e=2e3){let[t,a]=(0,s.useState)(!1),r=(0,s.useRef)(void 0),n=(0,s.useCallback)(async t=>{try{return await navigator.clipboard.writeText(t),a(!0),clearTimeout(r.current),r.current=setTimeout(()=>a(!1),e),!0}catch{return!1}},[e]);return(0,s.useEffect)(()=>()=>clearTimeout(r.current),[]),{copy:n,copied:t}}(),O=n&&"assistant"===e.role&&e.task_id===n.id&&e.conversation_id===n.conversation_id&&i.length>0,H=O&&n&&["completed","failed","cancelled","superseded"].includes(n.status),W="assistant"===e.role?(0,t.jsxs)("div",{className:"flex flex-row items-center gap-1",children:[(0,t.jsxs)(M.Tooltip,{children:[(0,t.jsx)(M.TooltipTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon-xs","aria-label":B?"Copied":"Copy message",onClick:async t=>{t.stopPropagation(),await q(e.content)?S.toast.success("Copied to clipboard"):S.toast.error("Failed to copy")},className:(0,o.cn)("self-start mb-1",B?"text-green-500 opacity-100":"text-muted-foreground md:opacity-0 md:group-hover/msg:opacity-100")}),children:B?(0,t.jsx)(ev.Check,{className:"size-3.5"}):(0,t.jsx)(ex.Copy,{className:"size-3.5"})}),(0,t.jsx)(M.TooltipContent,{children:B?"Copied":"Copy"})]}),I&&(0,t.jsxs)(M.Tooltip,{children:[(0,t.jsx)(M.TooltipTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon-xs",onClick:()=>I(e.id),className:(0,o.cn)("self-start mb-1",T?"text-primary opacity-100":"text-muted-foreground md:opacity-0 md:group-hover/msg:opacity-100")}),children:(0,t.jsx)(ep,{className:(0,o.cn)("size-3.5",T&&"fill-current")})}),(0,t.jsx)(M.TooltipContent,{children:T?"Unflag":"Flag"})]})]}):null;return(0,t.jsxs)(s.default.Fragment,{children:[O&&(0,t.jsxs)("div",{className:(0,o.cn)("group/msg",T&&"bg-muted/30 rounded-lg px-2 -mx-2"),...H?{"data-quote-source":!0}:{},children:[(0,t.jsx)(b,{task:n,messages:i,connectionLost:c,onRetry:C,provider:A}),H&&W]}),"user"===e.role?(z=d&&!!n&&"running"!==n.status&&!["completed","failed","cancelled","superseded"].includes(n.status),R=e.content.match(/^\/(\S+)\s?([\s\S]*)$/),D=R?.[1]??null,L=R?R[2]||"":e.content,(0,t.jsx)("div",{className:"flex justify-end","data-message-id":e.id,...e.task_id?{"data-task-id":e.task_id}:{},children:(0,t.jsxs)("div",{className:(0,o.cn)("max-w-[80%] px-4 py-2 bg-primary text-primary-foreground text-base relative",eN[E]),children:[z&&(0,t.jsx)("div",{className:(0,o.cn)("absolute inset-0 animate-pulse pointer-events-none",eN[E]),style:{boxShadow:"0 0 0 2px var(--bubble-glow)"}}),D&&(0,t.jsxs)("span",{className:"inline-flex items-center rounded px-1.5 py-0.5 text-xs font-medium bg-primary-foreground/15 text-primary-foreground mb-1",children:["/",D]}),L&&(0,t.jsx)("div",{className:"markdown markdown-user",children:(0,t.jsx)(u.Streamdown,{plugins:{mermaid:m.mermaid,cjk:f.cjk},controls:{code:{copy:!0,download:!1},table:{copy:!1,download:!1,fullscreen:!1}},linkSafety:{enabled:!1},allowedTags:ek,literalTagContent:eb,components:_,children:eu(L,a)})}),e.attachment_ids&&e.attachment_ids.length>0&&(0,t.jsx)(ey,{attachmentIds:e.attachment_ids,artifacts:r,onArtifactClick:j}),!e.attachment_ids&&(0,t.jsx)(ew,{pendingFiles:k,messageId:e.id})]})})):"event"===e.role?(F=e.metadata?.emailId,P=e.metadata?.issueId,$=e.metadata?.calendarEventId,(0,t.jsx)("div",{className:"flex justify-start","data-message-id":e.id,...e.task_id?{"data-task-id":e.task_id}:{},children:(0,t.jsxs)("div",{className:(0,o.cn)("w-full rounded-md border bg-muted/50 text-muted-foreground text-sm px-3 py-2 flex items-start gap-2",(!!F||!!P||!!$)&&"cursor-pointer hover:bg-muted transition-colors"),onClick:F?()=>y(F):P?()=>w(P):$?()=>N($):void 0,children:[(0,t.jsx)(ej,{content:e.content,conversationType:x}),(0,t.jsx)("span",{className:"min-w-0 wrap-anywhere",children:e.content})]})})):O?null:(0,t.jsxs)("div",{className:(0,o.cn)("group/msg flex flex-col justify-start min-w-0 overflow-x-clip",T&&"bg-muted/30 rounded-lg px-2 -mx-2"),"data-message-id":e.id,"data-quote-source":!0,...e.task_id?{"data-task-id":e.task_id}:{},children:[g&&"assistant"===e.role&&e.task_id&&h>1&&(0,t.jsx)(ef,{taskId:e.task_id,thinkingCount:h-1,workspaceId:p,provider:A}),e.metadata?.error_source==="runtime"?(0,t.jsx)("div",{className:"px-1 py-1",children:(0,t.jsx)(v,{provider:e.metadata.provider??A,message:e.content})}):(0,t.jsx)("div",{className:"markdown max-w-full min-w-0 px-1 py-1 text-base text-foreground",children:(0,t.jsx)(u.Streamdown,{plugins:{mermaid:m.mermaid,cjk:f.cjk},controls:{code:{copy:!0,download:!1},table:{copy:!0,download:!1,fullscreen:!0}},linkSafety:{enabled:!1},allowedTags:ek,literalTagContent:eb,components:_,children:eu(e.content,a)})}),W]})]})});e.i(400175);var e_=e.i(819748),eS=e.i(126366),eT=e.i(309475);function eM({agent:e,isOnline:a,activeTaskCount:r,variant:n="default",isHovered:l}){let[i,c]=(0,s.useState)(!1),d=e.email_handle?(0,X.toAlookAddress)(e.email_handle):null,u=(0,s.useCallback)(async()=>{if(d)try{await navigator.clipboard.writeText(d),c(!0),S.toast.success("Email copied to clipboard"),setTimeout(()=>c(!1),2e3)}catch{S.toast.error("Failed to copy email")}},[d]);if("compact"===n){let s;return(0,t.jsxs)("div",{className:"flex items-center gap-2 p-0",children:[(s=(0,eS.parseAvatarUrl)(e.avatar_url))?(0,t.jsx)(e_.AnimatedAvatar,{config:s,size:32,className:"shrink-0 rounded-xl",isHovered:l??!1,isWorking:!!a&&(r??0)>0}):(0,t.jsx)("div",{className:"flex items-center justify-center size-8 rounded-xl bg-secondary text-secondary-foreground text-xs font-medium shrink-0",children:e.name.charAt(0).toUpperCase()}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate max-w-35",children:e.name}),d&&(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:d})]}),void 0!==a&&(0,t.jsx)("div",{className:"pointer-events-none mt-0.5",children:(0,t.jsx)(eT.AgentStatusBadge,{isOnline:a,taskCount:r??0,agentId:e.id})})]})]})}return(0,t.jsxs)("div",{className:"flex flex-col gap-1.5 p-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsx)("p",{className:"text-sm font-medium truncate",children:e.name}),(0,t.jsx)("span",{className:"flex-1"}),void 0!==a&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground",children:[(0,t.jsx)("span",{className:(0,o.cn)("size-1.5 rounded-full",a?"bg-status-online":"bg-status-offline")}),a?(r??0)>0?"Working":null:"Offline"]})]}),d&&(0,t.jsxs)("div",{className:"flex items-center gap-1",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:d}),(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),u()},className:"shrink-0 p-0.5 rounded-sm text-muted-foreground/60 hover:text-foreground transition-colors cursor-pointer",children:i?(0,t.jsx)(ev.Check,{className:"size-3 text-green-500"}):(0,t.jsx)(ex.Copy,{className:"size-3"})})]}),e.description&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground line-clamp-2",children:e.description})]})}e.s(["AgentPreviewCard",0,eM],844010);var eI=e.i(224950);let eE={mention:function(e){let{children:s,...a}=e,{agents:r}=(0,w.useAgentContext)(),n=a["data-agent-id"]??a.dataAgentId,l=n?r.find(e=>e.id===n):void 0;if(!l&&"string"==typeof s){let e=s.startsWith("@")?s.slice(1):s;l=r.find(t=>t.name.toLowerCase()===e.toLowerCase())}return l?(0,t.jsxs)(eI.Popover,{children:[(0,t.jsx)(eI.PopoverTrigger,{openOnHover:!0,delay:300,nativeButton:!1,render:(0,t.jsx)("span",{className:"mention-highlight cursor-pointer"}),children:s}),(0,t.jsx)(eI.PopoverContent,{side:"top",className:"w-fit max-w-80",children:(0,t.jsx)(eM,{agent:l})})]}):(0,t.jsx)("span",{className:"mention-highlight",children:s})},p:({children:e,node:s,...a})=>(0,t.jsx)("div",{"data-md-p":"",...a,children:e})};function eA(e,t){if("issue_event"===t)return"issue";if("email_notification"===t)return"email";if("calendar_event"===t)return"calendar";let s=e.toLowerCase();return s.startsWith("issue ")||s.startsWith("issue:")?"issue":s.includes("email")?"email":"calendar"}function ez(e){return e.slice().sort((e,t)=>{let s=e.created_at.localeCompare(t.created_at);return 0!==s?s:e.id.localeCompare(t.id)})}function eR(e,t){let s=new Map;for(let t of e)s.set(t.id,t);for(let e of t)s.set(e.id,e);return ez([...s.values()])}function eD(e){let t=[],s=[],a=!1;for(let r of e)"message"===r.kind&&"user"===r.data.role?(a=!0,t.push(r)):"message"===r.kind&&"assistant"===r.data.role?(t.push(r),t.push(...s),s=[],a=!1):a&&"artifact"===r.kind?s.push(r):t.push(r);return t.push(...s),t}function eL(e){let t=(0,s.useRef)(e);return(0,s.useEffect)(()=>{t.current=e},[e]),t}function eF({agentName:e}){return(0,t.jsxs)("div",{className:"flex items-center gap-3 py-4 select-none","aria-hidden":!0,children:[(0,t.jsx)("div",{className:"flex-1 border-t border-border/40"}),(0,t.jsxs)("span",{className:"text-xs text-muted-foreground/60 whitespace-nowrap",children:[e," took a nap 💤"]}),(0,t.jsx)("div",{className:"flex-1 border-t border-border/40"})]})}function eP({artifact:e,version:s,hasDuplicates:a,onClick:r}){return(0,t.jsxs)("button",{onClick:()=>r(e),className:(0,o.cn)("flex items-center gap-3 w-full max-w-sm rounded-lg border border-border/60 bg-muted/30","px-3.5 py-2.5 text-left transition-colors duration-150","hover:bg-muted/60 hover:border-border"),children:[(0,t.jsx)(z.FileText,{className:"size-4 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("p",{className:"text-sm font-medium truncate",children:[e.filename,a&&(0,t.jsxs)("span",{className:"ml-1.5 text-xs text-muted-foreground bg-muted rounded-full px-1.5 py-0.5 font-normal",children:["v",s]})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:(0,Z.formatSize)(e.size)})]})]})}function e$({agentId:e,targetConvId:i,scrollToTaskId:c,scrollToMessageId:u}){let m,f,h,g=(0,r.useParams)(),p=(0,r.useSearchParams)(),{workspaceId:x,slug:v}=(0,n.useWorkspace)(),{agents:k,runtimes:E,agentLinks:q,activeTaskCounts:O,subscribeWs:H,subscribeReconnect:W}=(0,w.useAgentContext)(),{refresh:U}=(0,N.useInboxCount)(),{activeChannel:V,loading:K,setAgentId:Y}=(0,_.useChannel)(),X=e??g.id,G=k.find(e=>e.id===X),J=G?.runtime_id?E.find(e=>e.id===G.runtime_id):null,ee=J?.provider??null,et=void 0!==c?c:p.get("task"),es=void 0!==u?u:p.get("msg"),ea=void 0!==i?i:p.get("conv"),[ed,eu]=(0,s.useState)(null),[em,ef]=(0,s.useState)([]),[eh,eg]=(0,s.useState)(()=>localStorage.getItem(`chat-draft:${X}:${ea??"default"}`)??""),[ep,ex]=(0,s.useState)(!1),[ev,ek]=(0,s.useState)(!1),[eb,ej]=(0,s.useState)(null),[ey,ew]=(0,s.useState)([]),[eN,e_]=(0,s.useState)(!0),[eS,eT]=(0,s.useState)(!1),[eM,eA]=(0,s.useState)(!1),[eq,eB]=(0,s.useState)(!1),[eO,eH]=(0,s.useState)([]),[eW,eU]=(0,s.useState)(!1),[eV,eK]=(0,s.useState)(null),[eY,eX]=(0,s.useState)(!1),[eG,eJ]=(0,s.useState)(null),[eQ,eZ]=(0,s.useState)(!1),[e0,e1]=(0,s.useState)(null),[e2,e5]=(0,s.useState)(!1),[e3,e4]=(0,s.useState)(null),[e8,e6]=(0,s.useState)(null),[e9,e7]=(0,s.useState)(!1),[te,tt]=(0,s.useState)(null),[ts,ta]=(0,s.useState)(null),[tr,tn]=(0,s.useState)([]),[tl,ti]=(0,s.useState)([]),[to,tc]=(0,s.useState)(null),[td,tu]=(0,s.useState)([]),[tm,tf]=(0,s.useState)(!1),[th,tg]=(0,s.useState)([]),[tp,tx]=(0,s.useState)({}),[tv]=(0,s.useState)(()=>Date.now()),[tk,tb]=(0,s.useState)(()=>new Map),[tj,ty]=(0,s.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(`chat-draft-meta:${X}:${ea??"default"}`)??"null");return e?.quote??null}catch{return null}}),[tw,tN]=(0,s.useState)(!1),[tC,t_]=(0,s.useState)(null),[tS,tT]=(0,s.useState)(new Set),tM=(0,s.useRef)(tS);(0,s.useEffect)(()=>{tM.current=tS});let{increment:tI,decrement:tE,refresh:tA}=(0,C.useFlagCount)(),{writeToCache:tz}=function(e,t){let[a,r]=(0,s.useState)(null),[n,l]=(0,s.useState)(!1),i=(0,s.useRef)(e);return(0,s.useEffect)(()=>{if(i.current=e,!e||!t){r(null),l(!1);return}(0,y.openCacheDB)(t);let s=!1;return(0,y.getCachedMessages)(e,t).then(t=>{s||i.current!==e||(t&&t.length>0?(r(t),l(!0)):(r(null),l(!1)))}),()=>{s=!0}},[e,t]),{cachedMessages:a,isFromCache:n,writeToCache:(0,s.useCallback)(async(e,s,a)=>{i.current&&t&&await (0,y.mergeCachedMessages)(i.current,e,s,t,a)},[t])}}(ea??null,x),tR=(0,s.useRef)(tz);(0,s.useEffect)(()=>{tR.current=tz},[tz]),(0,s.useEffect)(()=>{Y(X)},[X,Y]);let tD=(0,s.useMemo)(()=>eO.filter(e=>"agent"===e.source),[eO]),{versionMap:tL,duplicateFilenames:tF}=(0,s.useMemo)(()=>(0,ei.computeArtifactVersions)(tD),[tD]),tP=(0,s.useMemo)(()=>(function(e,t,s,a){if(!a||0===s.length){let a=[...e.map(e=>({kind:"message",data:e})),...t.map(e=>({kind:"artifact",data:e})),...s.map(e=>({kind:"nap",data:e}))];return a.sort((e,t)=>{let s=e.data.created_at.localeCompare(t.data.created_at);if(0!==s)return s;if("nap"===e.kind||"nap"===t.kind){if("nap"===e.kind&&"nap"!==t.kind)return 1;if("nap"!==e.kind&&"nap"===t.kind)return -1}return e.kind!==t.kind?"message"===e.kind?-1:1:e.data.id.localeCompare(t.data.id)}),eD(a)}let r=new Set(s.map(e=>e.id.replace(/^nap-/,""))),n=[...s].sort((e,t)=>e.created_at.localeCompare(t.created_at)),l=s=>eD([...e.filter(e=>e.conversation_id===s).map(e=>({kind:"message",data:e})),...t.filter(e=>e.conversation_id===s).map(e=>({kind:"artifact",data:e}))].sort((e,t)=>{let s=e.data.created_at.localeCompare(t.data.created_at);return 0!==s?s:e.kind!==t.kind?"message"===e.kind?-1:1:e.data.id.localeCompare(t.data.id)})),i=[];for(let e of n){let t=e.id.replace(/^nap-/,"");i.push(...l(t)),i.push({kind:"nap",data:e})}i.push(...l(a));let o=new Set([...r,a]),c=e.filter(e=>!o.has(e.conversation_id)),d=t.filter(e=>!o.has(e.conversation_id));if(c.length>0||d.length>0){let e=[...c.map(e=>({kind:"message",data:e})),...d.map(e=>({kind:"artifact",data:e}))];e.sort((e,t)=>{let s=e.data.created_at.localeCompare(t.data.created_at);return 0!==s?s:e.kind!==t.kind?"message"===e.kind?-1:1:e.data.id.localeCompare(t.data.id)});let t=eD(e),s=i.findIndex(e=>"nap"===e.kind);s>=0?i.splice(s,0,...t):i.push(...t)}return i})(em,tD,th,ed?.id),[em,tD,th,ed?.id]),t$=(0,s.useMemo)(()=>(function(e){let t=Array(e.length).fill(null),s=e=>"user"===e.role||"assistant"===e.role;for(let a=0;a<e.length;a++){let r=e[a];if("message"!==r.kind)continue;let n=r.data;if(!s(n))continue;let l=a>0?e[a-1]:null,i=a<e.length-1?e[a+1]:null,o=l?.kind==="message"&&s(l.data)&&l.data.role===n.role&&(!n.created_at||!l.data.created_at||6e4>Math.abs(new Date(n.created_at).getTime()-new Date(l.data.created_at).getTime())),c=i?.kind==="message"&&s(i.data)&&i.data.role===n.role&&(!n.created_at||!i.data.created_at||6e4>Math.abs(new Date(i.data.created_at).getTime()-new Date(n.created_at).getTime()));o&&c?t[a]="middle":o&&!c?t[a]="last":!o&&c?t[a]="first":t[a]="solo"}return t})(tP),[tP]),tq=(0,s.useCallback)(e=>{(0,ei.isPreviewable)(e)?(eK(e),eU(!0)):window.open((0,ei.getArtifactUrl)(e.id,x,!0),"_blank")},[x]),tB=(0,s.useCallback)(e=>{(0,ei.isPreviewable)(e)?(eK(e),eU(!0)):window.open((0,ei.getArtifactUrl)(e.id,x,!0),"_blank")},[x]),tO=(0,s.useRef)(null),tH=(0,s.useRef)(null),tW=(0,s.useRef)(null),tU=(0,s.useRef)(null),tV=(0,s.useRef)(0),tK=(0,s.useRef)(0),tY=(0,s.useRef)(!1),tX=(0,s.useRef)(!1),tG=(0,s.useRef)(!0),tJ=(0,s.useRef)(!1),tQ=(0,s.useRef)(null),tZ=(0,s.useRef)(null),t0=(0,s.useRef)(0),t1=(0,s.useRef)(void 0),t2=(0,s.useRef)(null),t5=(0,s.useRef)({completedKey:null}),t3=(0,s.useRef)(null),t4=(0,s.useRef)(null),[t8,t6]=(0,s.useState)(""),t9=(0,s.useMemo)(()=>k.filter(e=>e.id!==X),[k,X]),[t7,se]=(0,s.useState)([]),st=(0,s.useRef)(!1);(0,s.useEffect)(()=>{let e=!1;return(0,j.getAgentSkills)(X,x).then(t=>{e||se(t.skills)}).catch(()=>{}),()=>{e=!0}},[X,x]);let[ss]=(0,s.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(`chat-draft-meta:${X}:${ea??"default"}`)??"null");return e?.skill??null}catch{return null}}),sa=function({input:e,caretIndex:t,skills:a,onInputChange:r,initialActiveSkill:n,getAnchorPos:l,onAfterSelect:i}){let[o,c]=(0,s.useState)(!1),[d,u]=(0,s.useState)(""),[m,f]=(0,s.useState)(0),[h,g]=(0,s.useState)({top:0,left:0}),p=(0,s.useRef)(null),x=(0,s.useMemo)(()=>{if(!o)return[];if(!d)return a;let e=d.toLowerCase(),t=[],s=[];for(let r of a){let a=r.name.toLowerCase();a.startsWith(e)?t.push(r):a.includes(e)&&s.push(r)}return[...t,...s]},[o,d,a]);(0,s.useEffect)(()=>{f(0)},[x.length,d]);let[v,k]=(0,s.useState)(n??null);(0,s.useEffect)(()=>{if(v||null===t)return void c(!1);let s=function(e,t){if(!e.startsWith("/")||0===t)return null;let s=t-1;for(;s>=0&&t-s<=30;){let a=e.charCodeAt(s);if(47===a&&0===s)return{start:0,query:e.slice(1,t)};if(10===a||13===a||32===a)break;s--}return null}(e,t);if(s){p.current=s.start,u(s.query),c(!0);let e=l(s.start);e&&g(e)}else c(!1),p.current=null},[e,t,l,v]);let b=(0,s.useCallback)(e=>{k(e),r(""),c(!1),i?.()},[r,i]),j=(0,s.useCallback)(()=>{k(null)},[]),y=(0,s.useCallback)(e=>!!o&&0!==x.length&&!e.isComposing&&("ArrowDown"===e.key?(e.preventDefault(),f(e=>(e+1)%x.length),!0):"ArrowUp"===e.key?(e.preventDefault(),f(e=>(e-1+x.length)%x.length),!0):"Enter"===e.key||"Tab"===e.key?(e.preventDefault(),b(x[m]),!0):"Escape"===e.key&&(e.preventDefault(),c(!1),!0)),[o,x,m,b]);return{isOpen:o,query:d,selectedIndex:m,anchorPos:h,skills:x,activeSkill:v,handleSlashKeyDown:y,selectSkill:b,clearActiveSkill:j,setActiveSkill:k}}({input:t8,caretIndex:to,skills:t7,onInputChange:()=>t4.current?.clear(),initialActiveSkill:ss,getAnchorPos:(0,s.useCallback)(e=>t4.current?.coordsAtTextIndex(e)??null,[]),onAfterSelect:(0,s.useCallback)(()=>{requestAnimationFrame(()=>t4.current?.focus())},[])});(0,s.useEffect)(()=>{0===t7.length||!sa.activeSkill||t7.some(e=>e.name===sa.activeSkill.name)||sa.setActiveSkill(null)},[t7]),(0,s.useEffect)(()=>{let e=`chat-draft:${X}:${ea??"default"}`;eh?localStorage.setItem(e,eh):localStorage.removeItem(e)},[eh,X,ea]),(0,s.useEffect)(()=>{if(!st.current)return;let e=`chat-draft-meta:${X}:${ea??"default"}`,t={};sa.activeSkill&&(t.skill={name:sa.activeSkill.name,description:sa.activeSkill.description}),tj&&(t.quote=tj),t.skill||t.quote?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)},[sa.activeSkill,tj,X,ea]),(0,s.useEffect)(()=>{ep||t4.current?.focus()},[ep]);let sr=(0,s.useCallback)(()=>{tG.current=!0,setTimeout(()=>{tO.current?.scrollTo({top:tO.current.scrollHeight,behavior:"smooth"})},50)},[]);(0,s.useEffect)(()=>{var e,t;if(!ea&&K)return;let s=(e={workspaceId:x,agentId:X,targetConvId:ea,scrollToTaskId:et}).targetConvId?`${e.workspaceId}::${e.agentId}::${e.targetConvId}::${e.scrollToTaskId??""}`:null;if(t=t5.current,s&&t.completedKey===s||(t.completedKey=null,0))return;tH.current&&clearInterval(tH.current),tH.current=null,tU.current=null,t2.current=null;let a=!1;e_(!0),tY.current=!1,ej(null),ew([]),ti([]),tb(new Map),tg([]),tx({}),tu([]),tf(!1),tZ.current=null,eg(localStorage.getItem(`chat-draft:${X}:${ea??"default"}`)??"");let r=localStorage.getItem(`chat-draft-meta:${X}:${ea??"default"}`);if(r)try{let e=JSON.parse(r);ty(e.quote??null),sa.setActiveSkill(e.skill?e.skill:null)}catch{ty(null),sa.setActiveSkill(null)}else ty(null),sa.setActiveSkill(null);async function n(e){let t=await (0,y.getCacheMeta)(e,x);if(t?.newestMessageId){let s=await (0,y.getCachedMessages)(e,x);if(a)return{painted:!1,cacheMeta:t};if(s&&s.length>0)return ef(s),eA(t.hasMore),e_(!1),{painted:!0,cacheMeta:t}}return{painted:!1,cacheMeta:t}}return st.current=!0,ef([]),async function(){let e=!1;try{let t=null,s=null,r=null;if(ea){t=ea;let r=await n(t);if(a)return;s=r.cacheMeta,e=r.painted}else{let l=await (0,y.getLastOpenConversation)(X,V,x);if(a)return;if(l?.conversation_id&&l.serverMessageCount>0){let t=await n(l.conversation_id);if(a)return;t.painted&&(e=!0,r=l.conversation_id,s=t.cacheMeta)}try{let l=await (0,j.checkFreshness)({agentId:X,channel:V},x);if(a)return;if(t=l.conversation_id,r&&t!==r){tY.current=!1,tG.current=!0;let r=await n(t);if(a)return;s=r.cacheMeta,e=r.painted,r.painted||(ef([]),e_(!0))}else if(!r){let r=await n(t);if(a)return;s=r.cacheMeta,e=r.painted}}catch{}}if(t){t2.current=t;let r=await (0,j.conversationInit)(t,x,{newestMessageId:s?.newestMessageId??void 0,messageCount:s?.serverMessageCount||void 0});if(a)return;if(eu(r.conversation),tf(r.has_more_conversations),!r.cache_valid&&r.messages){let s=tG.current;ef(e=>eR(e,r.messages)),t2.current===t&&(0,y.mergeCachedMessages)(t,r.messages,r.has_more_messages,x,r.message_count).catch(()=>{}),eA(r.has_more_messages),e&&tY.current&&s&&sr()}else s&&eA(s.hasMore);if(t2.current===t&&!ea){let e=await (0,y.getCacheMeta)(t,x);if(a)return;(0,y.setLastOpenConversation)(X,V,{conversation_id:t,newestMessageId:e?.newestMessageId??s?.newestMessageId??null,serverMessageCount:r.message_count},x).catch(()=>{})}if(tx(r.thinking_counts),eH(r.artifacts),ti(r.buffered_messages),tT(new Set(r.flagged_message_ids)),r.active_task&&(ej(r.active_task),ew(r.task_messages),r.task_messages.length>0&&(tV.current=Math.max(...r.task_messages.map(e=>e.seq))),tQ.current?.(r.active_task.id,t,tV.current)),et){let e=await (0,j.getTask)(et,x).catch(()=>null);if(a)return;if(e&&!["completed","failed","cancelled","superseded"].includes(e.status)){ej(e);let s=await (0,j.getTaskMessages)(et,x).catch(()=>[]);if(a)return;ew(s),s.length>0&&(tV.current=Math.max(...s.map(e=>e.seq))),tQ.current?.(e.id,t,tV.current)}}}else{let t=await (0,j.chatInit)(X,x,V);if(a)return;t2.current=t.conversation.id,eu(t.conversation);let s=tG.current;ef(e=>e.length>0?eR(e,t.messages):t.messages),eA(t.has_more_messages),eH(t.artifacts),ti(t.buffered_messages),tf(t.has_more_conversations),(0,y.mergeCachedMessages)(t.conversation.id,t.messages,t.has_more_messages,x).catch(()=>{}),(0,y.setLastOpenConversation)(X,V,{conversation_id:t.conversation.id,newestMessageId:t.messages.length>0?t.messages[t.messages.length-1].id:null,serverMessageCount:t.has_more_messages?0:t.messages.length},x).catch(()=>{}),e&&tY.current&&s&&sr(),(0,j.listFlaggedMessageIds)(x,t.conversation.id).then(e=>{a||tT(new Set(e.message_ids))}).catch(()=>{}),t.active_task&&(ej(t.active_task),t.task_messages.length>0&&(ew(t.task_messages),tV.current=Math.max(...t.task_messages.map(e=>e.seq))),["completed","failed","cancelled","superseded"].includes(t.active_task.status)||tQ.current?.(t.active_task.id,t.conversation.id,tV.current))}}catch{e?S.toast.error("Couldn't refresh conversation"):S.toast.error("Failed to load conversation")}finally{if(!a){var t;e_(!1),t=t5.current,s&&(t.completedKey=s)}}}(),()=>{a=!0}},[X,x,ea,et,V,K]);let sn=(0,s.useRef)(U);(0,s.useEffect)(()=>{sn.current=U},[U]);let sl=(0,s.useRef)(null);(0,s.useEffect)(()=>{if(!ed?.id||!x||sl.current===ed.id)return;sl.current=ed.id;let e=setTimeout(()=>{(0,j.markInboxRead)(ed.id,x).then(()=>sn.current()).catch(()=>{})},1e3);return()=>{sl.current=null,clearTimeout(e)}},[ed?.id,x]),(0,s.useEffect)(()=>{eN||!(em.length>0)||tY.current||(tY.current=!0,et||es?tG.current=!1:i?setTimeout(()=>{let e=tO.current?.querySelectorAll("[data-quote-source]");e&&e.length>0?e[e.length-1].scrollIntoView({behavior:"instant",block:"start"}):tO.current?.scrollTo({top:tO.current.scrollHeight})},50):setTimeout(()=>{tO.current?.scrollTo({top:tO.current.scrollHeight})},50))},[eN,em.length,et,es,i]),(0,s.useEffect)(()=>{let e;if(!et||eN||!ed)return;tG.current=!1,tJ.current=!0;let t=!1,s=()=>{if(t)return!1;let s=document.querySelector(`[data-task-id="${CSS.escape(et)}"]`);return!!s&&(s.scrollIntoView({behavior:"smooth",block:"start"}),s.classList.add("task-highlight"),e=setTimeout(()=>{s.classList.remove("task-highlight"),t||(tJ.current=!1)},1500),!0)},a=setTimeout(async()=>{if(!t&&!s())try{let e=await (0,j.listMessagesAroundTask)(ed.id,x,et);if(t)return;e.length>0?(ef(t=>eR(t,e)),requestAnimationFrame(()=>{setTimeout(()=>{s()||(tJ.current=!1)},100)})):tJ.current=!1}catch{t||(tJ.current=!1)}},100);return()=>{t=!0,clearTimeout(a),e&&clearTimeout(e)}},[et,eN,ed,x]),(0,s.useEffect)(()=>{let e;if(!es||et||eN||!ed)return;tG.current=!1,tJ.current=!0;let t=!1,s=setTimeout(()=>{!t&&((()=>{if(t)return!1;let s=document.querySelector(`[data-message-id="${CSS.escape(es)}"]`);return!!s&&(s.scrollIntoView({behavior:"smooth",block:"start"}),s.classList.add("task-highlight"),e=setTimeout(()=>{s.classList.remove("task-highlight"),t||(tJ.current=!1)},1500),!0)})()||(tO.current?.scrollTo({top:tO.current.scrollHeight}),tJ.current=!1))},100);return()=>{t=!0,clearTimeout(s),e&&clearTimeout(e)}},[es,et,eN,ed]);let si=eb?.status;(0,s.useEffect)(()=>{tJ.current||("running"===si||"queued"===si)&&tG.current&&sr()},[ey.length,si,sr]);let so=(0,s.useMemo)(()=>k.find(e=>e.id===X)?.name??"Agent",[k,X]),sc=eL(em),sd=eL(eM),su=eL(td),sm=eL(tm),sf=eL(so),sh=eL(V),sg=(0,s.useCallback)(async(e=!1)=>{if(!ed||tX.current)return;tX.current=!0;let t=sc.current,s=sd.current,r=sm.current,n=sf.current,l=sh.current,i=!!ea,o=t[0],c=tZ.current?.id??ed.id,d=s&&o,u=su.current;if(!i&&!d&&0===u.length&&r){let e=tZ.current??{id:ed.id,created_at:ed.created_at};try{let t=await (0,j.listPreviousConversations)(X,x,{exclude:ed.id,before:e.created_at,channel:l});u=t.conversations,tu(t.conversations),tf(t.has_more)}catch{tf(!1)}}let m=!i&&u.length>0;if(!d&&!m){tX.current=!1;return}eB(!0);let f=tO.current;f&&(f.style.overflowAnchor="none");let h=f?.scrollHeight??0;try{let t=[],s=[],m=20,g=!1,p=[],v=!1;if(d){let e=c===ed.id?await (0,y.getCachedMessagesBefore)(c,o.created_at,o.id,20,x):null;if(e)t=e.messages,m-=e.messages.length,g=e.hasMore;else{let e=await (0,j.listMessages)(c,x,{limit:20,before:o.created_at,beforeId:o.id});t=e.messages,m-=e.messages.length,g=e.has_more}v=g}if(!i&&!g&&m>0){if(0===u.length&&r){let e=tZ.current??{id:ed.id,created_at:ed.created_at};try{let t=await (0,j.listPreviousConversations)(X,x,{exclude:ed.id,before:e.created_at,channel:l});u=t.conversations,tu(t.conversations),tf(t.has_more)}catch{tf(!1)}}let e=0,t=0;for(;e<u.length&&m>0&&t<5;){let a=u[e];e++,t++;let r=await (0,j.listMessages)(a.id,x,{limit:m});if(0===r.messages.length){tZ.current=a;continue}let l=tZ.current?.created_at??ed.created_at;p.push({agentName:n,created_at:l,id:`nap-${a.id}`}),s=[...r.messages,...s],m-=r.messages.length,g=r.has_more,tZ.current=a}e>0&&tu(t=>t.slice(e))}let k=[...s,...t];if((0,a.flushSync)(()=>{k.length>0?(p.length>0&&tg(e=>{let t=new Set(e.map(e=>e.id)),s=p.filter(e=>!t.has(e.id));return[...e,...s]}),eA(g),ef(e=>{let t=new Set(e.map(e=>e.id));return[...k.filter(e=>!t.has(e.id)),...e]})):eA(!1)}),k.length>0&&ed){let e=k.filter(e=>e.conversation_id===ed.id);e.length>0&&(0,y.mergeCachedMessages)(ed.id,e,v,x).catch(()=>{})}if(tX.current=!1,(0,a.flushSync)(()=>eB(!1)),f)if(e)f.scrollTop=f.scrollHeight;else{let e=f.scrollHeight;f.scrollTop=e-h}}catch{S.toast.error("Failed to load older messages")}finally{tX.current=!1,eB(!1),tO.current&&(tO.current.style.overflowAnchor="")}},[ed,x,X,ea,sc,sd,sm,sf,sh,su]),sp=ea?eM:eM||td.length>0||tm;(0,s.useEffect)(()=>{ed?.id!==t1.current&&(t1.current=ed?.id,t0.current=0)},[ed?.id]),(0,s.useEffect)(()=>{eN||!ed||et||ea||em.length>=10||!sp||eq||t0.current>=3||(t0.current+=1,sg(!0))},[eN,em.length,sp,eq,ed,sg,et,ea]);let sx=(0,s.useCallback)(()=>{let e=tO.current;e&&(tG.current=e.scrollHeight-e.scrollTop-e.clientHeight<100)},[]),sv=(0,s.useCallback)((e,t,s)=>{tH.current&&clearInterval(tH.current),tV.current=s??0,tK.current=0,eT(!1),tU.current=e,tH.current=setInterval(async()=>{if(tU.current===e)try{let[s,a]=await Promise.all([(0,j.getTask)(e,x),(0,j.getTaskMessages)(e,x,tV.current||void 0)]),r=tU.current!==e;if(tK.current=0,eT(!1),a.length>0&&!r&&(ew(e=>{let t=new Set(e.map(e=>e.seq)),s=a.filter(e=>!t.has(e.seq));return s.length>0?[...e,...s]:e}),tV.current=Math.max(...a.map(e=>e.seq),tV.current)),"completed"===s.status||"failed"===s.status||"cancelled"===s.status||"superseded"===s.status){if(r)return void(0,j.listMessages)(t,x).then(({messages:e})=>{ef(t=>eR(t,e)),(0,y.mergeCachedMessages)(t,e,null,x).catch(()=>{})}).catch(()=>{});tH.current&&clearInterval(tH.current),tH.current=null,tW.current&&clearTimeout(tW.current),tW.current=setTimeout(()=>{(0,j.markInboxRead)(t,x).then(()=>sn.current()).catch(()=>{})},1e3);let a=!tJ.current&&tG.current;try{let[e,a]=await Promise.all([(0,j.listMessages)(t,x),(0,j.listArtifacts)(t,x).catch(()=>null)]);ef(t=>eR(t,e.messages)),(0,y.mergeCachedMessages)(t,e.messages,null,x).catch(()=>{}),a&&eH(a),ej(s)}catch{ej(s),S.toast.error("Failed to refresh messages")}a&&requestAnimationFrame(()=>{tO.current?.scrollTo({top:tO.current.scrollHeight,behavior:"smooth"})}),setTimeout(async()=>{if(!tH.current)try{let[s,a]=await Promise.all([(0,j.getActiveTask)(t,x),(0,j.listBufferedMessages)(t,x)]);if(ti(a),s&&s.id!==e){let{messages:e}=await (0,j.listMessages)(t,x);ef(t=>eR(t,e)),(0,y.mergeCachedMessages)(t,e,null,x).catch(()=>{}),ej(s),ew([]),tQ.current?.(s.id,t)}}catch{}},1e3)}else r||ej(s)}catch{if(tU.current!==e)return;tK.current+=1,tK.current>=3&&eT(!0),tK.current>=10&&(tH.current&&clearInterval(tH.current),tH.current=null,S.toast.error("Lost connection to agent"))}},3e3)},[x]);(0,s.useEffect)(()=>{tQ.current=sv},[sv]),(0,s.useEffect)(()=>()=>{tH.current&&clearInterval(tH.current),tW.current&&clearTimeout(tW.current)},[]);let sk=(0,s.useRef)(null);(0,s.useEffect)(()=>{sk.current=eb?.id??null},[eb]),(0,s.useEffect)(()=>H(e=>{if("task.messages"===e.type&&e.taskId===sk.current){let t=e.messages.filter(e=>e.seq>tV.current);t.length>0&&(ew(e=>{let s=new Set(e.map(e=>e.seq)),a=t.filter(e=>!s.has(e.seq));return a.length>0?[...e,...a]:e}),tV.current=Math.max(...t.map(e=>e.seq),tV.current))}if("task.created"===e.type&&e.conversationId===ed?.id){(0,j.listMessages)(e.conversationId,x).then(({messages:t})=>{ef(e=>eR(e,t)),(0,y.mergeCachedMessages)(e.conversationId,t,null,x).catch(()=>{})}).catch(()=>{});let t=e.task;sk.current=t.id,ej(t),ew([]),tV.current=0,tQ.current?.(t.id,e.conversationId)}if("task.created"===e.type){let t=e.task,s=sh.current;(0,y.getLastOpenConversation)(X,s,x).then(e=>{let a=function(e){let{task:t,agentId:s,activeChannel:a,currentPointerConvId:r}=e;return t.agent_id!==s||(t.channel??"default")!==a||t.conversation_id===r?null:t.conversation_id}({task:t,agentId:X,activeChannel:s,currentPointerConvId:e?.conversation_id??null});if(a)return(0,y.getCacheMeta)(a,x).then(e=>(0,y.setLastOpenConversation)(X,s,{conversation_id:a,newestMessageId:e?.newestMessageId??null,serverMessageCount:e?.messageCount??0},x))}).catch(()=>{})}if("conversation.message"===e.type&&(e.conversationId===t2.current&&(0,y.appendCachedMessage)(e.conversationId,e.message,x).catch(()=>{}),e.conversationId===ed?.id&&ef(t=>{let s=new Date(e.message.created_at).getTime(),a=t.findIndex(t=>t.id.startsWith("temp-")&&t.role===e.message.role&&t.content===e.message.content&&2e3>Math.abs(new Date(t.created_at).getTime()-s));if(-1!==a){let s=[...t];return s[a]=e.message,s}return eR(t,[e.message])})),"task.updated"===e.type&&e.taskId===sk.current&&ej(t=>t?{...t,status:e.status}:t),"artifact.uploaded"===e.type&&e.conversationId===ed?.id&&eH(t=>t.some(t=>t.id===e.artifact.id)?t:[...t,e.artifact]),"followup.dispatched"===e.type&&e.conversationId===ed?.id){ti(t=>t.filter(t=>t.id!==e.message.id)),(0,j.listBufferedMessages)(e.conversationId,x).then(ti).catch(()=>{}),(0,j.listMessages)(e.conversationId,x).then(({messages:t})=>{ef(e=>eR(e,t)),(0,y.mergeCachedMessages)(e.conversationId,t,null,x).catch(()=>{})}).catch(()=>{});let t=e.task;sk.current=t.id,ej(t),ew([]),tQ.current?.(t.id,e.conversationId)}"followup.created"===e.type&&e.conversationId===ed?.id&&ti(t=>(function(e,t){if(e.some(e=>e.id===t.id))return e;let s=new Date(t.created_at).getTime();return e.some(e=>e.id.startsWith("temp-")&&2e3>Math.abs(new Date(e.created_at).getTime()-s))?e:[...e,t]})(t,e.message)),"followup.deleted"===e.type&&e.conversationId===ed?.id&&ti(t=>t.filter(t=>t.id!==e.messageId)),"followup.dispatch_failed"===e.type&&e.conversationId===ed?.id&&S.toast.error(e.error||"Failed to dispatch follow-up")}),[H,ed?.id,x,X]),(0,s.useEffect)(()=>W(()=>{ed?.id&&(0,y.getCacheMeta)(ed.id,x).then(e=>{(0,j.conversationInit)(ed.id,x,{newestMessageId:e?.newestMessageId??void 0,messageCount:e?.serverMessageCount??void 0}).then(e=>{!e.cache_valid&&e.messages&&(ef(t=>eR(t,e.messages)),tR.current(e.messages,e.has_more_messages,e.message_count).catch(()=>{}))}).catch(()=>{})})}),[W,ed?.id,x]);let sb=(0,s.useCallback)(e=>{let t=[];for(let s of e)s.size>0xa00000?S.toast.error(`"${s.name}" exceeds 10 MB limit`):t.push(s);t.length>0&&tn(e=>[...e,...t])},[]),sj=(0,s.useCallback)(e=>{let t=e.target.files;t&&(sb(Array.from(t)),e.target.value="")},[sb]),sy=(0,s.useCallback)(e=>{tn(t=>t.filter((t,s)=>s!==e))},[]),sw=(0,s.useCallback)(()=>{let e=window.getSelection();if(!e||e.isCollapsed||!e.rangeCount)return void t_(null);let t=e.toString().trim();if(!t)return void t_(null);let s=e.getRangeAt(0),a=s.commonAncestorContainer instanceof HTMLElement?s.commonAncestorContainer:s.commonAncestorContainer.parentElement;if(!a?.closest("[data-quote-source]"))return void t_(null);let r=s.getClientRects(),n=r[r.length-1]||s.getBoundingClientRect();t_({text:t,x:n.right,y:n.top-4})},[]);(0,s.useEffect)(()=>(document.addEventListener("selectionchange",sw),()=>document.removeEventListener("selectionchange",sw)),[sw]);let sN=(0,s.useCallback)(()=>{tC&&(ty(tC.text),t_(null),window.getSelection()?.removeAllRanges(),t4.current?.focus())},[tC]),[sC,s_]=(0,s.useState)(!1),sS=(0,s.useRef)(0),sT=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),sS.current++,e.dataTransfer.types.includes("Files")&&s_(!0)},[]),sM=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),sS.current--,0===sS.current&&s_(!1)},[]),sI=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),sE=(0,s.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),s_(!1),sS.current=0,sb(Array.from(e.dataTransfer.files))},[sb]),sA=async()=>{if(ed&&!ev){ek(!0);try{let e=await (0,j.cancelActiveTask)(ed.id,x);if(e){if(sk.current&&sk.current!==e.id)return;tH.current&&clearInterval(tH.current),tH.current=null;let[t,s]=await Promise.all([(0,j.listMessages)(ed.id,x),(0,j.listBufferedMessages)(ed.id,x)]);ef(e=>eR(e,t.messages)),(0,y.mergeCachedMessages)(ed.id,t.messages,null,x).catch(()=>{}),ti(s),ej(e),ew([])}}catch{S.toast.error("Failed to cancel task")}finally{ek(!1)}}},sz=async()=>{let e=eh.trim();if(!e&&0===tr.length||ep||!ed)return;if(!e)return void S.toast.error("Please type a message");let t=tj?`> ${tj.split("\n").join("\n> ")}
|
|
2
|
-
|
|
3
|
-
${e}`:e;sa.activeSkill&&(t=`/${sa.activeSkill.name} ${t}`);let s=[...tr];if(eg(""),tn([]),ty(null),sa.clearActiveSkill(),ex(!0),eb&&!["completed","failed","cancelled","superseded"].includes(eb.status)){let e=`temp-${Date.now()}`,a={id:e,conversation_id:ed.id,role:"user",content:t,task_id:null,attachment_ids:null,status:"buffered",created_at:new Date().toISOString()};ti(e=>[...e,a]);try{let{message:a}=await (0,j.createBufferedMessage)(ed.id,t,x,s.length>0?s:void 0);ti(t=>t.some(e=>e.id===a.id)?t.filter(t=>t.id!==e):t.map(t=>t.id===e?a:t))}catch(a){ti(t=>t.filter(t=>t.id!==e)),eg(t),tn(s),S.toast.error(a instanceof Error?a.message:"Failed to queue follow-up")}finally{ex(!1)}return}let a=`temp-${Date.now()}`,r={id:a,conversation_id:ed.id,role:"user",content:t,task_id:null,attachment_ids:null,created_at:new Date().toISOString()};s.length>0&&tb(e=>{let t=new Map(e);return t.set(a,s),t}),ef(e=>[...e,r]),sr();try{let{message:e,task:n}=await (0,j.sendMessage)(ed.id,t,x,s.length>0?s:void 0);tb(e=>{if(!e.has(a))return e;let t=new Map(e);return t.delete(a),t}),ef(t=>{if(!t.some(e=>e.id===r.id))return t.some(t=>t.id===e.id)?t:ez([...t,e]);let s=t.filter(t=>t.id!==r.id&&t.id!==e.id);return ez([...s,e])}),(0,y.appendCachedMessage)(ed.id,e,x).catch(()=>{}),e.attachment_ids&&e.attachment_ids.length>0&&(0,j.listArtifacts)(ed.id,x).then(e=>eH(e)).catch(()=>{}),ej(n),ew([]),sv(n.id,ed.id)}catch(e){tb(e=>{if(!e.has(a))return e;let t=new Map(e);return t.delete(a),t}),ef(e=>e.filter(e=>e.id!==r.id)),eg(t),tn(s),S.toast.error(e instanceof Error?e.message:"Failed to send message")}finally{ex(!1),t4.current?.focus()}},sR=(0,s.useCallback)(async()=>{if(!eb||!ed)return;let e=await (0,j.retryTask)(eb.id,x);ej(e),ew([]),sv(e.id,ed.id)},[eb,ed,x,sv]),sD=(0,s.useCallback)(async e=>{let t=tM.current.has(e);tT(s=>{let a=new Set(s);return t?a.delete(e):a.add(e),a}),t?(tE(),(0,j.unflagMessage)(x,e).then(()=>{tA()}).catch(()=>{tT(t=>new Set(t).add(e)),tI()})):(tI(),(0,j.flagMessage)(x,e).then(()=>{tA()}).catch(()=>{tT(t=>{let s=new Set(t);return s.delete(e),s}),tE()}))},[x,tI,tE,tA]),sL=(0,s.useCallback)(async e=>{e4(e),e5(!0),e7(!0),tt(null),ta(null);try{let t=await (0,j.getIssue)(x,e);e6(t),t.issue.latest_task_id&&(0,j.getTask)(t.issue.latest_task_id,x).then(e=>ta(e)).catch(()=>ta(null)),t.issue.trace_id&&(0,j.getTrace)(t.issue.trace_id,x).then(e=>tt(e.tasks)).catch(()=>tt(null))}catch(e){S.toast.error(e instanceof Error?e.message:"Failed to load issue"),e5(!1)}finally{e7(!1)}},[x]),sF=e8?.issue?.conversation_id??null,sP=e8?.issue?.latest_task_id??null;(0,s.useEffect)(()=>{if(e2&&e3)return H(e=>{if("task.updated"===e.type&&sP&&e.taskId===sP&&(0,j.getTask)(sP,x).then(e=>ta(e)).catch(()=>{}),"conversation.message"===e.type&&sF&&e.conversationId===sF&&(e6(t=>!t||t.messages.some(t=>t.id===e.message.id)?t:{...t,messages:[...t.messages,e.message]}),"event"===e.message.role&&e.message.content.startsWith("Issue status changed:"))){let t=e.message.content.match(/-> (\w+)/);t&&e6(e=>e?{...e,issue:{...e.issue,status:t[1]}}:e)}"issue.comment"===e.type&&e.issueId===e3&&e6(t=>!t||t.comments.some(t=>t.id===e.comment.id)?t:{...t,comments:[...t.comments,e.comment]})})},[e2,e3,sF,sP,x,H]);let[s$,sq]=(0,s.useState)(!1),[sB,sO]=(0,s.useState)(!1),sH=(0,s.useMemo)(()=>!!ed&&em.some(e=>e.conversation_id===ed.id),[ed,em]),sW=async()=>{if(ed&&sH&&!s$){sq(!0);try{tH.current&&(clearInterval(tH.current),tH.current=null);let e=await (0,j.createConversation)(X,x,V);tg(t=>[...t,{agentName:so,created_at:e.created_at,id:`nap-${ed.id}`}]),tu(e=>[{id:ed.id,created_at:ed.created_at},...e]),eu(e),ej(null),ew([]),eH([]),ti([]),tn([]),tb(new Map),tV.current=0,eT(!1),eA(!1),tZ.current=null,sr()}catch{S.toast.error("Failed to start new conversation")}finally{sq(!1)}}},sU=!!eb&&!["completed","failed","cancelled","superseded"].includes(eb.status);return eN?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex-1 overflow-y-auto px-3 md:px-5",children:(0,t.jsxs)("div",{className:"mx-auto max-w-2xl py-6 space-y-4",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(T.Skeleton,{className:"h-10 w-48 rounded-lg"})}),(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"space-y-2 px-1 py-1",children:[(0,t.jsx)(T.Skeleton,{className:"h-4 w-72"}),(0,t.jsx)(T.Skeleton,{className:"h-4 w-56"}),(0,t.jsx)(T.Skeleton,{className:"h-4 w-64"})]})}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(T.Skeleton,{className:"h-10 w-36 rounded-lg"})}),(0,t.jsx)("div",{className:"flex justify-start",children:(0,t.jsxs)("div",{className:"space-y-2 px-1 py-1",children:[(0,t.jsx)(T.Skeleton,{className:"h-4 w-64"}),(0,t.jsx)(T.Skeleton,{className:"h-4 w-48"})]})})]})}),(0,t.jsx)("div",{className:"px-3 md:px-5 pt-3 pb-5 md:pb-6",children:(0,t.jsx)("div",{className:"mx-auto max-w-2xl",children:(0,t.jsx)(T.Skeleton,{className:"h-12 w-full rounded-3xl"})})})]}):eN||ed||0!==em.length?(0,t.jsxs)(t.Fragment,{children:[tC&&(0,t.jsxs)("button",{type:"button",className:"fixed z-50 flex items-center gap-1 px-2 py-1 rounded-md bg-popover border shadow-md text-xs text-popover-foreground hover:bg-accent transition-colors",style:{left:tC.x,top:tC.y,transform:"translate(-100%, -100%)"},onMouseDown:e=>e.preventDefault(),onClick:sN,children:[(0,t.jsx)(D,{className:"size-3"}),"Quote"]}),(0,t.jsxs)("div",{className:"relative flex-1 min-h-0",children:[(0,t.jsx)("div",{className:"h-full overflow-y-auto overflow-x-hidden px-3 md:px-5 thin-scrollbar",ref:tO,onScroll:sx,onClick:e=>{e.target.closest('[data-streamdown="code-block-actions"] button')&&S.toast.success("Copied to clipboard")},children:(0,t.jsxs)("div",{className:"mx-auto max-w-2xl pt-6 pb-15 min-w-0",children:[ed&&sp&&!eq&&(0,t.jsx)("div",{className:"flex justify-center py-2",children:(0,t.jsx)("button",{onClick:()=>sg(),className:"text-xs text-muted-foreground hover:text-foreground transition-colors",children:"Load earlier messages"})}),eq&&(0,t.jsx)("div",{className:"flex justify-center py-2",children:(0,t.jsx)(d.Loader2,{className:"size-4 animate-spin text-muted-foreground"})}),0===em.length&&!eb&&(m=k.find(e=>e.id===X),f=m?.created_at&&tv-new Date(m.created_at).getTime()<3e5,h=(O[X]??0)>0,f&&h&&"default"===V?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-20 gap-3 animate-[fade-up_400ms_ease-out_both]",children:[(0,t.jsxs)("div",{className:"relative animate-bounce",children:[(0,t.jsx)(R.Mail,{className:"size-8 text-primary"}),(0,t.jsxs)("span",{className:"absolute -top-1 -right-1 flex size-3",children:[(0,t.jsx)("span",{className:"animate-ping absolute inline-flex size-full rounded-full bg-primary/60"}),(0,t.jsx)("span",{className:"relative inline-flex size-3 rounded-full bg-primary"})]})]}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground text-center max-w-xs",children:"Your agent is sending you a welcome email."}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60 text-center max-w-xs",children:"Wait for the email task in the top-left to complete, then check your inbox. Or send a message below to start chatting."})]}):(0,t.jsx)("p",{className:"text-center text-muted-foreground py-20 text-sm",children:"Send a message to start chatting with the agent."})),tP.map((e,s)=>{let a=t$[s],r="first"===a||"solo"===a||null===a,n=0===s?"":r?"mt-4":"mt-0.5";if("nap"===e.kind)return(0,t.jsx)("div",{className:n,children:(0,t.jsx)(eF,{agentName:so})},e.data.id);if("artifact"===e.kind)return(0,t.jsx)("div",{className:n,children:(0,t.jsx)(eP,{artifact:e.data,version:tL.get(e.data.id)??1,hasDuplicates:tF.has(e.data.filename),onClick:tq})},`artifact-${e.data.id}`);let l=e.data;return(0,t.jsx)("div",{className:n,children:(0,t.jsx)(eC,{msg:l,agents:k,artifacts:eO,activeTask:eb,taskMessages:ey,connectionLost:eS,isLastMessage:em.length>0&&em[em.length-1].id===l.id,thinkingCount:l.task_id?tp[l.task_id]??0:0,targetConvId:ea,workspaceId:x,conversationType:ed?.type,pendingFilesByMessage:tk,onArtifactClick:tq,onEmailClick:e=>{eJ(e),eX(!0)},onCalendarEventClick:e=>{e1(e),eZ(!0)},onIssueClick:e=>sL(e),onRetry:sR,mentionComponents:eE,isFlagged:tS.has(l.id),onToggleFlag:"assistant"===l.role?sD:void 0,groupPosition:a??"solo",provider:ee})},l.id)}),eb&&eb.conversation_id===ed?.id&&!["completed","failed","cancelled","superseded"].includes(eb.status)&&(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(b,{task:eb,messages:ey,connectionLost:eS,provider:ee})})]})}),(0,t.jsx)(ec.ScrollToBottomButton,{scrollRef:tO})]}),ed&&(0,t.jsx)(eo,{bufferedMessages:tl,onDelete:e=>{ti(t=>t.filter(t=>t.id!==e)),(0,j.deleteBufferedMessage)(ed.id,e,x).catch(()=>{ti(tl),S.toast.error("Failed to delete follow-up")})}}),(0,t.jsx)("div",{"data-keyboard-offset":!0,className:"relative z-10 px-3 md:px-5 pt-3 pb-[max(1.25rem,env(safe-area-inset-bottom))] md:pb-6",children:(0,t.jsx)("div",{className:"mx-auto max-w-2xl relative",children:(0,t.jsxs)("div",{className:"flex items-end gap-2",children:[!ea&&(0,t.jsxs)(eI.Popover,{open:sB,onOpenChange:sO,children:[(0,t.jsx)(eI.PopoverTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon-sm",className:"shrink-0 self-end mb-2.5 size-8 rounded-full text-muted-foreground/60 hover:text-foreground transition-colors duration-200"}),children:(0,t.jsx)(L.MoreHorizontal,{className:"size-4"})}),(0,t.jsx)(eI.PopoverContent,{side:"top",align:"start",className:"w-auto p-1.5 flex flex-col gap-0.5",children:(0,t.jsxs)(M.Tooltip,{children:[(0,t.jsx)(M.TooltipTrigger,{render:e=>(0,t.jsx)("span",{...e,className:(0,o.cn)("inline-flex",e.className),children:(0,t.jsxs)(l.Button,{variant:"ghost",size:"sm",onClick:()=>{sO(!1),sW()},disabled:s$||!ed||!sH||sU,className:"w-full justify-start gap-2 rounded-md text-muted-foreground hover:text-foreground",children:[s$?(0,t.jsx)(d.Loader2,{className:"size-3.5 animate-spin"}):(0,t.jsx)(A,{className:"size-3.5"}),(0,t.jsx)("span",{className:"text-xs",children:"Nap"})]})})}),(0,t.jsx)(M.TooltipContent,{side:"right",children:sU?"Wait for the task to finish":sH?"Take a nap":`${so} is well-rested and ready to go`})]})})]}),(0,t.jsxs)("div",{className:(0,o.cn)("relative flex-1 min-w-0 flex flex-col rounded-3xl border border-border/50 bg-background/90 transition-[border-radius] duration-200","focus-within:border-ring focus-within:ring-3 focus-within:ring-ring/50",(tw||tj||sa.activeSkill)&&"rounded-2xl",ep&&"opacity-50",sC&&"border-ring ring-3 ring-ring/50"),onDragEnter:sT,onDragLeave:sM,onDragOver:sI,onDrop:sE,children:[sC&&(0,t.jsx)("div",{className:(0,o.cn)("absolute inset-0 z-10 flex items-center justify-center bg-background/80 border-2 border-dashed border-ring pointer-events-none",tw||tj||sa.activeSkill?"rounded-2xl":"rounded-3xl"),children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground font-medium",children:"Drop files here"})}),sa.activeSkill&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2.5 pb-1 border-b border-border/50",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[(0,t.jsxs)("span",{className:"shrink-0 text-xs font-medium text-primary",children:["/",sa.activeSkill.name]}),sa.activeSkill.isGlobal&&(0,t.jsx)("span",{className:"text-[10px] font-medium text-muted-foreground bg-muted rounded px-1 py-0.5",children:"Global"}),(0,t.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:sa.activeSkill.description})]}),(0,t.jsx)("button",{type:"button",onClick:sa.clearActiveSkill,className:"shrink-0 p-0.5 rounded-sm hover:bg-muted-foreground/20 transition-colors text-muted-foreground",children:(0,t.jsx)($.X,{className:"size-3.5"})})]}),tj&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-2.5 pb-1 border-b border-border/50",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0 flex items-start gap-2",children:[(0,t.jsx)(D,{className:"size-3.5 shrink-0 mt-0.5 text-muted-foreground"}),(0,t.jsxs)("p",{className:"text-xs text-muted-foreground truncate",children:[tj.slice(0,120),tj.length>120?"...":""]})]}),(0,t.jsx)("button",{type:"button",onClick:()=>ty(null),className:"shrink-0 p-0.5 rounded-sm hover:bg-muted-foreground/20 transition-colors text-muted-foreground",children:(0,t.jsx)($.X,{className:"size-3.5"})})]}),(0,t.jsx)(B,{isOpen:sa.isOpen,skills:sa.skills,selectedIndex:sa.selectedIndex,onSelect:sa.selectSkill,anchorPos:sa.anchorPos}),tr.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 px-3.5 pt-3 pb-0.5",children:tr.map((e,s)=>(0,t.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs text-muted-foreground",children:[(0,t.jsx)(z.FileText,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate max-w-30",children:e.name}),(0,t.jsx)("span",{className:"text-muted-foreground/60",children:(0,Z.formatSize)(e.size)}),(0,t.jsx)("button",{type:"button",onClick:()=>sy(s),className:"ml-0.5 rounded-sm p-0.5 hover:bg-muted-foreground/20 transition-colors",children:(0,t.jsx)($.X,{className:"size-3"})})]},`${e.name}-${s}`))}),(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)("input",{ref:t3,type:"file",multiple:!0,className:"hidden",onChange:sj}),(0,t.jsx)("div",{className:"px-13 py-3",children:(0,t.jsx)(Q,{ref:t4,value:eh,onChange:eg,onEditorState:(e,t)=>{t6(e),tc(t)},onSend:sz,placeholder:sU?"Type a follow-up...":"Type a task...",disabled:ep,onMultiLineChange:tN,onFiles:sb,agents:t9,agentLinks:q,currentAgentId:X,slashIsOpen:sa.isOpen,onSlashKeyDown:sa.handleSlashKeyDown})}),(0,t.jsxs)(M.Tooltip,{children:[(0,t.jsx)(M.TooltipTrigger,{render:(0,t.jsx)(l.Button,{variant:"ghost",size:"icon-sm",onPointerDown:e=>e.preventDefault(),onClick:()=>t3.current?.click(),disabled:ep,className:"absolute left-2 bottom-2 size-8 rounded-full text-muted-foreground/60 hover:text-foreground transition-colors duration-200"}),children:(0,t.jsx)(F.Paperclip,{className:"size-3.5"})}),(0,t.jsx)(M.TooltipContent,{side:"top",children:"Attach files"})]}),!sU||eh.trim()||ep?(0,t.jsxs)(M.Tooltip,{children:[(0,t.jsx)(M.TooltipTrigger,{render:(0,t.jsx)(l.Button,{size:"icon-sm",onClick:sz,disabled:!eh.trim()||ep,className:(0,o.cn)("absolute right-2 bottom-2 size-8 rounded-full bg-primary text-primary-foreground transition-opacity duration-200",!eh.trim()&&"opacity-30")}),children:ep?(0,t.jsx)(d.Loader2,{className:"size-3.5 animate-spin"}):(0,t.jsx)(I.ArrowUp,{className:"size-3.5"})}),(0,t.jsx)(M.TooltipContent,{side:"top",children:"Send"})]}):(0,t.jsxs)(M.Tooltip,{children:[(0,t.jsx)(M.TooltipTrigger,{render:(0,t.jsx)(l.Button,{size:"icon-sm",onClick:sA,disabled:ev,className:"absolute right-2 bottom-2 size-8 rounded-full bg-red-500/10 text-red-500 hover:bg-red-500/20 transition-colors duration-200"}),children:ev?(0,t.jsx)(d.Loader2,{className:"size-3.5 animate-spin"}):(0,t.jsx)(P.Square,{className:"size-3.5 fill-current"})}),(0,t.jsx)(M.TooltipContent,{side:"top",children:"Stop task"})]})]})]}),!ea&&(0,t.jsx)("div",{className:"shrink-0 self-end mb-2.5 size-8","aria-hidden":"true"})]})})}),(0,t.jsx)(Z.ArtifactSheet,{open:eW,onOpenChange:e=>{eU(e),e||setTimeout(()=>{eK(null)},300)},artifacts:eV?[eV]:tD,workspaceId:x,initialArtifact:eV,versionMap:tL,duplicateFilenames:tF}),(0,t.jsx)(er,{open:eY,onOpenChange:e=>{eX(e),e||setTimeout(()=>eJ(null),300)},emailId:eG,workspaceId:x}),(0,t.jsx)(en.CalendarEventSheet,{readonly:!0,open:eQ,onOpenChange:e=>{eZ(e),e||setTimeout(()=>e1(null),300)},calendarEventId:e0,workspaceId:x}),(0,t.jsx)(el.IssueSheet,{open:e2,onOpenChange:e=>{e5(e),e||setTimeout(()=>{e4(null),e6(null),ta(null)},300)},agents:k,issue:e8?.issue??null,detail:e8?{messages:e8.messages,comments:e8.comments,artifacts:e8.artifacts,traceId:e8.issue.trace_id}:null,detailLoading:e9,activeTask:ts,traceTasks:te,slug:v,workspaceId:x,onUpdate:async(e,t)=>{try{let s=await (0,j.updateIssue)(x,e,t);e6(a=>a&&a.issue.id===e?{...a,issue:{...a.issue,...t,updated_at:s.updated_at}}:a)}catch(e){S.toast.error(e instanceof Error?e.message:"Failed to update issue")}},onStatusChange:async(e,t)=>{try{await (0,j.updateIssue)(x,e,{status:t}),e6(s=>s&&s.issue.id===e?{...s,issue:{...s.issue,status:t}}:s)}catch(e){S.toast.error(e instanceof Error?e.message:"Failed to update status")}},onCommented:()=>{e3&&sL(e3)},onArtifactClick:tB})]}):(0,t.jsx)("div",{className:"flex flex-1 items-center justify-center text-sm text-muted-foreground",children:"Failed to load conversation"})}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,527746,e=>{"use strict";var t=e.i(368075),s=e.i(298699),a=e.i(208020),i=e.i(500324),n=e.i(186339),l=e.i(875061),r=e.i(332680),c=e.i(393153),o=e.i(728886),d=e.i(147881),u=e.i(949035),m=e.i(745925),x=e.i(541544),p=e.i(313101),g=e.i(108281),h=e.i(371522),f=e.i(676214);let j=(0,e.i(406963).default)("shield-check",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);var v=e.i(880932),b=e.i(613349),N=e.i(222862);let y={pending:{label:"Pending",variant:"outline",icon:p.Clock},scheduled:{label:"Scheduled",variant:"secondary",icon:p.Clock},joining:{label:"Joining...",variant:"default",icon:h.Loader2},recording:{label:"Recording",variant:"default",icon:d.Video},completed:{label:"Completed",variant:"secondary",icon:x.Check},failed:{label:"Failed",variant:"destructive",icon:g.AlertCircle}};function k({status:e}){let s=y[e]??y.pending,a=s.icon;return(0,t.jsxs)(l.Badge,{variant:s.variant,className:"gap-1 text-[10px]",children:[(0,t.jsx)(a,{className:(0,b.cn)("size-2.5","joining"===e&&"animate-spin","recording"===e&&"animate-pulse")}),s.label]})}function C(e){return e?new Date(e).toLocaleString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):""}e.s(["default",0,function(){let e=(0,a.useParams)().id,{workspaceId:l}=(0,i.useWorkspace)(),[x,p]=(0,s.useState)([]),[g,y]=(0,s.useState)(!0),[S,M]=(0,s.useState)(!1),[w,z]=(0,s.useState)(!1),[B,_]=(0,s.useState)(null),[F,T]=(0,s.useState)(!1),[P,J]=(0,s.useState)(""),[R,U]=(0,s.useState)(""),[A,L]=(0,s.useState)(""),O=(0,s.useCallback)(async()=>{try{let t=await (0,N.listMeetings)(e,l);p(t)}catch{v.toast.error("Failed to load meetings")}finally{y(!1)}},[e,l]);(0,s.useEffect)(()=>{let t=!1;return(0,N.listMeetings)(e,l).then(e=>{t||(p(e),y(!1))}).catch(()=>{t||(v.toast.error("Failed to load meetings"),y(!1))}),()=>{t=!0}},[e,l]),(0,s.useEffect)(()=>{if(!x.some(e=>"joining"===e.status||"recording"===e.status))return;let e=setInterval(O,5e3);return()=>clearInterval(e)},[x,O]);let D=async()=>{if(P){z(!0);try{let t=A.split(/[,\n]/).map(e=>e.trim()).filter(Boolean);await (0,N.createMeeting)(e,l,{meetingUrl:P,title:R||void 0,participants:t.length>0?t:void 0}),v.toast.success("Meeting created"),M(!1),J(""),U(""),L(""),O()}catch(e){v.toast.error(e instanceof Error?e.message:"Failed to create meeting")}finally{z(!1)}}},E=async t=>{try{await (0,N.stopMeeting)(e,t.id,l),v.toast.success("Meeting stopped"),O()}catch{v.toast.error("Failed to stop meeting")}},V=async t=>{try{await (0,N.approveMeeting)(e,t.id,l),v.toast.success("Meeting approved"),O()}catch{v.toast.error("Failed to approve meeting")}},G=async()=>{if(B){T(!0);try{await (0,N.deleteMeeting)(e,B.id,l),v.toast.success("Meeting deleted"),_(null),O()}catch{v.toast.error("Failed to delete meeting")}finally{T(!1)}}};return(0,t.jsxs)("div",{className:"flex-1 flex flex-col min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3 border-b border-border/50",children:[(0,t.jsx)("h2",{className:"text-sm font-medium",children:"Meetings"}),(0,t.jsxs)(n.Button,{size:"sm",onClick:()=>M(!0),className:"gap-1",children:[(0,t.jsx)(u.Plus,{className:"size-3"}),"Join Meeting"]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-y-auto thin-scrollbar",children:g?(0,t.jsx)("div",{className:"p-4 space-y-3",children:[1,2,3].map(e=>(0,t.jsx)(o.Skeleton,{className:"h-16 w-full rounded-lg"},e))}):0===x.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center h-full text-muted-foreground gap-2 p-8",children:[(0,t.jsx)(d.Video,{className:"size-8 opacity-40"}),(0,t.jsx)("p",{className:"text-sm",children:"No meetings yet"}),(0,t.jsx)("p",{className:"text-xs",children:"Join a Google Meet to start recording transcripts."})]}):(0,t.jsx)("div",{className:"p-2 space-y-1",children:x.map(e=>(0,t.jsxs)("div",{className:(0,b.cn)("flex items-center gap-3 rounded-lg border border-border/50 px-3 py-2.5 transition-colors","pending"===e.status&&!e.is_whitelisted&&"opacity-60"),children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-0.5",children:[(0,t.jsx)("span",{className:"text-sm font-medium truncate",children:e.title||"Untitled Meeting"}),(0,t.jsx)(k,{status:e.status})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[(0,t.jsx)("span",{className:"truncate",children:e.meeting_url.replace("https://","")}),e.scheduled_at&&(0,t.jsx)("span",{className:"shrink-0",children:C(e.scheduled_at)}),e.started_at&&!e.completed_at&&(0,t.jsxs)("span",{className:"shrink-0",children:["Started ",C(e.started_at)]}),e.completed_at&&(0,t.jsx)("span",{className:"shrink-0",children:C(e.completed_at)}),e.participants?.length>0&&(0,t.jsxs)("span",{className:"shrink-0",children:[e.participants.length," participants"]})]}),e.error&&(0,t.jsx)("p",{className:"text-xs text-destructive mt-1 truncate",children:e.error})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0",children:["pending"===e.status&&(0,t.jsxs)(n.Button,{variant:"outline",size:"xs",className:"gap-1",onClick:()=>V(e),children:[(0,t.jsx)(j,{className:"size-3"}),"Approve"]}),("recording"===e.status||"joining"===e.status)&&(0,t.jsxs)(n.Button,{variant:"outline",size:"xs",className:"gap-1 text-destructive",onClick:()=>E(e),children:[(0,t.jsx)(m.Square,{className:"size-3"}),"Stop"]}),(0,t.jsx)(n.Button,{variant:"ghost",size:"icon-sm",className:"text-muted-foreground hover:text-destructive",onClick:()=>_(e),children:(0,t.jsx)(f.Trash2,{className:"size-3"})})]})]},e.id))})}),(0,t.jsx)(r.Sheet,{open:S,onOpenChange:M,children:(0,t.jsxs)(r.SheetContent,{children:[(0,t.jsx)(r.SheetHeader,{children:(0,t.jsx)(r.SheetTitle,{children:"Join a Meeting"})}),(0,t.jsxs)(r.SheetBody,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Google Meet URL *"}),(0,t.jsx)("input",{type:"url",placeholder:"https://meet.google.com/abc-defg-hij",value:P,onChange:e=>J(e.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Title"}),(0,t.jsx)("input",{type:"text",placeholder:"Weekly Standup",value:R,onChange:e=>U(e.target.value),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground mb-1 block",children:"Participants (one email per line)"}),(0,t.jsx)("textarea",{placeholder:"alice@example.com\nbob@example.com",value:A,onChange:e=>L(e.target.value),rows:3,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm outline-none focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,t.jsxs)(r.SheetFooter,{children:[(0,t.jsx)(n.Button,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),(0,t.jsxs)(n.Button,{onClick:D,disabled:w||!P,children:[w&&(0,t.jsx)(h.Loader2,{className:"size-3 animate-spin"}),"Join Meeting"]})]})]})}),(0,t.jsx)(c.ConfirmDialog,{open:!!B,onOpenChange:e=>!e&&_(null),title:"Delete meeting",description:`Remove "${B?.title||"this meeting"}" and its transcript?`,loading:F,onConfirm:G})]})}],527746)}]);
|