thursday-agent 0.4.0 → 0.5.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 (199) 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.html +1 -1
  12. package/.next/server/app/_not-found.rsc +1 -1
  13. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  15. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/api/artifact/route.js +4 -4
  17. package/.next/server/app/api/artifact/route.js.nft.json +1 -1
  18. package/.next/server/app/api/bot/memory/files/route.js +3 -3
  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/task/[id]/route.js +8 -8
  23. package/.next/server/app/api/bot/task/[id]/route.js.nft.json +1 -1
  24. package/.next/server/app/api/bot/task/route.js +6 -6
  25. package/.next/server/app/api/bot/task/route.js.nft.json +1 -1
  26. package/.next/server/app/api/config/route.js.nft.json +1 -1
  27. package/.next/server/app/api/events/route.js.nft.json +1 -1
  28. package/.next/server/app/api/file/[...path]/route.js +4 -4
  29. package/.next/server/app/api/file/[...path]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/llm-model/catalog/route.js +2 -2
  31. package/.next/server/app/api/llm-model/catalog/route.js.nft.json +1 -1
  32. package/.next/server/app/api/llm-model/credits/route.js +2 -2
  33. package/.next/server/app/api/llm-model/credits/route.js.nft.json +1 -1
  34. package/.next/server/app/api/llm-model/route.js +2 -2
  35. package/.next/server/app/api/llm-model/route.js.nft.json +1 -1
  36. package/.next/server/app/api/llm-model/subscription/route.js +2 -2
  37. package/.next/server/app/api/llm-model/subscription/route.js.nft.json +1 -1
  38. package/.next/server/app/api/mcp/[name]/route.js.nft.json +1 -1
  39. package/.next/server/app/api/mcp/oauth/callback/route.js.nft.json +1 -1
  40. package/.next/server/app/api/mcp/route.js.nft.json +1 -1
  41. package/.next/server/app/api/mcp/tools/route.js.nft.json +1 -1
  42. package/.next/server/app/api/memory/edit/route.js +11 -11
  43. package/.next/server/app/api/memory/edit/route.js.nft.json +1 -1
  44. package/.next/server/app/api/memory/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 +6 -6
  48. package/.next/server/app/api/thursday/call/route.js.nft.json +1 -1
  49. package/.next/server/app/api/thursday/skills/route.js +6 -6
  50. package/.next/server/app/api/thursday/skills/route.js.nft.json +1 -1
  51. package/.next/server/app/api/thursday/tool-call/route.js +8 -8
  52. package/.next/server/app/api/thursday/tool-call/route.js.nft.json +1 -1
  53. package/.next/server/app/api/workspace/route.js +3 -2
  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 +2 -2
  57. package/.next/server/app/artifact/[...path]/page.js.nft.json +1 -1
  58. package/.next/server/app/artifact/[...path]/page_client-reference-manifest.js +1 -1
  59. package/.next/server/app/favicon.ico/route.js.nft.json +1 -1
  60. package/.next/server/app/page/server-reference-manifest.json +40 -40
  61. package/.next/server/app/page.js +1 -1
  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]__026u77e._.js +5 -0
  65. package/.next/server/chunks/{[root-of-the-server]__02xjoto._.js → [root-of-the-server]__050zri4._.js} +1 -1
  66. package/.next/server/chunks/[root-of-the-server]__0bg9710._.js +3 -0
  67. package/.next/server/chunks/[root-of-the-server]__0in-d5s._.js +3 -0
  68. package/.next/server/chunks/[root-of-the-server]__0pa9k-f._.js +8 -0
  69. package/.next/server/chunks/[root-of-the-server]__0qi_m0e._.js +8 -0
  70. package/.next/server/chunks/[root-of-the-server]__0tq0m_k._.js +3 -0
  71. package/.next/server/chunks/[root-of-the-server]__0xep6j_._.js +3 -0
  72. package/.next/server/chunks/[root-of-the-server]__144l7qt._.js +8 -0
  73. package/.next/server/chunks/[root-of-the-server]__1anc1p9._.js +1 -1
  74. package/.next/server/chunks/[root-of-the-server]__1jg8t86._.js +8 -0
  75. package/.next/server/chunks/{[root-of-the-server]__12cabg9._.js → [root-of-the-server]__1lldzy9._.js} +1 -1
  76. package/.next/server/chunks/{[root-of-the-server]__01dkp4a._.js → [root-of-the-server]__1peqvsi._.js} +1 -1
  77. package/.next/server/chunks/[root-of-the-server]__1w8gm5h._.js +10 -0
  78. package/.next/server/chunks/[root-of-the-server]__1xt39nn._.js +8 -0
  79. package/.next/server/chunks/[root-of-the-server]__1zb8mfo._.js +8 -0
  80. package/.next/server/chunks/_0-fjql4._.js +11 -6
  81. package/.next/server/chunks/_00xh_q0._.js +1 -1
  82. package/.next/server/chunks/{_1_9mjx-._.js → _091bi8d._.js} +1 -1
  83. package/.next/server/chunks/_0fzqt2y._.js +29 -21
  84. package/.next/server/chunks/{_0u4aiy2._.js → _0lr92vd._.js} +1 -1
  85. package/.next/server/chunks/_0mecv0f._.js +11 -6
  86. package/.next/server/chunks/{_0sbynis._.js → _0si7xzn._.js} +1 -1
  87. package/.next/server/chunks/_1230wbx._.js +5 -5
  88. package/.next/server/chunks/{_0obojvv._.js → _18d7-5p._.js} +1 -1
  89. package/.next/server/chunks/_1c78vw5._.js +33 -25
  90. package/.next/server/chunks/_1d0j961._.js +2 -2
  91. package/.next/server/chunks/_1krd9rf._.js +1 -1
  92. package/.next/server/chunks/{_03a0897._.js → _1zkfbaa._.js} +1 -1
  93. package/.next/server/chunks/features_1qf3cei._.js +6 -1
  94. package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_0r28-sm._.js → node_modules_consola_dist_chunks_prompt_mjs_17k8irj._.js} +1 -1
  95. package/.next/server/chunks/{node_modules_consola_dist_chunks_prompt_mjs_1xoq2rl._.js → node_modules_consola_dist_chunks_prompt_mjs_1jidylq._.js} +1 -1
  96. package/.next/server/chunks/ssr/[root-of-the-server]__0-nob52._.js +4 -0
  97. package/.next/server/chunks/ssr/{[root-of-the-server]__202p40z._.js → [root-of-the-server]__0s4wb56._.js} +1 -1
  98. package/.next/server/chunks/ssr/{[root-of-the-server]__0xsog8n._.js → [root-of-the-server]__0sd3izg._.js} +2 -2
  99. package/.next/server/chunks/ssr/{[root-of-the-server]__1gtlw6v._.js → [root-of-the-server]__1-13tcn._.js} +2 -2
  100. package/.next/server/chunks/ssr/[root-of-the-server]__10-dz5o._.js +1 -1
  101. package/.next/server/chunks/ssr/{[root-of-the-server]__0s9l2sv._.js → [root-of-the-server]__1zidpfl._.js} +1 -1
  102. package/.next/server/chunks/ssr/_001_ms1._.js +6 -1
  103. package/.next/server/chunks/ssr/{_0gb4gmf._.js → _04z2c7b._.js} +2 -2
  104. package/.next/server/chunks/ssr/{_1nnsk7z._.js → _06tssji._.js} +2 -2
  105. package/.next/server/chunks/ssr/_0fk4c7d._.js +3 -0
  106. package/.next/server/chunks/ssr/_0i_6q1w._.js +1 -1
  107. package/.next/server/chunks/ssr/{_1h0rw11._.js → _0m2lsd1._.js} +2 -2
  108. package/.next/server/chunks/ssr/_0mggveb._.js +3 -0
  109. package/.next/server/chunks/ssr/{_1jhd09t._.js → _0nbpc_8._.js} +2 -2
  110. package/.next/server/chunks/ssr/{_1fojd41._.js → _0rzucul._.js} +3 -3
  111. package/.next/server/chunks/ssr/_0s99bgb._.js +1 -1
  112. package/.next/server/chunks/ssr/_1-teee5._.js +4 -4
  113. package/.next/server/chunks/ssr/{_0fz4mf_._.js → _11j92tu._.js} +2 -2
  114. package/.next/server/chunks/ssr/{_1b2mjwr._.js → _1ebxla1._.js} +2 -2
  115. package/.next/server/chunks/ssr/{_1gd8q8l._.js → _1jdgjv9._.js} +2 -2
  116. package/.next/server/chunks/ssr/_1lz_cq2._.js +19 -11
  117. package/.next/server/chunks/ssr/{_0ilna52._.js → _1nj4niv._.js} +2 -2
  118. package/.next/server/chunks/ssr/_1ovmc9s._.js +3 -0
  119. package/.next/server/chunks/ssr/features_config_components_config-setting_tsx_0xfwqdg._.js +1 -1
  120. package/.next/server/chunks/ssr/features_connectors_components_mcp-setting_tsx_0jmbgvp._.js +1 -1
  121. package/.next/server/chunks/ssr/{node_modules_0pvd7q-._.js → node_modules_0-dr_o7._.js} +1 -1
  122. package/.next/server/chunks/ssr/{node_modules_1_pc9kq._.js → node_modules_04sksn9._.js} +1 -1
  123. package/.next/server/chunks/ssr/{node_modules_1vh5ntv._.js → node_modules_05-n6dz._.js} +1 -1
  124. package/.next/server/chunks/ssr/{node_modules_0b__sgl._.js → node_modules_056qgf-._.js} +1 -1
  125. package/.next/server/chunks/ssr/{node_modules_0g7fzk3._.js → node_modules_07dsgkx._.js} +1 -1
  126. package/.next/server/chunks/ssr/{node_modules_04jf_m8._.js → node_modules_0bvopy2._.js} +1 -1
  127. package/.next/server/chunks/ssr/{node_modules_0arus10._.js → node_modules_0fkeku3._.js} +1 -1
  128. package/.next/server/chunks/ssr/{node_modules_14om4ar._.js → node_modules_0ifp389._.js} +1 -1
  129. package/.next/server/chunks/ssr/{node_modules_0cxaxk9._.js → node_modules_0iur59s._.js} +1 -1
  130. package/.next/server/chunks/ssr/{node_modules_1aaxuef._.js → node_modules_0m383r2._.js} +1 -1
  131. package/.next/server/chunks/ssr/{node_modules_1qpjvy5._.js → node_modules_0u9da1h._.js} +1 -1
  132. package/.next/server/chunks/ssr/{node_modules_1cx_ql6._.js → node_modules_0zeg3x_._.js} +1 -1
  133. package/.next/server/chunks/ssr/{node_modules_0_-_a--._.js → node_modules_1-y7nni._.js} +1 -1
  134. package/.next/server/chunks/ssr/{node_modules_08dhkiq._.js → node_modules_16mkxuo._.js} +1 -1
  135. package/.next/server/chunks/ssr/{node_modules_198nmll._.js → node_modules_1a0kmjl._.js} +1 -1
  136. package/.next/server/chunks/ssr/{node_modules_1efrqxi._.js → node_modules_1chvq5f._.js} +1 -1
  137. package/.next/server/chunks/ssr/{node_modules_0yugy6m._.js → node_modules_1j8j4pt._.js} +1 -1
  138. package/.next/server/chunks/ssr/{node_modules_09q35v_._.js → node_modules_1k6n600._.js} +1 -1
  139. package/.next/server/chunks/ssr/{node_modules_1cz2hle._.js → node_modules_1k7z2j6._.js} +1 -1
  140. package/.next/server/chunks/ssr/{node_modules_1gdh31p._.js → node_modules_1k8j8n0._.js} +1 -1
  141. package/.next/server/chunks/ssr/{node_modules_1eg7m6c._.js → node_modules_1lz0oxc._.js} +1 -1
  142. package/.next/server/chunks/ssr/{node_modules_0940ns5._.js → node_modules_1t77e4n._.js} +1 -1
  143. package/.next/server/chunks/ssr/{node_modules_00etblx._.js → node_modules_1uyk91w._.js} +1 -1
  144. package/.next/server/chunks/ssr/{node_modules_0had7xd._.js → node_modules_1x0ztf4._.js} +1 -1
  145. package/.next/server/chunks/ssr/{node_modules_14q6g4n._.js → node_modules_1y79i83._.js} +1 -1
  146. package/.next/server/chunks/ssr/{node_modules_1hpopmo._.js → node_modules_20c28js._.js} +1 -1
  147. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1b748ic._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0bkwd0u._.js} +1 -1
  148. package/.next/server/chunks/ssr/{node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_1z4hm5e._.js → node_modules_@mermaid-js_parser_dist_chunks_mermaid-parser_core_0p9a9su._.js} +1 -1
  149. package/.next/server/chunks/ssr/{node_modules_@vercel_oidc_dist_06mk8id._.js → node_modules_@vercel_oidc_dist_1o553h-._.js} +1 -1
  150. package/.next/server/middleware-build-manifest.js +3 -3
  151. package/.next/server/pages/404.html +1 -1
  152. package/.next/server/pages/500.html +1 -1
  153. package/.next/server/server-reference-manifest.js +1 -1
  154. package/.next/server/server-reference-manifest.json +41 -41
  155. package/.next/static/chunks/{39j0fvpybzabl.js → 0n3jle9kbqfr2.js} +2 -2
  156. package/.next/static/chunks/{0fl3gwe4-l6tz.js → 11r2yp_yh9_qn.js} +1 -1
  157. package/.next/static/chunks/{1jd09sxcjddu1.js → 126fj4pga_72k.js} +1 -1
  158. package/.next/static/chunks/{0gnqdjn2lvdad.js → 159udiexf6dom.js} +1 -1
  159. package/.next/static/chunks/{08qe4as2q428z.js → 18gi7o2ibrgh8.js} +1 -1
  160. package/.next/static/chunks/{2u7xt6mxg44lf.js → 1q9z1tohil7xn.js} +1 -1
  161. package/.next/static/chunks/{3zmcsnuo25zvq.js → 1sjgfets224re.js} +1 -1
  162. package/.next/static/chunks/{0wcprt5ot5she.js → 1wszsr83t01gh.js} +1 -1
  163. package/.next/static/chunks/{0w52rrrmuj9r9.js → 2szintyibu0s5.js} +1 -1
  164. package/.next/static/chunks/{0hwap1-p0m5sa.js → 3-b6b7entqazs.js} +1 -1
  165. package/.next/static/chunks/{17p6tk6k88dq6.js → 3dmbhsv2u_8kj.js} +1 -1
  166. package/.next/static/chunks/{214ya3n5gxeih.js → 3i0a5px-oufgc.js} +1 -1
  167. package/.next/static/chunks/{1w73ece_6bheu.js → 3wexk9qo8zuj3.js} +3 -3
  168. package/.next/static/chunks/3xre8bu_pk1p_.js +1 -0
  169. package/.next/static/chunks/{3woj-xd7ki5_i.js → 3zv6t3i77xhr_.js} +1 -1
  170. package/.next/static/chunks/{3akmqm77muj4-.js → 408ueu4hfvcg7.js} +1 -1
  171. package/.next/static/chunks/{15m575979un5f.js → 435atsnhs7ksu.js} +6 -6
  172. package/bin/thursday.mjs +0 -0
  173. package/features/ai/prompts/bot.prompt.ts +1 -1
  174. package/features/ai/tools/bot.tool.ts +3 -3
  175. package/features/ai/tools/skills.tool.ts +25 -8
  176. package/features/bot/bot.run.ts +184 -73
  177. package/features/bot/bot.runner.ts +48 -23
  178. package/features/bot/task.query.ts +107 -4
  179. package/features/bot/task.store.ts +3 -5
  180. package/features/workspace/workspace.ts +27 -20
  181. package/package.json +1 -1
  182. package/skills/browser/SKILL.md +6 -5
  183. package/.next/server/chunks/[root-of-the-server]__04q--0f._.js +0 -8
  184. package/.next/server/chunks/[root-of-the-server]__0bl-e63._.js +0 -3
  185. package/.next/server/chunks/[root-of-the-server]__0jq4ohy._.js +0 -8
  186. package/.next/server/chunks/[root-of-the-server]__0ls6_8y._.js +0 -8
  187. package/.next/server/chunks/[root-of-the-server]__1339jnv._.js +0 -8
  188. package/.next/server/chunks/[root-of-the-server]__18_teo8._.js +0 -8
  189. package/.next/server/chunks/[root-of-the-server]__1ccon1w._.js +0 -10
  190. package/.next/server/chunks/[root-of-the-server]__1wa1k7r._.js +0 -8
  191. package/.next/server/chunks/_1zjrdag._.js +0 -3
  192. package/.next/server/chunks/ssr/[root-of-the-server]__1ox7hbk._.js +0 -4
  193. package/.next/server/chunks/ssr/_0n3toaw._.js +0 -3
  194. package/.next/server/chunks/ssr/_1-_etts._.js +0 -3
  195. package/.next/server/chunks/ssr/_1f-dg-6._.js +0 -3
  196. package/.next/static/chunks/00rd4-v8r7axp.js +0 -1
  197. /package/.next/static/{kaTO0UHqF1bMnWgCDik2f → G6-gNoyGDEcgAsq-L4PE1}/_buildManifest.js +0 -0
  198. /package/.next/static/{kaTO0UHqF1bMnWgCDik2f → G6-gNoyGDEcgAsq-L4PE1}/_clientMiddlewareManifest.js +0 -0
  199. /package/.next/static/{kaTO0UHqF1bMnWgCDik2f → G6-gNoyGDEcgAsq-L4PE1}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,519029,e=>{"use strict";var t=e.i(843476),n=e.i(647163);function s({color:e,picked:r,onPick:l}){return(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":e??"Follow the theme",style:e?{backgroundColor:e}:void 0,className:(0,n.cn)("size-5 rounded-full outline-none transition-transform hover:scale-110 focus-visible:ring-3 focus-visible:ring-ring/50",!e&&"bg-foreground",r&&"ring-2 ring-foreground/40 ring-offset-2 ring-offset-background")})}var r=e.i(864723);e.s(["MarkPalette",0,function({color:e,themePicked:n,onTheme:l,onPick:a}){return(0,t.jsx)("div",{className:"flex justify-center px-2",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(s,{color:null,picked:n,onPick:l}),(0,t.jsx)("span",{className:"w-2"}),r.MARK_PALETTE_ROWS[0].map(n=>(0,t.jsx)(s,{color:n,picked:e===n,onPick:()=>a(n)},n))]}),(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 pl-11",children:r.MARK_PALETTE_ROWS[1].map(n=>(0,t.jsx)(s,{color:n,picked:e===n,onPick:()=>a(n)},n))})]})})}],519029)},59158,e=>{"use strict";var t=e.i(843476),n=e.i(689664),s=e.i(466787),r=e.i(271645),l=e.i(798120),a=e.i(167881),i=e.i(736185),o=e.i(23750),c=e.i(917162),d=e.i(421429),u=e.i(184762),h=e.i(41533),m=e.i(968978),x=e.i(265402),p=e.i(519029),f=e.i(864723),g=e.i(895836),v=e.i(867927),b=e.i(456420);let j={name:"phone",size:24,node:[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]};j.node;let y=(0,b.default)(j);var k=e.i(759659),S=e.i(660302),N=e.i(671428),w=e.i(222055),C=e.i(245629),A=e.i(609856),E=e.i(661504),T=e.i(647163),R=e.i(95187);let _=(0,R.createServerReference)("7fc555b36b5925e2051ec959344746fb3809426d0d",R.callServer,void 0,R.findSourceMapURL,"deleteCallAction"),I=(0,R.createServerReference)("7f21d91d9d40f7a3f34d6c13a113858f03876152a7",R.callServer,void 0,R.findSourceMapURL,"deleteEndedCallsAction");var M=e.i(561540),K=e.i(256604);function O(){return(0,t.jsx)(g.SettingGroup,{label:"Transcripts",children:(0,t.jsx)(g.SettingItems,{children:(0,t.jsxs)("button",{type:"button",onClick:()=>c.notify.component({className:"sm:max-w-3xl",renderer:()=>(0,t.jsx)(g.SettingDialogContent,{title:"Call history",description:"Everything said on the line, oldest at the top. Scroll up for older calls.",children:(0,t.jsx)(D,{})})}),className:"flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(y,{className:"size-4"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block text-sm font-medium",children:"Call history"}),(0,t.jsx)("span",{className:"block text-xs text-muted-foreground",children:"Every call, word for word — hers and yours"})]}),(0,t.jsx)(v.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]})})})}let P={running:"working",waiting:"waiting on you",done:"done",failed:"failed"},z={running:"text-muted-foreground",waiting:T.WAITING_INK,done:"text-muted-foreground",failed:"text-destructive"},L="h-[min(34rem,58vh)] min-h-64 px-1";function D(){let{items:e,isLoading:n,isLoadingMore:s,error:i,hasMore:o,sentinelRef:d,refresh:u}=(0,E.useServerPages)({key:(e,t)=>{if(0===e)return l.queryKey.callHistory(null);let n=t?.at(-1);return n?l.queryKey.callHistory((0,C.toDate)(n.startedAt).toISOString()):null},size:h.CALL_HISTORY_PAGE,swr:{revalidateOnFocus:!1}}),m=(0,r.useMemo)(()=>[...e].reverse(),[e]),[x,p]=(0,A.useServerAction)(I,{okMessage:e=>1===e?"1 call deleted":`${e} calls deleted`,onOk:u}),f=async()=>{await c.notify.confirm({title:"Delete every call?",description:"Every turn of every call goes — and she stops reading any of it back into the next call. A call still on the line stays.",okText:"Delete all",destructive:!0})&&x()},v=(0,r.useRef)(null),b=(0,r.useRef)(!1),j=(0,r.useRef)(0);return((0,r.useLayoutEffect)(()=>{let e=v.current;e&&0!==m.length&&(b.current?e.scrollTop=e.scrollHeight-j.current:(b.current=!0,e.scrollTop=e.scrollHeight),j.current=e.scrollHeight-e.scrollTop)},[m]),n)?(0,t.jsx)("div",{className:(0,T.cn)(L,"overflow-hidden"),children:(0,t.jsx)(F,{})}):i?(0,t.jsx)(g.SettingError,{message:i.message}):(0,t.jsx)(t.Fragment,{children:0===m.length?(0,t.jsx)("p",{className:"px-1 text-sm leading-relaxed text-muted-foreground",children:"No calls yet. Everything said on the line is kept here — hers and yours, in the order it was said."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:v,onScroll:e=>{let t=e.currentTarget;j.current=t.scrollHeight-t.scrollTop},className:(0,T.cn)(L,"overflow-y-auto overscroll-contain pb-6"),children:[(0,t.jsx)(g.SettingMore,{hasMore:o,loading:s,sentinelRef:d,count:1,ghost:(0,t.jsx)(F,{})}),m.map((e,n)=>(0,t.jsx)($,{call:e,first:0===n,onDropped:u},e.id))]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(a.Button,{variant:"ghost",loading:p,onClick:f,className:"text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(k.Trash2,{}),"Delete all"]})})]})})}function F(){return(0,t.jsxs)("div",{className:"pb-3",children:[(0,t.jsxs)("div",{className:"flex h-7 items-center gap-2.5",children:[(0,t.jsx)(N.Skeleton,{className:"h-3 w-24"}),(0,t.jsx)(N.Skeleton,{className:"h-3 w-10"})]}),(0,t.jsx)("div",{className:"mt-2 mb-[18px] h-px bg-border/60"}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(N.Skeleton,{className:"h-9 w-3/5 rounded-2xl rounded-br-sm"})}),(0,t.jsxs)("div",{className:"mt-3 flex items-start gap-2",children:[(0,t.jsx)(N.Skeleton,{className:"mt-0.5 size-[18px] shrink-0 rounded-full"}),(0,t.jsx)(N.Skeleton,{className:"mt-1 h-3.5 w-2/3"})]})]})}let H=e=>"user"===e.role?"user":"her";function $({call:e,first:n,onDropped:s}){let[r,l]=(0,A.useServerAction)(_,{okMessage:"Call deleted",onOk:s}),i=(0,C.toDate)(e.startedAt),o=e.turns.at(-1),d=e.endedAt&&o?function(e,t){let n=Math.max(0,Math.round((t.getTime()-e.getTime())/1e3));if(n<60)return`${n}s`;let s=Math.floor(n/60);return s<60?`${s}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(s/60)}h ${String(s%60).padStart(2,"0")}m`}(i,(0,C.toDate)(o.at)):"on the line",u=async()=>{await c.notify.confirm({title:`Delete the call from ${(0,C.whenOf)(i)}?`,description:"Every turn of it goes — and she stops reading it back into the next call.",okText:"Delete",destructive:!0})&&r(e.id)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,T.cn)("group flex items-center gap-2.5",n?"mt-1":"mt-11"),children:[(0,t.jsx)("span",{title:`${e.provider} \xb7 ${e.model}`,className:"font-mono text-[10px] tracking-[0.14em] uppercase",children:(0,C.whenOf)(i)}),(0,t.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:d}),(0,t.jsx)("span",{className:"ml-auto flex size-7 shrink-0 items-center justify-center",children:e.endedAt&&(0,t.jsx)(a.Button,{size:"icon-sm",variant:"ghost",loading:l,"aria-label":"Delete this call",onClick:u,className:"text-muted-foreground/60 opacity-0 transition-opacity group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100",children:(0,t.jsx)(k.Trash2,{})})})]}),(0,t.jsx)("div",{className:"mt-2 mb-[18px] h-px bg-border/60"}),(function(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&"tool"===n.role&&"tool"===e.turn.role&&e.turn.tool===n.tool&&e.turn.text===n.text){e.repeats+=1;continue}t.push({turn:n,repeats:1})}return t})(e.turns).map(({turn:n,repeats:s},r,l)=>{var a,i;let o,c=l[r-1]?.turn,d=l[r+1]?.turn;return(0,t.jsx)(G,{turn:n,job:(a=e,i=n,(o=(0,M.delegatedLabel)(i.tool,i.text))?a.jobs.find(e=>e.label===o):void 0),repeats:s,opensRun:!c||H(c)!==H(n),closesRun:!d||H(d)!==H(n)},n.id)})]})}function G({turn:e,job:n,opensRun:s,closesRun:r,repeats:l=1}){return"tool"===e.role?(0,t.jsx)(V,{turn:e,job:n,repeats:l,opensRun:s}):"user"===e.role?(0,t.jsx)("div",{className:(0,T.cn)("flex justify-end",s?"mt-3":"mt-1"),children:(0,t.jsx)("p",{className:(0,T.cn)("max-w-[min(34rem,78%)] rounded-2xl bg-muted px-3.5 py-2 text-[13.5px] leading-relaxed break-keep whitespace-pre-wrap",r&&"rounded-br-sm"),children:e.text})}):(0,t.jsxs)("div",{className:(0,T.cn)("flex items-start gap-2",s?"mt-3":"mt-1"),children:[(0,t.jsx)(B,{face:s,className:"mt-0.5"}),(0,t.jsx)("p",{className:"max-w-[min(34rem,78%)] text-[13.5px] leading-relaxed break-keep whitespace-pre-wrap",children:e.text})]})}function B({face:e,className:n}){return(0,t.jsx)("span",{className:(0,T.cn)("grid size-[18px] shrink-0 place-items-center",n),children:e&&(0,t.jsx)(K.ThursdayMark,{size:18})})}function V({turn:e,job:n,repeats:s,opensRun:r}){let l=e.tool??"",a=(0,w.toolIcon)(l),i=(0,M.toolLine)(l,e.text);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,T.cn)("flex items-center gap-2",r?"mt-3":"mt-1.5"),children:[(0,t.jsx)(B,{face:r}),(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[(0,t.jsx)(a,{className:"size-3 shrink-0"}),i&&(0,t.jsx)("span",{className:"truncate text-[11px] break-keep",children:i}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/60",children:l}),s>1&&(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",s]})]})]}),n&&(0,t.jsxs)("p",{className:"mt-0.5 ml-[26px] flex min-w-0 items-baseline gap-1.5 text-[11px]",children:["running"===n.status?(0,t.jsx)(S.ShinyText,{text:P.running,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,T.cn)("shrink-0 font-mono text-[10px]",z[n.status]),children:P[n.status]}),n.outcome&&"running"!==n.status&&(0,t.jsx)("span",{className:"truncate text-muted-foreground",children:(0,T.plainText)(n.outcome)})]})]})}var W=e.i(333495),U=e.i(933916),q=e.i(762074);let Y=(0,R.createServerReference)("7f1d36b0d1eafa4f7bbf1208f18183bcc64c3ec7e0",R.callServer,void 0,R.findSourceMapURL,"resetHistoryAction"),X=(0,R.createServerReference)("7f163845a4428ceeeb912bcaf5c0c9eef6f501b473",R.callServer,void 0,R.findSourceMapURL,"setCallSkillsAction");var Z=e.i(671228),J=e.i(67045),Q=e.i(698570),ee=e.i(319841),et=e.i(981203),en=e.i(283653);function es(){let{data:e}=(0,en.useServerRoute)(l.queryKey.callSkills),[n]=(0,A.useServerAction)(X,{onOk:()=>(0,en.revalidate)(l.queryKey.callSkills)});return(0,t.jsx)(g.SettingGroup,{label:"Skills",children:(0,t.jsx)(g.SettingToggle,{label:"Read a skill herself",description:"A skill is how a thing is done here, written down. On, she opens one mid-call and follows it; off, only bots read them.",checked:e??!1,disabled:void 0===e,onChange:e=>n(e),children:(0,t.jsx)(er,{})})})}function er(){let{data:e}=(0,en.useServerRoute)(l.queryKey.skills);return e?(0,t.jsx)(g.SettingNote,{className:(0,T.cn)(!e.length&&T.WAITING_INK),children:e.length?`The same ${e.length} a bot reads. Each one she opens spends a page of the call on it.`:"Nothing installed yet — there is nothing for her to read."}):null}function el(){let[e,n]=(0,A.useServerAction)(Y,{okMessage:({calls:e,tasks:t,notes:n})=>`Wiped ${e} calls, ${t} jobs, ${n} notes`,onOk:()=>{(0,en.revalidate)(l.queryKey.memory),(0,en.revalidate)(l.queryKey.tasks),(0,en.revalidate)(l.queryKey.callHistory(null))}}),r=async()=>{await c.notify.confirm({title:"Reset history?",description:"Every call, every job and everything she remembers is deleted for good. Keys, bots and connectors stay.",okText:"Reset",destructive:!0})&&e()};return(0,t.jsx)(g.SettingGroup,{label:"Danger zone",note:"Keys, bots and connectors stay.",children:(0,t.jsx)(g.SettingItems,{children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(s.TriangleAlert,{className:"size-4"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block text-sm font-medium",children:"Reset history"}),(0,t.jsx)("span",{className:"block text-xs text-muted-foreground",children:"Every call, every job and everything she remembers"})]}),(0,t.jsx)(a.Button,{variant:"outline",size:"sm",loading:n,onClick:r,className:"shrink-0 text-destructive hover:text-destructive",children:"Reset"})]})})})}function ea({value:e,onChange:n}){let s=t=>n({...e,...t});return(0,t.jsx)(g.SettingGroup,{label:"Face",children:(0,t.jsxs)("div",{className:"space-y-5 py-2",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 pt-2",children:[(0,t.jsx)(W.Face,{look:e,size:176,className:"w-44"}),(0,t.jsx)(d.Segmented,{"aria-label":"Face",options:U.FACE_KINDS.map(e=>({value:e,label:W.FACES[e].label})),value:e.kind,onChange:e=>s({kind:e})}),(0,t.jsx)("p",{className:"max-w-sm text-center text-xs text-muted-foreground",children:W.FACES[e.kind].hint})]}),"mark"===e.kind&&(0,t.jsx)(p.MarkPalette,{color:e.color,themePicked:!e.color,onTheme:()=>s({color:void 0}),onPick:e=>s({color:e})}),"mark"===e.kind&&(0,t.jsx)(eo,{label:"Shape",children:(0,t.jsx)(d.Segmented,{"aria-label":"Shape",options:f.MARK_SHAPES.map(e=>({value:e,label:(0,t.jsx)("span",{className:"capitalize",children:e})})),value:e.shape??"blob",onChange:e=>s({shape:e})})}),"mark"===e.kind&&(0,t.jsx)(eo,{label:"Style",children:(0,t.jsx)(d.Segmented,{"aria-label":"Style",options:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"}],value:e.outline?"outline":"solid",onChange:e=>s({outline:"outline"===e||void 0})})}),"ascii"===e.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eo,{label:"Glyphs",children:(0,t.jsx)(d.Segmented,{"aria-label":"Glyphs",options:U.ASCII_CHARSETS.map(e=>({value:e,label:ei[e]})),value:e.charset,onChange:e=>s({charset:e})})}),(0,t.jsx)(eo,{label:"Size",children:(0,t.jsx)(ec,{min:h.ASCII_FACE.fontSize.min,max:h.ASCII_FACE.fontSize.max,step:1,value:e.fontSize,format:e=>`${e}px`,onChange:e=>s({fontSize:e})})}),(0,t.jsx)(eo,{label:"Density",children:(0,t.jsx)(ec,{min:h.ASCII_FACE.density.min,max:h.ASCII_FACE.density.max,step:.1,value:e.density,format:e=>`${e.toFixed(1)}x`,onChange:e=>s({density:e})})})]})]})})}let ei={ascii:"Characters",emoji:"Sprinkled",emojiOnly:"All emoji"};function eo({label:e,children:n}){return(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-16 shrink-0 font-mono text-[11px] text-muted-foreground",children:e}),n]})}function ec({value:e,onChange:n,format:s,...r}){return(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)("input",{type:"range",...r,value:e,onChange:e=>n(Number(e.target.value)),className:"min-w-0 flex-1 accent-foreground"}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground tabular-nums",children:s(e)})]})}function ed({provider:e,value:r,hasKey:l,onPick:a}){let o=!!r,c=r?.voice??e.defaultVoice,d=r?.model??"";return(0,t.jsxs)("div",{className:(0,T.cn)("p-4",o&&"bg-muted/40"),children:[(0,t.jsxs)("button",{type:"button",disabled:o,onClick:()=>a({voice:null,model:null}),className:"flex w-full items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:[(0,t.jsx)(m.ProviderIcon,{provider:e.id,className:"size-4 shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.label}),(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:d||e.models[0].id})]}),l?o&&(0,t.jsx)(n.Check,{className:"size-4 shrink-0"}):(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)(s.TriangleAlert,{className:"size-3"}),"No key"]})]}),o&&(0,t.jsxs)("div",{className:"space-y-3 pt-3",children:[(0,t.jsx)(i.Combobox,{value:d,onChange:e=>a({voice:r?.voice??null,model:e||null}),options:e.models.map(e=>({value:e.id,label:e.label,hint:e.id})),"aria-label":`${e.label} realtime model`,placeholder:e.models[0].id,empty:"Not on the list — it still runs"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.voices.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>a({voice:e,model:r?.model??null}),className:(0,T.cn)("rounded-full border px-2.5 py-1 font-mono text-[11px] transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",e===c?"border-foreground/40 text-foreground":"border-border/60 text-muted-foreground hover:text-foreground"),children:e},e))})]})]})}let eu={center:{label:"Her last line",hint:"One caption under the mark — only what she said."},sides:{label:"Last three turns",hint:"Hers on the left, yours on the right, beside the mark."}};function eh({value:e,onChange:n}){return(0,t.jsx)(g.SettingGroup,{label:"Calls you",note:"off"!==e&&"Needs this tab open. A tab that has been silent since it loaded may not be allowed to make a sound — the desktop notification covers that.",children:(0,t.jsx)(g.SettingChoiceRows,{options:Z.CALL_BACK_MODES.map(e=>({value:e,label:Z.CALL_BACK_LABEL[e],hint:em[e]})),value:e,onChange:n})})}let em={off:"Nothing opens a call but you.",waiting:"A job that stopped to ask gets her to ring you.",any:"Anything a bot finishes, she opens a line to tell you."};function ex({value:e,onChange:n}){return(0,t.jsx)(g.SettingGroup,{label:"Captions",children:(0,t.jsx)(g.SettingChoiceRows,{options:Z.CAPTION_VIEWS.map(e=>({value:e,label:eu[e].label,hint:eu[e].hint})),value:e,onChange:n})})}function ep({value:e,onChange:n}){let s=(0,Q.useDraft)(e.phrase,t=>n({...e,phrase:t}),{min:Z.WAKE_PHRASE.min}),r=s.value.trim().split(/\s+/).length<2;return(0,t.jsx)(g.SettingGroup,{label:"Wake",children:(0,t.jsx)(g.SettingToggle,{label:"Answer to her name",description:"Between calls, the browser listens for the phrase below and picks up when it hears it.",checked:e.enabled,onChange:t=>n({...e,enabled:t}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.Input,{value:s.value,maxLength:Z.WAKE_PHRASE.max,spellCheck:!1,onChange:e=>s.set(e.target.value),onBlur:s.commit,onKeyDown:s.onKeyDown,"aria-label":"Wake phrase",className:"font-mono text-sm"}),(0,t.jsx)(g.SettingNote,{children:r?"One word will wake her by accident — say hello first.":"Heard loosely, in English. Near misses count."})]})})})}function ef({value:e,onChange:n}){let[s,l]=(0,r.useState)(!1),[a,i]=(0,r.useState)(!1),o=(0,ee.useHotkeyLabel)((0,ee.isCombo)(e.combo)?e.combo:null);return(0,t.jsx)(g.SettingGroup,{label:"Shortcut",children:(0,t.jsx)(g.SettingToggle,{label:"Answer to a key",description:"With this tab in front, the key below starts a call — and ends the one that is running.",checked:e.enabled,onChange:t=>n({...e,enabled:t}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("button",{type:"button",...ee.HOTKEY_CAPTURE,onClick:()=>{i(!1),l(!0)},onBlur:()=>l(!1),onKeyDown:s?t=>{if("Tab"===t.key)return;if(t.preventDefault(),t.stopPropagation(),"Escape"===t.key)return l(!1);let s=(0,ee.comboOf)(t.nativeEvent);if(!s)return i(!0);i(!1),l(!1),n({...e,combo:s})}:void 0,className:(0,T.cn)("w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",s?"border-foreground/40 text-muted-foreground":"border-border/60 hover:bg-muted/50"),children:s?"Press the keys…":o??"Set a shortcut"}),(0,t.jsx)(g.SettingNote,{children:a?"Hold Ctrl, Alt or Cmd — a plain key is typing.":s?"Esc to keep the one you have.":"Only while this tab has focus. Not while you are typing."})]})})})}function eg({value:e,onSave:n}){let[s,l]=(0,r.useState)(e);return(0,t.jsx)(g.SettingGroup,{label:"Instructions",right:`${s.length}/${et.COMMON_VALIDATE.prompt.max}`,children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(u.Textarea,{value:s,maxLength:et.COMMON_VALIDATE.prompt.max,onChange:e=>l(e.target.value),placeholder:"Anything else she should know before the first word — how to address you, what to skip.",className:"min-h-28"}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(a.Button,{size:"sm",disabled:s===e,onClick:()=>n(s),children:"Save"})})]})})}e.s(["ThursdaySetting",0,function(){let e=(0,J.useThursdayStore)(),n=(0,J.useThursdayStore)(e=>e.patch),{data:s=[],isLoading:r,error:a}=(0,en.useServerRoute)(l.queryKey.llmModel),i=(0,q.useThursdayFace)();if(r)return(0,t.jsx)(g.SettingSkeleton,{rows:4});if(a)return(0,t.jsx)(g.SettingError,{message:a.message});let o=e.model?.provider??null;return(0,t.jsxs)(g.SettingScreen,{footer:(0,t.jsx)(g.SettingRailNote,{children:"Her prompt is assembled fresh on every call — memory, the roster and your skills go in."}),children:[(0,t.jsx)(ea,{value:i,onChange:q.setThursdayFace}),(0,t.jsx)(O,{}),(0,t.jsx)(g.SettingGroup,{label:"Voice",note:!o&&"Nothing picked — calls run on whichever key is set.",children:(0,t.jsx)(g.SettingItems,{children:x.SPEACH_MODEL_PROVIDER_LIST.map(r=>{let l;return(0,t.jsx)(ed,{provider:r,value:o===r.id?e.model:null,hasKey:(l=r.apiKeyName,s.some(e=>e.apiKeyName===l&&e.hasKey)),onPick:e=>n({model:{provider:r.id,...e}})},r.id)})})}),(0,t.jsx)(ex,{value:e.captionView,onChange:e=>n({captionView:e})}),(0,t.jsx)(ep,{value:e.wake,onChange:e=>n({wake:e})}),(0,t.jsx)(eh,{value:e.callBack,onChange:e=>n({callBack:e})}),(0,t.jsx)(ef,{value:e.hotkey,onChange:e=>n({hotkey:e})}),(0,t.jsx)(es,{}),(0,t.jsx)(eg,{value:e.systemPrompt??"",onSave:e=>n({systemPrompt:e})}),(0,t.jsx)(el,{})]})}],59158)},698570,e=>{"use strict";var t=e.i(271645);e.s(["useDraft",0,function(e,n,{min:s=1}={}){let[r,l]=(0,t.useState)(e),[a,i]=(0,t.useState)(e);return e!==a&&(i(e),l(e)),{value:r,set:l,commit:()=>{let t=r.trim();if(t.length<s)return l(e);l(t),t!==e&&n(t)},onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||e.currentTarget.blur()}}}])},661504,e=>{"use strict";var t=e.i(271645),n=e.i(699018),s=e.i(677309),r=e.i(271235),l=e.i(802239),a=e.i(646192);let i=Promise.resolve(),o=(0,r.withMiddleware)(n.u,e=>(n,r,o)=>{let c,d=(0,t.useRef)(!1),{cache:u,initialSize:h=1,revalidateAll:m=!1,persistSize:x=!1,revalidateFirstPage:p=!0,revalidateOnMount:f=!1,parallel:g=!1}=o,[,,,v]=s.a.get(s.o);try{(c=(0,s.s)(n?n(0,null):null)[0])&&(c=a.INFINITE_PREFIX+c)}catch(e){}let[b,j,y]=(0,s.c)(u,c),k=(0,t.useCallback)(()=>(0,s.i)(b()._l)?h:b()._l,[u,c,h]);(0,l.useSyncExternalStore)((0,t.useCallback)(e=>c?y(c,()=>{e()}):()=>{},[u,c]),k,k);let S=(0,t.useCallback)(()=>{let e=b()._l;return(0,s.i)(e)?h:e},[c,h]),N=(0,t.useRef)(S());(0,s.u)(()=>{if(!d.current){d.current=!0;return}c&&j({_l:x?N.current:S()})},[c,u]);let w=f&&!d.current,C=e(c,async e=>{let t=b()._i,l=b()._r,a=s.a.get(u),i=a[8],c=()=>a[8]!==i;j({_r:s.U});let d=[],h=S(),[x]=(0,s.c)(u,e),f=x().data,y=[],k=null;for(let e=0;e<h;++e){let[a,i]=(0,s.s)(n(e,g?null:k));if(!a)break;let[h,x]=(0,s.c)(u,a),b=h().data,j=m||t||(0,s.i)(b)||p&&!e&&!(0,s.i)(f)||w||f&&!(0,s.i)(f[e])&&!o.compare(f[e],b);if(r&&("function"==typeof l?l(b,i):j)){let t=async()=>{if(a in v){let e=v[a];delete v[a],b=await e}else b=await r(i);c()||x({data:b,_k:i}),d[e]=b};g?y.push(t):await t()}else d[e]=b;g||(k=b)}return g&&await Promise.all(y.map(e=>e())),c()||j({_i:s.U}),d},o),A=(0,t.useCallback)(function(e,t){let n="boolean"==typeof t?{revalidate:t}:t||{},r=!1!==n.revalidate;return c?(r&&((0,s.i)(e)?j({_i:!0,_r:n.revalidate}):j({_i:!1,_r:n.revalidate})),arguments.length?C.mutate(e,{...n,revalidate:r}):C.mutate()):i},[c,u]),E=(0,t.useCallback)(e=>{let t;if(!c)return i;let[,r]=(0,s.c)(u,c);if((0,s.e)(e)?t=e(S()):"number"==typeof e&&(t=e),"number"!=typeof t)return i;r({_l:t}),N.current=t;let l=[],[a]=(0,s.c)(u,c),o=null;for(let e=0;e<t;++e){let[t]=(0,s.s)(n(e,o)),[r]=(0,s.c)(u,t),i=t?r().data:s.U;if((0,s.i)(i))return A(a().data);l.push(i),o=i}return A(l)},[c,u,A,S]);return{size:S(),setSize:E,mutate:A,get data(){return C.data},get error(){return C.error},get isValidating(){return C.isValidating},get isLoading(){return C.isLoading}}});var c=e.i(41533),d=e.i(283653);e.s(["useServerPages",0,function(e){let n=e.size??c.PAGE_SIZE,{key:s}=e,{data:r,error:l,isLoading:a,isValidating:i,setSize:u,mutate:h}=o((e,t)=>(0,d.resolveKey)(s(e,t)),d.fetchRoute,{dedupingInterval:500,revalidateOnMount:!0,revalidateOnFocus:!0,revalidateOnReconnect:!0,focusThrottleInterval:1e3,revalidateFirstPage:!1,...e.swr}),m=r??[],x=m.flat(),p=m.at(-1),f=void 0!==p&&p.length>=n,g=(0,t.useRef)(0),v=i&&m.length>0&&g.current>m.length,b=(0,t.useRef)({isValidating:i,setSize:u,pages:m.length});b.current={isValidating:i,setSize:u,pages:m.length};let j=(0,d.resolveKey)(s(0,null)),y="string"==typeof j?j:j?.url;(0,t.useEffect)(()=>{if(y)return(0,d.registerPagedReader)({url:y,refresh:()=>h()})},[y,h]);let k=function(e,n={}){let{enabled:s=!0,margin:r="600px",revision:l}=n,a=(0,t.useRef)(e);a.current=e;let i=(0,t.useRef)(null),o=(0,t.useRef)(null),c=(0,t.useCallback)(e=>{i.current=e},[]);return(0,t.useEffect)(()=>{o.current?.disconnect();let e=i.current;if(e&&s)return o.current=new IntersectionObserver(([e])=>{e.isIntersecting&&a.current()},{root:function(e){let t=e.parentElement;for(;t;){let{overflowY:e}=getComputedStyle(t);if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}(e),rootMargin:r}),o.current.observe(e),()=>o.current?.disconnect()},[s,r,l]),c}(()=>{let e=b.current;e.isValidating||(g.current=e.pages+1,e.setSize(e.pages+1))},{enabled:f,revision:`${m.length}:${i}`});return{items:x,isLoading:a,isLoadingMore:v,error:l,hasMore:f,sentinelRef:k,refresh:()=>h()}}],661504)},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)},466787,e=>{"use strict";var t=e.i(755566);e.s(["TriangleAlert",()=>t.default])}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,519029,e=>{"use strict";var t=e.i(843476),n=e.i(647163);function s({color:e,picked:r,onPick:l}){return(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":e??"Follow the theme",style:e?{backgroundColor:e}:void 0,className:(0,n.cn)("size-5 rounded-full outline-none transition-transform hover:scale-110 focus-visible:ring-3 focus-visible:ring-ring/50",!e&&"bg-foreground",r&&"ring-2 ring-foreground/40 ring-offset-2 ring-offset-background")})}var r=e.i(864723);e.s(["MarkPalette",0,function({color:e,themePicked:n,onTheme:l,onPick:a}){return(0,t.jsx)("div",{className:"flex justify-center px-2",children:(0,t.jsxs)("div",{className:"flex flex-col gap-2.5",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)(s,{color:null,picked:n,onPick:l}),(0,t.jsx)("span",{className:"w-2"}),r.MARK_PALETTE_ROWS[0].map(n=>(0,t.jsx)(s,{color:n,picked:e===n,onPick:()=>a(n)},n))]}),(0,t.jsx)("div",{className:"flex flex-wrap items-center gap-2 pl-11",children:r.MARK_PALETTE_ROWS[1].map(n=>(0,t.jsx)(s,{color:n,picked:e===n,onPick:()=>a(n)},n))})]})})}],519029)},59158,e=>{"use strict";var t=e.i(843476),n=e.i(689664),s=e.i(466787),r=e.i(271645),l=e.i(798120),a=e.i(167881),i=e.i(736185),o=e.i(23750),c=e.i(917162),d=e.i(421429),u=e.i(184762),h=e.i(41533),m=e.i(968978),x=e.i(265402),f=e.i(519029),p=e.i(864723),g=e.i(895836),v=e.i(867927),b=e.i(456420);let j={name:"phone",size:24,node:[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]]};j.node;let y=(0,b.default)(j);var k=e.i(759659),S=e.i(660302),N=e.i(671428),w=e.i(222055),C=e.i(245629),A=e.i(609856),E=e.i(661504),T=e.i(647163),R=e.i(95187);let _=(0,R.createServerReference)("7f0ac011b0335ccbc4e877ba487ece0ed239d2f75d",R.callServer,void 0,R.findSourceMapURL,"deleteCallAction"),I=(0,R.createServerReference)("7f82cfe01c014083fefd463a144cd831b6f3c3fbcb",R.callServer,void 0,R.findSourceMapURL,"deleteEndedCallsAction");var M=e.i(561540),K=e.i(256604);function O(){return(0,t.jsx)(g.SettingGroup,{label:"Transcripts",children:(0,t.jsx)(g.SettingItems,{children:(0,t.jsxs)("button",{type:"button",onClick:()=>c.notify.component({className:"sm:max-w-3xl",renderer:()=>(0,t.jsx)(g.SettingDialogContent,{title:"Call history",description:"Everything said on the line, oldest at the top. Scroll up for older calls.",children:(0,t.jsx)(D,{})})}),className:"flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(y,{className:"size-4"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block text-sm font-medium",children:"Call history"}),(0,t.jsx)("span",{className:"block text-xs text-muted-foreground",children:"Every call, word for word — hers and yours"})]}),(0,t.jsx)(v.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground"})]})})})}let P={running:"working",waiting:"waiting on you",done:"done",failed:"failed"},z={running:"text-muted-foreground",waiting:T.WAITING_INK,done:"text-muted-foreground",failed:"text-destructive"},L="h-[min(34rem,58vh)] min-h-64 px-1";function D(){let{items:e,isLoading:n,isLoadingMore:s,error:i,hasMore:o,sentinelRef:d,refresh:u}=(0,E.useServerPages)({key:(e,t)=>{if(0===e)return l.queryKey.callHistory(null);let n=t?.at(-1);return n?l.queryKey.callHistory((0,C.toDate)(n.startedAt).toISOString()):null},size:h.CALL_HISTORY_PAGE,swr:{revalidateOnFocus:!1}}),m=(0,r.useMemo)(()=>[...e].reverse(),[e]),[x,f]=(0,A.useServerAction)(I,{okMessage:e=>1===e?"1 call deleted":`${e} calls deleted`,onOk:u}),p=async()=>{await c.notify.confirm({title:"Delete every call?",description:"Every turn of every call goes — and she stops reading any of it back into the next call. A call still on the line stays.",okText:"Delete all",destructive:!0})&&x()},v=(0,r.useRef)(null),b=(0,r.useRef)(!1),j=(0,r.useRef)(0);return((0,r.useLayoutEffect)(()=>{let e=v.current;e&&0!==m.length&&(b.current?e.scrollTop=e.scrollHeight-j.current:(b.current=!0,e.scrollTop=e.scrollHeight),j.current=e.scrollHeight-e.scrollTop)},[m]),n)?(0,t.jsx)("div",{className:(0,T.cn)(L,"overflow-hidden"),children:(0,t.jsx)(F,{})}):i?(0,t.jsx)(g.SettingError,{message:i.message}):(0,t.jsx)(t.Fragment,{children:0===m.length?(0,t.jsx)("p",{className:"px-1 text-sm leading-relaxed text-muted-foreground",children:"No calls yet. Everything said on the line is kept here — hers and yours, in the order it was said."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{ref:v,onScroll:e=>{let t=e.currentTarget;j.current=t.scrollHeight-t.scrollTop},className:(0,T.cn)(L,"overflow-y-auto overscroll-contain pb-6"),children:[(0,t.jsx)(g.SettingMore,{hasMore:o,loading:s,sentinelRef:d,count:1,ghost:(0,t.jsx)(F,{})}),m.map((e,n)=>(0,t.jsx)($,{call:e,first:0===n,onDropped:u},e.id))]}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(a.Button,{variant:"ghost",loading:f,onClick:p,className:"text-muted-foreground hover:text-destructive",children:[(0,t.jsx)(k.Trash2,{}),"Delete all"]})})]})})}function F(){return(0,t.jsxs)("div",{className:"pb-3",children:[(0,t.jsxs)("div",{className:"flex h-7 items-center gap-2.5",children:[(0,t.jsx)(N.Skeleton,{className:"h-3 w-24"}),(0,t.jsx)(N.Skeleton,{className:"h-3 w-10"})]}),(0,t.jsx)("div",{className:"mt-2 mb-[18px] h-px bg-border/60"}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(N.Skeleton,{className:"h-9 w-3/5 rounded-2xl rounded-br-sm"})}),(0,t.jsxs)("div",{className:"mt-3 flex items-start gap-2",children:[(0,t.jsx)(N.Skeleton,{className:"mt-0.5 size-[18px] shrink-0 rounded-full"}),(0,t.jsx)(N.Skeleton,{className:"mt-1 h-3.5 w-2/3"})]})]})}let H=e=>"user"===e.role?"user":"her";function $({call:e,first:n,onDropped:s}){let[r,l]=(0,A.useServerAction)(_,{okMessage:"Call deleted",onOk:s}),i=(0,C.toDate)(e.startedAt),o=e.turns.at(-1),d=e.endedAt&&o?function(e,t){let n=Math.max(0,Math.round((t.getTime()-e.getTime())/1e3));if(n<60)return`${n}s`;let s=Math.floor(n/60);return s<60?`${s}m ${String(n%60).padStart(2,"0")}s`:`${Math.floor(s/60)}h ${String(s%60).padStart(2,"0")}m`}(i,(0,C.toDate)(o.at)):"on the line",u=async()=>{await c.notify.confirm({title:`Delete the call from ${(0,C.whenOf)(i)}?`,description:"Every turn of it goes — and she stops reading it back into the next call.",okText:"Delete",destructive:!0})&&r(e.id)};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,T.cn)("group flex items-center gap-2.5",n?"mt-1":"mt-11"),children:[(0,t.jsx)("span",{title:`${e.provider} \xb7 ${e.model}`,className:"font-mono text-[10px] tracking-[0.14em] uppercase",children:(0,C.whenOf)(i)}),(0,t.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground",children:d}),(0,t.jsx)("span",{className:"ml-auto flex size-7 shrink-0 items-center justify-center",children:e.endedAt&&(0,t.jsx)(a.Button,{size:"icon-sm",variant:"ghost",loading:l,"aria-label":"Delete this call",onClick:u,className:"text-muted-foreground/60 opacity-0 transition-opacity group-hover:opacity-100 hover:text-destructive focus-visible:opacity-100",children:(0,t.jsx)(k.Trash2,{})})})]}),(0,t.jsx)("div",{className:"mt-2 mb-[18px] h-px bg-border/60"}),(function(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&"tool"===n.role&&"tool"===e.turn.role&&e.turn.tool===n.tool&&e.turn.text===n.text){e.repeats+=1;continue}t.push({turn:n,repeats:1})}return t})(e.turns).map(({turn:n,repeats:s},r,l)=>{var a,i;let o,c=l[r-1]?.turn,d=l[r+1]?.turn;return(0,t.jsx)(G,{turn:n,job:(a=e,i=n,(o=(0,M.delegatedLabel)(i.tool,i.text))?a.jobs.find(e=>e.label===o):void 0),repeats:s,opensRun:!c||H(c)!==H(n),closesRun:!d||H(d)!==H(n)},n.id)})]})}function G({turn:e,job:n,opensRun:s,closesRun:r,repeats:l=1}){return"tool"===e.role?(0,t.jsx)(V,{turn:e,job:n,repeats:l,opensRun:s}):"user"===e.role?(0,t.jsx)("div",{className:(0,T.cn)("flex justify-end",s?"mt-3":"mt-1"),children:(0,t.jsx)("p",{className:(0,T.cn)("max-w-[min(34rem,78%)] rounded-2xl bg-muted px-3.5 py-2 text-[13.5px] leading-relaxed break-keep whitespace-pre-wrap",r&&"rounded-br-sm"),children:e.text})}):(0,t.jsxs)("div",{className:(0,T.cn)("flex items-start gap-2",s?"mt-3":"mt-1"),children:[(0,t.jsx)(B,{face:s,className:"mt-0.5"}),(0,t.jsx)("p",{className:"max-w-[min(34rem,78%)] text-[13.5px] leading-relaxed break-keep whitespace-pre-wrap",children:e.text})]})}function B({face:e,className:n}){return(0,t.jsx)("span",{className:(0,T.cn)("grid size-[18px] shrink-0 place-items-center",n),children:e&&(0,t.jsx)(K.ThursdayMark,{size:18})})}function V({turn:e,job:n,repeats:s,opensRun:r}){let l=e.tool??"",a=(0,w.toolIcon)(l),i=(0,M.toolLine)(l,e.text);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,T.cn)("flex items-center gap-2",r?"mt-3":"mt-1.5"),children:[(0,t.jsx)(B,{face:r}),(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5 text-muted-foreground",children:[(0,t.jsx)(a,{className:"size-3 shrink-0"}),i&&(0,t.jsx)("span",{className:"truncate text-[11px] break-keep",children:i}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/60",children:l}),s>1&&(0,t.jsxs)("span",{className:"shrink-0 font-mono text-[10px] text-muted-foreground/70",children:["×",s]})]})]}),n&&(0,t.jsxs)("p",{className:"mt-0.5 ml-[26px] flex min-w-0 items-baseline gap-1.5 text-[11px]",children:["running"===n.status?(0,t.jsx)(S.ShinyText,{text:P.running,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,T.cn)("shrink-0 font-mono text-[10px]",z[n.status]),children:P[n.status]}),n.outcome&&"running"!==n.status&&(0,t.jsx)("span",{className:"truncate text-muted-foreground",children:(0,T.plainText)(n.outcome)})]})]})}var W=e.i(333495),U=e.i(933916),q=e.i(762074);let Y=(0,R.createServerReference)("7fa241ae08bf992a91ff0305fd62cff2597224f132",R.callServer,void 0,R.findSourceMapURL,"resetHistoryAction"),X=(0,R.createServerReference)("7f7ed086f54523b83b71c066e348abc9fb5050f73d",R.callServer,void 0,R.findSourceMapURL,"setCallSkillsAction");var Z=e.i(671228),J=e.i(67045),Q=e.i(698570),ee=e.i(319841),et=e.i(981203),en=e.i(283653);function es(){let{data:e}=(0,en.useServerRoute)(l.queryKey.callSkills),[n]=(0,A.useServerAction)(X,{onOk:()=>(0,en.revalidate)(l.queryKey.callSkills)});return(0,t.jsx)(g.SettingGroup,{label:"Skills",children:(0,t.jsx)(g.SettingToggle,{label:"Read a skill herself",description:"A skill is how a thing is done here, written down. On, she opens one mid-call and follows it; off, only bots read them.",checked:e??!1,disabled:void 0===e,onChange:e=>n(e),children:(0,t.jsx)(er,{})})})}function er(){let{data:e}=(0,en.useServerRoute)(l.queryKey.skills);return e?(0,t.jsx)(g.SettingNote,{className:(0,T.cn)(!e.length&&T.WAITING_INK),children:e.length?`The same ${e.length} a bot reads. Each one she opens spends a page of the call on it.`:"Nothing installed yet — there is nothing for her to read."}):null}function el(){let[e,n]=(0,A.useServerAction)(Y,{okMessage:({calls:e,tasks:t,notes:n})=>`Wiped ${e} calls, ${t} jobs, ${n} notes`,onOk:()=>{(0,en.revalidate)(l.queryKey.memory),(0,en.revalidate)(l.queryKey.tasks),(0,en.revalidate)(l.queryKey.callHistory(null))}}),r=async()=>{await c.notify.confirm({title:"Reset history?",description:"Every call, every job and everything she remembers is deleted for good. Keys, bots and connectors stay.",okText:"Reset",destructive:!0})&&e()};return(0,t.jsx)(g.SettingGroup,{label:"Danger zone",note:"Keys, bots and connectors stay.",children:(0,t.jsx)(g.SettingItems,{children:(0,t.jsxs)("div",{className:"flex items-center gap-3 p-4",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(s.TriangleAlert,{className:"size-4"})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block text-sm font-medium",children:"Reset history"}),(0,t.jsx)("span",{className:"block text-xs text-muted-foreground",children:"Every call, every job and everything she remembers"})]}),(0,t.jsx)(a.Button,{variant:"outline",size:"sm",loading:n,onClick:r,className:"shrink-0 text-destructive hover:text-destructive",children:"Reset"})]})})})}function ea({value:e,onChange:n}){let s=t=>n({...e,...t});return(0,t.jsx)(g.SettingGroup,{label:"Face",children:(0,t.jsxs)("div",{className:"space-y-5 py-2",children:[(0,t.jsxs)("div",{className:"flex flex-col items-center gap-4 pt-2",children:[(0,t.jsx)(W.Face,{look:e,size:176,className:"w-44"}),(0,t.jsx)(d.Segmented,{"aria-label":"Face",options:U.FACE_KINDS.map(e=>({value:e,label:W.FACES[e].label})),value:e.kind,onChange:e=>s({kind:e})}),(0,t.jsx)("p",{className:"max-w-sm text-center text-xs text-muted-foreground",children:W.FACES[e.kind].hint})]}),"mark"===e.kind&&(0,t.jsx)(f.MarkPalette,{color:e.color,themePicked:!e.color,onTheme:()=>s({color:void 0}),onPick:e=>s({color:e})}),"mark"===e.kind&&(0,t.jsx)(eo,{label:"Shape",children:(0,t.jsx)(d.Segmented,{"aria-label":"Shape",options:p.MARK_SHAPES.map(e=>({value:e,label:(0,t.jsx)("span",{className:"capitalize",children:e})})),value:e.shape??"blob",onChange:e=>s({shape:e})})}),"mark"===e.kind&&(0,t.jsx)(eo,{label:"Style",children:(0,t.jsx)(d.Segmented,{"aria-label":"Style",options:[{value:"solid",label:"Solid"},{value:"outline",label:"Outline"}],value:e.outline?"outline":"solid",onChange:e=>s({outline:"outline"===e||void 0})})}),"ascii"===e.kind&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eo,{label:"Glyphs",children:(0,t.jsx)(d.Segmented,{"aria-label":"Glyphs",options:U.ASCII_CHARSETS.map(e=>({value:e,label:ei[e]})),value:e.charset,onChange:e=>s({charset:e})})}),(0,t.jsx)(eo,{label:"Size",children:(0,t.jsx)(ec,{min:h.ASCII_FACE.fontSize.min,max:h.ASCII_FACE.fontSize.max,step:1,value:e.fontSize,format:e=>`${e}px`,onChange:e=>s({fontSize:e})})}),(0,t.jsx)(eo,{label:"Density",children:(0,t.jsx)(ec,{min:h.ASCII_FACE.density.min,max:h.ASCII_FACE.density.max,step:.1,value:e.density,format:e=>`${e.toFixed(1)}x`,onChange:e=>s({density:e})})})]})]})})}let ei={ascii:"Characters",emoji:"Sprinkled",emojiOnly:"All emoji"};function eo({label:e,children:n}){return(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)("span",{className:"w-16 shrink-0 font-mono text-[11px] text-muted-foreground",children:e}),n]})}function ec({value:e,onChange:n,format:s,...r}){return(0,t.jsxs)("span",{className:"flex min-w-0 flex-1 items-center gap-3",children:[(0,t.jsx)("input",{type:"range",...r,value:e,onChange:e=>n(Number(e.target.value)),className:"min-w-0 flex-1 accent-foreground"}),(0,t.jsx)("span",{className:"w-10 shrink-0 text-right font-mono text-[11px] text-muted-foreground tabular-nums",children:s(e)})]})}function ed({provider:e,value:r,hasKey:l,onPick:a}){let o=!!r,c=r?.voice??e.defaultVoice,d=r?.model??"";return(0,t.jsxs)("div",{className:(0,T.cn)("p-4",o&&"bg-muted/40"),children:[(0,t.jsxs)("button",{type:"button",disabled:o,onClick:()=>a({voice:null,model:null}),className:"flex w-full items-center gap-3 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-default",children:[(0,t.jsx)(m.ProviderIcon,{provider:e.id,className:"size-4 shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsx)("span",{className:"block truncate text-sm font-medium",children:e.label}),(0,t.jsx)("span",{className:"block truncate font-mono text-xs text-muted-foreground",children:d||e.models[0].id})]}),l?o&&(0,t.jsx)(n.Check,{className:"size-4 shrink-0"}):(0,t.jsxs)("span",{className:"flex shrink-0 items-center gap-1 font-mono text-[11px] text-muted-foreground",children:[(0,t.jsx)(s.TriangleAlert,{className:"size-3"}),"No key"]})]}),o&&(0,t.jsxs)("div",{className:"space-y-3 pt-3",children:[(0,t.jsx)(i.Combobox,{value:d,onChange:e=>a({voice:r?.voice??null,model:e||null}),options:e.models.map(e=>({value:e.id,label:e.label,hint:e.id})),"aria-label":`${e.label} realtime model`,placeholder:e.models[0].id,empty:"Not on the list — it still runs"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:e.voices.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>a({voice:e,model:r?.model??null}),className:(0,T.cn)("rounded-full border px-2.5 py-1 font-mono text-[11px] transition-colors outline-none focus-visible:ring-3 focus-visible:ring-ring/50",e===c?"border-foreground/40 text-foreground":"border-border/60 text-muted-foreground hover:text-foreground"),children:e},e))})]})]})}let eu={center:{label:"Her last line",hint:"One caption under the mark — only what she said."},sides:{label:"Last three turns",hint:"Hers on the left, yours on the right, beside the mark."}};function eh({value:e,onChange:n}){return(0,t.jsx)(g.SettingGroup,{label:"Calls you",note:"off"!==e&&"Needs this tab open. A tab that has been silent since it loaded may not be allowed to make a sound — the desktop notification covers that.",children:(0,t.jsx)(g.SettingChoiceRows,{options:Z.CALL_BACK_MODES.map(e=>({value:e,label:Z.CALL_BACK_LABEL[e],hint:em[e]})),value:e,onChange:n})})}let em={off:"Nothing opens a call but you.",waiting:"A job that stopped to ask gets her to ring you.",any:"Anything a bot finishes, she opens a line to tell you."};function ex({value:e,onChange:n}){return(0,t.jsx)(g.SettingGroup,{label:"Captions",children:(0,t.jsx)(g.SettingChoiceRows,{options:Z.CAPTION_VIEWS.map(e=>({value:e,label:eu[e].label,hint:eu[e].hint})),value:e,onChange:n})})}function ef({value:e,onChange:n}){let s=(0,Q.useDraft)(e.phrase,t=>n({...e,phrase:t}),{min:Z.WAKE_PHRASE.min}),r=s.value.trim().split(/\s+/).length<2;return(0,t.jsx)(g.SettingGroup,{label:"Wake",children:(0,t.jsx)(g.SettingToggle,{label:"Answer to her name",description:"Between calls, the browser listens for the phrase below and picks up when it hears it.",checked:e.enabled,onChange:t=>n({...e,enabled:t}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)(o.Input,{value:s.value,maxLength:Z.WAKE_PHRASE.max,spellCheck:!1,onChange:e=>s.set(e.target.value),onBlur:s.commit,onKeyDown:s.onKeyDown,"aria-label":"Wake phrase",className:"font-mono text-sm"}),(0,t.jsx)(g.SettingNote,{children:r?"One word will wake her by accident — say hello first.":"Heard loosely, in English. Near misses count."})]})})})}function ep({value:e,onChange:n}){let[s,l]=(0,r.useState)(!1),[a,i]=(0,r.useState)(!1),o=(0,ee.useHotkeyLabel)((0,ee.isCombo)(e.combo)?e.combo:null);return(0,t.jsx)(g.SettingGroup,{label:"Shortcut",children:(0,t.jsx)(g.SettingToggle,{label:"Answer to a key",description:"With this tab in front, the key below starts a call — and ends the one that is running.",checked:e.enabled,onChange:t=>n({...e,enabled:t}),children:(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("button",{type:"button",...ee.HOTKEY_CAPTURE,onClick:()=>{i(!1),l(!0)},onBlur:()=>l(!1),onKeyDown:s?t=>{if("Tab"===t.key)return;if(t.preventDefault(),t.stopPropagation(),"Escape"===t.key)return l(!1);let s=(0,ee.comboOf)(t.nativeEvent);if(!s)return i(!0);i(!1),l(!1),n({...e,combo:s})}:void 0,className:(0,T.cn)("w-full rounded-lg border px-3 py-2 font-mono text-sm outline-none transition-colors focus-visible:ring-3 focus-visible:ring-ring/50",s?"border-foreground/40 text-muted-foreground":"border-border/60 hover:bg-muted/50"),children:s?"Press the keys…":o??"Set a shortcut"}),(0,t.jsx)(g.SettingNote,{children:a?"Hold Ctrl, Alt or Cmd — a plain key is typing.":s?"Esc to keep the one you have.":"Only while this tab has focus. Not while you are typing."})]})})})}function eg({value:e,onSave:n}){let[s,l]=(0,r.useState)(e);return(0,t.jsx)(g.SettingGroup,{label:"Instructions",right:`${s.length}/${et.COMMON_VALIDATE.prompt.max}`,children:(0,t.jsxs)("div",{className:"space-y-3",children:[(0,t.jsx)(u.Textarea,{value:s,maxLength:et.COMMON_VALIDATE.prompt.max,onChange:e=>l(e.target.value),placeholder:"Anything else she should know before the first word — how to address you, what to skip.",className:"min-h-28"}),(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsx)(a.Button,{size:"sm",disabled:s===e,onClick:()=>n(s),children:"Save"})})]})})}e.s(["ThursdaySetting",0,function(){let e=(0,J.useThursdayStore)(),n=(0,J.useThursdayStore)(e=>e.patch),{data:s=[],isLoading:r,error:a}=(0,en.useServerRoute)(l.queryKey.llmModel),i=(0,q.useThursdayFace)();if(r)return(0,t.jsx)(g.SettingSkeleton,{rows:4});if(a)return(0,t.jsx)(g.SettingError,{message:a.message});let o=e.model?.provider??null;return(0,t.jsxs)(g.SettingScreen,{footer:(0,t.jsx)(g.SettingRailNote,{children:"Her prompt is assembled fresh on every call — memory, the roster and your skills go in."}),children:[(0,t.jsx)(ea,{value:i,onChange:q.setThursdayFace}),(0,t.jsx)(O,{}),(0,t.jsx)(g.SettingGroup,{label:"Voice",note:!o&&"Nothing picked — calls run on whichever key is set.",children:(0,t.jsx)(g.SettingItems,{children:x.SPEACH_MODEL_PROVIDER_LIST.map(r=>{let l;return(0,t.jsx)(ed,{provider:r,value:o===r.id?e.model:null,hasKey:(l=r.apiKeyName,s.some(e=>e.apiKeyName===l&&e.hasKey)),onPick:e=>n({model:{provider:r.id,...e}})},r.id)})})}),(0,t.jsx)(ex,{value:e.captionView,onChange:e=>n({captionView:e})}),(0,t.jsx)(ef,{value:e.wake,onChange:e=>n({wake:e})}),(0,t.jsx)(eh,{value:e.callBack,onChange:e=>n({callBack:e})}),(0,t.jsx)(ep,{value:e.hotkey,onChange:e=>n({hotkey:e})}),(0,t.jsx)(es,{}),(0,t.jsx)(eg,{value:e.systemPrompt??"",onSave:e=>n({systemPrompt:e})}),(0,t.jsx)(el,{})]})}],59158)},698570,e=>{"use strict";var t=e.i(271645);e.s(["useDraft",0,function(e,n,{min:s=1}={}){let[r,l]=(0,t.useState)(e),[a,i]=(0,t.useState)(e);return e!==a&&(i(e),l(e)),{value:r,set:l,commit:()=>{let t=r.trim();if(t.length<s)return l(e);l(t),t!==e&&n(t)},onKeyDown:e=>{"Enter"!==e.key||e.nativeEvent.isComposing||e.currentTarget.blur()}}}])},661504,e=>{"use strict";var t=e.i(271645),n=e.i(699018),s=e.i(677309),r=e.i(271235),l=e.i(802239),a=e.i(646192);let i=Promise.resolve(),o=(0,r.withMiddleware)(n.u,e=>(n,r,o)=>{let c,d=(0,t.useRef)(!1),{cache:u,initialSize:h=1,revalidateAll:m=!1,persistSize:x=!1,revalidateFirstPage:f=!0,revalidateOnMount:p=!1,parallel:g=!1}=o,[,,,v]=s.a.get(s.o);try{(c=(0,s.s)(n?n(0,null):null)[0])&&(c=a.INFINITE_PREFIX+c)}catch(e){}let[b,j,y]=(0,s.c)(u,c),k=(0,t.useCallback)(()=>(0,s.i)(b()._l)?h:b()._l,[u,c,h]);(0,l.useSyncExternalStore)((0,t.useCallback)(e=>c?y(c,()=>{e()}):()=>{},[u,c]),k,k);let S=(0,t.useCallback)(()=>{let e=b()._l;return(0,s.i)(e)?h:e},[c,h]),N=(0,t.useRef)(S());(0,s.u)(()=>{if(!d.current){d.current=!0;return}c&&j({_l:x?N.current:S()})},[c,u]);let w=p&&!d.current,C=e(c,async e=>{let t=b()._i,l=b()._r,a=s.a.get(u),i=a[8],c=()=>a[8]!==i;j({_r:s.U});let d=[],h=S(),[x]=(0,s.c)(u,e),p=x().data,y=[],k=null;for(let e=0;e<h;++e){let[a,i]=(0,s.s)(n(e,g?null:k));if(!a)break;let[h,x]=(0,s.c)(u,a),b=h().data,j=m||t||(0,s.i)(b)||f&&!e&&!(0,s.i)(p)||w||p&&!(0,s.i)(p[e])&&!o.compare(p[e],b);if(r&&("function"==typeof l?l(b,i):j)){let t=async()=>{if(a in v){let e=v[a];delete v[a],b=await e}else b=await r(i);c()||x({data:b,_k:i}),d[e]=b};g?y.push(t):await t()}else d[e]=b;g||(k=b)}return g&&await Promise.all(y.map(e=>e())),c()||j({_i:s.U}),d},o),A=(0,t.useCallback)(function(e,t){let n="boolean"==typeof t?{revalidate:t}:t||{},r=!1!==n.revalidate;return c?(r&&((0,s.i)(e)?j({_i:!0,_r:n.revalidate}):j({_i:!1,_r:n.revalidate})),arguments.length?C.mutate(e,{...n,revalidate:r}):C.mutate()):i},[c,u]),E=(0,t.useCallback)(e=>{let t;if(!c)return i;let[,r]=(0,s.c)(u,c);if((0,s.e)(e)?t=e(S()):"number"==typeof e&&(t=e),"number"!=typeof t)return i;r({_l:t}),N.current=t;let l=[],[a]=(0,s.c)(u,c),o=null;for(let e=0;e<t;++e){let[t]=(0,s.s)(n(e,o)),[r]=(0,s.c)(u,t),i=t?r().data:s.U;if((0,s.i)(i))return A(a().data);l.push(i),o=i}return A(l)},[c,u,A,S]);return{size:S(),setSize:E,mutate:A,get data(){return C.data},get error(){return C.error},get isValidating(){return C.isValidating},get isLoading(){return C.isLoading}}});var c=e.i(41533),d=e.i(283653);e.s(["useServerPages",0,function(e){let n=e.size??c.PAGE_SIZE,{key:s}=e,{data:r,error:l,isLoading:a,isValidating:i,setSize:u,mutate:h}=o((e,t)=>(0,d.resolveKey)(s(e,t)),d.fetchRoute,{dedupingInterval:500,revalidateOnMount:!0,revalidateOnFocus:!0,revalidateOnReconnect:!0,focusThrottleInterval:1e3,revalidateFirstPage:!1,...e.swr}),m=r??[],x=m.flat(),f=m.at(-1),p=void 0!==f&&f.length>=n,g=(0,t.useRef)(0),v=i&&m.length>0&&g.current>m.length,b=(0,t.useRef)({isValidating:i,setSize:u,pages:m.length});b.current={isValidating:i,setSize:u,pages:m.length};let j=(0,d.resolveKey)(s(0,null)),y="string"==typeof j?j:j?.url;(0,t.useEffect)(()=>{if(y)return(0,d.registerPagedReader)({url:y,refresh:()=>h()})},[y,h]);let k=function(e,n={}){let{enabled:s=!0,margin:r="600px",revision:l}=n,a=(0,t.useRef)(e);a.current=e;let i=(0,t.useRef)(null),o=(0,t.useRef)(null),c=(0,t.useCallback)(e=>{i.current=e},[]);return(0,t.useEffect)(()=>{o.current?.disconnect();let e=i.current;if(e&&s)return o.current=new IntersectionObserver(([e])=>{e.isIntersecting&&a.current()},{root:function(e){let t=e.parentElement;for(;t;){let{overflowY:e}=getComputedStyle(t);if(("auto"===e||"scroll"===e)&&t.scrollHeight>t.clientHeight)return t;t=t.parentElement}return null}(e),rootMargin:r}),o.current.observe(e),()=>o.current?.disconnect()},[s,r,l]),c}(()=>{let e=b.current;e.isValidating||(g.current=e.pages+1,e.setSize(e.pages+1))},{enabled:p,revision:`${m.length}:${i}`});return{items:x,isLoading:a,isLoadingMore:v,error:l,hasMore:p,sentinelRef:k,refresh:()=>h()}}],661504)},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)},466787,e=>{"use strict";var t=e.i(755566);e.s(["TriangleAlert",()=>t.default])}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,833959,e=>{"use strict";var t=e.i(843476),s=e.i(456420);let n={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"}]]};n.node;let r=(0,s.default)(n);var i=e.i(328256),l=e.i(24071),a=e.i(867927),o=e.i(829600),d=e.i(226091),c=e.i(726067),u=e.i(91511);let m={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"}]]};m.node;let x=(0,s.default)(m);var h=e.i(77071),p=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 g=(0,s.default)(f);var j=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 k=(0,s.default)(v);var b=e.i(271645),y=e.i(798120),N=e.i(167881),S=e.i(986530),w=e.i(23750),C=e.i(683408),z=e.i(917162),M=e.i(671428),R=e.i(319036),F=e.i(127341),L=e.i(184762),T=e.i(41533),A=e.i(895836),D=e.i(95187);let $=(0,D.createServerReference)("7f6ea0b94fed342484ac46cbadf1b8c4a65574103d",D.callServer,void 0,D.findSourceMapURL,"createSkillAction"),K=(0,D.createServerReference)("7f5d8a58afc993b28e0d65ceb273bbc1563a5a0f96",D.callServer,void 0,D.findSourceMapURL,"deleteSkillAction"),q=(0,D.createServerReference)("7ff3e5663097e128448f141172ac1d19851ee8456b",D.callServer,void 0,D.findSourceMapURL,"setSkillDisabledAction"),P=(0,D.createServerReference)("7fee438d730e3bae9a984816f037af1ba292df2e98",D.callServer,void 0,D.findSourceMapURL,"uploadSkillAction");var B=e.i(609856),O=e.i(283653),U=e.i(647163);let I={browser:u.Globe,computer:r,"find-skills":p.Search,"interactive-page":x,"skill-creator":g};function E({skill:e}){let[s,n]=(0,B.useServerAction)(K,{onOk:()=>(0,O.revalidate)(y.queryKey.skills)}),[r]=(0,B.useServerAction)(q,{onOk:()=>(0,O.revalidate)(y.queryKey.skills)}),l=async()=>{await z.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&&I[e.dir]||i.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,z.notify.component({className:"sm:max-w-4xl",renderer:()=>(0,t.jsx)(H,{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,U.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,U.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)(R.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)(N.Button,{size:"icon-sm",variant:"ghost",loading:n,onClick:l,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(j.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function H({skill:e}){let[s,n]=(0,b.useState)(""),[r,i]=(0,b.useState)("SKILL.md");return(0,t.jsx)(A.SettingDialogContent,{title:e.name,description:(0,t.jsx)(W,{skill:e,path:r??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:()=>n(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)(l.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s.split("/").pop()})]}),(0,t.jsx)(G,{source:e.source,dir:e.dir,path:s,current:r,onPick:e=>{let t=s?`${s}/${e.name}`:e.name;"dir"===e.kind?n(t):i(t)}})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r?(0,t.jsx)(Z,{source:e.source,dir:e.dir,path:r}):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function W({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 n=[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:n.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,U.cn)("truncate",s===n.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function V({icon:e,label:s,active:n,hasChildren:r,onClick:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,U.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",n?"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}),r&&(0,t.jsx)(a.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function G({source:e,dir:s,path:n,current:r,onPick:i}){let{data:l,isLoading:a,error:u}=(0,O.useServerRoute)(y.queryKey.skillNode(e,s,n));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):a||!l?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(M.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(M.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==l.kind?null:(0,t.jsxs)(t.Fragment,{children:[l.entries.map(e=>(0,t.jsx)(V,{icon:"dir"===e.kind?(0,t.jsx)(c.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(d.FileText,{}):(0,t.jsx)(o.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(n?`${n}/${e.name}`:e.name)===r,onClick:()=>i(e)},e.name)),0===l.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function Y({content:e}){let s=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),n=s?.[1].trim(),r=s?e.slice(s[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[n&&(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:n}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(C.Markdown,{children:r})})]})}function Z({source:e,dir:s,path:n}){let{data:r,isLoading:i,error:l}=(0,O.useServerRoute)(y.queryKey.skillNode(e,s,n));if(l)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:l.message});if(i||!r)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(M.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(M.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(M.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==r.kind)return null;let a=n.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:a}),(0,t.jsx)("span",{className:"shrink-0",children:(0,U.formatBytes)(r.size)})]}),null===r.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."}):a.toLowerCase().endsWith(".md")?(0,t.jsx)(Y,{content:r.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:r.content})]})}function _(){return z.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(J,{onDone:e})})}function J({onDone:e}){let[s,n]=(0,b.useState)("write"),[r,i]=(0,b.useState)(""),[l,a]=(0,b.useState)(""),[o,d]=(0,b.useState)(""),[c,u]=(0,b.useState)(null),[m,x]=(0,b.useState)(!1),p=(0,b.useRef)(null),f={errorMessage:!1,onOk:()=>{(0,O.revalidate)(y.queryKey.skills),e()}},[g,j,,v]=(0,B.useServerAction)($,f),[C,z,,M]=(0,B.useServerAction)(P,f),R=j||z,D="write"===s?v:M,K=!R&&("write"===s?r.trim()&&l.trim()&&o.trim():null!==c),q=async()=>{var e;!K||("write"===s?g({name:r.trim(),description:l.trim(),content:o}):c&&C({fileName:c.name,base64:await (e=c,new Promise((t,s)=>{let n=new FileReader;n.onload=()=>{let e=n.result;t(e.slice(e.indexOf(",")+1))},n.onerror=()=>s(n.error),n.readAsDataURL(e)}))}))},I=e=>{let t=e?.[0]??null;t&&u(t)};return(0,t.jsxs)(A.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)(N.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(N.Button,{disabled:!K,loading:R,onClick:q,children:[!R&&("write"===s?(0,t.jsx)(h.Plus,{}):(0,t.jsx)(k,{})),"write"===s?"Create":"Upload"]})]}),children:[(0,t.jsxs)(F.Tabs,{value:s,onValueChange:e=>n(e),children:[(0,t.jsxs)(F.TabsList,{className:"w-full",children:[(0,t.jsx)(F.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(F.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(F.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(S.Field,{children:[(0,t.jsx)(S.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(S.FieldContent,{children:[(0,t.jsx)(w.Input,{id:"skill-name",value:r,onChange:e=>i(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[T.PATHS.skills.custom,"/",r.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(S.Field,{children:[(0,t.jsx)(S.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(S.FieldContent,{children:(0,t.jsx)(w.Input,{id:"skill-description",value:l,onChange:e=>a(e.target.value),placeholder:"When to use it — this is how the agent decides to load it"})})]}),(0,t.jsxs)(S.Field,{children:[(0,t.jsx)(S.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)(F.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>p.current?.click(),onDragOver:e=>{e.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:e=>{e.preventDefault(),x(!1),I(e.dataTransfer.files)},className:(0,U.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)(k,{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,U.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:p,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."]})]})]})]}),D&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:D})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,b.useState)(""),{data:n,isLoading:r,error:i}=(0,O.useServerRoute)(y.queryKey.skills),l=n??[];if(r)return(0,t.jsx)(A.SettingSkeleton,{rows:4});if(i)return(0,t.jsx)(A.SettingError,{message:i.message});let a=e.trim().toLowerCase(),o=l.filter(e=>!a||`${e.name} ${e.description}`.toLowerCase().includes(a)),d=l.filter(e=>!e.disabled).length;return(0,t.jsxs)(A.SettingScreen,{footer:(0,t.jsxs)(A.SettingRailNote,{children:[l.filter(e=>"default"===e.source).length," shipped · ",l.filter(e=>"custom"===e.source).length," ","installed"]}),children:[(0,t.jsx)(A.SettingToolbar,{count:`${d} on \xb7 ${l.length-d} off`,children:(0,t.jsx)(A.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(A.SettingGroup,{label:"Custom",hint:"yours — added here · wins a name clash",children:(0,t.jsx)(A.SettingItems,{addRow:{label:"Add skill",onClick:_},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(E,{skill:e},`custom/${e.dir}`))})}),(0,t.jsx)(A.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(A.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(E,{skill:e},`default/${e.dir}`))})}),d>T.PROMPT_CROWDED.skills&&(0,t.jsxs)(A.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."]})]})},"openSkillCreate",0,_],833959)},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 n=(0,t.default)(s);e.s(["Folder",0,n],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 n=(0,t.default)(s);e.s(["Trash2",0,n],759659)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,833959,e=>{"use strict";var t=e.i(843476),s=e.i(456420);let n={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"}]]};n.node;let r=(0,s.default)(n);var i=e.i(328256),l=e.i(24071),a=e.i(867927),o=e.i(829600),d=e.i(226091),c=e.i(726067),u=e.i(91511);let m={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"}]]};m.node;let x=(0,s.default)(m);var h=e.i(77071),p=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 g=(0,s.default)(f);var j=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 k=(0,s.default)(v);var b=e.i(271645),y=e.i(798120),N=e.i(167881),S=e.i(986530),w=e.i(23750),C=e.i(683408),z=e.i(917162),M=e.i(671428),R=e.i(319036),F=e.i(127341),L=e.i(184762),T=e.i(41533),A=e.i(895836),D=e.i(95187);let $=(0,D.createServerReference)("7fd2be038aaf192febe6ff64aaa1cae78aa143c0c0",D.callServer,void 0,D.findSourceMapURL,"createSkillAction"),K=(0,D.createServerReference)("7f9f1e120f08a19080c12fcdb8240f9c4acc302d2e",D.callServer,void 0,D.findSourceMapURL,"deleteSkillAction"),q=(0,D.createServerReference)("7f63c41bac986f62db6dafc188e4e50b71eff95d4d",D.callServer,void 0,D.findSourceMapURL,"setSkillDisabledAction"),P=(0,D.createServerReference)("7fc28100d5c9fe991232c48d1c4ed58771916e504e",D.callServer,void 0,D.findSourceMapURL,"uploadSkillAction");var B=e.i(609856),O=e.i(283653),U=e.i(647163);let I={browser:u.Globe,computer:r,"find-skills":p.Search,"interactive-page":x,"skill-creator":g};function E({skill:e}){let[s,n]=(0,B.useServerAction)(K,{onOk:()=>(0,O.revalidate)(y.queryKey.skills)}),[r]=(0,B.useServerAction)(q,{onOk:()=>(0,O.revalidate)(y.queryKey.skills)}),l=async()=>{await z.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&&I[e.dir]||i.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,z.notify.component({className:"sm:max-w-4xl",renderer:()=>(0,t.jsx)(H,{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,U.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,U.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)(R.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)(N.Button,{size:"icon-sm",variant:"ghost",loading:n,onClick:l,className:"shrink-0 text-muted-foreground",children:(0,t.jsx)(j.Trash2,{})}):(0,t.jsx)("span",{className:"size-7 shrink-0"})]})]})}function H({skill:e}){let[s,n]=(0,b.useState)(""),[r,i]=(0,b.useState)("SKILL.md");return(0,t.jsx)(A.SettingDialogContent,{title:e.name,description:(0,t.jsx)(W,{skill:e,path:r??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:()=>n(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)(l.ChevronLeft,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:s.split("/").pop()})]}),(0,t.jsx)(G,{source:e.source,dir:e.dir,path:s,current:r,onPick:e=>{let t=s?`${s}/${e.name}`:e.name;"dir"===e.kind?n(t):i(t)}})]}),(0,t.jsx)("div",{className:"min-w-0 flex-1 overflow-y-auto",children:r?(0,t.jsx)(Z,{source:e.source,dir:e.dir,path:r}):(0,t.jsx)("p",{className:"p-6 text-sm text-muted-foreground/60",children:"Pick a file"})})]})})}function W({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 n=[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:n.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,U.cn)("truncate",s===n.length-1&&"text-foreground"),children:e})]},`${s}-${e}`))})}function V({icon:e,label:s,active:n,hasChildren:r,onClick:i}){return(0,t.jsxs)("button",{type:"button",onClick:i,className:(0,U.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",n?"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}),r&&(0,t.jsx)(a.ChevronRight,{className:"size-3 shrink-0 text-muted-foreground/50"})]})}function G({source:e,dir:s,path:n,current:r,onPick:i}){let{data:l,isLoading:a,error:u}=(0,O.useServerRoute)(y.queryKey.skillNode(e,s,n));return u?(0,t.jsx)("p",{className:"p-3 font-mono text-xs text-destructive",children:u.message}):a||!l?(0,t.jsxs)("div",{className:"space-y-2 p-2",children:[(0,t.jsx)(M.Skeleton,{className:"h-5 w-full"}),(0,t.jsx)(M.Skeleton,{className:"h-5 w-4/5"})]}):"dir"!==l.kind?null:(0,t.jsxs)(t.Fragment,{children:[l.entries.map(e=>(0,t.jsx)(V,{icon:"dir"===e.kind?(0,t.jsx)(c.Folder,{}):e.name.endsWith(".md")?(0,t.jsx)(d.FileText,{}):(0,t.jsx)(o.File,{}),label:e.name,hasChildren:"dir"===e.kind,active:(n?`${n}/${e.name}`:e.name)===r,onClick:()=>i(e)},e.name)),0===l.entries.length&&(0,t.jsx)("p",{className:"p-3 text-xs text-muted-foreground/60",children:"Empty folder"})]})}function Y({content:e}){let s=/^---\r?\n([\s\S]*?)\r?\n---[ \t]*\r?\n?/.exec(e),n=s?.[1].trim(),r=s?e.slice(s[0].length):e;return(0,t.jsxs)("div",{className:"min-w-0",children:[n&&(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:n}),(0,t.jsx)("div",{className:"px-5 py-4 text-sm leading-relaxed",children:(0,t.jsx)(C.Markdown,{children:r})})]})}function Z({source:e,dir:s,path:n}){let{data:r,isLoading:i,error:l}=(0,O.useServerRoute)(y.queryKey.skillNode(e,s,n));if(l)return(0,t.jsx)("p",{className:"p-4 font-mono text-xs text-destructive",children:l.message});if(i||!r)return(0,t.jsxs)("div",{className:"space-y-3 p-5",children:[(0,t.jsx)(M.Skeleton,{className:"h-5 w-2/3"}),(0,t.jsx)(M.Skeleton,{className:"h-4 w-full"}),(0,t.jsx)(M.Skeleton,{className:"h-4 w-5/6"})]});if("file"!==r.kind)return null;let a=n.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:a}),(0,t.jsx)("span",{className:"shrink-0",children:(0,U.formatBytes)(r.size)})]}),null===r.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."}):a.toLowerCase().endsWith(".md")?(0,t.jsx)(Y,{content:r.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:r.content})]})}function _(){return z.notify.component({className:"sm:max-w-lg",renderer:({close:e})=>(0,t.jsx)(J,{onDone:e})})}function J({onDone:e}){let[s,n]=(0,b.useState)("write"),[r,i]=(0,b.useState)(""),[l,a]=(0,b.useState)(""),[o,d]=(0,b.useState)(""),[c,u]=(0,b.useState)(null),[m,x]=(0,b.useState)(!1),p=(0,b.useRef)(null),f={errorMessage:!1,onOk:()=>{(0,O.revalidate)(y.queryKey.skills),e()}},[g,j,,v]=(0,B.useServerAction)($,f),[C,z,,M]=(0,B.useServerAction)(P,f),R=j||z,D="write"===s?v:M,K=!R&&("write"===s?r.trim()&&l.trim()&&o.trim():null!==c),q=async()=>{var e;!K||("write"===s?g({name:r.trim(),description:l.trim(),content:o}):c&&C({fileName:c.name,base64:await (e=c,new Promise((t,s)=>{let n=new FileReader;n.onload=()=>{let e=n.result;t(e.slice(e.indexOf(",")+1))},n.onerror=()=>s(n.error),n.readAsDataURL(e)}))}))},I=e=>{let t=e?.[0]??null;t&&u(t)};return(0,t.jsxs)(A.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)(N.Button,{variant:"ghost",onClick:e,children:"Cancel"}),(0,t.jsxs)(N.Button,{disabled:!K,loading:R,onClick:q,children:[!R&&("write"===s?(0,t.jsx)(h.Plus,{}):(0,t.jsx)(k,{})),"write"===s?"Create":"Upload"]})]}),children:[(0,t.jsxs)(F.Tabs,{value:s,onValueChange:e=>n(e),children:[(0,t.jsxs)(F.TabsList,{className:"w-full",children:[(0,t.jsx)(F.TabsTrigger,{value:"write",children:"Write"}),(0,t.jsx)(F.TabsTrigger,{value:"upload",children:"Upload"})]}),(0,t.jsxs)(F.TabsContent,{value:"write",className:"space-y-5 pt-4",children:[(0,t.jsxs)(S.Field,{children:[(0,t.jsx)(S.FieldLabel,{htmlFor:"skill-name",children:"Name"}),(0,t.jsxs)(S.FieldContent,{children:[(0,t.jsx)(w.Input,{id:"skill-name",value:r,onChange:e=>i(e.target.value),placeholder:"deploy-checklist",spellCheck:!1,autoFocus:!0}),(0,t.jsxs)("p",{className:"font-mono text-[11px] text-muted-foreground",children:[T.PATHS.skills.custom,"/",r.trim()||"…","/SKILL.md"]})]})]}),(0,t.jsxs)(S.Field,{children:[(0,t.jsx)(S.FieldLabel,{htmlFor:"skill-description",children:"Description"}),(0,t.jsx)(S.FieldContent,{children:(0,t.jsx)(w.Input,{id:"skill-description",value:l,onChange:e=>a(e.target.value),placeholder:"When to use it — this is how the agent decides to load it"})})]}),(0,t.jsxs)(S.Field,{children:[(0,t.jsx)(S.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)(F.TabsContent,{value:"upload",className:"space-y-4 pt-4",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>p.current?.click(),onDragOver:e=>{e.preventDefault(),x(!0)},onDragLeave:()=>x(!1),onDrop:e=>{e.preventDefault(),x(!1),I(e.dataTransfer.files)},className:(0,U.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)(k,{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,U.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:p,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."]})]})]})]}),D&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:D})]})}e.s(["SkillsSetting",0,function(){let[e,s]=(0,b.useState)(""),{data:n,isLoading:r,error:i}=(0,O.useServerRoute)(y.queryKey.skills),l=n??[];if(r)return(0,t.jsx)(A.SettingSkeleton,{rows:4});if(i)return(0,t.jsx)(A.SettingError,{message:i.message});let a=e.trim().toLowerCase(),o=l.filter(e=>!a||`${e.name} ${e.description}`.toLowerCase().includes(a)),d=l.filter(e=>!e.disabled).length;return(0,t.jsxs)(A.SettingScreen,{footer:(0,t.jsxs)(A.SettingRailNote,{children:[l.filter(e=>"default"===e.source).length," shipped · ",l.filter(e=>"custom"===e.source).length," ","installed"]}),children:[(0,t.jsx)(A.SettingToolbar,{count:`${d} on \xb7 ${l.length-d} off`,children:(0,t.jsx)(A.SettingFilter,{value:e,onChange:s,placeholder:"Filter skills"})}),(0,t.jsx)(A.SettingGroup,{label:"Custom",hint:"yours — added here · wins a name clash",children:(0,t.jsx)(A.SettingItems,{addRow:{label:"Add skill",onClick:_},children:o.filter(e=>"custom"===e.source).map(e=>(0,t.jsx)(E,{skill:e},`custom/${e.dir}`))})}),(0,t.jsx)(A.SettingGroup,{label:"Default",hint:"ships with the app · switch off, can't edit or delete",children:(0,t.jsx)(A.SettingItems,{children:o.filter(e=>"default"===e.source).map(e=>(0,t.jsx)(E,{skill:e},`default/${e.dir}`))})}),d>T.PROMPT_CROWDED.skills&&(0,t.jsxs)(A.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."]})]})},"openSkillCreate",0,_],833959)},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 n=(0,t.default)(s);e.s(["Folder",0,n],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 n=(0,t.default)(s);e.s(["Trash2",0,n],759659)}]);
@@ -1,6 +1,6 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,787800,e=>{"use strict";var t=e.i(843476),n=e.i(689664),s=e.i(716327),r=e.i(867927),o=e.i(456420);let a={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};a.node;let i=(0,o.default)(a);var c=e.i(77071);let l={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};l.node;let d=(0,o.default)(l),m={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};m.node;let p=(0,o.default)(m);var u=e.i(759659),h=e.i(263676),g=e.i(271645),f=e.i(798120),x=e.i(167881),v=e.i(986530),j=e.i(23750),y=e.i(647163);let b=(0,g.memo)(({data:e,name:n,initialExpandDepth:s=2})=>{let r=(0,g.useMemo)(()=>"string"==typeof e?function(e){let t=e.trim();if(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]")))return{success:!1,data:e};try{return{success:!0,data:JSON.parse(e)}}catch{return{success:!1,data:e}}}(e).data:e,[e]);return(0,t.jsx)("div",{className:" text-sm transition-all duration-300",children:(0,t.jsx)(N,{data:r,name:n,depth:0,initialExpandDepth:s})})});b.displayName="JsonView";let N=(0,g.memo)(({data:e,name:n,depth:s=0,initialExpandDepth:r})=>{var o;let a=void 0===e?"undefined":Array.isArray(e)?"array":null===e?"null":typeof e,[i,c]=(0,g.useState)("string"!==a&&s<r),l={number:"text-blue-500",boolean:"text-amber-500",null:"text-purple-500",undefined:"text-gray-500",string:"text-foreground break-all whitespace-pre-wrap",default:"text-muted-foreground"};switch(a){case"object":case"array":let d,m,p;return m=(d=(o="array"===a)?e:Object.entries(e)).length,p={open:o?"[":"{",close:o?"]":"}",collapsed:o?"[ ... ]":"{ ... }",empty:o?"[]":"{}"},0===m?(0,t.jsxs)("div",{className:"flex items-center",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:p.empty})]}):(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded cursor-pointer group hover:bg-input/30",onClick:()=>c(!i),children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),i?(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.open}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.collapsed}),(0,t.jsxs)("span",{className:"ml-1 text-muted-foreground group-hover:text-foreground",children:[m," ",1===m?"item":"items"]})]})]}),i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"pl-2 ml-4 border-l border-border",children:o?d.map((e,n)=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(N,{data:e,name:`${n}`,depth:s+1,initialExpandDepth:r})},n)):d.map(([e,n])=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(N,{data:n,name:e,depth:s+1,initialExpandDepth:r})},e))}),(0,t.jsx)("div",{className:"text-muted-foreground",children:p.close})]})]});case"string":return e.length>100?(0,t.jsxs)("div",{className:"flex mr-1 rounded group hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),(0,t.jsx)("pre",{className:(0,y.cn)(l.string,"cursor-pointer group-hover:text-foreground"),onClick:()=>c(!i),title:i?"Click to collapse":"Click to expand",children:i?`"${e}"`:`"${e.slice(0,100)}..."`})]}):(0,t.jsxs)("div",{className:"flex mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsxs)("pre",{className:l.string,children:['"',e,'"']})]});case"undefined":return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l.undefined,children:"undefined"})]});default:return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l[a]||l.default,children:null===e?"null":String(e)})]})}});N.displayName="JsonNode";var k=e.i(917162),S=e.i(319036),C=e.i(127341),w=e.i(184762),z=e.i(6799),O=e.i(95187);let T=(0,O.createServerReference)("7fa0c79ff2fb7f80629f25e491a9e69729aeedbd9a",O.callServer,void 0,O.findSourceMapURL,"callToolAction"),A=(0,O.createServerReference)("7f3396873361a98f9646981d66a61d2f8a456275ad",O.callServer,void 0,O.findSourceMapURL,"deleteServerAction"),I=(0,O.createServerReference)("7f959e357c3e9baa28d463b01bf77f8d21bdb66ca6",O.callServer,void 0,O.findSourceMapURL,"refreshServerAction"),P=(0,O.createServerReference)("7f6eacef15427e497ad6330ff0fa5820ce77ba0e87",O.callServer,void 0,O.findSourceMapURL,"registerServerAction");var F=e.i(681307),$=e.i(245629);let M=F.z.object({url:F.z.url(),headers:F.z.record(F.z.string(),F.z.string()).optional(),oauthClient:F.z.object({clientId:F.z.string().min(1),clientSecret:F.z.string().optional()}).optional()}),R=F.z.object({command:F.z.string().min(1),args:F.z.array(F.z.string()).optional(),env:F.z.record(F.z.string(),F.z.string()).optional()}),D=F.z.union([M,R]),E=F.z.object({name:F.z.string(),description:F.z.string().optional(),inputSchema:F.z.looseObject({}).optional(),outputSchema:F.z.looseObject({}).optional()});function L(e){return"url"in e}F.z.object({clientInformation:F.z.looseObject({}).optional(),tokens:F.z.looseObject({}).optional(),authorizationServer:F.z.looseObject({}).optional(),codeVerifier:F.z.string().optional(),state:F.z.string().optional()});let q=F.z.object({name:F.z.string().min(1).max(40),config:D,toolCount:F.z.number().int(),lastError:F.z.string().nullish()}),B=E.extend({id:F.z.number().int(),description:F.z.string().nullish()});q.omit({toolCount:!0}).extend({tools:B.array().default([]),toolsSyncedAt:$.DateLikeSchema});let J=F.z.object({name:F.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:D}),U=F.z.union([F.z.object({mcpServers:F.z.record(F.z.string(),D)}),F.z.record(F.z.string(),D)]),K=[{name:"notion",icon:"notion.so",description:"Pages, databases, and search",config:{url:"https://mcp.notion.com/mcp"}},{name:"github",icon:"github.com",description:"Repos, issues, PRs — paste a personal access token",config:{url:"https://api.githubcopilot.com/mcp/",headers:{Authorization:"Bearer <your-github-pat>"}}},{name:"linear",icon:"linear.app",description:"Issues, projects, and cycles",config:{url:"https://mcp.linear.app/mcp"}},{name:"slack",icon:"slack.com",description:"Channels, messages, and search",config:{url:"https://mcp.slack.com/mcp"}},{name:"atlassian",icon:"atlassian.com",description:"Jira and Confluence",config:{url:"https://mcp.atlassian.com/v1/mcp"}},{name:"asana",icon:"asana.com",description:"Tasks, projects, and portfolios",config:{url:"https://mcp.asana.com/mcp"}},{name:"monday",icon:"monday.com",description:"Boards, items, and updates",config:{url:"https://mcp.monday.com/mcp"}},{name:"clickup",icon:"clickup.com",description:"Tasks, docs, and spaces",config:{url:"https://mcp.clickup.com/mcp"}},{name:"airtable",icon:"airtable.com",description:"Bases, tables, and records",config:{url:"https://mcp.airtable.com/mcp"}},{name:"box",icon:"box.com",description:"Files, folders, and content search",config:{url:"https://mcp.box.com/mcp"}},{name:"figma",icon:"figma.com",description:"Design files and components",config:{url:"https://mcp.figma.com/mcp"}},{name:"canva",icon:"canva.com",description:"Create and manage designs",config:{url:"https://mcp.canva.com/mcp"}},{name:"sanity",icon:"sanity.io",description:"Structured content and datasets",config:{url:"https://mcp.sanity.io/mcp"}},{name:"webflow",icon:"webflow.com",description:"Sites, pages, and CMS collections",config:{url:"https://mcp.webflow.com/mcp"}},{name:"wix",icon:"wix.com",description:"Sites, stores, and bookings",config:{url:"https://mcp.wix.com/mcp"}},{name:"hubspot",icon:"hubspot.com",description:"Contacts, deals, and companies",config:{url:"https://app.hubspot.com/mcp/v1/http"}},{name:"attio",icon:"attio.com",description:"CRM records and lists",config:{url:"https://mcp.attio.com/mcp"}},{name:"intercom",icon:"intercom.com",description:"Conversations and support tickets",config:{url:"https://mcp.intercom.com/mcp"}},{name:"fireflies",icon:"fireflies.ai",description:"Meeting transcripts and summaries",config:{url:"https://mcp.fireflies.ai/mcp"}},{name:"stripe",icon:"stripe.com",description:"Payments, invoices, and customers",config:{url:"https://mcp.stripe.com"}},{name:"paypal",icon:"paypal.com",description:"Payments and orders",config:{url:"https://mcp.paypal.com/mcp"}},{name:"square",icon:"squareup.com",description:"Payments, catalog, and orders",config:{url:"https://mcp.squareup.com/mcp"}},{name:"ramp",icon:"ramp.com",description:"Spend, cards, and transactions",config:{url:"https://mcp.ramp.com/mcp"}},{name:"vercel",icon:"vercel.com",description:"Deployments and projects",config:{url:"https://mcp.vercel.com"}},{name:"netlify",icon:"netlify.com",description:"Sites, builds, and deploys",config:{url:"https://mcp.netlify.com/mcp"}},{name:"cloudflare",icon:"cloudflare.com",description:"Workers bindings — D1, R2, KV",config:{url:"https://bindings.mcp.cloudflare.com/mcp"}},{name:"supabase",icon:"supabase.com",description:"Projects, tables, and SQL",config:{url:"https://mcp.supabase.com/mcp"}},{name:"neon",icon:"neon.tech",description:"Postgres branches and queries",config:{url:"https://mcp.neon.tech/mcp"}},{name:"prisma",icon:"prisma.io",description:"Postgres databases and schema",config:{url:"https://mcp.prisma.io/mcp"}},{name:"sentry",icon:"sentry.io",description:"Errors and performance issues",config:{url:"https://mcp.sentry.dev/mcp"}},{name:"grafana",icon:"grafana.com",description:"Dashboards, metrics, and alerts",config:{url:"https://mcp.grafana.com/mcp"}},{name:"semgrep",icon:"semgrep.dev",description:"Scan code for security findings",config:{url:"https://mcp.semgrep.ai/mcp"}},{name:"postman",icon:"postman.com",description:"Collections, environments, and requests",config:{url:"https://mcp.postman.com/mcp"}},{name:"resend",icon:"resend.com",description:"Send email and manage audiences",config:{url:"https://mcp.resend.com/mcp"}},{name:"hugging-face",icon:"huggingface.co",description:"Models, datasets, and Spaces",config:{url:"https://huggingface.co/mcp"}},{name:"apify",icon:"apify.com",description:"Run scrapers and automation actors",config:{url:"https://mcp.apify.com"}},{name:"exa",icon:"exa.ai",description:"Web search for agents",config:{url:"https://mcp.exa.ai/mcp"}},{name:"kagi",icon:"kagi.com",description:"Search, summarize, and answer",config:{url:"https://mcp.kagi.com/mcp"}},{name:"context7",icon:"context7.com",description:"Up-to-date library docs",config:{url:"https://mcp.context7.com/mcp"}},{name:"deepwiki",icon:"deepwiki.com",description:"Ask questions about any GitHub repo",config:{url:"https://mcp.deepwiki.com/mcp"}},{name:"microsoft-learn",icon:"learn.microsoft.com",description:"Microsoft and Azure docs — no account",config:{url:"https://learn.microsoft.com/api/mcp"}},{name:"aws-knowledge",icon:"aws.amazon.com",description:"AWS docs and API references — no account",config:{url:"https://knowledge-mcp.global.api.aws"}},{name:"cloudflare-docs",icon:"developers.cloudflare.com",description:"Cloudflare docs — no account",config:{url:"https://docs.mcp.cloudflare.com/mcp"}},{name:"stack-overflow",icon:"stackoverflow.com",description:"Questions, answers, and teams",config:{url:"https://mcp.stackoverflow.com"}},{name:"playwright",icon:"playwright.dev",description:"Drive a real browser",config:{command:"npx",args:["@playwright/mcp@latest"]}},{name:"chrome-devtools",icon:"developer.chrome.com",description:"Inspect and debug Chrome",config:{command:"npx",args:["chrome-devtools-mcp@latest"]}}];var _=e.i(895836),H=e.i(333999),W=e.i(609856),V=e.i(283653);function G({name:e,onDone:n}){let{data:s,isLoading:r}=(0,V.useServerRoute)(f.queryKey.mcpServer(e)),[o,a]=(0,W.useServerAction)(I,{...ec,onOk:t=>{ec.onOk(t),(0,V.revalidate)(f.queryKey.mcpServer(e))}}),[i,c]=(0,W.useServerAction)(A,{okMessage:"Server deleted",onOk:()=>{n(),(0,V.revalidate)(f.queryKey.mcp)}}),l=async()=>{await k.notify.confirm({title:`Delete ${e}?`,description:"Its connection and saved authorization go with it.",okText:"Delete",destructive:!0})&&i(e)};if(r)return(0,t.jsx)(_.SettingSkeleton,{rows:4});if(!s)return null;let m=s.tools.length,p=L(s.config)?"HTTP":"STDIO";return(0,t.jsxs)(_.SettingDialogContent,{title:s.name,description:(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:p}),(0,t.jsx)("span",{className:"truncate font-mono",children:ed(s.config)})]}),footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(x.Button,{variant:"ghost",loading:c,onClick:l,children:[(0,t.jsx)(u.Trash2,{}),"Delete"]}),(0,t.jsxs)(x.Button,{variant:"outline",loading:a,onClick:()=>o(s.name),children:[(0,t.jsx)(d,{}),"Reconnect"]})]}),children:[s.lastError&&(0,t.jsx)("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 font-mono text-xs text-destructive",children:s.lastError}),(0,t.jsxs)("p",{className:"text-right font-mono text-xs text-muted-foreground",children:[m," ",1===m?"tool":"tools"]}),s.tools.map(e=>(0,t.jsx)(Y,{tool:e,serverName:s.name},e.name))]})}function Q({server:e}){let s=e.toolCount,o=e.lastError?"error":s>0?"connected":"idle";return(0,t.jsxs)("button",{type:"button",onClick:()=>{k.notify.component({className:"sm:max-w-3xl",renderer:({close:n})=>(0,t.jsx)(G,{name:e.name,onDone:n})})},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(X,{server:e})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.name}),"connected"===o&&(0,t.jsx)(n.Check,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:"error"===o?(0,t.jsx)("span",{className:"text-destructive",children:e.lastError}):(0,t.jsxs)(t.Fragment,{children:[s>0?`${s} ${1===s?"tool":"tools"}`:"No tools yet",(0,t.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground/70",children:[" · ",ed(e.config)]})]})})]}),(0,t.jsx)(r.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function X({server:e}){let n,s=(n=K.find(t=>L(t.config)?L(e.config)&&t.config.url.replace(/\/+$/,"")===e.config.url.replace(/\/+$/,""):!L(e.config)&&t.config.command===e.config.command&&(t.config.args??[]).join(" ")===(e.config.args??[]).join(" "))??K.find(t=>t.name===e.name),n?.icon);return s?(0,t.jsx)("img",{src:(0,y.faviconUrl)(s),alt:"",className:"size-5"}):(0,t.jsx)(p,{className:"size-4"})}function Y({tool:e,serverName:n}){let[o,a]=(0,g.useState)(!1),[i,c]=(0,g.useState)(!1),[l,d]=(0,g.useState)(!1),m=[["inputSchema",e.inputSchema],["outputSchema",e.outputSchema]].filter(([,e])=>e);return(0,t.jsxs)("div",{className:"rounded-xl border border-border/60 bg-background p-4",children:[(0,t.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-sm",children:e.name}),e.description?(0,t.jsx)("p",{className:(0,y.cn)("text-xs text-muted-foreground",!l&&"line-clamp-2",e.description.length>140&&"cursor-pointer"),onClick:()=>d(!l),children:e.description}):null]}),(0,t.jsxs)("div",{className:"mt-2 flex justify-end gap-1",children:[m.length>0&&(0,t.jsxs)(x.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(!o),children:[o?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(r.ChevronRight,{}),"Schema"]}),(0,t.jsxs)(x.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>c(!i),children:[i?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(r.ChevronRight,{}),"Test"]})]}),o?(0,t.jsx)("div",{className:"mt-2 space-y-3 overflow-x-auto rounded-lg border border-input p-3",children:m.map(([e,n])=>(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"block font-mono text-xs text-muted-foreground",children:"inputSchema"===e?"in":"out"}),(0,t.jsx)("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre",children:function e(t,n=0){if(!t||"object"!=typeof t)return"unknown";let s=" ".repeat(n+1),r=" ".repeat(n);if(Array.isArray(t.enum))return t.enum.map(e=>JSON.stringify(e)).join(" | ");let o=t.anyOf??t.oneOf;if(Array.isArray(o))return o.map(t=>e(t,n)).join(" | ");if("array"===t.type){let s=e(t.items,n);return/[|{]/.test(s)?`(${s})[]`:`${s}[]`}if("object"===t.type||t.properties){let o=t.properties;if(!o||0===Object.keys(o).length)return"{}";let a=t.required??[],i=Object.entries(o).map(([t,r])=>{let o=a.includes(t)?"":"?",i=r?.description,c="string"==typeof i&&i.length<=60?` // ${i}`:"";return`${s}${t}${o}: ${e(r,n+1)}${c}`});return`{
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,787800,e=>{"use strict";var t=e.i(843476),n=e.i(689664),s=e.i(716327),r=e.i(867927),o=e.i(456420);let a={name:"play",size:24,node:[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]};a.node;let i=(0,o.default)(a);var c=e.i(77071);let l={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};l.node;let d=(0,o.default)(l),m={name:"server",size:24,node:[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]};m.node;let p=(0,o.default)(m);var u=e.i(759659),h=e.i(263676),g=e.i(271645),f=e.i(798120),x=e.i(167881),v=e.i(986530),j=e.i(23750),b=e.i(647163);let y=(0,g.memo)(({data:e,name:n,initialExpandDepth:s=2})=>{let r=(0,g.useMemo)(()=>"string"==typeof e?function(e){let t=e.trim();if(!(t.startsWith("{")&&t.endsWith("}"))&&!(t.startsWith("[")&&t.endsWith("]")))return{success:!1,data:e};try{return{success:!0,data:JSON.parse(e)}}catch{return{success:!1,data:e}}}(e).data:e,[e]);return(0,t.jsx)("div",{className:" text-sm transition-all duration-300",children:(0,t.jsx)(N,{data:r,name:n,depth:0,initialExpandDepth:s})})});y.displayName="JsonView";let N=(0,g.memo)(({data:e,name:n,depth:s=0,initialExpandDepth:r})=>{var o;let a=void 0===e?"undefined":Array.isArray(e)?"array":null===e?"null":typeof e,[i,c]=(0,g.useState)("string"!==a&&s<r),l={number:"text-blue-500",boolean:"text-amber-500",null:"text-purple-500",undefined:"text-gray-500",string:"text-foreground break-all whitespace-pre-wrap",default:"text-muted-foreground"};switch(a){case"object":case"array":let d,m,p;return m=(d=(o="array"===a)?e:Object.entries(e)).length,p={open:o?"[":"{",close:o?"]":"}",collapsed:o?"[ ... ]":"{ ... }",empty:o?"[]":"{}"},0===m?(0,t.jsxs)("div",{className:"flex items-center",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:"text-muted-foreground",children:p.empty})]}):(0,t.jsxs)("div",{className:"flex flex-col",children:[(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded cursor-pointer group hover:bg-input/30",onClick:()=>c(!i),children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),i?(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.open}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{className:"text-muted-foreground group-hover:text-foreground",children:p.collapsed}),(0,t.jsxs)("span",{className:"ml-1 text-muted-foreground group-hover:text-foreground",children:[m," ",1===m?"item":"items"]})]})]}),i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"pl-2 ml-4 border-l border-border",children:o?d.map((e,n)=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(N,{data:e,name:`${n}`,depth:s+1,initialExpandDepth:r})},n)):d.map(([e,n])=>(0,t.jsx)("div",{className:"my-1",children:(0,t.jsx)(N,{data:n,name:e,depth:s+1,initialExpandDepth:r})},e))}),(0,t.jsx)("div",{className:"text-muted-foreground",children:p.close})]})]});case"string":return e.length>100?(0,t.jsxs)("div",{className:"flex mr-1 rounded group hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground hover:text-foreground",children:[n,":"]}),(0,t.jsx)("pre",{className:(0,b.cn)(l.string,"cursor-pointer group-hover:text-foreground"),onClick:()=>c(!i),title:i?"Click to collapse":"Click to expand",children:i?`"${e}"`:`"${e.slice(0,100)}..."`})]}):(0,t.jsxs)("div",{className:"flex mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsxs)("pre",{className:l.string,children:['"',e,'"']})]});case"undefined":return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l.undefined,children:"undefined"})]});default:return(0,t.jsxs)("div",{className:"flex items-center mr-1 rounded hover:bg-input/30",children:[n&&(0,t.jsxs)("span",{className:"mr-1 text-muted-foreground",children:[n,":"]}),(0,t.jsx)("span",{className:l[a]||l.default,children:null===e?"null":String(e)})]})}});N.displayName="JsonNode";var k=e.i(917162),S=e.i(319036),C=e.i(127341),w=e.i(184762),z=e.i(6799),O=e.i(95187);let T=(0,O.createServerReference)("7f09644e5c2cb7a6e7509f514d3a68ef068bf90077",O.callServer,void 0,O.findSourceMapURL,"callToolAction"),A=(0,O.createServerReference)("7f093c4b2999625019cfc89d41f66242633137b303",O.callServer,void 0,O.findSourceMapURL,"deleteServerAction"),I=(0,O.createServerReference)("7f5a8be5815d72b1969dc7e76d81e7aa2b6e9c0d95",O.callServer,void 0,O.findSourceMapURL,"refreshServerAction"),P=(0,O.createServerReference)("7fac698b428abfbc71051fcef2c891ac51c590bb7d",O.callServer,void 0,O.findSourceMapURL,"registerServerAction");var F=e.i(681307),$=e.i(245629);let M=F.z.object({url:F.z.url(),headers:F.z.record(F.z.string(),F.z.string()).optional(),oauthClient:F.z.object({clientId:F.z.string().min(1),clientSecret:F.z.string().optional()}).optional()}),R=F.z.object({command:F.z.string().min(1),args:F.z.array(F.z.string()).optional(),env:F.z.record(F.z.string(),F.z.string()).optional()}),D=F.z.union([M,R]),E=F.z.object({name:F.z.string(),description:F.z.string().optional(),inputSchema:F.z.looseObject({}).optional(),outputSchema:F.z.looseObject({}).optional()});function L(e){return"url"in e}F.z.object({clientInformation:F.z.looseObject({}).optional(),tokens:F.z.looseObject({}).optional(),authorizationServer:F.z.looseObject({}).optional(),codeVerifier:F.z.string().optional(),state:F.z.string().optional()});let q=F.z.object({name:F.z.string().min(1).max(40),config:D,toolCount:F.z.number().int(),lastError:F.z.string().nullish()}),B=E.extend({id:F.z.number().int(),description:F.z.string().nullish()});q.omit({toolCount:!0}).extend({tools:B.array().default([]),toolsSyncedAt:$.DateLikeSchema});let J=F.z.object({name:F.z.string().min(1,"Name is required").max(40).regex(/^[a-zA-Z0-9_-]+$/,"Only letters, numbers, - and _ are allowed"),config:D}),U=F.z.union([F.z.object({mcpServers:F.z.record(F.z.string(),D)}),F.z.record(F.z.string(),D)]),K=[{name:"notion",icon:"notion.so",description:"Pages, databases, and search",config:{url:"https://mcp.notion.com/mcp"}},{name:"github",icon:"github.com",description:"Repos, issues, PRs — paste a personal access token",config:{url:"https://api.githubcopilot.com/mcp/",headers:{Authorization:"Bearer <your-github-pat>"}}},{name:"linear",icon:"linear.app",description:"Issues, projects, and cycles",config:{url:"https://mcp.linear.app/mcp"}},{name:"slack",icon:"slack.com",description:"Channels, messages, and search",config:{url:"https://mcp.slack.com/mcp"}},{name:"atlassian",icon:"atlassian.com",description:"Jira and Confluence",config:{url:"https://mcp.atlassian.com/v1/mcp"}},{name:"asana",icon:"asana.com",description:"Tasks, projects, and portfolios",config:{url:"https://mcp.asana.com/mcp"}},{name:"monday",icon:"monday.com",description:"Boards, items, and updates",config:{url:"https://mcp.monday.com/mcp"}},{name:"clickup",icon:"clickup.com",description:"Tasks, docs, and spaces",config:{url:"https://mcp.clickup.com/mcp"}},{name:"airtable",icon:"airtable.com",description:"Bases, tables, and records",config:{url:"https://mcp.airtable.com/mcp"}},{name:"box",icon:"box.com",description:"Files, folders, and content search",config:{url:"https://mcp.box.com/mcp"}},{name:"figma",icon:"figma.com",description:"Design files and components",config:{url:"https://mcp.figma.com/mcp"}},{name:"canva",icon:"canva.com",description:"Create and manage designs",config:{url:"https://mcp.canva.com/mcp"}},{name:"sanity",icon:"sanity.io",description:"Structured content and datasets",config:{url:"https://mcp.sanity.io/mcp"}},{name:"webflow",icon:"webflow.com",description:"Sites, pages, and CMS collections",config:{url:"https://mcp.webflow.com/mcp"}},{name:"wix",icon:"wix.com",description:"Sites, stores, and bookings",config:{url:"https://mcp.wix.com/mcp"}},{name:"hubspot",icon:"hubspot.com",description:"Contacts, deals, and companies",config:{url:"https://app.hubspot.com/mcp/v1/http"}},{name:"attio",icon:"attio.com",description:"CRM records and lists",config:{url:"https://mcp.attio.com/mcp"}},{name:"intercom",icon:"intercom.com",description:"Conversations and support tickets",config:{url:"https://mcp.intercom.com/mcp"}},{name:"fireflies",icon:"fireflies.ai",description:"Meeting transcripts and summaries",config:{url:"https://mcp.fireflies.ai/mcp"}},{name:"stripe",icon:"stripe.com",description:"Payments, invoices, and customers",config:{url:"https://mcp.stripe.com"}},{name:"paypal",icon:"paypal.com",description:"Payments and orders",config:{url:"https://mcp.paypal.com/mcp"}},{name:"square",icon:"squareup.com",description:"Payments, catalog, and orders",config:{url:"https://mcp.squareup.com/mcp"}},{name:"ramp",icon:"ramp.com",description:"Spend, cards, and transactions",config:{url:"https://mcp.ramp.com/mcp"}},{name:"vercel",icon:"vercel.com",description:"Deployments and projects",config:{url:"https://mcp.vercel.com"}},{name:"netlify",icon:"netlify.com",description:"Sites, builds, and deploys",config:{url:"https://mcp.netlify.com/mcp"}},{name:"cloudflare",icon:"cloudflare.com",description:"Workers bindings — D1, R2, KV",config:{url:"https://bindings.mcp.cloudflare.com/mcp"}},{name:"supabase",icon:"supabase.com",description:"Projects, tables, and SQL",config:{url:"https://mcp.supabase.com/mcp"}},{name:"neon",icon:"neon.tech",description:"Postgres branches and queries",config:{url:"https://mcp.neon.tech/mcp"}},{name:"prisma",icon:"prisma.io",description:"Postgres databases and schema",config:{url:"https://mcp.prisma.io/mcp"}},{name:"sentry",icon:"sentry.io",description:"Errors and performance issues",config:{url:"https://mcp.sentry.dev/mcp"}},{name:"grafana",icon:"grafana.com",description:"Dashboards, metrics, and alerts",config:{url:"https://mcp.grafana.com/mcp"}},{name:"semgrep",icon:"semgrep.dev",description:"Scan code for security findings",config:{url:"https://mcp.semgrep.ai/mcp"}},{name:"postman",icon:"postman.com",description:"Collections, environments, and requests",config:{url:"https://mcp.postman.com/mcp"}},{name:"resend",icon:"resend.com",description:"Send email and manage audiences",config:{url:"https://mcp.resend.com/mcp"}},{name:"hugging-face",icon:"huggingface.co",description:"Models, datasets, and Spaces",config:{url:"https://huggingface.co/mcp"}},{name:"apify",icon:"apify.com",description:"Run scrapers and automation actors",config:{url:"https://mcp.apify.com"}},{name:"exa",icon:"exa.ai",description:"Web search for agents",config:{url:"https://mcp.exa.ai/mcp"}},{name:"kagi",icon:"kagi.com",description:"Search, summarize, and answer",config:{url:"https://mcp.kagi.com/mcp"}},{name:"context7",icon:"context7.com",description:"Up-to-date library docs",config:{url:"https://mcp.context7.com/mcp"}},{name:"deepwiki",icon:"deepwiki.com",description:"Ask questions about any GitHub repo",config:{url:"https://mcp.deepwiki.com/mcp"}},{name:"microsoft-learn",icon:"learn.microsoft.com",description:"Microsoft and Azure docs — no account",config:{url:"https://learn.microsoft.com/api/mcp"}},{name:"aws-knowledge",icon:"aws.amazon.com",description:"AWS docs and API references — no account",config:{url:"https://knowledge-mcp.global.api.aws"}},{name:"cloudflare-docs",icon:"developers.cloudflare.com",description:"Cloudflare docs — no account",config:{url:"https://docs.mcp.cloudflare.com/mcp"}},{name:"stack-overflow",icon:"stackoverflow.com",description:"Questions, answers, and teams",config:{url:"https://mcp.stackoverflow.com"}},{name:"playwright",icon:"playwright.dev",description:"Drive a real browser",config:{command:"npx",args:["@playwright/mcp@latest"]}},{name:"chrome-devtools",icon:"developer.chrome.com",description:"Inspect and debug Chrome",config:{command:"npx",args:["chrome-devtools-mcp@latest"]}}];var _=e.i(895836),H=e.i(333999),W=e.i(609856),V=e.i(283653);function G({name:e,onDone:n}){let{data:s,isLoading:r}=(0,V.useServerRoute)(f.queryKey.mcpServer(e)),[o,a]=(0,W.useServerAction)(I,{...ec,onOk:t=>{ec.onOk(t),(0,V.revalidate)(f.queryKey.mcpServer(e))}}),[i,c]=(0,W.useServerAction)(A,{okMessage:"Server deleted",onOk:()=>{n(),(0,V.revalidate)(f.queryKey.mcp)}}),l=async()=>{await k.notify.confirm({title:`Delete ${e}?`,description:"Its connection and saved authorization go with it.",okText:"Delete",destructive:!0})&&i(e)};if(r)return(0,t.jsx)(_.SettingSkeleton,{rows:4});if(!s)return null;let m=s.tools.length,p=L(s.config)?"HTTP":"STDIO";return(0,t.jsxs)(_.SettingDialogContent,{title:s.name,description:(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"shrink-0 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px]",children:p}),(0,t.jsx)("span",{className:"truncate font-mono",children:ed(s.config)})]}),footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(x.Button,{variant:"ghost",loading:c,onClick:l,children:[(0,t.jsx)(u.Trash2,{}),"Delete"]}),(0,t.jsxs)(x.Button,{variant:"outline",loading:a,onClick:()=>o(s.name),children:[(0,t.jsx)(d,{}),"Reconnect"]})]}),children:[s.lastError&&(0,t.jsx)("p",{className:"rounded-lg bg-destructive/10 px-3 py-2 font-mono text-xs text-destructive",children:s.lastError}),(0,t.jsxs)("p",{className:"text-right font-mono text-xs text-muted-foreground",children:[m," ",1===m?"tool":"tools"]}),s.tools.map(e=>(0,t.jsx)(Y,{tool:e,serverName:s.name},e.name))]})}function Q({server:e}){let s=e.toolCount,o=e.lastError?"error":s>0?"connected":"idle";return(0,t.jsxs)("button",{type:"button",onClick:()=>{k.notify.component({className:"sm:max-w-3xl",renderer:({close:n})=>(0,t.jsx)(G,{name:e.name,onDone:n})})},className:"group flex w-full items-center gap-3 p-4 text-left outline-none transition-colors hover:bg-muted/50 focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:ring-inset",children:[(0,t.jsx)("span",{className:"grid size-10 shrink-0 place-items-center rounded-lg bg-muted text-muted-foreground",children:(0,t.jsx)(X,{server:e})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 space-y-0.5",children:[(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)("span",{className:"truncate text-sm font-medium",children:e.name}),"connected"===o&&(0,t.jsx)(n.Check,{className:"size-3 shrink-0 text-muted-foreground"})]}),(0,t.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:"error"===o?(0,t.jsx)("span",{className:"text-destructive",children:e.lastError}):(0,t.jsxs)(t.Fragment,{children:[s>0?`${s} ${1===s?"tool":"tools"}`:"No tools yet",(0,t.jsxs)("span",{className:"font-mono text-[11px] text-muted-foreground/70",children:[" · ",ed(e.config)]})]})})]}),(0,t.jsx)(r.ChevronRight,{className:"size-4 shrink-0 text-muted-foreground/60 transition-colors group-hover:text-foreground"})]})}function X({server:e}){let n,s=(n=K.find(t=>L(t.config)?L(e.config)&&t.config.url.replace(/\/+$/,"")===e.config.url.replace(/\/+$/,""):!L(e.config)&&t.config.command===e.config.command&&(t.config.args??[]).join(" ")===(e.config.args??[]).join(" "))??K.find(t=>t.name===e.name),n?.icon);return s?(0,t.jsx)("img",{src:(0,b.faviconUrl)(s),alt:"",className:"size-5"}):(0,t.jsx)(p,{className:"size-4"})}function Y({tool:e,serverName:n}){let[o,a]=(0,g.useState)(!1),[i,c]=(0,g.useState)(!1),[l,d]=(0,g.useState)(!1),m=[["inputSchema",e.inputSchema],["outputSchema",e.outputSchema]].filter(([,e])=>e);return(0,t.jsxs)("div",{className:"rounded-xl border border-border/60 bg-background p-4",children:[(0,t.jsxs)("div",{className:"min-w-0 space-y-1",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-sm",children:e.name}),e.description?(0,t.jsx)("p",{className:(0,b.cn)("text-xs text-muted-foreground",!l&&"line-clamp-2",e.description.length>140&&"cursor-pointer"),onClick:()=>d(!l),children:e.description}):null]}),(0,t.jsxs)("div",{className:"mt-2 flex justify-end gap-1",children:[m.length>0&&(0,t.jsxs)(x.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>a(!o),children:[o?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(r.ChevronRight,{}),"Schema"]}),(0,t.jsxs)(x.Button,{size:"xs",variant:"ghost",className:"font-mono",onClick:()=>c(!i),children:[i?(0,t.jsx)(s.ChevronDown,{}):(0,t.jsx)(r.ChevronRight,{}),"Test"]})]}),o?(0,t.jsx)("div",{className:"mt-2 space-y-3 overflow-x-auto rounded-lg border border-input p-3",children:m.map(([e,n])=>(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("span",{className:"block font-mono text-xs text-muted-foreground",children:"inputSchema"===e?"in":"out"}),(0,t.jsx)("pre",{className:"font-mono text-xs leading-relaxed whitespace-pre",children:function e(t,n=0){if(!t||"object"!=typeof t)return"unknown";let s=" ".repeat(n+1),r=" ".repeat(n);if(Array.isArray(t.enum))return t.enum.map(e=>JSON.stringify(e)).join(" | ");let o=t.anyOf??t.oneOf;if(Array.isArray(o))return o.map(t=>e(t,n)).join(" | ");if("array"===t.type){let s=e(t.items,n);return/[|{]/.test(s)?`(${s})[]`:`${s}[]`}if("object"===t.type||t.properties){let o=t.properties;if(!o||0===Object.keys(o).length)return"{}";let a=t.required??[],i=Object.entries(o).map(([t,r])=>{let o=a.includes(t)?"":"?",i=r?.description,c="string"==typeof i&&i.length<=60?` // ${i}`:"";return`${s}${t}${o}: ${e(r,n+1)}${c}`});return`{
2
2
  ${i.join("\n")}
3
- ${r}}`}return Array.isArray(t.type)?t.type.join(" | "):"string"==typeof t.type?t.type:"unknown"}(n)})]},e))}):null,i?(0,t.jsx)(Z,{tool:e,serverName:n}):null]})}function Z({tool:e,serverName:n}){let[s,r]=(0,g.useState)(()=>(function(e){let t=e.inputSchema?.properties;if(!t||"object"!=typeof t)return"{}";let n={};for(let[e,s]of Object.entries(t))n[e]=s?.type==="number"||s?.type==="integer"?0:s?.type!=="boolean"&&(s?.type==="array"?[]:s?.type==="object"?{}:"");return JSON.stringify(n,null,2)})(e)),[o,a]=(0,g.useState)(""),[c,l,d,m,p]=(0,W.useServerAction)(T,{errorMessage:!1});return(0,t.jsxs)("div",{className:"mt-2 space-y-2 rounded-lg border border-input p-3",children:[(0,t.jsx)(w.Textarea,{value:s,onChange:e=>r(e.target.value),spellCheck:!1,className:"min-h-24 resize-none font-mono text-xs"}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"font-mono text-xs text-destructive",children:o||m}),(0,t.jsxs)(x.Button,{size:"sm",loading:l,onClick:()=>{let t;try{t=s.trim()?JSON.parse(s):void 0}catch{a("Not valid JSON");return}a(""),p(),c(n,e.name,t)},children:[!l&&(0,t.jsx)(i,{}),"Run"]})]}),void 0!==d&&(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg bg-muted/40 p-3",children:(0,t.jsx)(b,{data:d,initialExpandDepth:3})})]})}function ee(e){return k.notify.component({className:"sm:max-w-lg",renderer:({close:n})=>(0,t.jsx)(et,{initial:e,onDone:n})})}function et({initial:e,onDone:n}){let s=e&&L(e.config)?e.config:void 0,r=e&&!L(e.config)?e.config:void 0,[o,a]=(0,H.useObjectState)({mode:r?"stdio":"http",name:e?.name??"",url:s?.url??"",headers:er(s?.headers),clientId:s?.oauthClient?.clientId??"",clientSecret:s?.oauthClient?.clientSecret??"",command:r?.command??"",args:(r?.args??[]).join(" "),env:er(r?.env),raw:""}),{mode:i,name:c,url:l,headers:d,clientId:m,clientSecret:p,command:u,args:h,env:f,raw:y}=o,[b,N]=(0,W.useServerAction)(P,{...ec,onOk:e=>{ec.onOk(e),"error"!==e.status&&n()}}),k=(0,g.useMemo)(()=>{var e,t,n,s,r,o,a;let c,g;return"json"===i?function(e){let t,n=e.trim();if(!n)return{value:null,error:""};try{t=JSON.parse(n)}catch{return{value:null,error:"Not valid JSON"}}let s=D.safeParse(t);if(s.success)return{value:{name:null,config:s.data},error:""};let r=U.safeParse(t);if(!r.success)return{value:null,error:"Needs a url or a command"};let o=Object.entries("mcpServers"in r.data?r.data.mcpServers:r.data)[0];return o?{value:{name:o[0],config:o[1]},error:""}:{value:null,error:"No server in there"}}(y):"http"===i?(e=l,t=d,n=m,s=p,(c=M.safeParse({url:e.trim(),headers:eo(t),oauthClient:n.trim()?{clientId:n.trim(),clientSecret:s.trim()}:void 0})).success?{value:{name:null,config:c.data},error:""}:{value:null,error:e.trim()?"Needs a valid url":""}):(r=u,o=h,a=f,(g=R.safeParse({command:r.trim(),args:o.split(/\s+/).filter(Boolean),env:eo(a)})).success?{value:{name:null,config:g.data},error:""}:{value:null,error:r.trim()?"Needs a command":""})},[i,y,l,d,m,p,u,h,f]),z="json"===i?y:JSON.stringify([i,l,d,m,p,u,h,f]),[O,T]=(0,g.useState)(z);(0,g.useEffect)(()=>{let e=setTimeout(()=>T(z),700);return()=>clearTimeout(e)},[z]);let A=O===z?k.error:"",I=c||k.value?.name||"",F=J.safeParse({name:I,config:k.value?.config});function $(e){let t=k.value?.config;return t?"json"===e?a({mode:e,raw:JSON.stringify(t,null,2)}):"http"===e&&L(t)?a({mode:e,url:t.url,headers:er(t.headers),clientId:t.oauthClient?.clientId??"",clientSecret:t.oauthClient?.clientSecret??""}):"stdio"!==e||L(t)?void a({mode:e}):a({mode:e,command:t.command,args:(t.args??[]).join(" "),env:er(t.env)}):a({mode:e})}let E=(0,t.jsxs)("span",{className:"flex items-center gap-2 font-mono text-xs text-muted-foreground",children:["JSON",(0,t.jsx)(S.Switch,{size:"sm",checked:"json"===i,onCheckedChange:e=>{let t;return e?$("json"):void $((t=k.value?.config)&&!L(t)?"stdio":"http")}})]});return(0,t.jsx)(_.SettingDialogContent,{title:"Add MCP server",description:"Its tools become available to Thursday and every sub-agent.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Button,{variant:"ghost",onClick:n,children:"Cancel"}),(0,t.jsx)(x.Button,{disabled:!F.success,loading:N,onClick:()=>{F.success&&!N&&b(F.data)},children:"Connect"})]}),children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"Name"}),(0,t.jsx)(j.Input,{value:I,onChange:e=>a({name:e.target.value}),placeholder:"notion",spellCheck:!1})]}),"json"===i?(0,t.jsxs)(v.Field,{children:[(0,t.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,t.jsx)(v.FieldLabel,{children:"JSON"}),E]}),(0,t.jsx)(w.Textarea,{value:y,onChange:e=>a({raw:e.target.value}),spellCheck:!1,placeholder:ea,className:"min-h-64 resize-none font-mono text-xs"})]}):(0,t.jsxs)(C.Tabs,{value:i,onValueChange:e=>$(e),className:"gap-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,t.jsx)(v.FieldLabel,{children:"Transport"}),E]}),(0,t.jsxs)(C.TabsList,{className:"w-full",children:[(0,t.jsx)(C.TabsTrigger,{value:"http",children:"HTTP"}),(0,t.jsx)(C.TabsTrigger,{value:"stdio",children:"STDIO"})]})]}),(0,t.jsxs)(C.TabsContent,{value:"http",className:"space-y-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"URL"}),(0,t.jsx)(j.Input,{value:l,onChange:e=>a({url:e.target.value}),placeholder:"https://mcp.notion.com/mcp",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsx)(en,{label:"Headers",pairs:d,onChange:e=>a({headers:e}),keyPlaceholder:"Authorization",valuePlaceholder:"Bearer sk-..."}),(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"OAuth client"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(j.Input,{value:m,onChange:e=>a({clientId:e.target.value}),placeholder:"Client ID",spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(j.Input,{value:p,onChange:e=>a({clientSecret:e.target.value}),placeholder:"Client secret",spellCheck:!1,type:"password",className:"font-mono text-xs"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Only for servers that refuse to register clients on their own, like Figma. Leave empty and one is created during sign-in."})]})]}),(0,t.jsxs)(C.TabsContent,{value:"stdio",className:"space-y-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"Command"}),(0,t.jsx)(j.Input,{value:u,onChange:e=>a({command:e.target.value}),placeholder:"npx",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"Args"}),(0,t.jsx)(j.Input,{value:h,onChange:e=>a({args:e.target.value}),placeholder:"-y @notionhq/notion-mcp-server",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsx)(en,{label:"Env",pairs:f,onChange:e=>a({env:e}),keyPlaceholder:"NOTION_TOKEN",valuePlaceholder:"ntn_..."})]})]}),A&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:A})]})})}function en({label:e,pairs:n,onChange:s,keyPlaceholder:r,valuePlaceholder:o}){let a=(e,t)=>s(n.map(n=>n.id===e?{...n,...t}:n));return(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:e}),(0,t.jsxs)("div",{className:"space-y-2",children:[n.map(e=>(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(j.Input,{value:e.key,onChange:t=>a(e.id,{key:t.target.value}),placeholder:r,spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(j.Input,{value:e.value,onChange:t=>a(e.id,{value:t.target.value}),placeholder:o,spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",onClick:()=>s(n.filter(t=>t.id!==e.id)),children:(0,t.jsx)(h.X,{})})]},e.id)),(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>s([...n,es()]),children:[(0,t.jsx)(c.Plus,{}),"Add"]})]})]})}let es=(e="",t="")=>({id:crypto.randomUUID(),key:e,value:t}),er=e=>Object.entries(e??{}).map(([e,t])=>es(e,t)),eo=e=>{let t=e.filter(e=>e.key.trim());if(t.length)return Object.fromEntries(t.map(e=>[e.key.trim(),e.value]))},ea=`/** STDIO Example */
3
+ ${r}}`}return Array.isArray(t.type)?t.type.join(" | "):"string"==typeof t.type?t.type:"unknown"}(n)})]},e))}):null,i?(0,t.jsx)(Z,{tool:e,serverName:n}):null]})}function Z({tool:e,serverName:n}){let[s,r]=(0,g.useState)(()=>(function(e){let t=e.inputSchema?.properties;if(!t||"object"!=typeof t)return"{}";let n={};for(let[e,s]of Object.entries(t))n[e]=s?.type==="number"||s?.type==="integer"?0:s?.type!=="boolean"&&(s?.type==="array"?[]:s?.type==="object"?{}:"");return JSON.stringify(n,null,2)})(e)),[o,a]=(0,g.useState)(""),[c,l,d,m,p]=(0,W.useServerAction)(T,{errorMessage:!1});return(0,t.jsxs)("div",{className:"mt-2 space-y-2 rounded-lg border border-input p-3",children:[(0,t.jsx)(w.Textarea,{value:s,onChange:e=>r(e.target.value),spellCheck:!1,className:"min-h-24 resize-none font-mono text-xs"}),(0,t.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:"font-mono text-xs text-destructive",children:o||m}),(0,t.jsxs)(x.Button,{size:"sm",loading:l,onClick:()=>{let t;try{t=s.trim()?JSON.parse(s):void 0}catch{a("Not valid JSON");return}a(""),p(),c(n,e.name,t)},children:[!l&&(0,t.jsx)(i,{}),"Run"]})]}),void 0!==d&&(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg bg-muted/40 p-3",children:(0,t.jsx)(y,{data:d,initialExpandDepth:3})})]})}function ee(e){return k.notify.component({className:"sm:max-w-lg",renderer:({close:n})=>(0,t.jsx)(et,{initial:e,onDone:n})})}function et({initial:e,onDone:n}){let s=e&&L(e.config)?e.config:void 0,r=e&&!L(e.config)?e.config:void 0,[o,a]=(0,H.useObjectState)({mode:r?"stdio":"http",name:e?.name??"",url:s?.url??"",headers:er(s?.headers),clientId:s?.oauthClient?.clientId??"",clientSecret:s?.oauthClient?.clientSecret??"",command:r?.command??"",args:(r?.args??[]).join(" "),env:er(r?.env),raw:""}),{mode:i,name:c,url:l,headers:d,clientId:m,clientSecret:p,command:u,args:h,env:f,raw:b}=o,[y,N]=(0,W.useServerAction)(P,{...ec,onOk:e=>{ec.onOk(e),"error"!==e.status&&n()}}),k=(0,g.useMemo)(()=>{var e,t,n,s,r,o,a;let c,g;return"json"===i?function(e){let t,n=e.trim();if(!n)return{value:null,error:""};try{t=JSON.parse(n)}catch{return{value:null,error:"Not valid JSON"}}let s=D.safeParse(t);if(s.success)return{value:{name:null,config:s.data},error:""};let r=U.safeParse(t);if(!r.success)return{value:null,error:"Needs a url or a command"};let o=Object.entries("mcpServers"in r.data?r.data.mcpServers:r.data)[0];return o?{value:{name:o[0],config:o[1]},error:""}:{value:null,error:"No server in there"}}(b):"http"===i?(e=l,t=d,n=m,s=p,(c=M.safeParse({url:e.trim(),headers:eo(t),oauthClient:n.trim()?{clientId:n.trim(),clientSecret:s.trim()}:void 0})).success?{value:{name:null,config:c.data},error:""}:{value:null,error:e.trim()?"Needs a valid url":""}):(r=u,o=h,a=f,(g=R.safeParse({command:r.trim(),args:o.split(/\s+/).filter(Boolean),env:eo(a)})).success?{value:{name:null,config:g.data},error:""}:{value:null,error:r.trim()?"Needs a command":""})},[i,b,l,d,m,p,u,h,f]),z="json"===i?b:JSON.stringify([i,l,d,m,p,u,h,f]),[O,T]=(0,g.useState)(z);(0,g.useEffect)(()=>{let e=setTimeout(()=>T(z),700);return()=>clearTimeout(e)},[z]);let A=O===z?k.error:"",I=c||k.value?.name||"",F=J.safeParse({name:I,config:k.value?.config});function $(e){let t=k.value?.config;return t?"json"===e?a({mode:e,raw:JSON.stringify(t,null,2)}):"http"===e&&L(t)?a({mode:e,url:t.url,headers:er(t.headers),clientId:t.oauthClient?.clientId??"",clientSecret:t.oauthClient?.clientSecret??""}):"stdio"!==e||L(t)?void a({mode:e}):a({mode:e,command:t.command,args:(t.args??[]).join(" "),env:er(t.env)}):a({mode:e})}let E=(0,t.jsxs)("span",{className:"flex items-center gap-2 font-mono text-xs text-muted-foreground",children:["JSON",(0,t.jsx)(S.Switch,{size:"sm",checked:"json"===i,onCheckedChange:e=>{let t;return e?$("json"):void $((t=k.value?.config)&&!L(t)?"stdio":"http")}})]});return(0,t.jsx)(_.SettingDialogContent,{title:"Add MCP server",description:"Its tools become available to Thursday and every sub-agent.",footer:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Button,{variant:"ghost",onClick:n,children:"Cancel"}),(0,t.jsx)(x.Button,{disabled:!F.success,loading:N,onClick:()=>{F.success&&!N&&y(F.data)},children:"Connect"})]}),children:(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"Name"}),(0,t.jsx)(j.Input,{value:I,onChange:e=>a({name:e.target.value}),placeholder:"notion",spellCheck:!1})]}),"json"===i?(0,t.jsxs)(v.Field,{children:[(0,t.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,t.jsx)(v.FieldLabel,{children:"JSON"}),E]}),(0,t.jsx)(w.Textarea,{value:b,onChange:e=>a({raw:e.target.value}),spellCheck:!1,placeholder:ea,className:"min-h-64 resize-none font-mono text-xs"})]}):(0,t.jsxs)(C.Tabs,{value:i,onValueChange:e=>$(e),className:"gap-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsxs)("div",{className:"flex min-h-6 items-center justify-between gap-2",children:[(0,t.jsx)(v.FieldLabel,{children:"Transport"}),E]}),(0,t.jsxs)(C.TabsList,{className:"w-full",children:[(0,t.jsx)(C.TabsTrigger,{value:"http",children:"HTTP"}),(0,t.jsx)(C.TabsTrigger,{value:"stdio",children:"STDIO"})]})]}),(0,t.jsxs)(C.TabsContent,{value:"http",className:"space-y-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"URL"}),(0,t.jsx)(j.Input,{value:l,onChange:e=>a({url:e.target.value}),placeholder:"https://mcp.notion.com/mcp",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsx)(en,{label:"Headers",pairs:d,onChange:e=>a({headers:e}),keyPlaceholder:"Authorization",valuePlaceholder:"Bearer sk-..."}),(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"OAuth client"}),(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(j.Input,{value:m,onChange:e=>a({clientId:e.target.value}),placeholder:"Client ID",spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(j.Input,{value:p,onChange:e=>a({clientSecret:e.target.value}),placeholder:"Client secret",spellCheck:!1,type:"password",className:"font-mono text-xs"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"Only for servers that refuse to register clients on their own, like Figma. Leave empty and one is created during sign-in."})]})]}),(0,t.jsxs)(C.TabsContent,{value:"stdio",className:"space-y-6",children:[(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"Command"}),(0,t.jsx)(j.Input,{value:u,onChange:e=>a({command:e.target.value}),placeholder:"npx",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:"Args"}),(0,t.jsx)(j.Input,{value:h,onChange:e=>a({args:e.target.value}),placeholder:"-y @notionhq/notion-mcp-server",spellCheck:!1,className:"font-mono text-xs"})]}),(0,t.jsx)(en,{label:"Env",pairs:f,onChange:e=>a({env:e}),keyPlaceholder:"NOTION_TOKEN",valuePlaceholder:"ntn_..."})]})]}),A&&(0,t.jsx)("p",{className:"font-mono text-xs text-destructive",children:A})]})})}function en({label:e,pairs:n,onChange:s,keyPlaceholder:r,valuePlaceholder:o}){let a=(e,t)=>s(n.map(n=>n.id===e?{...n,...t}:n));return(0,t.jsxs)(v.Field,{children:[(0,t.jsx)(v.FieldLabel,{children:e}),(0,t.jsxs)("div",{className:"space-y-2",children:[n.map(e=>(0,t.jsxs)("div",{className:"flex gap-2",children:[(0,t.jsx)(j.Input,{value:e.key,onChange:t=>a(e.id,{key:t.target.value}),placeholder:r,spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(j.Input,{value:e.value,onChange:t=>a(e.id,{value:t.target.value}),placeholder:o,spellCheck:!1,className:"font-mono text-xs"}),(0,t.jsx)(x.Button,{variant:"ghost",size:"icon",onClick:()=>s(n.filter(t=>t.id!==e.id)),children:(0,t.jsx)(h.X,{})})]},e.id)),(0,t.jsxs)(x.Button,{variant:"outline",size:"sm",onClick:()=>s([...n,es()]),children:[(0,t.jsx)(c.Plus,{}),"Add"]})]})]})}let es=(e="",t="")=>({id:crypto.randomUUID(),key:e,value:t}),er=e=>Object.entries(e??{}).map(([e,t])=>es(e,t)),eo=e=>{let t=e.filter(e=>e.key.trim());if(t.length)return Object.fromEntries(t.map(e=>[e.key.trim(),e.value]))},ea=`/** STDIO Example */
4
4
  {
5
5
  "command": "node",
6
6
  "args": ["index.js"],
@@ -15,4 +15,4 @@ ${r}}`}return Array.isArray(t.type)?t.type.join(" | "):"string"==typeof t.type?t
15
15
  "headers": {
16
16
  "Authorization": "Bearer sk-..."
17
17
  }
18
- }`;function ei(e){if("auth_required"===e.status&&e.authorizationUrl){let t=window.open(e.authorizationUrl,"thursday-oauth","popup,width=520,height=720");z.toast.add({title:`${e.name} needs authorization`,description:"Approve access in the window that just opened"});let n=Date.now()+3e5,s=setInterval(()=>{let e=!t||t.closed;!(!e&&Date.now()<n)&&(clearInterval(s),e&&(0,V.revalidate)(f.queryKey.mcp))},700);return}"error"===e.status?z.toast.add({type:"error",title:`${e.name} could not connect`,description:e.error}):z.toast.add({type:"success",title:`${e.name} connected`,description:`${e.toolCount} ${1===e.toolCount?"tool":"tools"} available`})}let ec={onOk:e=>{(0,V.revalidate)(f.queryKey.mcp),ei(e)}};function el({filter:e,onFilter:n,onPreset:s}){let r=e.trim().toLowerCase(),o=K.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r));return(0,t.jsx)(_.SettingGroup,{label:"Presets",filter:(0,t.jsx)(_.SettingFilter,{value:e,onChange:n,placeholder:"Filter presets",className:"w-56"}),right:r?`${o.length} of ${K.length}`:void 0,children:(0,t.jsx)("div",{className:"grid grid-cols-[repeat(4,minmax(0,1fr))] gap-3",children:o.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group relative flex flex-col gap-2 rounded-xl border border-border/60 p-3 text-left text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(c.Plus,{className:"absolute top-3 right-3 size-3.5 shrink-0 text-muted-foreground/50 group-hover:text-foreground"}),(0,t.jsx)("span",{className:"grid size-6 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground",children:e.icon?(0,t.jsx)("img",{src:(0,y.faviconUrl)(e.icon),alt:"",className:"size-4"}):(0,t.jsx)(p,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-xs font-semibold",children:e.name}),(0,t.jsx)("span",{className:"block truncate text-xs",children:e.description})]})]},e.name))})})}function ed(e){return L(e)?e.url:[e.command,...e.args??[]].join(" ")}e.s(["CONNECT_OPTIONS",0,ec,"McpSetting",0,function(){let[e,n]=(0,g.useState)(""),{data:s=[],isLoading:r,error:o}=(0,V.useServerRoute)(f.queryKey.mcp);if(r)return(0,t.jsx)(_.SettingSkeleton,{rows:3});if(o)return(0,t.jsx)(_.SettingError,{message:o.message});let a=s.reduce((e,t)=>e+t.toolCount,0),i=s.filter(e=>e.lastError).length;return(0,t.jsxs)(_.SettingScreen,{footer:(0,t.jsx)(_.SettingRailNote,{children:0===s.length?"Nothing connected yet — a preset is the shortest way in":(0,t.jsxs)(t.Fragment,{children:[s.length," connected · ",a," tools",i>0&&` \xb7 ${i} failed`]})}),children:[(0,t.jsx)(_.SettingGroup,{label:"Connected",children:(0,t.jsx)(_.SettingItems,{addRow:{label:"Add server",onClick:()=>ee()},children:s.map(e=>(0,t.jsx)(Q,{server:e},e.name))})}),(0,t.jsx)(el,{filter:e,onFilter:n,onPreset:ee})]})},"openMcpRegister",0,ee,"reportConnect",0,ei],787800)},333999,e=>{"use strict";var t=e.i(271645),n=e.i(647163);e.s(["useObjectState",0,e=>{let[s,r]=(0,t.useState)(e);return[s,(0,t.useMemo)(()=>{let e=e=>{r(t=>{let s=(0,n.isFunction)(e)?e(t):e;return Object.keys(s).some(e=>!Object.is(t[e],s[e]))?{...t,...s}:t})},t=new Map;return new Proxy(e,{get(s,r,o){if("symbol"==typeof r)return Reflect.get(s,r,o);let a=t.get(r);return a||(a=t=>{e(e=>({[r]:(0,n.isFunction)(t)?t(e[r]):t}))},t.set(r,a)),a}})},[])]}])},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)}]);
18
+ }`;function ei(e){if("auth_required"===e.status&&e.authorizationUrl){let t=window.open(e.authorizationUrl,"thursday-oauth","popup,width=520,height=720");z.toast.add({title:`${e.name} needs authorization`,description:"Approve access in the window that just opened"});let n=Date.now()+3e5,s=setInterval(()=>{let e=!t||t.closed;!(!e&&Date.now()<n)&&(clearInterval(s),e&&(0,V.revalidate)(f.queryKey.mcp))},700);return}"error"===e.status?z.toast.add({type:"error",title:`${e.name} could not connect`,description:e.error}):z.toast.add({type:"success",title:`${e.name} connected`,description:`${e.toolCount} ${1===e.toolCount?"tool":"tools"} available`})}let ec={onOk:e=>{(0,V.revalidate)(f.queryKey.mcp),ei(e)}};function el({filter:e,onFilter:n,onPreset:s}){let r=e.trim().toLowerCase(),o=K.filter(e=>!r||`${e.name} ${e.description}`.toLowerCase().includes(r));return(0,t.jsx)(_.SettingGroup,{label:"Presets",filter:(0,t.jsx)(_.SettingFilter,{value:e,onChange:n,placeholder:"Filter presets",className:"w-56"}),right:r?`${o.length} of ${K.length}`:void 0,children:(0,t.jsx)("div",{className:"grid grid-cols-[repeat(4,minmax(0,1fr))] gap-3",children:o.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>s(e),className:"group relative flex flex-col gap-2 rounded-xl border border-border/60 p-3 text-left text-muted-foreground outline-none transition-colors hover:bg-accent hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(c.Plus,{className:"absolute top-3 right-3 size-3.5 shrink-0 text-muted-foreground/50 group-hover:text-foreground"}),(0,t.jsx)("span",{className:"grid size-6 shrink-0 place-items-center rounded-md bg-muted text-muted-foreground",children:e.icon?(0,t.jsx)("img",{src:(0,b.faviconUrl)(e.icon),alt:"",className:"size-4"}):(0,t.jsx)(p,{className:"size-3.5"})}),(0,t.jsxs)("span",{className:"min-w-0",children:[(0,t.jsx)("span",{className:"block truncate font-mono text-xs font-semibold",children:e.name}),(0,t.jsx)("span",{className:"block truncate text-xs",children:e.description})]})]},e.name))})})}function ed(e){return L(e)?e.url:[e.command,...e.args??[]].join(" ")}e.s(["CONNECT_OPTIONS",0,ec,"McpSetting",0,function(){let[e,n]=(0,g.useState)(""),{data:s=[],isLoading:r,error:o}=(0,V.useServerRoute)(f.queryKey.mcp);if(r)return(0,t.jsx)(_.SettingSkeleton,{rows:3});if(o)return(0,t.jsx)(_.SettingError,{message:o.message});let a=s.reduce((e,t)=>e+t.toolCount,0),i=s.filter(e=>e.lastError).length;return(0,t.jsxs)(_.SettingScreen,{footer:(0,t.jsx)(_.SettingRailNote,{children:0===s.length?"Nothing connected yet — a preset is the shortest way in":(0,t.jsxs)(t.Fragment,{children:[s.length," connected · ",a," tools",i>0&&` \xb7 ${i} failed`]})}),children:[(0,t.jsx)(_.SettingGroup,{label:"Connected",children:(0,t.jsx)(_.SettingItems,{addRow:{label:"Add server",onClick:()=>ee()},children:s.map(e=>(0,t.jsx)(Q,{server:e},e.name))})}),(0,t.jsx)(el,{filter:e,onFilter:n,onPreset:ee})]})},"openMcpRegister",0,ee,"reportConnect",0,ei],787800)},333999,e=>{"use strict";var t=e.i(271645),n=e.i(647163);e.s(["useObjectState",0,e=>{let[s,r]=(0,t.useState)(e);return[s,(0,t.useMemo)(()=>{let e=e=>{r(t=>{let s=(0,n.isFunction)(e)?e(t):e;return Object.keys(s).some(e=>!Object.is(t[e],s[e]))?{...t,...s}:t})},t=new Map;return new Proxy(e,{get(s,r,o){if("symbol"==typeof r)return Reflect.get(s,r,o);let a=t.get(r);return a||(a=t=>{e(e=>({[r]:(0,n.isFunction)(t)?t(e[r]):t}))},t.set(r,a)),a}})},[])]}])},759659,e=>{"use strict";var t=e.i(456420);let n={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};n.node;let s=(0,t.default)(n);e.s(["Trash2",0,s],759659)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,279265,240829,206721,e=>{"use strict";var t=e.i(843476),n=e.i(401851),s=e.i(96892),a=e.i(689664),o=e.i(716327),r=e.i(24071),i=e.i(867927),l=e.i(931619),d=e.i(508734),u=e.i(779266),c=e.i(632781),m=e.i(77071),x=e.i(825398),p=e.i(263676),f=e.i(271645),h=e.i(798120),b=e.i(815731),g=e.i(167881),k=e.i(496336),j=e.i(683408),v=e.i(660302),w=e.i(184762),y=e.i(6799),N=e.i(965281),T=e.i(451888),C=e.i(635963),z=e.i(835878),S=e.i(764224),M=e.i(919191),A=e.i(929272),B=e.i(702966),_=e.i(568288),R=e.i(95187);let $=(0,R.createServerReference)("7fa481c23373be6f44127e642532a2a5f91738cdf0",R.callServer,void 0,R.findSourceMapURL,"markSeenAction");var I=e.i(245629),E=e.i(393080),q=e.i(283653),F=e.i(647163);let L=[],K=!1,D=new Set,O={sync(e,t){for(let n of(K=!0,L=[...e].reverse().map(e=>P(e,t)).slice(-30),D))n()},primed:()=>K};function P(e,t){let n=e=>({name:e,icon:t?.find(t=>t.name===e)?.icon??null}),s=n(e.bot),a=[],o=new Map,r=new Map,i=new Map;for(let t of e.lines){let e=t.bot?n(t.bot):s,l=t.parent?i.get(t.parent)??null:null;switch(t.kind){case"user":a.push({id:t.id,bot:s,to:null,text:t.text,kind:"user"});break;case"text":a.push({id:t.id,bot:e,to:l,text:t.text,kind:"say"});break;case"note":a.push({id:t.id,bot:e,to:l,text:t.text,kind:"note"});break;case"stop":a.push({id:t.id,bot:e,to:l,text:t.text,kind:"stop",at:t.at});break;case"tool":o.set(t.callId,a.length),a.push({id:t.id,bot:e,to:l,text:t.note??t.input,kind:"tool",tool:{name:t.name,input:t.input,note:t.note,path:t.path,callId:t.callId}});break;case"tool-result":{let e=o.get(t.callId),n=void 0===e?void 0:a[e];n?.tool&&void 0!==e&&(a[e]={...n,tool:{...n.tool,results:t.results,more:t.more}});break}case"ask":{let s=n(t.to);r.set(t.callId,s),i.set(t.callId,e),a.push({id:t.id,bot:e,to:s,text:t.text,kind:"ask"});break}case"ask-result":{let n=r.get(t.callId);n&&t.text&&a.push({id:t.id,bot:n,to:e,text:t.text,kind:"ask"});break}case"waiting":a.push({id:t.id,bot:e,to:null,text:t.question,kind:"result",options:t.options})}}if("failed"===e.status&&e.outcome)a.push({id:`${e.id}-end`,bot:s,to:null,text:e.outcome,kind:"error"});else if("done"===e.status||"waiting"===e.status){let t=a.at(-1);t&&"say"===t.kind&&t.text===e.outcome&&(a[a.length-1]={...t,kind:"result"})}return{id:e.id,request:e.request,label:e.label,bot:s,lines:a,status:"running"===e.status?"working":e.status,outcome:e.outcome,ask:e.ask,seen:e.seen,tokens:e.tokens,contextTokens:e.contextTokens,contextBudget:e.contextBudget,updatedAt:e.updatedAt}}function U(e){for(let t=e.lines.length-1;t>=0;t--){let n=e.lines[t];if("user"!==n.kind&&"note"!==n.kind&&"stop"!==n.kind)return n}return null}let H=new Map,V={get:e=>H.get(e)??"",set(e,t){t?H.set(e,t):H.delete(e)},typing:e=>(H.get(e)?.trim().length??0)>0},W=new Set,G={announce(e){for(let t of W)t(e)},subscribe:e=>(W.add(e),()=>{W.delete(e)})},X=[];function J(){return(0,f.useSyncExternalStore)(e=>(D.add(e),()=>D.delete(e)),()=>L,()=>X)}let Y=e=>"result"===e.kind||"error"===e.kind;function Q(e){let t=[e.bot];for(let n of e.lines)t.some(e=>e.name===n.bot.name)||t.push(n.bot);return t}function Z(e){let t=new Set([e.bot.name]),n=[];for(let s of function(e){let t=[];for(let n of e){let e=t.at(-1);if(e&&e.bot.name===n.bot.name&&e.to?.name===n.to?.name&&"user"===e.lines[0].kind==("user"===n.kind)){e.lines.push(n);continue}t.push({key:n.id,bot:n.bot,to:n.to,lines:[n]})}return t}(e.lines))s.to&&!t.has(s.to.name)&&(t.add(s.to.name),n.push({kind:"invite",key:`${s.key}-joins`,from:s.bot,to:s.to})),t.add(s.bot.name),n.push({kind:"group",key:s.key,group:s});return n}function ee(e){let t=new Map;for(let n of e)for(let e of(t.has(n.bot.name)||t.set(n.bot.name,{bot:n.bot,task:n,line:null,open:0}),n.lines))"user"!==e.kind&&"note"!==e.kind&&"stop"!==e.kind&&t.set(e.bot.name,{bot:e.bot,task:n,line:e,open:t.get(e.bot.name)?.open??0});for(let n of e){if("working"!==n.status)continue;let e=t.get(n.bot.name);e&&(e.open+=1)}return[...t.values()]}function et(e){let t=(0,f.useRef)(new Set),n=e?.id??null,s=e?`${e.id}@${(0,I.toDate)(e.updatedAt).getTime()}`:null,a=!!e&&("done"===e.status||"failed"===e.status)&&!e.seen;(0,f.useEffect)(()=>{!n||!s||!a||t.current.has(s)||(t.current.add(s),$([n]).then(E.unwrapResult).then(()=>(0,q.revalidate)(h.queryKey.tasks)).catch(e=>{t.current.delete(s),y.toast.add({type:"error",title:"Could not mark the task as read",description:(0,F.errorToString)(e)})}))},[n,s,a])}e.s(["botTasks",0,O,"isOutcome",0,Y,"lastSaid",0,U,"latestPerBot",0,ee,"rosterOf",0,Q,"screenActs",0,G,"taskDrafts",0,V,"taskFromRow",0,P,"threadItems",0,Z,"useBotTasks",0,J,"useSeenOnDetail",0,et],240829);var en=e.i(609856);function es({task:e,status:n,lines:a=[],className:o}){let[r,i]=(0,f.useState)(()=>V.get(e.id));(0,f.useEffect)(()=>i(V.get(e.id)),[e.id]);let d=t=>{i(t),V.set(e.id,t)},[u,m]=ea(),[x,b]=(0,en.useServerAction)(_.cancelTaskAction,{onOk:e=>{(0,q.revalidate)(h.queryKey.tasks),G.announce({kind:"stopped",id:e.id,label:e.label})}}),j=m||b,[y,N]=(0,f.useState)(!1),[C,z]=(0,f.useState)(null);(0,f.useEffect)(()=>{N(!1),z(null)},[e.id]),(0,f.useEffect)(()=>{"running"!==n&&z(null)},[n]),(0,f.useEffect)(()=>{C&&a.some(e=>"user"===e.kind&&e.text===C)&&z(null)},[a,C]);let S=async t=>{!j&&await u(e,t)&&(d(""),"running"===n&&(z(t.trim()),N(!1)))},B="waiting"===n?e.ask:null,R=(0,T.isAppStop)(B),$=B?B.options.length?"Or put it another way…":"Your answer":"running"===n?`What's off? ${e.bot} reads this before its next step`:"Anything more? It picks up where it left off",I=(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),S(r)},className:"flex items-end gap-1 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",children:[(0,t.jsx)(w.Textarea,{value:r,rows:1,disabled:j,autoFocus:"running"===n,onChange:e=>d(e.target.value),onKeyDown:e=>{"Escape"===e.key&&"running"===n?N(!1):"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),S(r))},placeholder:$,"aria-label":`Message for ${e.label}`,className:"max-h-32 min-h-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"}),"running"===n&&(0,t.jsx)(g.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:j,onClick:()=>N(!1),"aria-label":"Never mind",className:"text-muted-foreground",children:(0,t.jsx)(p.X,{})}),(0,t.jsx)(g.Button,{type:"submit",size:"icon-sm",variant:r.trim()?"default":"ghost",disabled:!r.trim()||j,"aria-label":"Send",className:"rounded-full",children:m?(0,t.jsx)(c.Loader2,{className:"animate-spin"}):(0,t.jsx)(s.ArrowUp,{})})]});return"running"!==n||y?B?(0,t.jsxs)("div",{className:(0,F.cn)("space-y-2.5 rounded-2xl bg-amber-500/8 px-3.5 py-3 ring-1 ring-amber-500/25",o),children:[(0,t.jsxs)("p",{className:"flex items-center gap-1.5 font-mono text-[10px] text-muted-foreground",children:[(0,t.jsx)("span",{className:"shrink-0",children:"To"}),(0,t.jsx)("span",{className:"truncate text-foreground",children:e.bot}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/50",children:"·"}),(0,t.jsx)("span",{className:"truncate",children:e.label})]}),B.question&&(0,t.jsx)(k.FoldedText,{text:B.question,subject:"message",clamp:"line-clamp-6",tall:"max-h-56"}),B.options.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5",children:B.options.map(e=>(0,t.jsxs)(g.Button,{size:"sm",variant:"outline",disabled:j,onClick:()=>S(e),className:"h-7 gap-1.5 rounded-full bg-background px-3 text-[12px]",children:[R&&e===T.TASK_CONTINUE&&(0,t.jsx)(l.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),e]},e))}),I,"waiting"===n&&(0,t.jsx)("button",{type:"button",disabled:j,onClick:()=>x(e.id),className:"font-mono text-[10px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",children:"Stop this task instead"})]}):(0,t.jsx)("div",{className:o,children:I}):(0,t.jsxs)("div",{className:(0,F.cn)("flex items-center gap-2 rounded-2xl bg-muted/40 py-1.5 pr-1.5 pl-3.5 ring-1 ring-border/50",o),children:[C?(0,t.jsxs)("p",{className:"flex min-w-0 flex-1 items-center gap-2 text-[12.5px] leading-5 text-muted-foreground",children:[(0,t.jsx)(c.Loader2,{className:"size-3 shrink-0 animate-spin"}),(0,t.jsx)("span",{className:"shrink-0",children:"Before its next step:"}),(0,t.jsx)(v.ShinyText,{text:C,speed:2.2,className:"min-w-0 truncate"})]}):(0,t.jsx)(v.ShinyText,{text:`${e.bot} is on it — Thursday steers it by voice.`,speed:2.4,className:"min-w-0 flex-1 truncate text-[12.5px] leading-5 break-keep"}),(0,t.jsxs)(g.Button,{type:"button",size:"sm",variant:"ghost",disabled:j,onClick:()=>N(!0),className:"h-7 shrink-0 gap-1.5 rounded-full px-2.5 text-[12px]",children:[(0,t.jsx)(M.CornerDownLeft,{className:"size-3.5"}),"Step in"]}),(0,t.jsx)("span",{className:"h-4 w-px shrink-0 bg-border"}),(0,t.jsx)(g.Button,{type:"button",size:"icon-sm",variant:"ghost",disabled:j,onClick:()=>x(e.id),"aria-label":"Stop this task",className:"shrink-0 text-muted-foreground/60 hover:text-foreground",children:b?(0,t.jsx)(c.Loader2,{className:"animate-spin"}):(0,t.jsx)(A.Square,{className:"size-3"})})]})}function ea(){let[e,t]=(0,en.useServerAction)(B.answerTaskAction,{onOk:()=>(0,q.revalidate)(h.queryKey.tasks)});return[async(t,n)=>{let s=n.trim();if(!s)return!1;try{let n=await e(t.id,s);return G.announce({kind:"answered",id:n.id,label:n.label,answer:s}),!0}catch{return!1}},t]}e.s(["TaskReply",0,es,"useAnswerTask",0,ea],206721);var eo=e.i(989409),er=e.i(256604),ei=e.i(621285),el=e.i(864723),ed=e.i(222055);let eu=(0,f.memo)(function(){let e=J(),{data:n}=(0,q.useServerRoute)(h.queryKey.bot),[s,a]=(0,f.useState)(!1),[o,r]=(0,f.useState)(null),[i,l]=(0,f.useState)(!1),d=[...e].reverse(),u=o?d.find(e=>e.id===o)??null:null,[c,m]=function(){let[e,t]=(0,f.useState)(new Map),n=(0,f.useRef)(new Map);return(0,f.useEffect)(()=>()=>{for(let e of n.current.values())clearTimeout(e)},[]),[e,(0,f.useCallback)(e=>{t(t=>new Map(t).set(e.at,e));let s=n.current.get(e.at);s&&clearTimeout(s),n.current.set(e.at,setTimeout(()=>{n.current.delete(e.at),t(t=>{let n=new Map(t);return n.delete(e.at),n})},3400))},[])]}(),{crew:x,more:p}=(0,f.useMemo)(()=>ex(n,e),[n,e]),b=(0,f.useRef)(null),g=(0,f.useRef)(new Set);(0,f.useEffect)(()=>{if(!O.primed())return;let t=new Map(d.map(e=>[e.id,e.status])),n=b.current;b.current=t;let s=new Set;for(let t of e)for(let e of t.lines)"ask"===e.kind&&e.to&&s.add(e.id);let a=g.current;if(g.current=s,!n)return;let o=new Map;for(let t of e)for(let e of t.lines){if("ask"!==e.kind||!e.to||a.has(e.id))continue;let t=o.get(e.bot.name)??[];t.push({from:e.bot,to:e.to,text:e.text}),o.set(e.bot.name,t)}for(let[e,t]of o){if(1===t.length){m({at:t[0].to.name,from:t[0].from,text:em(t[0].text)});continue}m({at:e,from:t[0].from,text:`sent ${t.length} parts out`})}for(let e of d)n.get(e.id)!==e.status&&"working"===e.status&&m(n.has(e.id)?{at:e.bot.name,from:null,text:"picked it back up"}:{at:e.bot.name,from:eK,text:`took on \u201c${em(e.label)}\u201d`})},[e,m]),et(s?u:null);let k=e.filter(e=>"working"===e.status).length,j=d.filter(ep),v=j.length,w=d.filter(ef),y=w.filter(e=>"failed"===e.status).length,N=(0,f.useCallback)(()=>l(!1),[]);return(0,t.jsx)("div",{className:"pointer-events-none absolute right-5 bottom-5 z-10 flex w-[min(80vw,calc(100vw-2.5rem))] flex-col items-end gap-2",children:s?(0,t.jsx)("div",{className:"pointer-events-auto flex max-h-[min(44rem,78vh)] w-132 max-w-full animate-in flex-col overflow-hidden rounded-3xl bg-background/75 shadow-2xl shadow-black/6 ring-1 ring-border/50 backdrop-blur-xl fade-in slide-in-from-bottom-1 duration-200",children:u?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(ez,{task:u,onBack:()=>r(null),onClose:()=>a(!1)}),(0,t.jsx)(eq,{task:u,className:"min-h-0 flex-1"}),(0,t.jsx)(es,{task:{id:u.id,label:u.label,bot:u.bot.name,ask:function(e){if(!e.ask?.question)return e.ask;let t=e.lines.at(-1);return t&&Y(t)&&t.text===e.ask.question?{...e.ask,question:""}:e.ask}(u)},status:"working"===u.status?"running":u.status,lines:u.lines,className:"mx-3 mb-2 shrink-0"})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eC,{count:e.length,pending:v,composing:i,onCompose:()=>l(!0),onClose:()=>i?l(!1):a(!1)}),i?(0,t.jsx)(ek,{bots:n,onDone:N}):d.length?(0,t.jsx)(eI,{tasks:d,onPick:r}):(0,t.jsx)(e_,{bots:n}),!i&&(0,t.jsx)(eR,{})]})}):(0,t.jsx)(eh,{crew:x,more:p,bubbles:c,bots:n,rows:j,count:e.length,busy:k,pending:v,unread:w.length,failed:y,composing:i,onCompose:()=>l(!0),onCloseCompose:N,onPick:e=>{r(e),a(!0)},onOpen:()=>{let e=j.length?j:w;o||1!==e.length||r(e[0].id),a(!0)}})})}),ec=new Map,em=e=>{let t=(0,F.plainText)(e).replace(/\s+/g," ").trim();return t.length>28?`${t.slice(0,27)}…`:t};function ex(e,t){let n=new Map;for(let e of ee(t)){let{task:t,bot:s,line:a}=e;if("waiting"===t.status&&t.bot.name===s.name){n.set(s.name,{waiting:!0,word:null});continue}!("working"!==t.status||n.get(s.name)?.waiting)&&n.set(s.name,{waiting:!1,word:a?"tool"===a.kind&&a.tool?em(a.tool.note??`${a.tool.name} \xb7 ${a.tool.input}`):"say"===a.kind?em(a.text):null:null})}let s=new Map;for(let t of e??[])s.set(t.name,{name:t.name,icon:t.icon,awake:n.has(t.name),waiting:n.get(t.name)?.waiting??!1,word:n.get(t.name)?.word??null});for(let[e,t]of n)s.has(e)||s.set(e,{name:e,icon:null,awake:!0,waiting:t.waiting,word:t.word});let a=[...s.values()];if(!a.length)return{crew:ej.slice(0,ev),more:0};for(let e of ej){if(a.length>=ev)break;s.has(e.name)||a.push(e)}let o=e=>e.waiting?0:e.awake?1:e.standIn?3:2,r=a.map((e,t)=>({face:e,at:t})).sort((e,t)=>o(e.face)-o(t.face)||e.at-t.at).map(e=>e.face);return{crew:r.slice(0,10),more:Math.max(0,r.length-10)}}let ep=e=>"waiting"===e.status,ef=e=>("done"===e.status||"failed"===e.status)&&!e.seen;function eh({crew:e,more:n,bubbles:s,bots:o,rows:r,count:i,busy:l,pending:d,unread:u,failed:m,composing:x,onCompose:f,onCloseCompose:h,onPick:b,onOpen:g}){let k=function({count:e,busy:t,pending:n,unread:s,failed:a}){return n>0?{text:1===n?"waiting on you":`${n} waiting on you`,tone:F.WAITING_INK,shine:"waiting"}:a>0?{text:1===a?"1 failed":`${a} failed`,tone:"text-destructive",shine:null}:s>0?{text:1===s?"1 new answer":`${s} new answers`,tone:F.WAITING_INK,shine:null}:t>0?{text:1===t?"working":`${t} running`,tone:"text-muted-foreground",shine:"muted"}:e>0?{text:"all done",tone:"text-muted-foreground",shine:null}:{text:"no jobs yet",tone:"text-muted-foreground",shine:null}}({count:i,busy:l,pending:d,unread:u,failed:m}),j=x||d>0;return(0,t.jsxs)("div",{className:(0,F.cn)("pointer-events-auto w-fit max-w-full bg-background/78 ring-1 ring-border/50 backdrop-blur-md transition-shadow duration-300",j?"max-w-[min(33rem,100%)] min-w-96 rounded-3xl shadow-lg shadow-black/8":"rounded-full shadow-sm shadow-black/3"),children:[(0,t.jsx)("div",{className:(0,F.cn)("grid overflow-hidden transition-[grid-template-rows] duration-300 ease-out",j?"grid-rows-[1fr]":"grid-rows-[0fr]"),children:(0,t.jsx)("div",{className:"min-h-0 overflow-hidden",inert:!j,children:x?(0,t.jsx)(ek,{bots:o,onDone:h}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("p",{className:"flex items-center gap-2 px-3 py-2 font-mono text-[10px] tracking-wide text-muted-foreground",children:[(0,t.jsxs)("span",{className:"flex-1",children:["needs you · ",d]}),(0,t.jsx)(eb,{onClick:f})]}),(0,t.jsx)("div",{className:"px-1.5 pb-2",children:r.map(e=>(0,t.jsx)(eE,{task:e,onPick:()=>b(e.id)},e.id))}),(0,t.jsx)("span",{className:"block h-1.5"})]})})}),(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,t.jsxs)("button",{type:"button",onClick:g,"aria-label":i?`Tasks (${i})`:"Bots",className:"flex min-w-0 flex-1 items-center gap-2 rounded-full text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(ew,{crew:e,more:n,bubbles:s}),(0,t.jsxs)("span",{className:"ml-auto flex h-7 shrink-0 items-center gap-1.5",children:[k.shine?(0,t.jsx)(v.ShinyText,{text:k.text,tone:k.shine,speed:2.6,className:"block truncate text-[14px] leading-5 tracking-[-0.15px]"}):(0,t.jsx)("span",{className:(0,F.cn)("block animate-in truncate text-[14px] leading-5 tracking-[-0.15px] fade-in duration-300",k.tone),children:k.text},k.text),(0,t.jsxs)("span",{className:"grid size-4 shrink-0 place-items-center",children:[0===d&&0===u&&l>0&&(0,t.jsx)(c.Loader2,{className:"size-4 animate-spin text-muted-foreground/70"}),0===d&&0===m&&(u>0||0===l&&i>0)&&(0,t.jsx)(a.Check,{className:"size-4 text-muted-foreground/60"})]})]})]}),x&&(0,t.jsx)(eg,{onClick:h,label:"Cancel the message",children:(0,t.jsx)(p.X,{className:"size-3.5"})})]})]})}function eb({onClick:e}){return(0,t.jsx)(eg,{onClick:e,label:"Message a bot",children:(0,t.jsx)(m.Plus,{className:"size-4"})})}function eg({onClick:e,label:n,children:s}){return(0,t.jsx)("button",{type:"button",onClick:e,"aria-label":n,className:"grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:s})}function ek({bots:e,onDone:n}){let[a,o]=(0,f.useState)(null),[l,d]=(0,f.useState)(""),[u,m]=(0,en.useServerAction)(N.startTaskAction,{onOk:()=>{(0,q.revalidate)(h.queryKey.tasks),n()}}),x=e?.length?e.filter(e=>!e.disabled).map(e=>({name:e.name,icon:e.icon})):[{name:T.DEFAULT_BOT.name,icon:T.DEFAULT_BOT.icon}],p=()=>{a&&l.trim()&&!m&&u(a.name,l.trim())};return a?(0,t.jsxs)("div",{className:"flex min-h-32 flex-col pb-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3 pt-3 pb-2",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(null),"aria-label":"Choose a different bot",className:"grid size-6 shrink-0 place-items-center rounded-lg text-muted-foreground outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,t.jsx)(r.ChevronLeft,{className:"size-3.5"})}),(0,t.jsx)(C.BotMark,{size:22,seed:a.name,vary:a.name,color:a.icon?.color,shape:a.icon?.shape,outline:a.icon?.outline,className:"shrink-0"}),(0,t.jsxs)("span",{className:"min-w-0 flex-1 truncate text-[12.5px] font-medium",children:["To ",a.name]})]}),(0,t.jsxs)("form",{onSubmit:e=>{e.preventDefault(),p()},className:"mx-3 mt-auto flex items-end gap-1 rounded-2xl bg-background py-2 pr-2 pl-3 ring-1 ring-border/80 transition-shadow focus-within:ring-ring/60",children:[(0,t.jsx)(w.Textarea,{value:l,rows:1,autoFocus:!0,disabled:m,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||229===e.keyCode||(e.preventDefault(),p())},placeholder:`What should ${a.name} do? It cannot hear the call, so say the whole job.`,"aria-label":`Message for ${a.name}`,className:"max-h-32 min-h-15 flex-1 resize-none border-0 bg-transparent px-0 py-0 text-[13px] leading-5 shadow-none focus-visible:ring-0 dark:bg-transparent"}),(0,t.jsx)(g.Button,{type:"submit",size:"icon-sm",variant:l.trim()?"default":"ghost",disabled:!l.trim()||m,"aria-label":"Send",className:"rounded-full",children:m?(0,t.jsx)(c.Loader2,{className:"animate-spin"}):(0,t.jsx)(s.ArrowUp,{})})]})]}):(0,t.jsxs)("div",{className:"min-h-32 pb-3",children:[(0,t.jsx)("p",{className:"px-3 pt-3 pb-1.5 font-mono text-[10px] tracking-wide text-muted-foreground",children:"message a bot"}),(0,t.jsx)("div",{className:"px-1",children:x.map(e=>(0,t.jsxs)("button",{type:"button",onClick:()=>o(e),className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none transition-colors hover:bg-muted/60 focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(C.BotMark,{size:22,seed:e.name,vary:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,className:"shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 flex-1 truncate text-[13px]",children:e.name}),(0,t.jsx)(i.ChevronRight,{className:"size-3.5 shrink-0 text-muted-foreground/50"})]},e.name))})]})}let ej=["alto","brio","cinder","delta"].map((e,t)=>({name:e,icon:{color:el.MARK_PALETTE[Math.floor(t*el.MARK_PALETTE.length/4)],shape:el.MARK_SHAPES[t%el.MARK_SHAPES.length]},awake:!1,waiting:!1,word:null,standIn:!0})),ev=3;function ew({crew:e,more:n,bubbles:s}){return(0,t.jsxs)("span",{className:"flex min-w-0 shrink items-center",children:[e.map((n,a)=>{let o=s.get(n.name)??null;return(0,t.jsxs)(f.Fragment,{children:[(0,t.jsxs)("span",{className:(0,F.cn)("relative shrink-0 transition-[margin,transform] duration-500 ease-out",a>0&&!e[a-1].word&&"-ml-2",n.standIn&&"opacity-35",n.awake&&"-translate-y-0.5 scale-110"),style:{zIndex:e.length-a},children:[(0,t.jsx)(ey,{face:n}),o&&(0,t.jsx)(eN,{handoff:o})]}),n.word&&(0,t.jsx)("span",{className:"mx-2.5 min-w-0 shrink truncate",children:(0,t.jsx)(v.ShinyText,{text:n.word,speed:2.6,className:"truncate text-[13px] leading-5 tracking-[-0.1px]"})})]},n.name)}),n>0&&(0,t.jsxs)("span",{className:(0,F.cn)("grid size-7 shrink-0 place-items-center rounded-[9px] bg-muted font-mono text-[10px] text-muted-foreground ring-1 ring-border/50",!e.at(-1)?.word&&"-ml-2"),title:`${n} more`,children:["+",n]})]})}function ey({face:e}){let n=(0,f.useMemo)(()=>e.awake?{glow:20}:void 0,[e.awake]);return(0,t.jsx)(C.BotMark,{size:28,seed:e.name,vary:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:e.waiting,options:n})}function eN({handoff:e}){return(0,t.jsxs)("span",{className:"pointer-events-none absolute bottom-[calc(100%+9px)] left-1/2 flex -translate-x-1/2 animate-in flex-col items-center whitespace-nowrap fade-in zoom-in-95 duration-200",children:[(0,t.jsxs)("span",{className:"flex items-center gap-1.5 rounded-full bg-background px-2.5 py-1 text-[12.5px] leading-4 tracking-[-0.1px] shadow-lg shadow-black/10 ring-1 ring-border",children:[e.from?.name===eK.name?(0,t.jsx)(er.ThursdayMark,{size:14,className:"shrink-0 opacity-75"}):e.from&&(0,t.jsx)(C.BotMark,{size:14,seed:e.from.name,vary:e.from.name,color:e.from.icon?.color,shape:e.from.icon?.shape,outline:e.from.icon?.outline,className:"shrink-0 opacity-75"}),e.text]}),(0,t.jsx)("span",{className:"-mt-px size-0 border-x-[5px] border-t-[6px] border-x-transparent border-t-border"}),(0,t.jsx)("span",{className:"-mt-[6.5px] size-0 border-x-[5px] border-t-[6px] border-x-transparent border-t-background"})]})}function eT({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)(p.X,{className:"size-3.5"})})}function eC({count:e,pending:n,composing:s,onCompose:a,onClose:o}){return(0,t.jsxs)("div",{className:"flex items-center gap-2 px-3.5 pt-3 pb-1.5",children:[(0,t.jsx)("span",{className:"text-[13px] font-medium",children:"Tasks"}),e>0&&!s&&(0,t.jsx)("span",{className:"font-mono text-[10px] text-muted-foreground tabular-nums",children:n>0?`${n} for you \xb7 ${e}`:e}),(0,t.jsx)("span",{className:"flex-1"}),!s&&(0,t.jsx)(eb,{onClick:a}),(0,t.jsx)(eT,{onClick:o})]})}function ez({task:e,onBack:n,onClose:s}){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)(C.BotMark,{size:22,seed:e.bot.name,vary:e.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,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)(eS,{usage:e.tokens}),(0,t.jsx)(eM,{task:e}),(0,t.jsx)(eB,{task:e}),(0,t.jsx)(eT,{onClick:s})]})}function eS({usage:e}){let n=e.input+e.output;return n?(0,t.jsx)("span",{title:`in ${(0,F.formatCount)(e.input)} \xb7 out ${(0,F.formatCount)(e.output)}`,className:"shrink-0 font-mono text-[10px] text-muted-foreground/70 tabular-nums",children:(0,F.formatCount)(n)}):null}function eM({task:e}){let{contextTokens:n,contextBudget:s}=e;if(!n||!s)return null;let a=Math.min(1,n/s);return(0,t.jsx)("span",{title:`Context ${(0,F.formatCount)(n)} of ${(0,F.formatCount)(s)} — it summarizes itself here`,className:"block h-[3px] w-9 shrink-0 overflow-hidden rounded-full bg-muted",children:(0,t.jsx)("span",{className:(0,F.cn)("block h-full rounded-full",a>.9?"bg-amber-500/80":"bg-muted-foreground/70"),style:{width:`${Math.max(4,Math.round(100*a))}%`}})})}let eA={working:"text-muted-foreground",waiting:F.WAITING_INK,done:"text-foreground",failed:"text-destructive"};function eB({task:e}){let n="done"===e.status&&e.seen?"text-muted-foreground":eA[e.status];return"working"===e.status?(0,t.jsx)(v.ShinyText,{text:"working",speed:2.2,className:"shrink-0 font-mono text-[10px]"}):(0,t.jsx)("span",{className:(0,F.cn)("flex shrink-0 items-center gap-1.5 font-mono text-[10px]",n),children:e.status})}function e_({bots:e}){let{crew:n,more:s}=ex(e,[]);return(0,t.jsxs)("div",{className:"flex flex-col items-center gap-3 px-6 pt-3 pb-4 text-center",children:[(0,t.jsx)(ew,{crew:n,more:s,bubbles:ec}),e?.length?(0,t.jsx)("p",{className:"text-[12px] text-muted-foreground",children:"Nothing handed over yet — ask for something that takes a while."}):(0,t.jsxs)("p",{className:"text-[12px] text-muted-foreground",children:["Thursday hands work to ",T.DEFAULT_BOT.name," until you make bots of your own in Settings › Bots."]})]})}function eR(){return(0,t.jsx)("div",{className:"flex shrink-0 justify-end px-3 pb-2.5",children:(0,t.jsxs)("button",{type:"button",onClick:()=>(0,eo.openSettings)("tasks"),className:"flex items-center gap-1 rounded-md px-1.5 py-1 font-mono text-[10px] text-muted-foreground outline-none transition-colors hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)(u.History,{className:"size-3"}),"History"]})})}let e$=[{id:"you",label:"needs you",holds:ep},{id:"working",label:"working",holds:e=>"working"===e.status},{id:"done",label:"done",holds:()=>!0}];function eI({tasks:e,onPick:n}){let s=new Map;for(let t of e){let e=e$.find(e=>e.holds(t))??e$[2],n=s.get(e.id);n?n.push(t):s.set(e.id,[t])}return(0,t.jsx)("div",{className:"flex min-h-0 flex-1 flex-col gap-0.5 overflow-y-auto px-2 pt-1 pb-1 scrollbar-none",children:e$.map((e,a)=>{let o=s.get(e.id)??[];return o.length?(0,t.jsxs)(f.Fragment,{children:[(0,t.jsxs)("p",{className:(0,F.cn)("px-2.5 pb-1 font-mono text-[10px] text-muted-foreground",0===a?"pt-1":"pt-3"),children:[e.label," · ",o.length]}),o.map(e=>(0,t.jsx)(eE,{task:e,onPick:()=>n(e.id)},e.id))]},e.id):null})})}function eE({task:e,onPick:n}){let s=ep(e),a=e.lines.at(-1),o=(0,f.useMemo)(()=>(function(e){if("waiting"===e.status&&e.ask)return{text:(0,T.isAppStop)(e.ask)?(0,F.plainText)(e.outcome??e.ask.question):e.ask.question,tone:F.WAITING_INK};let t=e.seen;if("failed"===e.status)return{text:(0,F.plainText)(e.outcome??"Failed"),tone:t?"text-destructive/70":"text-destructive"};if("done"===e.status)return{text:(0,F.plainText)(e.outcome??"Done"),tone:t?"text-muted-foreground":"text-foreground"};let n=U(e);return n?{text:"tool"===n.kind&&n.tool?n.tool.note??`${n.tool.name} \xb7 ${n.tool.input}`:n.text,tone:"text-muted-foreground"}:{text:`${e.bot.name} is taking it on…`,tone:"text-muted-foreground italic"}})(e),[e.status,e.outcome,e.seen,e.ask,a?.id]),[r,i]=ea(),[d,u]=(0,f.useState)(null),m="waiting"===e.status?e.ask?.options??[]:[];return(0,t.jsxs)("div",{className:"rounded-xl transition-colors hover:bg-muted/60",children:[(0,t.jsxs)("button",{type:"button",onClick:n,className:"flex w-full items-center gap-2.5 rounded-xl px-2 py-1.5 text-left outline-none focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,t.jsx)("span",{className:"relative flex size-8 shrink-0 items-center justify-center overflow-visible",title:e.bot.name,children:(0,t.jsx)(C.BotMark,{size:32,seed:e.bot.name,vary:e.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,state:"working"===e.status?"thinking":"idle",notify:s})}),(0,t.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("span",{className:"flex items-center justify-between gap-2",children:[(0,t.jsx)("span",{className:(0,F.cn)("min-w-0 truncate text-[14px] leading-5 tracking-[-0.15px]",s?"text-foreground":"text-foreground/80"),children:e.label}),(0,t.jsx)(z.BotRoster,{bots:Q(e),taskId:e.id}),(0,t.jsx)("span",{className:"flex-1"}),(0,t.jsx)("span",{className:"shrink-0 font-mono text-[11px] leading-4 text-muted-foreground/70 tabular-nums",children:(0,I.shortAgo)(e.updatedAt)})]}),(0,t.jsxs)("span",{className:"mt-px flex h-4 items-center gap-1.5",children:["working"===e.status&&(0,t.jsx)(c.Loader2,{className:"size-3 shrink-0 animate-spin text-muted-foreground/70"}),"working"===e.status?(0,t.jsx)(v.ShinyText,{text:o.text,speed:2.2,className:(0,F.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone)}):(0,t.jsx)("span",{className:(0,F.cn)("min-w-0 flex-1 truncate text-[12px] leading-4",o.tone),children:o.text})]})]})]}),m.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-1.5 pt-0.5 pr-2 pb-2 pl-12.5",children:m.map(n=>(0,t.jsxs)(g.Button,{size:"sm",variant:"outline",loading:d===n,disabled:i,onClick:async()=>{u(n),await r(e,n),u(null)},className:"h-7 gap-1.5 rounded-full border-amber-500/35 bg-background px-3 text-[12px]",children:[n===T.TASK_CONTINUE&&(0,t.jsx)(l.ChevronsRight,{className:"size-3.5 text-muted-foreground"}),n]},n))})]})}function eq({task:e,className:n}){let s=(0,f.useRef)(null),a=(0,f.useRef)(!0);return(0,f.useEffect)(()=>{a.current=!0},[e.id]),(0,f.useEffect)(()=>{let e=s.current;e&&a.current&&(e.scrollTop=e.scrollHeight)},[e.lines,e.status]),(0,t.jsx)(ei.FileViewer,{children:(0,t.jsxs)("div",{ref:s,onScroll:e=>{let t=e.currentTarget;a.current=t.scrollHeight-t.scrollTop-t.clientHeight<24},className:(0,F.cn)("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",n),children:[(0,t.jsx)(eL,{task:e}),Z(e).map(n=>"invite"===n.kind?(0,t.jsx)(eD,{from:n.from,to:n.to},n.key):(0,t.jsx)(eH,{group:n.group,task:e},n.key)),"working"===e.status&&(0,t.jsx)(eF,{task:e})]})})}function eF({task:e}){if(e.lines.some(e=>e.tool&&void 0===e.tool.results))return null;let n=e.lines.at(-1),s=n?.kind==="ask"&&n.to?n.to:n?.bot;return(0,t.jsx)(v.ShinyText,{text:s?`${s.name} is on the next step…`:`${e.bot.name} is taking it on…`,speed:2.2,className:"block px-1 font-mono text-[10px]"})}function eL({task:e}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(eD,{from:eK,to:e.bot}),(0,t.jsx)(eP,{children:(0,t.jsx)(b.Bubble,{align:"end",className:"max-w-full",children:(0,t.jsx)(b.BubbleContent,{className:"rounded-tr-md py-2 pr-2 pl-3.5",children:(0,t.jsx)(k.FoldedText,{text:e.request,subject:"request"})})})})]})}let eK={name:"Thursday"};function eD({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)(eO,{bot:e}),(0,t.jsx)("span",{className:"shrink-0 text-muted-foreground/70",children:"invited"}),(0,t.jsx)(eO,{bot:n})]})})}function eO({bot:e}){return(0,t.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,t.jsx)(C.BotMark,{size:15,seed:e.name,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1,className:"shrink-0"}),(0,t.jsx)("span",{className:"truncate",children:e.name})]})}function eP({children:e}){return(0,t.jsx)(eU,{side:"end",name:"Thursday",mark:(0,t.jsx)(C.BotMark,{size:26,seed:"thursday",notify:!1,className:"mt-1 shrink-0"}),children:e})}function eU({side:e,mark:n,name:s,children:a}){return(0,t.jsxs)("div",{className:(0,F.cn)("flex gap-2.5","end"===e&&"flex-row-reverse"),children:[n,(0,t.jsxs)("div",{className:(0,F.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:s}),a]})]})}function eH({group:e,task:n}){return e.lines[0]?.kind==="user"?(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(eP,{children:e.lines.map(e=>(0,t.jsx)(b.Bubble,{align:"end",className:"max-w-full",children:(0,t.jsx)(b.BubbleContent,{className:"rounded-tr-md px-3.5 text-[13px] leading-snug break-keep",children:e.text})},e.id))})}):(0,t.jsx)("div",{className:"animate-in fade-in slide-in-from-bottom-2 duration-300",children:(0,t.jsx)(eU,{side:e.bot.name===n.bot.name?"start":"end",name:e.bot.name,mark:(0,t.jsx)(C.BotMark,{size:26,seed:e.bot.name,vary:n.id,color:e.bot.icon?.color,shape:e.bot.icon?.shape,outline:e.bot.icon?.outline,notify:!1,className:"mt-1 shrink-0"}),children:(function(e){let t=[];for(let n of e){let e="tool"===n.kind&&n.tool?"tools":"stop"===n.kind?"stops":"said",s=t.at(-1),a=s?.kind===e&&("stops"!==e||eJ(s.lines[0].text)===eJ(n.text));s&&a?s.lines.push(n):t.push({kind:e,key:n.id,lines:[n]})}return t})(e.lines).map(e=>"tools"===e.kind?(0,t.jsx)(eG,{lines:e.lines,taskId:n.id},e.key):"stops"===e.kind?(0,t.jsx)(eX,{lines:e.lines},e.key):e.lines.map(e=>(0,t.jsx)(eV,{line:e,taskId:n.id},e.id)))})})}function eV({line:e,taskId:n}){if("tool"===e.kind&&e.tool)return(0,t.jsx)(ed.BotTool,{tool:e.tool,taskId:n});if("note"===e.kind)return(0,t.jsxs)("details",{className:"w-full 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:"shrink-0 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)("p",{className:"mt-2 rounded-xl bg-muted/40 px-3 py-2 text-[11px] leading-relaxed whitespace-pre-wrap break-keep",children:e.text})]});if(!Y(e))return(0,t.jsx)("p",{className:"px-1 text-[12.5px] leading-relaxed break-keep text-muted-foreground",children:e.text});if(e.options)return(0,t.jsxs)("div",{className:"w-fit max-w-full space-y-1.5 rounded-2xl bg-amber-500/8 px-3 py-2 ring-1 ring-amber-500/25",children:[(0,t.jsx)("p",{className:"text-[13px] leading-snug break-keep",children:e.text}),e.options.length>0&&(0,t.jsx)("p",{className:"flex flex-wrap gap-1",children:e.options.map(e=>(0,t.jsx)("span",{className:"rounded-full bg-background/70 px-2 py-0.5 font-mono text-[10px] text-muted-foreground",children:e},e))})]});let s="error"===e.kind;return(0,t.jsxs)("div",{className:"min-w-0 px-1",children:[s&&(0,t.jsxs)("p",{className:"mb-1.5 flex items-center gap-1.5 font-mono text-[10px] text-destructive",children:[(0,t.jsx)(p.X,{className:"size-3 shrink-0"}),"Could not finish"]}),(0,t.jsx)(j.Markdown,{className:(0,F.cn)("overflow-x-auto text-[13px] leading-relaxed break-keep [&_h1]:text-[15px] [&_h2]:text-[14px] [&_h3]:text-[13px] [&_h3]:font-semibold [&_li]:my-0.5 [&_table]:text-[12px] [&>*:first-child]:mt-0 [&>*:last-child]:mb-0",s&&"text-destructive"),children:e.text}),(0,t.jsxs)("div",{className:"mt-2 flex items-center gap-2",children:[(0,t.jsx)(S.PathChips,{text:e.text,className:"min-w-0"}),!s&&(0,t.jsx)("span",{className:"ml-auto shrink-0",children:(0,t.jsx)(eW,{text:e.text})})]})]})}function eW({text:e}){let[n,s]=(0,f.useState)(!1),o=(0,f.useRef)(null);return(0,f.useEffect)(()=>()=>{o.current&&clearTimeout(o.current)},[]),(0,t.jsx)("button",{type:"button","aria-label":"Copy the answer",onClick:async()=>{try{await navigator.clipboard.writeText(e),s(!0),o.current&&clearTimeout(o.current),o.current=setTimeout(()=>s(!1),1400)}catch(e){y.toast.add({type:"error",title:"Could not copy the answer",description:(0,F.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)(d.Copy,{className:"size-3"})})}function eG({lines:e,taskId:n}){return(0,t.jsxs)("div",{className:"flex w-full flex-col gap-0.5 rounded-2xl bg-muted/40 p-1",children:[e.length>1&&(0,t.jsxs)("p",{className:"px-2 py-1 font-mono text-[10px] text-muted-foreground",children:[e.length," steps"]}),e.map(e=>e.tool?(0,t.jsx)(ed.BotTool,{tool:e.tool,taskId:n,collapsed:!0},e.id):null)]})}function eX({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)(x.RotateCw,{className:"size-3 shrink-0"}),(0,t.jsx)("span",{className:"min-w-0 truncate",children:eJ(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)(o.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,I.toDate)(e.at),"HH:mm:ss")}),(0,t.jsx)("span",{className:"min-w-0",children:e.text})]},e.id))})]})}let eJ=e=>e.split(" (")[0].replace(/\.$/,"");e.s(["BotRoom",0,eu,"Conversation",0,eq],279265)},702966,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7fe6602a05bb6dae37da243aa6829eac42bb7d02cb",t.callServer,void 0,t.findSourceMapURL,"answerTaskAction");e.s(["answerTaskAction",0,n])},568288,e=>{"use strict";var t=e.i(95187);let n=(0,t.createServerReference)("7fe9cd69f4473537676c65d3d2ae78b80659aa141e",t.callServer,void 0,t.findSourceMapURL,"cancelTaskAction");e.s(["cancelTaskAction",0,n])},931619,508734,825398,815731,496336,965281,835878,764224,919191,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 s=(0,t.default)(n);e.s(["ChevronsRight",0,s],931619);let a={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};a.node;let o=(0,t.default)(a);e.s(["Copy",0,o],508734);let r={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"}]]};r.node;let i=(0,t.default)(r);e.s(["RotateCw",0,i],825398);var l=e.i(843476),d=e.i(176782),u=e.i(552245),c=e.i(225913),m=e.i(647163);let x=(0,c.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,c.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,...s}){return(0,l.jsx)("div",{"data-slot":"bubble","data-variant":e,"data-align":t,className:(0,m.cn)(x({variant:e}),n),...s})},"BubbleContent",0,function({className:e,render:t,...n}){var s;return s={defaultTagName:"div",props:(0,d.mergeProps)({className:(0,m.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,u.useRenderElement)(s.defaultTagName??"div",s,s)}],815731);var p=e.i(716327),f=e.i(271645);e.s(["FoldedText",0,function({text:e,subject:t,clamp:n="line-clamp-3",tall:s="max-h-40",className:a}){let[o,r]=(0,f.useState)(!1),[i,d]=(0,f.useState)(!1),u=(0,f.useRef)(null);return(0,f.useEffect)(()=>r(!1),[e]),(0,f.useEffect)(()=>{let e=u.current;e&&!o&&d(e.scrollHeight>e.clientHeight+1)},[o,e]),(0,l.jsxs)("div",{className:(0,m.cn)("flex items-start gap-1",a),children:[(0,l.jsx)("p",{ref:u,className:(0,m.cn)("min-w-0 flex-1 text-[13px] leading-snug break-keep",o?(0,m.cn)(s,"overflow-y-auto scrollbar-none"):n),children:e}),(i||o)&&(0,l.jsx)("button",{type:"button",onClick:()=>r(e=>!e),"aria-label":o?`Fold the ${t}`:`Read the whole ${t}`,className:"shrink-0 rounded-md p-0.5 opacity-60 outline-none transition-opacity hover:opacity-100 focus-visible:ring-3 focus-visible:ring-ring/50",children:(0,l.jsx)(p.ChevronDown,{className:(0,m.cn)("size-3.5",o&&"rotate-180")})})]})}],496336);var h=e.i(95187);let b=(0,h.createServerReference)("7fead883112f4944026c3de5b1121d035e8d913c24",h.callServer,void 0,h.findSourceMapURL,"startTaskAction");e.s(["startTaskAction",0,b],965281);var g=e.i(635963);e.s(["BotRoster",0,function({bots:e,taskId:t}){return e.length<2?null:(0,l.jsxs)("span",{className:"flex shrink-0 items-center gap-1.5",title:e.map(e=>e.name).join(", "),children:[(0,l.jsx)("span",{className:"flex items-center",children:e.slice(0,3).map(e=>(0,l.jsx)(g.BotMark,{size:18,seed:e.name,vary:t,color:e.icon?.color,shape:e.icon?.shape,outline:e.icon?.outline,notify:!1,className:"-ml-[3px] rounded-[7px] ring-2 ring-background first:ml-0"},e.name))}),(0,l.jsxs)("span",{className:"font-mono text-[10px] text-muted-foreground",children:[e.length," bots"]})]})}],835878);var k=e.i(829600);let j={name:"file-code",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}]]};j.node;let v=(0,t.default)(j),w={name:"file-image",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]};w.node;let y=(0,t.default)(w);var N=e.i(905015);let T={name:"file-spreadsheet",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]};T.node;let C=(0,t.default)(T);var z=e.i(226091);let S={name:"file-type",size:24,node:[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M11 18h2",key:"12mj7e"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5",key:"qbrxap"}]]};S.node;let M=(0,t.default)(S);var A=e.i(621285),B=e.i(616172);let _={markdown:z.FileText,csv:C,json:N.FileJson,text:M,image:y};e.s(["PathChips",0,function({text:e,className:t}){let n=(0,f.useMemo)(()=>(0,B.pathsIn)(e),[e]);return n.length?(0,l.jsx)("div",{className:(0,m.cn)("flex flex-wrap gap-1.5",t),children:n.map(e=>{let t,n=e.split("/").pop()??e,s="frame"===(t=(0,B.viewKindOf)(e))?e.toLowerCase().endsWith(".pdf")?z.FileText:v:_[t]??k.File;return(0,l.jsxs)(A.FileLink,{path:e,className:"flex max-w-full items-center gap-1.5 rounded-full bg-muted/70 py-1 pr-2.5 pl-2 font-mono text-[11px] text-foreground/80 outline-none transition-colors hover:bg-muted hover:text-foreground focus-visible:ring-3 focus-visible:ring-ring/50",children:[(0,l.jsx)(s,{className:"size-3 shrink-0 text-muted-foreground"}),(0,l.jsx)("span",{className:"truncate",children:n})]},e)})}):null}],764224);let R={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"}]]};R.node;let $=(0,t.default)(R);e.s(["CornerDownLeft",0,$],919191)},929272,e=>{"use strict";var t=e.i(456420);let n={name:"square",size:24,node:[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]};n.node;let s=(0,t.default)(n);e.s(["Square",0,s],929272)}]);