thursday-agent 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/prerender-manifest.json +3 -3
  4. package/.next/server/app/_global-error.html +1 -1
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  9. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  10. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  11. package/.next/server/app/_not-found.html +1 -1
  12. package/.next/server/app/_not-found.rsc +2 -2
  13. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  14. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  15. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  16. package/.next/server/app/api/artifact/route.js +3 -3
  17. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  18. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  19. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  23. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  24. package/.next/server/app/api/memory/edit/route.js +1 -1
  25. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  26. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  27. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  28. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  29. package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
  30. package/.next/server/app/api/thursday/tool-call/route.js +1 -1
  31. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  32. package/.next/server/app/api/workspace/missing/route.js +2 -2
  33. package/.next/server/app/api/workspace/missing/route.js.nft.json +1 -1
  34. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  35. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
  36. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  37. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/page/server-reference-manifest.json +42 -42
  39. package/.next/server/app/page.js +5 -4
  40. package/.next/server/app/page.js.nft.json +1 -1
  41. package/.next/server/app/page_client-reference-manifest.js +1 -1
  42. package/.next/server/chunks/[root-of-the-server]__0-06t3f._.js +8 -0
  43. package/.next/server/chunks/{[root-of-the-server]__049f521._.js → [root-of-the-server]__06l05n_._.js} +1 -1
  44. package/.next/server/chunks/[root-of-the-server]__0_ue8oe._.js +1 -1
  45. package/.next/server/chunks/{[root-of-the-server]__0ye3da2._.js → [root-of-the-server]__0btqrct._.js} +1 -1
  46. package/.next/server/chunks/[root-of-the-server]__0c9fgca._.js +1 -1
  47. package/.next/server/chunks/[root-of-the-server]__0zp35ul._.js +1 -1
  48. package/.next/server/chunks/[root-of-the-server]__1kv8p3e._.js +1 -1
  49. package/.next/server/chunks/_02szwk8._.js +1 -1
  50. package/.next/server/chunks/_06c9kie._.js +24 -24
  51. package/.next/server/chunks/_0i55en5._.js +6 -6
  52. package/.next/server/chunks/_0p56fn0._.js +1 -1
  53. package/.next/server/chunks/_11ujpya._.js +1 -1
  54. package/.next/server/chunks/_1dbixxz._.js +1 -1
  55. package/.next/server/chunks/_1dc_d1q._.js +16 -16
  56. package/.next/server/chunks/_1gnjfli._.js +3 -0
  57. package/.next/server/chunks/_1klbcft._.js +1 -1
  58. package/.next/server/chunks/features_0-cnt0l._.js +1 -1
  59. package/.next/server/chunks/features_0hdaci0._.js +1 -1
  60. package/.next/server/chunks/ssr/[root-of-the-server]__0-e011f._.js +3 -0
  61. package/.next/server/chunks/ssr/[root-of-the-server]__0pd8yr7._.js +3 -0
  62. package/.next/server/chunks/ssr/[root-of-the-server]__1nygfik._.js +1 -1
  63. package/.next/server/chunks/ssr/[root-of-the-server]__1sdphb0._.js +1 -1
  64. package/.next/server/chunks/ssr/{[root-of-the-server]__1fll8dc._.js → [root-of-the-server]__1vdmfbe._.js} +2 -2
  65. package/.next/server/chunks/ssr/[root-of-the-server]__1waa3rc._.js +34 -49
  66. package/.next/server/chunks/ssr/{_1anqots._.js → _0-2qsxo._.js} +2 -2
  67. package/.next/server/chunks/ssr/_02oc_h5._.js +9 -9
  68. package/.next/server/chunks/ssr/_05yghx6._.js +1 -1
  69. package/.next/server/chunks/ssr/_07nbwap._.js +3 -0
  70. package/.next/server/chunks/ssr/_08c4z-9._.js +1 -1
  71. package/.next/server/chunks/ssr/_0_qfdlw._.js +1 -1
  72. package/.next/server/chunks/ssr/_0b6_jv-._.js +3 -0
  73. package/.next/server/chunks/ssr/_0hxt2ul._.js +1 -1
  74. package/.next/server/chunks/ssr/_0i_6q1w._.js +1 -1
  75. package/.next/server/chunks/ssr/{_18xqmny._.js → _0no7i1o._.js} +2 -2
  76. package/.next/server/chunks/ssr/_0tzg--b._.js +3 -0
  77. package/.next/server/chunks/ssr/{_1ztk7p6._.js → _114ylv7._.js} +3 -3
  78. package/.next/server/chunks/ssr/{_1k0spz7._.js → _12c-iwh._.js} +2 -2
  79. package/.next/server/chunks/ssr/_12w42gi._.js +1 -1
  80. package/.next/server/chunks/ssr/{_0eaog6_._.js → _167hchk._.js} +2 -2
  81. package/.next/server/chunks/ssr/{_1x9pskj._.js → _1_x5spz._.js} +3 -3
  82. package/.next/server/chunks/ssr/{_0dr-ddg._.js → _1a61fc9._.js} +2 -2
  83. package/.next/server/chunks/ssr/_1jmz33w._.js +1 -1
  84. package/.next/server/chunks/ssr/{_1y6b5mr._.js → _1w_t7h7._.js} +2 -2
  85. package/.next/server/chunks/ssr/{_0dh2e1j._.js → _1wyfaq_._.js} +7 -7
  86. package/.next/server/chunks/ssr/{[root-of-the-server]__0bxsfyn._.js → _200gt-m._.js} +4 -3
  87. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
  88. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  89. package/.next/server/chunks/ssr/{_0c9e5w6._.js → features_workspace_00jz2hu._.js} +3 -4
  90. package/.next/server/chunks/ssr/{node_modules_0746rzi._.js → node_modules_02ai7br._.js} +1 -1
  91. package/.next/server/chunks/ssr/{node_modules_0vsxbzp._.js → node_modules_02deexj._.js} +1 -1
  92. package/.next/server/chunks/ssr/{node_modules_1g1eihe._.js → node_modules_07za262._.js} +1 -1
  93. package/.next/server/chunks/ssr/{node_modules_0332gw4._.js → node_modules_0_s9get._.js} +1 -1
  94. package/.next/server/chunks/ssr/{node_modules_1gpednh._.js → node_modules_0n3c7h0._.js} +1 -1
  95. package/.next/server/chunks/ssr/{node_modules_0t-9nup._.js → node_modules_0od6jwr._.js} +1 -1
  96. package/.next/server/chunks/ssr/{node_modules_0mxvg8h._.js → node_modules_0rdt7pk._.js} +1 -1
  97. package/.next/server/chunks/ssr/{node_modules_0vv0-fg._.js → node_modules_0w1z7kz._.js} +1 -1
  98. package/.next/server/chunks/ssr/{node_modules_1d53yiq._.js → node_modules_0wdupfz._.js} +1 -1
  99. package/.next/server/chunks/ssr/{node_modules_1u6w1pb._.js → node_modules_1720w0a._.js} +1 -1
  100. package/.next/server/chunks/ssr/{node_modules_1gu1pph._.js → node_modules_18lsg7d._.js} +1 -1
  101. package/.next/server/chunks/ssr/{node_modules_1he1w8_._.js → node_modules_1b94fxf._.js} +1 -1
  102. package/.next/server/chunks/ssr/{node_modules_0qbfyjh._.js → node_modules_1ecdo1s._.js} +1 -1
  103. package/.next/server/chunks/ssr/{node_modules_0qapgjr._.js → node_modules_1fa9ag7._.js} +1 -1
  104. package/.next/server/chunks/ssr/{node_modules_0d5uzof._.js → node_modules_1fv-_si._.js} +1 -1
  105. package/.next/server/chunks/ssr/{node_modules_1lnjapm._.js → node_modules_1hf461g._.js} +1 -1
  106. package/.next/server/chunks/ssr/{node_modules_1-urho9._.js → node_modules_1m71ta-._.js} +1 -1
  107. package/.next/server/chunks/ssr/{node_modules_1lynj9m._.js → node_modules_1n93n-g._.js} +1 -1
  108. package/.next/server/chunks/ssr/{node_modules_0fr-ml8._.js → node_modules_1n9lqu9._.js} +1 -1
  109. package/.next/server/chunks/ssr/{node_modules_04vxchl._.js → node_modules_1npnsvd._.js} +1 -1
  110. package/.next/server/chunks/ssr/{node_modules_0exkwcm._.js → node_modules_1rn2r0n._.js} +1 -1
  111. package/.next/server/chunks/ssr/{node_modules_022sipm._.js → node_modules_1vq-mfk._.js} +1 -1
  112. package/.next/server/chunks/ssr/{node_modules_00_51_v._.js → node_modules_1vzyw1t._.js} +1 -1
  113. package/.next/server/chunks/ssr/{node_modules_0wsvp00._.js → node_modules_1w359w4._.js} +1 -1
  114. package/.next/server/chunks/ssr/{node_modules_1xn6saw._.js → node_modules_1yajbl6._.js} +1 -1
  115. package/.next/server/chunks/ssr/{node_modules_16pi_dd._.js → node_modules_20eqhy8._.js} +1 -1
  116. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_067_exa._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_019sbis._.js} +1 -1
  117. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0nrrdaq._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0s6piq3._.js} +1 -1
  118. package/.next/server/chunks/ssr/{node_modules_@vercel_oidc_dist_21a5haa._.js → node_modules_@vercel_oidc_dist_05itbb1._.js} +1 -1
  119. package/.next/server/middleware-build-manifest.js +3 -3
  120. package/.next/server/pages/404.html +1 -1
  121. package/.next/server/pages/500.html +1 -1
  122. package/.next/server/server-reference-manifest.js +1 -1
  123. package/.next/server/server-reference-manifest.json +43 -43
  124. package/.next/static/chunks/{0dr16v67vj4n7.js → 07vqbk_9t4em4.js} +2 -2
  125. package/.next/static/chunks/{2nvepds1fu2ux.js → 08krja1zx7nqg.js} +1 -1
  126. package/.next/static/chunks/{42wcg3wfg_m_p.js → 0qcuwdk132jjt.js} +1 -1
  127. package/.next/static/chunks/{2_pnccjp6j1ca.js → 0z69gvysmave7.js} +1 -1
  128. package/.next/static/chunks/12fvz1w5ows75.js +1 -0
  129. package/.next/static/chunks/14t03ned286iu.js +1 -0
  130. package/.next/static/chunks/{2jlz8zp4jax_m.js → 156xxbkrz5lzu.js} +1 -1
  131. package/.next/static/chunks/1fz14reod4lft.js +1 -0
  132. package/.next/static/chunks/{0joan-69kbspd.js → 1g23dbabl-vkr.js} +1 -1
  133. package/.next/static/chunks/{18mkhstgiqcbt.js → 1qy_rc3oxfxok.js} +1 -1
  134. package/.next/static/chunks/1zea7qdl-7365.js +1 -0
  135. package/.next/static/chunks/1zvqumkg7kmo0.css +1 -0
  136. package/.next/static/chunks/26hpqt3y6bogl.js +12 -0
  137. package/.next/static/chunks/{3zk6q3-3f9swq.js → 2_j5mqm6d-z18.js} +1 -1
  138. package/.next/static/chunks/{1vj_5bnbxx84e.js → 2dt6tu7a22svs.js} +1 -1
  139. package/.next/static/chunks/2h5ls3d86kya6.js +1 -0
  140. package/.next/static/chunks/2wc6y1ht6dfuy.js +1 -0
  141. package/.next/static/chunks/{1i-u2wzub_to1.js → 2xr0zpll7thyi.js} +6 -6
  142. package/.next/static/chunks/{26ql4y-43xwhp.js → 31jztc-yq30m7.js} +1 -1
  143. package/.next/static/chunks/391af0i8eljzk.js +1 -0
  144. package/.next/static/chunks/{1kp5nfp06nj9h.js → 3p2s2cjokx1aa.js} +2 -2
  145. package/.next/static/chunks/{1wlo979mx-y3w.js → 41s3fml5oivsa.js} +1 -1
  146. package/README.md +60 -19
  147. package/docs/how-it-works.md +2 -0
  148. package/docs/live-calls.md +38 -33
  149. package/features/ai/load-tools.ts +4 -2
  150. package/features/ai/prompts/bot.prompt.ts +5 -5
  151. package/features/ai/prompts/live.prompt.ts +36 -132
  152. package/features/ai/prompts/prompt-helper.ts +5 -4
  153. package/features/ai/prompts/thursday.prompt.ts +75 -54
  154. package/features/ai/tools/call.tool.ts +32 -4
  155. package/features/ai/tools/tool-name.ts +1 -0
  156. package/features/bot/bot.runner.ts +5 -5
  157. package/features/thursday/ascii.const.ts +74 -0
  158. package/features/thursday/components/ascii-orb.tsx +173 -30
  159. package/features/thursday/components/face.tsx +6 -1
  160. package/features/thursday/components/side-captions.tsx +273 -0
  161. package/features/thursday/components/tab-state.tsx +11 -3
  162. package/features/thursday/components/thursday-setting.tsx +6 -5
  163. package/features/thursday/components/thursday.tsx +227 -251
  164. package/features/thursday/face.store.ts +5 -0
  165. package/features/thursday/thursday.action.ts +4 -6
  166. package/features/thursday/thursday.schema.ts +10 -5
  167. package/features/thursday/thursday.store.ts +3 -0
  168. package/features/thursday/use-thursday.ts +461 -392
  169. package/features/workspace/file-kind.ts +9 -0
  170. package/hooks/use-hotkey.ts +3 -2
  171. package/lib/live/live.schema.ts +0 -21
  172. package/lib/live/live.server.ts +1 -3
  173. package/package.json +1 -1
  174. package/scripts/artifact-paths.test.mts +13 -0
  175. package/scripts/live-session.test.mts +56 -66
  176. package/.next/server/chunks/[root-of-the-server]__0g-ueei._.js +0 -8
  177. package/.next/server/chunks/node_modules_consola_dist_chunks_prompt_mjs_1kipdeo._.js +0 -3
  178. package/.next/server/chunks/ssr/[root-of-the-server]__172cq4x._.js +0 -3
  179. package/.next/server/chunks/ssr/_03_928f._.js +0 -3
  180. package/.next/server/chunks/ssr/_0g_rlog._.js +0 -3
  181. package/.next/server/chunks/ssr/_123ttsf._.js +0 -3
  182. package/.next/static/chunks/10k2xvap03z20.css +0 -1
  183. package/.next/static/chunks/1t9qms5pwwa3n.js +0 -1
  184. package/.next/static/chunks/2a51-ywz9b2a3.js +0 -1
  185. package/.next/static/chunks/2fvdgxih7x7hr.js +0 -1
  186. package/.next/static/chunks/3addj3i4-izma.js +0 -1
  187. package/.next/static/chunks/3gfh7nxwusbt0.js +0 -1
  188. package/.next/static/chunks/3gwa44cvz4qoi.js +0 -1
  189. package/.next/static/chunks/3zkg5iup3v4a2.js +0 -12
  190. package/.next/static/chunks/405m0bqtoihev.js +0 -1
  191. /package/.next/static/{0qzGoKn2wTERVZtblX1tp → yyRVBc0xxYQsh3GpbQX9b}/_buildManifest.js +0 -0
  192. /package/.next/static/{0qzGoKn2wTERVZtblX1tp → yyRVBc0xxYQsh3GpbQX9b}/_clientMiddlewareManifest.js +0 -0
  193. /package/.next/static/{0qzGoKn2wTERVZtblX1tp → yyRVBc0xxYQsh3GpbQX9b}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,457343,e=>{"use strict";var t=e.i(843476),n=e.i(867927),s=e.i(632781),a=e.i(456420);let i={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};i.node;let r=(0,a.default)(i);var o=e.i(929272),l=e.i(759659),d=e.i(263676),c=e.i(271645),u=e.i(798120),x=e.i(167881),h=e.i(630374),m=e.i(463415),p=e.i(917162),f=e.i(660302),g=e.i(671428),j=e.i(41533),b=e.i(330097),k=e.i(95187);let N=(0,k.createServerReference)("7f45bd8152273b835b8d00740e6ada4ffb33542287",k.callServer,void 0,k.findSourceMapURL,"clearFinishedThreadsAction"),v=(0,k.createServerReference)("7f1f4eedad50097c78f50ee80637fedd36da6d9a4d",k.callServer,void 0,k.findSourceMapURL,"deleteThreadAction");var w=e.i(451888),y=e.i(635963),S=e.i(279265),T=e.i(835878),D=e.i(222055),C=e.i(978411),M=e.i(895836),z=e.i(245629),A=e.i(609856),R=e.i(661504),I=e.i(283653),O=e.i(647163),$=e.i(399512);let F="w-36";function K({thread:e,bots:a,open:i,onOpen:r,onStop:o,onDelete:l}){let d="running"===e.status,u=(0,c.useMemo)(()=>(0,C.threadFromRow)(e,a),[e,a]),x=function(e){let t=e.room.questions[0];if(t)return{text:(0,O.plainText)(t.text),tone:O.WAITING_INK};if("waiting"===e.status&&e.ask)return{text:(0,w.isAppStop)(e.ask)?(0,O.plainText)(e.outcome??e.ask.question):e.ask.question,tone:O.WAITING_INK};let n=e.seen;if("cancelled"===e.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===e.status)return{text:(0,O.plainText)(e.outcome??"Done"),tone:n?"text-muted-foreground":"text-foreground/80"};for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("tool"===n.kind)return{text:n.note??n.input,tone:"text-muted-foreground",tool:n.name,shine:!0};if("text"===n.kind)return{text:n.text,tone:"text-muted-foreground",shine:!0};if("user"===n.kind)break}return{text:`${e.bot} is taking it on…`,tone:"text-muted-foreground italic",shine:!0}}(e),h=e.tokens.input+e.tokens.output;return(0,t.jsxs)("div",{className:(0,O.cn)("group/row relative transition-colors",i?"bg-muted/80":"hover:bg-muted/50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsxs)("button",{type:"button",onClick:r,className:"flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(y.BotMark,{size:40,seed:e.bot,...P(e.bot,a),state:d?"thinking":"idle",notify:(0,w.needsThreadReply)(e),crossed:"cancelled"===e.status,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),(0,t.jsx)(T.BotRoster,{bots:(0,C.rosterOf)(u)}),d&&(0,t.jsx)(s.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),x&&(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] leading-snug",children:[x.tool&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:x.tool}),x.shine?(0,t.jsx)(f.ShinyText,{text:x.text,speed:2.2,className:"min-w-0 truncate"}):(0,t.jsx)("span",{className:(0,O.cn)("min-w-0 truncate",x.tone),children:x.text})]})]}),(0,t.jsxs)("span",{className:(0,O.cn)("flex shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",F),children:[(0,t.jsx)("span",{children:(0,z.whenOf)(e.updatedAt)}),(0,t.jsxs)("span",{className:"max-w-full truncate text-muted-foreground/70",title:h>0?`${e.id} \xb7 in ${(0,O.formatCount)(e.tokens.input)} \xb7 out ${(0,O.formatCount)(e.tokens.output)}`:e.id,children:[e.bot,h>0&&` \xb7 ${(0,O.formatCount)(h)}`]})]}),(0,t.jsx)(n.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(q,{thread:e,onStop:o,onDelete:l})]}),d&&(0,t.jsx)(L,{thread:e})]})}function q({thread:e,onStop:n,onDelete:s,className:a}){let i="running"===e.status||"waiting"===e.status;return(0,t.jsxs)(m.DropdownMenu,{children:[(0,t.jsx)(m.DropdownMenuTrigger,{render:(0,t.jsx)(x.Button,{size:"icon-sm",variant:"ghost",className:a}),children:(0,t.jsx)(r,{})}),(0,t.jsxs)(m.DropdownMenuContent,{align:"end",children:[i&&(0,t.jsxs)(m.DropdownMenuItem,{onClick:n,children:[(0,t.jsx)(o.Square,{}),"Stop"]}),(0,t.jsxs)(m.DropdownMenuItem,{variant:"destructive",onClick:s,children:[(0,t.jsx)(l.Trash2,{}),"Delete"]})]})]})}function B({thread:e,bots:n,onClose:s,onStop:a,onDelete:i}){let[r,o]=(0,c.useState)(null),l=(0,c.useCallback)(e=>{o(e?.closest("[data-slot=dialog-content]")??null)},[]),[u,m]=(0,c.useState)({}),p=(0,c.useMemo)(()=>e?(0,C.threadFromRow)(e,n):null,[e,n]),f=e?u[e.id]??null:null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{ref:l,hidden:!0}),(0,t.jsx)(h.Dialog,{open:!!(e&&r),onOpenChange:e=>!e&&s(),modal:!1,disablePointerDismissal:!0,children:(0,t.jsx)(h.DialogPortal,{container:r,children:(0,t.jsx)(h.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:e&&p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[(0,t.jsx)(y.BotMark,{size:28,seed:e.bot,...P(e.bot,n),state:"running"===e.status?"thinking":"idle",notify:(0,w.needsThreadReply)(e),crossed:"cancelled"===e.status,className:"shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(h.DialogTitle,{className:"sr-only",children:e.label}),(0,t.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:e.label}),(0,t.jsxs)("div",{className:"mt-0.5 flex min-w-0 items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsxs)("span",{title:e.id,className:"min-w-0 truncate",children:[e.bot," · ",(0,z.whenOf)(e.updatedAt)]}),(0,t.jsx)(S.ThreadFacts,{thread:p})]})]}),(0,t.jsx)(q,{thread:e,onStop:()=>a(e),onDelete:()=>i(e),className:"text-muted-foreground"}),(0,t.jsx)(h.DialogClose,{render:(0,t.jsx)(x.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the thread"}),children:(0,t.jsx)(d.X,{})})]}),(0,t.jsx)(S.Conversation,{thread:p,tab:f,onTab:t=>m(n=>({...n,[e.id]:t})),className:"max-h-none min-h-0 flex-1 px-5",tabsClassName:"px-5"}),(0,t.jsx)("div",{className:"shrink-0 px-5 pt-2 pb-4",children:(0,t.jsx)($.ThreadReply,{thread:{id:e.id,label:e.label,bot:e.bot,ask:e.ask,room:e.room},status:e.status,faces:(0,C.rosterOf)(p),to:f??e.bot})})]})})})})]})}function P(e,t){let n=t?.find(t=>t.name===e)?.icon;return{color:n?.color,shape:n?.shape,outline:n?.outline,paint:n?.paint}}function L({thread:e}){let n=[];if(e.lines.forEach((t,s)=>{if("tool"!==t.kind)return;let a=e.lines[s+1];n.push({step:t,took:a?(0,z.toDate)(a.at).getTime()-(0,z.toDate)(t.at).getTime():null})}),0===n.length)return null;let a=(0,z.toDate)(e.updatedAt).getTime()-(0,z.toDate)(e.createdAt).getTime();return(0,t.jsxs)("div",{className:"pointer-events-none absolute top-[calc(100%-0.75rem)] left-17 z-20 hidden w-96 max-w-[calc(100%-5rem)] rounded-xl bg-background p-3 pb-2 shadow-xl shadow-black/10 ring-1 ring-border/60 group-hover/row:block",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)("span",{children:e.bot}),(0,t.jsx)("span",{className:"opacity-50",children:"·"}),(0,t.jsxs)("span",{children:[n.length," ",1===n.length?"step":"steps"]}),(0,t.jsx)("span",{className:"opacity-50",children:"·"}),(0,t.jsx)("span",{children:E(a)})]}),n.slice(-6).map(({step:e,took:n})=>{let a=(0,D.toolIcon)(e.name);return(0,t.jsxs)("div",{className:"flex h-5.5 items-center gap-2 font-mono text-[11px]",children:[null===n?(0,t.jsx)(s.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}):(0,t.jsx)(a,{className:"size-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",children:e.name}),null===n?(0,t.jsx)(f.ShinyText,{text:e.note??e.input,speed:2.2,className:"min-w-0 flex-1 truncate"}):(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",children:e.note??e.input}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right text-muted-foreground/70 tabular-nums",children:null===n?"":E(n)})]},e.id)})]})}function E(e){let t=Math.max(0,e)/1e3;if(t<10)return`${t.toFixed(1)}s`;if(t<60)return`${Math.round(t)}s`;let n=Math.floor(t/60);return`${n}m ${Math.round(t-60*n)}s`}function G(){return(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsx)(g.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-2",children:[(0,t.jsx)(g.Skeleton,{className:"h-3 w-40 max-w-full"}),(0,t.jsx)(g.Skeleton,{className:"h-2.5 w-80 max-w-full"})]}),(0,t.jsxs)("span",{className:(0,O.cn)("flex shrink-0 flex-col items-end gap-1.5",F),children:[(0,t.jsx)(g.Skeleton,{className:"h-2.5 w-12"}),(0,t.jsx)(g.Skeleton,{className:"h-2.5 w-24"})]}),(0,t.jsx)("span",{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"size-7 shrink-0"})]})}e.s(["ThreadSetting",0,function(){let[e,n]=(0,c.useState)(null),[s,a]=(0,c.useState)(""),{data:i}=(0,I.useServerRoute)(u.queryKey.bot),{items:r,isLoading:o,isLoadingMore:l,error:d,hasMore:h,sentinelRef:m}=(0,R.useServerPages)({key:(e,t)=>{if(0===e)return u.queryKey.threadHistory(null);let n=t?.at(-1);return n?u.queryKey.threadHistory((0,z.toDate)(n.updatedAt).toISOString()):null},size:j.PAGE_SIZE}),f=r.find(t=>t.id===e);(0,C.useSeenOnDetail)(f);let[g]=(0,A.useServerAction)(b.cancelThreadAction,{onOk:e=>{(0,I.revalidate)(u.queryKey.threads),C.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),[k]=(0,A.useServerAction)(v,{onOk:()=>(0,I.revalidate)(u.queryKey.threads)}),[w]=(0,A.useServerAction)(N,{onOk:()=>(0,I.revalidate)(u.queryKey.threads)}),y=s.trim().toLowerCase(),S=y?r.filter(e=>[e.label,e.outcome,e.bot].join(" ").toLowerCase().includes(y)):r,T=async()=>{await p.notify.confirm({title:"Clear finished jobs?",description:"Everything done or stopped goes, messages included. Running and waiting jobs stay.",okText:"Clear",destructive:!0})&&w()},D=async t=>{if(!await p.notify.confirm({title:`Delete "${t.label}"?`,description:"Its messages go with it — nothing can be picked back up.",okText:"Delete",destructive:!0}))return;let s=S.findIndex(e=>e.id===t.id),a=S[s+1]??S[s-1];try{await k(t.id)}catch{return}t.id===e&&n(a?.id??null)};if(o)return(0,t.jsx)(M.SettingSkeleton,{rows:3});if(d)return(0,t.jsx)(M.SettingError,{message:d.message});let O=r.filter(e=>"waiting"===e.status).length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M.SettingScreen,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(M.SettingRailNote,{children:[r.length," loaded",O>0&&` \xb7 ${O} waiting on you`]}),(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:T,children:"Clear finished"})]}),children:(0,t.jsx)(M.SettingGroup,{filter:(0,t.jsx)(M.SettingFilter,{value:s,onChange:a,placeholder:"Filter by label, bot or word"}),right:y?`${S.length} of ${r.length}`:void 0,children:(0,t.jsxs)(M.SettingItems,{children:[0===S.length?(0,t.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:y?"Nothing loaded matches. Keep scrolling to search further back.":"Nothing yet. When Thursday hands a job to a bot mid-call, it shows up here — while it runs, and after."}):S.map(e=>(0,t.jsx)(K,{thread:e,bots:i,open:e.id===f?.id,onOpen:()=>n(e.id),onStop:()=>g(e.id),onDelete:()=>D(e)},e.id)),(0,t.jsx)(M.SettingMore,{hasMore:h,loading:l,sentinelRef:m,ghost:(0,t.jsx)(G,{}),className:"divide-y divide-border/60"})]})})}),(0,t.jsx)(B,{thread:f,bots:i,onClose:()=>n(null),onStop:e=>g(e.id),onDelete:D})]})}],457343)},759659,e=>{"use strict";var t=e.i(456420);let n={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]};n.node;let s=(0,t.default)(n);e.s(["Trash2",0,s],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,457343,e=>{"use strict";var t=e.i(843476),n=e.i(867927),s=e.i(632781),a=e.i(456420);let i={name:"ellipsis",size:24,node:[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],aliases:["more-horizontal"]};i.node;let r=(0,a.default)(i);var o=e.i(929272),l=e.i(759659),d=e.i(263676),c=e.i(271645),u=e.i(798120),x=e.i(167881),h=e.i(630374),m=e.i(463415),p=e.i(917162),f=e.i(660302),g=e.i(671428),j=e.i(41533),b=e.i(707467),k=e.i(95187);let N=(0,k.createServerReference)("7f5504510b2b5ac64fb7845bf8f1c26f2a161ae4de",k.callServer,void 0,k.findSourceMapURL,"clearFinishedThreadsAction"),v=(0,k.createServerReference)("7f14aebbf0de8891159190362b1eb52f77adcf6be2",k.callServer,void 0,k.findSourceMapURL,"deleteThreadAction");var w=e.i(451888),y=e.i(635963),S=e.i(279265),T=e.i(835878),D=e.i(222055),C=e.i(978411),M=e.i(895836),z=e.i(245629),A=e.i(609856),R=e.i(661504),I=e.i(283653),O=e.i(647163),$=e.i(399512);let F="w-36";function K({thread:e,bots:a,open:i,onOpen:r,onStop:o,onDelete:l}){let d="running"===e.status,u=(0,c.useMemo)(()=>(0,C.threadFromRow)(e,a),[e,a]),x=function(e){let t=e.room.questions[0];if(t)return{text:(0,O.plainText)(t.text),tone:O.WAITING_INK};if("waiting"===e.status&&e.ask)return{text:(0,w.isAppStop)(e.ask)?(0,O.plainText)(e.outcome??e.ask.question):e.ask.question,tone:O.WAITING_INK};let n=e.seen;if("cancelled"===e.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===e.status)return{text:(0,O.plainText)(e.outcome??"Done"),tone:n?"text-muted-foreground":"text-foreground/80"};for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("tool"===n.kind)return{text:n.note??n.input,tone:"text-muted-foreground",tool:n.name,shine:!0};if("text"===n.kind)return{text:n.text,tone:"text-muted-foreground",shine:!0};if("user"===n.kind)break}return{text:`${e.bot} is taking it on…`,tone:"text-muted-foreground italic",shine:!0}}(e),h=e.tokens.input+e.tokens.output;return(0,t.jsxs)("div",{className:(0,O.cn)("group/row relative transition-colors",i?"bg-muted/80":"hover:bg-muted/50"),children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsxs)("button",{type:"button",onClick:r,className:"flex min-w-0 flex-1 items-center gap-3 rounded-md text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(y.BotMark,{size:40,seed:e.bot,...P(e.bot,a),state:d?"thinking":"idle",notify:(0,w.needsThreadReply)(e),crossed:"cancelled"===e.status,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.label}),(0,t.jsx)(T.BotRoster,{bots:(0,C.rosterOf)(u)}),d&&(0,t.jsx)(s.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"})]}),x&&(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-[13px] leading-snug",children:[x.tool&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground",children:x.tool}),x.shine?(0,t.jsx)(f.ShinyText,{text:x.text,speed:2.2,className:"min-w-0 truncate"}):(0,t.jsx)("span",{className:(0,O.cn)("min-w-0 truncate",x.tone),children:x.text})]})]}),(0,t.jsxs)("span",{className:(0,O.cn)("flex shrink-0 flex-col items-end gap-0.5 font-mono text-[11px] leading-4 text-muted-foreground tabular-nums",F),children:[(0,t.jsx)("span",{children:(0,z.whenOf)(e.updatedAt)}),(0,t.jsxs)("span",{className:"max-w-full truncate text-muted-foreground/70",title:h>0?`${e.id} \xb7 in ${(0,O.formatCount)(e.tokens.input)} \xb7 out ${(0,O.formatCount)(e.tokens.output)}`:e.id,children:[e.bot,h>0&&` \xb7 ${(0,O.formatCount)(h)}`]})]}),(0,t.jsx)(n.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(q,{thread:e,onStop:o,onDelete:l})]}),d&&(0,t.jsx)(L,{thread:e})]})}function q({thread:e,onStop:n,onDelete:s,className:a}){let i="running"===e.status||"waiting"===e.status;return(0,t.jsxs)(m.DropdownMenu,{children:[(0,t.jsx)(m.DropdownMenuTrigger,{render:(0,t.jsx)(x.Button,{size:"icon-sm",variant:"ghost",className:a}),children:(0,t.jsx)(r,{})}),(0,t.jsxs)(m.DropdownMenuContent,{align:"end",children:[i&&(0,t.jsxs)(m.DropdownMenuItem,{onClick:n,children:[(0,t.jsx)(o.Square,{}),"Stop"]}),(0,t.jsxs)(m.DropdownMenuItem,{variant:"destructive",onClick:s,children:[(0,t.jsx)(l.Trash2,{}),"Delete"]})]})]})}function B({thread:e,bots:n,onClose:s,onStop:a,onDelete:i}){let[r,o]=(0,c.useState)(null),l=(0,c.useCallback)(e=>{o(e?.closest("[data-slot=dialog-content]")??null)},[]),[u,m]=(0,c.useState)({}),p=(0,c.useMemo)(()=>e?(0,C.threadFromRow)(e,n):null,[e,n]),f=e?u[e.id]??null:null;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{ref:l,hidden:!0}),(0,t.jsx)(h.Dialog,{open:!!(e&&r),onOpenChange:e=>!e&&s(),modal:!1,disablePointerDismissal:!0,children:(0,t.jsx)(h.DialogPortal,{container:r,children:(0,t.jsx)(h.DialogPopup,{className:"absolute inset-y-0 right-0 z-10 flex w-[min(35rem,calc(100%-13rem))] flex-col border-l border-border/60 bg-popover text-popover-foreground shadow-2xl shadow-black/10 duration-150 data-open:animate-in data-open:fade-in-0 data-open:slide-in-from-right-4 data-closed:animate-out data-closed:fade-out-0 data-closed:slide-out-to-right-4",children:e&&p&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2.5 pt-3.5 pr-3 pb-1.5 pl-5",children:[(0,t.jsx)(y.BotMark,{size:28,seed:e.bot,...P(e.bot,n),state:"running"===e.status?"thinking":"idle",notify:(0,w.needsThreadReply)(e),crossed:"cancelled"===e.status,className:"shrink-0"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsx)(h.DialogTitle,{className:"sr-only",children:e.label}),(0,t.jsx)("p",{className:"truncate text-[15px] leading-5 font-semibold",children:e.label}),(0,t.jsxs)("div",{className:"mt-0.5 flex min-w-0 items-center gap-2 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsxs)("span",{title:e.id,className:"min-w-0 truncate",children:[e.bot," · ",(0,z.whenOf)(e.updatedAt)]}),(0,t.jsx)(S.ThreadFacts,{thread:p})]})]}),(0,t.jsx)(q,{thread:e,onStop:()=>a(e),onDelete:()=>i(e),className:"text-muted-foreground"}),(0,t.jsx)(h.DialogClose,{render:(0,t.jsx)(x.Button,{size:"icon-sm",variant:"ghost","aria-label":"Close the thread"}),children:(0,t.jsx)(d.X,{})})]}),(0,t.jsx)(S.Conversation,{thread:p,tab:f,onTab:t=>m(n=>({...n,[e.id]:t})),className:"max-h-none min-h-0 flex-1 px-5",tabsClassName:"px-5"}),(0,t.jsx)("div",{className:"shrink-0 px-5 pt-2 pb-4",children:(0,t.jsx)($.ThreadReply,{thread:{id:e.id,label:e.label,bot:e.bot,ask:e.ask,room:e.room},status:e.status,faces:(0,C.rosterOf)(p),to:f??e.bot})})]})})})})]})}function P(e,t){let n=t?.find(t=>t.name===e)?.icon;return{color:n?.color,shape:n?.shape,outline:n?.outline,paint:n?.paint}}function L({thread:e}){let n=[];if(e.lines.forEach((t,s)=>{if("tool"!==t.kind)return;let a=e.lines[s+1];n.push({step:t,took:a?(0,z.toDate)(a.at).getTime()-(0,z.toDate)(t.at).getTime():null})}),0===n.length)return null;let a=(0,z.toDate)(e.updatedAt).getTime()-(0,z.toDate)(e.createdAt).getTime();return(0,t.jsxs)("div",{className:"pointer-events-none absolute top-[calc(100%-0.75rem)] left-17 z-20 hidden w-96 max-w-[calc(100%-5rem)] rounded-xl bg-background p-3 pb-2 shadow-xl shadow-black/10 ring-1 ring-border/60 group-hover/row:block",children:[(0,t.jsxs)("div",{className:"mb-1.5 flex items-center gap-2 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)("span",{children:e.bot}),(0,t.jsx)("span",{className:"opacity-50",children:"·"}),(0,t.jsxs)("span",{children:[n.length," ",1===n.length?"step":"steps"]}),(0,t.jsx)("span",{className:"opacity-50",children:"·"}),(0,t.jsx)("span",{children:E(a)})]}),n.slice(-6).map(({step:e,took:n})=>{let a=(0,D.toolIcon)(e.name);return(0,t.jsxs)("div",{className:"flex h-5.5 items-center gap-2 font-mono text-[11px]",children:[null===n?(0,t.jsx)(s.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}):(0,t.jsx)(a,{className:"size-3 shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"w-24 shrink-0 truncate text-muted-foreground",children:e.name}),null===n?(0,t.jsx)(f.ShinyText,{text:e.note??e.input,speed:2.2,className:"min-w-0 flex-1 truncate"}):(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-foreground",children:e.note??e.input}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right text-muted-foreground/70 tabular-nums",children:null===n?"":E(n)})]},e.id)})]})}function E(e){let t=Math.max(0,e)/1e3;if(t<10)return`${t.toFixed(1)}s`;if(t<60)return`${Math.round(t)}s`;let n=Math.floor(t/60);return`${n}m ${Math.round(t-60*n)}s`}function G(){return(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsx)(g.Skeleton,{className:"size-10 shrink-0 rounded-full"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-2",children:[(0,t.jsx)(g.Skeleton,{className:"h-3 w-40 max-w-full"}),(0,t.jsx)(g.Skeleton,{className:"h-2.5 w-80 max-w-full"})]}),(0,t.jsxs)("span",{className:(0,O.cn)("flex shrink-0 flex-col items-end gap-1.5",F),children:[(0,t.jsx)(g.Skeleton,{className:"h-2.5 w-12"}),(0,t.jsx)(g.Skeleton,{className:"h-2.5 w-24"})]}),(0,t.jsx)("span",{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"size-7 shrink-0"})]})}e.s(["ThreadSetting",0,function(){let[e,n]=(0,c.useState)(null),[s,a]=(0,c.useState)(""),{data:i}=(0,I.useServerRoute)(u.queryKey.bot),{items:r,isLoading:o,isLoadingMore:l,error:d,hasMore:h,sentinelRef:m}=(0,R.useServerPages)({key:(e,t)=>{if(0===e)return u.queryKey.threadHistory(null);let n=t?.at(-1);return n?u.queryKey.threadHistory((0,z.toDate)(n.updatedAt).toISOString()):null},size:j.PAGE_SIZE}),f=r.find(t=>t.id===e);(0,C.useSeenOnDetail)(f);let[g]=(0,A.useServerAction)(b.cancelThreadAction,{onOk:e=>{(0,I.revalidate)(u.queryKey.threads),C.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),[k]=(0,A.useServerAction)(v,{onOk:()=>(0,I.revalidate)(u.queryKey.threads)}),[w]=(0,A.useServerAction)(N,{onOk:()=>(0,I.revalidate)(u.queryKey.threads)}),y=s.trim().toLowerCase(),S=y?r.filter(e=>[e.label,e.outcome,e.bot].join(" ").toLowerCase().includes(y)):r,T=async()=>{await p.notify.confirm({title:"Clear finished jobs?",description:"Everything done or stopped goes, messages included. Running and waiting jobs stay.",okText:"Clear",destructive:!0})&&w()},D=async t=>{if(!await p.notify.confirm({title:`Delete "${t.label}"?`,description:"Its messages go with it — nothing can be picked back up.",okText:"Delete",destructive:!0}))return;let s=S.findIndex(e=>e.id===t.id),a=S[s+1]??S[s-1];try{await k(t.id)}catch{return}t.id===e&&n(a?.id??null)};if(o)return(0,t.jsx)(M.SettingSkeleton,{rows:3});if(d)return(0,t.jsx)(M.SettingError,{message:d.message});let O=r.filter(e=>"waiting"===e.status).length;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(M.SettingScreen,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(M.SettingRailNote,{children:[r.length," loaded",O>0&&` \xb7 ${O} waiting on you`]}),(0,t.jsx)(x.Button,{variant:"outline",size:"sm",onClick:T,children:"Clear finished"})]}),children:(0,t.jsx)(M.SettingGroup,{filter:(0,t.jsx)(M.SettingFilter,{value:s,onChange:a,placeholder:"Filter by label, bot or word"}),right:y?`${S.length} of ${r.length}`:void 0,children:(0,t.jsxs)(M.SettingItems,{children:[0===S.length?(0,t.jsx)("p",{className:"p-4 text-sm leading-relaxed text-muted-foreground",children:y?"Nothing loaded matches. Keep scrolling to search further back.":"Nothing yet. When Thursday hands a job to a bot mid-call, it shows up here — while it runs, and after."}):S.map(e=>(0,t.jsx)(K,{thread:e,bots:i,open:e.id===f?.id,onOpen:()=>n(e.id),onStop:()=>g(e.id),onDelete:()=>D(e)},e.id)),(0,t.jsx)(M.SettingMore,{hasMore:h,loading:l,sentinelRef:m,ghost:(0,t.jsx)(G,{}),className:"divide-y divide-border/60"})]})})}),(0,t.jsx)(B,{thread:f,bots:i,onClose:()=>n(null),onStop:e=>g(e.id),onDelete:D})]})}],457343)},759659,e=>{"use strict";var t=e.i(456420);let n={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]};n.node;let s=(0,t.default)(n);e.s(["Trash2",0,s],759659)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,94682,e=>{"use strict";var t=e.i(843476),n=e.i(24071),i=e.i(482022),s=e.i(829600),r=e.i(434322),a=e.i(905015),o=e.i(226091),l=e.i(569644),c=e.i(815170),d=e.i(456420);let u={name:"images",size:24,node:[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]]};u.node;let f=(0,d.default)(u);var h=e.i(51921),m=e.i(650639),x=e.i(759659),p=e.i(438583),g=e.i(271645),y=e.i(798120),v=e.i(167881),b=e.i(917162),j=e.i(671428),k=e.i(41533),N=e.i(95187);let w=(0,N.createServerReference)("7f640a65cdf70f68212f5c7a86a2ddfa448136ce91",N.callServer,void 0,N.findSourceMapURL,"deleteArtifactAction");var S=e.i(635963),A=e.i(895836),C=e.i(621285),F=e.i(149611),z=e.i(245629),$=e.i(609856),T=e.i(283653),M=e.i(647163);let R={markdown:o.FileText,csv:m.Sheet,json:a.FileJson,text:o.FileText,frame:r.FileCode2,image:c.Image,audio:h.Music,video:p.Video,none:s.File};function L({entry:e,active:n,onPick:i}){let s="set"===e.kind?f:R[e.view];return(0,t.jsxs)("button",{type:"button",onClick:i,title:`${e.name} \xb7 ${(0,z.shortAgo)(e.at)}`,className:(0,M.cn)("mx-2 flex items-center gap-2 rounded-md px-2 py-1.5 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",n?"bg-secondary font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[(0,t.jsx)(s,{className:"size-3.5 shrink-0 opacity-70"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e.name}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/75",children:"set"===e.kind?e.count:(0,M.formatBytes)(e.bytes)})]})}function V({row:e,file:s,onOpen:r,onBack:a,onGone:o}){let[c]=(0,$.useServerAction)(F.openFileAction),[d,u]=(0,$.useServerAction)(w,{okMessage:"Deleted",onOk:()=>{(0,T.revalidate)(y.queryKey.artifacts),s?a():o()}}),f=s?{path:s.path,bytes:s.bytes,at:s.at}:"file"===e.kind?{path:e.path,bytes:e.bytes,at:e.at}:null,h=async e=>{await b.notify.confirm({title:`Delete ${e.split("/").pop()}?`,description:f?"It is deleted from disk for good.":"The folder and everything in it are deleted from disk for good.",okText:"Delete",destructive:!0})&&d(e)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex h-11 shrink-0 items-center gap-3 border-b border-border/60 px-6",children:[s&&(0,t.jsxs)("button",{type:"button",onClick:a,className:"-ml-1 flex shrink-0 items-center gap-1 rounded-md px-1.5 py-1 font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(n.ChevronLeft,{className:"size-3"}),e.name]}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:f?f.path.split("/").pop()??e.name:e.name}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:f?`${(0,M.formatBytes)(f.bytes)} \xb7 ${(0,z.shortAgo)(f.at)}`:`${e.count} ${1===e.count?"file":"files"} \xb7 ${(0,z.shortAgo)(e.at)}`}),f&&(0,t.jsx)("a",{href:y.queryKey.fileView(f.path),target:"_blank",rel:"noreferrer","aria-label":"Open in a new tab",className:"grid size-7 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(i.ExternalLink,{className:"size-4"})}),(0,t.jsx)(v.Button,{size:"icon-sm",variant:"ghost","aria-label":"Reveal in the file manager",className:"text-muted-foreground",onClick:()=>c(f?.path??e.path),children:(0,t.jsx)(l.FolderOpen,{})}),(0,t.jsx)(v.Button,{size:"icon-sm",variant:"ghost","aria-label":"Delete",loading:u,className:"text-muted-foreground",onClick:()=>h(f?.path??e.path),children:(0,t.jsx)(x.Trash2,{})})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:f?(0,t.jsx)(C.FilePreview,{path:f.path,bytes:f.bytes}):(0,t.jsx)(I,{path:e.path,onOpen:r})})]})}function I({path:e,onOpen:n}){let{data:i,isLoading:s,error:r}=(0,T.useServerRoute)(y.queryKey.artifactSet(e,k.ARTIFACT_VIEW.setFiles));if(s)return(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3 p-5",children:Array.from({length:8},(e,n)=>(0,t.jsx)(j.Skeleton,{className:"aspect-4/3 w-full rounded-xl"},n))});if(r)return(0,t.jsx)(A.SettingError,{message:r.message});let a=i?.files??[];return 0===a.length?(0,t.jsx)("p",{className:"p-5 text-xs text-muted-foreground/60",children:"Nothing in here the app can open."}):(0,t.jsxs)("div",{className:"p-5",children:[(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3",children:a.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),title:`${e.name} \xb7 ${(0,M.formatBytes)(e.bytes)}`,className:"flex flex-col gap-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-offset-2",children:[(0,t.jsx)(B,{file:e}),(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e.name})]},e.path))}),i&&i.total>a.length&&(0,t.jsx)("p",{className:"pt-4 font-mono text-[11px] text-muted-foreground/60",children:`${a.length} of ${i.total.toLocaleString("en")} — the rest are in the folder`})]})}function B({file:e}){if("image"===e.view&&e.bytes<=k.WORKSPACE_VIEW.elementMax)return(0,t.jsx)("img",{src:y.queryKey.file(e.path),alt:e.name,loading:"lazy",decoding:"async",className:"aspect-4/3 w-full rounded-xl object-cover"});let n=R[e.view];return(0,t.jsx)("span",{className:"grid aspect-4/3 w-full place-items-center rounded-xl bg-muted/40 text-muted-foreground",children:(0,t.jsx)(n,{className:"size-5"})})}function E({empty:e,onReveal:n}){return(0,t.jsxs)("div",{className:"space-y-4 p-8",children:[(0,t.jsx)("p",{className:"max-w-lg text-sm leading-relaxed text-muted-foreground",children:e?"Nothing finished yet. When a bot ends a job with something to hand over — a page, a report, a set of pictures — it lands here.":"Pick something on the left. Each bot's work is under its face; a folder it filled is one row, and opens as a sheet."}),(0,t.jsxs)(v.Button,{variant:"outline",onClick:n,children:[(0,t.jsx)(l.FolderOpen,{}),"Reveal folder"]})]})}e.s(["ArtifactSetting",0,function(){let[e,n]=(0,g.useState)(null),[i,s]=(0,g.useState)(""),[r,a]=(0,g.useState)(k.ARTIFACT_VIEW.rows),{data:o,isLoading:c,error:d}=(0,T.useServerRoute)(y.queryKey.artifactShelf(r),{keepPreviousData:!0}),{data:u}=(0,T.useServerRoute)(y.queryKey.bot),[f]=(0,$.useServerAction)(F.openFileAction);if(c)return(0,t.jsx)(A.SettingPanesSkeleton,{});if(d)return(0,t.jsx)(A.SettingError,{message:d.message});let h=o?.entries??[],m=o?.total??0,x=i.trim().toLowerCase(),p=x?h.filter(e=>e.name.toLowerCase().includes(x)||e.bot?.toLowerCase().includes(x)):h,b=h.find(t=>t.path===e?.row.path)??e?.row;return(0,t.jsx)(A.SettingPanes,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A.SettingRailNote,{children:(0,t.jsxs)("span",{className:"font-mono",children:[(0,t.jsx)("span",{className:"font-medium text-foreground",children:"artifacts"}),` \xb7 ${function(e,t,n){if(0===t)return"empty";let i=t>e.length?`${e.length} of ${t.toLocaleString("en")} artifacts`:`${t} ${1===t?"artifact":"artifacts"}`;return n>t?`${i} \xb7 ${n.toLocaleString("en")} files`:i}(h,m,o?.files??0)}`]})}),(0,t.jsxs)(v.Button,{variant:"outline",size:"sm",onClick:()=>f("artifacts"),children:[(0,t.jsx)(l.FolderOpen,{}),"Reveal folder"]})]}),left:(0,t.jsxs)("div",{className:"flex flex-col py-2",children:[(0,t.jsx)(A.SettingFilter,{value:i,onChange:s,placeholder:"Filter artifacts",className:"mx-2 mb-1.5 w-auto"}),0===p.length?(0,t.jsx)("p",{className:"px-4 py-3 text-xs text-muted-foreground/60",children:x?"Nothing matches":"Nothing here yet"}):(function(e){let t=new Map;for(let n of e){let e=t.get(n.bot)??[];e.push(n),t.set(n.bot,e)}return[...t].map(([e,t])=>({bot:e,rows:t}))})(p).map(({bot:e,rows:i})=>{var s,r;let a;return(0,t.jsxs)(g.Fragment,{children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 px-3 pt-3 pb-1 font-mono text-[10px] text-muted-foreground/60",children:[e&&(0,t.jsx)(S.BotMark,{size:12,seed:e,...(s=e,r=u,a=r?.find(e=>e.name===s)?.icon,{color:a?.color,shape:a?.shape,outline:a?.outline,paint:a?.paint}),notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e??"Unsorted"})]}),i.map(e=>(0,t.jsx)(L,{entry:e,active:e.path===b?.path,onPick:()=>n({row:e,file:null})},e.path))]},e??"")}),m>h.length&&(0,t.jsx)("button",{type:"button",onClick:()=>a(r+k.ARTIFACT_VIEW.rows),className:"mx-2 mt-2 rounded-md px-2 py-1.5 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/60 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:`Show ${Math.min(k.ARTIFACT_VIEW.rows,m-h.length)} more of ${m.toLocaleString("en")}`})]}),right:b?(0,t.jsx)(V,{row:b,file:e?.file??null,onOpen:e=>n({row:b,file:e}),onBack:()=>n({row:b,file:null}),onGone:()=>n(null)},b.path):(0,t.jsx)(E,{empty:0===m,onReveal:()=>f("artifacts")})})}],94682)},434322,51921,650639,438583,e=>{"use strict";var t=e.i(456420);let n={name:"file-code-corner",size:24,node:[["path",{d:"M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35",key:"1wthlu"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m5 16-3 3 3 3",key:"331omg"}],["path",{d:"m9 22 3-3-3-3",key:"lsp7cz"}]],aliases:["file-code-2"]};n.node;let i=(0,t.default)(n);e.s(["FileCode2",0,i],434322);let s={name:"music",size:24,node:[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]};s.node;let r=(0,t.default)(s);e.s(["Music",0,r],51921);let a={name:"sheet",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]};a.node;let o=(0,t.default)(a);e.s(["Sheet",0,o],650639);let l={name:"video",size:24,node:[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]};l.node;let c=(0,t.default)(l);e.s(["Video",0,c],438583)},815170,e=>{"use strict";var t=e.i(456420);let n={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};n.node;let i=(0,t.default)(n);e.s(["Image",0,i],815170)},759659,e=>{"use strict";var t=e.i(456420);let n={name:"trash",size:24,node:[["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"}]],aliases:["trash-2"]};n.node;let i=(0,t.default)(n);e.s(["Trash2",0,i],759659)}]);
@@ -1,5 +1,5 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,279265,978411,399512,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(108957),s=e.i(980797),o=e.i(383482),r=e.i(96892),i=e.i(689664),l=e.i(716327),d=e.i(24071),c=e.i(867927),u=e.i(931619),m=e.i(119002),x=e.i(51481),p=e.i(508734),h=e.i(632781),f=e.i(77071),b=e.i(825398),g=e.i(263676),k=e.i(271645),j=e.i(511769),w=e.i(798120),y=e.i(815731),v=e.i(167881),N=e.i(496336),T=e.i(683408),M=e.i(660302),S=e.i(671428),z=e.i(127341),C=e.i(184762),_=e.i(6799),A=e.i(41533),R=e.i(990483),$=e.i(451888),I=e.i(635963),B=e.i(835878),q=e.i(764224),D=e.i(919191),E=e.i(929272),F=e.i(463415),O=e.i(969526),L=e.i(330097),P=e.i(95187);let K=(0,P.createServerReference)("7ffe9230c748738877501065308042e15107c43db5",P.callServer,void 0,P.findSourceMapURL,"markSeenAction");var H=e.i(245629),U=e.i(393080),V=e.i(283653),Y=e.i(647163),W=e.i(553429);let G=[],Q=!1,J=new Set,X={sync(e,t){for(let n of(Q=!0,G=[...e].reverse().map(e=>Z(e,t)),J))n()},primed:()=>Q};function Z(e,t){let n=e=>({name:e,icon:t?.find(t=>t.name===e)?.icon??null}),a=n(e.bot),s=[],o=new Map,r=new Map,i=new Map;for(let t of e.lines){let e=t.bot?n(t.bot):a,l=t.to?n(t.to):t.parent?r.get(t.parent)??null:null;switch(t.kind){case"user":s.push({id:t.id,bot:t.to?n(t.to):a,to:t.to?n(t.to):null,text:t.text,kind:"user"});break;case"text":s.push({id:t.id,bot:e,to:l,text:t.text,kind:"say"});break;case"note":s.push({id:t.id,bot:e,to:l,text:t.text,kind:"note"});break;case"stop":s.push({id:t.id,bot:e,to:l,text:t.text,kind:"stop",at:t.at});break;case"tool":o.set(t.callId,s.length),s.push({id:t.id,bot:e,to:l,text:t.note??t.input,kind:"tool",tool:{name:t.name,input:t.input,note:t.note,path:t.path,callId:t.callId}});break;case"tool-result":{let e=o.get(t.callId)??i.get(t.callId),n=void 0===e?void 0:s[e];n?.tool&&void 0!==e?s[e]={...n,tool:{...n.tool,results:t.results,more:t.more}}:n?.kind==="ask"&&void 0!==e&&(s[e]={id:n.id,bot:n.bot,to:null,text:n.text,kind:"tool",tool:{name:t.name,input:n.text,callId:t.callId,results:t.results,more:t.more}});break}case"ask":{i.set(t.callId,s.length);let a=n(t.to);r.set(t.callId,e),s.push({id:t.id,bot:e,to:a,text:t.text,kind:"ask",question:t.question})}}}if("done"===e.status){let t=s.at(-1);t&&"say"===t.kind&&t.text===e.outcome&&(s[s.length-1]={...t,kind:"result"})}return{id:e.id,room:e.room,request:e.request,label:e.label,bot:a,lines:s,status:"running"===e.status?"working":e.status,outcome:e.outcome,ask:e.ask,seen:e.seen,tokens:e.tokens,contextTokens:e.contextTokens,contextBudget:e.contextBudget,updatedAt:e.updatedAt}}function ee(e){for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("user"!==n.kind&&"note"!==n.kind&&"stop"!==n.kind)return n}return null}let et=new Map,en=new Map,ea={recipient:e=>en.get(e),select:(e,t)=>{en.set(e,t)},get:(e,t,n)=>et.get(e)?.get(JSON.stringify([t,n??null]))??"",set(e,t,n,a){let s=et.get(e)??new Map,o=JSON.stringify([t,a??null]);n?s.set(o,n):s.delete(o),s.size?et.set(e,s):et.delete(e)}},es=new Set,eo={announce(e){for(let t of es)t(e)},subscribe:e=>(es.add(e),()=>{es.delete(e)})},er=[];function ei(){return(0,k.useSyncExternalStore)(e=>(J.add(e),()=>J.delete(e)),()=>G,()=>er)}function el(e){let t=[e.bot];for(let n of e.lines)for(let e of[n.bot,n.to])e&&e.name!==W.ROOM_THURSDAY&&!t.some(t=>t.name===e.name)&&t.push(e);return t}let ed=e=>e.id.slice(0,e.id.lastIndexOf("-")),ec=e=>"user"===e.kind?{name:W.ROOM_THURSDAY}:e.bot,eu=e=>"user"===e.kind?e.bot:e.to,em=(e,t)=>({kind:"entry",speaker:e.bot,entry:{kind:"work",key:`${e.lines[0].id}-work`,lines:e.lines,open:t}});function ex(e,t,n=[]){let a,s=(a=new Set(e.lines.filter(e=>"tool"===e.kind||"ask"===e.kind).map(ed)),e=>"user"===e.kind||"ask"===e.kind||"result"===e.kind||"say"===e.kind&&!a.has(ed(e))),o=t===e.bot.name?e.lines:e.lines.filter(e=>ec(e).name===t||s(e)&&eu(e)?.name===t),r=new Set([e.bot.name,W.ROOM_THURSDAY]),i=new Map;for(let t of e.lines){let e=eu(t);e&&!r.has(e.name)&&(r.add(e.name),i.set(t.id,{from:ec(t),to:e})),r.add(t.bot.name)}let l=[],d=new Map,c=e=>{let t=e?d.get(e.name):void 0;t&&(d.delete(t.bot.name),l.push(em(t,!1)))};for(let e of o){if(!s(e)){let t=d.get(e.bot.name)??{bot:e.bot,lines:[],at:0};t.lines.push(e),t.at=l.length,d.set(e.bot.name,t);continue}let t=ec(e);c(eu(e));let n=i.get(e.id);n&&l.push({kind:"invite",key:`${e.id}-joins`,...n}),c(t),l.push({kind:"entry",speaker:t,entry:{kind:"message",key:e.id,line:e}})}for(let e of[...d.values()].sort((e,t)=>e.at-t.at).reverse())l.splice(e.at,0,em(e,!0));for(let e of n)d.has(e.name)||l.push({kind:"entry",speaker:e,entry:{kind:"work",key:`${e.name}-now`,lines:[],open:!0}});let u=[];for(let e of l){let t=u.at(-1);"invite"===e.kind?u.push(e):t?.kind==="turn"&&t.speaker.name===e.speaker.name?t.entries.push(e.entry):u.push({kind:"turn",key:e.entry.key,speaker:e.speaker,entries:[e.entry]})}return u}function ep(e){let t=new Map;for(let n of e)for(let e of(t.has(n.bot.name)||t.set(n.bot.name,{bot:n.bot,thread:n,line:null}),n.lines))"user"!==e.kind&&"note"!==e.kind&&"stop"!==e.kind&&t.set(e.bot.name,{bot:e.bot,thread:n,line:e});return[...t.values()]}function eh(e){let t=(0,k.useRef)(new Set),n=e?.id??null,a=e?`${e.id}@${(0,H.toDate)(e.updatedAt).getTime()}`:null,s=!!e&&"done"===e.status&&!e.seen;(0,k.useEffect)(()=>{!n||!a||!s||t.current.has(a)||(t.current.add(a),K([n]).then(U.unwrapResult).then(()=>(0,V.revalidate)(w.queryKey.threads)).catch(e=>{t.current.delete(a),_.toast.add({type:"error",title:"Could not mark the thread as read",description:(0,Y.errorToString)(e)})}))},[n,a,s])}e.s(["botThreads",0,X,"heardBy",0,eu,"lastSaid",0,ee,"latestPerBot",0,ep,"rosterOf",0,el,"screenActs",0,eo,"threadDrafts",0,ea,"threadFromRow",0,Z,"threadItems",0,ex,"useBotThreads",0,ei,"useSeenOnDetail",0,eh],978411);var ef=e.i(609856);function eb({thread:e,status:n,faces:a=[],to:s=null,className:o}){let[r,i]=(0,k.useState)(),[l,u]=(0,k.useState)(()=>ea.recipient(e.id)??e.bot),[m,x]=(0,k.useState)(!1),[p,f]=(0,k.useState)(null);(0,k.useEffect)(()=>{u(ea.recipient(e.id)??e.bot),i(void 0),x(!1)},[e.id,e.bot]),(0,k.useEffect)(()=>{s&&(ea.select(e.id,s),u(s))},[e.id,s]);let b=e.room.participants,j=e.room.questions,y=Math.max(0,j.findIndex(e=>e.id===r)),S=j[y],z="waiting"===n?e.ask:null,C=(0,$.isAppStop)(z),_=S?.bot??(b.some(e=>e.bot===l)?l:e.bot),A=S?.id,[R,I]=eN(),[B,q]=(0,ef.useServerAction)(L.cancelThreadAction,{onOk:e=>{(0,V.revalidate)(w.queryKey.threads),eo.announce({kind:"stopped",id:e.id,label:e.label})}}),F=I||q,O=e.room.deliveries.filter(e=>!e.delivered).map(e=>`${e.bot}: ${e.text}`).join(" · "),P=b.filter(e=>"running"===e.state).map(e=>e.bot).join(", ")||e.bot,K=e=>a.find(t=>t.name===e)??{name:e},H=async t=>{if(F)return!1;let a=await R(e,t,_,A);return a&&"running"===n&&x(!1),a},U=async e=>{f(e),await H(e),f(null)},W="running"===n||"waiting"===n?(0,t.jsx)(v.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:F,onClick:()=>B(e.id),"aria-label":"Stop this thread",title:"Stop this thread",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:q?(0,t.jsx)(h.Loader2,{className:"animate-spin"}):(0,t.jsx)(E.Square,{className:"size-3"})}):null;if(S){let n=S.options??[],a=S.text;return(0,t.jsxs)(eg,{className:o,children:[(0,t.jsx)(ek,{bot:K(_),word:"Question",children:j.length>1&&(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)(v.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:F||0===y,onClick:()=>i(j[y-1].id),children:(0,t.jsx)(d.ChevronLeft,{})}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[y+1," / ",j.length]}),(0,t.jsx)(v.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:F||y===j.length-1,onClick:()=>i(j[y+1].id),children:(0,t.jsx)(c.ChevronRight,{})})]})}),a&&(0,t.jsx)("div",{className:"max-h-[min(14rem,30vh)] min-w-0 overflow-y-auto overscroll-contain pr-1.5",children:(0,t.jsx)(T.Markdown,{className:"min-w-0 text-[13px] leading-snug wrap-anywhere break-keep [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:a})}),n.length>0&&(0,t.jsx)(ej,{options:n,picked:p,busy:F,onChoose:U}),(0,t.jsx)(ew,{threadId:e.id,recipient:_,draftKey:S.id,send:H,busy:F,placeholder:n.length?"Or write your own answer…":"Your answer…",label:`Answer for ${_}`,trailing:W},JSON.stringify([e.id,_,S.id]))]})}return C?(0,t.jsxs)(eg,{className:o,children:[(0,t.jsx)(ek,{bot:K(e.bot),word:"Paused"}),z?.question&&(0,t.jsx)(N.FoldedText,{text:z.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,t.jsx)(ej,{options:z?.options.length?z.options:[$.THREAD_CONTINUE],picked:p,busy:F,onChoose:U}),(0,t.jsx)(ew,{threadId:e.id,recipient:_,send:H,busy:F,placeholder:"Or put it another way…",label:`Message for ${_}`,trailing:W},JSON.stringify([e.id,_,"paused"]))]}):"running"!==n||m?(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 flex-col gap-1.5",o),children:[(0,t.jsx)(ew,{threadId:e.id,recipient:_,send:H,busy:F,autoFocus:"running"===n,onEscape:"running"===n?()=>x(!1):void 0,placeholder:"running"===n?`What's off? ${_} reads this before its next step`:"Anything more? It picks up where it left off",label:`Message for ${_}`,className:"rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",leading:b.length>1?(0,t.jsx)(ey,{current:K(_),bots:b.map(e=>K(e.bot)),disabled:F,onPick:t=>{ea.select(e.id,t),u(t)}}):null,trailing:"running"===n?(0,t.jsx)(v.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:F,onClick:()=>x(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(g.X,{})}):null},JSON.stringify([e.id,_])),!!O&&"running"!==n&&(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsxs)("span",{className:"truncate",children:["Sending to ",O]})]})]}):(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 items-center gap-2 rounded-2xl bg-muted/40 py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/50",o),children:[O?(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-2 text-[12.5px] leading-5 text-muted-foreground",children:[(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsx)("span",{className:"shrink-0",children:"Before its next step:"}),(0,t.jsx)(M.ShinyText,{text:O,speed:2.2,className:"min-w-0 truncate"})]}):(0,t.jsx)(M.ShinyText,{text:`${P} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"ghost",disabled:F,onClick:()=>x(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(D.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),W]})}function eg({className:e,children:n}){return(0,t.jsx)("div",{className:(0,Y.cn)("flex min-w-0 flex-col gap-2.5 rounded-[18px] bg-muted py-2 pr-2 pl-3.5",e),children:n})}function ek({bot:e,word:n,children:a}){return(0,t.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{title:e.name,className:"shrink-0 leading-none",children:(0,t.jsx)(ev,{bot:e,size:16})}),(0,t.jsx)("span",{className:(0,Y.cn)("truncate text-[12px] leading-4 font-medium",Y.WAITING_INK),children:n}),a]})}function ej({options:e,picked:n,busy:a,onChoose:s}){return(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"ghost",loading:n===e,disabled:a,onClick:()=>s(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12.5px] hover:bg-background/60 dark:hover:bg-background/60",children:[e===$.THREAD_CONTINUE&&n!==e&&(0,t.jsx)(u.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))})}function ew({threadId:e,recipient:n,draftKey:a,send:s,busy:o,placeholder:i,label:l,autoFocus:d=!1,onEscape:c,leading:u,trailing:m,className:x}){let[p,f]=(0,k.useState)(()=>ea.get(e,n,a)),[b,g]=(0,k.useState)(!1),j=t=>{f(t),ea.set(e,n,t,a)},w=async()=>{p.trim()&&!o&&(g(!0),await s(p)&&j(""),g(!1))};return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),w()},className:(0,Y.cn)("flex min-w-0 items-end gap-1",x),children:[u,(0,t.jsx)(C.Textarea,{value:p,rows:1,disabled:o,autoFocus:d,onChange:e=>j(e.target.value),onKeyDown:e=>{"Escape"===e.key&&c?c():"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),w())},placeholder:i,"aria-label":l,className:"max-h-32 min-h-0 min-w-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),m,(0,t.jsx)(v.Button,{type:"submit",size:"icon-sm",variant:p.trim()?"default":"ghost",disabled:!p.trim()||o,"aria-label":"Send",className:"rounded-full",children:b?(0,t.jsx)(h.Loader2,{className:"animate-spin"}):(0,t.jsx)(r.ArrowUp,{})})]})}function ey({current:e,bots:n,disabled:a,onPick:s}){return(0,t.jsxs)(F.DropdownMenu,{children:[(0,t.jsxs)(F.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",disabled:a,"aria-label":`Message ${e.name}; choose another bot`,className:"mt-1 inline-flex h-5 shrink-0 items-center gap-1 self-start rounded-full bg-muted pr-1.5 pl-[3px] text-[12px] leading-none font-medium outline-none transition-colors hover:bg-muted-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"}),children:[(0,t.jsx)(ev,{bot:e,size:14}),(0,t.jsx)("span",{className:"max-w-32 truncate",children:e.name}),(0,t.jsx)(l.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(F.DropdownMenuContent,{align:"start",children:(0,t.jsx)(F.DropdownMenuGroup,{children:n.map(e=>(0,t.jsxs)(F.DropdownMenuItem,{onClick:()=>s(e.name),children:[(0,t.jsx)(ev,{bot:e,size:16}),e.name]},e.name))})})]})}function ev({bot:e,size:n}){return(0,t.jsx)(I.BotMark,{size:n,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}function eN(){let[e,t]=(0,ef.useServerAction)(O.answerThreadAction,{onOk:()=>(0,V.revalidate)(w.queryKey.threads)});return[async(t,n,a,s)=>{let o=n.trim();if(!o)return!1;try{let n=await e(t.id,o,a,s);return eo.announce({kind:"answered",id:n.id,label:n.label,answer:o,recipient:a,replyTo:s}),!0}catch{return!1}},t]}e.s(["ThreadReply",0,eb,"useAnswerThread",0,eN],399512);var eT=e.i(256604),eM=e.i(621285),eS=e.i(661504),ez=e.i(864723),eC=e.i(222055);let e_=(0,k.memo)(function(){let e=ei(),{data:n}=(0,V.useServerRoute)(w.queryKey.bot),[a,s]=(0,k.useState)(!1),[o,r]=(0,k.useState)(null),[i,l]=(0,k.useState)(!1),[d,c]=(0,k.useState)({}),[u,m]=(0,k.useState)("now"),x=(0,k.useRef)(0),p=[...e].reverse(),h=Date.now(),f=e=>"cancelled"===e.status?0:"done"===e.status&&e.seen?(0,H.toDate)(e.updatedAt).getTime()+A.ROOM_KEEP_READ_MS:1/0,b=p.filter(e=>f(e)>h),[,g]=(0,k.useState)(0),y=Math.min(...b.map(f));(0,k.useEffect)(()=>{if(!Number.isFinite(y))return;let e=setTimeout(()=>g(e=>e+1),y-Date.now());return()=>clearTimeout(e)},[y]);let v=a&&"history"===u,N=(0,eS.useServerPages)({key:(e,t)=>{if(!v)return null;if(0===e)return w.queryKey.threadHistory(null);let n=t?.at(-1);return n?w.queryKey.threadHistory((0,H.toDate)(n.updatedAt).toISOString()):null},size:A.PAGE_SIZE}),{refresh:T}=N,M=(0,k.useRef)(!1);M.current=N.items.length>0,(0,k.useEffect)(()=>{v&&M.current&&T()},[v,T]);let S=(0,k.useMemo)(()=>N.items.filter(e=>"done"===e.status||"cancelled"===e.status).map(e=>Z(e,n)),[N.items,n]),z=o?p.find(e=>e.id===o)??S.find(e=>e.id===o)??null:null,[C,_]=function(){let[e,t]=(0,k.useState)(null),n=(0,k.useRef)(null);return(0,k.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,k.useCallback)(e=>{t(e),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t(null)},3400)},[])]}(),{crew:R,more:I}=(0,k.useMemo)(()=>(function(e,t){let n=new Map;for(let e of ep(t)){let{thread:t,bot:a,line:s}=e;if("waiting"===t.status&&t.bot.name===a.name){n.set(a.name,{waiting:!0,word:null});continue}!("working"!==t.status||n.get(a.name)?.waiting)&&n.set(a.name,{waiting:!1,word:s?.kind==="tool"||s?.kind==="say"?e$(tc(s)):null})}let a=new Map;for(let t of e??[])a.set(t.name,{name:t.name,icon:t.icon,awake:n.has(t.name),waiting:n.get(t.name)?.waiting??!1,word:n.get(t.name)?.word??null});for(let[e,t]of n)a.has(e)||a.set(e,{name:e,icon:null,awake:!0,waiting:t.waiting,word:t.word});let s=[...a.values()];if(!s.length)return{crew:eP.slice(0,eK),more:0};for(let e of eP){if(s.length>=eK)break;a.has(e.name)||s.push(e)}let o=e=>e.waiting?0:e.awake?1:e.standIn?3:2,r=s.map((e,t)=>({face:e,at:t})).sort((e,t)=>o(e.face)-o(t.face)||e.at-t.at).map(e=>e.face);return{crew:r.slice(0,10),more:Math.max(0,r.length-10)}})(n,e),[n,e]),B=(0,k.useRef)(null),q=(0,k.useRef)(new Map),D=(0,k.useRef)(new Set);(0,k.useEffect)(()=>{if(!X.primed())return;let t=B.current;B.current=new Map(e.map(e=>[e.id,e.status]));let n=q.current;q.current=function(e){let t=new Map;for(let n of e)for(let e of n.room.participants)t.set(`${n.id}
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,279265,978411,399512,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(108957),s=e.i(980797),o=e.i(383482),r=e.i(96892),i=e.i(689664),l=e.i(716327),d=e.i(24071),c=e.i(867927),u=e.i(931619),m=e.i(119002),x=e.i(51481),p=e.i(508734),h=e.i(632781),f=e.i(77071),b=e.i(825398),g=e.i(263676),k=e.i(271645),j=e.i(511769),w=e.i(798120),y=e.i(815731),v=e.i(167881),N=e.i(496336),T=e.i(683408),M=e.i(660302),S=e.i(671428),z=e.i(127341),C=e.i(184762),_=e.i(6799),A=e.i(41533),R=e.i(201082),$=e.i(451888),I=e.i(635963),B=e.i(835878),q=e.i(764224),D=e.i(919191),E=e.i(929272),F=e.i(463415),O=e.i(673544),L=e.i(707467),P=e.i(95187);let K=(0,P.createServerReference)("7feb38361657ff2d01858e3fd2d867d37a52aac4ba",P.callServer,void 0,P.findSourceMapURL,"markSeenAction");var H=e.i(245629),U=e.i(393080),V=e.i(283653),Y=e.i(647163),W=e.i(553429);let G=[],Q=!1,J=new Set,X={sync(e,t){for(let n of(Q=!0,G=[...e].reverse().map(e=>Z(e,t)),J))n()},primed:()=>Q};function Z(e,t){let n=e=>({name:e,icon:t?.find(t=>t.name===e)?.icon??null}),a=n(e.bot),s=[],o=new Map,r=new Map,i=new Map;for(let t of e.lines){let e=t.bot?n(t.bot):a,l=t.to?n(t.to):t.parent?r.get(t.parent)??null:null;switch(t.kind){case"user":s.push({id:t.id,bot:t.to?n(t.to):a,to:t.to?n(t.to):null,text:t.text,kind:"user"});break;case"text":s.push({id:t.id,bot:e,to:l,text:t.text,kind:"say"});break;case"note":s.push({id:t.id,bot:e,to:l,text:t.text,kind:"note"});break;case"stop":s.push({id:t.id,bot:e,to:l,text:t.text,kind:"stop",at:t.at});break;case"tool":o.set(t.callId,s.length),s.push({id:t.id,bot:e,to:l,text:t.note??t.input,kind:"tool",tool:{name:t.name,input:t.input,note:t.note,path:t.path,callId:t.callId}});break;case"tool-result":{let e=o.get(t.callId)??i.get(t.callId),n=void 0===e?void 0:s[e];n?.tool&&void 0!==e?s[e]={...n,tool:{...n.tool,results:t.results,more:t.more}}:n?.kind==="ask"&&void 0!==e&&(s[e]={id:n.id,bot:n.bot,to:null,text:n.text,kind:"tool",tool:{name:t.name,input:n.text,callId:t.callId,results:t.results,more:t.more}});break}case"ask":{i.set(t.callId,s.length);let a=n(t.to);r.set(t.callId,e),s.push({id:t.id,bot:e,to:a,text:t.text,kind:"ask",question:t.question})}}}if("done"===e.status){let t=s.at(-1);t&&"say"===t.kind&&t.text===e.outcome&&(s[s.length-1]={...t,kind:"result"})}return{id:e.id,room:e.room,request:e.request,label:e.label,bot:a,lines:s,status:"running"===e.status?"working":e.status,outcome:e.outcome,ask:e.ask,seen:e.seen,tokens:e.tokens,contextTokens:e.contextTokens,contextBudget:e.contextBudget,updatedAt:e.updatedAt}}function ee(e){for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("user"!==n.kind&&"note"!==n.kind&&"stop"!==n.kind)return n}return null}let et=new Map,en=new Map,ea={recipient:e=>en.get(e),select:(e,t)=>{en.set(e,t)},get:(e,t,n)=>et.get(e)?.get(JSON.stringify([t,n??null]))??"",set(e,t,n,a){let s=et.get(e)??new Map,o=JSON.stringify([t,a??null]);n?s.set(o,n):s.delete(o),s.size?et.set(e,s):et.delete(e)}},es=new Set,eo={announce(e){for(let t of es)t(e)},subscribe:e=>(es.add(e),()=>{es.delete(e)})},er=[];function ei(){return(0,k.useSyncExternalStore)(e=>(J.add(e),()=>J.delete(e)),()=>G,()=>er)}function el(e){let t=[e.bot];for(let n of e.lines)for(let e of[n.bot,n.to])e&&e.name!==W.ROOM_THURSDAY&&!t.some(t=>t.name===e.name)&&t.push(e);return t}let ed=e=>e.id.slice(0,e.id.lastIndexOf("-")),ec=e=>"user"===e.kind?{name:W.ROOM_THURSDAY}:e.bot,eu=e=>"user"===e.kind?e.bot:e.to,em=(e,t)=>({kind:"entry",speaker:e.bot,entry:{kind:"work",key:`${e.lines[0].id}-work`,lines:e.lines,open:t}});function ex(e,t,n=[]){let a,s=(a=new Set(e.lines.filter(e=>"tool"===e.kind||"ask"===e.kind).map(ed)),e=>"user"===e.kind||"ask"===e.kind||"result"===e.kind||"say"===e.kind&&!a.has(ed(e))),o=t===e.bot.name?e.lines:e.lines.filter(e=>ec(e).name===t||s(e)&&eu(e)?.name===t),r=new Set([e.bot.name,W.ROOM_THURSDAY]),i=new Map;for(let t of e.lines){let e=eu(t);e&&!r.has(e.name)&&(r.add(e.name),i.set(t.id,{from:ec(t),to:e})),r.add(t.bot.name)}let l=[],d=new Map,c=e=>{let t=e?d.get(e.name):void 0;t&&(d.delete(t.bot.name),l.push(em(t,!1)))};for(let e of o){if(!s(e)){let t=d.get(e.bot.name)??{bot:e.bot,lines:[],at:0};t.lines.push(e),t.at=l.length,d.set(e.bot.name,t);continue}let t=ec(e);c(eu(e));let n=i.get(e.id);n&&l.push({kind:"invite",key:`${e.id}-joins`,...n}),c(t),l.push({kind:"entry",speaker:t,entry:{kind:"message",key:e.id,line:e}})}for(let e of[...d.values()].sort((e,t)=>e.at-t.at).reverse())l.splice(e.at,0,em(e,!0));for(let e of n)d.has(e.name)||l.push({kind:"entry",speaker:e,entry:{kind:"work",key:`${e.name}-now`,lines:[],open:!0}});let u=[];for(let e of l){let t=u.at(-1);"invite"===e.kind?u.push(e):t?.kind==="turn"&&t.speaker.name===e.speaker.name?t.entries.push(e.entry):u.push({kind:"turn",key:e.entry.key,speaker:e.speaker,entries:[e.entry]})}return u}function ep(e){let t=new Map;for(let n of e)for(let e of(t.has(n.bot.name)||t.set(n.bot.name,{bot:n.bot,thread:n,line:null}),n.lines))"user"!==e.kind&&"note"!==e.kind&&"stop"!==e.kind&&t.set(e.bot.name,{bot:e.bot,thread:n,line:e});return[...t.values()]}function eh(e){let t=(0,k.useRef)(new Set),n=e?.id??null,a=e?`${e.id}@${(0,H.toDate)(e.updatedAt).getTime()}`:null,s=!!e&&"done"===e.status&&!e.seen;(0,k.useEffect)(()=>{!n||!a||!s||t.current.has(a)||(t.current.add(a),K([n]).then(U.unwrapResult).then(()=>(0,V.revalidate)(w.queryKey.threads)).catch(e=>{t.current.delete(a),_.toast.add({type:"error",title:"Could not mark the thread as read",description:(0,Y.errorToString)(e)})}))},[n,a,s])}e.s(["botThreads",0,X,"heardBy",0,eu,"lastSaid",0,ee,"latestPerBot",0,ep,"rosterOf",0,el,"screenActs",0,eo,"threadDrafts",0,ea,"threadFromRow",0,Z,"threadItems",0,ex,"useBotThreads",0,ei,"useSeenOnDetail",0,eh],978411);var ef=e.i(609856);function eb({thread:e,status:n,faces:a=[],to:s=null,className:o}){let[r,i]=(0,k.useState)(),[l,u]=(0,k.useState)(()=>ea.recipient(e.id)??e.bot),[m,x]=(0,k.useState)(!1),[p,f]=(0,k.useState)(null);(0,k.useEffect)(()=>{u(ea.recipient(e.id)??e.bot),i(void 0),x(!1)},[e.id,e.bot]),(0,k.useEffect)(()=>{s&&(ea.select(e.id,s),u(s))},[e.id,s]);let b=e.room.participants,j=e.room.questions,y=Math.max(0,j.findIndex(e=>e.id===r)),S=j[y],z="waiting"===n?e.ask:null,C=(0,$.isAppStop)(z),_=S?.bot??(b.some(e=>e.bot===l)?l:e.bot),A=S?.id,[R,I]=eN(),[B,q]=(0,ef.useServerAction)(L.cancelThreadAction,{onOk:e=>{(0,V.revalidate)(w.queryKey.threads),eo.announce({kind:"stopped",id:e.id,label:e.label})}}),F=I||q,O=e.room.deliveries.filter(e=>!e.delivered).map(e=>`${e.bot}: ${e.text}`).join(" · "),P=b.filter(e=>"running"===e.state).map(e=>e.bot).join(", ")||e.bot,K=e=>a.find(t=>t.name===e)??{name:e},H=async t=>{if(F)return!1;let a=await R(e,t,_,A);return a&&"running"===n&&x(!1),a},U=async e=>{f(e),await H(e),f(null)},W="running"===n||"waiting"===n?(0,t.jsx)(v.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:F,onClick:()=>B(e.id),"aria-label":"Stop this thread",title:"Stop this thread",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:q?(0,t.jsx)(h.Loader2,{className:"animate-spin"}):(0,t.jsx)(E.Square,{className:"size-3"})}):null;if(S){let n=S.options??[],a=S.text;return(0,t.jsxs)(eg,{className:o,children:[(0,t.jsx)(ek,{bot:K(_),word:"Question",children:j.length>1&&(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)(v.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:F||0===y,onClick:()=>i(j[y-1].id),children:(0,t.jsx)(d.ChevronLeft,{})}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[y+1," / ",j.length]}),(0,t.jsx)(v.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:F||y===j.length-1,onClick:()=>i(j[y+1].id),children:(0,t.jsx)(c.ChevronRight,{})})]})}),a&&(0,t.jsx)("div",{className:"max-h-[min(14rem,30vh)] min-w-0 overflow-y-auto overscroll-contain pr-1.5",children:(0,t.jsx)(T.Markdown,{className:"min-w-0 text-[13px] leading-snug wrap-anywhere break-keep [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",children:a})}),n.length>0&&(0,t.jsx)(ej,{options:n,picked:p,busy:F,onChoose:U}),(0,t.jsx)(ew,{threadId:e.id,recipient:_,draftKey:S.id,send:H,busy:F,placeholder:n.length?"Or write your own answer…":"Your answer…",label:`Answer for ${_}`,trailing:W},JSON.stringify([e.id,_,S.id]))]})}return C?(0,t.jsxs)(eg,{className:o,children:[(0,t.jsx)(ek,{bot:K(e.bot),word:"Paused"}),z?.question&&(0,t.jsx)(N.FoldedText,{text:z.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,t.jsx)(ej,{options:z?.options.length?z.options:[$.THREAD_CONTINUE],picked:p,busy:F,onChoose:U}),(0,t.jsx)(ew,{threadId:e.id,recipient:_,send:H,busy:F,placeholder:"Or put it another way…",label:`Message for ${_}`,trailing:W},JSON.stringify([e.id,_,"paused"]))]}):"running"!==n||m?(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 flex-col gap-1.5",o),children:[(0,t.jsx)(ew,{threadId:e.id,recipient:_,send:H,busy:F,autoFocus:"running"===n,onEscape:"running"===n?()=>x(!1):void 0,placeholder:"running"===n?`What's off? ${_} reads this before its next step`:"Anything more? It picks up where it left off",label:`Message for ${_}`,className:"rounded-2xl bg-background py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",leading:b.length>1?(0,t.jsx)(ey,{current:K(_),bots:b.map(e=>K(e.bot)),disabled:F,onPick:t=>{ea.select(e.id,t),u(t)}}):null,trailing:"running"===n?(0,t.jsx)(v.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:F,onClick:()=>x(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(g.X,{})}):null},JSON.stringify([e.id,_])),!!O&&"running"!==n&&(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-2 px-1 text-xs text-muted-foreground",children:[(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsxs)("span",{className:"truncate",children:["Sending to ",O]})]})]}):(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 items-center gap-2 rounded-2xl bg-muted/40 py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/50",o),children:[O?(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-2 text-[12.5px] leading-5 text-muted-foreground",children:[(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsx)("span",{className:"shrink-0",children:"Before its next step:"}),(0,t.jsx)(M.ShinyText,{text:O,speed:2.2,className:"min-w-0 truncate"})]}):(0,t.jsx)(M.ShinyText,{text:`${P} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"ghost",disabled:F,onClick:()=>x(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(D.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),W]})}function eg({className:e,children:n}){return(0,t.jsx)("div",{className:(0,Y.cn)("flex min-w-0 flex-col gap-2.5 rounded-[18px] bg-muted py-2 pr-2 pl-3.5",e),children:n})}function ek({bot:e,word:n,children:a}){return(0,t.jsxs)("div",{className:"flex min-h-7 min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{title:e.name,className:"shrink-0 leading-none",children:(0,t.jsx)(ev,{bot:e,size:16})}),(0,t.jsx)("span",{className:(0,Y.cn)("truncate text-[12px] leading-4 font-medium",Y.WAITING_INK),children:n}),a]})}function ej({options:e,picked:n,busy:a,onChoose:s}){return(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.map(e=>(0,t.jsxs)(v.Button,{type:"button",size:"sm",variant:"ghost",loading:n===e,disabled:a,onClick:()=>s(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12.5px] hover:bg-background/60 dark:hover:bg-background/60",children:[e===$.THREAD_CONTINUE&&n!==e&&(0,t.jsx)(u.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))})}function ew({threadId:e,recipient:n,draftKey:a,send:s,busy:o,placeholder:i,label:l,autoFocus:d=!1,onEscape:c,leading:u,trailing:m,className:x}){let[p,f]=(0,k.useState)(()=>ea.get(e,n,a)),[b,g]=(0,k.useState)(!1),j=t=>{f(t),ea.set(e,n,t,a)},w=async()=>{p.trim()&&!o&&(g(!0),await s(p)&&j(""),g(!1))};return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),w()},className:(0,Y.cn)("flex min-w-0 items-end gap-1",x),children:[u,(0,t.jsx)(C.Textarea,{value:p,rows:1,disabled:o,autoFocus:d,onChange:e=>j(e.target.value),onKeyDown:e=>{"Escape"===e.key&&c?c():"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),w())},placeholder:i,"aria-label":l,className:"max-h-32 min-h-0 min-w-0 flex-1 resize-none border-0 bg-transparent px-0 py-1 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),m,(0,t.jsx)(v.Button,{type:"submit",size:"icon-sm",variant:p.trim()?"default":"ghost",disabled:!p.trim()||o,"aria-label":"Send",className:"rounded-full",children:b?(0,t.jsx)(h.Loader2,{className:"animate-spin"}):(0,t.jsx)(r.ArrowUp,{})})]})}function ey({current:e,bots:n,disabled:a,onPick:s}){return(0,t.jsxs)(F.DropdownMenu,{children:[(0,t.jsxs)(F.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",disabled:a,"aria-label":`Message ${e.name}; choose another bot`,className:"mt-1 inline-flex h-5 shrink-0 items-center gap-1 self-start rounded-full bg-muted pr-1.5 pl-[3px] text-[12px] leading-none font-medium outline-none transition-colors hover:bg-muted-foreground/15 focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50"}),children:[(0,t.jsx)(ev,{bot:e,size:14}),(0,t.jsx)("span",{className:"max-w-32 truncate",children:e.name}),(0,t.jsx)(l.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(F.DropdownMenuContent,{align:"start",children:(0,t.jsx)(F.DropdownMenuGroup,{children:n.map(e=>(0,t.jsxs)(F.DropdownMenuItem,{onClick:()=>s(e.name),children:[(0,t.jsx)(ev,{bot:e,size:16}),e.name]},e.name))})})]})}function ev({bot:e,size:n}){return(0,t.jsx)(I.BotMark,{size:n,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}function eN(){let[e,t]=(0,ef.useServerAction)(O.answerThreadAction,{onOk:()=>(0,V.revalidate)(w.queryKey.threads)});return[async(t,n,a,s)=>{let o=n.trim();if(!o)return!1;try{let n=await e(t.id,o,a,s);return eo.announce({kind:"answered",id:n.id,label:n.label,answer:o,recipient:a,replyTo:s}),!0}catch{return!1}},t]}e.s(["ThreadReply",0,eb,"useAnswerThread",0,eN],399512);var eT=e.i(256604),eM=e.i(621285),eS=e.i(661504),ez=e.i(864723),eC=e.i(222055);let e_=(0,k.memo)(function(){let e=ei(),{data:n}=(0,V.useServerRoute)(w.queryKey.bot),[a,s]=(0,k.useState)(!1),[o,r]=(0,k.useState)(null),[i,l]=(0,k.useState)(!1),[d,c]=(0,k.useState)({}),[u,m]=(0,k.useState)("now"),x=(0,k.useRef)(0),p=[...e].reverse(),h=Date.now(),f=e=>"cancelled"===e.status?0:"done"===e.status&&e.seen?(0,H.toDate)(e.updatedAt).getTime()+A.ROOM_KEEP_READ_MS:1/0,b=p.filter(e=>f(e)>h),[,g]=(0,k.useState)(0),y=Math.min(...b.map(f));(0,k.useEffect)(()=>{if(!Number.isFinite(y))return;let e=setTimeout(()=>g(e=>e+1),y-Date.now());return()=>clearTimeout(e)},[y]);let v=a&&"history"===u,N=(0,eS.useServerPages)({key:(e,t)=>{if(!v)return null;if(0===e)return w.queryKey.threadHistory(null);let n=t?.at(-1);return n?w.queryKey.threadHistory((0,H.toDate)(n.updatedAt).toISOString()):null},size:A.PAGE_SIZE}),{refresh:T}=N,M=(0,k.useRef)(!1);M.current=N.items.length>0,(0,k.useEffect)(()=>{v&&M.current&&T()},[v,T]);let S=(0,k.useMemo)(()=>N.items.filter(e=>"done"===e.status||"cancelled"===e.status).map(e=>Z(e,n)),[N.items,n]),z=o?p.find(e=>e.id===o)??S.find(e=>e.id===o)??null:null,[C,_]=function(){let[e,t]=(0,k.useState)(null),n=(0,k.useRef)(null);return(0,k.useEffect)(()=>()=>{n.current&&clearTimeout(n.current)},[]),[e,(0,k.useCallback)(e=>{t(e),n.current&&clearTimeout(n.current),n.current=setTimeout(()=>{n.current=null,t(null)},3400)},[])]}(),{crew:R,more:I}=(0,k.useMemo)(()=>(function(e,t){let n=new Map;for(let e of ep(t)){let{thread:t,bot:a,line:s}=e;if("waiting"===t.status&&t.bot.name===a.name){n.set(a.name,{waiting:!0,word:null});continue}!("working"!==t.status||n.get(a.name)?.waiting)&&n.set(a.name,{waiting:!1,word:s?.kind==="tool"||s?.kind==="say"?e$(tc(s)):null})}let a=new Map;for(let t of e??[])a.set(t.name,{name:t.name,icon:t.icon,awake:n.has(t.name),waiting:n.get(t.name)?.waiting??!1,word:n.get(t.name)?.word??null});for(let[e,t]of n)a.has(e)||a.set(e,{name:e,icon:null,awake:!0,waiting:t.waiting,word:t.word});let s=[...a.values()];if(!s.length)return{crew:eP.slice(0,eK),more:0};for(let e of eP){if(s.length>=eK)break;a.has(e.name)||s.push(e)}let o=e=>e.waiting?0:e.awake?1:e.standIn?3:2,r=s.map((e,t)=>({face:e,at:t})).sort((e,t)=>o(e.face)-o(t.face)||e.at-t.at).map(e=>e.face);return{crew:r.slice(0,10),more:Math.max(0,r.length-10)}})(n,e),[n,e]),B=(0,k.useRef)(null),q=(0,k.useRef)(new Map),D=(0,k.useRef)(new Set);(0,k.useEffect)(()=>{if(!X.primed())return;let t=B.current;B.current=new Map(e.map(e=>[e.id,e.status]));let n=q.current;q.current=function(e){let t=new Map;for(let n of e)for(let e of n.room.participants)t.set(`${n.id}
2
2
  ${e.bot}`,e.state);return t}(e);let a=D.current;if(D.current=new Set(e.flatMap(e=>e.lines.map(e=>e.id))),!t)return;let s=null;for(let o of e)for(let e of function(e,t,n,a,s){let o=[],r=e.lines.filter(e=>!n.has(e.id)),i=e.bot,l=new Map;for(let e of r)"user"===e.kind?o.push({rank:1,at:e.bot.name,from:tm,to:[e.bot],text:e$(e.text)}):"stop"===e.kind?o.push({rank:3,at:e.bot.name,from:e.bot,to:[],sign:"stopped",text:tM(e.text)}):"ask"===e.kind&&e.to?.name===tm.name?o.push(e.question?{rank:4,at:e.bot.name,from:e.bot,to:[],sign:"question",text:`asks you \xb7 ${e$(e.text)}`}:{rank:2,at:e.bot.name,from:e.bot,to:[tm],text:e$(e.text)}):"ask"===e.kind&&e.to&&l.set(e.bot.name,[...l.get(e.bot.name)??[],e]);for(let[e,t]of l){let n=new Map;for(let e of t)e.to&&n.set(e.to.name,e.to);o.push({rank:2,at:e,from:t[0].bot,to:[...n.values()],text:1===t.length?e$(t[0].text):`sent ${t.length} parts out`})}for(let t of el(e)){let n=`${e.id}
3
3
  ${t.name}`;t.name===i.name||"running"!==a.get(n)||"done"!==s.get(n)||r.some(e=>e.bot.name===t.name&&("ask"===e.kind||"say"===e.kind))||o.push({rank:1,at:t.name,from:t,to:[],sign:"done",text:"finished its part"})}if(!t)return"working"===e.status&&o.push({rank:1,at:i.name,from:tm,to:[i],text:`took on “${e$(e.label)}”`}),o;if(t===e.status)return o;let d=e$(e.label);return"cancelled"===e.status?o.push({rank:3,at:i.name,from:i,to:[],sign:"cancelled",text:`stopped \xb7 ${d}`}):"done"===e.status?o.push({rank:3,at:i.name,from:i,to:[],sign:"done",text:`done \xb7 ${d}`}):"working"===e.status?r.some(e=>"user"===e.kind)||o.push({rank:1,at:i.name,from:i,to:[],sign:"resumed",text:"picked it back up"}):(0,$.isAppStop)(e.ask)&&!o.some(e=>"question"===e.sign||"stopped"===e.sign)&&o.push({rank:3,at:i.name,from:i,to:[],sign:"stopped",text:"paused"}),o}(o,t.get(o.id),a,n,q.current))(!s||e.rank>=s.rank)&&(s=e);s&&_(s)},[e,_]),eh(a?z:null),(0,j.useAppEvent)({showThread:e=>{r(e.threadId),s(!0)}});let E=e.filter(e=>"working"===e.status).length,F=p.filter(eI).length,O=p.filter(eB),L=(0,k.useMemo)(()=>R.map(e=>({...e,word:null})),[R]),P=(0,k.useCallback)(()=>l(!1),[]),K=()=>{s(!1),l(!1),r(null),m("now"),x.current=0};return(0,t.jsx)("div",{className:"pointer-events-none absolute right-5 bottom-5 z-10 flex w-[min(80vw,calc(100vw-2.5rem))] flex-col items-end gap-2",children:a?(0,t.jsx)("div",{className:"pointer-events-auto flex max-h-[min(44rem,78vh)] w-132 max-w-full animate-in flex-col overflow-hidden rounded-3xl bg-background/75 shadow-2xl shadow-black/6 ring-1 ring-border/50 backdrop-blur-xl fade-in slide-in-from-bottom-1 duration-200",children:z?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eZ,{thread:z,onBack:()=>r(null),onClose:K}),(0,t.jsx)(tn,{thread:z,tab:d[z.id]??null,onTab:e=>c(t=>({...t,[z.id]:e})),className:"min-h-0 flex-1"}),(0,t.jsx)(eb,{thread:{id:z.id,label:z.label,bot:z.bot.name,ask:z.ask,room:z.room},status:"working"===z.status?"running":z.status,faces:el(z),to:d[z.id]??z.bot.name,className:"mx-3 mb-2 shrink-0"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eX,{tab:u,current:b.length,composing:i,onTab:e=>{l(!1),m(e)},onCompose:()=>l(!0),onClose:()=>i?l(!1):K()}),i?(0,t.jsx)(eL,{bots:n,onDone:P}):"history"===u?(0,t.jsx)(e8,{pages:N,threads:S,scroll:x,onPick:r}):b.length?(0,t.jsx)(te,{threads:b,onPick:r}):p.length?(0,t.jsx)(e7,{}):(0,t.jsx)(e4,{bots:n}),(0,t.jsx)(eD,{crew:L,more:I,bubble:null,label:"Fold the room away",onClick:K,side:C?(0,t.jsx)(eY,{handoff:C}):(0,t.jsx)(eE,{busy:E,pending:F,grown:!0})})]})}):(0,t.jsx)(eq,{crew:R,more:I,bubble:C,bots:n,rows:p.filter(e=>eI(e)||eB(e)),count:e.length,busy:E,pending:F,unread:O.length,composing:i,onCompose:()=>l(!0),onCloseCompose:P,onPick:e=>{r(e),s(!0)},onOpen:()=>s(!0)})})}),eA={done:i.Check,cancelled:g.X,question:x.CircleQuestionMark,stopped:m.CirclePause,resumed:b.RotateCw},eR={question:Y.WAITING_INK,stopped:Y.WAITING_INK},e$=e=>{let t=(0,Y.plainText)(e).replace(/\s+/g," ").trim();return t.length>28?`${t.slice(0,27)}…`:t},eI=$.needsThreadReply,eB=e=>"done"===e.status&&!e.seen;function eq({crew:e,more:n,bubble:a,bots:s,rows:o,count:r,busy:i,pending:l,unread:d,composing:c,onCompose:u,onCloseCompose:m,onPick:x,onOpen:p}){let h=c||o.length>0;return(0,t.jsxs)("div",{className:(0,Y.cn)("pointer-events-auto w-fit max-w-full bg-background/78 ring-1 ring-border/50 backdrop-blur-md transition-shadow duration-300",h?"w-132 rounded-3xl shadow-lg shadow-black/8":"rounded-full shadow-sm shadow-black/3"),children:[(0,t.jsx)("div",{className:(0,Y.cn)("grid overflow-hidden transition-[grid-template-rows] duration-300 ease-out",h?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,t.jsx)("div",{className:"min-h-0 overflow-hidden",inert:!h,children:c?(0,t.jsx)(eL,{bots:s,onDone:m}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-2 font-mono text-[10px] tracking-wide text-muted-foreground",children:[(0,t.jsx)("span",{className:"flex-1",children:[l>0?`${l} ${1===l?"needs":"need"} a reply`:"",d>0?`${d} new ${1===d?"result":"results"}`:""].filter(Boolean).join(" · ")}),(0,t.jsx)(eF,{onClick:u})]}),(0,t.jsx)("div",{className:"max-h-[45vh] overflow-y-auto px-1.5 pb-2",children:o.map(e=>(0,t.jsx)(tt,{thread:e,onPick:()=>x(e.id)},e.id))}),(0,t.jsx)("span",{className:"block h-1.5"})]})})}),(0,t.jsx)(eD,{crew:e,more:n,bubble:h?null:a,label:r?`Threads (${r})`:"Bots",onClick:p,side:(0,t.jsx)(eE,{busy:i,pending:l,grown:h}),children:c&&(0,t.jsx)(eO,{onClick:m,label:"Cancel the message",children:(0,t.jsx)(g.X,{className:"size-3.5"})})})]})}function eD({crew:e,more:n,bubble:a,side:s,label:o,onClick:r,children:i}){return(0,t.jsxs)("div",{className:"flex shrink-0 items-center gap-2 px-3 py-1.5",children:[(0,t.jsxs)("button",{type:"button",onClick:r,"aria-label":o,className:"flex min-w-0 flex-1 items-center gap-2 rounded-full text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(eH,{crew:e,more:n,bubble:a}),s]}),i]})}function eE(e){let n=function({busy:e,pending:t,grown:n}){return t>0?{text:1===t?"waiting on you":`${t} waiting on you`,shine:!0}:e>0?{text:"working",shine:!0,spin:!0}:n?null:{text:"Need a hand?",shine:!1}}(e);return n?(0,t.jsxs)("span",{className:"ml-auto flex h-7 shrink-0 items-center gap-1.5",children:[n.shine?(0,t.jsx)(M.ShinyText,{text:n.text,speed:2.6,className:"block truncate text-[14px] leading-5 tracking-[-0.15px]"}):(0,t.jsx)("span",{className:"block animate-in truncate text-[14px] leading-5 tracking-[-0.15px] text-muted-foreground fade-in duration-300",children:n.text},n.text),n.spin&&(0,t.jsx)(h.Loader2,{className:"size-4 shrink-0 animate-spin text-muted-foreground/70"})]}):null}function eF({onClick:e}){return(0,t.jsx)(eO,{onClick:e,label:"Message a bot",children:(0,t.jsx)(f.Plus,{className:"size-4"})})}function eO({onClick:e,label:n,children:a}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":n,className:"grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:a})}function eL({bots:e,onDone:n}){let[a,s]=(0,k.useState)(null),[o,i]=(0,k.useState)(""),[l,u]=(0,ef.useServerAction)(R.startThreadAction,{onOk:()=>{(0,V.revalidate)(w.queryKey.threads),n()}}),m=e?.length?e.filter(e=>!e.disabled).map(e=>({name:e.name,icon:e.icon})):[{name:$.DEFAULT_BOT.name,icon:$.DEFAULT_BOT.icon}],x=()=>{a&&o.trim()&&!u&&l(a.name,o.trim())};return a?(0,t.jsxs)("div",{className:"flex min-h-32 flex-col pb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>s(null),"aria-label":"Choose a different bot",className:"grid size-6 shrink-0 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(d.ChevronLeft,{className:"size-3.5"})}),(0,t.jsx)(I.BotMark,{size:22,seed:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,paint:a.icon?.paint,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-medium",children:["To ",a.name]})]}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),x()},className:"mx-3 mt-auto flex items-end gap-1 rounded-2xl bg-background py-2 pr-2 pl-3 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",children:[(0,t.jsx)(C.Textarea,{value:o,rows:1,autoFocus:!0,disabled:u,onChange:e=>i(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),x())},placeholder:`What should ${a.name} do? It cannot hear the call, so say the whole job.`,"aria-label":`Message for ${a.name}`,className:"max-h-32 min-h-15 flex-1 resize-none border-0 bg-transparent px-0 py-0 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,t.jsx)(v.Button,{type:"submit",size:"icon-sm",variant:o.trim()?"default":"ghost",disabled:!o.trim()||u,"aria-label":"Send",className:"rounded-full",children:u?(0,t.jsx)(h.Loader2,{className:"animate-spin"}):(0,t.jsx)(r.ArrowUp,{})})]})]}):(0,t.jsxs)("div",{className:"min-h-32 pb-3",children:[(0,t.jsx)("p",{className:"px-3 pt-3 pb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:"message a bot"}),(0,t.jsx)("div",{className:"px-1",children:m.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(I.BotMark,{size:22,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,className:"shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:e.name}),(0,t.jsx)(c.ChevronRight,{className:"size-3.5 shrink-0 text-muted-foreground/50"})]},e.name))})]})}let eP=["alto","brio","cinder","delta"].map((e,t)=>({name:e,icon:{color:ez.MARK_PALETTE[Math.floor(t*ez.MARK_PALETTE.length/4)],shape:ez.MARK_SHAPES[t%ez.MARK_SHAPES.length]},awake:!1,waiting:!1,word:null,standIn:!0})),eK=3;function eH({crew:e,more:n,bubble:a}){return(0,t.jsxs)("span",{className:"flex min-w-0 shrink items-center",children:[e.map((n,s)=>(0,t.jsxs)(k.Fragment,{children:[(0,t.jsxs)("span",{className:(0,Y.cn)("relative shrink-0 transition-[margin] duration-500 ease-out",s>0&&!e[s-1].word&&"-ml-2",n.standIn&&"opacity-35"),style:{zIndex:e.length-s},children:[(0,t.jsx)("span",{className:(0,Y.cn)("flex transition-transform duration-500 ease-out",n.awake&&"-translate-y-0.5 scale-110"),children:(0,t.jsx)(eU,{face:n})}),a?.at===n.name&&(0,t.jsx)(eV,{handoff:a})]}),n.word&&(0,t.jsx)("span",{className:"mx-2.5 min-w-0 shrink truncate",children:(0,t.jsx)(M.ShinyText,{text:n.word,speed:2.6,className:"truncate text-[13px] leading-5 tracking-[-0.1px]"})})]},n.name)),n>0&&(0,t.jsxs)("span",{className:(0,Y.cn)("grid size-7 shrink-0 place-items-center rounded-[9px] bg-muted font-mono text-[10px] text-muted-foreground ring-1 ring-border/50",!e.at(-1)?.word&&"-ml-2"),title:`${n} more`,children:["+",n]})]})}function eU({face:e}){return(0,t.jsx)(I.BotMark,{size:28,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:e.waiting})}function eV({handoff:e}){return(0,t.jsxs)("span",{className:"pointer-events-none absolute bottom-[calc(100%+10px)] left-1/2 flex w-max -translate-x-1/2 animate-in flex-col items-center fade-in zoom-in-95 duration-200",children:[(0,t.jsx)("span",{className:"flex rounded-full bg-background py-2 pr-3.5 pl-2.5 shadow-lg shadow-black/10 ring-1 ring-border",children:(0,t.jsx)(eW,{handoff:e})}),(0,t.jsx)("span",{className:"-mt-px size-0 border-x-[6px] border-t-[7px] border-x-transparent border-t-border"}),(0,t.jsx)("span",{className:"-mt-[7.5px] size-0 border-x-[6px] border-t-[7px] border-x-transparent border-t-background"})]})}function eY({handoff:e}){return(0,t.jsx)("span",{className:"ml-auto flex h-7 min-w-0 shrink animate-in items-center pl-4 fade-in duration-200",children:(0,t.jsx)(eW,{handoff:e})})}function eW({handoff:e}){let n=e.sign?eA[e.sign]:null,a=e.sign?eR[e.sign]:void 0;return(0,t.jsxs)("span",{className:(0,Y.cn)("flex min-w-0 items-center gap-2 text-[13px] leading-[18px] tracking-[-0.1px] whitespace-nowrap",a),children:[(0,t.jsx)(eG,{from:e.from,to:e.to}),n&&(0,t.jsx)(n,{className:(0,Y.cn)("size-3.5 shrink-0",!a&&"text-muted-foreground/70")}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:e.text})]})}function eG({from:e,to:n}){let a=[e,...n];return(0,t.jsx)("span",{className:"flex shrink-0 items-center",children:a.map((e,n)=>(0,t.jsx)("span",{className:(0,Y.cn)("relative flex",n>0&&"-ml-1.25"),style:{zIndex:a.length-n},children:(0,t.jsx)(eQ,{bot:e})},e.name))})}function eQ({bot:e}){return e.name===tm.name?(0,t.jsx)(eT.ThursdayMark,{size:18,className:"shrink-0"}):(0,t.jsx)(I.BotMark,{size:18,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"})}function eJ({onClick:e}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":"Fold the room away",className:"grid size-7 shrink-0 place-items-center rounded-full bg-muted text-foreground outline-none transition-colors hover:bg-muted-foreground/20 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(g.X,{className:"size-3.5"})})}function eX({tab:e,current:n,composing:a,onTab:s,onCompose:o,onClose:r}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 pt-3 pr-3.5 pb-1.5 pl-2.5",children:[(0,t.jsx)(z.Tabs,{value:a?null:e,onValueChange:e=>s(e),className:"gap-0",children:(0,t.jsxs)(z.TabsList,{className:"gap-1 rounded-none bg-transparent p-0 group-data-horizontal/tabs:h-auto",children:[(0,t.jsxs)(z.TabsTrigger,{value:"now",className:ts,children:["Now",n>0&&(0,t.jsx)("span",{className:"font-mono text-[10px] font-normal text-muted-foreground tabular-nums",children:n})]}),(0,t.jsx)(z.TabsTrigger,{value:"history",className:ts,children:"History"})]})}),(0,t.jsx)("span",{className:"flex-1"}),!a&&(0,t.jsx)(eF,{onClick:o}),(0,t.jsx)(eJ,{onClick:r})]})}function eZ({thread:e,onBack:n,onClose:a}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-1",children:[(0,t.jsx)("button",{type:"button",onClick:n,"aria-label":"Back to the list",className:"shrink-0 rounded-md p-1 text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(d.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(I.BotMark,{size:22,seed:e.bot.name,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,paint:e.bot.icon?.paint,notify:!1}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[13px] font-medium",children:[e.label,(0,t.jsx)("span",{title:e.id,className:"ml-1.5 font-mono text-[10px] font-normal text-muted-foreground/60",children:e.id.slice(0,8)})]}),(0,t.jsx)(e0,{thread:e}),(0,t.jsx)(eJ,{onClick:a})]})}function e0({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e1,{usage:e.tokens}),(0,t.jsx)(e2,{thread:e}),(0,t.jsx)(e3,{thread:e})]})}function e1({usage:e}){let n=e.input+e.output;return n?(0,t.jsx)("span",{title:`in ${(0,Y.formatCount)(e.input)} \xb7 out ${(0,Y.formatCount)(e.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,Y.formatCount)(n)}):null}function e2({thread:e}){let{contextTokens:n,contextBudget:a}=e;if(!n||!a)return null;let s=Math.min(1,n/a);return(0,t.jsx)("span",{title:`Context ${(0,Y.formatCount)(n)} of ${(0,Y.formatCount)(a)} — it summarizes itself here`,className:"block h-[3px] w-9 shrink-0 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,Y.cn)("block h-full rounded-full",s>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*s))}%`}})})}let e5={working:"text-muted-foreground",waiting:Y.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"};function e3({thread:e}){let n="done"===e.status&&e.seen?"text-muted-foreground":e5[e.status];return"working"===e.status?(0,t.jsx)(M.ShinyText,{text:"working",speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,Y.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:e.status})}function e4({bots:e}){return(0,t.jsx)("p",{className:"px-6 pt-4 pb-5 text-center text-[12px] text-muted-foreground",children:e?.length?"Nothing handed over yet — ask for something that takes a while.":`Thursday hands work to ${$.DEFAULT_BOT.name} until you make bots of your own in Settings › Bots.`})}function e7(){return(0,t.jsx)("p",{className:"px-6 pt-4 pb-5 text-center text-[12px] text-muted-foreground",children:"Nothing running or waiting."})}function e8({pages:e,threads:r,scroll:i,onPick:l}){let d=(0,k.useCallback)(e=>{e&&(e.scrollTop=i.current)},[i]),c=[];for(let e of r){let t=function(e){let t=(0,H.toDate)(e);return(0,s.isToday)(t)?"today":(0,o.isYesterday)(t)?"yesterday":(0,n.format)(t,(0,a.isThisYear)(t)?"MMM d":"MMM d, yyyy").toLowerCase()}(e.updatedAt),r=c.at(-1);r?.day===t?r.rows.push(e):c.push({day:t,rows:[e]})}return(0,t.jsx)("div",{ref:d,onScroll:e=>{i.current=e.currentTarget.scrollTop},className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-2 scrollbar-none",children:e.error?(0,t.jsx)("p",{className:"px-2.5 py-3 text-[12px] text-destructive",children:e.error.message}):e.isLoading?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(e6,{}),(0,t.jsx)(e6,{}),(0,t.jsx)(e6,{})]}):(0,t.jsxs)(t.Fragment,{children:[c.map((e,n)=>(0,t.jsxs)(k.Fragment,{children:[(0,t.jsxs)("p",{className:(0,Y.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===n?"pt-1":"pt-3"),children:[e.day," · ",e.rows.length]}),e.rows.map(e=>(0,t.jsx)(tt,{thread:e,onPick:()=>l(e.id)},e.id))]},e.day)),e.hasMore?(0,t.jsx)("div",{ref:e.sentinelRef,children:(0,t.jsx)(e6,{})}):0===c.length&&(0,t.jsx)("p",{className:"px-6 pt-3 pb-4 text-center text-[12px] text-muted-foreground",children:"Nothing has ended yet."})]})})}function e6(){return(0,t.jsxs)("div",{className:"flex items-center gap-2.5 px-2 py-1.5",children:[(0,t.jsx)(S.Skeleton,{className:"size-8 shrink-0 rounded-[10px]"}),(0,t.jsxs)("span",{className:"flex h-9 min-w-0 flex-1 flex-col justify-center gap-1.5",children:[(0,t.jsx)(S.Skeleton,{className:"h-3.5 w-2/5"}),(0,t.jsx)(S.Skeleton,{className:"h-2.5 w-3/5"})]})]})}let e9=[{id:"you",label:"needs you",holds:eI},{id:"unread",label:"new results",holds:eB},{id:"working",label:"working",holds:e=>"working"===e.status},{id:"done",label:"done",holds:()=>!0}];function te({threads:e,onPick:n}){let a=new Map;for(let t of e){let e=e9.find(e=>e.holds(t))??e9[e9.length-1],n=a.get(e.id);n?n.push(t):a.set(e.id,[t])}return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-1 scrollbar-none",children:e9.map((e,s)=>{let o=a.get(e.id)??[];return o.length?(0,t.jsxs)(k.Fragment,{children:[(0,t.jsxs)("p",{className:(0,Y.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===s?"pt-1":"pt-3"),children:[e.label," · ",o.length]}),o.map(e=>(0,t.jsx)(tt,{thread:e,onPick:()=>n(e.id)},e.id))]},e.id):null})})}function tt({thread:e,onPick:n}){let a=eI(e),s=e.lines.at(-1),o=(0,k.useMemo)(()=>(function(e){let t=e.room.questions[0];if(t)return{text:(0,Y.plainText)(t.text),tone:"text-foreground"};if("waiting"===e.status&&e.ask)return{text:(0,$.isAppStop)(e.ask)?(0,Y.plainText)(e.outcome??e.ask.question):e.ask.question,tone:Y.WAITING_INK};let n=e.seen;if("cancelled"===e.status)return{text:"Stopped",tone:"text-muted-foreground"};if("done"===e.status)return{text:(0,Y.plainText)(e.outcome??"Done"),tone:n?"text-muted-foreground":"text-foreground"};let a=ee(e);return a?{text:"tool"===a.kind&&a.tool?a.tool.note??`${a.tool.name} \xb7 ${a.tool.input}`:a.text,tone:"text-muted-foreground"}:{text:`${e.bot.name} is taking it on…`,tone:"text-muted-foreground italic"}})(e),[e.status,e.outcome,e.seen,e.ask,e.room.questions,s?.id]),[r,i]=eN(),[l,d]=(0,k.useState)(null),c="waiting"===e.status&&(0,$.isAppStop)(e.ask)?e.ask?.options??[]:[];return(0,t.jsxs)("div",{className:"rounded-xl transition-colors hover:bg-muted/60",children:[(0,t.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{className:"relative flex size-8 shrink-0 items-center justify-center overflow-visible",title:e.bot.name,children:(0,t.jsx)(I.BotMark,{size:32,seed:e.bot.name,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,paint:e.bot.icon?.paint,state:"working"===e.status?"thinking":"idle",notify:a,crossed:"cancelled"===e.status})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(a||eB(e))&&(0,t.jsx)("span",{className:"block text-[10px] font-medium text-foreground",children:e.room.questions.length?`${1===e.room.questions.length?"Question":`${e.room.questions.length} questions`} \xb7 ${[...new Set(e.room.questions.map(e=>e.bot))].join(", ")}`:"waiting"===e.status?(0,$.isAppStop)(e.ask)?"Paused":"Question":"New result"}),(0,t.jsxs)("span",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:(0,Y.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",a?"text-foreground":"text-foreground/80"),children:e.label}),(0,t.jsx)(B.BotRoster,{bots:el(e)}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] leading-4 text-muted-foreground/70 tabular-nums",children:(0,H.shortAgo)(e.updatedAt)})]}),(0,t.jsxs)("span",{className:"mt-px flex h-4 items-center gap-1.5",children:["working"===e.status&&(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/70"}),"working"!==e.status||a?(0,t.jsx)("span",{className:(0,Y.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone),children:o.text}):(0,t.jsx)(M.ShinyText,{text:o.text,speed:2.2,className:(0,Y.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone.includes("italic")&&"italic")})]})]})]}),c.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-0.5 pr-2 pb-2 pl-12.5",children:c.map(n=>(0,t.jsxs)(v.Button,{size:"sm",variant:"outline",loading:l===n,disabled:i,onClick:async()=>{d(n),await r(e,n),d(null)},className:"h-7 gap-1.5 rounded-full border-border bg-background px-3 text-[12px]",children:[n===$.THREAD_CONTINUE&&(0,t.jsx)(u.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),n]},n))})]})}function tn({thread:e,tab:n=null,onTab:a,className:s,tabsClassName:o}){let r,i=(0,k.useRef)(null),l=(0,k.useRef)(!0),d=el(e),c=a&&n!==e.bot.name&&d.some(e=>e.name===n)?n:null,u=c??e.bot.name,m=d.filter(t=>(!c||t.name===c)&&to(e,t.name)),x=ex((r=new Set(e.room.questions.map(e=>`${e.bot}
4
4
  ${e.text.trim()}`))).size?{...e,lines:e.lines.filter(e=>!("ask"===e.kind&&e.question&&e.to?.name===tm.name&&r.has(`${e.bot.name}
5
- ${e.text.trim()}`)))}:e,u,m);return(0,k.useEffect)(()=>{l.current=!0},[e.id,c]),(0,k.useEffect)(()=>{let e=i.current;e&&l.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status,c]),(0,t.jsxs)(eM.FileViewer,{children:[a&&(0,t.jsx)(ta,{thread:e,roster:d,side:c,onPick:a,className:o}),(0,t.jsxs)("div",{ref:i,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,Y.cn)("min-w-0 max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",s),children:[!c&&(0,t.jsx)(tu,{thread:e}),x.map(n=>"invite"===n.kind?(0,t.jsx)(tx,{from:n.from,to:n.to},n.key):(0,t.jsx)(tr,{turn:n,thread:e,self:u},n.key))]})]})}function ta({thread:e,roster:n,side:a,onPick:s,className:o}){return(0,t.jsx)(z.Tabs,{value:a??e.bot.name,onValueChange:t=>s(t===e.bot.name?null:String(t)),className:(0,Y.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",o),children:(0,t.jsx)(z.TabsList,{className:"w-full justify-start gap-1 overflow-x-auto rounded-none bg-transparent p-0 scrollbar-none group-data-horizontal/tabs:h-auto",children:n.map(n=>{let a=to(e,n.name);return(0,t.jsxs)(z.TabsTrigger,{value:n.name,className:(0,Y.cn)(ts,"pl-1.5"),children:[(0,t.jsx)(I.BotMark,{size:16,seed:n.name,color:n.icon?.color,shape:n.icon?.shape,outline:n.icon?.outline,paint:n.icon?.paint,notify:"asking"===a,className:"shrink-0"}),(0,t.jsx)("span",{className:"max-w-28 truncate",children:n.name}),"running"===a&&(0,t.jsx)(h.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},n.name)})})})}let ts="h-7 flex-none rounded-full px-3 py-0 text-[12px] text-muted-foreground hover:bg-muted/60 data-active:bg-muted data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:border-transparent dark:data-active:bg-muted";function to(e,t){let{room:n}=e;return n.questions.some(e=>e.bot===t)?"asking":"working"===e.status&&n.participants.some(e=>e.bot===t&&"running"===e.state)?"running":null}function tr({turn:e,thread:n,self:a}){let s=e.speaker.name===a,o=s?"none":e.speaker.name===tm.name?"dark":"secondary",r=null;return(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(tb,{side:s?"start":"end",name:e.speaker.name,mark:(0,t.jsx)(th,{bot:e.speaker}),children:e.entries.map(i=>{if("work"===i.kind)return s?(0,t.jsx)(tl,{lines:i.lines,trailing:i.open,bot:e.speaker,thread:n},i.key):(0,t.jsx)(ti,{lines:i.lines,trailing:i.open,bot:e.speaker,thread:n},i.key);let l=eu(i.line),d=l&&l.name!==e.speaker.name&&l.name!==a&&l.name!==tm.name&&l.name!==r?l:null;return l&&(r=l.name),(0,t.jsx)(tg,{line:i.line,surface:o,mention:d},i.key)})})})}function ti({lines:e,trailing:n,bot:a,thread:s}){var o;let[r,i]=(0,k.useState)(!1),d=n?to(s,a.name):null,c=(o=e,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([e,t])=>[o.filter(t=>t.kind===e).length,t]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}${1===e?"":"s"}`).join(" · "));if(!d&&!c)return null;let u=e.findLast(e=>"tool"===e.kind||"say"===e.kind),m=r&&e.length>0;return(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",m?"w-full":"w-fit max-w-full"),children:[(0,t.jsxs)("button",{type:"button",disabled:!e.length,"aria-expanded":m,onClick:()=>i(e=>!e),className:"flex min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-left outline-none transition-colors enabled:hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:["running"===d&&(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),d?(0,t.jsx)(M.ShinyText,{text:"asking"===d?"waiting on you":u?tc(u):"working",tone:"asking"===d?"waiting":"muted",speed:2.4,className:"min-w-0 truncate text-[12px] leading-4"}):(0,t.jsx)("span",{className:"min-w-0 truncate font-mono text-[10px] leading-4 text-muted-foreground",children:c}),e.length>0&&(0,t.jsx)(l.ChevronDown,{className:(0,Y.cn)("size-3 shrink-0 text-muted-foreground/50 transition-transform",m&&"rotate-180")})]}),m&&(0,t.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:tS(e).map(e=>"tools"===e.kind?e.lines.map(e=>e.tool&&(0,t.jsx)(eC.BotTool,{tool:e.tool,threadId:s.id,collapsed:!0},e.id)):"stops"===e.kind?(0,t.jsx)("div",{className:"px-1.5 py-1",children:(0,t.jsx)(tT,{lines:e.lines})},e.key):e.lines.map(e=>(0,t.jsx)(tv,{line:e,inset:!0},e.id)))})]})}function tl({lines:e,trailing:n,bot:a,thread:s}){let o=n?to(s,a.name):null,r=e.some(e=>e.tool&&void 0===e.tool.results);return(0,t.jsxs)(t.Fragment,{children:[tS(e).map(e=>"tools"===e.kind?(0,t.jsx)(td,{lines:e.lines,threadId:s.id},e.key):"stops"===e.kind?(0,t.jsx)(tT,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(tv,{line:e},e.id))),o&&!r&&(0,t.jsx)(M.ShinyText,{text:"asking"===o?"waiting on you":"on the next step…",tone:"asking"===o?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function td({lines:e,threadId:n}){return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:[e.length>1&&(0,t.jsxs)("p",{className:"px-2 py-1 font-mono text-[10px] text-muted-foreground",children:[e.length," steps"]}),e.map(e=>e.tool&&(0,t.jsx)(eC.BotTool,{tool:e.tool,threadId:n,collapsed:!0},e.id))]})}function tc(e){return"tool"===e.kind&&e.tool?e.tool.note??`${e.tool.name} \xb7 ${e.tool.input}`:(0,Y.plainText)(e.text).replace(/\s+/g," ").trim()}function tu({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tx,{from:tm,to:e.bot}),(0,t.jsx)(tb,{side:"end",name:tm.name,mark:(0,t.jsx)(th,{bot:tm}),children:(0,t.jsx)(tf,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,t.jsx)(N.FoldedText,{text:e.request,subject:"request",className:"wrap-anywhere"})})})]})}let tm={name:W.ROOM_THURSDAY};function tx({from:e,to:n}){return(0,t.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(tp,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(tp,{bot:n})]})})}function tp({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.name===tm.name?(0,t.jsx)(eT.ThursdayMark,{size:15,className:"shrink-0"}):(0,t.jsx)(I.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function th({bot:e}){return e.name===tm.name?(0,t.jsx)(eT.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,t.jsx)(I.BotMark,{size:26,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"mt-1 shrink-0"})}function tf({dark:e=!1,children:n,className:a}){return(0,t.jsx)(y.Bubble,{align:"end",variant:e?"default":"secondary",className:"max-w-full",children:(0,t.jsx)(y.BubbleContent,{className:(0,Y.cn)("rounded-tr-md px-3.5",a),children:(0,t.jsx)("div",{className:(0,Y.cn)("min-w-0",e&&"inverse"),children:n})})})}function tb({side:e,mark:n,name:a,children:s}){return(0,t.jsxs)("div",{className:(0,Y.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===e&&"items-end"),children:[(0,t.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:a}),s]})]})}function tg({line:e,surface:n,mention:a}){let s=!!e.question,o="result"===e.kind,r="none"!==n,i=(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(ty,{}),a?(0,t.jsx)(tw,{bot:a,bubble:r,children:e.text}):(0,t.jsx)(tk,{bubble:r,className:(0,Y.cn)(!o&&"leading-snug"),children:e.text})]});return(0,t.jsxs)(t.Fragment,{children:[r?(0,t.jsx)(tf,{dark:"dark"===n,children:i}):(0,t.jsx)("div",{className:"min-w-0 max-w-full px-1",children:i}),o&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)(q.PathChips,{text:e.text,className:"min-w-0"}),(0,t.jsx)(tN,{text:e.text})]})]})}function tk({children:e,bubble:n=!1,className:a}){return(0,t.jsx)(T.Markdown,{className:(0,Y.cn)("min-w-0 max-w-full text-[13px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&_table]:wrap-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",n&&"[&_[data-streamdown=inline-code]]:text-[12px] [&_[data-streamdown=code-block]]:my-2 [&_[data-streamdown=code-block]]:gap-0 [&_[data-streamdown=code-block]]:rounded-[10px] [&_[data-streamdown=code-block]]:border-0 [&_[data-streamdown=code-block]]:bg-background [&_[data-streamdown=code-block]]:p-0 [&_[data-streamdown=code-block-header]]:h-7 [&_[data-streamdown=code-block-header]]:px-2.5 [&_[data-streamdown=code-block-header]]:text-[11px] [&_[data-streamdown=code-block-body]]:border-0 [&_[data-streamdown=code-block-body]]:bg-transparent! [&_[data-streamdown=code-block-body]]:px-2.5 [&_[data-streamdown=code-block-body]]:pt-0 [&_[data-streamdown=code-block-body]]:pb-2.5 [&_[data-streamdown=code-block-body]]:text-[12.5px] [&_[data-streamdown=code-block]_div:has(>[data-streamdown=code-block-actions])]:-mt-7 [&_[data-streamdown=code-block-actions]]:mr-1 [&_[data-streamdown=code-block-actions]]:border-0 [&_[data-streamdown=code-block-actions]]:bg-transparent!",a),children:e})}function tj({bot:e,bubble:n}){return(0,t.jsxs)("span",{className:(0,Y.cn)("mr-1.5 inline-flex h-5 max-w-full items-center gap-1 rounded-full pr-2 pl-[3px] align-[-4px] text-[12px] leading-none font-medium whitespace-nowrap text-foreground",n?"bg-background":"bg-muted"),children:[(0,t.jsx)(I.BotMark,{size:14,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function tw({bot:e,bubble:n,children:a}){return(0,t.jsxs)("div",{className:"min-w-0 max-w-full text-[13px] leading-snug",children:[(0,t.jsx)(tj,{bot:e,bubble:n}),(0,t.jsx)(tk,{bubble:n,className:"contents leading-snug [&>p:first-child]:inline",children:a})]})}function ty(){return(0,t.jsxs)("p",{className:"mb-1 flex items-center gap-1.5 text-[12px] leading-4 font-medium text-muted-foreground",children:[(0,t.jsx)(x.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function tv({line:e,inset:n=!1}){return"note"===e.kind?(0,t.jsxs)("details",{className:"w-full px-2 py-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,t.jsx)("span",{className:"min-w-0 text-center font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)(tk,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:e.text})]}):(0,t.jsx)(tk,{className:(0,Y.cn)("text-[12.5px] text-muted-foreground",n?"px-2.5 py-1":"px-1"),children:e.text})}function tN({text:e}){let[n,a]=(0,k.useState)(!1),s=(0,k.useRef)(null);return(0,k.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(!1),1400)}catch(e){_.toast.add({type:"error",title:"Could not copy the answer",description:(0,Y.errorToString)(e)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:n?(0,t.jsx)(i.Check,{className:"size-3"}):(0,t.jsx)(p.Copy,{className:"size-3"})})}function tT({lines:e}){return(0,t.jsxs)("details",{className:"group min-w-0 px-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[12.5px] leading-relaxed outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)(b.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:tM(e[0].text)}),e.length>1&&(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",e.length]}),(0,t.jsx)(l.ChevronDown,{className:"size-2.5 shrink-0 text-muted-foreground/70 transition-transform group-open:rotate-180"})]}),(0,t.jsx)("div",{className:"mt-1 space-y-1 pl-4.5 text-[11px] leading-relaxed",children:e.map(e=>(0,t.jsxs)("p",{className:"flex gap-2 break-keep",children:[e.at&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground/70 tabular-nums",children:(0,n.format)((0,H.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let tM=e=>e.split(" (")[0].replace(/\.$/,"");function tS(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"stop"===n.kind?"stops":"said",a=t.at(-1),s=a?.kind===e&&("stops"!==e||tM(a.lines[0].text)===tM(n.text));a&&s?a.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t}e.s(["BotRoom",0,e_,"Conversation",0,tn,"ThreadFacts",0,e0],279265)},969526,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f3520b407abd92fdf69d02d2f364032903f49fa11",t.callServer,void 0,t.findSourceMapURL,"answerThreadAction");e.s(["answerThreadAction",0,n])},330097,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f503964271cf21576536fd7e051e10454f1c4e9bc",t.callServer,void 0,t.findSourceMapURL,"cancelThreadAction");e.s(["cancelThreadAction",0,n])},108957,931619,119002,51481,508734,825398,815731,496336,990483,835878,764224,919191,e=>{"use strict";var t=e.i(677241),n=e.i(24708),a=e.i(845110);e.s(["isThisYear",0,function(e,s){return function(e,t){let[n,s]=(0,a.normalizeDates)(void 0,e,t);return n.getFullYear()===s.getFullYear()}((0,t.constructFrom)(s?.in||e,e),(0,n.constructNow)(s?.in||e))}],108957);var s=e.i(456420);let o={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};o.node;let r=(0,s.default)(o);e.s(["ChevronsRight",0,r],931619);let i={name:"circle-pause",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],aliases:["pause-circle"]};i.node;let l=(0,s.default)(i);e.s(["CirclePause",0,l],119002);let d={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};d.node;let c=(0,s.default)(d);e.s(["CircleQuestionMark",0,c],51481);let u={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};u.node;let m=(0,s.default)(u);e.s(["Copy",0,m],508734);let x={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};x.node;let p=(0,s.default)(x);e.s(["RotateCw",0,p],825398);var h=e.i(843476),f=e.i(176782),b=e.i(552245),g=e.i(225913),k=e.i(647163);let j=(0,g.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,g.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),e.s(["Bubble",0,function({variant:e="default",align:t="start",className:n,...a}){return(0,h.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,k.cn)(j({variant:e}),n),...a})},"BubbleContent",0,function({className:e,render:t,...n}){var a;return a={defaultTagName:"div",props:(0,f.mergeProps)({className:(0,k.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",e)},n),render:t,state:{slot:"bubble-content"}},(0,b.useRenderElement)(a.defaultTagName??"div",a,a)}],815731);var w=e.i(716327),y=e.i(271645);e.s(["FoldedText",0,function({text:e,subject:t,clamp:n="line-clamp-3",tall:a="max-h-40",className:s}){let[o,r]=(0,y.useState)(!1),[i,l]=(0,y.useState)(!1),d=(0,y.useRef)(null);return(0,y.useEffect)(()=>r(!1),[e]),(0,y.useEffect)(()=>{let e=d.current;e&&!o&&l(e.scrollHeight>e.clientHeight+1)},[o,e]),(0,h.jsxs)("div",{className:(0,k.cn)("flex items-start gap-1",s),children:[(0,h.jsx)("p",{ref:d,className:(0,k.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",o?(0,k.cn)(a,"overflow-y-auto scrollbar-none"):n),children:e}),(i||o)&&(0,h.jsx)("button",{type:"button",onClick:()=>r(e=>!e),"aria-label":o?`Fold the ${t}`:`Read the whole ${t}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,h.jsx)(w.ChevronDown,{className:(0,k.cn)("size-3.5",o&&"rotate-180")})})]})}],496336);var v=e.i(95187);let N=(0,v.createServerReference)("7f647faa7f1919a4f08f73dcc78e04901429e8c75e",v.callServer,void 0,v.findSourceMapURL,"startThreadAction");e.s(["startThreadAction",0,N],990483);var T=e.i(635963);e.s(["BotRoster",0,function({bots:e}){return e.length<2?null:(0,h.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,h.jsx)("span",{className:"flex items-center gap-0.5",children:e.slice(0,3).map(e=>(0,h.jsx)(T.BotMark,{size:18,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"},e.name))}),(0,h.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}],835878);var M=e.i(829600);let S={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};S.node;let z=(0,s.default)(S),C={name:"file-image",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]};C.node;let _=(0,s.default)(C);var A=e.i(905015);let R={name:"file-spreadsheet",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]};R.node;let $=(0,s.default)(R);var I=e.i(226091);let B={name:"file-type",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]]};B.node;let q=(0,s.default)(B),D={name:"file-x",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]};D.node;let E=(0,s.default)(D);var F=e.i(798120),O=e.i(621285),L=e.i(616172),P=e.i(283653);let K={markdown:I.FileText,csv:$,json:A.FileJson,text:q,image:_};e.s(["PathChips",0,function({text:e,className:t}){let n=(0,y.useMemo)(()=>(0,L.pathsIn)(e),[e]),{data:a}=(0,P.useServerRoute)(n.length?F.queryKey.workspaceMissing(n):null),s=(0,y.useMemo)(()=>new Set(a),[a]);if(!n.length)return null;let o="flex max-w-full items-center gap-1.5 rounded-full bg-muted/70 py-1 pr-2.5 pl-2 font-mono text-[11px]";return(0,h.jsx)("div",{className:(0,k.cn)("flex flex-wrap gap-1.5",t),children:n.map(e=>{let t,n=e.split("/").pop()??e;if(s.has(e))return(0,h.jsxs)("span",{title:`${e} — not on disk`,className:(0,k.cn)(o,"text-muted-foreground"),children:[(0,h.jsx)(E,{className:"size-3 shrink-0"}),(0,h.jsx)("span",{className:"truncate line-through",children:n})]},e);let a="frame"===(t=(0,L.viewKindOf)(e))?e.toLowerCase().endsWith(".pdf")?I.FileText:z:K[t]??M.File;return(0,h.jsxs)(O.FileLink,{path:e,className:(0,k.cn)(o,"text-foreground/80 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50"),children:[(0,h.jsx)(a,{className:"size-3 shrink-0 text-muted-foreground"}),(0,h.jsx)("span",{className:"truncate",children:n})]},e)})})}],764224);let H={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};H.node;let U=(0,s.default)(H);e.s(["CornerDownLeft",0,U],919191)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let a=(0,t.default)(n);e.s(["Square",0,a],929272)}]);
5
+ ${e.text.trim()}`)))}:e,u,m);return(0,k.useEffect)(()=>{l.current=!0},[e.id,c]),(0,k.useEffect)(()=>{let e=i.current;e&&l.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status,c]),(0,t.jsxs)(eM.FileViewer,{children:[a&&(0,t.jsx)(ta,{thread:e,roster:d,side:c,onPick:a,className:o}),(0,t.jsxs)("div",{ref:i,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,Y.cn)("min-w-0 max-h-[64vh] space-y-3 overflow-y-auto px-4 pt-6 pb-4 mask-[linear-gradient(to_bottom,transparent,black_2rem)] scrollbar-none",s),children:[!c&&(0,t.jsx)(tu,{thread:e}),x.map(n=>"invite"===n.kind?(0,t.jsx)(tx,{from:n.from,to:n.to},n.key):(0,t.jsx)(tr,{turn:n,thread:e,self:u},n.key))]})]})}function ta({thread:e,roster:n,side:a,onPick:s,className:o}){return(0,t.jsx)(z.Tabs,{value:a??e.bot.name,onValueChange:t=>s(t===e.bot.name?null:String(t)),className:(0,Y.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",o),children:(0,t.jsx)(z.TabsList,{className:"w-full justify-start gap-1 overflow-x-auto rounded-none bg-transparent p-0 scrollbar-none group-data-horizontal/tabs:h-auto",children:n.map(n=>{let a=to(e,n.name);return(0,t.jsxs)(z.TabsTrigger,{value:n.name,className:(0,Y.cn)(ts,"pl-1.5"),children:[(0,t.jsx)(I.BotMark,{size:16,seed:n.name,color:n.icon?.color,shape:n.icon?.shape,outline:n.icon?.outline,paint:n.icon?.paint,notify:"asking"===a,className:"shrink-0"}),(0,t.jsx)("span",{className:"max-w-28 truncate",children:n.name}),"running"===a&&(0,t.jsx)(h.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},n.name)})})})}let ts="h-7 flex-none rounded-full px-3 py-0 text-[12px] text-muted-foreground hover:bg-muted/60 data-active:bg-muted data-active:text-foreground group-data-[variant=default]/tabs-list:data-active:shadow-none dark:data-active:border-transparent dark:data-active:bg-muted";function to(e,t){let{room:n}=e;return n.questions.some(e=>e.bot===t)?"asking":"working"===e.status&&n.participants.some(e=>e.bot===t&&"running"===e.state)?"running":null}function tr({turn:e,thread:n,self:a}){let s=e.speaker.name===a,o=s?"none":e.speaker.name===tm.name?"dark":"secondary",r=null;return(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(tb,{side:s?"start":"end",name:e.speaker.name,mark:(0,t.jsx)(th,{bot:e.speaker}),children:e.entries.map(i=>{if("work"===i.kind)return s?(0,t.jsx)(tl,{lines:i.lines,trailing:i.open,bot:e.speaker,thread:n},i.key):(0,t.jsx)(ti,{lines:i.lines,trailing:i.open,bot:e.speaker,thread:n},i.key);let l=eu(i.line),d=l&&l.name!==e.speaker.name&&l.name!==a&&l.name!==tm.name&&l.name!==r?l:null;return l&&(r=l.name),(0,t.jsx)(tg,{line:i.line,surface:o,mention:d},i.key)})})})}function ti({lines:e,trailing:n,bot:a,thread:s}){var o;let[r,i]=(0,k.useState)(!1),d=n?to(s,a.name):null,c=(o=e,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([e,t])=>[o.filter(t=>t.kind===e).length,t]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}${1===e?"":"s"}`).join(" · "));if(!d&&!c)return null;let u=e.findLast(e=>"tool"===e.kind||"say"===e.kind),m=r&&e.length>0;return(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",m?"w-full":"w-fit max-w-full"),children:[(0,t.jsxs)("button",{type:"button",disabled:!e.length,"aria-expanded":m,onClick:()=>i(e=>!e),className:"flex min-w-0 items-center gap-2 rounded-xl px-2.5 py-1.5 text-left outline-none transition-colors enabled:hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:["running"===d&&(0,t.jsx)(h.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),d?(0,t.jsx)(M.ShinyText,{text:"asking"===d?"waiting on you":u?tc(u):"working",tone:"asking"===d?"waiting":"muted",speed:2.4,className:"min-w-0 truncate text-[12px] leading-4"}):(0,t.jsx)("span",{className:"min-w-0 truncate font-mono text-[10px] leading-4 text-muted-foreground",children:c}),e.length>0&&(0,t.jsx)(l.ChevronDown,{className:(0,Y.cn)("size-3 shrink-0 text-muted-foreground/50 transition-transform",m&&"rotate-180")})]}),m&&(0,t.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:tS(e).map(e=>"tools"===e.kind?e.lines.map(e=>e.tool&&(0,t.jsx)(eC.BotTool,{tool:e.tool,threadId:s.id,collapsed:!0},e.id)):"stops"===e.kind?(0,t.jsx)("div",{className:"px-1.5 py-1",children:(0,t.jsx)(tT,{lines:e.lines})},e.key):e.lines.map(e=>(0,t.jsx)(tv,{line:e,inset:!0},e.id)))})]})}function tl({lines:e,trailing:n,bot:a,thread:s}){let o=n?to(s,a.name):null,r=e.some(e=>e.tool&&void 0===e.tool.results);return(0,t.jsxs)(t.Fragment,{children:[tS(e).map(e=>"tools"===e.kind?(0,t.jsx)(td,{lines:e.lines,threadId:s.id},e.key):"stops"===e.kind?(0,t.jsx)(tT,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(tv,{line:e},e.id))),o&&!r&&(0,t.jsx)(M.ShinyText,{text:"asking"===o?"waiting on you":"on the next step…",tone:"asking"===o?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function td({lines:e,threadId:n}){return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:[e.length>1&&(0,t.jsxs)("p",{className:"px-2 py-1 font-mono text-[10px] text-muted-foreground",children:[e.length," steps"]}),e.map(e=>e.tool&&(0,t.jsx)(eC.BotTool,{tool:e.tool,threadId:n,collapsed:!0},e.id))]})}function tc(e){return"tool"===e.kind&&e.tool?e.tool.note??`${e.tool.name} \xb7 ${e.tool.input}`:(0,Y.plainText)(e.text).replace(/\s+/g," ").trim()}function tu({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(tx,{from:tm,to:e.bot}),(0,t.jsx)(tb,{side:"end",name:tm.name,mark:(0,t.jsx)(th,{bot:tm}),children:(0,t.jsx)(tf,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,t.jsx)(N.FoldedText,{text:e.request,subject:"request",className:"wrap-anywhere"})})})]})}let tm={name:W.ROOM_THURSDAY};function tx({from:e,to:n}){return(0,t.jsx)("div",{className:"flex animate-in justify-center fade-in duration-300",children:(0,t.jsxs)("span",{className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted px-2.5 py-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(tp,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(tp,{bot:n})]})})}function tp({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.name===tm.name?(0,t.jsx)(eT.ThursdayMark,{size:15,className:"shrink-0"}):(0,t.jsx)(I.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function th({bot:e}){return e.name===tm.name?(0,t.jsx)(eT.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,t.jsx)(I.BotMark,{size:26,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"mt-1 shrink-0"})}function tf({dark:e=!1,children:n,className:a}){return(0,t.jsx)(y.Bubble,{align:"end",variant:e?"default":"secondary",className:"max-w-full",children:(0,t.jsx)(y.BubbleContent,{className:(0,Y.cn)("rounded-tr-md px-3.5",a),children:(0,t.jsx)("div",{className:(0,Y.cn)("min-w-0",e&&"inverse"),children:n})})})}function tb({side:e,mark:n,name:a,children:s}){return(0,t.jsxs)("div",{className:(0,Y.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,Y.cn)("flex min-w-0 flex-1 flex-col gap-1.5 [&>*+*]:max-w-[80%]","end"===e&&"items-end"),children:[(0,t.jsx)("p",{className:"max-w-[80%] truncate px-1 font-mono text-[10px] text-muted-foreground",children:a}),s]})]})}function tg({line:e,surface:n,mention:a}){let s=!!e.question,o="result"===e.kind,r="none"!==n,i=(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(ty,{}),a?(0,t.jsx)(tw,{bot:a,bubble:r,children:e.text}):(0,t.jsx)(tk,{bubble:r,className:(0,Y.cn)(!o&&"leading-snug"),children:e.text})]});return(0,t.jsxs)(t.Fragment,{children:[r?(0,t.jsx)(tf,{dark:"dark"===n,children:i}):(0,t.jsx)("div",{className:"min-w-0 max-w-full px-1",children:i}),o&&(0,t.jsxs)("div",{className:"flex items-center gap-2 px-1",children:[(0,t.jsx)(q.PathChips,{text:e.text,className:"min-w-0"}),(0,t.jsx)(tN,{text:e.text})]})]})}function tk({children:e,bubble:n=!1,className:a}){return(0,t.jsx)(T.Markdown,{className:(0,Y.cn)("min-w-0 max-w-full text-[13px] leading-relaxed wrap-anywhere break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&_table]:wrap-normal [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",n&&"[&_[data-streamdown=inline-code]]:text-[12px] [&_[data-streamdown=code-block]]:my-2 [&_[data-streamdown=code-block]]:gap-0 [&_[data-streamdown=code-block]]:rounded-[10px] [&_[data-streamdown=code-block]]:border-0 [&_[data-streamdown=code-block]]:bg-background [&_[data-streamdown=code-block]]:p-0 [&_[data-streamdown=code-block-header]]:h-7 [&_[data-streamdown=code-block-header]]:px-2.5 [&_[data-streamdown=code-block-header]]:text-[11px] [&_[data-streamdown=code-block-body]]:border-0 [&_[data-streamdown=code-block-body]]:bg-transparent! [&_[data-streamdown=code-block-body]]:px-2.5 [&_[data-streamdown=code-block-body]]:pt-0 [&_[data-streamdown=code-block-body]]:pb-2.5 [&_[data-streamdown=code-block-body]]:text-[12.5px] [&_[data-streamdown=code-block]_div:has(>[data-streamdown=code-block-actions])]:-mt-7 [&_[data-streamdown=code-block-actions]]:mr-1 [&_[data-streamdown=code-block-actions]]:border-0 [&_[data-streamdown=code-block-actions]]:bg-transparent!",a),children:e})}function tj({bot:e,bubble:n}){return(0,t.jsxs)("span",{className:(0,Y.cn)("mr-1.5 inline-flex h-5 max-w-full items-center gap-1 rounded-full pr-2 pl-[3px] align-[-4px] text-[12px] leading-none font-medium whitespace-nowrap text-foreground",n?"bg-background":"bg-muted"),children:[(0,t.jsx)(I.BotMark,{size:14,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function tw({bot:e,bubble:n,children:a}){return(0,t.jsxs)("div",{className:"min-w-0 max-w-full text-[13px] leading-snug",children:[(0,t.jsx)(tj,{bot:e,bubble:n}),(0,t.jsx)(tk,{bubble:n,className:"contents leading-snug [&>p:first-child]:inline",children:a})]})}function ty(){return(0,t.jsxs)("p",{className:"mb-1 flex items-center gap-1.5 text-[12px] leading-4 font-medium text-muted-foreground",children:[(0,t.jsx)(x.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function tv({line:e,inset:n=!1}){return"note"===e.kind?(0,t.jsxs)("details",{className:"w-full px-2 py-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-2.5 outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)("span",{className:"h-px flex-1 bg-border"}),(0,t.jsx)("span",{className:"min-w-0 text-center font-mono text-[10px]",children:"Compacted — it goes on from its summary"}),(0,t.jsx)("span",{className:"h-px flex-1 bg-border"})]}),(0,t.jsx)(tk,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:e.text})]}):(0,t.jsx)(tk,{className:(0,Y.cn)("text-[12.5px] text-muted-foreground",n?"px-2.5 py-1":"px-1"),children:e.text})}function tN({text:e}){let[n,a]=(0,k.useState)(!1),s=(0,k.useRef)(null);return(0,k.useEffect)(()=>()=>{s.current&&clearTimeout(s.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),a(!0),s.current&&clearTimeout(s.current),s.current=setTimeout(()=>a(!1),1400)}catch(e){_.toast.add({type:"error",title:"Could not copy the answer",description:(0,Y.errorToString)(e)})}},className:"grid size-5 shrink-0 place-items-center rounded-md text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:n?(0,t.jsx)(i.Check,{className:"size-3"}):(0,t.jsx)(p.Copy,{className:"size-3"})})}function tT({lines:e}){return(0,t.jsxs)("details",{className:"group min-w-0 px-1 text-muted-foreground",children:[(0,t.jsxs)("summary",{className:"flex cursor-pointer list-none items-center gap-1.5 text-[12.5px] leading-relaxed outline-none [&::-webkit-details-marker]:hidden",children:[(0,t.jsx)(b.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:tM(e[0].text)}),e.length>1&&(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",e.length]}),(0,t.jsx)(l.ChevronDown,{className:"size-2.5 shrink-0 text-muted-foreground/70 transition-transform group-open:rotate-180"})]}),(0,t.jsx)("div",{className:"mt-1 space-y-1 pl-4.5 text-[11px] leading-relaxed",children:e.map(e=>(0,t.jsxs)("p",{className:"flex gap-2 break-keep",children:[e.at&&(0,t.jsx)("span",{className:"shrink-0 font-mono text-muted-foreground/70 tabular-nums",children:(0,n.format)((0,H.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let tM=e=>e.split(" (")[0].replace(/\.$/,"");function tS(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"stop"===n.kind?"stops":"said",a=t.at(-1),s=a?.kind===e&&("stops"!==e||tM(a.lines[0].text)===tM(n.text));a&&s?a.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t}e.s(["BotRoom",0,e_,"Conversation",0,tn,"ThreadFacts",0,e0],279265)},673544,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f4df059775807466d6f59f19acbde15dbef4cbdd9",t.callServer,void 0,t.findSourceMapURL,"answerThreadAction");e.s(["answerThreadAction",0,n])},707467,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f9a5f6dfac94ea98a45074e6bdc01793589f97196",t.callServer,void 0,t.findSourceMapURL,"cancelThreadAction");e.s(["cancelThreadAction",0,n])},108957,931619,119002,51481,508734,825398,815731,496336,201082,835878,764224,919191,e=>{"use strict";var t=e.i(677241),n=e.i(24708),a=e.i(845110);e.s(["isThisYear",0,function(e,s){return function(e,t){let[n,s]=(0,a.normalizeDates)(void 0,e,t);return n.getFullYear()===s.getFullYear()}((0,t.constructFrom)(s?.in||e,e),(0,n.constructNow)(s?.in||e))}],108957);var s=e.i(456420);let o={name:"chevrons-right",size:24,node:[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]};o.node;let r=(0,s.default)(o);e.s(["ChevronsRight",0,r],931619);let i={name:"circle-pause",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],aliases:["pause-circle"]};i.node;let l=(0,s.default)(i);e.s(["CirclePause",0,l],119002);let d={name:"circle-question-mark",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],aliases:["help-circle","circle-help"]};d.node;let c=(0,s.default)(d);e.s(["CircleQuestionMark",0,c],51481);let u={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};u.node;let m=(0,s.default)(u);e.s(["Copy",0,m],508734);let x={name:"rotate-cw",size:24,node:[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]};x.node;let p=(0,s.default)(x);e.s(["RotateCw",0,p],825398);var h=e.i(843476),f=e.i(176782),b=e.i(552245),g=e.i(225913),k=e.i(647163);let j=(0,g.cva)("group/bubble relative flex w-fit max-w-[80%] min-w-0 flex-col gap-1 group-data-[align=end]/message:self-end data-[align=end]:self-end data-[variant=ghost]:max-w-full",{variants:{variant:{default:"*:data-[slot=bubble-content]:bg-primary *:data-[slot=bubble-content]:text-primary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-primary/80",secondary:"*:data-[slot=bubble-content]:bg-secondary *:data-[slot=bubble-content]:text-secondary-foreground [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)]",muted:"*:data-[slot=bubble-content]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[color-mix(in_oklch,var(--muted),var(--foreground)_5%)]",tinted:"*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.93_calc(c*0.4)_h)] *:data-[slot=bubble-content]:text-foreground dark:*:data-[slot=bubble-content]:bg-[oklch(from_var(--primary)_0.3_calc(c*0.4)_h)] [&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.88_calc(c*0.5)_h)] dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-[oklch(from_var(--primary)_0.35_calc(c*0.5)_h)]",outline:"*:data-[slot=bubble-content]:border-border *:data-[slot=bubble-content]:bg-background [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-input/30",ghost:"border-none *:data-[slot=bubble-content]:rounded-none *:data-[slot=bubble-content]:bg-transparent *:data-[slot=bubble-content]:p-0 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted [&>[data-slot=bubble-content]:is(button,a):hover]:text-foreground dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-muted/50",destructive:"*:data-[slot=bubble-content]:bg-destructive/10 *:data-[slot=bubble-content]:text-destructive dark:*:data-[slot=bubble-content]:bg-destructive/20 [&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/20 dark:[&>[data-slot=bubble-content]:is(button,a):hover]:bg-destructive/30"}},defaultVariants:{variant:"default"}});(0,g.cva)("absolute z-10 flex w-fit shrink-0 items-center justify-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-sm ring-3 ring-card has-[button]:p-0",{variants:{side:{top:"top-0 -translate-y-3/4",bottom:"bottom-0 translate-y-3/4"},align:{start:"left-3",end:"right-3"}},defaultVariants:{side:"bottom",align:"end"}}),e.s(["Bubble",0,function({variant:e="default",align:t="start",className:n,...a}){return(0,h.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,k.cn)(j({variant:e}),n),...a})},"BubbleContent",0,function({className:e,render:t,...n}){var a;return a={defaultTagName:"div",props:(0,f.mergeProps)({className:(0,k.cn)("w-fit max-w-full min-w-0 overflow-hidden rounded-xl border border-transparent px-3 py-2 text-sm leading-relaxed wrap-break-word group-data-[align=end]/bubble:self-end [button]:text-left [button,a]:transition-colors [button,a]:outline-none [button,a]:focus-visible:border-ring [button,a]:focus-visible:ring-3 [button,a]:focus-visible:ring-ring/50",e)},n),render:t,state:{slot:"bubble-content"}},(0,b.useRenderElement)(a.defaultTagName??"div",a,a)}],815731);var w=e.i(716327),y=e.i(271645);e.s(["FoldedText",0,function({text:e,subject:t,clamp:n="line-clamp-3",tall:a="max-h-40",className:s}){let[o,r]=(0,y.useState)(!1),[i,l]=(0,y.useState)(!1),d=(0,y.useRef)(null);return(0,y.useEffect)(()=>r(!1),[e]),(0,y.useEffect)(()=>{let e=d.current;e&&!o&&l(e.scrollHeight>e.clientHeight+1)},[o,e]),(0,h.jsxs)("div",{className:(0,k.cn)("flex items-start gap-1",s),children:[(0,h.jsx)("p",{ref:d,className:(0,k.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",o?(0,k.cn)(a,"overflow-y-auto scrollbar-none"):n),children:e}),(i||o)&&(0,h.jsx)("button",{type:"button",onClick:()=>r(e=>!e),"aria-label":o?`Fold the ${t}`:`Read the whole ${t}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,h.jsx)(w.ChevronDown,{className:(0,k.cn)("size-3.5",o&&"rotate-180")})})]})}],496336);var v=e.i(95187);let N=(0,v.createServerReference)("7ff917f5236e9de4a7137d6d5003d5dafeb295990e",v.callServer,void 0,v.findSourceMapURL,"startThreadAction");e.s(["startThreadAction",0,N],201082);var T=e.i(635963);e.s(["BotRoster",0,function({bots:e}){return e.length<2?null:(0,h.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,h.jsx)("span",{className:"flex items-center gap-0.5",children:e.slice(0,3).map(e=>(0,h.jsx)(T.BotMark,{size:18,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,paint:e.icon?.paint,notify:!1,className:"shrink-0"},e.name))}),(0,h.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}],835878);var M=e.i(829600);let S={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};S.node;let z=(0,s.default)(S),C={name:"file-image",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]};C.node;let _=(0,s.default)(C);var A=e.i(905015);let R={name:"file-spreadsheet",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]};R.node;let $=(0,s.default)(R);var I=e.i(226091);let B={name:"file-type",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]]};B.node;let q=(0,s.default)(B),D={name:"file-x",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]};D.node;let E=(0,s.default)(D);var F=e.i(798120),O=e.i(621285),L=e.i(616172),P=e.i(283653);let K={markdown:I.FileText,csv:$,json:A.FileJson,text:q,image:_};e.s(["PathChips",0,function({text:e,className:t}){let n=(0,y.useMemo)(()=>(0,L.pathsIn)(e),[e]),{data:a}=(0,P.useServerRoute)(n.length?F.queryKey.workspaceMissing(n):null),s=(0,y.useMemo)(()=>new Set(a),[a]);if(!n.length)return null;let o="flex max-w-full items-center gap-1.5 rounded-full bg-muted/70 py-1 pr-2.5 pl-2 font-mono text-[11px]";return(0,h.jsx)("div",{className:(0,k.cn)("flex flex-wrap gap-1.5",t),children:n.map(e=>{let t,n=e.split("/").pop()??e;if(s.has(e))return(0,h.jsxs)("span",{title:`${e} — not on disk`,className:(0,k.cn)(o,"text-muted-foreground"),children:[(0,h.jsx)(E,{className:"size-3 shrink-0"}),(0,h.jsx)("span",{className:"truncate line-through",children:n})]},e);let a="frame"===(t=(0,L.viewKindOf)(e))?e.toLowerCase().endsWith(".pdf")?I.FileText:z:K[t]??M.File;return(0,h.jsxs)(O.FileLink,{path:e,className:(0,k.cn)(o,"text-foreground/80 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50"),children:[(0,h.jsx)(a,{className:"size-3 shrink-0 text-muted-foreground"}),(0,h.jsx)("span",{className:"truncate",children:n})]},e)})})}],764224);let H={name:"corner-down-left",size:24,node:[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]]};H.node;let U=(0,s.default)(H);e.s(["CornerDownLeft",0,U],919191)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let a=(0,t.default)(n);e.s(["Square",0,a],929272)}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,805995,e=>{"use strict";var t=e.i(843476),n=e.i(493801),i=e.i(456420);let s={name:"audio-lines",size:24,node:[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]};s.node;let r=(0,i.default)(s),o={name:"captions",size:24,node:[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],aliases:["subtitles"]};o.node;let a=(0,i.default)(o);var l=e.i(689664),d=e.i(867927);let c={name:"clapperboard",size:24,node:[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]]};c.node;let u=(0,i.default)(c);var m=e.i(815170),g=e.i(758925),f=e.i(566595),h=e.i(466787),x=e.i(271645),y=e.i(798120),k=e.i(167881),p=e.i(23750),v=e.i(917162),j=e.i(671428),S=e.i(412294),b=e.i(146538),N=e.i(968978),w=e.i(265402),C=e.i(635963),I=e.i(95187);let M=(0,I.createServerReference)("7f008a27595d5d6e96e1685cb7afd843882426f54b",I.callServer,void 0,I.findSourceMapURL,"removeConfigAction");var A=e.i(349196),D=e.i(992112),K=e.i(895836),T=e.i(609856),z=e.i(283653),R=e.i(647163);let $={[D.EXA_API_KEY]:f.Search},q={image:m.Image,video:u,speech:r,transcription:a};function O({section:e}){let{data:n,isLoading:i,error:s}=(0,z.useServerRoute)(y.queryKey.config);if(i)return(0,t.jsx)(K.SettingSkeleton,{rows:4});if(s)return(0,t.jsx)(K.SettingError,{message:s.message});let r=e=>(0,D.isConfigSet)(n,e),o=e=>n?.find(t=>t.key===e)?.value,a=D.CONFIG_GROUPS.filter(t=>t.section===e),l=a.flatMap(e=>e.entries);return(0,t.jsx)(K.SettingScreen,{footer:(0,t.jsx)(K.SettingRailNote,{children:"keys"===e?(0,t.jsxs)(t.Fragment,{children:[l.filter(e=>r(e.key)).length," of"," ",l.length," set",a.some(e=>!(0,D.groupSatisfied)(e,r))?" · a call needs one voice key":" · your keys stay on this machine"]}):(0,t.jsxs)(t.Fragment,{children:[l.length," of ",l.length," resolved ·"," ",l.filter(e=>o(e.key)).length," pinned"]})}),children:a.map(e=>(0,t.jsx)(K.SettingGroup,{label:e.title,hint:e.hint,right:(0,t.jsx)(F,{group:e,isSet:r}),children:(0,t.jsx)(K.SettingItems,{children:e.entries.map(n=>n.choices?(0,t.jsx)(H,{entry:n,choices:n.choices,value:o(n.key),isSet:r},n.key):(0,t.jsx)(B,{entry:n,set:r(n.key),needed:!(0,D.groupSatisfied)(e,r)},n.key))})},e.id))})}function F({group:e,isSet:n}){return"none"===e.require?null:(0,D.groupSatisfied)(e,n)?(0,t.jsxs)("span",{className:"flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)(l.Check,{className:"size-3"}),"ready"]}):(0,t.jsxs)("span",{className:(0,R.cn)("flex items-center gap-1 font-mono text-[11px]",R.WAITING_INK),children:[(0,t.jsx)(h.TriangleAlert,{className:"size-3"}),e.note??"Required"]})}function B({entry:e,set:n,needed:i}){let s=_(e,n),r=L(e,n),o=U(e,n),a=r.data?W(r.data):P(n,i,s.data,e.signIn);return(0,t.jsxs)("button",{type:"button",onClick:()=>{var i,s,r;return e.signIn?(i=e,v.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,t.jsx)(Q,{entry:i,onDone:e})})):(s=e,r=n,v.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,t.jsx)(V,{entry:s,set:r,onDone:e})}))},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,t.jsx)(Y,{entry:e})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.label}),(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:e.signIn?n?E(r.data,o):"sign in with your account":e.key})]}),s.isLoading||r.isLoading?(0,t.jsx)(j.Skeleton,{className:"h-3 w-20 shrink-0"}):(0,t.jsxs)("span",{className:(0,R.cn)("flex shrink-0 items-center gap-1.5 font-mono text-xs",a.ink),children:[a.warn?(0,t.jsx)(h.TriangleAlert,{className:"size-3"}):n&&(0,t.jsx)(l.Check,{className:"size-3"}),a.text]}),(0,t.jsx)(d.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}let G=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function P(e,t,n,i){return e?n?"refused"in n?{text:"Key refused",ink:"text-destructive",warn:!0}:{text:`${G.format(n.balance)} left`,ink:n.low?R.WAITING_INK:"text-muted-foreground",warn:n.low}:{text:i?"Signed in":"Set",ink:"text-muted-foreground",warn:!1}:t?{text:"Needed",ink:R.WAITING_INK,warn:!0}:{text:i?"Signed out":"Not set",ink:"text-muted-foreground/60",warn:!1}}function _(e,t){return(0,z.useServerRoute)(t&&"vercel-ai-gateway"===e.provider?y.queryKey.gatewayCredits:null)}function U(e,t){let{data:n}=(0,z.useServerRoute)(t&&e.signIn?y.queryKey.llmModel:null);return n?.find(t=>t.id===e.provider)?.plan??null}function L(e,t){return(0,z.useServerRoute)(t&&e.signIn?y.queryKey.subscriptionUsage:null)}function W(e){return"refused"in e?{text:"Sign-in refused",ink:"text-destructive",warn:!0}:{text:e.spent?"Limit reached":`${e.usedPercent}% used`,ink:e.high?R.WAITING_INK:"text-muted-foreground",warn:e.high}}function E(e,t){let i=!e||"refused"in e?null:e,s=`${i?.plan??t??"unknown"} plan`;return i?.resetsAt?`${s} \xb7 resets in ${(0,n.formatDistanceToNowStrict)(new Date(i.resetsAt))}`:s}function Y({entry:e}){if(e.provider)return(0,t.jsx)(N.ProviderIcon,{provider:e.provider,className:"size-4"});let n=$[e.key]??g.KeyRound;return(0,t.jsx)(n,{className:"size-4 text-muted-foreground"})}function H({entry:e,choices:n,value:i,isSet:s}){let r=n.find(e=>e.value===i),o=n.filter(e=>s(e.needs)),a=i&&!r?i:null,l=e.kind?q[e.kind]:C.BotsMark;return(0,t.jsxs)("button",{type:"button",onClick:()=>{var i,s,r;return e.kind||e.text?(i=e,v.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(X,{entry:i,onDone:e})})):(s=e,r=n,v.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,t.jsx)(J,{entry:s,choices:r,onDone:e})}))},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,t.jsx)(l,{className:"size-4 text-muted-foreground"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.label}),(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[!r&&!a&&(0,t.jsx)("span",{className:(0,R.cn)("shrink-0 rounded-[5px] border border-border/60 px-1 font-mono text-[10px]",e.kind?R.WAITING_INK:"text-muted-foreground"),children:e.kind?"off":"auto"}),(0,t.jsx)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:r?.label??a??(e.kind?"Not offered to bots until you pick one":o[0]?.label??"No key for any of these yet")})]})]}),(0,t.jsx)(d.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function X({entry:e,onDone:n}){let{data:i}=(0,z.useServerRoute)(y.queryKey.config),s=i?.find(t=>t.key===e.key)?.value,[r,o]=(0,x.useState)(()=>{let t=e.text?(0,w.parseTextModel)(s):(0,w.parseMediaModel)(s);return{provider:t?.provider??null,model:t?.model??""}}),a=()=>{(0,z.revalidate)(y.queryKey.config),n()},[l]=(0,T.useServerAction)(A.setConfigAction,{okMessage:`${e.label} saved`,onOk:a}),[d,c]=(0,T.useServerAction)(M,{okMessage:e.kind?`${e.label} switched off`:`${e.label} back to automatic`,onOk:a});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:e.hint,footer:(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(k.Button,{variant:"ghost",loading:c,onClick:()=>d(e.key),children:e.kind?"Turn off":"Automatic"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:n,children:"Close"})]}),children:(0,t.jsx)(b.ModelPicker,{kind:e.kind,provider:r.provider,model:r.model,onChange:t=>{o(t),t.model.trim()&&l(e.key,`${t.provider}/${t.model.trim()}`)}})})}function J({entry:e,choices:n,onDone:i}){let{data:s}=(0,z.useServerRoute)(y.queryKey.config),r=s?.find(t=>t.key===e.key)?.value,o=()=>{(0,z.revalidate)(y.queryKey.config),i()},[a,l]=(0,T.useServerAction)(A.setConfigAction,{okMessage:`${e.label} saved`,onOk:o}),[d,c]=(0,T.useServerAction)(M,{okMessage:e.kind?`${e.label} switched off`:`${e.label} back to automatic`,onOk:o});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:e.hint,footer:(0,t.jsxs)(t.Fragment,{children:[r&&(0,t.jsx)(k.Button,{variant:"ghost",loading:c,onClick:()=>d(e.key),children:e.kind?"Turn off":"Automatic"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:i,children:"Close"})]}),children:(0,t.jsx)(K.SettingChoiceRows,{options:n.map(e=>({value:e.value,label:e.label,disabled:!(0,D.isConfigSet)(s,e.needs)&&`needs ${e.needs}`})),value:r,onChange:t=>a(e.key,t),disabled:l})})}function Q({entry:e,onDone:n}){let{data:i}=(0,z.useServerRoute)(y.queryKey.config),s=(0,D.isConfigSet)(i,e.key),r=U(e,s),o=L(e,s),a=o.data?W(o.data):null,[l,d]=(0,T.useServerAction)(M,{okMessage:`Signed out of ${e.label}`,onOk:()=>{(0,z.revalidate)(y.queryKey.config),(0,z.revalidate)(y.queryKey.llmModel),n()}});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:s?(0,t.jsxs)(t.Fragment,{children:["Signed in ·"," ",(0,t.jsx)("span",{className:"font-mono",children:E(o.data,r)}),a&&(0,t.jsxs)(t.Fragment,{children:[" · ",(0,t.jsx)("span",{className:(0,R.cn)("font-mono",a.ink),children:a.text})]})]}):"Sign in with your ChatGPT account instead of a key",footer:(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(k.Button,{variant:"ghost",loading:d,onClick:()=>l(e.key),children:"Sign out"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:n,children:s?"Close":"Cancel"}),!s&&(0,t.jsx)(S.ChatGptSignIn,{})]}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(K.SettingNote,{children:s?"Bots on this subscription spend your plan's usage, not a key. When it runs out, the job stops and says when it resets.":"The sign-in opens in its own window. Approve it there, and this turns to signed in by itself."}),o.data&&"refused"in o.data&&(0,t.jsx)(K.SettingNote,{className:"wrap-break-word text-destructive",children:o.data.refused})]})})}function V({entry:e,set:n,onDone:i}){let[s,r]=(0,x.useState)(""),{data:o}=_(e,n),a=o?P(n,!1,o):null,l=()=>{(0,z.revalidate)(y.queryKey.config),(0,z.revalidate)(y.queryKey.llmModel)},[d,c]=(0,T.useServerAction)(A.setConfigAction,{okMessage:`${e.label} key saved`,onOk:()=>{l(),i()}}),[u,m]=(0,T.useServerAction)(M,{okMessage:`${e.label} key removed`,onOk:()=>{l(),i()}});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-mono",children:e.key}),e.hint&&(0,t.jsxs)(t.Fragment,{children:[" · ",e.hint]}),a&&(0,t.jsxs)(t.Fragment,{children:[" · ",(0,t.jsx)("span",{className:(0,R.cn)("font-mono",a.ink),children:a.text})]})]}),footer:(0,t.jsxs)(t.Fragment,{children:[n&&(0,t.jsx)(k.Button,{variant:"ghost",loading:m,onClick:()=>u(e.key),children:"Remove"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:i,children:"Cancel"}),(0,t.jsx)(k.Button,{loading:c,disabled:s.trim().length<8,onClick:()=>d(e.key,s),children:n?"Replace":"Save"})]}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(p.Input,{value:s,onChange:e=>r(e.target.value),onKeyDown:t=>{"Enter"===t.key&&s.trim().length>=8&&d(e.key,s)},placeholder:n?"New value — replaces the current key":e.key,spellCheck:!1,type:"password",autoFocus:!0}),o&&"refused"in o&&(0,t.jsx)(K.SettingNote,{className:"wrap-break-word text-destructive",children:o.refused})]})})}e.s(["ConfigGroups",0,O,"ConfigSetting",0,function(){return(0,t.jsx)(O,{section:"keys"})}],805995)},493801,e=>{"use strict";var t=e.i(24708),n=e.i(55545),i=e.i(455024),s=e.i(99151),r=e.i(845110),o=e.i(281092),a=e.i(234662);e.s(["formatDistanceToNowStrict",0,function(e,l){return function(e,t,l){var d;let c,u,m=(0,i.getDefaultOptions)(),g=l?.locale??m.locale??n.defaultLocale,f=(u=(0,o.toDate)(e)-(0,o.toDate)(t))<0?-1:u>0?1:u;if(isNaN(f))throw RangeError("Invalid time value");let h=Object.assign({},l,{addSuffix:l?.addSuffix,comparison:f}),[x,y]=(0,r.normalizeDates)(l?.in,...f>0?[t,e]:[e,t]),k=(d=l?.roundingMethod??"round",e=>{let t=(d?Math[d]:Math.trunc)(e);return 0===t?0:t}),p=y.getTime()-x.getTime(),v=p/a.millisecondsInMinute,j=(p-((0,s.getTimezoneOffsetInMilliseconds)(y)-(0,s.getTimezoneOffsetInMilliseconds)(x)))/a.millisecondsInMinute,S=l?.unit;if("second"===(c=S||(v<1?"second":v<60?"minute":v<a.minutesInDay?"hour":j<a.minutesInMonth?"day":j<a.minutesInYear?"month":"year"))){let e=k(p/1e3);return g.formatDistance("xSeconds",e,h)}if("minute"===c){let e=k(v);return g.formatDistance("xMinutes",e,h)}if("hour"===c){let e=k(v/60);return g.formatDistance("xHours",e,h)}if("day"===c){let e=k(j/a.minutesInDay);return g.formatDistance("xDays",e,h)}if("month"===c){let e=k(j/a.minutesInMonth);return 12===e&&"month"!==S?g.formatDistance("xYears",1,h):g.formatDistance("xMonths",e,h)}else{let e=k(j/a.minutesInYear);return g.formatDistance("xYears",e,h)}}(e,(0,t.constructNow)(e),l)}],493801)},815170,e=>{"use strict";var t=e.i(456420);let n={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};n.node;let i=(0,t.default)(n);e.s(["Image",0,i],815170)},466787,e=>{"use strict";var t=e.i(755566);e.s(["TriangleAlert",()=>t.default])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,805995,e=>{"use strict";var t=e.i(843476),n=e.i(493801),i=e.i(456420);let s={name:"audio-lines",size:24,node:[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]};s.node;let r=(0,i.default)(s),o={name:"captions",size:24,node:[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]],aliases:["subtitles"]};o.node;let a=(0,i.default)(o);var l=e.i(689664),d=e.i(867927);let c={name:"clapperboard",size:24,node:[["path",{d:"m12.296 3.464 3.02 3.956",key:"qash78"}],["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3z",key:"1h7j8b"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"4lm6w1"}],["path",{d:"m6.18 5.276 3.1 3.899",key:"zjj9t3"}]]};c.node;let u=(0,i.default)(c);var m=e.i(815170),f=e.i(758925),g=e.i(566595),h=e.i(466787),x=e.i(271645),y=e.i(798120),k=e.i(167881),p=e.i(23750),v=e.i(917162),j=e.i(671428),S=e.i(412294),N=e.i(146538),b=e.i(968978),w=e.i(265402),C=e.i(635963),I=e.i(95187);let M=(0,I.createServerReference)("7ff28dc5f254ed7fecc4fc2197f95a4732ea0d8ad1",I.callServer,void 0,I.findSourceMapURL,"removeConfigAction");var A=e.i(981577),D=e.i(992112),K=e.i(895836),T=e.i(609856),z=e.i(283653),R=e.i(647163);let $={[D.EXA_API_KEY]:g.Search},q={image:m.Image,video:u,speech:r,transcription:a};function O({section:e}){let{data:n,isLoading:i,error:s}=(0,z.useServerRoute)(y.queryKey.config);if(i)return(0,t.jsx)(K.SettingSkeleton,{rows:4});if(s)return(0,t.jsx)(K.SettingError,{message:s.message});let r=e=>(0,D.isConfigSet)(n,e),o=e=>n?.find(t=>t.key===e)?.value,a=D.CONFIG_GROUPS.filter(t=>t.section===e),l=a.flatMap(e=>e.entries);return(0,t.jsx)(K.SettingScreen,{footer:(0,t.jsx)(K.SettingRailNote,{children:"keys"===e?(0,t.jsxs)(t.Fragment,{children:[l.filter(e=>r(e.key)).length," of"," ",l.length," set",a.some(e=>!(0,D.groupSatisfied)(e,r))?" · a call needs one voice key":" · your keys stay on this machine"]}):(0,t.jsxs)(t.Fragment,{children:[l.length," of ",l.length," resolved ·"," ",l.filter(e=>o(e.key)).length," pinned"]})}),children:a.map(e=>(0,t.jsx)(K.SettingGroup,{label:e.title,hint:e.hint,right:(0,t.jsx)(F,{group:e,isSet:r}),children:(0,t.jsx)(K.SettingItems,{children:e.entries.map(n=>n.choices?(0,t.jsx)(H,{entry:n,choices:n.choices,value:o(n.key),isSet:r},n.key):(0,t.jsx)(B,{entry:n,set:r(n.key),needed:!(0,D.groupSatisfied)(e,r)},n.key))})},e.id))})}function F({group:e,isSet:n}){return"none"===e.require?null:(0,D.groupSatisfied)(e,n)?(0,t.jsxs)("span",{className:"flex items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)(l.Check,{className:"size-3"}),"ready"]}):(0,t.jsxs)("span",{className:(0,R.cn)("flex items-center gap-1 font-mono text-[11px]",R.WAITING_INK),children:[(0,t.jsx)(h.TriangleAlert,{className:"size-3"}),e.note??"Required"]})}function B({entry:e,set:n,needed:i}){let s=_(e,n),r=L(e,n),o=U(e,n),a=r.data?W(r.data):P(n,i,s.data,e.signIn);return(0,t.jsxs)("button",{type:"button",onClick:()=>{var i,s,r;return e.signIn?(i=e,v.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,t.jsx)(Q,{entry:i,onDone:e})})):(s=e,r=n,v.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,t.jsx)(V,{entry:s,set:r,onDone:e})}))},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,t.jsx)(Y,{entry:e})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.label}),(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:e.signIn?n?E(r.data,o):"sign in with your account":e.key})]}),s.isLoading||r.isLoading?(0,t.jsx)(j.Skeleton,{className:"h-3 w-20 shrink-0"}):(0,t.jsxs)("span",{className:(0,R.cn)("flex shrink-0 items-center gap-1.5 font-mono text-xs",a.ink),children:[a.warn?(0,t.jsx)(h.TriangleAlert,{className:"size-3"}):n&&(0,t.jsx)(l.Check,{className:"size-3"}),a.text]}),(0,t.jsx)(d.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}let G=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD"});function P(e,t,n,i){return e?n?"refused"in n?{text:"Key refused",ink:"text-destructive",warn:!0}:{text:`${G.format(n.balance)} left`,ink:n.low?R.WAITING_INK:"text-muted-foreground",warn:n.low}:{text:i?"Signed in":"Set",ink:"text-muted-foreground",warn:!1}:t?{text:"Needed",ink:R.WAITING_INK,warn:!0}:{text:i?"Signed out":"Not set",ink:"text-muted-foreground/60",warn:!1}}function _(e,t){return(0,z.useServerRoute)(t&&"vercel-ai-gateway"===e.provider?y.queryKey.gatewayCredits:null)}function U(e,t){let{data:n}=(0,z.useServerRoute)(t&&e.signIn?y.queryKey.llmModel:null);return n?.find(t=>t.id===e.provider)?.plan??null}function L(e,t){return(0,z.useServerRoute)(t&&e.signIn?y.queryKey.subscriptionUsage:null)}function W(e){return"refused"in e?{text:"Sign-in refused",ink:"text-destructive",warn:!0}:{text:e.spent?"Limit reached":`${e.usedPercent}% used`,ink:e.high?R.WAITING_INK:"text-muted-foreground",warn:e.high}}function E(e,t){let i=!e||"refused"in e?null:e,s=`${i?.plan??t??"unknown"} plan`;return i?.resetsAt?`${s} \xb7 resets in ${(0,n.formatDistanceToNowStrict)(new Date(i.resetsAt))}`:s}function Y({entry:e}){if(e.provider)return(0,t.jsx)(b.ProviderIcon,{provider:e.provider,className:"size-4"});let n=$[e.key]??f.KeyRound;return(0,t.jsx)(n,{className:"size-4 text-muted-foreground"})}function H({entry:e,choices:n,value:i,isSet:s}){let r=n.find(e=>e.value===i),o=n.filter(e=>s(e.needs)),a=i&&!r?i:null,l=e.kind?q[e.kind]:C.BotsMark;return(0,t.jsxs)("button",{type:"button",onClick:()=>{var i,s,r;return e.kind||e.text?(i=e,v.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(X,{entry:i,onDone:e})})):(s=e,r=n,v.notify.component({className:"sm:max-w-md",renderer:({close:e})=>(0,t.jsx)(J,{entry:s,choices:r,onDone:e})}))},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-8 shrink-0 place-items-center rounded-lg bg-muted/60",children:(0,t.jsx)(l,{className:"size-4 text-muted-foreground"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.label}),(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[!r&&!a&&(0,t.jsx)("span",{className:(0,R.cn)("shrink-0 rounded-[5px] border border-border/60 px-1 font-mono text-[10px]",e.kind?R.WAITING_INK:"text-muted-foreground"),children:e.kind?"off":"auto"}),(0,t.jsx)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:r?.label??a??(e.kind?"Not offered to bots until you pick one":o[0]?.label??"No key for any of these yet")})]})]}),(0,t.jsx)(d.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function X({entry:e,onDone:n}){let{data:i}=(0,z.useServerRoute)(y.queryKey.config),s=i?.find(t=>t.key===e.key)?.value,[r,o]=(0,x.useState)(()=>{let t=e.text?(0,w.parseTextModel)(s):(0,w.parseMediaModel)(s);return{provider:t?.provider??null,model:t?.model??""}}),a=()=>{(0,z.revalidate)(y.queryKey.config),n()},[l]=(0,T.useServerAction)(A.setConfigAction,{okMessage:`${e.label} saved`,onOk:a}),[d,c]=(0,T.useServerAction)(M,{okMessage:e.kind?`${e.label} switched off`:`${e.label} back to automatic`,onOk:a});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:e.hint,footer:(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(k.Button,{variant:"ghost",loading:c,onClick:()=>d(e.key),children:e.kind?"Turn off":"Automatic"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:n,children:"Close"})]}),children:(0,t.jsx)(N.ModelPicker,{kind:e.kind,provider:r.provider,model:r.model,onChange:t=>{o(t),t.model.trim()&&l(e.key,`${t.provider}/${t.model.trim()}`)}})})}function J({entry:e,choices:n,onDone:i}){let{data:s}=(0,z.useServerRoute)(y.queryKey.config),r=s?.find(t=>t.key===e.key)?.value,o=()=>{(0,z.revalidate)(y.queryKey.config),i()},[a,l]=(0,T.useServerAction)(A.setConfigAction,{okMessage:`${e.label} saved`,onOk:o}),[d,c]=(0,T.useServerAction)(M,{okMessage:e.kind?`${e.label} switched off`:`${e.label} back to automatic`,onOk:o});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:e.hint,footer:(0,t.jsxs)(t.Fragment,{children:[r&&(0,t.jsx)(k.Button,{variant:"ghost",loading:c,onClick:()=>d(e.key),children:e.kind?"Turn off":"Automatic"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:i,children:"Close"})]}),children:(0,t.jsx)(K.SettingChoiceRows,{options:n.map(e=>({value:e.value,label:e.label,disabled:!(0,D.isConfigSet)(s,e.needs)&&`needs ${e.needs}`})),value:r,onChange:t=>a(e.key,t),disabled:l})})}function Q({entry:e,onDone:n}){let{data:i}=(0,z.useServerRoute)(y.queryKey.config),s=(0,D.isConfigSet)(i,e.key),r=U(e,s),o=L(e,s),a=o.data?W(o.data):null,[l,d]=(0,T.useServerAction)(M,{okMessage:`Signed out of ${e.label}`,onOk:()=>{(0,z.revalidate)(y.queryKey.config),(0,z.revalidate)(y.queryKey.llmModel),n()}});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:s?(0,t.jsxs)(t.Fragment,{children:["Signed in ·"," ",(0,t.jsx)("span",{className:"font-mono",children:E(o.data,r)}),a&&(0,t.jsxs)(t.Fragment,{children:[" · ",(0,t.jsx)("span",{className:(0,R.cn)("font-mono",a.ink),children:a.text})]})]}):"Sign in with your ChatGPT account instead of a key",footer:(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(k.Button,{variant:"ghost",loading:d,onClick:()=>l(e.key),children:"Sign out"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:n,children:s?"Close":"Cancel"}),!s&&(0,t.jsx)(S.ChatGptSignIn,{})]}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(K.SettingNote,{children:s?"Bots on this subscription spend your plan's usage, not a key. When it runs out, the job stops and says when it resets.":"The sign-in opens in its own window. Approve it there, and this turns to signed in by itself."}),o.data&&"refused"in o.data&&(0,t.jsx)(K.SettingNote,{className:"wrap-break-word text-destructive",children:o.data.refused})]})})}function V({entry:e,set:n,onDone:i}){let[s,r]=(0,x.useState)(""),{data:o}=_(e,n),a=o?P(n,!1,o):null,l=()=>{(0,z.revalidate)(y.queryKey.config),(0,z.revalidate)(y.queryKey.llmModel)},[d,c]=(0,T.useServerAction)(A.setConfigAction,{okMessage:`${e.label} key saved`,onOk:()=>{l(),i()}}),[u,m]=(0,T.useServerAction)(M,{okMessage:`${e.label} key removed`,onOk:()=>{l(),i()}});return(0,t.jsx)(K.SettingDialogContent,{title:e.label,description:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"font-mono",children:e.key}),e.hint&&(0,t.jsxs)(t.Fragment,{children:[" · ",e.hint]}),a&&(0,t.jsxs)(t.Fragment,{children:[" · ",(0,t.jsx)("span",{className:(0,R.cn)("font-mono",a.ink),children:a.text})]})]}),footer:(0,t.jsxs)(t.Fragment,{children:[n&&(0,t.jsx)(k.Button,{variant:"ghost",loading:m,onClick:()=>u(e.key),children:"Remove"}),(0,t.jsx)(k.Button,{variant:"ghost",onClick:i,children:"Cancel"}),(0,t.jsx)(k.Button,{loading:c,disabled:s.trim().length<8,onClick:()=>d(e.key,s),children:n?"Replace":"Save"})]}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(p.Input,{value:s,onChange:e=>r(e.target.value),onKeyDown:t=>{"Enter"===t.key&&s.trim().length>=8&&d(e.key,s)},placeholder:n?"New value — replaces the current key":e.key,spellCheck:!1,type:"password",autoFocus:!0}),o&&"refused"in o&&(0,t.jsx)(K.SettingNote,{className:"wrap-break-word text-destructive",children:o.refused})]})})}e.s(["ConfigGroups",0,O,"ConfigSetting",0,function(){return(0,t.jsx)(O,{section:"keys"})}],805995)},493801,e=>{"use strict";var t=e.i(24708),n=e.i(55545),i=e.i(455024),s=e.i(99151),r=e.i(845110),o=e.i(281092),a=e.i(234662);e.s(["formatDistanceToNowStrict",0,function(e,l){return function(e,t,l){var d;let c,u,m=(0,i.getDefaultOptions)(),f=l?.locale??m.locale??n.defaultLocale,g=(u=(0,o.toDate)(e)-(0,o.toDate)(t))<0?-1:u>0?1:u;if(isNaN(g))throw RangeError("Invalid time value");let h=Object.assign({},l,{addSuffix:l?.addSuffix,comparison:g}),[x,y]=(0,r.normalizeDates)(l?.in,...g>0?[t,e]:[e,t]),k=(d=l?.roundingMethod??"round",e=>{let t=(d?Math[d]:Math.trunc)(e);return 0===t?0:t}),p=y.getTime()-x.getTime(),v=p/a.millisecondsInMinute,j=(p-((0,s.getTimezoneOffsetInMilliseconds)(y)-(0,s.getTimezoneOffsetInMilliseconds)(x)))/a.millisecondsInMinute,S=l?.unit;if("second"===(c=S||(v<1?"second":v<60?"minute":v<a.minutesInDay?"hour":j<a.minutesInMonth?"day":j<a.minutesInYear?"month":"year"))){let e=k(p/1e3);return f.formatDistance("xSeconds",e,h)}if("minute"===c){let e=k(v);return f.formatDistance("xMinutes",e,h)}if("hour"===c){let e=k(v/60);return f.formatDistance("xHours",e,h)}if("day"===c){let e=k(j/a.minutesInDay);return f.formatDistance("xDays",e,h)}if("month"===c){let e=k(j/a.minutesInMonth);return 12===e&&"month"!==S?f.formatDistance("xYears",1,h):f.formatDistance("xMonths",e,h)}else{let e=k(j/a.minutesInYear);return f.formatDistance("xYears",e,h)}}(e,(0,t.constructNow)(e),l)}],493801)},815170,e=>{"use strict";var t=e.i(456420);let n={name:"image",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]};n.node;let i=(0,t.default)(n);e.s(["Image",0,i],815170)},466787,e=>{"use strict";var t=e.i(755566);e.s(["TriangleAlert",()=>t.default])}]);
package/README.md CHANGED
@@ -1,11 +1,11 @@
1
1
  <div align="center">
2
2
 
3
- <img src="docs/images/hero.png" alt="Thursday — an open-source voice agent with a face made of emoji" width="760">
3
+ <img src="docs/images/hero.png" alt="Thursday — an open-source voice assistant with a face made of emoji" width="760">
4
4
 
5
5
  ### Everyone wanted Friday. This is Thursday.
6
6
 
7
- Talk to your computer. Thursday talks back while bots do the work.<br>
8
- An open-source agent like [OpenClaw](https://github.com/openclaw/openclaw) and [Hermes](https://github.com/NousResearch/hermes-agent), built around your voice and running on your own machine.
7
+ **An open-source voice assistant that runs on your computer, with a team of AI bots behind it.**<br>
8
+ You talk. Bots take the slow work to a real browser, a shell and your files. The conversation never stops.
9
9
 
10
10
  [![npm](https://img.shields.io/npm/v/thursday-agent?style=flat-square&color=111&label=npm)](https://www.npmjs.com/package/thursday-agent)
11
11
  [![CI](https://img.shields.io/github/actions/workflow/status/cgoinglove/thursday/ci.yml?style=flat-square&label=ci)](https://github.com/cgoinglove/thursday/actions/workflows/ci.yml)
@@ -22,22 +22,45 @@ An open-source agent like [OpenClaw](https://github.com/openclaw/openclaw) and [
22
22
  npx thursday-agent
23
23
  ```
24
24
 
25
- Paste an OpenAI API key, pick your starter bots, and say **“hey thursday.”**
25
+ Paste an OpenAI API key, pick your starter bots, and say **“hey thursday.”** No account, no `.env`.
26
26
 
27
- ![The call keeps going while a bot does the work](docs/images/two-minds.png)
27
+ ## Talk while it works
28
28
 
29
- ## Features
29
+ Most agents make you type and wait. Thursday is a real-time voice call you can interrupt. Anything that takes more than a few seconds goes to a bot in the background, so the call never goes quiet, and she tells you when it's back.
30
30
 
31
- - **Just talk.** A real-time voice call you can interrupt. Start one with “hey thursday” or a hotkey.
32
- - **Bots do the slow work.** Anything that takes more than a few seconds goes to a bot in the background, and the conversation keeps going.
33
- - **Your real computer.** Bots get a shell, your files, and a real browser — even the Chrome you are already signed into. It stops at a Pay button and leaves it to you.
34
- - **Results you can open.** Pages, docs, charts, images, audio, and video, saved as files and opened on your screen.
35
- - **Hang up, it keeps going.** Jobs run on your machine and Thursday tells you when they are done.
36
- - **A team you build.** Make a bot with a name and one sentence. Bots pass work to each other and ask you when a decision is yours.
37
- - **Memory you can read.** What Thursday knows about you is plain notes. Open, edit, or delete any line.
38
- - **Skills and MCP.** Add Agent Skills and connect MCP servers.
39
- - **Any model.** OpenAI, Anthropic, Google, xAI, Vercel AI Gateway, or your ChatGPT sign-in, with a different model per bot.
40
- - **Local-first.** No Thursday account. The app, your data, and your keys stay on your computer.
31
+ ![A voice call with Thursday while a bot looks for hotels in the background](docs/images/call.png)
32
+
33
+ ## One sentence, a whole team
34
+
35
+ Bots hand parts of a job to each other, check what comes back, and ask you only when a decision is yours. Every handoff is saved: open the thread to see who did what, or step in.
36
+
37
+ ![A planner bot splits a trip request between two bots and one asks the user a question](docs/images/room.png)
38
+
39
+ ## Errands, in a real browser
40
+
41
+ Orders, bookings, forms, the inbox. Bots use their own browser or the Chrome you're already signed into, and ask before using a login you gave them. A purchase stops at the Pay button, left open on your screen.
42
+
43
+ ![A checkout a bot filled in and left open, with the Pay button for the user to press](docs/images/errands.png)
44
+
45
+ ## Results you can keep
46
+
47
+ Pages, charts, videos, slides, docs and scripts, saved as files on your machine and opened on your screen when they're ready.
48
+
49
+ ![Files made by six different bots: a rent chart, a short video, a carousel, a trip page, launch copy, and a script](docs/images/artifacts.png)
50
+
51
+ ## Your crew
52
+
53
+ Pick starter bots on the first run, or make your own with a name and one sentence about what it's for. Give each its own model and tools.
54
+
55
+ ![A lineup of bots, each with its own face and job, plus a slot to make your own](docs/images/bots.png)
56
+
57
+ ## And also
58
+
59
+ - **Hang up, it keeps going.** Jobs run on your machine, and Thursday tells you when they finish, or calls you if you turn that on.
60
+ - **Memory you can read.** What she knows about you is plain notes. Open, edit, or delete any line.
61
+ - **Skills and MCP.** Teach bots new methods with Agent Skills, and connect any MCP server.
62
+ - **Any model.** OpenAI, Anthropic, Google, xAI, Vercel AI Gateway, or your ChatGPT sign-in, per bot.
63
+ - **Local-first.** No Thursday account and no server of ours. The app, your data and your keys stay on your computer.
41
64
 
42
65
  ## Requirements
43
66
 
@@ -45,8 +68,26 @@ Paste an OpenAI API key, pick your starter bots, and say **“hey thursday.”**
45
68
  - An OpenAI API key for the voice
46
69
  - macOS. Linux should work; Windows is not tested yet.
47
70
 
48
- > [!NOTE]
49
- > Bots run real commands on your computer. Thursday is not a sandbox — read [SECURITY.md](SECURITY.md) before giving it access to anything sensitive.
71
+ <details>
72
+ <summary><b>What does it cost?</b></summary>
73
+
74
+ Thursday is free and MIT-licensed. You bring the keys: the voice is billed by OpenAI per active minute of a call, and bots use whichever provider you pick for them.
75
+
76
+ </details>
77
+
78
+ <details>
79
+ <summary><b>Where does my data go?</b></summary>
80
+
81
+ What you say and what bots work on go only to the model providers you set up and the services you connect. The app listens only on `127.0.0.1`, and your calls, memory and files live in `~/.thursday` (or the checkout, when you run from source).
82
+
83
+ </details>
84
+
85
+ <details>
86
+ <summary><b>Is it safe to let bots use my computer?</b></summary>
87
+
88
+ Bots run real commands, so treat Thursday like any powerful local tool: it is not a sandbox. Read [SECURITY.md](SECURITY.md) before giving it access to anything sensitive.
89
+
90
+ </details>
50
91
 
51
92
  <details>
52
93
  <summary><b>Run from source</b></summary>
@@ -68,6 +109,6 @@ Requires pnpm 10+.
68
109
 
69
110
  **[How it works](docs/how-it-works.md)** · [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [MIT](LICENSE)
70
111
 
71
- If you want an assistant you can talk to while it works, [star Thursday](https://github.com/cgoinglove/thursday).
112
+ If you'd rather say it than type it, [star Thursday](https://github.com/cgoinglove/thursday).
72
113
 
73
114
  </div>