thursday-agent 0.8.0 → 0.10.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 (301) 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/page.js.nft.json +1 -1
  5. package/.next/server/app/_global-error.html +1 -1
  6. package/.next/server/app/_global-error.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  10. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  11. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  12. package/.next/server/app/_not-found.html +1 -1
  13. package/.next/server/app/_not-found.rsc +2 -2
  14. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  15. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  16. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  17. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  18. package/.next/server/app/api/bot/keep-working/route.js.nft.json +1 -1
  19. package/.next/server/app/api/bot/memory/files/route.js.nft.json +1 -1
  20. package/.next/server/app/api/bot/memory/route.js.nft.json +1 -1
  21. package/.next/server/app/api/bot/route.js.nft.json +1 -1
  22. package/.next/server/app/api/bot/thread/[id]/route.js.nft.json +1 -1
  23. package/.next/server/app/api/bot/thread/route.js.nft.json +1 -1
  24. package/.next/server/app/api/config/route.js.nft.json +1 -1
  25. package/.next/server/app/api/events/route.js.nft.json +1 -1
  26. package/.next/server/app/api/favicon/[host]/route.js.nft.json +1 -1
  27. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  28. package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
  29. package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
  30. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  31. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  32. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  33. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  34. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  35. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  36. package/.next/server/app/api/memory/edit/route.js +1 -1
  37. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  38. package/.next/server/app/api/memory/route.js.nft.json +1 -1
  39. package/.next/server/app/api/probe/route.js.nft.json +1 -1
  40. package/.next/server/app/api/reach/route.js +11 -11
  41. package/.next/server/app/api/reach/route.js.nft.json +1 -1
  42. package/.next/server/app/api/routine/route.js +6 -6
  43. package/.next/server/app/api/routine/route.js.nft.json +1 -1
  44. package/.next/server/app/api/signins/route.js.nft.json +1 -1
  45. package/.next/server/app/api/skills/[source]/[name]/route.js.nft.json +1 -1
  46. package/.next/server/app/api/skills/route.js.nft.json +1 -1
  47. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  48. package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
  49. package/.next/server/app/api/thursday/text/route.js +11 -11
  50. package/.next/server/app/api/thursday/text/route.js.nft.json +1 -1
  51. package/.next/server/app/api/thursday/tool-call/route.js +6 -6
  52. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  53. package/.next/server/app/api/workspace/files/route.js.nft.json +1 -1
  54. package/.next/server/app/api/workspace/route.js.nft.json +1 -1
  55. package/.next/server/app/artifact/[...path]/page/server-reference-manifest.json +1 -1
  56. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  57. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  59. package/.next/server/app/manifest.webmanifest/route.js.nft.json +1 -1
  60. package/.next/server/app/page/server-reference-manifest.json +56 -56
  61. package/.next/server/app/page.js +3 -3
  62. package/.next/server/app/page.js.nft.json +1 -1
  63. package/.next/server/app/page_client-reference-manifest.js +1 -1
  64. package/.next/server/chunks/[root-of-the-server]__012s2o8._.js +1 -1
  65. package/.next/server/chunks/[root-of-the-server]__04r4h-2._.js +1 -1
  66. package/.next/server/chunks/[root-of-the-server]__0mrk2it._.js +1 -1
  67. package/.next/server/chunks/[root-of-the-server]__0nmhgeo._.js +3 -0
  68. package/.next/server/chunks/[root-of-the-server]__1fy2g82._.js +3 -0
  69. package/.next/server/chunks/[root-of-the-server]__1ndi14y._.js +1 -1
  70. package/.next/server/chunks/[root-of-the-server]__1nmflqk._.js +3 -0
  71. package/.next/server/chunks/[root-of-the-server]__1v7-zke._.js +1 -1
  72. package/.next/server/chunks/[root-of-the-server]__1wnzmx9._.js +3 -0
  73. package/.next/server/chunks/[root-of-the-server]__1xv-5cq._.js +1 -1
  74. package/.next/server/chunks/[root-of-the-server]__1ygplx1._.js +1 -1
  75. package/.next/server/chunks/_05v8k21._.js +1 -1
  76. package/.next/server/chunks/_0awtznl._.js +4 -4
  77. package/.next/server/chunks/_0k6qjcf._.js +1 -1
  78. package/.next/server/chunks/_0na2fj1._.js +5 -5
  79. package/.next/server/chunks/_0x-ej3f._.js +21 -21
  80. package/.next/server/chunks/_1dc_d1q._.js +22 -20
  81. package/.next/server/chunks/_1jc5g4p._.js +2 -2
  82. package/.next/server/chunks/_1jn-aep._.js +50 -48
  83. package/.next/server/chunks/{_1u8ygbz._.js → _1m88lkh._.js} +7 -7
  84. package/.next/server/chunks/_1uuucy-._.js +4 -4
  85. package/.next/server/chunks/_1v9r2ke._.js +1 -1
  86. package/.next/server/chunks/ssr/{[root-of-the-server]__1h4bnrf._.js → [root-of-the-server]__0cxqzfc._.js} +2 -2
  87. package/.next/server/chunks/ssr/{[root-of-the-server]__1kyi568._.js → [root-of-the-server]__0tvavy9._.js} +1 -1
  88. package/.next/server/chunks/ssr/[root-of-the-server]__0tzekbl._.js +1 -1
  89. package/.next/server/chunks/ssr/[root-of-the-server]__1-d2tgh._.js +3 -0
  90. package/.next/server/chunks/ssr/[root-of-the-server]__1se25x0._.js +1 -1
  91. package/.next/server/chunks/ssr/{_1i3ddn7._.js → _05pl_u8._.js} +1 -1
  92. package/.next/server/chunks/ssr/_05rxyf9._.js +3 -0
  93. package/.next/server/chunks/ssr/_070nv1_._.js +3 -0
  94. package/.next/server/chunks/ssr/_097-ljd._.js +1 -1
  95. package/.next/server/chunks/ssr/{_10y6r1n._.js → _0bp-_fi._.js} +3 -3
  96. package/.next/server/chunks/ssr/_0fqhhwi._.js +1 -1
  97. package/.next/server/chunks/ssr/_0hlxij-._.js +3 -0
  98. package/.next/server/chunks/ssr/_0ld9_qq._.js +1 -1
  99. package/.next/server/chunks/ssr/{_0z8jpch._.js → _0p9pmxe._.js} +2 -2
  100. package/.next/server/chunks/ssr/{_1y-ea28._.js → _0s41irp._.js} +2 -2
  101. package/.next/server/chunks/ssr/_0tg0vf8._.js +164 -0
  102. package/.next/server/chunks/ssr/_0u5xv6g._.js +3 -0
  103. package/.next/server/chunks/ssr/{_1_rqu8x._.js → _12mijol._.js} +7 -7
  104. package/.next/server/chunks/ssr/_15zqt-t._.js +1 -1
  105. package/.next/server/chunks/ssr/{_1oijqjw._.js → _173siic._.js} +2 -2
  106. package/.next/server/chunks/ssr/_17v-33v._.js +20 -0
  107. package/.next/server/chunks/ssr/_184327j._.js +1 -1
  108. package/.next/server/chunks/ssr/{_1nod5hh._.js → _19n08g5._.js} +2 -2
  109. package/.next/server/chunks/ssr/_1alxym6._.js +3 -0
  110. package/.next/server/chunks/ssr/{_0hzz82u._.js → _1d423aj._.js} +25 -23
  111. package/.next/server/chunks/ssr/{_0ewory0._.js → _1doidrw._.js} +2 -2
  112. package/.next/server/chunks/ssr/{_0pm-2p-._.js → _1flsjeo._.js} +2 -2
  113. package/.next/server/chunks/ssr/_1mqn9mc._.js +1 -1
  114. package/.next/server/chunks/ssr/_1neoj22._.js +1 -1
  115. package/.next/server/chunks/ssr/_1ng831c._.js +3 -0
  116. package/.next/server/chunks/ssr/{_19g570d._.js → _1u2jw0i._.js} +3 -3
  117. package/.next/server/chunks/ssr/_1xoch6f._.js +1 -1
  118. package/.next/server/chunks/ssr/{_1u1mxu9._.js → _1yk6yak._.js} +2 -2
  119. package/.next/server/chunks/ssr/features_bot_1s_-2vj._.js +1 -1
  120. package/.next/server/chunks/ssr/features_bot_1yr-_pm._.js +3 -0
  121. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  122. package/.next/server/chunks/ssr/features_memory_components_memory-setting_tsx_0oa43sw._.js +1 -1
  123. package/.next/server/chunks/ssr/features_routine_components_routine-setting_tsx_055fknz._.js +1 -1
  124. package/.next/server/chunks/ssr/{node_modules_1_8mv4v._.js → node_modules_048wmmj._.js} +1 -1
  125. package/.next/server/chunks/ssr/{node_modules_1p9rdsy._.js → node_modules_04t200t._.js} +1 -1
  126. package/.next/server/chunks/ssr/{node_modules_03ptrl9._.js → node_modules_0511ha-._.js} +1 -1
  127. package/.next/server/chunks/ssr/{node_modules_07ih6wb._.js → node_modules_08g12f-._.js} +1 -1
  128. package/.next/server/chunks/ssr/{node_modules_01f8_se._.js → node_modules_0cdu6jq._.js} +1 -1
  129. package/.next/server/chunks/ssr/{node_modules_111sh9o._.js → node_modules_0eb4rx7._.js} +1 -1
  130. package/.next/server/chunks/ssr/{node_modules_10gbm2y._.js → node_modules_0f2k5l0._.js} +1 -1
  131. package/.next/server/chunks/ssr/{node_modules_1ix-g49._.js → node_modules_0piws2a._.js} +1 -1
  132. package/.next/server/chunks/ssr/{node_modules_0t-44lj._.js → node_modules_0pk6i-e._.js} +1 -1
  133. package/.next/server/chunks/ssr/{node_modules_0lg75qx._.js → node_modules_0s1lwc9._.js} +1 -1
  134. package/.next/server/chunks/ssr/{node_modules_1v9tc1c._.js → node_modules_0wq4-ts._.js} +1 -1
  135. package/.next/server/chunks/ssr/{node_modules_1m3gb16._.js → node_modules_0zjqwz7._.js} +1 -1
  136. package/.next/server/chunks/ssr/{node_modules_0b8df3s._.js → node_modules_11hbkuj._.js} +1 -1
  137. package/.next/server/chunks/ssr/{node_modules_00jv9_3._.js → node_modules_18woe20._.js} +1 -1
  138. package/.next/server/chunks/ssr/{node_modules_1x825hz._.js → node_modules_1_afpz7._.js} +1 -1
  139. package/.next/server/chunks/ssr/{node_modules_0woscox._.js → node_modules_1_ban4u._.js} +1 -1
  140. package/.next/server/chunks/ssr/{node_modules_0gt-uw9._.js → node_modules_1cxc8kn._.js} +1 -1
  141. package/.next/server/chunks/ssr/{node_modules_059vtf2._.js → node_modules_1dcbvfw._.js} +1 -1
  142. package/.next/server/chunks/ssr/{node_modules_1lsyy7k._.js → node_modules_1expacw._.js} +1 -1
  143. package/.next/server/chunks/ssr/{node_modules_1-7qawg._.js → node_modules_1ksh9gy._.js} +1 -1
  144. package/.next/server/chunks/ssr/{node_modules_06w645b._.js → node_modules_1m2ho33._.js} +1 -1
  145. package/.next/server/chunks/ssr/{node_modules_0sz5yg1._.js → node_modules_1n0h9sf._.js} +1 -1
  146. package/.next/server/chunks/ssr/{node_modules_1teyzfa._.js → node_modules_1qehmwm._.js} +1 -1
  147. package/.next/server/chunks/ssr/{node_modules_0yv-re6._.js → node_modules_1xzo2wn._.js} +1 -1
  148. package/.next/server/chunks/ssr/{node_modules_20xmwtu._.js → node_modules_1zf46lp._.js} +1 -1
  149. package/.next/server/chunks/ssr/{node_modules_0ii1l89._.js → node_modules_1zkpek5._.js} +1 -1
  150. package/.next/server/chunks/ssr/{node_modules_@base-ui_react_0jne69c._.js → node_modules_@base-ui_react_0buz1-j._.js} +1 -1
  151. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_00q1oa3._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0avl8-1._.js} +1 -1
  152. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1-2_5z7._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_14oslro._.js} +1 -1
  153. package/.next/server/middleware-build-manifest.js +3 -3
  154. package/.next/server/pages/404.html +1 -1
  155. package/.next/server/pages/500.html +1 -1
  156. package/.next/server/server-reference-manifest.js +1 -1
  157. package/.next/server/server-reference-manifest.json +57 -57
  158. package/.next/static/chunks/03kgfyrli_0gz.js +1 -0
  159. package/.next/static/chunks/{1e4yrzs5evq_r.js → 09120tms63y21.js} +1 -1
  160. package/.next/static/chunks/{2zhfdbq50ee5i.js → 0o980477kfqez.js} +1 -1
  161. package/.next/static/chunks/{1ocy4w0v20a3v.js → 0oz3rs47yy3p8.js} +2 -2
  162. package/.next/static/chunks/{2be08eqxsfc1y.js → 0w20wnnfrscq7.js} +1 -1
  163. package/.next/static/chunks/{09c13vnqy7al3.js → 19ojn4lomsk0r.js} +2 -2
  164. package/.next/static/chunks/{2om4lkg86feb4.js → 1mwee7xvitlp9.js} +1 -1
  165. package/.next/static/chunks/1p764d75_0lhv.js +18 -0
  166. package/.next/static/chunks/{0oz7a68qanm99.js → 1pjygp7hqib6j.js} +1 -1
  167. package/.next/static/chunks/22shnca_6zfzs.js +1 -0
  168. package/.next/static/chunks/{34s52v8f841zo.js → 24dst4mgurbsh.js} +1 -1
  169. package/.next/static/chunks/25zq8gzhbdsr7.js +1 -0
  170. package/.next/static/chunks/2d4z3er53ng8r.js +1 -0
  171. package/.next/static/chunks/{2d3yhjtafgmtw.js → 2ky81z-jgvasc.js} +1 -1
  172. package/.next/static/chunks/2m6jd3586ijb-.js +1 -0
  173. package/.next/static/chunks/{0k5tkt_qi52kb.js → 2ndw4w4u2x51r.js} +1 -1
  174. package/.next/static/chunks/2qod5tqlpz8b7.js +17 -0
  175. package/.next/static/chunks/{21gf2t_whhurc.js → 30skcjexa57zn.js} +2 -2
  176. package/.next/static/chunks/{2upc9mkcc3nlq.js → 35kwn237o4wdn.js} +1 -1
  177. package/.next/static/chunks/{2u9yjkpkoij75.js → 3exjsi8pfdvzj.js} +1 -1
  178. package/.next/static/chunks/3obf9n3cxj99k.js +1 -0
  179. package/.next/static/chunks/3qq4o8w2rv_e9.css +1 -0
  180. package/.next/static/chunks/{0g1p98s2pfx2w.js → 3vynnr71ghvom.js} +2 -2
  181. package/.next/static/chunks/{44kjmi5h_p8px.js → 42890jqk049q1.js} +1 -1
  182. package/README.md +35 -14
  183. package/bin/port.mjs +11 -7
  184. package/bin/thursday.mjs +1 -1
  185. package/components/ui/radio-group.tsx +1 -1
  186. package/components/ui/shiny-text.tsx +3 -22
  187. package/docs/how-it-works.md +11 -3
  188. package/docs/images/first-run.png +0 -0
  189. package/docs/images/keeps-going.png +0 -0
  190. package/docs/images/two-minds.png +0 -0
  191. package/features/ai/components/model-browser.tsx +1 -1
  192. package/features/ai/components/model-picker.tsx +1 -1
  193. package/features/ai/guide.ts +9 -4
  194. package/features/ai/prompts/bot.prompt.ts +4 -1
  195. package/features/ai/tools/routine.tool.ts +28 -16
  196. package/features/bot/bot.runner.ts +3 -1
  197. package/features/bot/components/bot-mark.tsx +6 -1
  198. package/features/bot/components/bot-setting.tsx +4 -6
  199. package/features/bot/components/bot-tool.tsx +2 -0
  200. package/features/bot/components/room-list.tsx +12 -3
  201. package/features/bot/components/room-pill.tsx +26 -19
  202. package/features/config/components/config-setting.tsx +17 -5
  203. package/features/config/components/voice-key.tsx +38 -18
  204. package/features/connectors/mcp.const.ts +90 -59
  205. package/features/intro/components/intro.tsx +50 -27
  206. package/features/routine/components/routine-mark.tsx +4 -6
  207. package/features/routine/components/routine-setting.tsx +332 -143
  208. package/features/routine/routine.query.ts +24 -3
  209. package/features/routine/routine.schema.ts +55 -4
  210. package/features/settings/components/install-app.tsx +1 -4
  211. package/features/settings/components/setting-ui.tsx +1 -1
  212. package/features/skills/skills.discover.ts +2 -1
  213. package/features/skills/skills.query.ts +5 -1
  214. package/features/skills/skills.schema.ts +2 -0
  215. package/features/thursday/components/ascii-orb.tsx +39 -10
  216. package/features/thursday/components/connect-wave.tsx +284 -0
  217. package/features/thursday/components/side-captions.tsx +29 -17
  218. package/features/thursday/components/thursday-setting.tsx +3 -3
  219. package/features/thursday/components/thursday.tsx +130 -58
  220. package/features/thursday/components/voice-picker.tsx +1 -1
  221. package/features/thursday/components/write-line.tsx +2 -2
  222. package/features/thursday/open-work.ts +11 -3
  223. package/features/thursday/tool-line.ts +94 -12
  224. package/features/thursday/use-text-call.ts +3 -2
  225. package/features/thursday/use-thursday.ts +5 -2
  226. package/features/workspace/components/artifact-view.tsx +129 -7
  227. package/guide/bots.md +17 -5
  228. package/guide/calls.md +15 -7
  229. package/guide/setup.md +10 -2
  230. package/knip.json +1 -0
  231. package/lib/desktop-notify.ts +3 -2
  232. package/package.json +1 -1
  233. package/scripts/bot-context.test.mts +1 -1
  234. package/seed-skills/analyst/README.md +19 -0
  235. package/seed-skills/analyst/data-report/SKILL.md +59 -0
  236. package/seed-skills/analyst/data-report/references/brief.md +31 -0
  237. package/seed-skills/analyst/data-report/references/company.md +41 -0
  238. package/seed-skills/analyst/data-report/references/comparison.md +42 -0
  239. package/seed-skills/analyst/data-report/references/decision.md +28 -0
  240. package/seed-skills/analyst/data-report/references/market-size.md +49 -0
  241. package/seed-skills/analyst/data-report/references/price-check.md +33 -0
  242. package/seed-skills/analyst/data-report/references/sources.md +51 -0
  243. package/seed-skills/analyst/data-report/references/trend.md +39 -0
  244. package/seed-skills/analyst/data-report/scripts/chart.mjs +679 -0
  245. package/seed-skills/analyst/data-report/scripts/fetch.mjs +521 -0
  246. package/seed-skills/insta/instagram/SKILL.md +33 -0
  247. package/seed-skills/insta/instagram/references/dm.md +49 -0
  248. package/seed-skills/insta/instagram/references/post.md +74 -0
  249. package/seed-skills/insta/instagram/scripts/compose.mjs +329 -0
  250. package/seed-skills/insta/instagram/scripts/image-size.mjs +30 -0
  251. package/seed-skills/insta/instagram/scripts/inbox.mjs +159 -0
  252. package/seed-skills/insta/instagram/scripts/lib.mjs +91 -0
  253. package/seed-skills/insta/instagram/scripts/media.mjs +104 -0
  254. package/seed-skills/insta/instagram/scripts/profile.mjs +139 -0
  255. package/seed-skills/insta/instagram/scripts/read.mjs +240 -0
  256. package/seed-skills/insta/instagram/scripts/render.mjs +126 -0
  257. package/seed-skills/insta/instagram/scripts/search.mjs +133 -0
  258. package/seed-skills/insta/instagram/scripts/selectors.mjs +56 -0
  259. package/seed-skills/insta/instagram/scripts/sheet.mjs +100 -0
  260. package/seed-skills/insta/instagram/scripts/webimage.mjs +105 -0
  261. package/seed-skills/insta/instagram/templates/carousel.html +62 -0
  262. package/seed-skills/mail/mail/SKILL.md +37 -0
  263. package/seed-skills/mail/mail/recipes/gmail.mjs +448 -0
  264. package/seed-skills/mail/mail/references/recipes.md +55 -0
  265. package/seed-skills/mail/mail/scripts/mail.mjs +202 -0
  266. package/seed-skills/marketer/README.md +6 -4
  267. package/seed-skills/marketer/copywriting/SKILL.md +1 -1
  268. package/seed-skills/marketer/emails/SKILL.md +1 -1
  269. package/seed-skills/marketer/launch/SKILL.md +1 -1
  270. package/seed-skills/marketer/product-marketing/SKILL.md +5 -5
  271. package/seed-skills/marketer/seo-audit/SKILL.md +1 -1
  272. package/seed-skills/marketer/social/SKILL.md +1 -1
  273. package/skills/computer/SKILL.md +1 -0
  274. package/skills/interactive-page/SKILL.md +4 -0
  275. package/.next/server/chunks/[root-of-the-server]__0n-l_n_._.js +0 -3
  276. package/.next/server/chunks/[root-of-the-server]__0wvo2of._.js +0 -3
  277. package/.next/server/chunks/[root-of-the-server]__1e6aut3._.js +0 -3
  278. package/.next/server/chunks/[root-of-the-server]__1ziojdq._.js +0 -3
  279. package/.next/server/chunks/ssr/[root-of-the-server]__1srp8l5._.js +0 -3
  280. package/.next/server/chunks/ssr/_0mes4s0._.js +0 -3
  281. package/.next/server/chunks/ssr/_0ya0cb0._.js +0 -3
  282. package/.next/server/chunks/ssr/_0yto5s7._.js +0 -20
  283. package/.next/server/chunks/ssr/_10dw2nv._.js +0 -3
  284. package/.next/server/chunks/ssr/_1p0gxeo._.js +0 -164
  285. package/.next/server/chunks/ssr/_1r41yvh._.js +0 -3
  286. package/.next/server/chunks/ssr/_1r79ksv._.js +0 -3
  287. package/.next/server/chunks/ssr/features_bot_1ogjt52._.js +0 -3
  288. package/.next/server/chunks/ssr/node_modules_@base-ui_react_0b3d4m9._.js +0 -3
  289. package/.next/static/chunks/03omwz_vi2ndg.js +0 -1
  290. package/.next/static/chunks/0_1bqgd6wt_og.js +0 -1
  291. package/.next/static/chunks/0abgkzikaznxc.js +0 -1
  292. package/.next/static/chunks/0bddkpash59-o.js +0 -17
  293. package/.next/static/chunks/0c2-bzhy3a0ib.js +0 -1
  294. package/.next/static/chunks/0iilfb1ocevnx.js +0 -1
  295. package/.next/static/chunks/0imbhx-j830a_.css +0 -1
  296. package/.next/static/chunks/24h1y9dhy3m_2.js +0 -1
  297. package/.next/static/chunks/2f_5saocsko_b.js +0 -1
  298. package/.next/static/chunks/2lwbr5vx0ixaj.js +0 -18
  299. /package/.next/static/{UiOMPYpQ4fqGyu5PzS-7j → Ar5V4kMdL4CE1trx8anrH}/_buildManifest.js +0 -0
  300. /package/.next/static/{UiOMPYpQ4fqGyu5PzS-7j → Ar5V4kMdL4CE1trx8anrH}/_clientMiddlewareManifest.js +0 -0
  301. /package/.next/static/{UiOMPYpQ4fqGyu5PzS-7j → Ar5V4kMdL4CE1trx8anrH}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),s=e.i(225913);e.i(271645);var l=e.i(647163);function i({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}e.i(652225);let a=(0,s.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:s="vertical",...i}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":s,className:(0,l.cn)(a({orientation:s}),e),...i})},"FieldContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,l.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...s})},"FieldLabel",0,function({className:e,...s}){return(0,t.jsx)(i,{"data-slot":"field-label",className:(0,l.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...s})}],986530)},833959,e=>{"use strict";var t=e.i(843476),s=e.i(437750),l=e.i(856539),i=e.i(24071),a=e.i(867927),r=e.i(829600),n=e.i(226091),o=e.i(726067),d=e.i(91511),c=e.i(456420);let u={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]};u.node;let m=(0,c.default)(u);var x=e.i(77071),h=e.i(566595);let f={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};f.node;let p=(0,c.default)(f);var g=e.i(759659);let v={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};v.node;let b=(0,c.default)(v);var j=e.i(271645),k=e.i(798120),y=e.i(167881),N=e.i(986530),w=e.i(23750),S=e.i(683408),C=e.i(917162),z=e.i(671428),F=e.i(319036),M=e.i(127341),L=e.i(184762),R=e.i(41533),T=e.i(895836),A=e.i(95187);let D=(0,A.createServerReference)("7f91a6d9f913e15ff853b2b7c7bbc2291ca1f4f555",A.callServer,void 0,A.findSourceMapURL,"createSkillAction"),$=(0,A.createServerReference)("7fd36e3d7b61e0eae544c22a137bbed93c3e346f12",A.callServer,void 0,A.findSourceMapURL,"deleteSkillAction"),K=(0,A.createServerReference)("7fc736d208ad1587e78e00236baf163ed603e9c47e",A.callServer,void 0,A.findSourceMapURL,"setSkillDisabledAction"),q=(0,A.createServerReference)("7f852b5418e1658a512b0e7d5cdc5f3c395be7cfd5",A.callServer,void 0,A.findSourceMapURL,"uploadSkillAction");var P=e.i(609856),B=e.i(283653),O=e.i(647163);let U={browser:d.Globe,computer:s.AppWindow,"find-skills":h.Search,"interactive-page":m,"skill-creator":p};function I({skill:e}){let[s,i]=(0,P.useServerAction)($,{onOk:()=>(0,B.revalidate)(k.queryKey.skills)}),[r]=(0,P.useServerAction)(K,{onOk:()=>(0,B.revalidate)(k.queryKey.skills)}),n=async()=>{await C.notify.confirm({title:`Delete ${e.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&s(e.dir)},o="default"===e.source&&U[e.dir]||l.BookMarked;return(0,t.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{var s;return s=e,C.notify.component({className:"sm:max-w-4xl",renderer:()=>(0,t.jsx)(W,{skill:s})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:(0,O.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",e.disabled&&"opacity-45"),children:(0,t.jsx)(o,{className:"size-4"})}),(0,t.jsxs)("span",{className:(0,O.cn)("min-w-0 flex-1 space-y-0.5",e.disabled&&"opacity-45"),children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description})]}),(0,t.jsx)(a.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,t.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,t.jsx)(F.Switch,{checked:!e.disabled,onCheckedChange:t=>r(e.source,e.dir,!t),"aria-label":`${e.name} on or off`,className:"shrink-0"}),"custom"===e.source?(0,t.jsx)(y.Button,{size:"icon-sm",variant:"ghost",loading:i,onClick:n,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(g.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function W({skill:e}){let[s,l]=(0,j.useState)(""),[a,r]=(0,j.useState)("SKILL.md");return(0,t.jsx)(T.SettingDialogContent,{title:e.name,description:(0,t.jsx)(E,{skill:e,path:a??s}),children:(0,t.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,t.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[s&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(s.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(i.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s.split("/").pop()})]}),(0,t.jsx)(V,{source:e.source,dir:e.dir,path:s,current:a,onPick:e=>{let t=s?`${s}/${e.name}`:e.name;"dir"===e.kind?l(t):r(t)}})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:a?(0,t.jsx)(Y,{source:e.source,dir:e.dir,path:a}):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function E({skill:e,path:s}){if(!e)return(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground/60",children:"Pick a skill"});let l=[e.name,...s.split("/").filter(Boolean)];return(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:l.map((e,s)=>(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[s>0&&(0,t.jsx)(a.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,t.jsx)("span",{className:(0,O.cn)("truncate",s===l.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function H({icon:e,label:s,active:l,hasChildren:i,onClick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,O.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",l?"bg-secondary text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:e}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),i&&(0,t.jsx)(a.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function V({source:e,dir:s,path:l,current:i,onPick:a}){let{data:d,isLoading:c,error:u}=(0,B.useServerRoute)(k.queryKey.skillNode(e,s,l));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):c||!d?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(z.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(z.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==d.kind?null:(0,t.jsxs)(t.Fragment,{children:[d.entries.map(e=>(0,t.jsx)(H,{icon:"dir"===e.kind?(0,t.jsx)(o.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(n.FileText,{}):(0,t.jsx)(r.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(l?`${l}/${e.name}`:e.name)===i,onClick:()=>a(e)},e.name)),0===d.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function G({content:e}){let s=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),l=s?.[1].trim(),i=s?e.slice(s[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[l&&(0,t.jsx)("pre",{className:"border-b border-border/60 bg-muted/20 px-5 py-3 font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground",children:l}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(S.Markdown,{children:i})})]})}function Y({source:e,dir:s,path:l}){let{data:i,isLoading:a,error:r}=(0,B.useServerRoute)(k.queryKey.skillNode(e,s,l));if(r)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:r.message});if(a||!i)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(z.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(z.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(z.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==i.kind)return null;let n=l.split("/").pop()??"";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,t.jsx)("span",{className:"truncate",children:n}),(0,t.jsx)("span",{className:"shrink-0",children:(0,O.formatBytes)(i.size)})]}),null===i.content?(0,t.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground/60",children:"Not a text file — the agent can still read it from disk."}):n.toLowerCase().endsWith(".md")?(0,t.jsx)(G,{content:i.content}):(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:i.content})]})}function Z(){return C.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(_,{onDone:e})})}function _({onDone:e}){let[s,l]=(0,j.useState)("write"),[i,a]=(0,j.useState)(""),[r,n]=(0,j.useState)(""),[o,d]=(0,j.useState)(""),[c,u]=(0,j.useState)(null),[m,h]=(0,j.useState)(!1),f=(0,j.useRef)(null),p={errorMessage:!1,onOk:()=>{(0,B.revalidate)(k.queryKey.skills),e()}},[g,v,,S]=(0,P.useServerAction)(D,p),[C,z,,F]=(0,P.useServerAction)(q,p),A=v||z,$="write"===s?S:F,K=!A&&("write"===s?i.trim()&&r.trim()&&o.trim():null!==c),U=async()=>{var e;!K||("write"===s?g({name:i.trim(),description:r.trim(),content:o}):c&&C({fileName:c.name,base64:await (e=c,new Promise((t,s)=>{let l=new FileReader;l.onload=()=>{let e=l.result;t(e.slice(e.indexOf(",")+1))},l.onerror=()=>s(l.error),l.readAsDataURL(e)}))}))},I=e=>{let t=e?.[0]??null;t&&u(t)};return(0,t.jsxs)(T.SettingDialogContent,{title:"New skill",description:"Instructions the agent loads by name when a task calls for them.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(y.Button,{disabled:!K,loading:A,onClick:U,children:[!A&&("write"===s?(0,t.jsx)(x.Plus,{}):(0,t.jsx)(b,{})),"write"===s?"Create":"Upload"]})]}),children:[(0,t.jsxs)(M.Tabs,{value:s,onValueChange:e=>l(e),children:[(0,t.jsxs)(M.TabsList,{className:"w-full",children:[(0,t.jsx)(M.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(M.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(M.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(N.Field,{children:[(0,t.jsx)(N.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(N.FieldContent,{children:[(0,t.jsx)(w.Input,{id:"skill-name",value:i,onChange:e=>a(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[R.PATHS.skills.custom,"/",i.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(N.Field,{children:[(0,t.jsx)(N.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(N.FieldContent,{children:(0,t.jsx)(w.Input,{id:"skill-description",value:r,onChange:e=>n(e.target.value),placeholder:"When to use it — this is how the agent decides to load it"})})]}),(0,t.jsxs)(N.Field,{children:[(0,t.jsx)(N.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,t.jsx)(L.Textarea,{id:"skill-content",value:o,onChange:e=>d(e.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,t.jsxs)(M.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>f.current?.click(),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:e=>{e.preventDefault(),h(!1),I(e.dataTransfer.files)},className:(0,O.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",m?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,t.jsx)(b,{className:"size-5 text-muted-foreground"}),c?(0,t.jsxs)("span",{className:"text-sm",children:[c.name,(0,t.jsx)("span",{className:"ml-2 font-mono text-[11px] text-muted-foreground",children:(0,O.formatBytes)(c.size)})]}):(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,t.jsx)("input",{ref:f,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:e=>I(e.target.files)}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,t.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]})]})]})]}),$&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:$})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,j.useState)(""),{data:l,isLoading:i,error:a}=(0,B.useServerRoute)(k.queryKey.skills),r=l??[];if(i)return(0,t.jsx)(T.SettingSkeleton,{rows:4});if(a)return(0,t.jsx)(T.SettingError,{message:a.message});let n=e.trim().toLowerCase(),o=r.filter(e=>!n||`${e.name} ${e.description}`.toLowerCase().includes(n)),d=r.filter(e=>!e.disabled).length;return(0,t.jsxs)(T.SettingScreen,{footer:(0,t.jsxs)(T.SettingRailNote,{children:[r.filter(e=>"default"===e.source).length," shipped · ",r.filter(e=>"custom"===e.source).length," ","installed"]}),children:[(0,t.jsx)(T.SettingToolbar,{count:`${d} on \xb7 ${r.length-d} off`,children:(0,t.jsx)(T.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(T.SettingGroup,{label:"Custom",hint:"yours — added here · wins a name clash",children:(0,t.jsx)(T.SettingItems,{addRow:{label:"Add skill",onClick:Z},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(I,{skill:e},`custom/${e.dir}`))})}),(0,t.jsx)(T.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(T.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(I,{skill:e},`default/${e.dir}`))})}),d>R.PROMPT_CROWDED.skills&&(0,t.jsxs)(T.SettingNote,{children:[d," skills are on. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],833959)},437750,e=>{"use strict";var t=e.i(456420);let s={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};s.node;let l=(0,t.default)(s);e.s(["AppWindow",0,l],437750)},726067,e=>{"use strict";var t=e.i(456420);let s={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};s.node;let l=(0,t.default)(s);e.s(["Folder",0,l],726067)},759659,e=>{"use strict";var t=e.i(456420);let s={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"]};s.node;let l=(0,t.default)(s);e.s(["Trash2",0,l],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),s=e.i(225913);e.i(271645);var l=e.i(647163);function i({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,l.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}e.i(652225);let a=(0,s.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:s="vertical",...i}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":s,className:(0,l.cn)(a({orientation:s}),e),...i})},"FieldContent",0,function({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,l.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...s})},"FieldLabel",0,function({className:e,...s}){return(0,t.jsx)(i,{"data-slot":"field-label",className:(0,l.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...s})}],986530)},833959,e=>{"use strict";var t=e.i(843476),s=e.i(437750),l=e.i(856539),i=e.i(24071),a=e.i(867927),r=e.i(829600),n=e.i(226091),o=e.i(726067),d=e.i(91511),c=e.i(456420);let u={name:"mouse-pointer-2",size:24,node:[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]};u.node;let m=(0,c.default)(u);var x=e.i(77071),h=e.i(566595);let f={name:"square-pen",size:24,node:[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],aliases:["pen-box","edit","pen-square"]};f.node;let p=(0,c.default)(f);var g=e.i(759659);let v={name:"upload",size:24,node:[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]};v.node;let b=(0,c.default)(v);var j=e.i(271645),k=e.i(798120),y=e.i(167881),N=e.i(986530),w=e.i(23750),S=e.i(683408),C=e.i(917162),z=e.i(671428),F=e.i(319036),M=e.i(127341),L=e.i(184762),R=e.i(41533),T=e.i(895836),A=e.i(95187);let D=(0,A.createServerReference)("7f9f33fe5e06e630f1c3061bb0f5b0dbfbfdb17665",A.callServer,void 0,A.findSourceMapURL,"createSkillAction"),$=(0,A.createServerReference)("7fe25a136dd135edeaab138b485e8d0a463856fb8c",A.callServer,void 0,A.findSourceMapURL,"deleteSkillAction"),K=(0,A.createServerReference)("7f533d2df4f51899d76c2a2a761706dcfbf33b2e71",A.callServer,void 0,A.findSourceMapURL,"setSkillDisabledAction"),q=(0,A.createServerReference)("7f1c4d96c3c987bc7549c62fce538230eabb594734",A.callServer,void 0,A.findSourceMapURL,"uploadSkillAction");var P=e.i(609856),B=e.i(283653),O=e.i(647163);let U={browser:d.Globe,computer:s.AppWindow,"find-skills":h.Search,"interactive-page":m,"skill-creator":p};function I({skill:e}){let[s,i]=(0,P.useServerAction)($,{onOk:()=>(0,B.revalidate)(k.queryKey.skills)}),[r]=(0,P.useServerAction)(K,{onOk:()=>(0,B.revalidate)(k.queryKey.skills)}),n=async()=>{await C.notify.confirm({title:`Delete ${e.name}?`,description:"Every file in this skill is deleted for good.",okText:"Delete",destructive:!0})&&s(e.dir)},o="default"===e.source&&U[e.dir]||l.BookMarked;return(0,t.jsxs)("div",{className:"group flex items-center transition-colors hover:bg-muted/50",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{var s;return s=e,C.notify.component({className:"sm:max-w-4xl",renderer:()=>(0,t.jsx)(W,{skill:s})})},className:"flex min-w-0 flex-1 items-center gap-3 py-4 pl-4 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:(0,O.cn)("grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",e.disabled&&"opacity-45"),children:(0,t.jsx)(o,{className:"size-4"})}),(0,t.jsxs)("span",{className:(0,O.cn)("min-w-0 flex-1 space-y-0.5",e.disabled&&"opacity-45"),children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.name}),(0,t.jsx)("span",{className:"line-clamp-2 text-xs leading-relaxed text-muted-foreground",children:e.description})]}),(0,t.jsx)(a.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 group-hover:text-foreground"})]}),(0,t.jsxs)("div",{className:"mr-4 ml-5 flex w-18 shrink-0 items-center justify-end gap-3",children:[(0,t.jsx)(F.Switch,{checked:!e.disabled,onCheckedChange:t=>r(e.source,e.dir,!t),"aria-label":`${e.name} on or off`,className:"shrink-0"}),"custom"===e.source?(0,t.jsx)(y.Button,{size:"icon-sm",variant:"ghost",loading:i,onClick:n,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(g.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function W({skill:e}){let[s,l]=(0,j.useState)(""),[a,r]=(0,j.useState)("SKILL.md");return(0,t.jsx)(T.SettingDialogContent,{title:e.name,description:(0,t.jsx)(E,{skill:e,path:a??s}),children:(0,t.jsxs)("div",{className:"flex h-[36rem] divide-x divide-border/60 overflow-hidden rounded-xl border border-border/60 bg-background",children:[(0,t.jsxs)("div",{className:"flex w-44 shrink-0 flex-col overflow-y-auto bg-muted/20 py-1",children:[s&&(0,t.jsxs)("button",{type:"button",onClick:()=>l(s.split("/").slice(0,-1).join("/")),className:"mx-1 mb-1 flex items-center gap-1 rounded-md px-2 py-1 text-left font-mono text-[11px] text-muted-foreground outline-none hover:bg-muted/50 hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)(i.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s.split("/").pop()})]}),(0,t.jsx)(V,{source:e.source,dir:e.dir,path:s,current:a,onPick:e=>{let t=s?`${s}/${e.name}`:e.name;"dir"===e.kind?l(t):r(t)}})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:a?(0,t.jsx)(Y,{source:e.source,dir:e.dir,path:a}):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function E({skill:e,path:s}){if(!e)return(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground/60",children:"Pick a skill"});let l=[e.name,...s.split("/").filter(Boolean)];return(0,t.jsx)("span",{className:"flex min-w-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:l.map((e,s)=>(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1",children:[s>0&&(0,t.jsx)(a.ChevronRight,{className:"size-3 shrink-0 opacity-50"}),(0,t.jsx)("span",{className:(0,O.cn)("truncate",s===l.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function H({icon:e,label:s,active:l,hasChildren:i,onClick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,O.cn)("mx-1 flex items-center gap-1.5 rounded-md px-2 py-1 text-left text-xs outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",l?"bg-secondary text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"),children:[(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70 [&>svg]:size-3",children:e}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:s}),i&&(0,t.jsx)(a.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function V({source:e,dir:s,path:l,current:i,onPick:a}){let{data:d,isLoading:c,error:u}=(0,B.useServerRoute)(k.queryKey.skillNode(e,s,l));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):c||!d?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(z.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(z.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==d.kind?null:(0,t.jsxs)(t.Fragment,{children:[d.entries.map(e=>(0,t.jsx)(H,{icon:"dir"===e.kind?(0,t.jsx)(o.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(n.FileText,{}):(0,t.jsx)(r.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(l?`${l}/${e.name}`:e.name)===i,onClick:()=>a(e)},e.name)),0===d.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function G({content:e}){let s=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),l=s?.[1].trim(),i=s?e.slice(s[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[l&&(0,t.jsx)("pre",{className:"border-b border-border/60 bg-muted/20 px-5 py-3 font-mono text-[11px] leading-relaxed whitespace-pre-wrap text-muted-foreground",children:l}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(S.Markdown,{children:i})})]})}function Y({source:e,dir:s,path:l}){let{data:i,isLoading:a,error:r}=(0,B.useServerRoute)(k.queryKey.skillNode(e,s,l));if(r)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:r.message});if(a||!i)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(z.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(z.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(z.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==i.kind)return null;let n=l.split("/").pop()??"";return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"sticky top-0 z-20 flex items-center justify-between gap-2 border-b border-border/60 bg-background/90 px-5 py-2 font-mono text-[11px] text-muted-foreground backdrop-blur",children:[(0,t.jsx)("span",{className:"truncate",children:n}),(0,t.jsx)("span",{className:"shrink-0",children:(0,O.formatBytes)(i.size)})]}),null===i.content?(0,t.jsx)("p",{className:"px-5 py-4 text-sm text-muted-foreground/60",children:"Not a text file — the agent can still read it from disk."}):n.toLowerCase().endsWith(".md")?(0,t.jsx)(G,{content:i.content}):(0,t.jsx)("pre",{className:"overflow-x-auto px-5 py-4 font-mono text-[13px] leading-relaxed whitespace-pre text-foreground/90",children:i.content})]})}function Z(){return C.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(_,{onDone:e})})}function _({onDone:e}){let[s,l]=(0,j.useState)("write"),[i,a]=(0,j.useState)(""),[r,n]=(0,j.useState)(""),[o,d]=(0,j.useState)(""),[c,u]=(0,j.useState)(null),[m,h]=(0,j.useState)(!1),f=(0,j.useRef)(null),p={errorMessage:!1,onOk:()=>{(0,B.revalidate)(k.queryKey.skills),e()}},[g,v,,S]=(0,P.useServerAction)(D,p),[C,z,,F]=(0,P.useServerAction)(q,p),A=v||z,$="write"===s?S:F,K=!A&&("write"===s?i.trim()&&r.trim()&&o.trim():null!==c),U=async()=>{var e;!K||("write"===s?g({name:i.trim(),description:r.trim(),content:o}):c&&C({fileName:c.name,base64:await (e=c,new Promise((t,s)=>{let l=new FileReader;l.onload=()=>{let e=l.result;t(e.slice(e.indexOf(",")+1))},l.onerror=()=>s(l.error),l.readAsDataURL(e)}))}))},I=e=>{let t=e?.[0]??null;t&&u(t)};return(0,t.jsxs)(T.SettingDialogContent,{title:"New skill",description:"Instructions the agent loads by name when a task calls for them.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(y.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(y.Button,{disabled:!K,loading:A,onClick:U,children:[!A&&("write"===s?(0,t.jsx)(x.Plus,{}):(0,t.jsx)(b,{})),"write"===s?"Create":"Upload"]})]}),children:[(0,t.jsxs)(M.Tabs,{value:s,onValueChange:e=>l(e),children:[(0,t.jsxs)(M.TabsList,{className:"w-full",children:[(0,t.jsx)(M.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(M.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(M.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(N.Field,{children:[(0,t.jsx)(N.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(N.FieldContent,{children:[(0,t.jsx)(w.Input,{id:"skill-name",value:i,onChange:e=>a(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[R.PATHS.skills.custom,"/",i.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(N.Field,{children:[(0,t.jsx)(N.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(N.FieldContent,{children:(0,t.jsx)(w.Input,{id:"skill-description",value:r,onChange:e=>n(e.target.value),placeholder:"When to use it — this is how the agent decides to load it"})})]}),(0,t.jsxs)(N.Field,{children:[(0,t.jsx)(N.FieldLabel,{htmlFor:"skill-content",children:"Content"}),(0,t.jsx)(L.Textarea,{id:"skill-content",value:o,onChange:e=>d(e.target.value),placeholder:"Markdown. The steps, the rules, the examples.",className:"min-h-40 resize-none font-mono text-xs"})]})]}),(0,t.jsxs)(M.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>f.current?.click(),onDragOver:e=>{e.preventDefault(),h(!0)},onDragLeave:()=>h(!1),onDrop:e=>{e.preventDefault(),h(!1),I(e.dataTransfer.files)},className:(0,O.cn)("flex w-full flex-col items-center gap-2 rounded-xl border border-dashed px-6 py-10 text-center outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",m?"border-foreground/60 bg-muted/60":"border-border hover:bg-muted/40"),children:[(0,t.jsx)(b,{className:"size-5 text-muted-foreground"}),c?(0,t.jsxs)("span",{className:"text-sm",children:[c.name,(0,t.jsx)("span",{className:"ml-2 font-mono text-[11px] text-muted-foreground",children:(0,O.formatBytes)(c.size)})]}):(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"Drop a file here, or click to choose"})]}),(0,t.jsx)("input",{ref:f,type:"file",accept:".md,.zip,.skill",className:"hidden",onChange:e=>I(e.target.files)}),(0,t.jsxs)("div",{className:"space-y-1 text-xs text-muted-foreground",children:[(0,t.jsx)("p",{className:"font-medium text-foreground/80",children:"File requirements"}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".md"})," file needs a YAML block with the skill's name and description."]}),(0,t.jsxs)("p",{children:["A ",(0,t.jsx)("span",{className:"font-mono",children:".zip"})," or"," ",(0,t.jsx)("span",{className:"font-mono",children:".skill"})," archive needs a SKILL.md inside — the rest of its folder comes along."]})]})]})]}),$&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:$})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,j.useState)(""),{data:l,isLoading:i,error:a}=(0,B.useServerRoute)(k.queryKey.skills),r=l??[];if(i)return(0,t.jsx)(T.SettingSkeleton,{rows:4});if(a)return(0,t.jsx)(T.SettingError,{message:a.message});let n=e.trim().toLowerCase(),o=r.filter(e=>!n||`${e.name} ${e.description}`.toLowerCase().includes(n)),d=r.filter(e=>!e.disabled).length;return(0,t.jsxs)(T.SettingScreen,{footer:(0,t.jsxs)(T.SettingRailNote,{children:[r.filter(e=>"default"===e.source).length," shipped · ",r.filter(e=>"custom"===e.source).length," ","installed"]}),children:[(0,t.jsx)(T.SettingToolbar,{count:`${d} on \xb7 ${r.length-d} off`,children:(0,t.jsx)(T.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(T.SettingGroup,{label:"Custom",hint:"yours — added here · wins a name clash",children:(0,t.jsx)(T.SettingItems,{addRow:{label:"Add skill",onClick:Z},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(I,{skill:e},`custom/${e.dir}`))})}),(0,t.jsx)(T.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(T.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(I,{skill:e},`default/${e.dir}`))})}),d>R.PROMPT_CROWDED.skills&&(0,t.jsxs)(T.SettingNote,{children:[d," skills are on. Each is a line in every prompt a bot reads, and one more to look past when it picks."]})]})}],833959)},437750,e=>{"use strict";var t=e.i(456420);let s={name:"app-window",size:24,node:[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]};s.node;let l=(0,t.default)(s);e.s(["AppWindow",0,l],437750)},726067,e=>{"use strict";var t=e.i(456420);let s={name:"folder",size:24,node:[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]};s.node;let l=(0,t.default)(s);e.s(["Folder",0,l],726067)},759659,e=>{"use strict";var t=e.i(456420);let s={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"]};s.node;let l=(0,t.default)(s);e.s(["Trash2",0,l],759659)}]);
@@ -1,2 +1,2 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),a=e.i(225913);e.i(271645);var r=e.i(647163);function s({className:e,...a}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...a})}e.i(652225);let n=(0,a.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:a="vertical",...s}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,r.cn)(n({orientation:a}),e),...s})},"FieldContent",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...a})},"FieldLabel",0,function({className:e,...a}){return(0,t.jsx)(s,{"data-slot":"field-label",className:(0,r.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...a})}],986530)},556133,e=>{"use strict";var t=e.i(843476),a=e.i(401851),r=e.i(689664),s=e.i(867927),n=e.i(456420);let i={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};i.node;let l=(0,n.default)(i),o={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};o.node;let d=(0,n.default)(o);var c=e.i(77071),u=e.i(759659),m=e.i(263676),h=e.i(271645),f=e.i(798120),p=e.i(167881),x=e.i(986530),g=e.i(23750),v=e.i(917162),b=e.i(671428),j=e.i(127341),y=e.i(184762),k=e.i(41533),N=e.i(968978),S=e.i(265402),w=e.i(670097),C=e.i(640262),z=e.i(96892);let F={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};F.node;let A=(0,n.default)(F);var M=e.i(716327),L=e.i(632781);let R={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};R.node;let T=(0,n.default)(R);var O=e.i(660302),B=e.i(146538),$=e.i(213377),E=e.i(647163);let P=new C.DefaultChatTransport({api:f.queryKey.memoryEdit});function D({notes:e}){let[a,r]=(0,h.useState)(""),[s,n]=(0,h.useState)({provider:null,model:""}),[i,l]=(0,h.useState)(!1),{messages:o,sendMessage:d,setMessages:c,status:u,stop:m,error:f,clearError:x}=(0,w.useChat)({transport:P}),g=(0,h.useRef)(m);g.current=m,(0,h.useEffect)(()=>()=>{g.current()},[]);let v=(0,h.useRef)(new Map);for(let t of e)for(let e of t.facts)v.current.set(e.id,{text:e.text,path:t.path});let b="submitted"===u||"streaming"===u,j=!!(s.provider&&s.model.trim()),y=[...o].reverse().find(e=>"assistant"===e.role),k=y?.parts??[],S=k.filter(C.isToolUIPart),F=k.flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim(),A=!!f||S.some(e=>"output-error"===e.state),L=S.filter(e=>"output-available"===e.state&&(0,C.getToolName)(e)!==$.TOOL_NAMES.memory_recall).length;(0,h.useEffect)(()=>{if("ready"!==u||A||0===o.length)return;let e=setTimeout(()=>c([]),4e3);return()=>clearTimeout(e)},[u,A,o.length,c]);let R=b?(0,t.jsx)(O.ShinyText,{text:"Working on memory",className:"text-xs"}):f?(0,t.jsx)("span",{className:"text-xs text-destructive",children:f.message}):y?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:F||(0===L?"Nothing to change":1===L?"1 change saved":`${L} changes saved`)}):null;return(0,t.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,t.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[i&&(0,t.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,t.jsx)(B.ModelPicker,{provider:s.provider,model:s.model,unset:"Provider",onChange:n})}),S.length>0&&(0,t.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:S.map(e=>(0,t.jsx)(K,{name:(0,C.getToolName)(e),input:e.input,state:e.state,errorText:"output-error"===e.state?e.errorText:void 0,known:v.current},e.toolCallId))}),R&&(0,t.jsx)("p",{className:"max-w-full truncate px-1",children:R}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=a.trim();t&&j&&!b&&(r(""),l(!1),x(),c([]),d({text:t},{body:{model:s}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,t.jsx)("input",{autoFocus:!0,value:a,onChange:e=>r(e.target.value),disabled:b,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,t.jsxs)(p.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>l(!i),className:(0,E.cn)("max-w-44",!j&&"text-muted-foreground"),children:[j&&s.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.ProviderIcon,{provider:s.provider,className:"size-3"}),(0,t.jsx)("span",{className:"truncate",children:s.model})]}):"Model",(0,t.jsx)(M.ChevronDown,{className:"text-muted-foreground"})]}),(0,t.jsx)(p.Button,{type:"submit",size:"icon-sm",loading:b,disabled:!a.trim()||!j||b,"aria-label":"Send",children:!b&&(0,t.jsx)(z.ArrowUp,{})})]})]})})}let I={Remember:c.Plus,Replace:l,Forget:T,Rename:l,Opened:A};function K({name:e,input:a,state:s,errorText:n,known:i}){let l=function(e,t,a){let r=t??{};if(e===$.TOOL_NAMES.memory_recall)return{kind:"Opened",path:r.path??"",lines:[],carried:!1};if(e===$.TOOL_NAMES.memory_forget){let e=(r.factIds??[]).filter(e=>null!=e),t=e.map(e=>a.get(e));return{kind:"Forget",path:t.find(e=>e)?.path??"",lines:e.map((e,a)=>({before:t[a]?.text??`Fact #${e}`})),carried:!1}}let s=(r.facts??[]).filter(e=>null!=e),n=s.map(e=>null!=e.replaces?{before:a.get(e.replaces)?.text??`Fact #${e.replaces}`,after:e.text}:{after:e.text});r.description&&n.push({after:`“${r.description}”`});let i=(r.aliases??[]).filter(Boolean);return i.length&&n.push({after:`Called ${i.map(e=>`“${e}”`).join(", ")}`}),{kind:s.some(e=>null!=e.replaces)?"Replace":s.length?"Remember":"Rename",path:r.path??"",lines:n,carried:s.some(e=>e.alwaysLoad)}}(e,a,i),o=I[l.kind],d="output-error"===s;return(0,t.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,t.jsx)(o,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[l.lines.map((e,a)=>(0,t.jsxs)("div",{children:[e.before&&(0,t.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:e.before}),e.after&&(0,t.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:e.after})]},`${l.kind}-${a}`)),(0,t.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[l.kind,l.path&&` \xb7 ${l.path}`,l.carried&&" · carried into every call"]}),d&&n&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:n})]}),(0,t.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:d?(0,t.jsx)(m.X,{className:"size-3.5 text-destructive"}):"output-available"===s?(0,t.jsx)(r.Check,{className:"size-3.5"}):(0,t.jsx)(L.Loader2,{className:"size-3.5 animate-spin"})})]})}var U=e.i(95187);let q=(0,U.createServerReference)("7f4fac77567cdafd72b2bf6782cd0f611e1897366b",U.callServer,void 0,U.findSourceMapURL,"addFactsAction"),_=(0,U.createServerReference)("7f9fed78e867f7a9a3ca8bbfc84790fafd5e12a986",U.callServer,void 0,U.findSourceMapURL,"createNoteAction"),V=(0,U.createServerReference)("7f217f6d2d5cb353db061b4d9cd1408929c5fa6ba5",U.callServer,void 0,U.findSourceMapURL,"deleteNoteAction"),H=(0,U.createServerReference)("7fad2ce6440b556210deb037b14dd73364d81b4957",U.callServer,void 0,U.findSourceMapURL,"forgetFactAction"),W=(0,U.createServerReference)("7f4e2e121803433ad2955469b7e840169f6e4c5a3b",U.callServer,void 0,U.findSourceMapURL,"reviseFactAction"),X=(0,U.createServerReference)("7fbb6c2fbfc8b1c615464246ac1d2b8652ef96d209",U.callServer,void 0,U.findSourceMapURL,"setFactAlwaysLoadAction"),G=(0,U.createServerReference)("7fc588d108a6ea07a81643dd5c48041111972f952e",U.callServer,void 0,U.findSourceMapURL,"updateNoteAction");var Y=e.i(681307),Z=e.i(245629);let J=Y.z.enum(["user","call","bot"]),Q=Y.z.object({id:Y.z.number(),text:Y.z.string(),alwaysLoad:Y.z.boolean(),source:J.nullish(),createdAt:Z.DateLikeSchema});Y.z.object({id:Y.z.number(),path:Y.z.string(),description:Y.z.string(),aliases:Y.z.string().array().nullish(),ownedByUser:Y.z.boolean(),hits:Y.z.number(),lastReadAt:Z.DateLikeSchema.nullable(),createdAt:Z.DateLikeSchema,updatedAt:Z.DateLikeSchema,factCount:Y.z.number(),facts:Q.array()});let ee=[{path:"profile",of:"The user themselves — their name, age, what they do, where they live, and whatever else says who they are"},{path:"preferences",of:"How they want things done, and said"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],et=ee.filter(e=>!e.path.endsWith("/")).map(e=>e.path),ea=ee.filter(e=>e.path.endsWith("/")).map(e=>e.path.slice(0,-1));RegExp(`^(?:${et.join("|")}|(?:${ea.join("|")})/.+)$`);let er=["profile","preferences"];var es=e.i(895836),en=e.i(609856),ei=e.i(661504),el=e.i(283653);let eo=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ed={onOk:()=>(0,el.revalidate)(f.queryKey.memory)},ec=S.textModelProviderSchema.options.filter(e=>"chatgpt"!==e);function eu(){return(0,t.jsx)("span",{className:"mr-0.5 flex items-center",children:ec.map(e=>(0,t.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,t.jsx)(N.ProviderIcon,{provider:e,className:"size-3"})},e))})}function em(e,t){return a=>{a.nativeEvent.isComposing||229===a.keyCode||("Enter"===a.key&&(a.preventDefault(),e()),"Escape"===a.key&&(a.stopPropagation(),t()))}}function eh({note:e,open:a,onToggle:r}){var n;let i,o,d,c,m,[f,x]=(0,h.useState)(!1),[g,b]=(0,en.useServerAction)(V,ed),j=async()=>{await v.notify.confirm({title:`Forget ${e.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&g(e.id)},y=(0,t.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(i=(n=e.path).indexOf("/"))?n:n.slice(i+1)});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),y,(0,t.jsx)(ef,{note:e,onDone:()=>x(!1)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","aria-expanded":a,onClick:r,className:(0,E.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(o=e.path,!er.includes(o)&&.15>(d=(0,Z.toDate)(e.lastReadAt??e.createdAt),c=Math.max(0,(Date.now()-d.getTime())/864e5),(e.hits+1)/(1+c))&&!a&&"opacity-55")),children:[(0,t.jsx)(s.ChevronRight,{className:(0,E.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")}),y,(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:e.description}),(0,t.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[e.factCount," ",1===e.factCount?"fact":"facts"]}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:e.lastReadAt?"Last read back":"Never read back",children:e.lastReadAt?(0,Z.shortAgo)(e.lastReadAt):"—"})]}),(0,t.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:a&&(0,t.jsxs)(t.Fragment,{children:[(m=e.path,!er.includes(m)&&(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>x(!0),children:(0,t.jsx)(l,{})})),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:b,onClick:j,children:!b&&(0,t.jsx)(u.Trash2,{})})]})})]})}),a&&(0,t.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,t.jsx)(ep,{noteId:e.id}),e.facts.map(a=>(0,t.jsx)(ex,{noteId:e.id,fact:a},a.id))]})]})}function ef({note:e,onDone:a}){let[s,n]=(0,h.useState)(e.description),[i,l]=(0,en.useServerAction)(G,{onOk:()=>{a(),(0,el.revalidate)(f.queryKey.memory)}}),o=()=>{let t=s.trim();if(!t||t===e.description)return a();i(e.id,{description:t})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Input,{autoFocus:!0,value:s,onChange:e=>n(e.target.value),onKeyDown:em(o,a),"aria-label":"The note's line",placeholder:"One line the agent sees in its note list",className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:l,onClick:o,children:!l&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:a,children:(0,t.jsx)(m.X,{})})]})}function ep({noteId:e}){let[a,r]=(0,h.useState)(""),[s,n]=(0,en.useServerAction)(q,{onOk:()=>{r(""),(0,el.revalidate)(f.queryKey.memory)}}),i=()=>{let t=a.trim();t&&!n&&s(e,[t])};return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,t.jsx)(g.Input,{value:a,onChange:e=>r(e.target.value),onKeyDown:em(i,()=>r("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsxs)(p.Button,{size:"sm",variant:"outline",loading:n,disabled:!a.trim(),onClick:i,children:[!n&&(0,t.jsx)(c.Plus,{}),"Add"]})]})}function ex({noteId:e,fact:s}){let n,[i,o]=(0,h.useState)(!1),[c,x]=(0,h.useState)(s.text),[v,b]=(0,en.useServerAction)(W,{onOk:()=>{o(!1),(0,el.revalidate)(f.queryKey.memory)}}),[j,y]=(0,en.useServerAction)(X,ed),[k,N]=(0,en.useServerAction)(H,ed),S=()=>{let t=c.trim();if(!t||t===s.text)return o(!1);v(e,s.id,t)},w="user"===(n=s.source)?"you":"call"===n?"on a call":"bot"===n?"a bot":"";return(0,t.jsxs)("div",{className:"flex min-h-10 items-center gap-1.5",children:[(0,t.jsx)(p.Button,{size:"icon-sm",variant:s.alwaysLoad?"secondary":"ghost","aria-pressed":s.alwaysLoad,"aria-label":s.alwaysLoad?"Stop carrying into calls":"Carry into every call",title:"Carried into every call, without opening this note",loading:y,onClick:()=>j(e,s.id,!s.alwaysLoad),children:!y&&(0,t.jsx)(d,{className:(0,E.cn)(!s.alwaysLoad&&"text-muted-foreground/45")})}),i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Input,{autoFocus:!0,value:c,onChange:e=>x(e.target.value),onKeyDown:em(S,()=>o(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:b,onClick:S,children:!b&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>o(!1),children:(0,t.jsx)(m.X,{})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:s.text}),(0,t.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,a.format)(s.createdAt,"yyyy.MM.dd"),w&&` \xb7 ${w}`]}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{x(s.text),o(!0)},children:(0,t.jsx)(l,{})}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:N,onClick:()=>k(e,s.id),children:!N&&(0,t.jsx)(u.Trash2,{})})]})]})}let eg=[{key:"people",label:"Person",placeholder:"jihoon",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ev(){return v.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(eb,{onDone:e})})}function eb({onDone:e}){let[a,r]=(0,h.useState)("people"),[s,n]=(0,h.useState)(""),[i,l]=(0,h.useState)(""),[o,d]=(0,h.useState)(""),[u,m,,v]=(0,en.useServerAction)(_,{errorMessage:!1,onOk:()=>{(0,el.revalidate)(f.queryKey.memory),e()}}),b=eg.find(e=>e.key===a),k=s.trim()&&i.trim()&&!m,N=()=>{k&&u(`${a}/${s.trim()}`,i.trim(),o.split("\n").map(e=>e.trim()).filter(Boolean))};return(0,t.jsxs)(es.SettingDialogContent,{title:"New note",description:"Where the agent files what it learns about this subject.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(p.Button,{disabled:!k,loading:m,onClick:N,children:[!m&&(0,t.jsx)(c.Plus,{}),"Create"]})]}),children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"Kind"}),(0,t.jsx)(j.Tabs,{value:a,onValueChange:e=>r(e),children:(0,t.jsx)(j.TabsList,{className:"w-full",children:eg.map(e=>(0,t.jsx)(j.TabsTrigger,{value:e.key,children:e.label},e.key))})})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,t.jsxs)(x.FieldContent,{children:[(0,t.jsx)(g.Input,{id:"note-name",value:s,onChange:e=>n(e.target.value),placeholder:b?.placeholder,spellCheck:!1,required:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[a,"/",s.trim()||"…"]})]})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,t.jsx)(x.FieldContent,{children:(0,t.jsx)(g.Input,{id:"note-summary",value:i,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&N(),placeholder:"One line the agent sees in its note list",required:!0})})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,t.jsx)(y.Textarea,{id:"note-facts",value:o,onChange:e=>d(e.target.value),placeholder:`One per line
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,986530,e=>{"use strict";var t=e.i(843476),a=e.i(225913);e.i(271645);var r=e.i(647163);function s({className:e,...a}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...a})}e.i(652225);let n=(0,a.cva)("group/field flex w-full gap-2 data-[invalid=true]:text-destructive",{variants:{orientation:{vertical:"flex-col *:w-full [&>.sr-only]:w-auto",horizontal:"flex-row items-center has-[>[data-slot=field-content]]:items-start *:data-[slot=field-label]:flex-auto has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px",responsive:"flex-col *:w-full @md/field-group:flex-row @md/field-group:items-center @md/field-group:*:w-auto @md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:*:data-[slot=field-label]:flex-auto [&>.sr-only]:w-auto @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"}},defaultVariants:{orientation:"vertical"}});e.s(["Field",0,function({className:e,orientation:a="vertical",...s}){return(0,t.jsx)("div",{role:"group","data-slot":"field","data-orientation":a,className:(0,r.cn)(n({orientation:a}),e),...s})},"FieldContent",0,function({className:e,...a}){return(0,t.jsx)("div",{"data-slot":"field-content",className:(0,r.cn)("group/field-content flex flex-1 flex-col gap-0.5 leading-snug",e),...a})},"FieldLabel",0,function({className:e,...a}){return(0,t.jsx)(s,{"data-slot":"field-label",className:(0,r.cn)("group/field-label peer/field-label flex w-fit gap-2 leading-snug group-data-[disabled=true]/field:opacity-50 has-data-checked:border-primary/30 has-data-checked:bg-primary/5 has-[>[data-slot=field]]:rounded-lg has-[>[data-slot=field]]:border has-[>[data-slot=field]]:not-has-[:disabled,[data-disabled]]:hover:bg-muted/50 has-[>[data-slot=field]]:has-[:focus-visible]:border-ring has-[>[data-slot=field]]:has-[:focus-visible]:ring-3 has-[>[data-slot=field]]:has-[:focus-visible]:ring-ring/50 *:data-[slot=field]:p-2.5 dark:has-data-checked:border-primary/20 dark:has-data-checked:bg-primary/10","has-[>[data-slot=field]]:w-full has-[>[data-slot=field]]:flex-col",e),...a})}],986530)},556133,e=>{"use strict";var t=e.i(843476),a=e.i(401851),r=e.i(689664),s=e.i(867927),n=e.i(456420);let i={name:"pencil",size:24,node:[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]};i.node;let l=(0,n.default)(i),o={name:"pin",size:24,node:[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]};o.node;let d=(0,n.default)(o);var c=e.i(77071),u=e.i(759659),m=e.i(263676),h=e.i(271645),f=e.i(798120),p=e.i(167881),x=e.i(986530),g=e.i(23750),v=e.i(917162),b=e.i(671428),j=e.i(127341),y=e.i(184762),k=e.i(41533),N=e.i(968978),S=e.i(265402),w=e.i(670097),C=e.i(640262),z=e.i(96892);let F={name:"book-open",size:24,node:[["path",{d:"M12 5v16",key:"1f6ucr"}],["path",{d:"M20.001 19A2 2 0 0022 17V5a2 2 0 00-1.999-2L16 3.002A5 5 0 0012 5a5 5 0 00-4-2H4a2 2 0 00-2 2v12a2 2 0 001.999 2H8a5 5 0 014 2 5 5 0 014-2z",key:"1fyvmf"}]]};F.node;let A=(0,n.default)(F);var M=e.i(716327),L=e.i(632781);let R={name:"minus",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}]]};R.node;let T=(0,n.default)(R);var O=e.i(660302),B=e.i(146538),$=e.i(213377),E=e.i(647163);let P=new C.DefaultChatTransport({api:f.queryKey.memoryEdit});function D({notes:e}){let[a,r]=(0,h.useState)(""),[s,n]=(0,h.useState)({provider:null,model:""}),[i,l]=(0,h.useState)(!1),{messages:o,sendMessage:d,setMessages:c,status:u,stop:m,error:f,clearError:x}=(0,w.useChat)({transport:P}),g=(0,h.useRef)(m);g.current=m,(0,h.useEffect)(()=>()=>{g.current()},[]);let v=(0,h.useRef)(new Map);for(let t of e)for(let e of t.facts)v.current.set(e.id,{text:e.text,path:t.path});let b="submitted"===u||"streaming"===u,j=!!(s.provider&&s.model.trim()),y=[...o].reverse().find(e=>"assistant"===e.role),k=y?.parts??[],S=k.filter(C.isToolUIPart),F=k.flatMap(e=>"text"===e.type?[e.text]:[]).join(" ").trim(),A=!!f||S.some(e=>"output-error"===e.state),L=S.filter(e=>"output-available"===e.state&&(0,C.getToolName)(e)!==$.TOOL_NAMES.memory_recall).length;(0,h.useEffect)(()=>{if("ready"!==u||A||0===o.length)return;let e=setTimeout(()=>c([]),4e3);return()=>clearTimeout(e)},[u,A,o.length,c]);let R=b?(0,t.jsx)(O.ShinyText,{text:"Working on memory",className:"text-xs"}):f?(0,t.jsx)("span",{className:"text-xs text-destructive",children:f.message}):y?(0,t.jsx)("span",{className:"text-xs text-muted-foreground",children:F||(0===L?"Nothing to change":1===L?"1 change saved":`${L} changes saved`)}):null;return(0,t.jsx)("div",{className:"pointer-events-none absolute inset-x-0 bottom-18 z-10 flex justify-center px-8",children:(0,t.jsxs)("div",{className:"pointer-events-auto flex w-full max-w-120 flex-col items-center gap-2",children:[i&&(0,t.jsx)("div",{className:"w-full rounded-xl bg-popover p-2 shadow-lg ring-1 ring-foreground/10",children:(0,t.jsx)(B.ModelPicker,{provider:s.provider,model:s.model,unset:"Provider",onChange:n})}),S.length>0&&(0,t.jsx)("ul",{className:"w-full divide-y divide-border/60 overflow-hidden rounded-xl bg-popover shadow-lg ring-1 ring-foreground/10",children:S.map(e=>(0,t.jsx)(K,{name:(0,C.getToolName)(e),input:e.input,state:e.state,errorText:"output-error"===e.state?e.errorText:void 0,known:v.current},e.toolCallId))}),R&&(0,t.jsx)("p",{className:"max-w-full truncate px-1",children:R}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault();let t=a.trim();t&&j&&!b&&(r(""),l(!1),x(),c([]),d({text:t},{body:{model:s}}))},className:"flex h-10 w-full items-center gap-1.5 rounded-xl bg-popover pr-1.5 pl-3.5 shadow-lg ring-1 ring-foreground/10",children:[(0,t.jsx)("input",{autoFocus:!0,value:a,onChange:e=>r(e.target.value),disabled:b,"aria-label":"Edit memory",placeholder:"Tell memory what changed",className:"min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:opacity-60"}),(0,t.jsxs)(p.Button,{type:"button",size:"xs",variant:"ghost",onClick:()=>l(!i),className:(0,E.cn)("max-w-44",!j&&"text-muted-foreground"),children:[j&&s.provider?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(N.ProviderIcon,{provider:s.provider,className:"size-3"}),(0,t.jsx)("span",{className:"truncate",children:s.model})]}):"Model",(0,t.jsx)(M.ChevronDown,{className:"text-muted-foreground"})]}),(0,t.jsx)(p.Button,{type:"submit",size:"icon-sm",loading:b,disabled:!a.trim()||!j||b,"aria-label":"Send",children:!b&&(0,t.jsx)(z.ArrowUp,{})})]})]})})}let I={Remember:c.Plus,Replace:l,Forget:T,Rename:l,Opened:A};function K({name:e,input:a,state:s,errorText:n,known:i}){let l=function(e,t,a){let r=t??{};if(e===$.TOOL_NAMES.memory_recall)return{kind:"Opened",path:r.path??"",lines:[],carried:!1};if(e===$.TOOL_NAMES.memory_forget){let e=(r.factIds??[]).filter(e=>null!=e),t=e.map(e=>a.get(e));return{kind:"Forget",path:t.find(e=>e)?.path??"",lines:e.map((e,a)=>({before:t[a]?.text??`Fact #${e}`})),carried:!1}}let s=(r.facts??[]).filter(e=>null!=e),n=s.map(e=>null!=e.replaces?{before:a.get(e.replaces)?.text??`Fact #${e.replaces}`,after:e.text}:{after:e.text});r.description&&n.push({after:`“${r.description}”`});let i=(r.aliases??[]).filter(Boolean);return i.length&&n.push({after:`Called ${i.map(e=>`“${e}”`).join(", ")}`}),{kind:s.some(e=>null!=e.replaces)?"Replace":s.length?"Remember":"Rename",path:r.path??"",lines:n,carried:s.some(e=>e.alwaysLoad)}}(e,a,i),o=I[l.kind],d="output-error"===s;return(0,t.jsxs)("li",{className:"flex animate-in items-start gap-2.5 px-3 py-2.5 duration-200 fade-in slide-in-from-bottom-1",children:[(0,t.jsx)(o,{className:"mt-1 size-3.5 shrink-0 text-muted-foreground"}),(0,t.jsxs)("div",{className:"min-w-0 flex-1 space-y-0.5",children:[l.lines.map((e,a)=>(0,t.jsxs)("div",{children:[e.before&&(0,t.jsx)("p",{className:"text-[13px] leading-5 text-muted-foreground/60 line-through",children:e.before}),e.after&&(0,t.jsx)("p",{className:"text-sm leading-5 text-foreground/90",children:e.after})]},`${l.kind}-${a}`)),(0,t.jsxs)("p",{className:"pt-0.5 font-mono text-[11px] text-muted-foreground",children:[l.kind,l.path&&` \xb7 ${l.path}`,l.carried&&" · carried into every call"]}),d&&n&&(0,t.jsx)("p",{className:"text-xs text-destructive",children:n})]}),(0,t.jsx)("span",{className:"mt-0.5 flex size-5 shrink-0 items-center justify-center text-muted-foreground",children:d?(0,t.jsx)(m.X,{className:"size-3.5 text-destructive"}):"output-available"===s?(0,t.jsx)(r.Check,{className:"size-3.5"}):(0,t.jsx)(L.Loader2,{className:"size-3.5 animate-spin"})})]})}var U=e.i(95187);let q=(0,U.createServerReference)("7f0971ae6f804e41d67f1025aa120d5aae7b54122d",U.callServer,void 0,U.findSourceMapURL,"addFactsAction"),_=(0,U.createServerReference)("7f613c3180e5ebe6d59ccfdb49ca64857370285950",U.callServer,void 0,U.findSourceMapURL,"createNoteAction"),V=(0,U.createServerReference)("7f0cae0b4f090c99dc36fb2f27c0fa185ea70396d5",U.callServer,void 0,U.findSourceMapURL,"deleteNoteAction"),H=(0,U.createServerReference)("7fc84c5e9af8ab7c523daaf9bbcacce53b587a4eae",U.callServer,void 0,U.findSourceMapURL,"forgetFactAction"),W=(0,U.createServerReference)("7f53dfd755ddd439971369bb94a70c6eb12e46535a",U.callServer,void 0,U.findSourceMapURL,"reviseFactAction"),X=(0,U.createServerReference)("7f8a5abfc7504ee1eb38c762125d4ee3e7a62002b8",U.callServer,void 0,U.findSourceMapURL,"setFactAlwaysLoadAction"),G=(0,U.createServerReference)("7f3167c5fbd04ab35ebd4b0e96777d21c1fcbe437d",U.callServer,void 0,U.findSourceMapURL,"updateNoteAction");var Y=e.i(681307),Z=e.i(245629);let J=Y.z.enum(["user","call","bot"]),Q=Y.z.object({id:Y.z.number(),text:Y.z.string(),alwaysLoad:Y.z.boolean(),source:J.nullish(),createdAt:Z.DateLikeSchema});Y.z.object({id:Y.z.number(),path:Y.z.string(),description:Y.z.string(),aliases:Y.z.string().array().nullish(),ownedByUser:Y.z.boolean(),hits:Y.z.number(),lastReadAt:Z.DateLikeSchema.nullable(),createdAt:Z.DateLikeSchema,updatedAt:Z.DateLikeSchema,factCount:Y.z.number(),facts:Q.array()});let ee=[{path:"profile",of:"The user themselves — their name, age, what they do, where they live, and whatever else says who they are"},{path:"preferences",of:"How they want things done, and said"},{path:"people/",of:"Someone in their life, and what matters about them"},{path:"projects/",of:"Something with an end — a trip, a purchase, a deadline, a thing being built"},{path:"topics/",of:"Something ongoing that keeps coming back"}],et=ee.filter(e=>!e.path.endsWith("/")).map(e=>e.path),ea=ee.filter(e=>e.path.endsWith("/")).map(e=>e.path.slice(0,-1));RegExp(`^(?:${et.join("|")}|(?:${ea.join("|")})/.+)$`);let er=["profile","preferences"];var es=e.i(895836),en=e.i(609856),ei=e.i(661504),el=e.i(283653);let eo=[{key:"you",label:"You"},{key:"people",label:"People"},{key:"projects",label:"Projects"},{key:"topics",label:"Topics"},{key:"other",label:"Other"}],ed={onOk:()=>(0,el.revalidate)(f.queryKey.memory)},ec=S.textModelProviderSchema.options.filter(e=>"chatgpt"!==e);function eu(){return(0,t.jsx)("span",{className:"mr-0.5 flex items-center",children:ec.map(e=>(0,t.jsx)("span",{className:"-ml-1.5 grid size-5 place-items-center rounded-full bg-background ring-1 ring-border first:ml-0",children:(0,t.jsx)(N.ProviderIcon,{provider:e,className:"size-3"})},e))})}function em(e,t){return a=>{a.nativeEvent.isComposing||229===a.keyCode||("Enter"===a.key&&(a.preventDefault(),e()),"Escape"===a.key&&(a.stopPropagation(),t()))}}function eh({note:e,open:a,onToggle:r}){var n;let i,o,d,c,m,[f,x]=(0,h.useState)(!1),[g,b]=(0,en.useServerAction)(V,ed),j=async()=>{await v.notify.confirm({title:`Forget ${e.path}?`,description:"Every fact in this note is deleted for good.",okText:"Delete",destructive:!0})&&g(e.id)},y=(0,t.jsx)("span",{className:"w-36 shrink-0 truncate text-sm font-medium",children:-1===(i=(n=e.path).indexOf("/"))?n:n.slice(i+1)});return(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex h-12 items-center gap-3 pr-2 pl-4",children:f?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(s.ChevronRight,{className:"size-3.5 shrink-0 rotate-90 text-muted-foreground"}),y,(0,t.jsx)(ef,{note:e,onDone:()=>x(!1)})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("button",{type:"button","aria-expanded":a,onClick:r,className:(0,E.cn)("flex h-full min-w-0 flex-1 items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",(o=e.path,!er.includes(o)&&.15>(d=(0,Z.toDate)(e.lastReadAt??e.createdAt),c=Math.max(0,(Date.now()-d.getTime())/864e5),(e.hits+1)/(1+c))&&!a&&"opacity-55")),children:[(0,t.jsx)(s.ChevronRight,{className:(0,E.cn)("size-3.5 shrink-0 text-muted-foreground transition-transform",a&&"rotate-90")}),y,(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px] text-muted-foreground",children:e.description}),(0,t.jsxs)("span",{className:"w-16 shrink-0 text-right font-mono text-[11px] text-muted-foreground/70",children:[e.factCount," ",1===e.factCount?"fact":"facts"]}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground/50",title:e.lastReadAt?"Last read back":"Never read back",children:e.lastReadAt?(0,Z.shortAgo)(e.lastReadAt):"—"})]}),(0,t.jsx)("span",{className:"flex w-15 shrink-0 justify-end",children:a&&(0,t.jsxs)(t.Fragment,{children:[(m=e.path,!er.includes(m)&&(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit the note's line",onClick:()=>x(!0),children:(0,t.jsx)(l,{})})),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this note",loading:b,onClick:j,children:!b&&(0,t.jsx)(u.Trash2,{})})]})})]})}),a&&(0,t.jsxs)("div",{className:"space-y-1 border-t border-border/60 bg-muted/40 py-2.5 pr-2 pl-10",children:[(0,t.jsx)(ep,{noteId:e.id}),e.facts.map(a=>(0,t.jsx)(ex,{noteId:e.id,fact:a},a.id))]})]})}function ef({note:e,onDone:a}){let[s,n]=(0,h.useState)(e.description),[i,l]=(0,en.useServerAction)(G,{onOk:()=>{a(),(0,el.revalidate)(f.queryKey.memory)}}),o=()=>{let t=s.trim();if(!t||t===e.description)return a();i(e.id,{description:t})};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Input,{autoFocus:!0,value:s,onChange:e=>n(e.target.value),onKeyDown:em(o,a),"aria-label":"The note's line",placeholder:"One line the agent sees in its note list",className:"h-8 min-w-0 flex-1 text-[13px]"}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:l,onClick:o,children:!l&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:a,children:(0,t.jsx)(m.X,{})})]})}function ep({noteId:e}){let[a,r]=(0,h.useState)(""),[s,n]=(0,en.useServerAction)(q,{onOk:()=>{r(""),(0,el.revalidate)(f.queryKey.memory)}}),i=()=>{let t=a.trim();t&&!n&&s(e,[t])};return(0,t.jsxs)("div",{className:"flex items-center gap-1.5 pb-1",children:[(0,t.jsx)(g.Input,{value:a,onChange:e=>r(e.target.value),onKeyDown:em(i,()=>r("")),"aria-label":"Add a fact",placeholder:"Add a fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsxs)(p.Button,{size:"sm",variant:"outline",loading:n,disabled:!a.trim(),onClick:i,children:[!n&&(0,t.jsx)(c.Plus,{}),"Add"]})]})}function ex({noteId:e,fact:s}){let n,[i,o]=(0,h.useState)(!1),[c,x]=(0,h.useState)(s.text),[v,b]=(0,en.useServerAction)(W,{onOk:()=>{o(!1),(0,el.revalidate)(f.queryKey.memory)}}),[j,y]=(0,en.useServerAction)(X,ed),[k,N]=(0,en.useServerAction)(H,ed),S=()=>{let t=c.trim();if(!t||t===s.text)return o(!1);v(e,s.id,t)},w="user"===(n=s.source)?"you":"call"===n?"on a call":"bot"===n?"a bot":"";return(0,t.jsxs)("div",{className:"flex min-h-10 items-center gap-1.5",children:[(0,t.jsx)(p.Button,{size:"icon-sm",variant:s.alwaysLoad?"secondary":"ghost","aria-pressed":s.alwaysLoad,"aria-label":s.alwaysLoad?"Stop carrying into calls":"Carry into every call",title:"Carried into every call, without opening this note",loading:y,onClick:()=>j(e,s.id,!s.alwaysLoad),children:!y&&(0,t.jsx)(d,{className:(0,E.cn)(!s.alwaysLoad&&"text-muted-foreground/45")})}),i?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g.Input,{autoFocus:!0,value:c,onChange:e=>x(e.target.value),onKeyDown:em(S,()=>o(!1)),"aria-label":"Fact",className:"h-8 min-w-0 flex-1 bg-background text-sm"}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Save",loading:b,onClick:S,children:!b&&(0,t.jsx)(r.Check,{})}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost","aria-label":"Cancel",onClick:()=>o(!1),children:(0,t.jsx)(m.X,{})})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"min-w-0 flex-1 pl-1 text-sm leading-relaxed text-foreground/90",children:s.text}),(0,t.jsxs)("span",{className:"shrink-0 pr-1 font-mono text-[11px] text-muted-foreground/50",children:[(0,a.format)(s.createdAt,"yyyy.MM.dd"),w&&` \xb7 ${w}`]}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Edit this fact",onClick:()=>{x(s.text),o(!0)},children:(0,t.jsx)(l,{})}),(0,t.jsx)(p.Button,{size:"icon-sm",variant:"ghost",className:"text-muted-foreground","aria-label":"Forget this fact",loading:N,onClick:()=>k(e,s.id),children:!N&&(0,t.jsx)(u.Trash2,{})})]})]})}let eg=[{key:"people",label:"Person",placeholder:"jihoon",fact:"Moved to the platform team in March"},{key:"projects",label:"Project",placeholder:"thursday",fact:"Ships behind a feature flag until April"},{key:"topics",label:"Topic",placeholder:"scheduling",fact:"No meetings before 10am"}];function ev(){return v.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(eb,{onDone:e})})}function eb({onDone:e}){let[a,r]=(0,h.useState)("people"),[s,n]=(0,h.useState)(""),[i,l]=(0,h.useState)(""),[o,d]=(0,h.useState)(""),[u,m,,v]=(0,en.useServerAction)(_,{errorMessage:!1,onOk:()=>{(0,el.revalidate)(f.queryKey.memory),e()}}),b=eg.find(e=>e.key===a),k=s.trim()&&i.trim()&&!m,N=()=>{k&&u(`${a}/${s.trim()}`,i.trim(),o.split("\n").map(e=>e.trim()).filter(Boolean))};return(0,t.jsxs)(es.SettingDialogContent,{title:"New note",description:"Where the agent files what it learns about this subject.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(p.Button,{disabled:!k,loading:m,onClick:N,children:[!m&&(0,t.jsx)(c.Plus,{}),"Create"]})]}),children:[(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{children:"Kind"}),(0,t.jsx)(j.Tabs,{value:a,onValueChange:e=>r(e),children:(0,t.jsx)(j.TabsList,{className:"w-full",children:eg.map(e=>(0,t.jsx)(j.TabsTrigger,{value:e.key,children:e.label},e.key))})})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{htmlFor:"note-name",children:"Name"}),(0,t.jsxs)(x.FieldContent,{children:[(0,t.jsx)(g.Input,{id:"note-name",value:s,onChange:e=>n(e.target.value),placeholder:b?.placeholder,spellCheck:!1,required:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[a,"/",s.trim()||"…"]})]})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{htmlFor:"note-summary",children:"Summary"}),(0,t.jsx)(x.FieldContent,{children:(0,t.jsx)(g.Input,{id:"note-summary",value:i,onChange:e=>l(e.target.value),onKeyDown:e=>"Enter"===e.key&&N(),placeholder:"One line the agent sees in its note list",required:!0})})]}),(0,t.jsxs)(x.Field,{children:[(0,t.jsx)(x.FieldLabel,{htmlFor:"note-facts",children:"Facts"}),(0,t.jsx)(y.Textarea,{id:"note-facts",value:o,onChange:e=>d(e.target.value),placeholder:`One per line
2
2
  ${b?.fact??""}`,className:"min-h-24 resize-none text-sm"})]})]}),v&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:v})]})}e.s(["MemorySetting",0,function(){let{items:e,isLoading:a,isLoadingMore:r,error:s,hasMore:n,sentinelRef:i}=(0,ei.useServerPages)({key:e=>f.queryKey.memoryPage(e*k.PAGE_SIZE)}),[l,o]=(0,h.useState)(""),[d,u]=(0,h.useState)(new Set),[m,x]=(0,h.useState)(!1);if(a)return(0,t.jsx)(es.SettingSkeleton,{});if(s)return(0,t.jsx)(es.SettingError,{message:s.message});let g=l.trim().toLowerCase(),v=g?e.filter(e=>[e.path,e.description,...e.aliases??[],...e.facts.map(e=>e.text)].some(e=>e.toLowerCase().includes(g))):e,j=e.reduce((e,t)=>e+t.factCount,0),y=e.reduce((e,t)=>e+t.facts.filter(e=>e.alwaysLoad).length,0),N=n?"+":"";return(0,t.jsxs)("div",{className:"relative h-full min-h-0",children:[(0,t.jsxs)(es.SettingScreen,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(es.SettingRailNote,{children:(0,t.jsxs)("span",{className:"font-mono",children:[y," of ",k.MEMORY_LIMITS.carried," carried into every call"]})}),(0,t.jsxs)(p.Button,{size:"sm",variant:m?"secondary":"ghost","aria-pressed":m,onClick:()=>x(!m),children:[(0,t.jsx)(eu,{}),"Edit with a model"]})]}),children:[(0,t.jsx)(es.SettingToolbar,{count:(0,t.jsxs)("span",{className:"flex items-center gap-3",children:[`${e.length}${N} notes \xb7 ${j}${N} facts`,(0,t.jsxs)(p.Button,{size:"sm",variant:"outline",className:"font-sans",onClick:ev,children:[(0,t.jsx)(c.Plus,{}),"New note"]})]}),children:(0,t.jsx)(es.SettingFilter,{value:l,onChange:o,placeholder:"Filter memory"})}),g&&0===v.length&&(0,t.jsx)("p",{className:"px-1 text-xs text-muted-foreground/60",children:"Nothing matches"}),eo.map(({key:e,label:a})=>{let r=v.filter(t=>(function(e){if("profile"===e||"preferences"===e)return"you";let t=e.slice(0,e.indexOf("/"));return ea.includes(t)?t:"other"})(t.path)===e);return 0===r.length?null:(0,t.jsx)(es.SettingGroup,{label:a,children:(0,t.jsx)(es.SettingItems,{children:r.map(e=>(0,t.jsx)(eh,{note:e,open:d.has(e.id)!==!!g,onToggle:()=>{let t;return t=e.id,u(e=>{let a=new Set(e);return a.delete(t)||a.add(t),a})}},e.id))})},e)}),(0,t.jsx)(es.SettingMore,{hasMore:n,loading:r,sentinelRef:i,ghost:(0,t.jsxs)("div",{className:"flex h-12 items-center gap-3 px-4",children:[(0,t.jsx)(b.Skeleton,{className:"h-3 w-24"}),(0,t.jsx)(b.Skeleton,{className:"h-3 w-56"})]})})]}),m&&(0,t.jsx)(D,{notes:e})]})}],556133)},759659,e=>{"use strict";var t=e.i(456420);let a={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"]};a.node;let r=(0,t.default)(a);e.s(["Trash2",0,r],759659)}]);
@@ -1,3 +1,3 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,496336,e=>{"use strict";var t=e.i(843476),n=e.i(716327),a=e.i(271645),s=e.i(647163);e.s(["FoldedText",0,function({text:e,subject:r,clamp:i="line-clamp-3",tall:o="max-h-40",className:l}){let[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),x=(0,a.useRef)(null);return(0,a.useEffect)(()=>c(!1),[e]),(0,a.useEffect)(()=>{let e=x.current;e&&!d&&m(e.scrollHeight>e.clientHeight+1)},[d,e]),(0,t.jsxs)("div",{className:(0,s.cn)("flex items-start gap-1",l),children:[(0,t.jsx)("p",{ref:x,className:(0,s.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",d?(0,s.cn)(o,"overflow-y-auto scrollbar-none"):i),children:e}),(u||d)&&(0,t.jsx)("button",{type:"button",onClick:()=>c(e=>!e),"aria-label":d?`Fold the ${r}`:`Read the whole ${r}`,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,t.jsx)(n.ChevronDown,{className:(0,s.cn)("size-3.5",d&&"rotate-180")})})]})}])},835878,e=>{"use strict";var t=e.i(843476),n=e.i(635963);e.s(["BotRoster",0,function({bots:e}){return e.length<2?null:(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,t.jsx)("span",{className:"flex items-center gap-0.5",children:e.slice(0,3).map(e=>(0,t.jsx)(n.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,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}])},351866,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(689664),s=e.i(716327),r=e.i(24071),i=e.i(51481),o=e.i(508734),l=e.i(919191),d=e.i(632781),c=e.i(825398),u=e.i(263676),m=e.i(271645),x=e.i(815731),p=e.i(496336),b=e.i(683408),h=e.i(660302),f=e.i(127341),g=e.i(6799),k=e.i(95187);let j=(0,k.createServerReference)("7f220551c6465300b702969a592872219cbd5034ef",k.callServer,void 0,k.findSourceMapURL,"compactThreadAction");var v=e.i(807038),w=e.i(635963),y=e.i(256604),N=e.i(621285),S=e.i(245629),z=e.i(609856),C=e.i(647163),T=e.i(553429),_=e.i(978411),M=e.i(222055);function B({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)(u.X,{className:"size-3.5"})})}function $({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A,{thread:e}),(0,t.jsx)(R,{thread:e}),(0,t.jsx)(I,{thread:e})]})}function A({thread:e}){let{contextTokens:n,tokens:a}=e;return n?(0,t.jsx)("span",{title:`Last step ${(0,C.formatCount)(n)} tokens \xb7 in total in ${(0,C.formatCount)(a.input)} \xb7 out ${(0,C.formatCount)(a.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,C.formatCount)(n)}):null}function R({thread:e}){let{contextTokens:n,contextBudget:a}=e,[s,r]=(0,m.useState)(!1),[i,o]=(0,z.useServerAction)(j,{onOk:()=>r(!0)});if((0,m.useEffect)(()=>r(!1),[n]),!n||!a)return null;let l=Math.min(1,n/a);return(0,t.jsx)("button",{type:"button",disabled:o||s,onClick:()=>void i(e.id,e.bot.name).catch(()=>{}),title:s?"It summarizes itself at its next step":`Context ${(0,C.formatCount)(n)} of ${(0,C.formatCount)(a)} — it summarizes itself at the end of the bar. Press to have it do so at its next step`,"aria-label":"Summarize this thread's context at its next step",className:"-my-2 flex h-6 shrink-0 items-center rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:(0,t.jsx)("span",{className:"block h-[3px] w-9 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,C.cn)("block h-full rounded-full",s?"animate-pulse bg-muted-foreground/40":l>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*l))}%`}})})})}let D={working:"text-muted-foreground",waiting:C.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"};function I({thread:e}){let n="done"===e.status&&e.seen?"text-muted-foreground":D[e.status];return"working"===e.status?(0,t.jsx)(h.ShinyText,{text:"working",speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,C.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:e.status})}function F({thread:e,roster:n,side:a,onPick:s,className:r}){return(0,t.jsx)(f.Tabs,{value:a??e.bot.name,onValueChange:t=>s(t===e.bot.name?null:String(t)),className:(0,C.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",r),children:(0,t.jsx)(f.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=q(e,n.name);return(0,t.jsxs)(f.TabsTrigger,{value:n.name,className:(0,C.cn)(L,"pl-1.5"),children:[(0,t.jsx)(w.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)(d.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},n.name)})})})}let L="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 q(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 E({turn:e,thread:n,self:a}){let s=e.speaker.name===a,r=s?"none":e.speaker.name===Q.name?"dark":"secondary",i=null;return(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(Z,{side:s?"start":"end",name:e.speaker.name,mark:(0,t.jsx)(Y,{bot:e.speaker}),children:e.entries.map(o=>{if("work"===o.kind)return s?(0,t.jsx)(K,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key):(0,t.jsx)(O,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key);let l=(0,_.heardBy)(o.line),d=l&&l.name!==e.speaker.name&&l.name!==a&&l.name!==Q.name&&l.name!==i?l:null;return l&&(i=l.name),(0,t.jsx)(ee,{line:o.line,surface:r,mention:d},o.key)})})})}function O({lines:e,trailing:n,bot:a,thread:s}){var r;let[i,o]=(0,m.useState)(!1),[l,c]=(0,m.useState)(null),u=n?q(s,a.name):null,x=(r=e,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([e,t])=>[r.filter(t=>t.kind===e).length,t]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}${1===e?"":"s"}`).join(" · ")),p=e.filter(e=>e.tool?.results!==void 0);if(!u&&!x)return null;let b=e.findLast(e=>"tool"===e.kind||"say"===e.kind),f=i&&e.length>0;return(0,t.jsxs)("div",{className:(0,C.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",f?"w-full":"w-fit max-w-full"),children:[(0,t.jsxs)("button",{type:"button",disabled:!e.length,"aria-expanded":f,onClick:()=>{o(e=>!e),c(null)},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"===u&&(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),u?(0,t.jsx)(h.ShinyText,{text:"asking"===u?"waiting on you":b?G(b):"working",tone:"asking"===u?"waiting":"muted",speed:2.4,className:"min-w-0 truncate text-[12px] leading-4"}):(0,t.jsx)(U,{words:b?G(b):"",facts:[x,function(e){let t=e.flatMap(e=>e.at?[(0,S.toDate)(e.at).getTime()]:[]);if(t.length<2)return"";let n=Math.round((Math.max(...t)-Math.min(...t))/1e3);if(n<1)return"";if(n<60)return`${n}s`;let a=Math.round(n/60);return a<60?`${a} min`:`${Math.floor(a/60)}h ${a%60}m`}(e)].filter(Boolean).join(" · ")}),e.length>0&&(0,t.jsx)(H,{open:f})]}),!f&&p.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1 px-2 pt-0.5 pb-1.5",children:p.map(e=>e.tool&&(0,t.jsx)(M.StepTile,{tool:e.tool,onOpen:()=>{c(e.id),o(!0)}},e.id))}),f&&(0,t.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:ed(e).map(e=>"tools"===e.kind?e.lines.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:s.id,collapsed:e.id!==l},e.id)):"stops"===e.kind?(0,t.jsx)("div",{className:"px-1.5 py-1",children:(0,t.jsx)(eo,{lines:e.lines})},e.key):e.lines.map(e=>(0,t.jsx)(er,{line:e,inset:!0},e.id)))})]})}function K({lines:e,trailing:n,bot:a,thread:s}){let r=n?q(s,a.name):null,i=e.some(e=>e.tool&&void 0===e.tool.results);return(0,t.jsxs)(t.Fragment,{children:[ed(e).map(e=>"tools"===e.kind?(0,t.jsx)(P,{lines:e.lines,threadId:s.id},e.key):"stops"===e.kind?(0,t.jsx)(eo,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(er,{line:e},e.id))),r&&!i&&(0,t.jsx)(h.ShinyText,{text:"asking"===r?"waiting on you":"on the next step…",tone:"asking"===r?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function P({lines:e,threadId:n}){return(0,t.jsx)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:e.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:n,collapsed:!0},e.id))})}function U({words:e,facts:n,grow:a=!1}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,C.cn)("min-w-0 truncate text-[12.5px] leading-5 text-foreground/80",a&&"flex-1"),children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] leading-4 text-muted-foreground",children:n})]})}function H({open:e}){return(0,t.jsx)("span",{className:"grid size-5.5 shrink-0 place-items-center rounded-md bg-background text-muted-foreground ring-1 ring-border/60",children:(0,t.jsx)(s.ChevronDown,{className:(0,C.cn)("size-3.5 transition-transform",e&&"rotate-180")})})}function G(e){return"tool"===e.kind&&e.tool?e.tool.note??`${e.tool.name} \xb7 ${e.tool.input}`:(0,C.plainText)(e.text).replace(/\s+/g," ").trim()}function V({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W,{from:Q,to:e.bot}),(0,t.jsx)(Z,{side:"end",name:Q.name,mark:(0,t.jsx)(Y,{bot:Q}),children:(0,t.jsx)(J,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,t.jsx)(p.FoldedText,{text:e.request,subject:"request",className:"wrap-anywhere"})})})]})}let Q={name:T.ROOM_THURSDAY};function W({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)(X,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(X,{bot:n})]})})}function X({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.name===Q.name?(0,t.jsx)(y.ThursdayMark,{size:15,className:"shrink-0"}):(0,t.jsx)(w.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 Y({bot:e}){return e.name===Q.name?(0,t.jsx)(y.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,t.jsx)(w.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 J({dark:e=!1,children:n,className:a}){return(0,t.jsx)(x.Bubble,{align:"end",variant:e?"default":"secondary",className:"max-w-full",children:(0,t.jsx)(x.BubbleContent,{className:(0,C.cn)("rounded-tr-md px-3.5",a),children:(0,t.jsx)("div",{className:(0,C.cn)("min-w-0",e&&"inverse"),children:n})})})}function Z({side:e,mark:n,name:a,children:s}){return(0,t.jsxs)("div",{className:(0,C.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,C.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 ee({line:e,surface:n,mention:a}){let s=!!e.question,r="result"===e.kind,i="none"!==n,o=(0,v.shortenPaths)(e.text),d=(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(es,{}),a?(0,t.jsx)(ea,{bot:a,bubble:i,children:o}):(0,t.jsx)(et,{bubble:i,className:(0,C.cn)(!r&&"leading-snug"),children:o}),(0,t.jsx)(v.Attachments,{text:e.text,onBubble:i,className:"mt-2"})]});return(0,t.jsxs)(t.Fragment,{children:[i?(0,t.jsx)(J,{dark:"dark"===n,children:d}):(0,t.jsx)("div",{className:"min-w-0 max-w-full px-1",children:d}),e.steppedIn&&(0,t.jsxs)("p",{className:"flex items-center gap-1 px-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(l.CornerDownLeft,{className:"size-2.5"}),"stepped in"]}),r&&(0,t.jsx)("div",{className:"flex px-1",children:(0,t.jsx)(ei,{text:e.text})})]})}function et({children:e,bubble:n=!1,className:a}){return(0,t.jsx)(b.Markdown,{className:(0,C.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 en({bot:e,bubble:n}){return(0,t.jsxs)("span",{className:(0,C.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)(w.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 ea({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)(en,{bot:e,bubble:n}),(0,t.jsx)(et,{bubble:n,className:"contents leading-snug [&>p:first-child]:inline",children:a})]})}function es(){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)(i.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function er({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)(et,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:e.text})]}):(0,t.jsx)(et,{className:(0,C.cn)("text-[12.5px] text-muted-foreground",n?"px-2.5 py-1":"px-1"),children:e.text})}function ei({text:e}){let[n,s]=(0,m.useState)(!1),r=(0,m.useRef)(null);return(0,m.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),s(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>s(!1),1400)}catch(e){g.toast.add({type:"error",title:"Could not copy the answer",description:(0,C.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)(a.Check,{className:"size-3"}):(0,t.jsx)(o.Copy,{className:"size-3"})})}function eo({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)(c.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:el(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)(s.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,S.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let el=e=>e.split(" (")[0].replace(/\.$/,"");function ed(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||el(a.lines[0].text)===el(n.text));a&&s?a.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t}e.s(["Conversation",0,function({thread:e,tab:n=null,onTab:a,className:s,tabsClassName:r}){let i,o=(0,m.useRef)(null),l=(0,m.useRef)(!0),d=(0,_.rosterOf)(e),c=a&&n!==e.bot.name&&d.some(e=>e.name===n)?n:null,u=c??e.bot.name,x=d.filter(t=>(!c||t.name===c)&&q(e,t.name)),p=(0,_.threadItems)((i=new Set(e.room.questions.map(e=>`${e.bot}
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,496336,e=>{"use strict";var t=e.i(843476),n=e.i(716327),a=e.i(271645),s=e.i(647163);e.s(["FoldedText",0,function({text:e,subject:r,clamp:i="line-clamp-3",tall:o="max-h-40",className:l}){let[d,c]=(0,a.useState)(!1),[u,m]=(0,a.useState)(!1),x=(0,a.useRef)(null);return(0,a.useEffect)(()=>c(!1),[e]),(0,a.useEffect)(()=>{let e=x.current;e&&!d&&m(e.scrollHeight>e.clientHeight+1)},[d,e]),(0,t.jsxs)("div",{className:(0,s.cn)("flex items-start gap-1",l),children:[(0,t.jsx)("p",{ref:x,className:(0,s.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",d?(0,s.cn)(o,"overflow-y-auto scrollbar-none"):i),children:e}),(u||d)&&(0,t.jsx)("button",{type:"button",onClick:()=>c(e=>!e),"aria-label":d?`Fold the ${r}`:`Read the whole ${r}`,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,t.jsx)(n.ChevronDown,{className:(0,s.cn)("size-3.5",d&&"rotate-180")})})]})}])},835878,e=>{"use strict";var t=e.i(843476),n=e.i(635963);e.s(["BotRoster",0,function({bots:e}){return e.length<2?null:(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,t.jsx)("span",{className:"flex items-center gap-0.5",children:e.slice(0,3).map(e=>(0,t.jsx)(n.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,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}])},351866,e=>{"use strict";var t=e.i(843476),n=e.i(401851),a=e.i(689664),s=e.i(716327),r=e.i(24071),i=e.i(51481),o=e.i(508734),l=e.i(919191),d=e.i(632781),c=e.i(825398),u=e.i(263676),m=e.i(271645),x=e.i(815731),p=e.i(496336),b=e.i(683408),f=e.i(660302),h=e.i(127341),g=e.i(6799),k=e.i(95187);let j=(0,k.createServerReference)("7fa79f2b94e5e145ca0dbb9f3ef82067e0f2b003fa",k.callServer,void 0,k.findSourceMapURL,"compactThreadAction");var v=e.i(807038),w=e.i(635963),y=e.i(256604),N=e.i(621285),S=e.i(245629),z=e.i(609856),C=e.i(647163),T=e.i(553429),_=e.i(978411),M=e.i(222055);function B({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)(u.X,{className:"size-3.5"})})}function $({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(A,{thread:e}),(0,t.jsx)(R,{thread:e}),(0,t.jsx)(I,{thread:e})]})}function A({thread:e}){let{contextTokens:n,tokens:a}=e;return n?(0,t.jsx)("span",{title:`Last step ${(0,C.formatCount)(n)} tokens \xb7 in total in ${(0,C.formatCount)(a.input)} \xb7 out ${(0,C.formatCount)(a.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,C.formatCount)(n)}):null}function R({thread:e}){let{contextTokens:n,contextBudget:a}=e,[s,r]=(0,m.useState)(!1),[i,o]=(0,z.useServerAction)(j,{onOk:()=>r(!0)});if((0,m.useEffect)(()=>r(!1),[n]),!n||!a)return null;let l=Math.min(1,n/a);return(0,t.jsx)("button",{type:"button",disabled:o||s,onClick:()=>void i(e.id,e.bot.name).catch(()=>{}),title:s?"It summarizes itself at its next step":`Context ${(0,C.formatCount)(n)} of ${(0,C.formatCount)(a)} — it summarizes itself at the end of the bar. Press to have it do so at its next step`,"aria-label":"Summarize this thread's context at its next step",className:"-my-2 flex h-6 shrink-0 items-center rounded-sm outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:(0,t.jsx)("span",{className:"block h-[3px] w-9 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,C.cn)("block h-full rounded-full",s?"animate-pulse bg-muted-foreground/40":l>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*l))}%`}})})})}let D={working:"text-muted-foreground",waiting:C.WAITING_INK,done:"text-foreground",cancelled:"text-muted-foreground"};function I({thread:e}){let n="done"===e.status&&e.seen?"text-muted-foreground":D[e.status];return"working"===e.status?(0,t.jsx)(f.ShinyText,{text:"working",speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,C.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:e.status})}function F({thread:e,roster:n,side:a,onPick:s,className:r}){return(0,t.jsx)(h.Tabs,{value:a??e.bot.name,onValueChange:t=>s(t===e.bot.name?null:String(t)),className:(0,C.cn)("shrink-0 gap-0 px-3 pt-1 pb-0.5",r),children:(0,t.jsx)(h.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=q(e,n.name);return(0,t.jsxs)(h.TabsTrigger,{value:n.name,className:(0,C.cn)(L,"pl-1.5"),children:[(0,t.jsx)(w.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)(d.Loader2,{className:"size-3 animate-spin text-muted-foreground/70"})]},n.name)})})})}let L="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 q(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 E({turn:e,thread:n,self:a}){let s=e.speaker.name===a,r=s?"none":e.speaker.name===Q.name?"dark":"secondary",i=null;return(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(Z,{side:s?"start":"end",name:e.speaker.name,mark:(0,t.jsx)(Y,{bot:e.speaker}),children:e.entries.map(o=>{if("work"===o.kind)return s?(0,t.jsx)(K,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key):(0,t.jsx)(O,{lines:o.lines,trailing:o.open,bot:e.speaker,thread:n},o.key);let l=(0,_.heardBy)(o.line),d=l&&l.name!==e.speaker.name&&l.name!==a&&l.name!==Q.name&&l.name!==i?l:null;return l&&(i=l.name),(0,t.jsx)(ee,{line:o.line,surface:r,mention:d},o.key)})})})}function O({lines:e,trailing:n,bot:a,thread:s}){var r;let[i,o]=(0,m.useState)(!1),[l,c]=(0,m.useState)(null),u=n?q(s,a.name):null,x=(r=e,[["tool","step"],["say","note"],["stop","stop"],["note","compaction"]].map(([e,t])=>[r.filter(t=>t.kind===e).length,t]).filter(([e])=>e>0).map(([e,t])=>`${e} ${t}${1===e?"":"s"}`).join(" · ")),p=e.filter(e=>e.tool?.results!==void 0);if(!u&&!x)return null;let b=e.findLast(e=>"tool"===e.kind||"say"===e.kind),h=i&&e.length>0;return(0,t.jsxs)("div",{className:(0,C.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 p-1",h?"w-full":"w-fit max-w-full"),children:[(0,t.jsxs)("button",{type:"button",disabled:!e.length,"aria-expanded":h,onClick:()=>{o(e=>!e),c(null)},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"===u&&(0,t.jsx)(d.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/60"}),u?(0,t.jsx)(f.ShinyText,{text:"asking"===u?"waiting on you":b?G(b):"working",tone:"asking"===u?"waiting":"muted",speed:2.4,className:"min-w-0 truncate text-[12px] leading-4"}):(0,t.jsx)(U,{words:b?G(b):"",facts:[x,function(e){let t=e.flatMap(e=>e.at?[(0,S.toDate)(e.at).getTime()]:[]);if(t.length<2)return"";let n=Math.round((Math.max(...t)-Math.min(...t))/1e3);if(n<1)return"";if(n<60)return`${n}s`;let a=Math.round(n/60);return a<60?`${a} min`:`${Math.floor(a/60)}h ${a%60}m`}(e)].filter(Boolean).join(" · ")}),e.length>0&&(0,t.jsx)(H,{open:h})]}),!h&&p.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-1 px-2 pt-0.5 pb-1.5",children:p.map(e=>e.tool&&(0,t.jsx)(M.StepTile,{tool:e.tool,onOpen:()=>{c(e.id),o(!0)}},e.id))}),h&&(0,t.jsx)("div",{className:"flex min-w-0 flex-col gap-0.5 pt-0.5",children:ed(e).map(e=>"tools"===e.kind?e.lines.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:s.id,collapsed:e.id!==l},e.id)):"stops"===e.kind?(0,t.jsx)("div",{className:"px-1.5 py-1",children:(0,t.jsx)(eo,{lines:e.lines})},e.key):e.lines.map(e=>(0,t.jsx)(er,{line:e,inset:!0},e.id)))})]})}function K({lines:e,trailing:n,bot:a,thread:s}){let r=n?q(s,a.name):null,i=e.some(e=>e.tool&&void 0===e.tool.results);return(0,t.jsxs)(t.Fragment,{children:[ed(e).map(e=>"tools"===e.kind?(0,t.jsx)(P,{lines:e.lines,threadId:s.id},e.key):"stops"===e.kind?(0,t.jsx)(eo,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(er,{line:e},e.id))),r&&!i&&(0,t.jsx)(f.ShinyText,{text:"asking"===r?"waiting on you":"on the next step…",tone:"asking"===r?"waiting":"muted",speed:2.2,className:"block px-1 font-mono text-[10px]"})]})}function P({lines:e,threadId:n}){return(0,t.jsx)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:e.map(e=>e.tool&&(0,t.jsx)(M.BotTool,{tool:e.tool,threadId:n,collapsed:!0},e.id))})}function U({words:e,facts:n,grow:a=!1}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:(0,C.cn)("min-w-0 truncate text-[12.5px] leading-5 text-foreground/80",a&&"flex-1"),children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] leading-4 text-muted-foreground",children:n})]})}function H({open:e}){return(0,t.jsx)("span",{className:"grid size-5.5 shrink-0 place-items-center rounded-md bg-background text-muted-foreground ring-1 ring-border/60",children:(0,t.jsx)(s.ChevronDown,{className:(0,C.cn)("size-3.5 transition-transform",e&&"rotate-180")})})}function G(e){return"tool"===e.kind&&e.tool?e.tool.note??`${e.tool.name} \xb7 ${e.tool.input}`:(0,C.plainText)(e.text).replace(/\s+/g," ").trim()}function V({thread:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(W,{from:Q,to:e.bot}),(0,t.jsx)(Z,{side:"end",name:Q.name,mark:(0,t.jsx)(Y,{bot:Q}),children:(0,t.jsx)(J,{dark:!0,className:"py-2 pr-2 pl-3.5",children:(0,t.jsx)(p.FoldedText,{text:e.request,subject:"request",className:"wrap-anywhere"})})})]})}let Q={name:T.ROOM_THURSDAY};function W({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)(X,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(X,{bot:n})]})})}function X({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[e.name===Q.name?(0,t.jsx)(y.ThursdayMark,{size:15,className:"shrink-0"}):(0,t.jsx)(w.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 Y({bot:e}){return e.name===Q.name?(0,t.jsx)(y.ThursdayMark,{size:26,className:"mt-1 shrink-0"}):(0,t.jsx)(w.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 J({dark:e=!1,children:n,className:a}){return(0,t.jsx)(x.Bubble,{align:"end",variant:e?"default":"secondary",className:"max-w-full",children:(0,t.jsx)(x.BubbleContent,{className:(0,C.cn)("rounded-tr-md px-3.5",a),children:(0,t.jsx)("div",{className:(0,C.cn)("min-w-0",e&&"inverse"),children:n})})})}function Z({side:e,mark:n,name:a,children:s}){return(0,t.jsxs)("div",{className:(0,C.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,C.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 ee({line:e,surface:n,mention:a}){let s=!!e.question,r="result"===e.kind,i="none"!==n,o=(0,v.shortenPaths)(e.text),d=(0,t.jsxs)(t.Fragment,{children:[s&&(0,t.jsx)(es,{}),a?(0,t.jsx)(ea,{bot:a,bubble:i,children:o}):(0,t.jsx)(et,{bubble:i,className:(0,C.cn)(!r&&"leading-snug"),children:o}),(0,t.jsx)(v.Attachments,{text:e.text,onBubble:i,className:"mt-2"})]});return(0,t.jsxs)(t.Fragment,{children:[i?(0,t.jsx)(J,{dark:"dark"===n,children:d}):(0,t.jsx)("div",{className:"min-w-0 max-w-full px-1",children:d}),e.steppedIn&&(0,t.jsxs)("p",{className:"flex items-center gap-1 px-1 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)(l.CornerDownLeft,{className:"size-2.5"}),"stepped in"]}),r&&(0,t.jsx)("div",{className:"flex px-1",children:(0,t.jsx)(ei,{text:e.text})})]})}function et({children:e,bubble:n=!1,className:a}){return(0,t.jsx)(b.Markdown,{className:(0,C.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 en({bot:e,bubble:n}){return(0,t.jsxs)("span",{className:(0,C.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)(w.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 ea({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)(en,{bot:e,bubble:n}),(0,t.jsx)(et,{bubble:n,className:"contents leading-snug [&>p:first-child]:inline",children:a})]})}function es(){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)(i.CircleQuestionMark,{className:"size-3.5 shrink-0"}),"Question"]})}function er({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)(et,{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px]",children:e.text})]}):(0,t.jsx)(et,{className:(0,C.cn)("text-[12.5px] text-muted-foreground",n?"px-2.5 py-1":"px-1"),children:e.text})}function ei({text:e}){let[n,s]=(0,m.useState)(!1),r=(0,m.useRef)(null);return(0,m.useEffect)(()=>()=>{r.current&&clearTimeout(r.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),s(!0),r.current&&clearTimeout(r.current),r.current=setTimeout(()=>s(!1),1400)}catch(e){g.toast.add({type:"error",title:"Could not copy the answer",description:(0,C.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)(a.Check,{className:"size-3"}):(0,t.jsx)(o.Copy,{className:"size-3"})})}function eo({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)(c.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:el(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)(s.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,S.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let el=e=>e.split(" (")[0].replace(/\.$/,"");function ed(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||el(a.lines[0].text)===el(n.text));a&&s?a.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t}e.s(["Conversation",0,function({thread:e,tab:n=null,onTab:a,className:s,tabsClassName:r}){let i,o=(0,m.useRef)(null),l=(0,m.useRef)(!0),d=(0,_.rosterOf)(e),c=a&&n!==e.bot.name&&d.some(e=>e.name===n)?n:null,u=c??e.bot.name,x=d.filter(t=>(!c||t.name===c)&&q(e,t.name)),p=(0,_.threadItems)((i=new Set(e.room.questions.map(e=>`${e.bot}
2
2
  ${e.text.trim()}`))).size?{...e,lines:e.lines.filter(e=>!("ask"===e.kind&&e.question&&e.to?.name===Q.name&&i.has(`${e.bot.name}
3
- ${e.text.trim()}`)))}:e,u,x);return(0,m.useEffect)(()=>{l.current=!0},[e.id,c]),(0,m.useEffect)(()=>{let e=o.current;e&&l.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status,c]),(0,t.jsxs)(N.FileViewer,{children:[a&&(0,t.jsx)(F,{thread:e,roster:d,side:c,onPick:a,className:r}),(0,t.jsxs)("div",{ref:o,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,C.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)(V,{thread:e}),p.map(n=>"invite"===n.kind?(0,t.jsx)(W,{from:n.from,to:n.to},n.key):(0,t.jsx)(E,{turn:n,thread:e,self:u},n.key))]})]})},"FoldButton",0,B,"TAB",0,L,"THURSDAY",0,Q,"ThreadFacts",0,$,"ThreadHeader",0,function({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)(r.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(w.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)($,{thread:e}),(0,t.jsx)(B,{onClick:a})]})},"leadOf",0,el,"stepOf",0,G],351866)},399512,709190,e=>{"use strict";var t=e.i(843476),n=e.i(96892),a=e.i(716327),s=e.i(24071),r=e.i(867927),i=e.i(931619),o=e.i(919191),l=e.i(632781),d=e.i(64801),c=e.i(929272),u=e.i(263676),m=e.i(271645),x=e.i(798120),p=e.i(167881),b=e.i(463415),h=e.i(496336),f=e.i(683408),g=e.i(660302),k=e.i(184762),j=e.i(904703),v=e.i(729332),w=e.i(95187);let y=(0,w.createServerReference)("7f602f8df658c6da8793cc42bb16430f601e506677",w.callServer,void 0,w.findSourceMapURL,"withdrawStepInAction");var N=e.i(451888),S=e.i(635963),z=e.i(978411),C=e.i(609856),T=e.i(283653),_=e.i(984837);function M({bot:e,onAllowed:n}){let{data:a}=(0,T.useServerRoute)(x.queryKey.signIns),[s,r]=(0,C.useServerAction)(_.setSignInBotAction,{onOk:()=>(0,T.revalidate)(x.queryKey.signIns)}),i=(a??[]).filter(t=>t.asking.includes(e));return i.length?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(a=>(0,t.jsxs)(p.Button,{type:"button",size:"sm",loading:r,onClick:()=>void s(a.site,e,!0).then(()=>n(`Yes — you may use my ${a.site} sign-in.`)).catch(()=>{}),children:["Let ",e," use ",a.site," (",a.account,")"]},a.site))}):null}var B=e.i(6799),$=e.i(41533),A=e.i(83928);let R=(0,w.createServerReference)("7f3a23a9c29546de657b8c739534fd79f8e75f6d47",w.callServer,void 0,w.findSourceMapURL,"giveFilesAction");var D=e.i(647163);function I(e){let t=(0,m.useRef)(e?.onKept);t.current=e?.onKept;let[n,a]=(0,m.useState)([]),[s]=(0,C.useServerAction)(R),r=(0,m.useCallback)(async e=>{let r=$.GIVEN_FILES.perMessage-n.length;e.length>r&&B.toast.add({type:"error",title:`At most ${$.GIVEN_FILES.perMessage} files at a time.`});let i=e.slice(0,Math.max(0,r));if(!i.length)return;let o=i.map(e=>({key:crypto.randomUUID(),name:e.name,bytes:e.size,path:null}));a(e=>[...e,...o]);let l=new FormData;for(let e of i)l.append("file",e);try{let e=await s(l),n=t.current?.(e);a(t=>t.map(t=>{let a=o.findIndex(e=>e.key===t.key);return a<0?t:{...t,path:e[a]??null,note:n}}))}catch{a(e=>e.filter(e=>!o.some(t=>t.key===e.key)))}},[n.length,s]);return{files:n,take:r,remove:e=>a(t=>t.filter(t=>t.key!==e)),clear:()=>a([]),arriving:n.some(e=>null===e.path),withPaths:e=>[e.trim(),...n.flatMap(e=>e.path??[])].filter(Boolean).join("\n")}}function F({files:e,onRemove:n,dense:a=!1,children:s,className:r}){let i=a?"size-8 rounded-lg":"size-10 rounded-[9px]";return(0,t.jsxs)("div",{className:(0,D.cn)("flex flex-wrap gap-1.5",r),children:[e.map(e=>(0,t.jsxs)("span",{className:(0,D.cn)("flex max-w-64 items-center bg-muted/70",a?"h-10.5 gap-2 rounded-xl py-1 pr-1.5 pl-1":"h-13 gap-2.5 rounded-[14px] py-1.5 pr-2 pl-1.5"),children:[e.path?(0,t.jsx)(A.FileThumb,{path:e.path,bytes:e.bytes,className:(0,D.cn)("shrink-0 overflow-hidden ring-1 ring-foreground/6",i)}):(0,t.jsx)("span",{className:(0,D.cn)("grid shrink-0 place-items-center bg-background text-muted-foreground ring-1 ring-foreground/6",i),children:(0,t.jsx)(l.Loader2,{className:"size-3.5 animate-spin"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,t.jsx)("span",{className:(0,D.cn)("truncate",a?"text-xs leading-4":"text-[12.5px] leading-4.5"),children:e.name}),(0,t.jsxs)("span",{className:"font-mono text-[10px] leading-3.5 text-muted-foreground",children:[E(e.bytes),e.note&&` \xb7 ${e.note}`]})]}),(0,t.jsx)("button",{type:"button","aria-label":`Take ${e.name} out`,onClick:()=>n(e.key),className:"grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(u.X,{className:"size-3.5"})})]},e.key)),s]})}let L=null,q={claim:e=>(L=e,()=>{L===e&&(L=null)}),offer:(e,t)=>!!L&&!!e?.closest?.("[data-room]")&&(L(t),!0)},E=e=>e<1048576?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`;function O({className:e,children:n}){return(0,t.jsx)("div",{className:(0,D.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 K({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)(G,{bot:e,size:16})}),(0,t.jsx)("span",{className:(0,D.cn)("truncate text-[12px] leading-4 font-medium",D.WAITING_INK),children:n}),a]})}function P({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)(p.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===N.THREAD_CONTINUE&&n!==e&&(0,t.jsx)(i.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))})}function U({threadId:e,recipient:a,draftKey:s,send:r,busy:i,placeholder:o,label:c,autoFocus:u=!1,onEscape:x,leading:b,trailing:h,className:f}){let[g,j]=(0,m.useState)(()=>z.threadDrafts.get(e,a,s)),[v,w]=(0,m.useState)(!1),y=t=>{j(t),z.threadDrafts.set(e,a,t,s)},N=I(),S=(0,m.useRef)(null),{take:C}=N;(0,m.useEffect)(()=>q.claim(e=>void C(e)),[C]);let T=!!g.trim()&&!i&&!N.arriving,_=async()=>{T&&(w(!0),await r(N.withPaths(g))&&(y(""),N.clear()),w(!1))};return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),_()},className:(0,D.cn)("flex min-w-0 flex-wrap items-end gap-1",f),children:[N.files.length>0&&(0,t.jsx)(F,{dense:!0,files:N.files,onRemove:N.remove,className:"w-full pb-1"}),b,(0,t.jsx)(k.Textarea,{value:g,rows:1,disabled:i,autoFocus:u,onChange:e=>y(e.target.value),onPaste:e=>{let t=[...e.clipboardData.files];t.length&&(e.preventDefault(),C(t))},onKeyDown:e=>{"Escape"===e.key&&x?x():"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),_())},placeholder:o,"aria-label":c,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"}),(0,t.jsx)("input",{ref:S,type:"file",multiple:!0,hidden:!0,onChange:e=>{C([...e.target.files??[]]),e.target.value=""}}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:i,"aria-label":"Add files",onClick:()=>S.current?.click(),className:"rounded-full text-muted-foreground",children:(0,t.jsx)(d.Paperclip,{})}),h,(0,t.jsx)(p.Button,{type:"submit",size:"icon-sm",variant:T?"default":"ghost",disabled:!T,"aria-label":"Send",className:"rounded-full",children:v?(0,t.jsx)(l.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]})}function H({current:e,bots:n,disabled:s,onPick:r}){return(0,t.jsxs)(b.DropdownMenu,{children:[(0,t.jsxs)(b.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",disabled:s,"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)(G,{bot:e,size:14}),(0,t.jsx)("span",{className:"max-w-32 truncate",children:e.name}),(0,t.jsx)(a.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(b.DropdownMenuContent,{align:"start",children:(0,t.jsx)(b.DropdownMenuGroup,{children:n.map(e=>(0,t.jsxs)(b.DropdownMenuItem,{onClick:()=>r(e.name),children:[(0,t.jsx)(G,{bot:e,size:16}),e.name]},e.name))})})]})}function G({bot:e,size:n}){return(0,t.jsx)(S.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 V(){let[e,t]=(0,C.useServerAction)(j.answerThreadAction,{onOk:()=>(0,T.revalidate)(x.queryKey.threads)});return[async(t,n,a,s)=>{let r=n.trim();if(!r)return!1;try{let n=await e(t.id,r,a,s);return z.screenActs.announce({kind:"answered",id:n.id,label:n.label,answer:r,recipient:a,replyTo:s}),!0}catch{return!1}},t]}e.s(["GivenFiles",0,F,"roomDrop",0,q,"useGivenFiles",0,I],709190),e.s(["ThreadReply",0,function({thread:e,status:n,faces:a=[],to:i=null,className:d}){let[b,k]=(0,m.useState)(),[j,w]=(0,m.useState)(()=>z.threadDrafts.recipient(e.id)??e.bot),[S,_]=(0,m.useState)(!1),[B,$]=(0,m.useState)(null);(0,m.useEffect)(()=>{w(z.threadDrafts.recipient(e.id)??e.bot),k(void 0),_(!1)},[e.id,e.bot]),(0,m.useEffect)(()=>{i&&(z.threadDrafts.select(e.id,i),w(i))},[e.id,i]);let A=e.room.participants,R=e.room.questions,I=Math.max(0,R.findIndex(e=>e.id===b)),F=R[I],L="waiting"===n?e.ask:null,q=(0,N.isAppStop)(L),E=F?.bot??(A.some(e=>e.bot===j)?j:e.bot),G=F?.id,[Q,W]=V(),[X,Y]=(0,C.useServerAction)(v.cancelThreadAction,{onOk:e=>{(0,T.revalidate)(x.queryKey.threads),z.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),J=W||Y,Z=e.room.deliveries.filter(e=>!e.delivered),[ee,et]=(0,C.useServerAction)(y,{onOk:()=>(0,T.revalidate)(x.queryKey.threads)}),en=Z.map(e=>`${e.bot}: ${e.text}`).join(" · "),ea=A.filter(e=>"running"===e.state).map(e=>e.bot).join(", ")||e.bot,es=e=>a.find(t=>t.name===e)??{name:e},er=async t=>{if(J)return!1;let a=await Q(e,t,E,G);return a&&"running"===n&&_(!1),a},ei=async e=>{$(e),await er(e),$(null)},eo="running"===n||"waiting"===n?(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:J,onClick:()=>X(e.id),"aria-label":"Stop this thread",title:"Stop this thread",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:Y?(0,t.jsx)(l.Loader2,{className:"animate-spin"}):(0,t.jsx)(c.Square,{className:"size-3"})}):null;if(F){let n=F.options??[],a=F.text;return(0,t.jsxs)(O,{className:d,children:[(0,t.jsx)(K,{bot:es(E),word:"Question",children:R.length>1&&(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:J||0===I,onClick:()=>k(R[I-1].id),children:(0,t.jsx)(s.ChevronLeft,{})}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[I+1," / ",R.length]}),(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:J||I===R.length-1,onClick:()=>k(R[I+1].id),children:(0,t.jsx)(r.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)(f.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)(P,{options:n,picked:B,busy:J,onChoose:ei}),(0,t.jsx)(M,{bot:E,onAllowed:er}),(0,t.jsx)(U,{threadId:e.id,recipient:E,draftKey:F.id,send:er,busy:J,placeholder:n.length?"Or write your own answer…":"Your answer…",label:`Answer for ${E}`,trailing:eo},JSON.stringify([e.id,E,F.id]))]})}return q?(0,t.jsxs)(O,{className:d,children:[(0,t.jsx)(K,{bot:es(e.bot),word:"Paused"}),L?.question&&(0,t.jsx)(h.FoldedText,{text:L.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,t.jsx)(P,{options:L?.options.length?L.options:[N.THREAD_CONTINUE],picked:B,busy:J,onChoose:ei}),(0,t.jsx)(U,{threadId:e.id,recipient:E,send:er,busy:J,placeholder:"Or put it another way…",label:`Message for ${E}`,trailing:eo},JSON.stringify([e.id,E,"paused"]))]}):"running"!==n||S?(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col gap-1.5",d),children:[(0,t.jsx)(U,{threadId:e.id,recipient:E,send:er,busy:J,autoFocus:"running"===n,onEscape:"running"===n?()=>_(!1):void 0,placeholder:"running"===n?`What's off? ${E} reads this before its next step`:"Anything more? It picks up where it left off",label:`Message for ${E}`,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:A.length>1?(0,t.jsx)(H,{current:es(E),bots:A.map(e=>es(e.bot)),disabled:J,onPick:t=>{z.threadDrafts.select(e.id,t),w(t)}}):null,trailing:"running"===n?(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:J,onClick:()=>_(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(u.X,{})}):null},JSON.stringify([e.id,E])),!!en&&"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)(l.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsxs)("span",{className:"truncate",children:["Sending to ",en]})]})]}):(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 ring-1 ring-border/50",d),children:[Z.map(n=>(0,t.jsxs)("div",{className:"flex items-start gap-2 border-border/60 border-b py-2.5 pr-1.5 pl-3.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[10px] leading-4",children:[(0,t.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}),(0,t.jsx)(g.ShinyText,{text:`Step-in \xb7 waits for ${n.bot}'s next step`,speed:2.2,className:"min-w-0 truncate"})]}),(0,t.jsx)("p",{className:"whitespace-pre-wrap break-keep text-[13px] leading-snug",children:n.text})]}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:et,onClick:()=>ee(e.id,n.id),"aria-label":"Take it back",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:(0,t.jsx)(u.X,{})})]},n.id)),(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1.5 pr-1.5 pl-3.5",children:[(0,t.jsx)(g.ShinyText,{text:`${ea} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",disabled:J,onClick:()=>_(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(o.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),eo]})]})},"useAnswerThread",0,V],399512)},904703,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f739178d6588f6d545722472bf51e3c2df3138fb8",t.callServer,void 0,t.findSourceMapURL,"answerThreadAction");e.s(["answerThreadAction",0,n])},729332,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f79944ad9ee07a58b4b5d000d35c8c560c7a10a19",t.callServer,void 0,t.findSourceMapURL,"cancelThreadAction");e.s(["cancelThreadAction",0,n])},931619,e=>{"use strict";var t=e.i(456420);let n={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"}]]};n.node;let a=(0,t.default)(n);e.s(["ChevronsRight",0,a],931619)},51481,e=>{"use strict";var t=e.i(456420);let n={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"]};n.node;let a=(0,t.default)(n);e.s(["CircleQuestionMark",0,a],51481)},919191,e=>{"use strict";var t=e.i(456420);let n={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"}]]};n.node;let a=(0,t.default)(n);e.s(["CornerDownLeft",0,a],919191)},64801,e=>{"use strict";var t=e.i(456420);let n={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};n.node;let a=(0,t.default)(n);e.s(["Paperclip",0,a],64801)},825398,815731,e=>{"use strict";var t=e.i(456420);let n={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"}]]};n.node;let a=(0,t.default)(n);e.s(["RotateCw",0,a],825398);var s=e.i(843476),r=e.i(176782),i=e.i(552245),o=e.i(225913),l=e.i(647163);let d=(0,o.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,o.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,s.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,l.cn)(d({variant:e}),n),...a})},"BubbleContent",0,function({className:e,render:t,...n}){var a;return a={defaultTagName:"div",props:(0,r.mergeProps)({className:(0,l.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,i.useRenderElement)(a.defaultTagName??"div",a,a)}],815731)},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)}]);
3
+ ${e.text.trim()}`)))}:e,u,x);return(0,m.useEffect)(()=>{l.current=!0},[e.id,c]),(0,m.useEffect)(()=>{let e=o.current;e&&l.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status,c]),(0,t.jsxs)(N.FileViewer,{children:[a&&(0,t.jsx)(F,{thread:e,roster:d,side:c,onPick:a,className:r}),(0,t.jsxs)("div",{ref:o,onScroll:e=>{let t=e.currentTarget;l.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,C.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)(V,{thread:e}),p.map(n=>"invite"===n.kind?(0,t.jsx)(W,{from:n.from,to:n.to},n.key):(0,t.jsx)(E,{turn:n,thread:e,self:u},n.key))]})]})},"FoldButton",0,B,"TAB",0,L,"THURSDAY",0,Q,"ThreadFacts",0,$,"ThreadHeader",0,function({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)(r.ChevronLeft,{className:"size-4"})}),(0,t.jsx)(w.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)($,{thread:e}),(0,t.jsx)(B,{onClick:a})]})},"leadOf",0,el,"stepOf",0,G],351866)},399512,709190,e=>{"use strict";var t=e.i(843476),n=e.i(96892),a=e.i(716327),s=e.i(24071),r=e.i(867927),i=e.i(931619),o=e.i(919191),l=e.i(632781),d=e.i(64801),c=e.i(929272),u=e.i(263676),m=e.i(271645),x=e.i(798120),p=e.i(167881),b=e.i(463415),f=e.i(496336),h=e.i(683408),g=e.i(660302),k=e.i(184762),j=e.i(633840),v=e.i(248473),w=e.i(95187);let y=(0,w.createServerReference)("7f846c3a9b71e5f3c1e3d53451fc7114df90e1437e",w.callServer,void 0,w.findSourceMapURL,"withdrawStepInAction");var N=e.i(451888),S=e.i(635963),z=e.i(978411),C=e.i(609856),T=e.i(283653),_=e.i(696801);function M({bot:e,onAllowed:n}){let{data:a}=(0,T.useServerRoute)(x.queryKey.signIns),[s,r]=(0,C.useServerAction)(_.setSignInBotAction,{onOk:()=>(0,T.revalidate)(x.queryKey.signIns)}),i=(a??[]).filter(t=>t.asking.includes(e));return i.length?(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:i.map(a=>(0,t.jsxs)(p.Button,{type:"button",size:"sm",loading:r,onClick:()=>void s(a.site,e,!0).then(()=>n(`Yes — you may use my ${a.site} sign-in.`)).catch(()=>{}),children:["Let ",e," use ",a.site," (",a.account,")"]},a.site))}):null}var B=e.i(6799),$=e.i(41533),A=e.i(83928);let R=(0,w.createServerReference)("7f1c15fbadd646f804b60c10d0fe95367e29335f86",w.callServer,void 0,w.findSourceMapURL,"giveFilesAction");var D=e.i(647163);function I(e){let t=(0,m.useRef)(e?.onKept);t.current=e?.onKept;let[n,a]=(0,m.useState)([]),[s]=(0,C.useServerAction)(R),r=(0,m.useCallback)(async e=>{let r=$.GIVEN_FILES.perMessage-n.length;e.length>r&&B.toast.add({type:"error",title:`At most ${$.GIVEN_FILES.perMessage} files at a time.`});let i=e.slice(0,Math.max(0,r));if(!i.length)return;let o=i.map(e=>({key:crypto.randomUUID(),name:e.name,bytes:e.size,path:null}));a(e=>[...e,...o]);let l=new FormData;for(let e of i)l.append("file",e);try{let e=await s(l),n=t.current?.(e);a(t=>t.map(t=>{let a=o.findIndex(e=>e.key===t.key);return a<0?t:{...t,path:e[a]??null,note:n}}))}catch{a(e=>e.filter(e=>!o.some(t=>t.key===e.key)))}},[n.length,s]);return{files:n,take:r,remove:e=>a(t=>t.filter(t=>t.key!==e)),clear:()=>a([]),arriving:n.some(e=>null===e.path),withPaths:e=>[e.trim(),...n.flatMap(e=>e.path??[])].filter(Boolean).join("\n")}}function F({files:e,onRemove:n,dense:a=!1,children:s,className:r}){let i=a?"size-8 rounded-lg":"size-10 rounded-[9px]";return(0,t.jsxs)("div",{className:(0,D.cn)("flex flex-wrap gap-1.5",r),children:[e.map(e=>(0,t.jsxs)("span",{className:(0,D.cn)("flex max-w-64 items-center bg-muted/70",a?"h-10.5 gap-2 rounded-xl py-1 pr-1.5 pl-1":"h-13 gap-2.5 rounded-[14px] py-1.5 pr-2 pl-1.5"),children:[e.path?(0,t.jsx)(A.FileThumb,{path:e.path,bytes:e.bytes,className:(0,D.cn)("shrink-0 overflow-hidden ring-1 ring-foreground/6",i)}):(0,t.jsx)("span",{className:(0,D.cn)("grid shrink-0 place-items-center bg-background text-muted-foreground ring-1 ring-foreground/6",i),children:(0,t.jsx)(l.Loader2,{className:"size-3.5 animate-spin"})}),(0,t.jsxs)("span",{className:"flex min-w-0 flex-col",children:[(0,t.jsx)("span",{className:(0,D.cn)("truncate",a?"text-xs leading-4":"text-[12.5px] leading-4.5"),children:e.name}),(0,t.jsxs)("span",{className:"font-mono text-[10px] leading-3.5 text-muted-foreground",children:[E(e.bytes),e.note&&` \xb7 ${e.note}`]})]}),(0,t.jsx)("button",{type:"button","aria-label":`Take ${e.name} out`,onClick:()=>n(e.key),className:"grid size-5 shrink-0 place-items-center rounded-full text-muted-foreground outline-none hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(u.X,{className:"size-3.5"})})]},e.key)),s]})}let L=null,q={claim:e=>(L=e,()=>{L===e&&(L=null)}),offer:(e,t)=>!!L&&!!e?.closest?.("[data-room]")&&(L(t),!0)},E=e=>e<1048576?`${Math.max(1,Math.round(e/1024))} KB`:`${(e/1024/1024).toFixed(1)} MB`;function O({className:e,children:n}){return(0,t.jsx)("div",{className:(0,D.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 K({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)(G,{bot:e,size:16})}),(0,t.jsx)("span",{className:(0,D.cn)("truncate text-[12px] leading-4 font-medium",D.WAITING_INK),children:n}),a]})}function P({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)(p.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===N.THREAD_CONTINUE&&n!==e&&(0,t.jsx)(i.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))})}function U({threadId:e,recipient:a,draftKey:s,send:r,busy:i,placeholder:o,label:c,autoFocus:u=!1,onEscape:x,leading:b,trailing:f,className:h}){let[g,j]=(0,m.useState)(()=>z.threadDrafts.get(e,a,s)),[v,w]=(0,m.useState)(!1),y=t=>{j(t),z.threadDrafts.set(e,a,t,s)},N=I(),S=(0,m.useRef)(null),{take:C}=N;(0,m.useEffect)(()=>q.claim(e=>void C(e)),[C]);let T=!!g.trim()&&!i&&!N.arriving,_=async()=>{T&&(w(!0),await r(N.withPaths(g))&&(y(""),N.clear()),w(!1))};return(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),_()},className:(0,D.cn)("flex min-w-0 flex-wrap items-end gap-1",h),children:[N.files.length>0&&(0,t.jsx)(F,{dense:!0,files:N.files,onRemove:N.remove,className:"w-full pb-1"}),b,(0,t.jsx)(k.Textarea,{value:g,rows:1,disabled:i,autoFocus:u,onChange:e=>y(e.target.value),onPaste:e=>{let t=[...e.clipboardData.files];t.length&&(e.preventDefault(),C(t))},onKeyDown:e=>{"Escape"===e.key&&x?x():"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),_())},placeholder:o,"aria-label":c,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"}),(0,t.jsx)("input",{ref:S,type:"file",multiple:!0,hidden:!0,onChange:e=>{C([...e.target.files??[]]),e.target.value=""}}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:i,"aria-label":"Add files",onClick:()=>S.current?.click(),className:"rounded-full text-muted-foreground",children:(0,t.jsx)(d.Paperclip,{})}),f,(0,t.jsx)(p.Button,{type:"submit",size:"icon-sm",variant:T?"default":"ghost",disabled:!T,"aria-label":"Send",className:"rounded-full",children:v?(0,t.jsx)(l.Loader2,{className:"animate-spin"}):(0,t.jsx)(n.ArrowUp,{})})]})}function H({current:e,bots:n,disabled:s,onPick:r}){return(0,t.jsxs)(b.DropdownMenu,{children:[(0,t.jsxs)(b.DropdownMenuTrigger,{render:(0,t.jsx)("button",{type:"button",disabled:s,"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)(G,{bot:e,size:14}),(0,t.jsx)("span",{className:"max-w-32 truncate",children:e.name}),(0,t.jsx)(a.ChevronDown,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)(b.DropdownMenuContent,{align:"start",children:(0,t.jsx)(b.DropdownMenuGroup,{children:n.map(e=>(0,t.jsxs)(b.DropdownMenuItem,{onClick:()=>r(e.name),children:[(0,t.jsx)(G,{bot:e,size:16}),e.name]},e.name))})})]})}function G({bot:e,size:n}){return(0,t.jsx)(S.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 V(){let[e,t]=(0,C.useServerAction)(j.answerThreadAction,{onOk:()=>(0,T.revalidate)(x.queryKey.threads)});return[async(t,n,a,s)=>{let r=n.trim();if(!r)return!1;try{let n=await e(t.id,r,a,s);return z.screenActs.announce({kind:"answered",id:n.id,label:n.label,answer:r,recipient:a,replyTo:s}),!0}catch{return!1}},t]}e.s(["GivenFiles",0,F,"roomDrop",0,q,"useGivenFiles",0,I],709190),e.s(["ThreadReply",0,function({thread:e,status:n,faces:a=[],to:i=null,className:d}){let[b,k]=(0,m.useState)(),[j,w]=(0,m.useState)(()=>z.threadDrafts.recipient(e.id)??e.bot),[S,_]=(0,m.useState)(!1),[B,$]=(0,m.useState)(null);(0,m.useEffect)(()=>{w(z.threadDrafts.recipient(e.id)??e.bot),k(void 0),_(!1)},[e.id,e.bot]),(0,m.useEffect)(()=>{i&&(z.threadDrafts.select(e.id,i),w(i))},[e.id,i]);let A=e.room.participants,R=e.room.questions,I=Math.max(0,R.findIndex(e=>e.id===b)),F=R[I],L="waiting"===n?e.ask:null,q=(0,N.isAppStop)(L),E=F?.bot??(A.some(e=>e.bot===j)?j:e.bot),G=F?.id,[Q,W]=V(),[X,Y]=(0,C.useServerAction)(v.cancelThreadAction,{onOk:e=>{(0,T.revalidate)(x.queryKey.threads),z.screenActs.announce({kind:"stopped",id:e.id,label:e.label})}}),J=W||Y,Z=e.room.deliveries.filter(e=>!e.delivered),[ee,et]=(0,C.useServerAction)(y,{onOk:()=>(0,T.revalidate)(x.queryKey.threads)}),en=Z.map(e=>`${e.bot}: ${e.text}`).join(" · "),ea=A.filter(e=>"running"===e.state).map(e=>e.bot).join(", ")||e.bot,es=e=>a.find(t=>t.name===e)??{name:e},er=async t=>{if(J)return!1;let a=await Q(e,t,E,G);return a&&"running"===n&&_(!1),a},ei=async e=>{$(e),await er(e),$(null)},eo="running"===n||"waiting"===n?(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:J,onClick:()=>X(e.id),"aria-label":"Stop this thread",title:"Stop this thread",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:Y?(0,t.jsx)(l.Loader2,{className:"animate-spin"}):(0,t.jsx)(c.Square,{className:"size-3"})}):null;if(F){let n=F.options??[],a=F.text;return(0,t.jsxs)(O,{className:d,children:[(0,t.jsx)(K,{bot:es(E),word:"Question",children:R.length>1&&(0,t.jsxs)("span",{className:"ml-auto flex shrink-0 items-center gap-0.5",children:[(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Previous question",disabled:J||0===I,onClick:()=>k(R[I-1].id),children:(0,t.jsx)(s.ChevronLeft,{})}),(0,t.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums","aria-live":"polite",children:[I+1," / ",R.length]}),(0,t.jsx)(p.Button,{type:"button",variant:"ghost",size:"icon-sm","aria-label":"Next question",disabled:J||I===R.length-1,onClick:()=>k(R[I+1].id),children:(0,t.jsx)(r.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)(h.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)(P,{options:n,picked:B,busy:J,onChoose:ei}),(0,t.jsx)(M,{bot:E,onAllowed:er}),(0,t.jsx)(U,{threadId:e.id,recipient:E,draftKey:F.id,send:er,busy:J,placeholder:n.length?"Or write your own answer…":"Your answer…",label:`Answer for ${E}`,trailing:eo},JSON.stringify([e.id,E,F.id]))]})}return q?(0,t.jsxs)(O,{className:d,children:[(0,t.jsx)(K,{bot:es(e.bot),word:"Paused"}),L?.question&&(0,t.jsx)(f.FoldedText,{text:L.question,subject:"message",clamp:"line-clamp-3",tall:"max-h-40"}),(0,t.jsx)(P,{options:L?.options.length?L.options:[N.THREAD_CONTINUE],picked:B,busy:J,onChoose:ei}),(0,t.jsx)(U,{threadId:e.id,recipient:E,send:er,busy:J,placeholder:"Or put it another way…",label:`Message for ${E}`,trailing:eo},JSON.stringify([e.id,E,"paused"]))]}):"running"!==n||S?(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col gap-1.5",d),children:[(0,t.jsx)(U,{threadId:e.id,recipient:E,send:er,busy:J,autoFocus:"running"===n,onEscape:"running"===n?()=>_(!1):void 0,placeholder:"running"===n?`What's off? ${E} reads this before its next step`:"Anything more? It picks up where it left off",label:`Message for ${E}`,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:A.length>1?(0,t.jsx)(H,{current:es(E),bots:A.map(e=>es(e.bot)),disabled:J,onPick:t=>{z.threadDrafts.select(e.id,t),w(t)}}):null,trailing:"running"===n?(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:J,onClick:()=>_(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(u.X,{})}):null},JSON.stringify([e.id,E])),!!en&&"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)(l.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsxs)("span",{className:"truncate",children:["Sending to ",en]})]})]}):(0,t.jsxs)("div",{className:(0,D.cn)("flex min-w-0 flex-col rounded-2xl bg-muted/40 ring-1 ring-border/50",d),children:[Z.map(n=>(0,t.jsxs)("div",{className:"flex items-start gap-2 border-border/60 border-b py-2.5 pr-1.5 pl-3.5",children:[(0,t.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[(0,t.jsxs)("p",{className:"flex min-w-0 items-center gap-1.5 font-mono text-[10px] leading-4",children:[(0,t.jsx)(l.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground"}),(0,t.jsx)(g.ShinyText,{text:`Step-in \xb7 waits for ${n.bot}'s next step`,speed:2.2,className:"min-w-0 truncate"})]}),(0,t.jsx)("p",{className:"whitespace-pre-wrap break-keep text-[13px] leading-snug",children:n.text})]}),(0,t.jsx)(p.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:et,onClick:()=>ee(e.id,n.id),"aria-label":"Take it back",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:(0,t.jsx)(u.X,{})})]},n.id)),(0,t.jsxs)("div",{className:"flex min-w-0 items-center gap-2 py-1.5 pr-1.5 pl-3.5",children:[(0,t.jsx)(g.ShinyText,{text:`${ea} \xb7 Working`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(p.Button,{type:"button",size:"sm",variant:"ghost",disabled:J,onClick:()=>_(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(o.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),eo]})]})},"useAnswerThread",0,V],399512)},248473,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7f777b3dcd6fac42c0201ea9a338fdaaec72e25d22",t.callServer,void 0,t.findSourceMapURL,"cancelThreadAction");e.s(["cancelThreadAction",0,n])},633840,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7ff2a34f34dc1c633b94ee70431cc84efc247ec2b3",t.callServer,void 0,t.findSourceMapURL,"answerThreadAction");e.s(["answerThreadAction",0,n])},931619,e=>{"use strict";var t=e.i(456420);let n={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"}]]};n.node;let a=(0,t.default)(n);e.s(["ChevronsRight",0,a],931619)},51481,e=>{"use strict";var t=e.i(456420);let n={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"]};n.node;let a=(0,t.default)(n);e.s(["CircleQuestionMark",0,a],51481)},919191,e=>{"use strict";var t=e.i(456420);let n={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"}]]};n.node;let a=(0,t.default)(n);e.s(["CornerDownLeft",0,a],919191)},64801,e=>{"use strict";var t=e.i(456420);let n={name:"paperclip",size:24,node:[["path",{d:"m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551",key:"1miecu"}]]};n.node;let a=(0,t.default)(n);e.s(["Paperclip",0,a],64801)},825398,815731,e=>{"use strict";var t=e.i(456420);let n={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"}]]};n.node;let a=(0,t.default)(n);e.s(["RotateCw",0,a],825398);var s=e.i(843476),r=e.i(176782),i=e.i(552245),o=e.i(225913),l=e.i(647163);let d=(0,o.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,o.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,s.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,l.cn)(d({variant:e}),n),...a})},"BubbleContent",0,function({className:e,render:t,...n}){var a;return a={defaultTagName:"div",props:(0,r.mergeProps)({className:(0,l.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,i.useRenderElement)(a.defaultTagName??"div",a,a)}],815731)},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,94682,e=>{"use strict";var t=e.i(843476),n=e.i(24071),s=e.i(482022),i=e.i(569644),r=e.i(456420);let o={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"}]]};o.node;let a=(0,r.default)(o);var l=e.i(759659),c=e.i(271645),d=e.i(798120),u=e.i(167881),f=e.i(917162),m=e.i(671428),x=e.i(41533),h=e.i(95187);let p=(0,h.createServerReference)("7f216094191ab085292e867e0733768c9d6bcc8435",h.callServer,void 0,h.findSourceMapURL,"deleteArtifactAction");var g=e.i(635963),b=e.i(895836),v=e.i(83928),j=e.i(621285),y=e.i(289971),k=e.i(245629),N=e.i(609856),w=e.i(283653),S=e.i(647163);function A(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}))}function C(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 $({label:e,mark:n,count:s,active:i,onPick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,S.cn)("mx-2 flex h-9 items-center gap-2 rounded-md px-2 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i?"bg-secondary font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[n??(0,t.jsx)(a,{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] text-muted-foreground/70 tabular-nums",children:s})]})}function F({row:e,file:r,onOpen:o,onBack:a,onGone:c,onShelf:m}){let[x]=(0,N.useServerAction)(y.openFileAction),[h,g]=(0,N.useServerAction)(p,{okMessage:"Deleted",onOk:()=>{(0,w.revalidate)(d.queryKey.artifacts),r?a():c()}}),b=r?{path:r.path,bytes:r.bytes,at:r.at}:"file"===e.kind?{path:e.path,bytes:e.bytes,at:e.at}:null,v=async e=>{await f.notify.confirm({title:`Delete ${e.split("/").pop()}?`,description:b?"It is deleted from disk for good.":"The folder and everything in it are deleted from disk for good.",okText:"Delete",destructive:!0})&&h(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:[(0,t.jsxs)("button",{type:"button",onClick:r?a:m,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"}),r?e.name:"Shelf"]}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:b?b.path.split("/").pop()??e.name:e.name}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:b?`${(0,S.formatBytes)(b.bytes)} \xb7 ${(0,k.shortAgo)(b.at)}`:`${e.count} ${1===e.count?"file":"files"} \xb7 ${(0,k.shortAgo)(e.at)}`}),b&&(0,t.jsx)("a",{href:d.queryKey.fileView(b.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)(s.ExternalLink,{className:"size-4"})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Reveal in the file manager",className:"text-muted-foreground",onClick:()=>x(b?.path??e.path),children:(0,t.jsx)(i.FolderOpen,{})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Delete",loading:g,className:"text-muted-foreground",onClick:()=>v(b?.path??e.path),children:(0,t.jsx)(l.Trash2,{})})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:b?(0,t.jsx)(j.FilePreview,{path:b.path,bytes:b.bytes}):(0,t.jsx)(T,{path:e.path,onOpen:o})})]})}function T({path:e,onOpen:n}){let{data:s,isLoading:i,error:r}=(0,w.useServerRoute)(d.queryKey.artifactSet(e,x.ARTIFACT_VIEW.setFiles));if(i)return(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3 p-5",children:Array.from({length:8},(e,n)=>(0,t.jsx)(m.Skeleton,{className:"aspect-4/3 w-full rounded-xl"},n))});if(r)return(0,t.jsx)(b.SettingError,{message:r.message});let o=s?.files??[];return 0===o.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:o.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),title:`${e.name} \xb7 ${(0,S.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)(R,{file:e}),(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e.name})]},e.path))}),s&&s.total>o.length&&(0,t.jsx)("p",{className:"pt-4 font-mono text-[11px] text-muted-foreground/60",children:`${o.length} of ${s.total.toLocaleString("en")} — the rest are in the folder`})]})}function R({file:e}){return(0,t.jsx)(v.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl"})}function z({entries:e,bots:n,onPick:s}){return(0,t.jsx)("div",{className:"space-y-7 p-6",children:A(e).map(({bot:e,rows:r})=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-medium",children:[e&&(0,t.jsx)(g.BotMark,{size:20,seed:e,...C(e,n),notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e??"Unsorted"}),(0,t.jsx)("span",{className:"font-mono text-[11px] font-normal text-muted-foreground",children:r.length})]}),(0,t.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(9.5rem,1fr))] gap-x-4 gap-y-5",children:r.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group flex min-w-0 flex-col gap-1.5 rounded-xl text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:["set"===e.kind?(0,t.jsx)("span",{className:"grid aspect-4/3 w-full place-items-center rounded-xl bg-muted/60 text-muted-foreground transition-colors group-hover:bg-muted",children:(0,t.jsx)(i.FolderOpen,{className:"size-5"})}):(0,t.jsx)(v.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl"}),(0,t.jsxs)("span",{className:"min-w-0 space-y-0.5 px-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-[13px]",children:e.name}),(0,t.jsxs)("span",{className:"block truncate font-mono text-[10.5px] text-muted-foreground",children:["set"===e.kind?`${e.count} files \xb7 `:"",(0,k.shortAgo)(e.at)]})]})]},e.path))})]},e??""))})}function M({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)(u.Button,{variant:"outline",onClick:n,children:[(0,t.jsx)(i.FolderOpen,{}),"Reveal folder"]})]})}e.s(["ArtifactSetting",0,function(){let[e,n]=(0,c.useState)(null),[s,r]=(0,c.useState)(""),[o,a]=(0,c.useState)(void 0),[l,f]=(0,c.useState)(x.ARTIFACT_VIEW.rows),{data:m,isLoading:h,error:p}=(0,w.useServerRoute)(d.queryKey.artifactShelf(l),{keepPreviousData:!0}),{data:v}=(0,w.useServerRoute)(d.queryKey.bot),[j]=(0,N.useServerAction)(y.openFileAction);if(h)return(0,t.jsx)(b.SettingPanesSkeleton,{});if(p)return(0,t.jsx)(b.SettingError,{message:p.message});let k=m?.entries??[],S=m?.total??0,T=s.trim().toLowerCase(),R=k.filter(e=>(void 0===o||e.bot===o)&&(!T||e.name.toLowerCase().includes(T)||e.bot?.toLowerCase().includes(T))),B=k.find(t=>t.path===e?.row.path)??e?.row;return(0,t.jsx)(b.SettingPanes,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.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 s=t>e.length?`${e.length} of ${t.toLocaleString("en")} artifacts`:`${t} ${1===t?"artifact":"artifacts"}`;return n>t?`${s} \xb7 ${n.toLocaleString("en")} files`:s}(k,S,m?.files??0)}`]})}),(0,t.jsxs)(u.Button,{variant:"outline",size:"sm",onClick:()=>j("artifacts"),children:[(0,t.jsx)(i.FolderOpen,{}),"Reveal folder"]})]}),left:(0,t.jsxs)("div",{className:"flex flex-col py-2",children:[(0,t.jsx)(b.SettingFilter,{value:s,onChange:r,placeholder:"Filter artifacts",className:"mx-2 mb-1.5 w-auto"}),(0,t.jsx)($,{label:"Everyone",count:k.length,active:void 0===o,onPick:()=>{a(void 0),n(null)}}),A(k).map(({bot:e,rows:s})=>(0,t.jsx)($,{label:e??"Unsorted",mark:e?(0,t.jsx)(g.BotMark,{size:18,seed:e,...C(e,v),notify:!1,className:"shrink-0"}):void 0,count:s.length,active:o===e,onPick:()=>{a(e),n(null)}},e??"")),S>k.length&&(0,t.jsx)("button",{type:"button",onClick:()=>f(l+x.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(x.ARTIFACT_VIEW.rows,S-k.length)} more of ${S.toLocaleString("en")}`})]}),right:B?(0,t.jsx)(F,{row:B,file:e?.file??null,onOpen:e=>n({row:B,file:e}),onBack:()=>n({row:B,file:null}),onGone:()=>n(null),onShelf:()=>n(null)},B.path):R.length>0?(0,t.jsx)(z,{entries:R,bots:v,onPick:e=>n({row:e,file:null})}):(0,t.jsx)(M,{empty:0===S,onReveal:()=>j("artifacts")})})}],94682)},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,94682,e=>{"use strict";var t=e.i(843476),n=e.i(24071),s=e.i(482022),i=e.i(569644),r=e.i(456420);let o={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"}]]};o.node;let a=(0,r.default)(o);var l=e.i(759659),c=e.i(271645),d=e.i(798120),u=e.i(167881),f=e.i(917162),m=e.i(671428),x=e.i(41533),h=e.i(95187);let p=(0,h.createServerReference)("7f6bd3486804e49ac8d1c10ac9a44f986aa91422d3",h.callServer,void 0,h.findSourceMapURL,"deleteArtifactAction");var g=e.i(635963),b=e.i(895836),v=e.i(83928),j=e.i(621285),y=e.i(343488),k=e.i(245629),N=e.i(609856),w=e.i(283653),S=e.i(647163);function A(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}))}function C(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 $({label:e,mark:n,count:s,active:i,onPick:r}){return(0,t.jsxs)("button",{type:"button",onClick:r,className:(0,S.cn)("mx-2 flex h-9 items-center gap-2 rounded-md px-2 text-left text-[13px] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",i?"bg-secondary font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[n??(0,t.jsx)(a,{className:"size-4 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate",children:e}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10.5px] text-muted-foreground/70 tabular-nums",children:s})]})}function F({row:e,file:r,onOpen:o,onBack:a,onGone:c,onShelf:m}){let[x]=(0,N.useServerAction)(y.openFileAction),[h,g]=(0,N.useServerAction)(p,{okMessage:"Deleted",onOk:()=>{(0,w.revalidate)(d.queryKey.artifacts),r?a():c()}}),b=r?{path:r.path,bytes:r.bytes,at:r.at}:"file"===e.kind?{path:e.path,bytes:e.bytes,at:e.at}:null,v=async e=>{await f.notify.confirm({title:`Delete ${e.split("/").pop()}?`,description:b?"It is deleted from disk for good.":"The folder and everything in it are deleted from disk for good.",okText:"Delete",destructive:!0})&&h(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:[(0,t.jsxs)("button",{type:"button",onClick:r?a:m,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"}),r?e.name:"Shelf"]}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate font-mono text-[11px] text-foreground",children:b?b.path.split("/").pop()??e.name:e.name}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] text-muted-foreground/70",children:b?`${(0,S.formatBytes)(b.bytes)} \xb7 ${(0,k.shortAgo)(b.at)}`:`${e.count} ${1===e.count?"file":"files"} \xb7 ${(0,k.shortAgo)(e.at)}`}),b&&(0,t.jsx)("a",{href:d.queryKey.fileView(b.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)(s.ExternalLink,{className:"size-4"})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Reveal in the file manager",className:"text-muted-foreground",onClick:()=>x(b?.path??e.path),children:(0,t.jsx)(i.FolderOpen,{})}),(0,t.jsx)(u.Button,{size:"icon-sm",variant:"ghost","aria-label":"Delete",loading:g,className:"text-muted-foreground",onClick:()=>v(b?.path??e.path),children:(0,t.jsx)(l.Trash2,{})})]}),(0,t.jsx)("div",{className:"min-h-0 flex-1 overflow-auto",children:b?(0,t.jsx)(j.FilePreview,{path:b.path,bytes:b.bytes}):(0,t.jsx)(T,{path:e.path,onOpen:o})})]})}function T({path:e,onOpen:n}){let{data:s,isLoading:i,error:r}=(0,w.useServerRoute)(d.queryKey.artifactSet(e,x.ARTIFACT_VIEW.setFiles));if(i)return(0,t.jsx)("div",{className:"grid grid-cols-4 gap-3 p-5",children:Array.from({length:8},(e,n)=>(0,t.jsx)(m.Skeleton,{className:"aspect-4/3 w-full rounded-xl"},n))});if(r)return(0,t.jsx)(b.SettingError,{message:r.message});let o=s?.files??[];return 0===o.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:o.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>n(e),title:`${e.name} \xb7 ${(0,S.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)(R,{file:e}),(0,t.jsx)("span",{className:"truncate font-mono text-[11px] text-muted-foreground",children:e.name})]},e.path))}),s&&s.total>o.length&&(0,t.jsx)("p",{className:"pt-4 font-mono text-[11px] text-muted-foreground/60",children:`${o.length} of ${s.total.toLocaleString("en")} — the rest are in the folder`})]})}function R({file:e}){return(0,t.jsx)(v.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl"})}function z({entries:e,bots:n,onPick:s}){return(0,t.jsx)("div",{className:"space-y-7 p-6",children:A(e).map(({bot:e,rows:r})=>(0,t.jsxs)("section",{className:"space-y-3",children:[(0,t.jsxs)("h3",{className:"flex items-center gap-2 text-sm font-medium",children:[e&&(0,t.jsx)(g.BotMark,{size:20,seed:e,...C(e,n),notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e??"Unsorted"}),(0,t.jsx)("span",{className:"font-mono text-[11px] font-normal text-muted-foreground",children:r.length})]}),(0,t.jsx)("div",{className:"grid grid-cols-[repeat(auto-fill,minmax(9.5rem,1fr))] gap-x-4 gap-y-5",children:r.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group flex min-w-0 flex-col gap-1.5 rounded-xl text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:["set"===e.kind?(0,t.jsx)("span",{className:"grid aspect-4/3 w-full place-items-center rounded-xl bg-muted/60 text-muted-foreground transition-colors group-hover:bg-muted",children:(0,t.jsx)(i.FolderOpen,{className:"size-5"})}):(0,t.jsx)(v.FileThumb,{path:e.path,bytes:e.bytes,glyph:"size-5",className:"aspect-4/3 w-full rounded-xl"}),(0,t.jsxs)("span",{className:"min-w-0 space-y-0.5 px-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-[13px]",children:e.name}),(0,t.jsxs)("span",{className:"block truncate font-mono text-[10.5px] text-muted-foreground",children:["set"===e.kind?`${e.count} files \xb7 `:"",(0,k.shortAgo)(e.at)]})]})]},e.path))})]},e??""))})}function M({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)(u.Button,{variant:"outline",onClick:n,children:[(0,t.jsx)(i.FolderOpen,{}),"Reveal folder"]})]})}e.s(["ArtifactSetting",0,function(){let[e,n]=(0,c.useState)(null),[s,r]=(0,c.useState)(""),[o,a]=(0,c.useState)(void 0),[l,f]=(0,c.useState)(x.ARTIFACT_VIEW.rows),{data:m,isLoading:h,error:p}=(0,w.useServerRoute)(d.queryKey.artifactShelf(l),{keepPreviousData:!0}),{data:v}=(0,w.useServerRoute)(d.queryKey.bot),[j]=(0,N.useServerAction)(y.openFileAction);if(h)return(0,t.jsx)(b.SettingPanesSkeleton,{});if(p)return(0,t.jsx)(b.SettingError,{message:p.message});let k=m?.entries??[],S=m?.total??0,T=s.trim().toLowerCase(),R=k.filter(e=>(void 0===o||e.bot===o)&&(!T||e.name.toLowerCase().includes(T)||e.bot?.toLowerCase().includes(T))),B=k.find(t=>t.path===e?.row.path)??e?.row;return(0,t.jsx)(b.SettingPanes,{footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(b.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 s=t>e.length?`${e.length} of ${t.toLocaleString("en")} artifacts`:`${t} ${1===t?"artifact":"artifacts"}`;return n>t?`${s} \xb7 ${n.toLocaleString("en")} files`:s}(k,S,m?.files??0)}`]})}),(0,t.jsxs)(u.Button,{variant:"outline",size:"sm",onClick:()=>j("artifacts"),children:[(0,t.jsx)(i.FolderOpen,{}),"Reveal folder"]})]}),left:(0,t.jsxs)("div",{className:"flex flex-col py-2",children:[(0,t.jsx)(b.SettingFilter,{value:s,onChange:r,placeholder:"Filter artifacts",className:"mx-2 mb-1.5 w-auto"}),(0,t.jsx)($,{label:"Everyone",count:k.length,active:void 0===o,onPick:()=>{a(void 0),n(null)}}),A(k).map(({bot:e,rows:s})=>(0,t.jsx)($,{label:e??"Unsorted",mark:e?(0,t.jsx)(g.BotMark,{size:18,seed:e,...C(e,v),notify:!1,className:"shrink-0"}):void 0,count:s.length,active:o===e,onPick:()=>{a(e),n(null)}},e??"")),S>k.length&&(0,t.jsx)("button",{type:"button",onClick:()=>f(l+x.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(x.ARTIFACT_VIEW.rows,S-k.length)} more of ${S.toLocaleString("en")}`})]}),right:B?(0,t.jsx)(F,{row:B,file:e?.file??null,onOpen:e=>n({row:B,file:e}),onBack:()=>n({row:B,file:null}),onGone:()=>n(null),onShelf:()=>n(null)},B.path):R.length>0?(0,t.jsx)(z,{entries:R,bots:v,onPick:e=>n({row:e,file:null})}):(0,t.jsx)(M,{empty:0===S,onReveal:()=>j("artifacts")})})}],94682)},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)}]);