@stigmer/server-slim 3.13.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 (738) hide show
  1. package/README.md +3 -0
  2. package/console/404.html +1 -0
  3. package/console/Icon-bw.svg +10 -0
  4. package/console/Icon-light.svg +10 -0
  5. package/console/__next.__PAGE__.txt +5 -0
  6. package/console/__next._full.txt +28 -0
  7. package/console/__next._head.txt +6 -0
  8. package/console/__next._index.txt +17 -0
  9. package/console/__next._tree.txt +5 -0
  10. package/console/_next/static/XrBnttPHHP5Wmi7mT4uLM/_buildManifest.js +11 -0
  11. package/console/_next/static/XrBnttPHHP5Wmi7mT4uLM/_clientMiddlewareManifest.js +1 -0
  12. package/console/_next/static/XrBnttPHHP5Wmi7mT4uLM/_ssgManifest.js +1 -0
  13. package/console/_next/static/chunks/0-6znc4v4kg4~.js +1 -0
  14. package/console/_next/static/chunks/0-73gkqs33_.~.js +1 -0
  15. package/console/_next/static/chunks/0-l4jzu40dd8w.js +1 -0
  16. package/console/_next/static/chunks/0-z-fnjdx4ulh.js +1 -0
  17. package/console/_next/static/chunks/0-zcgxw8vt51~.js +1 -0
  18. package/console/_next/static/chunks/0.f-b71h~m9l_.js +1 -0
  19. package/console/_next/static/chunks/0.p57pbuzo8j7.js +90 -0
  20. package/console/_next/static/chunks/0.qu8zg6yocro.js +1 -0
  21. package/console/_next/static/chunks/00-fpv~l3r27l.js +1 -0
  22. package/console/_next/static/chunks/005ctashl3n1r.js +1 -0
  23. package/console/_next/static/chunks/0068d1zb538z~.js +1 -0
  24. package/console/_next/static/chunks/008b.zzs.t4bw.js +139 -0
  25. package/console/_next/static/chunks/00d~s.n2ue-_h.js +1 -0
  26. package/console/_next/static/chunks/00o8ud2dmna2j.js +1 -0
  27. package/console/_next/static/chunks/00r~itj4ekq5y.js +1 -0
  28. package/console/_next/static/chunks/01.9x7hzkgv7j.js +1 -0
  29. package/console/_next/static/chunks/016uwj-o-jqap.js +1 -0
  30. package/console/_next/static/chunks/01f1gh.2dzexy.js +1 -0
  31. package/console/_next/static/chunks/01ontipw7_pn-.js +1 -0
  32. package/console/_next/static/chunks/02fsq8lsaeu8j.js +1 -0
  33. package/console/_next/static/chunks/02qsbdquvk64o.js +1 -0
  34. package/console/_next/static/chunks/03.b9z-1o34dx.js +1 -0
  35. package/console/_next/static/chunks/038jxymv2x4u-.js +148 -0
  36. package/console/_next/static/chunks/03f2f6enzzhsy.js +1 -0
  37. package/console/_next/static/chunks/03l_lqxocp3uj.js +1 -0
  38. package/console/_next/static/chunks/03lth2le32c6r.js +201 -0
  39. package/console/_next/static/chunks/03v0v690_bw8u.js +62 -0
  40. package/console/_next/static/chunks/03yru4-m-450t.js +1 -0
  41. package/console/_next/static/chunks/03~yq9q893hmn.js +1 -0
  42. package/console/_next/static/chunks/04nu-nyhd8yfk.js +18 -0
  43. package/console/_next/static/chunks/04uzf6wcrofgt.js +1 -0
  44. package/console/_next/static/chunks/056bfxvkb8fd~.js +1 -0
  45. package/console/_next/static/chunks/06huuay3x3z07.js +1 -0
  46. package/console/_next/static/chunks/06o.rsm2b~dht.js +60 -0
  47. package/console/_next/static/chunks/07.l7154cu7z-.js +1 -0
  48. package/console/_next/static/chunks/07wnm1~gr1rx~.js +1 -0
  49. package/console/_next/static/chunks/08.rk-nar1l2t.js +25 -0
  50. package/console/_next/static/chunks/08iibm2~7e.mj.js +1 -0
  51. package/console/_next/static/chunks/08o5wsrurx9ux.js +5 -0
  52. package/console/_next/static/chunks/09~n7y-jkmjlj.js +152 -0
  53. package/console/_next/static/chunks/0_mhv9_2_g.-d.js +119 -0
  54. package/console/_next/static/chunks/0af53k.rxu1kn.js +1 -0
  55. package/console/_next/static/chunks/0amugang-25bm.js +1 -0
  56. package/console/_next/static/chunks/0awsj.h.eiuen.js +1 -0
  57. package/console/_next/static/chunks/0axtn1ln1j35_.js +79 -0
  58. package/console/_next/static/chunks/0c5xj4q0jmdu0.js +1 -0
  59. package/console/_next/static/chunks/0c7llz2igr3w7.js +1 -0
  60. package/console/_next/static/chunks/0cgp87bgoglgv.js +1 -0
  61. package/console/_next/static/chunks/0co3~00k0sae5.js +1 -0
  62. package/console/_next/static/chunks/0cq0zrqlu~xa7.js +1 -0
  63. package/console/_next/static/chunks/0cs_h74-ljzlt.js +77 -0
  64. package/console/_next/static/chunks/0cu8k_dz43e4y.js +1 -0
  65. package/console/_next/static/chunks/0d05q_m7mqj4o.js +1 -0
  66. package/console/_next/static/chunks/0dsde0n1co0l..js +1 -0
  67. package/console/_next/static/chunks/0e4xdug~7dxzk.js +1 -0
  68. package/console/_next/static/chunks/0e7hldxv930hc.js +12 -0
  69. package/console/_next/static/chunks/0ed3hfv95qark.js +10 -0
  70. package/console/_next/static/chunks/0f1nokqa6poai.js +1 -0
  71. package/console/_next/static/chunks/0f8bbcvfh6x_j.js +64 -0
  72. package/console/_next/static/chunks/0fy2-q-5a0j3r.js +1 -0
  73. package/console/_next/static/chunks/0g-98wql22rf4.css +1 -0
  74. package/console/_next/static/chunks/0g167wye7-x6z.js +1 -0
  75. package/console/_next/static/chunks/0g4_345f39a55.js +1 -0
  76. package/console/_next/static/chunks/0ge0mq0ea60lx.js +1 -0
  77. package/console/_next/static/chunks/0gepanyj709pr.js +1 -0
  78. package/console/_next/static/chunks/0glne1asott9e.js +2 -0
  79. package/console/_next/static/chunks/0hb.-vcj2w6kf.js +1 -0
  80. package/console/_next/static/chunks/0hdh_2akzrlxi.js +287 -0
  81. package/console/_next/static/chunks/0hhe78mplcj67.js +1 -0
  82. package/console/_next/static/chunks/0hori02zn~h3o.js +1 -0
  83. package/console/_next/static/chunks/0hq~c-~dp2g~1.js +1 -0
  84. package/console/_next/static/chunks/0i.l9589uvx0j.js +1 -0
  85. package/console/_next/static/chunks/0i8pgzf~hu-3m.js +24 -0
  86. package/console/_next/static/chunks/0icpvuwlmnlty.js +43 -0
  87. package/console/_next/static/chunks/0icsogze8wb_v.js +3 -0
  88. package/console/_next/static/chunks/0ij17mw0v0qd-.js +1 -0
  89. package/console/_next/static/chunks/0io-wgdji~5d0.js +1 -0
  90. package/console/_next/static/chunks/0ipk1er3w80bj.js +24 -0
  91. package/console/_next/static/chunks/0irq1yd9ix16u.js +1 -0
  92. package/console/_next/static/chunks/0iwpyv2wbln6f.js +1 -0
  93. package/console/_next/static/chunks/0ixo5_jc~m0~2.js +1 -0
  94. package/console/_next/static/chunks/0jxlubusvmdjm.js +1 -0
  95. package/console/_next/static/chunks/0j~3z.dgn_8ff.css +6 -0
  96. package/console/_next/static/chunks/0k9_1v72yx36d.js +226 -0
  97. package/console/_next/static/chunks/0ka-.7dww7nze.js +101 -0
  98. package/console/_next/static/chunks/0kt3942_0py-t.js +1 -0
  99. package/console/_next/static/chunks/0l3uvjh3oslhq.js +1 -0
  100. package/console/_next/static/chunks/0lp.du_t-~cqs.js +2 -0
  101. package/console/_next/static/chunks/0lq22-4n7_uyt.js +34 -0
  102. package/console/_next/static/chunks/0lypu-.xpph9..js +15 -0
  103. package/console/_next/static/chunks/0mb.pnhflhw95.js +1 -0
  104. package/console/_next/static/chunks/0mcz_room09fj.js +1 -0
  105. package/console/_next/static/chunks/0mo3-obfy2_6v.js +15 -0
  106. package/console/_next/static/chunks/0mtfbfe5xd3.6.js +1 -0
  107. package/console/_next/static/chunks/0mvcspqlkvjri.js +1 -0
  108. package/console/_next/static/chunks/0n2qydw3oc1oj.js +1 -0
  109. package/console/_next/static/chunks/0nnkdto25tilf.js +1 -0
  110. package/console/_next/static/chunks/0npm9l63~4j0v.js +1 -0
  111. package/console/_next/static/chunks/0nu6llqvg4741.js +1 -0
  112. package/console/_next/static/chunks/0n~glqz40m6gv.js +1 -0
  113. package/console/_next/static/chunks/0o-.19qua6web.js +5 -0
  114. package/console/_next/static/chunks/0omq5mq8dkd24.js +1 -0
  115. package/console/_next/static/chunks/0oprw5m.lmqln.js +1 -0
  116. package/console/_next/static/chunks/0ortphe030oky.js +1 -0
  117. package/console/_next/static/chunks/0oufb2b491l23.js +153 -0
  118. package/console/_next/static/chunks/0owq59irnycu5.js +1 -0
  119. package/console/_next/static/chunks/0ptwwlt0l20~o.js +1 -0
  120. package/console/_next/static/chunks/0q2tc-vqxe1_n.js +1 -0
  121. package/console/_next/static/chunks/0qfu4h5g.k-yt.js +1 -0
  122. package/console/_next/static/chunks/0qji_.pm~u8x3.js +1 -0
  123. package/console/_next/static/chunks/0qm2930z0c.8m.js +80 -0
  124. package/console/_next/static/chunks/0q~1rz_i~v0vs.js +1 -0
  125. package/console/_next/static/chunks/0r4lipg4xb6fx.js +1 -0
  126. package/console/_next/static/chunks/0rhvismtjivza.js +104 -0
  127. package/console/_next/static/chunks/0rmt10l3458p_.js +93 -0
  128. package/console/_next/static/chunks/0rob~86j~8vge.js +1 -0
  129. package/console/_next/static/chunks/0r~zu0c3j_b7p.js +1 -0
  130. package/console/_next/static/chunks/0s0v8xobo-2ok.js +34 -0
  131. package/console/_next/static/chunks/0s8nwq43gep9_.js +15 -0
  132. package/console/_next/static/chunks/0spswjguxbqfn.js +1 -0
  133. package/console/_next/static/chunks/0t6aq14rpn1.w.js +1 -0
  134. package/console/_next/static/chunks/0taiwi2j.k7mm.js +1 -0
  135. package/console/_next/static/chunks/0tj3k0t29gpn7.js +1 -0
  136. package/console/_next/static/chunks/0tq77.56bu2eu.js +1 -0
  137. package/console/_next/static/chunks/0ulcdeu8yx-cn.js +1 -0
  138. package/console/_next/static/chunks/0uvbqsa~x3_x6.js +1 -0
  139. package/console/_next/static/chunks/0uw8zy_zoej6s.js +1 -0
  140. package/console/_next/static/chunks/0uz5-~rqk9vr..js +1 -0
  141. package/console/_next/static/chunks/0w3ug0~zih~j2.js +1 -0
  142. package/console/_next/static/chunks/0wfrz3x.bxehc.js +1 -0
  143. package/console/_next/static/chunks/0wyb4nqlt6his.js +1 -0
  144. package/console/_next/static/chunks/0x.4919xjicc5.js +75 -0
  145. package/console/_next/static/chunks/0xr1dk~mec2dn.js +1 -0
  146. package/console/_next/static/chunks/0xxouzzjw_a6q.js +115 -0
  147. package/console/_next/static/chunks/0y0u4wm.3~_ac.js +1 -0
  148. package/console/_next/static/chunks/0y4vop46pw7ip.js +2 -0
  149. package/console/_next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
  150. package/console/_next/static/chunks/0y99xmlf_e2si.js +1 -0
  151. package/console/_next/static/chunks/0ydl92ezt_ppz.js +1 -0
  152. package/console/_next/static/chunks/0ywlzawl2ml3h.js +1 -0
  153. package/console/_next/static/chunks/0yysdfbgz-l8n.js +1 -0
  154. package/console/_next/static/chunks/0zjs5hlwbvch9.js +4 -0
  155. package/console/_next/static/chunks/0zsntdh42--v1.js +1 -0
  156. package/console/_next/static/chunks/104yvyc1ce3q5.js +1 -0
  157. package/console/_next/static/chunks/1051z1rwyse00.js +1 -0
  158. package/console/_next/static/chunks/10h6g4u9i~5h8.js +1 -0
  159. package/console/_next/static/chunks/10isn5~-bj4w5.js +4 -0
  160. package/console/_next/static/chunks/10ymqudg~95gr.js +1 -0
  161. package/console/_next/static/chunks/111eimn8nia.7.js +1 -0
  162. package/console/_next/static/chunks/1155_-gh-rcvi.js +1 -0
  163. package/console/_next/static/chunks/117cg_x8i7.ol.js +1 -0
  164. package/console/_next/static/chunks/11_7qxlc92f5s.js +1 -0
  165. package/console/_next/static/chunks/11h85j-8~tny3.js +36 -0
  166. package/console/_next/static/chunks/11t~35bechtea.js +1 -0
  167. package/console/_next/static/chunks/11uh-ttx4zin-.js +9 -0
  168. package/console/_next/static/chunks/11xfx57fbi3md.js +2 -0
  169. package/console/_next/static/chunks/12329wyw7127c.js +1 -0
  170. package/console/_next/static/chunks/123jshjvn0ocr.js +31 -0
  171. package/console/_next/static/chunks/128ahbvhdeeq-.js +1 -0
  172. package/console/_next/static/chunks/13hl4dngamd3l.js +127 -0
  173. package/console/_next/static/chunks/14.38bpm-d3-l.js +1 -0
  174. package/console/_next/static/chunks/14i46k409qlt0.js +1 -0
  175. package/console/_next/static/chunks/14j238ax8coge.js +29 -0
  176. package/console/_next/static/chunks/159151ghv9-cc.js +1 -0
  177. package/console/_next/static/chunks/15hlb71q~xfev.js +1 -0
  178. package/console/_next/static/chunks/15r_pfbdb2jhp.js +23 -0
  179. package/console/_next/static/chunks/15wc.2zpsy4wc.js +4 -0
  180. package/console/_next/static/chunks/16pzrphqjtyli.js +1 -0
  181. package/console/_next/static/chunks/16ukgtm3fhab~.js +1071 -0
  182. package/console/_next/static/chunks/170p3g7_6_620.js +2 -0
  183. package/console/_next/static/chunks/175hd_pl41_vh.js +15 -0
  184. package/console/_next/static/chunks/17glhyaxi4vs-.js +1 -0
  185. package/console/_next/static/chunks/17jhgtykn778_.js +1 -0
  186. package/console/_next/static/chunks/17v4twif7y~.b.js +1 -0
  187. package/console/_next/static/chunks/182b_f_n0-cdr.js +1 -0
  188. package/console/_next/static/chunks/187v8dzyf1l-f.js +80 -0
  189. package/console/_next/static/chunks/turbopack-0cvnq9zq1g68-.js +1 -0
  190. package/console/_next/static/chunks/turbopack-172c~.rma.yso.js +1 -0
  191. package/console/_next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
  192. package/console/_next/static/media/02263ebadd758ea4-s.0qg7j5o.yrclm.woff2 +0 -0
  193. package/console/_next/static/media/03fc1b4a8d284b5e-s.09.f.n_ccld80.woff2 +0 -0
  194. package/console/_next/static/media/07454f8ad8aaac57-s.0tqkxa-w3pk~c.woff2 +0 -0
  195. package/console/_next/static/media/1bcd0e671759a44c-s.0vnh8.d8wxa2x.woff2 +0 -0
  196. package/console/_next/static/media/1bffadaabf893a1e-s.16ipb6fqu393i.woff2 +0 -0
  197. package/console/_next/static/media/224e262ef877bfa4-s.0mo8vqgr8yagc.woff2 +0 -0
  198. package/console/_next/static/media/2bbe8d2671613f1f-s.067x_6k0k23tk.woff2 +0 -0
  199. package/console/_next/static/media/2c55a0e60120577a-s.0bjc5tiuqdqro.woff2 +0 -0
  200. package/console/_next/static/media/2fe89d53234c61d4-s.0k_.i63k_i_qa.woff2 +0 -0
  201. package/console/_next/static/media/4fa387ec64143e14-s.0wkzw~je483f-.woff2 +0 -0
  202. package/console/_next/static/media/53b9e256198e5412-s.0-wfv7uh4i7h9.woff2 +0 -0
  203. package/console/_next/static/media/5476f68d60460930-s.0wxq9webf.ew4.woff2 +0 -0
  204. package/console/_next/static/media/57215795b8570f5c-s.0vwgtotjdgnhr.woff2 +0 -0
  205. package/console/_next/static/media/59b15b4bcd7b1eb5-s.0x08jh8vondwt.woff2 +0 -0
  206. package/console/_next/static/media/5ce348bf30bf5439-s.0zgw-jeven.3w.woff2 +0 -0
  207. package/console/_next/static/media/5e05ae5b48faa55e-s.0m9hhkgdlzukj.woff2 +0 -0
  208. package/console/_next/static/media/6306c77e7c8268e4-s.0rhz0arwfsn~5.woff2 +0 -0
  209. package/console/_next/static/media/68757d6cddeff913-s.0hkrq11n-dhos.woff2 +0 -0
  210. package/console/_next/static/media/7178b3e590c64307-s.0nx0ww8fni_q3.woff2 +0 -0
  211. package/console/_next/static/media/797e433ab948586e-s.p.08e28id.o-okb.woff2 +0 -0
  212. package/console/_next/static/media/7d817b4c03b0c5f1-s.0l76wvqk9d84w.woff2 +0 -0
  213. package/console/_next/static/media/7f11d98043fdedc9-s.0r4w1y.tjq0ay.woff2 +0 -0
  214. package/console/_next/static/media/7fea77d1d19108bf-s.0xyeb7czu1stb.woff2 +0 -0
  215. package/console/_next/static/media/83afe278b6a6bb3c-s.0q-301v4kxxnr.woff2 +0 -0
  216. package/console/_next/static/media/8a480f0b521d4e75-s.0jzbimsg8vl84.woff2 +0 -0
  217. package/console/_next/static/media/90c51ce8fb754fe8-s.00z~hoalba5dm.woff2 +0 -0
  218. package/console/_next/static/media/99e609270109b47d-s.16-z~2sp29ex6.woff2 +0 -0
  219. package/console/_next/static/media/9c72aa0f40e4eef8-s.0m6w47a4e5dy9.woff2 +0 -0
  220. package/console/_next/static/media/a7afbb44bec2bb18-s.0juuwbcf7uz~t.woff2 +0 -0
  221. package/console/_next/static/media/ad66f9afd8947f86-s.11u06r12fd6v_.woff2 +0 -0
  222. package/console/_next/static/media/bbc41e54d2fcbd21-s.0k4k9394f2q-k.woff2 +0 -0
  223. package/console/_next/static/media/caa3a2e1cccd8315-s.p.09~u27dqhyhd6.woff2 +0 -0
  224. package/console/_next/static/media/d8cb5ab3660140cd-s.0ri_id_kcagyz.woff2 +0 -0
  225. package/console/_next/static/media/e15f58668ad64cb8-s.0~.8lt~vdqmc3.woff2 +0 -0
  226. package/console/_next/static/media/e390973e931a41c5-s.08hd0g.321csk.woff2 +0 -0
  227. package/console/_next/static/media/e532fa1b9921e1cd-s.0~wrfy7sm-h4g.woff2 +0 -0
  228. package/console/_next/static/media/e6d00ff86ef9e699-s.0lcb62h0-.jh3.woff2 +0 -0
  229. package/console/_next/static/media/effe91970fc4db64-s.07ig5l8azj~hy.woff2 +0 -0
  230. package/console/_next/static/media/elk-worker.min.13hrbirt7_.ef.js +6401 -0
  231. package/console/_next/static/media/favicon.0x3dzn~oxb6tn.ico +0 -0
  232. package/console/_next/static/media/fef07dbb0973bf53-s.12tyk43_3sh9u.woff2 +0 -0
  233. package/console/_not-found/__next._full.txt +29 -0
  234. package/console/_not-found/__next._head.txt +6 -0
  235. package/console/_not-found/__next._index.txt +17 -0
  236. package/console/_not-found/__next._not-found.__PAGE__.txt +6 -0
  237. package/console/_not-found/__next._not-found.txt +5 -0
  238. package/console/_not-found/__next._tree.txt +3 -0
  239. package/console/_not-found.html +1 -0
  240. package/console/_not-found.txt +29 -0
  241. package/console/apple-touch-icon-dark.png +0 -0
  242. package/console/apple-touch-icon-light.png +0 -0
  243. package/console/auth/callback/__next._full.txt +36 -0
  244. package/console/auth/callback/__next._head.txt +6 -0
  245. package/console/auth/callback/__next._index.txt +17 -0
  246. package/console/auth/callback/__next._tree.txt +5 -0
  247. package/console/auth/callback/__next.auth.callback.__PAGE__.txt +9 -0
  248. package/console/auth/callback/__next.auth.callback.txt +5 -0
  249. package/console/auth/callback/__next.auth.txt +5 -0
  250. package/console/auth/callback.html +1 -0
  251. package/console/auth/callback.txt +36 -0
  252. package/console/auth/github/callback/__next._full.txt +37 -0
  253. package/console/auth/github/callback/__next._head.txt +6 -0
  254. package/console/auth/github/callback/__next._index.txt +17 -0
  255. package/console/auth/github/callback/__next._tree.txt +5 -0
  256. package/console/auth/github/callback/__next.auth.github.callback.__PAGE__.txt +9 -0
  257. package/console/auth/github/callback/__next.auth.github.callback.txt +5 -0
  258. package/console/auth/github/callback/__next.auth.github.txt +5 -0
  259. package/console/auth/github/callback/__next.auth.txt +5 -0
  260. package/console/auth/github/callback.html +1 -0
  261. package/console/auth/github/callback.txt +37 -0
  262. package/console/auth/oauth/callback/__next._full.txt +37 -0
  263. package/console/auth/oauth/callback/__next._head.txt +6 -0
  264. package/console/auth/oauth/callback/__next._index.txt +17 -0
  265. package/console/auth/oauth/callback/__next._tree.txt +5 -0
  266. package/console/auth/oauth/callback/__next.auth.oauth.callback.__PAGE__.txt +9 -0
  267. package/console/auth/oauth/callback/__next.auth.oauth.callback.txt +5 -0
  268. package/console/auth/oauth/callback/__next.auth.oauth.txt +5 -0
  269. package/console/auth/oauth/callback/__next.auth.txt +5 -0
  270. package/console/auth/oauth/callback.html +1 -0
  271. package/console/auth/oauth/callback.txt +37 -0
  272. package/console/chat/__placeholder__/__placeholder__/__next._full.txt +35 -0
  273. package/console/chat/__placeholder__/__placeholder__/__next._head.txt +6 -0
  274. package/console/chat/__placeholder__/__placeholder__/__next._index.txt +17 -0
  275. package/console/chat/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  276. package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.__PAGE__.txt +6 -0
  277. package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.$d$slug.txt +5 -0
  278. package/console/chat/__placeholder__/__placeholder__/__next.chat.$d$org.txt +5 -0
  279. package/console/chat/__placeholder__/__placeholder__/__next.chat.txt +5 -0
  280. package/console/chat/__placeholder__/__placeholder__.html +1 -0
  281. package/console/chat/__placeholder__/__placeholder__.txt +35 -0
  282. package/console/conversations/__next._full.txt +32 -0
  283. package/console/conversations/__next._head.txt +6 -0
  284. package/console/conversations/__next._index.txt +17 -0
  285. package/console/conversations/__next._tree.txt +5 -0
  286. package/console/conversations/__next.conversations.__PAGE__.txt +6 -0
  287. package/console/conversations/__next.conversations.txt +5 -0
  288. package/console/conversations/__placeholder__/__placeholder__/__next._full.txt +35 -0
  289. package/console/conversations/__placeholder__/__placeholder__/__next._head.txt +6 -0
  290. package/console/conversations/__placeholder__/__placeholder__/__next._index.txt +17 -0
  291. package/console/conversations/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  292. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.__PAGE__.txt +6 -0
  293. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.$d$key.txt +5 -0
  294. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.$d$channelId.txt +5 -0
  295. package/console/conversations/__placeholder__/__placeholder__/__next.conversations.txt +5 -0
  296. package/console/conversations/__placeholder__/__placeholder__.html +1 -0
  297. package/console/conversations/__placeholder__/__placeholder__.txt +35 -0
  298. package/console/conversations.html +1 -0
  299. package/console/conversations.txt +32 -0
  300. package/console/dashboard/__next._full.txt +32 -0
  301. package/console/dashboard/__next._head.txt +6 -0
  302. package/console/dashboard/__next._index.txt +17 -0
  303. package/console/dashboard/__next._tree.txt +5 -0
  304. package/console/dashboard/__next.dashboard.__PAGE__.txt +6 -0
  305. package/console/dashboard/__next.dashboard.txt +5 -0
  306. package/console/dashboard.html +1 -0
  307. package/console/dashboard.txt +32 -0
  308. package/console/embed.js +1 -0
  309. package/console/executions/__placeholder__/__next._full.txt +32 -0
  310. package/console/executions/__placeholder__/__next._head.txt +6 -0
  311. package/console/executions/__placeholder__/__next._index.txt +17 -0
  312. package/console/executions/__placeholder__/__next._tree.txt +5 -0
  313. package/console/executions/__placeholder__/__next.executions.$d$id.__PAGE__.txt +5 -0
  314. package/console/executions/__placeholder__/__next.executions.$d$id.txt +5 -0
  315. package/console/executions/__placeholder__/__next.executions.txt +5 -0
  316. package/console/executions/__placeholder__.html +1 -0
  317. package/console/executions/__placeholder__.txt +32 -0
  318. package/console/favicon-dark-16x16.png +0 -0
  319. package/console/favicon-dark-32x32.png +0 -0
  320. package/console/favicon-dark.ico +0 -0
  321. package/console/favicon-dark.svg +11 -0
  322. package/console/favicon-light-16x16.png +0 -0
  323. package/console/favicon-light-32x32.png +0 -0
  324. package/console/favicon-light.ico +0 -0
  325. package/console/favicon-light.svg +11 -0
  326. package/console/favicon.ico +0 -0
  327. package/console/index.html +1 -0
  328. package/console/index.txt +28 -0
  329. package/console/invite/__placeholder__/__next._full.txt +33 -0
  330. package/console/invite/__placeholder__/__next._head.txt +6 -0
  331. package/console/invite/__placeholder__/__next._index.txt +17 -0
  332. package/console/invite/__placeholder__/__next._tree.txt +5 -0
  333. package/console/invite/__placeholder__/__next.invite.$d$token.__PAGE__.txt +6 -0
  334. package/console/invite/__placeholder__/__next.invite.$d$token.txt +5 -0
  335. package/console/invite/__placeholder__/__next.invite.txt +5 -0
  336. package/console/invite/__placeholder__.html +1 -0
  337. package/console/invite/__placeholder__.txt +33 -0
  338. package/console/library/__next._full.txt +33 -0
  339. package/console/library/__next._head.txt +6 -0
  340. package/console/library/__next._index.txt +17 -0
  341. package/console/library/__next._tree.txt +5 -0
  342. package/console/library/__next.library.__PAGE__.txt +6 -0
  343. package/console/library/__next.library.txt +7 -0
  344. package/console/library/agents/__next._full.txt +36 -0
  345. package/console/library/agents/__next._head.txt +6 -0
  346. package/console/library/agents/__next._index.txt +17 -0
  347. package/console/library/agents/__next._tree.txt +5 -0
  348. package/console/library/agents/__next.library.agents.__PAGE__.txt +6 -0
  349. package/console/library/agents/__next.library.agents.txt +5 -0
  350. package/console/library/agents/__next.library.txt +7 -0
  351. package/console/library/agents/__placeholder__/__placeholder__/__next._full.txt +39 -0
  352. package/console/library/agents/__placeholder__/__placeholder__/__next._head.txt +6 -0
  353. package/console/library/agents/__placeholder__/__placeholder__/__next._index.txt +17 -0
  354. package/console/library/agents/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  355. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.__PAGE__.txt +6 -0
  356. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.$d$slug.txt +5 -0
  357. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.$d$org.txt +5 -0
  358. package/console/library/agents/__placeholder__/__placeholder__/__next.library.agents.txt +5 -0
  359. package/console/library/agents/__placeholder__/__placeholder__/__next.library.txt +7 -0
  360. package/console/library/agents/__placeholder__/__placeholder__.html +1 -0
  361. package/console/library/agents/__placeholder__/__placeholder__.txt +39 -0
  362. package/console/library/agents/new/__next._full.txt +40 -0
  363. package/console/library/agents/new/__next._head.txt +6 -0
  364. package/console/library/agents/new/__next._index.txt +17 -0
  365. package/console/library/agents/new/__next._tree.txt +5 -0
  366. package/console/library/agents/new/__next.library.agents.new.__PAGE__.txt +9 -0
  367. package/console/library/agents/new/__next.library.agents.new.txt +5 -0
  368. package/console/library/agents/new/__next.library.agents.txt +5 -0
  369. package/console/library/agents/new/__next.library.txt +7 -0
  370. package/console/library/agents/new.html +1 -0
  371. package/console/library/agents/new.txt +40 -0
  372. package/console/library/agents.html +1 -0
  373. package/console/library/agents.txt +36 -0
  374. package/console/library/mcp-servers/__next._full.txt +36 -0
  375. package/console/library/mcp-servers/__next._head.txt +6 -0
  376. package/console/library/mcp-servers/__next._index.txt +17 -0
  377. package/console/library/mcp-servers/__next._tree.txt +5 -0
  378. package/console/library/mcp-servers/__next.library.mcp-servers.__PAGE__.txt +6 -0
  379. package/console/library/mcp-servers/__next.library.mcp-servers.txt +5 -0
  380. package/console/library/mcp-servers/__next.library.txt +7 -0
  381. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._full.txt +39 -0
  382. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._head.txt +6 -0
  383. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._index.txt +17 -0
  384. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  385. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.__PAGE__.txt +6 -0
  386. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.$d$slug.txt +5 -0
  387. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.$d$org.txt +5 -0
  388. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.mcp-servers.txt +5 -0
  389. package/console/library/mcp-servers/__placeholder__/__placeholder__/__next.library.txt +7 -0
  390. package/console/library/mcp-servers/__placeholder__/__placeholder__.html +1 -0
  391. package/console/library/mcp-servers/__placeholder__/__placeholder__.txt +39 -0
  392. package/console/library/mcp-servers/new/__next._full.txt +40 -0
  393. package/console/library/mcp-servers/new/__next._head.txt +6 -0
  394. package/console/library/mcp-servers/new/__next._index.txt +17 -0
  395. package/console/library/mcp-servers/new/__next._tree.txt +5 -0
  396. package/console/library/mcp-servers/new/__next.library.mcp-servers.new.__PAGE__.txt +9 -0
  397. package/console/library/mcp-servers/new/__next.library.mcp-servers.new.txt +5 -0
  398. package/console/library/mcp-servers/new/__next.library.mcp-servers.txt +5 -0
  399. package/console/library/mcp-servers/new/__next.library.txt +7 -0
  400. package/console/library/mcp-servers/new.html +1 -0
  401. package/console/library/mcp-servers/new.txt +40 -0
  402. package/console/library/mcp-servers.html +1 -0
  403. package/console/library/mcp-servers.txt +36 -0
  404. package/console/library/schedules/__next._full.txt +36 -0
  405. package/console/library/schedules/__next._head.txt +6 -0
  406. package/console/library/schedules/__next._index.txt +17 -0
  407. package/console/library/schedules/__next._tree.txt +5 -0
  408. package/console/library/schedules/__next.library.schedules.__PAGE__.txt +6 -0
  409. package/console/library/schedules/__next.library.schedules.txt +5 -0
  410. package/console/library/schedules/__next.library.txt +7 -0
  411. package/console/library/schedules/__placeholder__/__placeholder__/__next._full.txt +39 -0
  412. package/console/library/schedules/__placeholder__/__placeholder__/__next._head.txt +6 -0
  413. package/console/library/schedules/__placeholder__/__placeholder__/__next._index.txt +17 -0
  414. package/console/library/schedules/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  415. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.__PAGE__.txt +6 -0
  416. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.$d$slug.txt +5 -0
  417. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.$d$org.txt +5 -0
  418. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.schedules.txt +5 -0
  419. package/console/library/schedules/__placeholder__/__placeholder__/__next.library.txt +7 -0
  420. package/console/library/schedules/__placeholder__/__placeholder__.html +1 -0
  421. package/console/library/schedules/__placeholder__/__placeholder__.txt +39 -0
  422. package/console/library/schedules/new/__next._full.txt +40 -0
  423. package/console/library/schedules/new/__next._head.txt +6 -0
  424. package/console/library/schedules/new/__next._index.txt +17 -0
  425. package/console/library/schedules/new/__next._tree.txt +5 -0
  426. package/console/library/schedules/new/__next.library.schedules.new.__PAGE__.txt +9 -0
  427. package/console/library/schedules/new/__next.library.schedules.new.txt +5 -0
  428. package/console/library/schedules/new/__next.library.schedules.txt +5 -0
  429. package/console/library/schedules/new/__next.library.txt +7 -0
  430. package/console/library/schedules/new.html +1 -0
  431. package/console/library/schedules/new.txt +40 -0
  432. package/console/library/schedules.html +1 -0
  433. package/console/library/schedules.txt +36 -0
  434. package/console/library/skills/__next._full.txt +36 -0
  435. package/console/library/skills/__next._head.txt +6 -0
  436. package/console/library/skills/__next._index.txt +17 -0
  437. package/console/library/skills/__next._tree.txt +5 -0
  438. package/console/library/skills/__next.library.skills.__PAGE__.txt +6 -0
  439. package/console/library/skills/__next.library.skills.txt +5 -0
  440. package/console/library/skills/__next.library.txt +7 -0
  441. package/console/library/skills/__placeholder__/__placeholder__/__next._full.txt +39 -0
  442. package/console/library/skills/__placeholder__/__placeholder__/__next._head.txt +6 -0
  443. package/console/library/skills/__placeholder__/__placeholder__/__next._index.txt +17 -0
  444. package/console/library/skills/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  445. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.__PAGE__.txt +6 -0
  446. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.$d$slug.txt +5 -0
  447. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.$d$org.txt +5 -0
  448. package/console/library/skills/__placeholder__/__placeholder__/__next.library.skills.txt +5 -0
  449. package/console/library/skills/__placeholder__/__placeholder__/__next.library.txt +7 -0
  450. package/console/library/skills/__placeholder__/__placeholder__.html +1 -0
  451. package/console/library/skills/__placeholder__/__placeholder__.txt +39 -0
  452. package/console/library/skills/new/__next._full.txt +40 -0
  453. package/console/library/skills/new/__next._head.txt +6 -0
  454. package/console/library/skills/new/__next._index.txt +17 -0
  455. package/console/library/skills/new/__next._tree.txt +5 -0
  456. package/console/library/skills/new/__next.library.skills.new.__PAGE__.txt +9 -0
  457. package/console/library/skills/new/__next.library.skills.new.txt +5 -0
  458. package/console/library/skills/new/__next.library.skills.txt +5 -0
  459. package/console/library/skills/new/__next.library.txt +7 -0
  460. package/console/library/skills/new.html +1 -0
  461. package/console/library/skills/new.txt +40 -0
  462. package/console/library/skills.html +1 -0
  463. package/console/library/skills.txt +36 -0
  464. package/console/library/workflows/__next._full.txt +36 -0
  465. package/console/library/workflows/__next._head.txt +6 -0
  466. package/console/library/workflows/__next._index.txt +17 -0
  467. package/console/library/workflows/__next._tree.txt +5 -0
  468. package/console/library/workflows/__next.library.txt +7 -0
  469. package/console/library/workflows/__next.library.workflows.__PAGE__.txt +6 -0
  470. package/console/library/workflows/__next.library.workflows.txt +5 -0
  471. package/console/library/workflows/__placeholder__/__placeholder__/__next._full.txt +39 -0
  472. package/console/library/workflows/__placeholder__/__placeholder__/__next._head.txt +6 -0
  473. package/console/library/workflows/__placeholder__/__placeholder__/__next._index.txt +17 -0
  474. package/console/library/workflows/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  475. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.txt +7 -0
  476. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.__PAGE__.txt +6 -0
  477. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.$d$slug.txt +5 -0
  478. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.$d$org.txt +5 -0
  479. package/console/library/workflows/__placeholder__/__placeholder__/__next.library.workflows.txt +5 -0
  480. package/console/library/workflows/__placeholder__/__placeholder__.html +1 -0
  481. package/console/library/workflows/__placeholder__/__placeholder__.txt +39 -0
  482. package/console/library/workflows/executions/__next._full.txt +37 -0
  483. package/console/library/workflows/executions/__next._head.txt +6 -0
  484. package/console/library/workflows/executions/__next._index.txt +17 -0
  485. package/console/library/workflows/executions/__next._tree.txt +5 -0
  486. package/console/library/workflows/executions/__next.library.txt +7 -0
  487. package/console/library/workflows/executions/__next.library.workflows.executions.__PAGE__.txt +6 -0
  488. package/console/library/workflows/executions/__next.library.workflows.executions.txt +5 -0
  489. package/console/library/workflows/executions/__next.library.workflows.txt +5 -0
  490. package/console/library/workflows/executions.html +1 -0
  491. package/console/library/workflows/executions.txt +37 -0
  492. package/console/library/workflows/new/__next._full.txt +40 -0
  493. package/console/library/workflows/new/__next._head.txt +6 -0
  494. package/console/library/workflows/new/__next._index.txt +17 -0
  495. package/console/library/workflows/new/__next._tree.txt +5 -0
  496. package/console/library/workflows/new/__next.library.txt +7 -0
  497. package/console/library/workflows/new/__next.library.workflows.new.__PAGE__.txt +9 -0
  498. package/console/library/workflows/new/__next.library.workflows.new.txt +5 -0
  499. package/console/library/workflows/new/__next.library.workflows.txt +5 -0
  500. package/console/library/workflows/new.html +1 -0
  501. package/console/library/workflows/new.txt +40 -0
  502. package/console/library/workflows.html +1 -0
  503. package/console/library/workflows.txt +36 -0
  504. package/console/library.html +1 -0
  505. package/console/library.txt +33 -0
  506. package/console/login/__next._full.txt +35 -0
  507. package/console/login/__next._head.txt +6 -0
  508. package/console/login/__next._index.txt +17 -0
  509. package/console/login/__next._tree.txt +5 -0
  510. package/console/login/__next.login.__PAGE__.txt +9 -0
  511. package/console/login/__next.login.txt +5 -0
  512. package/console/login.html +1 -0
  513. package/console/login.txt +35 -0
  514. package/console/logo.svg +1 -0
  515. package/console/oauth/slack/callback/__next._full.txt +37 -0
  516. package/console/oauth/slack/callback/__next._head.txt +6 -0
  517. package/console/oauth/slack/callback/__next._index.txt +17 -0
  518. package/console/oauth/slack/callback/__next._tree.txt +5 -0
  519. package/console/oauth/slack/callback/__next.oauth.slack.callback.__PAGE__.txt +9 -0
  520. package/console/oauth/slack/callback/__next.oauth.slack.callback.txt +5 -0
  521. package/console/oauth/slack/callback/__next.oauth.slack.txt +5 -0
  522. package/console/oauth/slack/callback/__next.oauth.txt +5 -0
  523. package/console/oauth/slack/callback.html +1 -0
  524. package/console/oauth/slack/callback.txt +37 -0
  525. package/console/sessions/__placeholder__/__next._full.txt +32 -0
  526. package/console/sessions/__placeholder__/__next._head.txt +6 -0
  527. package/console/sessions/__placeholder__/__next._index.txt +17 -0
  528. package/console/sessions/__placeholder__/__next._tree.txt +5 -0
  529. package/console/sessions/__placeholder__/__next.sessions.$d$id.__PAGE__.txt +5 -0
  530. package/console/sessions/__placeholder__/__next.sessions.$d$id.txt +5 -0
  531. package/console/sessions/__placeholder__/__next.sessions.txt +5 -0
  532. package/console/sessions/__placeholder__.html +1 -0
  533. package/console/sessions/__placeholder__.txt +32 -0
  534. package/console/settings/__next._full.txt +35 -0
  535. package/console/settings/__next._head.txt +6 -0
  536. package/console/settings/__next._index.txt +17 -0
  537. package/console/settings/__next._tree.txt +5 -0
  538. package/console/settings/__next.settings.__PAGE__.txt +9 -0
  539. package/console/settings/__next.settings.txt +6 -0
  540. package/console/settings/account-preferences/__next._full.txt +35 -0
  541. package/console/settings/account-preferences/__next._head.txt +6 -0
  542. package/console/settings/account-preferences/__next._index.txt +17 -0
  543. package/console/settings/account-preferences/__next._tree.txt +5 -0
  544. package/console/settings/account-preferences/__next.settings.account-preferences.__PAGE__.txt +6 -0
  545. package/console/settings/account-preferences/__next.settings.account-preferences.txt +5 -0
  546. package/console/settings/account-preferences/__next.settings.txt +6 -0
  547. package/console/settings/account-preferences.html +1 -0
  548. package/console/settings/account-preferences.txt +35 -0
  549. package/console/settings/api-keys/__next._full.txt +35 -0
  550. package/console/settings/api-keys/__next._head.txt +6 -0
  551. package/console/settings/api-keys/__next._index.txt +17 -0
  552. package/console/settings/api-keys/__next._tree.txt +5 -0
  553. package/console/settings/api-keys/__next.settings.api-keys.__PAGE__.txt +6 -0
  554. package/console/settings/api-keys/__next.settings.api-keys.txt +5 -0
  555. package/console/settings/api-keys/__next.settings.txt +6 -0
  556. package/console/settings/api-keys.html +1 -0
  557. package/console/settings/api-keys.txt +35 -0
  558. package/console/settings/billing/__next._full.txt +38 -0
  559. package/console/settings/billing/__next._head.txt +6 -0
  560. package/console/settings/billing/__next._index.txt +17 -0
  561. package/console/settings/billing/__next._tree.txt +5 -0
  562. package/console/settings/billing/__next.settings.billing.__PAGE__.txt +9 -0
  563. package/console/settings/billing/__next.settings.billing.txt +5 -0
  564. package/console/settings/billing/__next.settings.txt +6 -0
  565. package/console/settings/billing.html +1 -0
  566. package/console/settings/billing.txt +38 -0
  567. package/console/settings/channel-apps/__next._full.txt +35 -0
  568. package/console/settings/channel-apps/__next._head.txt +6 -0
  569. package/console/settings/channel-apps/__next._index.txt +17 -0
  570. package/console/settings/channel-apps/__next._tree.txt +5 -0
  571. package/console/settings/channel-apps/__next.settings.channel-apps.__PAGE__.txt +6 -0
  572. package/console/settings/channel-apps/__next.settings.channel-apps.txt +5 -0
  573. package/console/settings/channel-apps/__next.settings.txt +6 -0
  574. package/console/settings/channel-apps.html +1 -0
  575. package/console/settings/channel-apps.txt +35 -0
  576. package/console/settings/cursor-accounts/__next._full.txt +38 -0
  577. package/console/settings/cursor-accounts/__next._head.txt +6 -0
  578. package/console/settings/cursor-accounts/__next._index.txt +17 -0
  579. package/console/settings/cursor-accounts/__next._tree.txt +5 -0
  580. package/console/settings/cursor-accounts/__next.settings.cursor-accounts.__PAGE__.txt +9 -0
  581. package/console/settings/cursor-accounts/__next.settings.cursor-accounts.txt +5 -0
  582. package/console/settings/cursor-accounts/__next.settings.txt +6 -0
  583. package/console/settings/cursor-accounts.html +1 -0
  584. package/console/settings/cursor-accounts.txt +38 -0
  585. package/console/settings/environments/__next._full.txt +35 -0
  586. package/console/settings/environments/__next._head.txt +6 -0
  587. package/console/settings/environments/__next._index.txt +17 -0
  588. package/console/settings/environments/__next._tree.txt +5 -0
  589. package/console/settings/environments/__next.settings.environments.__PAGE__.txt +6 -0
  590. package/console/settings/environments/__next.settings.environments.txt +5 -0
  591. package/console/settings/environments/__next.settings.txt +6 -0
  592. package/console/settings/environments.html +1 -0
  593. package/console/settings/environments.txt +35 -0
  594. package/console/settings/identity-providers/__next._full.txt +35 -0
  595. package/console/settings/identity-providers/__next._head.txt +6 -0
  596. package/console/settings/identity-providers/__next._index.txt +17 -0
  597. package/console/settings/identity-providers/__next._tree.txt +5 -0
  598. package/console/settings/identity-providers/__next.settings.identity-providers.__PAGE__.txt +6 -0
  599. package/console/settings/identity-providers/__next.settings.identity-providers.txt +5 -0
  600. package/console/settings/identity-providers/__next.settings.txt +6 -0
  601. package/console/settings/identity-providers.html +1 -0
  602. package/console/settings/identity-providers.txt +35 -0
  603. package/console/settings/invitations/__next._full.txt +35 -0
  604. package/console/settings/invitations/__next._head.txt +6 -0
  605. package/console/settings/invitations/__next._index.txt +17 -0
  606. package/console/settings/invitations/__next._tree.txt +5 -0
  607. package/console/settings/invitations/__next.settings.invitations.__PAGE__.txt +6 -0
  608. package/console/settings/invitations/__next.settings.invitations.txt +5 -0
  609. package/console/settings/invitations/__next.settings.txt +6 -0
  610. package/console/settings/invitations.html +1 -0
  611. package/console/settings/invitations.txt +35 -0
  612. package/console/settings/members/__next._full.txt +35 -0
  613. package/console/settings/members/__next._head.txt +6 -0
  614. package/console/settings/members/__next._index.txt +17 -0
  615. package/console/settings/members/__next._tree.txt +5 -0
  616. package/console/settings/members/__next.settings.members.__PAGE__.txt +6 -0
  617. package/console/settings/members/__next.settings.members.txt +5 -0
  618. package/console/settings/members/__next.settings.txt +6 -0
  619. package/console/settings/members.html +1 -0
  620. package/console/settings/members.txt +35 -0
  621. package/console/settings/memory/__next._full.txt +35 -0
  622. package/console/settings/memory/__next._head.txt +6 -0
  623. package/console/settings/memory/__next._index.txt +17 -0
  624. package/console/settings/memory/__next._tree.txt +5 -0
  625. package/console/settings/memory/__next.settings.memory.__PAGE__.txt +6 -0
  626. package/console/settings/memory/__next.settings.memory.txt +5 -0
  627. package/console/settings/memory/__next.settings.txt +6 -0
  628. package/console/settings/memory.html +1 -0
  629. package/console/settings/memory.txt +35 -0
  630. package/console/settings/oauth-apps/__next._full.txt +35 -0
  631. package/console/settings/oauth-apps/__next._head.txt +6 -0
  632. package/console/settings/oauth-apps/__next._index.txt +17 -0
  633. package/console/settings/oauth-apps/__next._tree.txt +5 -0
  634. package/console/settings/oauth-apps/__next.settings.oauth-apps.__PAGE__.txt +6 -0
  635. package/console/settings/oauth-apps/__next.settings.oauth-apps.txt +5 -0
  636. package/console/settings/oauth-apps/__next.settings.txt +6 -0
  637. package/console/settings/oauth-apps.html +1 -0
  638. package/console/settings/oauth-apps.txt +35 -0
  639. package/console/settings/org-preferences/__next._full.txt +35 -0
  640. package/console/settings/org-preferences/__next._head.txt +6 -0
  641. package/console/settings/org-preferences/__next._index.txt +17 -0
  642. package/console/settings/org-preferences/__next._tree.txt +5 -0
  643. package/console/settings/org-preferences/__next.settings.org-preferences.__PAGE__.txt +6 -0
  644. package/console/settings/org-preferences/__next.settings.org-preferences.txt +5 -0
  645. package/console/settings/org-preferences/__next.settings.txt +6 -0
  646. package/console/settings/org-preferences.html +1 -0
  647. package/console/settings/org-preferences.txt +35 -0
  648. package/console/settings/org-profile/__next._full.txt +35 -0
  649. package/console/settings/org-profile/__next._head.txt +6 -0
  650. package/console/settings/org-profile/__next._index.txt +17 -0
  651. package/console/settings/org-profile/__next._tree.txt +5 -0
  652. package/console/settings/org-profile/__next.settings.org-profile.__PAGE__.txt +6 -0
  653. package/console/settings/org-profile/__next.settings.org-profile.txt +5 -0
  654. package/console/settings/org-profile/__next.settings.txt +6 -0
  655. package/console/settings/org-profile.html +1 -0
  656. package/console/settings/org-profile.txt +35 -0
  657. package/console/settings/platform-clients/__next._full.txt +35 -0
  658. package/console/settings/platform-clients/__next._head.txt +6 -0
  659. package/console/settings/platform-clients/__next._index.txt +17 -0
  660. package/console/settings/platform-clients/__next._tree.txt +5 -0
  661. package/console/settings/platform-clients/__next.settings.platform-clients.__PAGE__.txt +6 -0
  662. package/console/settings/platform-clients/__next.settings.platform-clients.txt +5 -0
  663. package/console/settings/platform-clients/__next.settings.txt +6 -0
  664. package/console/settings/platform-clients.html +1 -0
  665. package/console/settings/platform-clients.txt +35 -0
  666. package/console/settings/pricing-governance/__next._full.txt +38 -0
  667. package/console/settings/pricing-governance/__next._head.txt +6 -0
  668. package/console/settings/pricing-governance/__next._index.txt +17 -0
  669. package/console/settings/pricing-governance/__next._tree.txt +5 -0
  670. package/console/settings/pricing-governance/__next.settings.pricing-governance.__PAGE__.txt +9 -0
  671. package/console/settings/pricing-governance/__next.settings.pricing-governance.txt +5 -0
  672. package/console/settings/pricing-governance/__next.settings.txt +6 -0
  673. package/console/settings/pricing-governance.html +1 -0
  674. package/console/settings/pricing-governance.txt +38 -0
  675. package/console/settings/provider-standing/__next._full.txt +38 -0
  676. package/console/settings/provider-standing/__next._head.txt +6 -0
  677. package/console/settings/provider-standing/__next._index.txt +17 -0
  678. package/console/settings/provider-standing/__next._tree.txt +5 -0
  679. package/console/settings/provider-standing/__next.settings.provider-standing.__PAGE__.txt +9 -0
  680. package/console/settings/provider-standing/__next.settings.provider-standing.txt +5 -0
  681. package/console/settings/provider-standing/__next.settings.txt +6 -0
  682. package/console/settings/provider-standing.html +1 -0
  683. package/console/settings/provider-standing.txt +38 -0
  684. package/console/settings/usage/__next._full.txt +35 -0
  685. package/console/settings/usage/__next._head.txt +6 -0
  686. package/console/settings/usage/__next._index.txt +17 -0
  687. package/console/settings/usage/__next._tree.txt +5 -0
  688. package/console/settings/usage/__next.settings.txt +6 -0
  689. package/console/settings/usage/__next.settings.usage.__PAGE__.txt +6 -0
  690. package/console/settings/usage/__next.settings.usage.txt +5 -0
  691. package/console/settings/usage.html +1 -0
  692. package/console/settings/usage.txt +35 -0
  693. package/console/settings.html +1 -0
  694. package/console/settings.txt +35 -0
  695. package/console/workflows/__next._full.txt +32 -0
  696. package/console/workflows/__next._head.txt +6 -0
  697. package/console/workflows/__next._index.txt +17 -0
  698. package/console/workflows/__next._tree.txt +5 -0
  699. package/console/workflows/__next.workflows.__PAGE__.txt +6 -0
  700. package/console/workflows/__next.workflows.txt +5 -0
  701. package/console/workflows/__placeholder__/__placeholder__/__next._full.txt +35 -0
  702. package/console/workflows/__placeholder__/__placeholder__/__next._head.txt +6 -0
  703. package/console/workflows/__placeholder__/__placeholder__/__next._index.txt +17 -0
  704. package/console/workflows/__placeholder__/__placeholder__/__next._tree.txt +5 -0
  705. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.__PAGE__.txt +6 -0
  706. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.$d$slug.txt +5 -0
  707. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.$d$org.txt +5 -0
  708. package/console/workflows/__placeholder__/__placeholder__/__next.workflows.txt +5 -0
  709. package/console/workflows/__placeholder__/__placeholder__.html +1 -0
  710. package/console/workflows/__placeholder__/__placeholder__.txt +35 -0
  711. package/console/workflows/executions/__next._full.txt +33 -0
  712. package/console/workflows/executions/__next._head.txt +6 -0
  713. package/console/workflows/executions/__next._index.txt +17 -0
  714. package/console/workflows/executions/__next._tree.txt +5 -0
  715. package/console/workflows/executions/__next.workflows.executions.__PAGE__.txt +6 -0
  716. package/console/workflows/executions/__next.workflows.executions.txt +5 -0
  717. package/console/workflows/executions/__next.workflows.txt +5 -0
  718. package/console/workflows/executions/__placeholder__/__next._full.txt +34 -0
  719. package/console/workflows/executions/__placeholder__/__next._head.txt +6 -0
  720. package/console/workflows/executions/__placeholder__/__next._index.txt +17 -0
  721. package/console/workflows/executions/__placeholder__/__next._tree.txt +5 -0
  722. package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.__PAGE__.txt +6 -0
  723. package/console/workflows/executions/__placeholder__/__next.workflows.executions.$d$id.txt +5 -0
  724. package/console/workflows/executions/__placeholder__/__next.workflows.executions.txt +5 -0
  725. package/console/workflows/executions/__placeholder__/__next.workflows.txt +5 -0
  726. package/console/workflows/executions/__placeholder__.html +1 -0
  727. package/console/workflows/executions/__placeholder__.txt +34 -0
  728. package/console/workflows/executions.html +1 -0
  729. package/console/workflows/executions.txt +33 -0
  730. package/console/workflows.html +1 -0
  731. package/console/workflows.txt +32 -0
  732. package/main.js +1138 -0
  733. package/mappings.wasm +0 -0
  734. package/package.json +25 -0
  735. package/workflow-bundle-agent-execution.js +31729 -0
  736. package/workflow-bundle-schedule.js +11315 -0
  737. package/workflow-bundle-workflow-execution.js +29297 -0
  738. package/workflow-worker-thread.cjs +111 -0
@@ -0,0 +1,18 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,63353,e=>{"use strict";var t=e.i(843476),s=e.i(271645),n=e.i(618566),r=e.i(846696),a=e.i(862749),i=e.i(465261),l=e.i(385663),o=e.i(686311),g=e.i(541071),d=e.i(475254);let c=(0,d.default)("share-2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);var u=e.i(649582),m=e.i(727612),h=e.i(893976),x=e.i(610595),p=e.i(153333),f=e.i(170255),b=e.i(484763),v=e.i(845132),j=e.i(65642),y=e.i(311015),k=e.i(934197),N=e.i(699187),C=e.i(981922),w=e.i(10337),S=e.i(966205),A=e.i(616629),R=e.i(597744),M=e.i(630983),E=e.i(364802),T=e.i(17616),I=e.i(284614),L=e.i(37727),$=e.i(468806),O=e.i(869803),D=e.i(361353),z=e.i(526025),P=e.i(891287),B=e.i(577817),U=e.i(586108),W=e.i(583093);function _({open:e,onOpenChange:n,channel:r,sessionHref:a,modal:i=!0}){let l=(0,s.useId)(),o=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:i,width:"lg","aria-labelledby":l,children:e&&(0,t.jsx)(F,{titleId:l,channel:r,sessionHref:a,onClose:o})})}function F({titleId:e,channel:s,sessionHref:n,onClose:r}){let a=s.metadata?.name||s.metadata?.slug||"this channel",{sessions:i,isLoading:l,error:g}=function(e){let t=(0,U.useStigmer)(),s=e?async()=>(await t.session.listByChannel((0,P.create)(B.ListSessionsByChannelRequestSchema,{channelId:e}))).entries:null,{data:n,isLoading:r,isRefetching:a,error:i,refetch:l}=(0,W.useFetch)(s,[e,t],[]);return{sessions:n,isLoading:r,isRefetching:a,error:i,refetch:l}}(s.metadata?.id??"");return(0,t.jsxs)("div",{className:"stg:flex stg:max-h-[70vh] stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3 stg:border-b stg:border-border stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("h2",{id:e,className:"stg:text-sm stg:font-semibold stg:text-popover-foreground",children:"Sessions"}),(0,t.jsxs)("p",{className:"stg:mt-0.5 stg:truncate stg:text-xs stg:text-muted-foreground",children:["The sessions ",a,"created — read-only, visible to the channel's owner and org admins."]})]}),(0,t.jsx)(j.Button,{variant:"ghost",size:"xs",onClick:r,"aria-label":"Close sessions",children:(0,t.jsx)(L.X,{className:"stg:size-4"})})]}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:p-3",children:l?(0,t.jsx)(V,{}):g?(0,t.jsx)("p",{className:"stg:px-2 stg:py-6 stg:text-center stg:text-sm stg:text-destructive",children:(0,x.getUserMessage)(g)}):0===i.length?(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(o.MessageSquare,{className:"stg:size-8"}),title:"No sessions yet",description:"When someone messages this channel, the sessions serving them appear here."}):(0,t.jsx)("ul",{className:(0,h.cn)(O.UNSTYLED_LIST,"stg:space-y-1"),children:i.map(e=>(0,t.jsx)(H,{session:e,href:n&&e.metadata?.id?n(e.metadata.id):void 0},e.metadata?.id))})})]})}function H({session:e,href:s}){var n;let r,a=e.spec?.subject||"Untitled session",i=(0,z.channelSessionExternalUserKey)(e),l=(n=e,(r=n.status?.audit?.statusAudit?.updatedAt??n.status?.audit?.specAudit?.createdAt)?(0,T.timestampDate)(r):null),o=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)(E.TruncatedText,{text:a,className:"stg:block stg:text-sm stg:text-foreground"}),i&&(0,t.jsxs)("p",{className:"stg:mt-0.5 stg:flex stg:items-center stg:gap-1 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)(I.User,{"aria-hidden":"true",className:"stg:size-3"}),i]})]}),l&&(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground-faint",children:(0,D.formatRelativeTime)(l)})]}),g="stg:flex stg:items-center stg:gap-3 stg:rounded-md stg:px-2 stg:py-2 stg:text-left";return(0,t.jsx)("li",{children:s?(0,t.jsx)("a",{href:s,className:(0,h.cn)(g,"stg:hover:bg-accent stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:o}):(0,t.jsx)("div",{className:g,children:o})})}function V(){return(0,t.jsx)("div",{className:"stg:space-y-1 stg:p-1",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}var q=e.i(302933),Y=e.i(373351);let K={status:"na"},G={status:"needs-credentials"};function X(e,t){let n=(0,U.useStigmer)(),[r,a]=(0,s.useState)(K),i=(0,s.useMemo)(()=>t.map(e=>`${e.org}/${e.slug}`).join(","),[t]),l=e&&""!==i;return((0,s.useEffect)(()=>{if(!l)return void a(K);let e=!1;return a({status:"checking"}),(async()=>{let e=[];for(let t of i.split(",")){let[s,r]=t.split("/");try{let a=await n.environment.getByReference({org:s,slug:r});a.metadata?.visibility!==q.ApiResourceVisibility.visibility_org&&e.push(t)}catch{e.push(t)}}return 0===e.length?{status:"ready"}:{status:"blocked",privateEnvironments:e}})().then(t=>{e||a(t)},()=>{e||a(K)}),()=>{e=!0}},[l,i,n]),e)?""===i?G:r:K}function J(e,t,s){let n=(0,R.useDeploymentMode)(),r=(e.spec?.mcpServerUsages?.length??0)>0;return X(t&&"cloud"===n&&r,s)}function Z({agent:e,org:n,value:r,onChange:a,disabled:i=!1,enabled:l=!0}){let o=(0,s.useCallback)(e=>e.metadata?.visibility===q.ApiResourceVisibility.visibility_org,[]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-2",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Environments whose values workspace conversations can use — bind one holding the credentials this agent's tools need (a read-only token is safest). Only environments shared with your organization can be bound; share one first in Settings → Environments. Secret values stay hidden from workspace members either way."}),(0,t.jsx)(Y.EnvironmentPicker,{org:n,value:r,onChange:a,disabled:i,filterEnvironment:o}),(0,t.jsx)(Q,{agent:e,enabled:l,value:r})]})}function Q({agent:e,enabled:s,value:n}){let r=J(e,s,n);if("needs-credentials"===r.status)return(0,t.jsx)("p",{className:"stg:text-xs stg:text-warning",role:"status",children:"Workspace conversations can't use this agent's tools yet: no credentials are bound to this channel. Bind an org-shared environment above."});if("blocked"!==r.status)return null;let a=r.privateEnvironments.join(", "),i=r.privateEnvironments.length>1;return(0,t.jsxs)("p",{className:"stg:text-xs stg:text-warning",role:"status",children:["Workspace conversations can't use this agent's tools yet: the environment",i?"s":""," ",(0,t.jsx)("span",{className:"stg:font-medium",children:a})," ",i?"are":"is"," private. Share ",i?"them":"it","with your organization (Settings → Environments) so channel conversations can use the credentials. Secret values stay hidden either way."]})}var ee=e.i(326283);function et(e){let t=e.metadata,s=e.spec,n=t?.labels??{},r=s?.environmentRefs??[];return{name:t?.name??"",...t?.slug?{slug:t.slug}:{},org:t?.org??"",...Object.keys(n).length>0?{labels:{...n}}:{},...t?.visibility?{visibility:t.visibility}:{},agentRef:{org:s?.agentRef?.org??"",slug:s?.agentRef?.slug??""},enabled:s?.enabled??!1,...s?.providerConfig?.case==="slack"?{slack:{}}:{},...s?.providerConfig?.case==="whatsapp"?{whatsapp:{phoneNumberId:s.providerConfig.value.phoneNumberId}}:{},...s?.appRef?.slug?{appRef:{org:s.appRef.org,slug:s.appRef.slug}}:{},...r.length>0?{environmentRefs:r.map(e=>({org:e.org,slug:e.slug}))}:{},...s?.runConfig?{runConfig:{modelName:s.runConfig.modelName,maxCostUsd:s.runConfig.maxCostUsd,maxToolRounds:s.runConfig.maxToolRounds,serviceTier:s.runConfig.serviceTier,thinkingMode:s.runConfig.thinkingMode}}:{}}}function es(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{save:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentChannel.apply(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isPending:t,error:r,clearError:i}}function en({open:e,onOpenChange:n,agent:r,channel:a,onSaved:i,modal:l=!0}){let o=(0,s.useId)(),g=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:l,width:"md","aria-labelledby":o,children:e&&(0,t.jsx)(er,{agent:r,channel:a,onSaved:i,onClose:g,titleId:o})})}function er({agent:e,channel:n,onSaved:r,onClose:a,titleId:i}){let l=n.metadata?.name||n.metadata?.slug||"this channel",o=n.metadata?.org??"",{save:g,isPending:d,error:c,clearError:u}=es(),[m,p]=(0,s.useState)(()=>(n.spec?.environmentRefs??[]).map(e=>({org:e.org,slug:e.slug}))),f=(0,s.useCallback)(async()=>{try{await g({...et(n),environmentRefs:[...m]}),r?.(),a()}catch{}},[n,m,a,r,g]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3 stg:border-b stg:border-border stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("h2",{id:i,className:"stg:text-sm stg:font-semibold stg:text-foreground",children:"Tool credentials"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:truncate stg:text-xs stg:text-muted-foreground",children:l})]}),(0,t.jsx)("button",{type:"button",onClick:a,"aria-label":"Close dialog",className:(0,h.cn)("stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(ea,{})})]}),(0,t.jsxs)("div",{className:"stg:px-5 stg:py-4",children:[(0,t.jsx)(Z,{agent:e,org:o,value:m,onChange:p,disabled:d,enabled:n.spec?.enabled??!1}),c&&(0,t.jsx)("div",{role:"alert",className:"stg:mt-3 stg:rounded-md stg:border stg:border-destructive/30 stg:bg-destructive-subtle stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",children:(0,x.getUserMessage)(c)})]}),(0,t.jsxs)("div",{className:"stg:flex stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-5 stg:py-3",children:[(0,t.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:()=>{u(),a()},disabled:d,children:"Cancel"}),(0,t.jsx)(j.Button,{variant:"primary",size:"sm",onClick:()=>void f(),disabled:d,children:"Save"})]})]})}function ea(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m3 3 8 8M11 3l-8 8"})})}var ei=e.i(216386),el=e.i(444857),eo=e.i(766817);function eg({open:e,onOpenChange:n,channel:r,onSaved:a,modal:i=!0}){let l=(0,s.useId)(),o=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:i,width:"md","aria-labelledby":l,children:e&&(0,t.jsx)(ed,{channel:r,onSaved:a,onClose:o,titleId:l})})}function ed({channel:e,onSaved:n,onClose:r,titleId:a}){let i=e.metadata?.name||e.metadata?.slug||"this channel",l=e.spec?.runConfig,{save:o,isPending:g,error:d,clearError:c}=es(),[u,m]=(0,s.useState)(l?.modelName??""),[p,f]=(0,s.useState)("cursor"),[b,v]=(0,s.useState)((0,el.fromProtoServiceTier)(l?.serviceTier)??"standard"),[y,k]=(0,s.useState)((0,eo.fromProtoThinkingMode)(l?.thinkingMode)??"disabled"),[N,C]=(0,s.useState)(l&&l.maxCostUsd>0?String(l.maxCostUsd):""),w=(0,s.useCallback)(async()=>{try{var t,s,a,i,g;let d,c,m;await o({...et(e),runConfig:(t=u,s=N,a=b,i=y,g=l?.maxToolRounds??0,d=t.trim(),c=Number.parseFloat(s),m={},""!==d&&(m.modelName=d),Number.isFinite(c)&&c>0&&(m.maxCostUsd=c),g>0&&(m.maxToolRounds=g),"fast"===a&&""!==d&&(m.serviceTier=(0,el.toProtoServiceTier)(a)),"enabled"===i&&""!==d&&(m.thinkingMode=(0,eo.toProtoThinkingMode)(i)),Object.keys(m).length>0?m:void 0)}),n?.(),r()}catch{}},[N,e,u,r,n,o,b,l,y]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3 stg:border-b stg:border-border stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("h2",{id:a,className:"stg:text-sm stg:font-semibold stg:text-foreground",children:"Run settings"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:truncate stg:text-xs stg:text-muted-foreground",children:i})]}),(0,t.jsx)("button",{type:"button",onClick:r,"aria-label":"Close dialog",className:(0,h.cn)("stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(eh,{})})]}),(0,t.jsxs)("div",{className:"stg:space-y-4 stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsxs)("span",{className:ec,children:["Model"," ",(0,t.jsx)("span",{className:"stg:font-normal stg:text-muted-foreground",children:"(optional)"})]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsx)(ei.ModelSelector,{value:u,onValueChange:m,initialHarness:p,onHarnessChange:f,serviceTier:b,onServiceTierChange:v,thinkingMode:y,onThinkingModeChange:k,placeholderLabel:"Platform default",disabled:g}),""!==u&&(0,t.jsx)("button",{type:"button",onClick:()=>{m(""),v("standard"),k("disabled")},disabled:g,className:(0,h.cn)("stg:rounded-md stg:px-2 stg:py-1 stg:text-[0.65rem] stg:text-muted-foreground","stg:hover:text-foreground stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Reset to platform default"})]}),(0,t.jsx)("p",{className:eu,children:"Every conversation turn on this channel runs the pinned model. Unpinned, the platform’s default engine and model apply."})]}),(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsxs)("label",{htmlFor:`${a}-budget`,className:ec,children:["Budget per run (USD)"," ",(0,t.jsx)("span",{className:"stg:font-normal stg:text-muted-foreground",children:"(optional)"})]}),(0,t.jsx)("input",{id:`${a}-budget`,type:"number",min:"0",step:"0.5",inputMode:"decimal",value:N,onChange:e=>C(e.target.value),placeholder:"Platform default",disabled:g,className:(0,h.cn)(em,"stg:max-w-40")}),(0,t.jsx)("p",{className:eu,children:"Caps each turn’s estimated spend. The platform profile bounds this value; the lower cap wins."})]}),d&&(0,t.jsx)("div",{role:"alert",className:"stg:rounded-md stg:border stg:border-destructive/30 stg:bg-destructive-subtle stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",children:(0,x.getUserMessage)(d)})]}),(0,t.jsxs)("div",{className:"stg:flex stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-5 stg:py-3",children:[(0,t.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:()=>{c(),r()},disabled:g,children:"Cancel"}),(0,t.jsx)(j.Button,{variant:"primary",size:"sm",onClick:()=>void w(),disabled:g,children:"Save"})]})]})}let ec="stg:block stg:text-xs stg:font-medium stg:text-foreground",eu="stg:text-[0.65rem] stg:text-muted-foreground",em=(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-1 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50");function eh(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m3 3 8 8M11 3l-8 8"})})}var ex=e.i(778917),ep=e.i(266442);let ef={id:"slack",describeChannel:e=>{let t=e.status?.providerStatus?.case==="slack"?e.status.providerStatus.value:null,s=t?.installedAt?(0,T.timestampDate)(t.installedAt):null;switch(ej(e)){case p.AgentChannelInstallState.installed:return[t?.teamName?`Workspace: ${t.teamName}`:"Workspace connected",s?`since ${ey(s)}`:null].filter(Boolean).join(" · ");case p.AgentChannelInstallState.revoked:return t?.teamName?`The Slack app was removed from ${t.teamName} — reconnect to resume.`:"The Slack app was removed from the workspace — reconnect to resume.";default:return"The Slack install hasn't been completed yet."}},servingLine:e=>e?`Serving app: ${e} (your app) — members @mention ${e}`:"Serving app: Stigmer — members @mention Stigmer",disconnectDescription:e=>`"${e}" stops serving immediately and its stored Slack install (including credentials) is removed. Members of the workspace can no longer reach the agent. To pause without disconnecting, turn the channel off instead.`},eb=[ef,{id:"whatsapp",describeChannel:e=>{let t=e.status?.providerStatus?.case==="whatsapp"?e.status.providerStatus.value:null,s=t?.installedAt?(0,T.timestampDate)(t.installedAt):null;switch(ej(e)){case p.AgentChannelInstallState.installed:{let e=t?.displayPhoneNumber||t?.phoneNumberId||null;return[e?`Number: ${e}`:"Number connected",t?.verifiedName?`(${t.verifiedName})`:null,s?`since ${ey(s)}`:null].filter(Boolean).join(" · ")}case p.AgentChannelInstallState.revoked:return"The WhatsApp connection was revoked — reconnect to resume.";default:return"The WhatsApp connection hasn't been completed yet."}},servingLine:e=>e?`Serving app: ${e} (your Meta app) — people message the connected number`:"Serving app: your Meta app — people message the connected number",disconnectDescription:e=>`"${e}" stops serving immediately and its WhatsApp number binding is removed. People can no longer reach the agent on that number. To pause without disconnecting, turn the channel off instead.`}];function ev(e){return eb.find(t=>t.id===e)??null}function ej(e){return e.status?.installState??p.AgentChannelInstallState.agent_channel_install_state_unspecified}function ey(e){return e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}var ek=e.i(928240),eN=e.i(182990);function eC({open:e,onOpenChange:n,channel:r,onEditYaml:a,modal:i=!0}){let l=(0,s.useId)(),o=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:i,width:"2xl","aria-labelledby":l,children:e&&(0,t.jsx)(ew,{titleId:l,channel:r,onEditYaml:a,onClose:o})})}function ew({titleId:e,channel:s,onEditYaml:n,onClose:r}){let a=s.metadata?.name||s.metadata?.slug||"this channel";return(0,t.jsxs)("div",{className:"stg:flex stg:max-h-[75vh] stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3 stg:border-b stg:border-border stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("h2",{id:e,className:"stg:text-sm stg:font-semibold stg:text-popover-foreground",children:"Templates"}),(0,t.jsxs)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:["The message templates WhatsApp holds for ",a," — authored and approved in WhatsApp Manager, listed here as WhatsApp reports them."]})]}),(0,t.jsx)(j.Button,{variant:"ghost",size:"xs",onClick:r,"aria-label":"Close templates",children:(0,t.jsx)(L.X,{className:"stg:size-4"})})]}),(0,t.jsx)("div",{className:"stg:min-h-0 stg:flex-1 stg:overflow-y-auto stg:p-4",children:(0,t.jsx)(eS,{channel:s,onEditYaml:n})})]})}function eS({channel:e,onEditYaml:s}){let n="cloud"!==(0,R.useDeploymentMode)()?{status:"cloud-only"}:e.status?.installState!==p.AgentChannelInstallState.installed?{status:"not-installed"}:e.spec?.enabled?e.spec.proactiveMessagingEnabled?{status:"ready"}:{status:"not-proactive"}:{status:"channel-off"},r=ev(e.spec?.providerConfig?.case)??ef;switch(n.status){case"cloud-only":return(0,t.jsx)(M.CloudFeatureNotice,{children:"Message templates come from the provider through Stigmer Cloud's channel runtime. Channel configuration still works here, but the template registry can only be read on a cloud deployment."});case"not-installed":return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(l.LayoutTemplate,{className:"stg:size-8"}),title:"Connect this channel first",description:`${r.describeChannel(e)} Templates become readable once the connection is complete.`});case"channel-off":return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(l.LayoutTemplate,{className:"stg:size-8"}),title:"This channel is turned off",description:"Turn the channel on with the switch on its card, then check back here."});case"not-proactive":return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(l.LayoutTemplate,{className:"stg:size-8"}),title:"Business-initiated messaging is not enabled",description:"Templates power messages your agent sends first — reminders, invoices, notifications. To allow them, set proactive_messaging_enabled on this channel's definition.",children:s&&(0,t.jsx)(j.Button,{variant:"primary",onClick:s,children:"Edit channel YAML"})});case"ready":return(0,t.jsx)(eA,{channel:e})}}function eA({channel:e}){let{templates:s,isLoading:n,error:r}=(0,eN.useChannelTemplateList)(e.metadata?.slug??"",e.metadata?.org??"");if(n)return(0,t.jsx)(eI,{});if(r)return(0,t.jsx)("p",{className:"stg:px-2 stg:py-6 stg:text-center stg:text-sm stg:text-destructive",children:(0,x.getUserMessage)(r)});if(0===s.length)return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(l.LayoutTemplate,{className:"stg:size-8"}),title:"No templates found for this channel",description:"Templates are authored in WhatsApp Manager and approved by WhatsApp — Stigmer keeps no copy. Once a template is approved, it appears here and in your agent's repertoire automatically.",children:(0,t.jsx)(eT,{label:"Open WhatsApp Manager"})});let a=s.filter(e=>"APPROVED"===e.status&&""===e.unsupportedReason).length;return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:gap-3 stg:px-1 stg:pb-3",children:[(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:[s.length," ",1===s.length?"template":"templates"," · ",a," ready to send"]}),(0,t.jsx)(eT,{label:"Manage in WhatsApp Manager"})]}),(0,t.jsx)("ul",{className:(0,h.cn)(O.UNSTYLED_LIST,"stg:space-y-2"),children:s.map(e=>(0,t.jsx)(eR,{template:e},`${e.name}\u0000${e.language}`))})]})}function eR({template:e}){return(0,t.jsxs)("li",{className:"stg:rounded-lg stg:border stg:border-border stg:p-3",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:flex-wrap stg:items-center stg:gap-x-2 stg:gap-y-1",children:[(0,t.jsx)(E.TruncatedText,{text:e.name,className:"stg:text-sm stg:font-medium stg:text-foreground"}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground",children:e.language}),e.category&&(0,t.jsx)(eE,{children:e.category}),e.headerFormat&&(0,t.jsxs)(eE,{children:[e.headerFormat," header"]})]}),(0,t.jsx)(ep.StatusBadge,{phase:(0,ek.templateStatusPhase)(e.status),label:e.status,className:"stg:shrink-0"})]}),e.bodyText&&(0,t.jsx)(eM,{body:e.bodyText}),e.rejectionReason&&(0,t.jsxs)("p",{className:"stg:mt-2 stg:text-xs stg:text-destructive",children:["Rejected: ",e.rejectionReason]}),e.unsupportedReason&&(0,t.jsxs)("p",{className:"stg:mt-2 stg:text-xs stg:text-warning",role:"status",children:["Not sendable: ",e.unsupportedReason]})]})}function eM({body:e}){return(0,t.jsx)("p",{className:"stg:mt-2 stg:whitespace-pre-wrap stg:text-xs stg:leading-relaxed stg:text-muted-foreground",children:(0,ek.splitTemplateBody)(e).map((e,s)=>"placeholder"===e.kind?(0,t.jsx)("code",{className:"stg:rounded stg:bg-muted-subtle stg:px-1 stg:font-mono stg:text-foreground",children:e.value},s):(0,t.jsx)("span",{children:e.value},s))})}function eE({children:e}){return(0,t.jsx)("span",{className:"stg:shrink-0 stg:rounded stg:bg-muted-subtle stg:px-1.5 stg:py-0.5 stg:text-xs stg:text-muted-foreground",children:e})}function eT({label:e}){return(0,t.jsxs)("a",{href:"https://business.facebook.com/wa/manage/message-templates/",target:"_blank",rel:"noreferrer noopener",className:(0,h.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-foreground","stg:underline stg:underline-offset-2 stg:hover:text-muted-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[e,(0,t.jsx)(ex.ExternalLink,{"aria-hidden":"true",className:"stg:size-3"})]})}function eI(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:p-1",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-20 stg:animate-pulse stg:rounded-lg stg:bg-muted-faint"},e))})}function eL({org:e,apps:s,value:n,onChange:r,disabled:a,channelAppsHref:i,idPrefix:l,platformOption:o,appHint:g,emptyBody:d}){return 0===s.length?(0,t.jsxs)("section",{"aria-label":"Connect as",children:[(0,t.jsx)("h3",{className:"stg:mb-1.5 stg:text-xs stg:font-medium stg:text-foreground",children:"Connect as"}),d]}):(0,t.jsxs)("fieldset",{className:O.UNSTYLED_FIELDSET,children:[(0,t.jsx)("legend",{className:"stg:mb-1.5 stg:block stg:text-xs stg:font-medium stg:text-foreground",children:"Connect as"}),(0,t.jsxs)("div",{role:"radiogroup",className:"stg:space-y-1.5",children:[o&&(0,t.jsx)(eO,{id:`${l}-platform`,name:l,label:o.label,hint:o.hint,checked:null===n,onSelect:()=>r(null),disabled:a}),s.map(s=>{let i=s.metadata?.slug??"",o=n?.slug===i;return(0,t.jsx)(eO,{id:`${l}-${i}`,name:l,label:s.metadata?.name??i,hint:g,checked:o,onSelect:()=>r({org:e,slug:i}),disabled:a},s.metadata?.id??i)})]}),(0,t.jsxs)("p",{className:"stg:mt-1.5 stg:text-xs stg:text-muted-foreground",children:[(0,t.jsx)(e$,{channelAppsHref:i,children:"Register a channel app"}),"."]})]})}function e$({channelAppsHref:e,children:s}){return e?(0,t.jsx)("a",{href:e,className:(0,h.cn)("stg:font-medium stg:underline stg:underline-offset-2","stg:hover:no-underline","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:s}):(0,t.jsxs)(t.Fragment,{children:[s," under Settings → Channel Apps"]})}function eO({id:e,name:s,label:n,hint:r,checked:a,onSelect:i,disabled:l}){return(0,t.jsxs)("label",{htmlFor:e,className:(0,h.cn)("stg:flex stg:cursor-pointer stg:items-start stg:gap-2 stg:rounded-md stg:border stg:px-2.5 stg:py-1.5",a?"stg:border-ring stg:bg-accent":"stg:border-border stg:hover:bg-accent-hover",l&&"stg:pointer-events-none stg:opacity-50"),children:[(0,t.jsx)("input",{id:e,type:"radio",name:s,checked:a,onChange:i,disabled:l,className:"stg:mt-0.5 stg:accent-current"}),(0,t.jsxs)("span",{className:"stg:min-w-0",children:[(0,t.jsx)("span",{className:"stg:block stg:text-xs stg:font-medium stg:text-foreground",children:n}),(0,t.jsx)("span",{className:"stg:block stg:text-[0.65rem] stg:text-muted-foreground",children:r})]})]})}function eD(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m3 3 8 8M11 3l-8 8"})})}function ez({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m3 8.5 3.5 3.5L13 5"})})}function eP({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 12 12",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4.5 2.5 3.5 3.5-3.5 3.5"})})}function eB({className:e}){return(0,t.jsxs)("svg",{className:(0,h.cn)("stg:animate-spin",e),viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"8",cy:"8",r:"6.5",stroke:"currentColor",strokeOpacity:"0.25",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M14.5 8A6.5 6.5 0 0 0 8 1.5",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})]})}function eU({agent:e,org:n,value:r,onChange:a,disabled:i}){let l=(e.spec?.mcpServerUsages?.length??0)>0,[o,g]=(0,s.useState)(l||r.length>0);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>g(e=>!e),"aria-expanded":o,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(eP,{className:(0,h.cn)("stg:size-3 stg:transition-transform",o&&"stg:rotate-90")}),"Tool credentials"]}),o&&(0,t.jsx)("div",{className:"stg:mt-2",children:(0,t.jsx)(Z,{agent:e,org:n,value:r,onChange:a,disabled:i})})]})}function eW({error:e}){return(0,t.jsx)(e_,{children:(0,x.getUserMessage)(e)})}function e_({children:e}){return(0,t.jsx)("div",{role:"alert",className:"stg:space-y-1 stg:rounded-md stg:border stg:border-destructive/30 stg:bg-destructive-subtle stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",children:e})}var eF=e.i(476487),eH=e.i(903198);function eV(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{createChannel:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentChannel.create(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isPending:t,error:r,clearError:i}}var eq=e.i(815907),eY=e.i(914118);function eK({open:e,onOpenChange:n,agent:r,channel:a,onChannelsChanged:i,modal:l=!0,channelAppsHref:o}){let g=(0,s.useId)(),d=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:l,width:"md","aria-labelledby":g,children:e&&(0,t.jsx)(eG,{agent:r,channel:a??null,onChannelsChanged:i,onClose:d,titleId:g,channelAppsHref:o})})}function eG({agent:e,channel:n,onChannelsChanged:r,onClose:a,channelAppsHref:i,titleId:l}){let o=(0,R.useDeploymentMode)(),g=e.metadata?.name||e.metadata?.slug||"this agent",d=e.metadata?.org??"",{createChannel:c,isPending:u}=eV(),m=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)("idle"),[r,a]=(0,s.useState)(null),i=(0,s.useRef)(null),l=(0,s.useRef)(null),o=(0,s.useRef)(!1);(0,s.useEffect)(()=>()=>{l.current?.()},[]);let g=(0,s.useCallback)(()=>{(l.current||i.current)&&(o.current=!0,l.current?.(),(0,eH.closeOAuthPopup)(i.current),i.current=null,l.current=null),n("idle"),a(null)},[]);return{connect:(0,s.useCallback)(async t=>{n("initiating"),a(null),o.current=!1,l.current?.();let s=(0,eH.openOAuthPopup)();if(!s){let e=(0,eH.popupBlockedError)();throw a(e),n("idle"),e}i.current=s;try{let r=await e.agentChannel.initiateInstall((0,P.create)(eF.InitiateChannelInstallInputSchema,{resourceId:t}));s.location.href=r.authorizationUrl,n("awaiting-callback");let{code:a,state:i}=await (0,eH.waitForOAuthCallback)(s,r.state,e=>{l.current=e});n("completing");let o=await e.agentChannel.completeInstall((0,P.create)(eF.CompleteChannelInstallInputSchema,{resourceId:t,state:i,code:a}));return n("done"),o}catch(t){let e=(0,ee.toError)(t);throw o.current||(a(e),n("idle"),(0,eH.closeOAuthPopup)(s)),o.current=!1,e}finally{i.current=null,l.current=null}},[e]),isInProgress:"idle"!==t&&"done"!==t,phase:t,error:r,clearError:g}}(),[x,f]=(0,s.useState)(()=>n?n.metadata?.name??"":`${g} Slack`),[b,v]=(0,s.useState)([]),[y,k]=(0,s.useState)(null),[C,w]=(0,s.useState)(null),[S,A]=(0,s.useState)(null),{channelApps:E}=(0,N.useChannelAppList)(d||null),T=(0,s.useMemo)(()=>E.filter(e=>e.spec?.providerConfig?.case==="slack"),[E]),I=n?n.spec?.appRef?.slug?{org:n.spec.appRef.org||d,slug:n.spec.appRef.slug}:null:y,L=I?T.find(e=>e.metadata?.slug===I.slug)??null:null,$=I?L?.metadata?.name||I.slug:"Stigmer",O="cloud"===o&&!n&&!C,{channels:D}=(0,eq.useOrgAgentChannelList)(O&&d?d:null),z=(0,s.useMemo)(()=>{let e=I?L?.metadata?.id:"";return void 0===e?[]:D.filter(t=>t.status?.installState===p.AgentChannelInstallState.installed&&t.status?.providerStatus?.case==="slack"&&t.status.providerStatus.value.channelAppId===e)},[D,I,L]),B=(0,s.useCallback)(async()=>{A(null);try{let t=n;t||(t=await c({name:x.trim()||`${g} Slack`,org:d,agentRef:{org:d,slug:e.metadata?.slug??""},enabled:!0,slack:{},...y?{appRef:y}:{},...b.length>0?{environmentRefs:b}:{}}),r?.());let s=await m.connect(t.metadata?.id??"");w(s),r?.()}catch(e){A(m.error??(e instanceof Error?e:Error(String(e))))}},[e,g,y,n,c,b,x,d,r,m]),W=(0,s.useCallback)(()=>{m.clearError(),A(null)},[m]),_=u||m.isInProgress;return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3 stg:border-b stg:border-border stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2.5",children:[(0,t.jsx)(eY.SlackMarkIcon,{className:"stg:size-5 stg:text-foreground"}),(0,t.jsx)("h2",{id:l,className:"stg:text-sm stg:font-semibold stg:text-foreground",children:n?"Reconnect to Slack":"Connect to Slack"})]}),(0,t.jsx)("button",{type:"button",onClick:a,"aria-label":"Close dialog",className:(0,h.cn)("stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(eD,{})})]}),(0,t.jsx)("div",{className:"stg:space-y-4 stg:px-5 stg:py-4",children:"local"===o?(0,t.jsx)(M.CloudFeatureNotice,{children:"Channel installs require Stigmer Cloud. The local backend manages channel configuration, but connecting to Slack uses the platform's hosted Slack app."}):C?(0,t.jsx)(e0,{channel:C,agentName:g,botName:$}):_?(0,t.jsx)(eQ,{phase:m.phase,onCancel:W}):(0,t.jsxs)(t.Fragment,{children:[!n&&(0,t.jsxs)("label",{className:"stg:block",children:[(0,t.jsx)("span",{className:"stg:mb-1.5 stg:block stg:text-xs stg:font-medium stg:text-foreground",children:"Channel name"}),(0,t.jsx)("input",{type:"text",value:x,onChange:e=>f(e.target.value),disabled:_,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-3 stg:py-1.5","stg:text-sm stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring")}),(0,t.jsx)("span",{className:"stg:mt-1 stg:block stg:text-xs stg:text-muted-foreground",children:"Names the connection in Stigmer — pick something that identifies the workspace if you connect more than one."})]}),!n&&(0,t.jsx)(eL,{org:d,apps:T,value:y,onChange:k,disabled:_,channelAppsHref:i,idPrefix:"stgm-slack-app",platformOption:{label:"Stigmer app",hint:"Fastest — no setup, the bot is named Stigmer"},appHint:"Your app — your bot name and icon",emptyBody:(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["The platform"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:"Stigmer"})," ","app — no setup needed. Want the bot to carry your own name and icon, or several agents in one workspace?"," ",(0,t.jsx)(e$,{channelAppsHref:i,children:"Register a channel app"}),"."]})}),z.length>0&&(0,t.jsx)(eJ,{botName:$,channels:z}),!n&&(0,t.jsx)(eU,{agent:e,org:d,value:b,onChange:v,disabled:_}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-muted-foreground",children:"When you continue, Slack asks which workspace to add the bot to — pick the one where your team should chat with this agent."}),(0,t.jsxs)("p",{className:"stg:text-sm stg:text-muted-foreground",children:["Members reach the agent by opening a direct message with"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:$}),", or typing @ in a channel and picking"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:$})," ","from the list — it answers as"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:g}),"."]}),(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["Conversations from Slack are billed to"," ",(0,t.jsx)("span",{className:"stg:font-medium",children:d}),". A workspace can host one agent per Slack app."]}),S&&(0,t.jsx)(eX,{error:S,channelAppsHref:i})]})}),(0,t.jsx)("div",{className:"stg:flex stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-5 stg:py-3",children:C||"local"===o?(0,t.jsx)(j.Button,{variant:"outline",size:"sm",onClick:a,children:C?"Done":"Close"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:a,disabled:_,children:"Cancel"}),(0,t.jsx)(j.Button,{variant:"primary",size:"sm",onClick:()=>void B(),disabled:_,icon:(0,t.jsx)(eY.SlackMarkIcon,{className:"stg:size-3.5"}),"data-cursor-target":"dialog-connect-slack",children:S?"Try again":n?"Reconnect to Slack":"Connect to Slack"})]})})]})}function eX({error:e,channelAppsHref:s}){let n=(0,x.getErrorReason)(e);if(n?.reason!=="SLACK_WORKSPACE_ALREADY_CONNECTED")return(0,t.jsx)(eW,{error:e});let r=n.metadata.team_name||"This workspace";return(0,t.jsxs)(e_,{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"stg:font-medium",children:r})," already hosts an agent through this app — a workspace hosts one agent per Slack app."]}),(0,t.jsxs)("p",{children:["To reach it with this agent, disconnect the existing channel, or"," ",(0,t.jsx)(e$,{channelAppsHref:s,children:"register a channel app"})," ","and connect through that instead."]})]})}function eJ({botName:e,channels:s}){return(0,t.jsx)("div",{role:"status",className:"stg:space-y-0.5 stg:text-xs stg:text-warning",children:s.map(s=>{let n=s.status?.providerStatus?.case==="slack"?s.status.providerStatus.value:null,r=n?.teamName||n?.teamId||"a workspace",a=s.spec?.agentRef?.slug||"another agent";return(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"stg:font-medium",children:e})," already serves"," ",(0,t.jsx)("span",{className:"stg:font-medium",children:r})," via ",a," — a workspace hosts one agent per app, so connect through a different channel app to reach it."]},s.metadata?.id??r)})})}let eZ=[{phase:"initiating",label:"Contacting Slack"},{phase:"awaiting-callback",label:"Waiting for your approval in the Slack window"},{phase:"completing",label:"Finalizing the connection"}];function eQ({phase:e,onCancel:s}){let n=eZ.findIndex(t=>t.phase===e);return(0,t.jsxs)("div",{className:"stg:space-y-3","aria-live":"polite",children:[(0,t.jsx)("ul",{className:(0,h.cn)(O.UNSTYLED_LIST,"stg:space-y-2"),children:eZ.map((e,s)=>{let r=s===n,a=n>s;return(0,t.jsxs)("li",{className:(0,h.cn)("stg:flex stg:items-center stg:gap-2 stg:text-sm",r?"stg:text-foreground":a?"stg:text-muted-foreground":"stg:text-muted-foreground-subtle"),children:[a?(0,t.jsx)(ez,{className:"stg:size-3.5 stg:shrink-0 stg:text-success"}):r?(0,t.jsx)(eB,{className:"stg:size-3.5 stg:shrink-0"}):(0,t.jsx)("span",{className:"stg:size-3.5 stg:shrink-0 stg:rounded-full stg:border stg:border-border","aria-hidden":"true"}),e.label]},e.phase)})}),(0,t.jsx)(j.Button,{variant:"ghost",size:"xs",onClick:s,children:"Cancel"})]})}function e0({channel:e,agentName:s,botName:n}){let r=e.status?.providerStatus?.case==="slack"?e.status.providerStatus.value:null;return(0,t.jsxs)("div",{className:"stg:space-y-2",role:"status",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-sm stg:font-medium stg:text-foreground",children:[(0,t.jsx)(ez,{className:"stg:size-4 stg:text-success"}),"Connected",r?.teamName?` to ${r.teamName}`:""]}),(0,t.jsxs)("p",{className:"stg:text-sm stg:text-muted-foreground",children:["In Slack, open a direct message with"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:n})," — or type @ in any channel and pick"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:n})," from the list — then ask your question. Answers come from"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:s}),"."]})]})}var e1=e.i(582688);function e2({open:e,onOpenChange:n,agent:r,channel:a,onChannelsChanged:i,modal:l=!0,channelAppsHref:o}){let g=(0,s.useId)(),d=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:l,width:"md","aria-labelledby":g,children:e&&(0,t.jsx)(e5,{agent:r,channel:a??null,onChannelsChanged:i,onClose:d,channelAppsHref:o,titleId:g})})}function e5({agent:e,channel:n,onChannelsChanged:r,onClose:a,channelAppsHref:i,titleId:l}){let o=(0,U.useStigmer)(),g=(0,R.useDeploymentMode)(),d=e.metadata?.name||e.metadata?.slug||"this agent",c=e.metadata?.org??"",{createChannel:u,isPending:m}=eV(),{save:x,isPending:f}=es(),b=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)("idle"),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>{n("idle"),a(null)},[]);return{install:(0,s.useCallback)(async t=>{n("installing"),a(null);try{if(!(await e.agentChannel.initiateInstall((0,P.create)(eF.InitiateChannelInstallInputSchema,{resourceId:t}))).completed)throw Error("This channel's provider requires an interactive install — connect it through its provider flow instead.");n("done")}catch(t){let e=(0,ee.toError)(t);throw a(e),n("idle"),e}},[e]),isInProgress:"installing"===t,phase:t,error:r,clearError:i}}(),[v,y]=(0,s.useState)(()=>n?n.metadata?.name??"":`${d} WhatsApp`),[k,C]=(0,s.useState)(()=>n?.spec?.providerConfig?.case==="whatsapp"?n.spec.providerConfig.value.phoneNumberId:""),[w,S]=(0,s.useState)([]),[A,E]=(0,s.useState)(()=>n?.spec?.appRef?.slug?{org:n.spec.appRef.org||c,slug:n.spec.appRef.slug}:null),[T,I]=(0,s.useState)(null),[L,$]=(0,s.useState)(null),{channelApps:O}=(0,N.useChannelAppList)(c||null),D=(0,s.useMemo)(()=>O.filter(e=>e.spec?.providerConfig?.case==="whatsapp"),[O]),z=A??(1===D.length?{org:c,slug:D[0].metadata?.slug??""}:null),B=z?D.find(e=>e.metadata?.slug===z.slug)??null:null,W="cloud"===g&&!T,{channels:_}=(0,eq.useOrgAgentChannelList)(W&&c?c:null),F=k.trim(),H=(0,s.useMemo)(()=>{let e=B?.metadata?.id;return e&&F?_.filter(t=>t.metadata?.id!==n?.metadata?.id&&t.status?.installState===p.AgentChannelInstallState.installed&&t.status?.providerStatus?.case==="whatsapp"&&t.status.providerStatus.value.phoneNumberId===F&&t.status.providerStatus.value.channelAppId===e):[]},[_,B,F,n]),V=(0,s.useCallback)(async()=>{$(null);try{let t=n;if(t){let e=t.spec?.providerConfig?.case==="whatsapp"?t.spec.providerConfig.value.phoneNumberId:"",s=t.spec?.appRef?.slug??"";(e!==F||s!==(z?.slug??""))&&(t=await x({...et(t),whatsapp:{phoneNumberId:F},...z?{appRef:z}:{}}),r?.())}else t=await u({name:v.trim()||`${d} WhatsApp`,org:c,agentRef:{org:c,slug:e.metadata?.slug??""},enabled:!0,whatsapp:{phoneNumberId:F},...z?{appRef:z}:{},...w.length>0?{environmentRefs:w}:{}}),r?.();await b.install(t.metadata?.id??"");let s=await o.agentChannel.get(t.metadata?.id??"");I(s),r?.()}catch(e){$(b.error??(e instanceof Error?e:Error(String(e))))}},[e,d,n,u,z,w,b,v,c,r,x,o,F]),q=m||f||b.isInProgress,Y=""!==F&&null!==z&&!q;return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3 stg:border-b stg:border-border stg:px-5 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2.5",children:[(0,t.jsx)(e1.WhatsAppMarkIcon,{className:"stg:size-5 stg:text-foreground"}),(0,t.jsx)("h2",{id:l,className:"stg:text-sm stg:font-semibold stg:text-foreground",children:n?"Reconnect to WhatsApp":"Connect to WhatsApp"})]}),(0,t.jsx)("button",{type:"button",onClick:a,"aria-label":"Close dialog",className:(0,h.cn)("stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(eD,{})})]}),(0,t.jsx)("div",{className:"stg:space-y-4 stg:px-5 stg:py-4",children:"local"===g?(0,t.jsx)(M.CloudFeatureNotice,{children:"Channel installs require Stigmer Cloud. The local backend manages channel configuration, but connecting to WhatsApp verifies your number through Stigmer's hosted webhook infrastructure."}):T?(0,t.jsx)(e8,{channel:T,agentName:d}):q?(0,t.jsx)(e6,{}):(0,t.jsxs)(t.Fragment,{children:[!n&&(0,t.jsxs)("label",{className:"stg:block",children:[(0,t.jsx)("span",{className:"stg:mb-1.5 stg:block stg:text-xs stg:font-medium stg:text-foreground",children:"Channel name"}),(0,t.jsx)("input",{type:"text",value:v,onChange:e=>y(e.target.value),disabled:q,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-3 stg:py-1.5","stg:text-sm stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring")}),(0,t.jsx)("span",{className:"stg:mt-1 stg:block stg:text-xs stg:text-muted-foreground",children:"Names the connection in Stigmer — pick something that identifies the number if you connect more than one."})]}),(0,t.jsxs)("label",{className:"stg:block",children:[(0,t.jsx)("span",{className:"stg:mb-1.5 stg:block stg:text-xs stg:font-medium stg:text-foreground",children:"Phone number ID"}),(0,t.jsx)("input",{type:"text",value:k,onChange:e=>C(e.target.value),disabled:q,required:!0,placeholder:"106540352242922","data-cursor-target":"dialog-whatsapp-number",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-input stg:bg-background stg:px-3 stg:py-1.5","stg:font-mono stg:text-sm stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring")}),(0,t.jsx)("span",{className:"stg:mt-1 stg:block stg:text-xs stg:text-muted-foreground",children:"From Meta's WhatsApp Manager (API Setup) — the numeric ID of the number this agent should answer, not the phone number itself."})]}),(0,t.jsx)(eL,{org:c,apps:D,value:z,onChange:E,disabled:q,channelAppsHref:i,idPrefix:"stgm-whatsapp-app",appHint:"Your Meta app — its credentials verify and serve the number",emptyBody:(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["WhatsApp channels connect through your own Meta app — there is no shared platform app."," ",(0,t.jsx)(e$,{channelAppsHref:i,children:"Register a channel app"})," ","with your Meta app's credentials first, then connect here."]})}),H.length>0&&(0,t.jsx)(e4,{channels:H}),!n&&(0,t.jsx)(eU,{agent:e,org:c,value:w,onChange:S,disabled:q}),(0,t.jsx)("p",{className:"stg:text-sm stg:text-muted-foreground",children:"When you continue, Stigmer verifies the number with WhatsApp through the selected app's credentials — the connection completes right here, with no browser hand-off."}),(0,t.jsxs)("p",{className:"stg:text-sm stg:text-muted-foreground",children:["People reach the agent by sending a WhatsApp message to the connected number — it answers as"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:d}),"."]}),(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["Conversations from WhatsApp are billed to"," ",(0,t.jsx)("span",{className:"stg:font-medium",children:c}),". Each number serves one agent per channel app."]}),L&&(0,t.jsx)(e3,{error:L,channelAppsHref:i})]})}),(0,t.jsx)("div",{className:"stg:flex stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-5 stg:py-3",children:T||"local"===g?(0,t.jsx)(j.Button,{variant:"outline",size:"sm",onClick:a,children:T?"Done":"Close"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(j.Button,{variant:"ghost",size:"sm",onClick:a,disabled:q,children:"Cancel"}),(0,t.jsx)(j.Button,{variant:"primary",size:"sm",onClick:()=>void V(),disabled:!Y,icon:(0,t.jsx)(e1.WhatsAppMarkIcon,{className:"stg:size-3.5"}),"data-cursor-target":"dialog-connect-whatsapp",children:L?"Try again":n?"Reconnect to WhatsApp":"Connect to WhatsApp"})]})})]})}function e3({error:e,channelAppsHref:s}){let n=(0,x.getErrorReason)(e);if(n?.reason!=="WHATSAPP_NUMBER_ALREADY_CONNECTED")return(0,t.jsx)(eW,{error:e});let r=n.metadata.display_phone_number||"This number";return(0,t.jsxs)(e_,{children:[(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"stg:font-medium",children:r})," is already connected to an agent through this channel app — each number serves one agent."]}),(0,t.jsxs)("p",{children:["To reach it with this agent, disconnect the existing channel, use a different number, or"," ",(0,t.jsx)(e$,{channelAppsHref:s,children:"register a channel app"})," ","and connect through that instead."]})]})}function e4({channels:e}){return(0,t.jsx)("div",{role:"status",className:"stg:space-y-0.5 stg:text-xs stg:text-warning",children:e.map(e=>{let s=e.status?.providerStatus?.case==="whatsapp"?e.status.providerStatus.value:null,n=s?.displayPhoneNumber||s?.phoneNumberId||"this number",r=e.spec?.agentRef?.slug||"another agent";return(0,t.jsxs)("p",{children:[(0,t.jsx)("span",{className:"stg:font-medium",children:n})," is already served via ",r," — each number serves one agent per channel app, so disconnect that channel or pick a different number."]},e.metadata?.id??n)})})}function e6(){return(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-sm stg:text-foreground","aria-live":"polite",children:[(0,t.jsx)(eB,{className:"stg:size-3.5 stg:shrink-0"}),"Verifying the number with WhatsApp…"]})}function e8({channel:e,agentName:s}){let n=e.status?.providerStatus?.case==="whatsapp"?e.status.providerStatus.value:null,r=n?.displayPhoneNumber||n?.phoneNumberId||null;return(0,t.jsxs)("div",{className:"stg:space-y-2",role:"status",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-sm stg:font-medium stg:text-foreground",children:[(0,t.jsx)(ez,{className:"stg:size-4 stg:text-success"}),"Connected",r?` to ${r}`:"",n?.verifiedName?` (${n.verifiedName})`:""]}),(0,t.jsxs)("p",{className:"stg:text-sm stg:text-muted-foreground",children:["Send a WhatsApp message to"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:r??"the connected number"})," ","and ask your question — answers come from"," ",(0,t.jsx)("span",{className:"stg:font-medium stg:text-foreground",children:s}),"."]})]})}var e9=e.i(543727);function e7({agent:e,onConnectExternal:n,channelAppsHref:a,sessionHref:i,className:l}){let o=e.metadata?.id??"",{channels:g,isLoading:d,error:c,refetch:u}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>(await s.agentChannel.getByAgent((0,P.create)(eF.GetAgentChannelsByAgentRequestSchema,{agentId:e,org:t??""}))).items:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{channels:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(o,e.metadata?.org??""),{channelApps:m}=(0,N.useChannelAppList)(e.metadata?.org||null),{allowed:f}=(0,C.useCheckPermission)(o?{kind:"agent",id:o}:null,"can_edit"),b="cloud"===(0,R.useDeploymentMode)(),{deleteChannel:v}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteChannel:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentChannel.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{confirmState:y,confirm:k,handleConfirm:E,handleCancel:T}=(0,S.useConfirmAction)(),[I,L]=(0,s.useState)(null),[$,O]=(0,s.useState)(null),[D,z]=(0,s.useState)(null),[B,F]=(0,s.useState)(null),[H,V]=(0,s.useState)(null),[q,Y]=(0,s.useState)(null),K=(0,s.useCallback)((e,t)=>{"redirect"===t.installStyle&&n?n(e):L(e?{mode:"reconnect",channel:e}:{mode:"create",provider:t})},[n]),G=(0,s.useCallback)(async e=>{let t=e.metadata?.name||e.metadata?.slug||"this channel",s=ev(e.spec?.providerConfig?.case)??ef;if(await k({title:"Disconnect channel?",description:s.disconnectDescription(t),confirmLabel:"Disconnect",variant:"destructive"}))try{await v(e.metadata?.id??""),r.toast.success("Channel disconnected"),u()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[k,v,u]);if(d)return(0,t.jsx)(ta,{});if(c)return(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load channels"});let X=!b&&(0===g.length||g.some(e=>ts(e)!==p.AgentChannelInstallState.installed)),J=e9.CHANNEL_PROVIDERS.filter(e=>f&&(b||"redirect"===e.installStyle&&!!n)),Z=null===I?null:"create"===I.mode?I.provider:(0,e9.channelProviderOf)(I.channel.spec?.providerConfig?.case)??e9.CHANNEL_PROVIDERS[0];return(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",l),children:[X&&(0,t.jsx)(M.CloudFeatureNotice,{children:"Channel installs require Stigmer Cloud — connecting an agent to Slack or WhatsApp runs through the platform's hosted webhook infrastructure. Channel configuration still works here."}),0===g.length?(0,t.jsx)(tr,{providers:J,onConnectClick:e=>K(null,e)}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:gap-2",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[g.length," ",1===g.length?"channel":"channels"]}),J.length>0&&(0,t.jsx)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-2",children:J.map(e=>(0,t.jsxs)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(e.Icon,{className:"stg:size-3"}),onClick:()=>K(null,e),"data-cursor-target":`connect-${e.id}`,children:["Connect to ",e.label]},e.id))})]}),(0,t.jsx)("div",{className:"stg:space-y-2",children:g.map(s=>{let r=(0,e9.channelProviderOf)(s.spec?.providerConfig?.case)??e9.CHANNEL_PROVIDERS[0];return(0,t.jsx)(te,{agent:e,channel:s,channelApps:m,connectAvailable:b||"redirect"===r.installStyle&&!!n,onConnectClick:()=>K(s,r),onDeleteClick:()=>void G(s),onEditCredentials:()=>O(s),onViewConversations:()=>z(s),onViewTemplates:()=>F(s),onEditYaml:()=>V(s),onEditRunConfig:()=>Y(s),refetch:u},s.metadata?.id)})})]}),I&&Z?.id==="whatsapp"?(0,t.jsx)(e2,{open:!0,onOpenChange:e=>{e||L(null)},agent:e,channel:"reconnect"===I.mode?I.channel:void 0,onChannelsChanged:u,channelAppsHref:a}):I?(0,t.jsx)(eK,{open:!0,onOpenChange:e=>{e||L(null)},agent:e,channel:"reconnect"===I.mode?I.channel:void 0,onChannelsChanged:u,channelAppsHref:a}):null,$&&(0,t.jsx)(en,{open:!0,onOpenChange:e=>{e||O(null)},agent:e,channel:$,onSaved:u}),D&&(0,t.jsx)(_,{open:!0,onOpenChange:e=>{e||z(null)},channel:D,sessionHref:i}),B&&(0,t.jsx)(eC,{open:!0,onOpenChange:e=>{e||F(null)},channel:B,onEditYaml:()=>{F(null),V(B)}}),H&&(0,t.jsx)(A.EditResourceYamlDialog,{open:!0,onOpenChange:e=>{e||V(null)},resource:H,onApplied:u}),q&&(0,t.jsx)(eg,{open:!0,onOpenChange:e=>{e||Y(null)},channel:q,onSaved:u}),(0,t.jsx)(w.ConfirmDialog,{state:y,onConfirm:E,onCancel:T})]})}function te({agent:e,channel:n,channelApps:d,connectAvailable:h,onConnectClick:y,onDeleteClick:N,onEditCredentials:w,onViewConversations:S,onViewTemplates:A,onEditYaml:R,onEditRunConfig:M,refetch:T}){let I=n.metadata,L=I?.id??"",$=n.spec?.enabled??!1,O=ts(n),D=n.spec?.appRef?.slug||null,z=D?d.find(e=>e.metadata?.slug===D)?.metadata?.name||D:null,P=(0,e9.channelProviderOf)(n.spec?.providerConfig?.case)??e9.CHANNEL_PROVIDERS[0],B=ev(n.spec?.providerConfig?.case)??ef,{save:U,isPending:W}=es(),{allowed:_}=(0,C.useCheckPermission)({kind:"agent_channel",id:L},"can_edit"),{allowed:F}=(0,C.useCheckPermission)({kind:"agent_channel",id:L},"can_delete"),H=(0,b.useManageAccess)({resource:L?{kind:f.ApiResourceKind.agent_channel,kindString:"agent_channel",id:L,org:I?.org??"",name:I?.name||I?.slug}:null}),V=(0,s.useCallback)(async e=>{try{await U({...et(n),enabled:e}),r.toast.success(e?"Channel turned on":"Channel turned off"),T()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[U,n,T]);return(0,t.jsxs)("div",{className:"stg:rounded-lg stg:border stg:border-border stg:p-4",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-3",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2.5",children:[(0,t.jsx)(P.Icon,{className:"stg:size-5 stg:shrink-0 stg:text-foreground"}),(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2",children:[(0,t.jsx)(E.TruncatedText,{text:I?.name||I?.slug||"—",className:"stg:text-sm stg:font-medium stg:text-foreground"}),(0,t.jsx)(tn,{state:O})]}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:B.describeChannel(n)}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground-faint",children:B.servingLine(z)})]})]}),(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:items-center stg:gap-2",children:[_&&O===p.AgentChannelInstallState.installed&&(0,t.jsx)(k.Switch,{checked:$,onCheckedChange:e=>void V(e),disabled:W,"aria-label":`Turn ${I?.name||I?.slug||"channel"} ${$?"off":"on"}`}),_&&h&&O!==p.AgentChannelInstallState.installed&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",onClick:y,children:O===p.AgentChannelInstallState.revoked?"Reconnect":"Connect"}),(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{"aria-label":`Actions for ${I?.name||I?.slug}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(o.MessageSquare,{}),onSelect:S,"data-cursor-target":"channel-conversations",children:"Sessions"}),H.action&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(c,{}),onSelect:H.open,children:"Manage access"}),_&&P.supportsMessageTemplates&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(l.LayoutTemplate,{}),onSelect:A,"data-cursor-target":"channel-templates",children:"Templates"}),_&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(u.SlidersHorizontal,{}),onSelect:M,"data-cursor-target":"channel-run-config",children:"Run settings"}),_&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(i.KeyRound,{}),onSelect:w,children:"Tool credentials"}),_&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(a.FileCode2,{}),onSelect:R,children:"Edit YAML"}),F&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:N,children:"Disconnect"})]})]})]})]}),(0,t.jsx)(tt,{agent:e,channel:n,canEdit:_,onEditCredentials:w}),H.dialog]})}function tt({agent:e,channel:s,canEdit:n,onEditCredentials:r}){let a=J(e,(s.spec?.enabled??!1)&&ts(s)===p.AgentChannelInstallState.installed,s.spec?.environmentRefs??[]);if("needs-credentials"!==a.status&&"blocked"!==a.status)return null;let i="needs-credentials"===a.status?"This agent uses tools, but no credentials are bound to this channel — workspace messages that need a tool will be refused.":`Bound environment${a.privateEnvironments.length>1?"s":""} ${a.privateEnvironments.join(", ")} ${a.privateEnvironments.length>1?"are":"is"} private — share ${a.privateEnvironments.length>1?"them":"it"} with your organization so workspace messages can use the credentials.`;return(0,t.jsxs)("p",{className:"stg:mt-2 stg:text-xs stg:text-warning",role:"status",children:[i,n&&(0,t.jsxs)(t.Fragment,{children:[" ",(0,t.jsx)("button",{type:"button",onClick:r,className:(0,h.cn)("stg:font-medium stg:underline stg:underline-offset-2","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:"Bind credentials"})]})]})}function ts(e){return e.status?.installState??p.AgentChannelInstallState.agent_channel_install_state_unspecified}function tn({state:e}){let{label:s,tone:n}=(()=>{switch(e){case p.AgentChannelInstallState.installed:return{label:"Installed",tone:"stg:text-success"};case p.AgentChannelInstallState.revoked:return{label:"Revoked",tone:"stg:text-destructive"};default:return{label:"Pending install",tone:"stg:text-muted-foreground"}}})();return(0,t.jsxs)("span",{className:(0,h.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:gap-1.5 stg:text-xs",n),children:[(0,t.jsx)("span",{"aria-hidden":"true",className:"stg:size-1.5 stg:rounded-full stg:bg-current"}),s]})}function tr({providers:e,onConnectClick:s}){let n=e9.CHANNEL_PROVIDERS.map(e=>e.label).join(" or ");return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)("span",{className:"stg:flex stg:items-center stg:gap-2",children:e9.CHANNEL_PROVIDERS.map(e=>(0,t.jsx)(e.Icon,{className:"stg:size-10"},e.id))}),title:"No channels yet",description:`Connect this agent to ${n} and people chat with it right where they work — with policy, rate limits, and billing enforced by Stigmer.`,children:e.length>0&&(0,t.jsx)("span",{className:"stg:flex stg:items-center stg:gap-2",children:e.map(e=>(0,t.jsxs)(j.Button,{variant:"primary",icon:(0,t.jsx)(e.Icon,{className:"stg:size-3"}),onClick:()=>s(e),"data-cursor-target":`connect-${e.id}`,children:["Connect to ",e.label]},e.id))})})}function ta(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2].map(e=>(0,t.jsx)("div",{className:"stg:h-20 stg:animate-pulse stg:rounded-lg stg:bg-muted-faint"},e))})}var ti=e.i(196716),tl=e.i(992999),to=e.i(476007),tg=e.i(758960);let td=(0,d.default)("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]),tc=(0,d.default)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);var tu=e.i(431343),tm=e.i(367240),th=e.i(82765),tx=e.i(188482),tp=e.i(154752),tf=e.i(910304),tb=e.i(421415),tv=e.i(927056),tj=e.i(936175),ty=e.i(982247),tk=e.i(367539),tN=e.i(891914),tC=e.i(313171);function tw(e){return e===tC.AgentShareAudience.org?"org":"public"}function tS(e){let t=e?.spec;return{enabled:t?.enabled??!1,audience:tw(t?.audience),allowedOrigins:t?.allowedOrigins??[],messages:{rateLimited:t?.messages?.rateLimited??"",unavailable:t?.messages?.unavailable??"",conversationEnded:t?.messages?.conversationEnded??""},environmentRefs:(t?.environmentRefs??[]).map(e=>({org:e.org,slug:e.slug})),runConfig:t?.runConfig?{modelName:t.runConfig.modelName,maxCostUsd:t.runConfig.maxCostUsd,maxToolRounds:t.runConfig.maxToolRounds,serviceTier:t.runConfig.serviceTier}:void 0}}function tA(e,t){let n=(0,U.useStigmer)(),[r,a]=(0,s.useState)(!1),[i,l]=(0,s.useState)(null),o=e?.metadata?.org??"",g=e?.metadata?.slug??"",d=e?.metadata?.name??"",c=t||o;return{save:(0,s.useCallback)(async(e,t,s)=>{if(o&&g){a(!0),l(null);try{var r;return await n.agentShare.apply({org:t?.metadata?.org||c,slug:t?.metadata?.slug||s?.slug||g,name:t?.metadata?.name||s?.name||d||g,agentRef:{org:o,slug:g},enabled:e.enabled,audience:(r=e.audience,"org"===r?tC.AgentShareAudience.org:tC.AgentShareAudience.public),allowedOrigins:[...e.allowedOrigins],messages:{rateLimited:e.messages.rateLimited,unavailable:e.messages.unavailable,conversationEnded:e.messages.conversationEnded},environmentRefs:e.environmentRefs.map(e=>({org:e.org,slug:e.slug})),runConfig:e.runConfig})}catch(e){throw l((0,ee.toError)(e)),e}finally{a(!1)}}},[o,g,d,c,n]),isPending:r,error:i}}var tR=e.i(743459);function tM(e){let t=(0,U.useStigmer)(),[n,r]=(0,s.useState)(!1),[a,i]=(0,s.useState)(null);return{rotateShareLink:(0,s.useCallback)(async()=>{if(e){r(!0),i(null);try{return await t.agentShare.rotateShareLink((0,P.create)(tR.RotateShareLinkInputSchema,{resourceId:e}))}catch(e){throw i((0,ee.toError)(e)),e}finally{r(!1)}}},[e,t]),isPending:n,error:a}}let tE=[{id:"link",label:"Link"},{id:"embed",label:"Embed"},{id:"developer",label:"Developer"}];function tT({open:e,onOpenChange:n,agent:r,share:a,shareOrg:i,buildShareUrl:l,onSharingChanged:o,modal:g=!0}){let d=(0,s.useId)(),c=(0,s.useCallback)(()=>{n(!1)},[n]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:n,modal:g,width:"lg","aria-labelledby":d,children:e&&(0,t.jsx)(tI,{agent:r,share:a??null,shareOrg:i,buildShareUrl:l,onSharingChanged:o,onClose:c,titleId:d})})}function tI({agent:e,share:n,shareOrg:r,buildShareUrl:a,onSharingChanged:i,onClose:l,titleId:o}){let[g,d]=(0,s.useState)(null),c=n??g,u=null===c,m=c?.metadata?.org||r||(e.metadata?.org??""),x=m!==(e.metadata?.org??"");return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("h2",{id:o,className:"stg:text-base stg:font-semibold stg:text-foreground",children:u?"Create share":"Share"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:truncate stg:text-xs stg:text-muted-foreground",children:x?`${e.metadata?.org}/${e.metadata?.slug}`:e.metadata?.name||e.metadata?.slug})]}),(0,t.jsx)("button",{type:"button",onClick:l,"aria-label":"Close",className:(0,h.cn)("stg:rounded-md stg:p-1 stg:text-muted-foreground","stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"),children:(0,t.jsx)(tJ,{})})]}),u?(0,t.jsx)(tL,{agent:e,shareOrg:m,onCreated:e=>{d(e),i?.()}}):(0,t.jsx)(t$,{agent:e,initialShare:c,buildShareUrl:a,onSharingChanged:i}),(0,t.jsx)("div",{className:"stg:flex stg:items-center stg:justify-end stg:border-t stg:border-border stg:px-6 stg:py-3",children:(0,t.jsx)("button",{type:"button",onClick:l,className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium",u?"stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover":"stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2"),children:u?"Cancel":"Done"})})]})}function tL({agent:e,shareOrg:n,onCreated:a}){let i=e.metadata?.name||(e.metadata?.slug??""),l=n!==(e.metadata?.org??""),o=(0,s.useId)(),g=`${o}-name`,d=`${o}-slug`,[c,u]=(0,s.useState)(i),[m,p]=(0,s.useState)(e.metadata?.slug??""),f=(0,s.useRef)(!1),[b,v]=(0,s.useState)(null),[j,y]=(0,s.useState)(null),{save:k,isPending:N}=tA(e,n),C=c.trim(),w=m.length>0||C.length>0?(0,tN.validateMessage)(tb.ApiResourceMetadataSchema,(0,P.create)(tb.ApiResourceMetadataSchema,{...m.length>0&&{slug:m},...C.length>0&&{name:C}})):[],S=b??(m.length>0?(0,tN.getFieldError)(w,"slug"):null),A=C.length>0?(0,tN.getFieldError)(w,"name"):null,R=""!==C&&m.length>0&&null===S&&null===A&&!N,M=(0,s.useCallback)(e=>{u(e),f.current||(p((0,tk.generateSlug)(e.trim())),v(null))},[]),E=(0,s.useCallback)(e=>{f.current=!0,p(e),v(null)},[]),T=(0,s.useCallback)(async e=>{if(e.preventDefault(),R){y(null);try{let e=await k({...tS(null),enabled:!0},null,{name:C,slug:m});e&&(r.toast.success("Share created — the link is live"),a(e))}catch(e){e instanceof tf.StigmerError&&"already-exists"===e.code?v(`"${m}" is already used by another share or resource in ${n} — pick a different slug`):y((0,x.getUserMessage)(e))}}},[R,k,C,m,n,a]);return(0,t.jsxs)("form",{onSubmit:T,className:"stg:flex stg:flex-col stg:gap-4 stg:px-6 stg:py-4",children:[(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["A share is its own channel to this agent: a hosted chat link with its own audience, embed origins, tool credentials, and visitor messages."," ",l&&(0,t.jsxs)(t.Fragment,{children:["This one lives in your organization"," ",(0,t.jsx)("span",{className:"stg:font-medium",children:n})," while the agent stays in ",(0,t.jsx)("span",{className:"stg:font-medium",children:e.metadata?.org})," ","— updates to the agent apply live."," "]}),"Visitors chat on ",(0,t.jsx)("span",{className:"stg:font-medium",children:n}),"'s credits."]}),(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsx)("label",{htmlFor:g,className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Name"}),(0,t.jsx)("input",{id:g,type:"text",value:c,onChange:e=>M(e.target.value),disabled:N,required:!0,maxLength:63,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:bg-input-bg stg:px-2.5 stg:py-1.5 stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",A?"stg:border-destructive":"stg:border-border")}),A?(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-destructive",role:"alert",children:A}):(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"A display name for this share — e.g. the site or campaign it serves."})]}),(0,t.jsxs)("div",{className:"stg:space-y-1",children:[(0,t.jsx)("label",{htmlFor:d,className:"stg:text-xs stg:font-medium stg:text-foreground",children:"Slug"}),(0,t.jsx)("input",{id:d,type:"text",value:m,onChange:e=>E(e.target.value),disabled:N,required:!0,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:bg-input-bg stg:px-2.5 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",S?"stg:border-destructive":"stg:border-border")}),S?(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-destructive",role:"alert",children:S}):(0,t.jsxs)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:["Becomes the share's address:"," ",(0,t.jsxs)("code",{className:"stg:font-mono",children:["/chat/",n,"/",m||"…"]}),". Can't be changed later."]})]}),j&&(0,t.jsx)("p",{className:"stg:text-xs stg:text-destructive",role:"alert",children:j}),(0,t.jsx)("div",{className:"stg:flex stg:items-center stg:justify-end",children:(0,t.jsx)("button",{type:"submit",disabled:!R,className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:N?"Creating…":"Create share"})})]})}function t$({agent:e,initialShare:n,buildShareUrl:a,onSharingChanged:i}){let l=e.metadata?.name||(e.metadata?.slug??""),o=(0,s.useId)(),[g,d]=(0,s.useState)(n),[c,u]=(0,s.useState)(()=>tS(n)),[m,h]=(0,s.useState)("link"),{save:p,isPending:f}=tA(e),{rotateShareLink:b,isPending:v}=tM(g.metadata?.id??null),j=g.metadata?.org??"",y=g.metadata?.slug??"",N=g.status?.shareLinkToken??"",C=j!==(e.metadata?.org??""),w=(0,s.useCallback)(async(e,t)=>{try{let s=await p(e,g);return s?(d(s),u(tS(s))):u(e),r.toast.success(t),i?.(),!0}catch(e){return r.toast.error((0,x.getUserMessage)(e)),!1}},[p,g,i]),S=(0,s.useCallback)(async()=>{try{let e=await b();e&&d(e),r.toast.success("Link reset — the old link no longer works"),i?.()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[b,i]),A=(0,s.useCallback)(e=>{w({...c,enabled:e},e?"Sharing enabled":"Sharing disabled")},[w,c]),R=(0,s.useCallback)(e=>{if(e===c.audience)return;let t="org"===e&&c.environmentRefs.length>0;w({...c,audience:e,environmentRefs:t?[]:c.environmentRefs},"org"===e?t?"Only organization members can chat now — tool credential bindings were removed (they apply to public links only)":"Only organization members can chat now":"Anyone with the link can chat now")},[w,c]),M="org"===c.audience,E=a?a(j,y):(0,th.chatPath)(j,y),T=M?E:(0,th.appendLinkToken)(E,N);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"stg:border-b stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("span",{id:o,className:"stg:text-sm stg:font-medium stg:text-foreground",children:M?"Organization members can chat":"Anyone with the link can chat"}),(0,t.jsx)(tP,{org:j,audience:c.audience})]}),(0,t.jsx)(k.Switch,{checked:c.enabled,onCheckedChange:A,disabled:f,"aria-labelledby":o})]}),!C&&(0,t.jsx)(tz,{audience:c.audience,onChange:R,disabled:f}),(0,t.jsx)(tO,{agent:e,draft:c})]}),(0,t.jsx)("div",{className:"stg:px-6 stg:pb-2 stg:pt-3",children:(0,t.jsx)(tv.Tabs,{tabs:tE,activeTab:m,onTabChange:h,"aria-label":"Sharing options",children:(0,t.jsxs)("div",{className:"stg:pt-4",children:["link"===m&&(0,t.jsx)(tU,{shareUrl:T,org:j,agent:e,enabled:c.enabled,draft:c,isPending:f,commit:w,hasLinkToken:""!==N,isRotating:v,onResetLink:S}),"embed"===m&&(0,t.jsx)(tF,{shareUrl:T,org:j,slug:y,agentName:l,linkToken:N,enabled:c.enabled,draft:c,isPending:f,commit:w}),"developer"===m&&(0,t.jsx)(tG,{org:j,slug:y})]})})})]})}function tO({agent:e,draft:s}){let n,r,a=(n=(0,R.useDeploymentMode)(),r=(e.spec?.mcpServerUsages?.length??0)>0,X(s.enabled&&"public"===s.audience&&"cloud"===n&&r,s.environmentRefs));if("needs-credentials"===a.status)return(0,t.jsxs)("p",{className:"stg:mt-2 stg:text-xs stg:text-warning",role:"status",children:["Visitors' chats can't use this agent's tools yet: no credentials are bound to this share. Bind an org-shared environment under ",(0,t.jsx)("span",{className:"stg:font-medium",children:"Tool credentials"})," in the Link tab below."]});if("blocked"!==a.status)return null;let i=a.privateEnvironments.join(", "),l=a.privateEnvironments.length>1;return(0,t.jsxs)("p",{className:"stg:mt-2 stg:text-xs stg:text-warning",role:"status",children:["Visitors' chats can't use this agent's tools yet: the environment",l?"s":""," ",(0,t.jsx)("span",{className:"stg:font-medium",children:i})," ",l?"are":"is"," private. Share ",l?"them":"it","with your organization (Settings → Environments) so visitor runs can use the credentials. Secret values stay hidden either way."]})}let tD=[{value:"public",label:"Public link"},{value:"org",label:"Org members"}];function tz({audience:e,onChange:s,disabled:n}){return(0,t.jsx)("div",{role:"radiogroup","aria-label":"Who can chat",className:"stg:mt-3 stg:inline-flex stg:rounded-md stg:border stg:border-border stg:p-0.5",children:tD.map(({value:r,label:a})=>{let i=e===r;return(0,t.jsx)("button",{type:"button",role:"radio","aria-checked":i,onClick:()=>s(r),disabled:n,className:(0,h.cn)("stg:rounded stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50",i?"stg:bg-primary stg:text-primary-foreground":"stg:text-muted-foreground stg:hover:text-foreground"),children:a},r)})})}function tP({org:e,audience:s}){let n=(0,R.useDeploymentMode)(),{account:r}=(0,tj.useBillingAccount)("cloud"===n?e:null),a=r?.balance!==void 0?(0,ty.formatCreditBalance)(r.balance?.availableMicros):null;return(0,t.jsxs)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:["org"===s?"Members":"Visitors"," chat on"," ",(0,t.jsx)("span",{className:"stg:font-medium",children:e}),"'s credits",null!==a&&(0,t.jsxs)(t.Fragment,{children:[" (",a," available)"]}),"."]})}function tB({subject:e}){return(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",role:"status",children:["Sharing is off, so ",e,"doesn't work yet — turn on the switch above to activate it."]})}function tU({shareUrl:e,org:s,agent:n,enabled:r,draft:a,isPending:i,commit:l,hasLinkToken:o,isRotating:g,onResetLink:d}){let c="org"===a.audience;return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4",children:[(0,t.jsx)(tX,{label:c?"Member chat link":"Public chat link",value:e,copyLabel:"Link",disabled:!r,openHref:r?e:void 0}),!r&&(0,t.jsx)(tB,{subject:"this link"}),c?(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",children:["Only signed-in members of ",(0,t.jsx)("span",{className:"stg:font-medium",children:s})," ","can chat. Access is checked on every message, so it ends the moment someone leaves the organization. The link is safe to forward — it shows nothing to anyone else."]}):(0,t.jsx)("p",{className:"stg:text-xs stg:text-warning",children:"Public links can be forwarded and indexed by search engines. Don't share agents that know internal or confidential information — or switch the audience to org members."}),!c&&(0,t.jsx)(tW,{enabled:r,hasLinkToken:o,isRotating:g,onResetLink:d}),!c&&(0,t.jsx)(t_,{org:s,agent:n,draft:a,isPending:i,commit:l}),(0,t.jsx)(tY,{draft:a,isPending:i,commit:l})]})}function tW({enabled:e,hasLinkToken:s,isRotating:n,onResetLink:r}){return(0,t.jsx)("section",{className:(0,h.cn)(!e&&"stg:opacity-50"),children:(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:justify-between stg:gap-4",children:[(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Reset link"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-[0.65rem] stg:text-muted-foreground",children:s?"Generates a new link and kills the current one immediately — even mid-conversation. Re-share the new link with the people who should keep access.":"Got forwarded further than you wanted? Resetting locks the link behind a secret and kills the plain address immediately."})]}),(0,t.jsx)("button",{type:"button",onClick:r,disabled:!e||n,className:(0,h.cn)("stg:shrink-0 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:n?"Resetting…":"Reset link"})]})})}function t_({org:e,agent:n,draft:r,isPending:a,commit:i}){let l=(n.spec?.mcpServerUsages?.length??0)>0,[o,g]=(0,s.useState)(l||r.environmentRefs.length>0),d=(0,s.useCallback)(e=>{let t=e.length>r.environmentRefs.length;i({...r,environmentRefs:e},t?"Credentials bound":"Credential bindings updated")},[i,r]),c=(0,s.useCallback)(e=>e.metadata?.visibility===q.ApiResourceVisibility.visibility_org,[]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>g(e=>!e),"aria-expanded":o,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",o&&"stg:rotate-90")}),"Tool credentials"]}),o&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-2",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Environments whose values visitors' chats can use — bind one holding the credentials this agent's tools need (a read-only token is safest). Only environments shared with your organization can be bound; share one first in Settings → Environments. Secret values stay hidden from visitors either way."}),(0,t.jsx)(Y.EnvironmentPicker,{org:e,value:r.environmentRefs,onChange:d,disabled:a,filterEnvironment:c})]})]})}function tF({shareUrl:e,org:n,slug:r,agentName:a,linkToken:i,enabled:l,draft:o,isPending:g,commit:d}){let c=(0,s.useMemo)(()=>(0,th.buildEmbedSnippet)(function(e){try{return new URL(e).origin}catch{return""}}(e),n,r,i||void 0),[e,n,r,i]);return"org"===o.audience?(0,t.jsxs)("p",{className:"stg:text-xs stg:text-muted-foreground",role:"status",children:["Embedding isn't available for org-members-only sharing: embeds serve anonymous visitors, and this agent requires a signed-in organization member. Switch the audience to"," ",(0,t.jsx)("span",{className:"stg:font-medium",children:"Public link"})," to embed it on a site."]}):(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-4",children:[(0,t.jsx)(tX,{label:"Embed on your site",value:c,copyLabel:"Embed code",disabled:!l,multiline:!0}),!l&&(0,t.jsx)(tB,{subject:"this embed"}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:'The widget hides itself on sites that aren\'t allowed to embed this agent. Free embeds show a "Powered by Stigmer" badge.'}),(0,t.jsx)(tV,{draft:o,isPending:g,commit:d}),(0,t.jsx)(tH,{shareUrl:e,agentName:a,enabled:l})]})}function tH({shareUrl:e,agentName:n,enabled:r}){let[a,i]=(0,s.useState)(!1),l=(0,s.useMemo)(()=>`<iframe
2
+ src="${e}"
3
+ title="${n}"
4
+ width="400"
5
+ height="600"
6
+ style="border: 0; border-radius: 12px;"
7
+ ></iframe>`,[e,n]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-expanded":a,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",a&&"stg:rotate-90")}),"No-JavaScript alternative"]}),a&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-2",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"For sites that can't run scripts. A blocked embed shows an empty frame instead of hiding."}),(0,t.jsx)(tX,{label:"Iframe embed",value:l,copyLabel:"Iframe code",disabled:!r,multiline:!0})]})]})}function tV({draft:e,isPending:n,commit:r}){let[a,i]=(0,s.useState)(""),[l,o]=(0,s.useState)(null),g=(0,s.useCallback)(async()=>{let t=a.trim(),s=(0,th.validateOrigin)(t);s?o(s):e.allowedOrigins.includes(t)?o("That origin is already in the list"):e.allowedOrigins.length>=th.MAX_ALLOWED_ORIGINS?o(`At most ${th.MAX_ALLOWED_ORIGINS} origins are allowed`):(o(null),await r({...e,allowedOrigins:[...e.allowedOrigins,t]},"Origin added")&&i(""))},[a,e,r]),d=(0,s.useCallback)(t=>{r({...e,allowedOrigins:e.allowedOrigins.filter(e=>e!==t)},"Origin removed")},[e,r]);return(0,t.jsxs)("section",{children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Allowed embed origins"}),(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-[0.65rem] stg:text-muted-foreground",children:"Sites allowed to embed this agent. An empty list allows any site; adding origins restricts embedding to those sites. The hosted link works either way."}),e.allowedOrigins.length>0&&(0,t.jsx)("ul",{className:(0,h.cn)(O.UNSTYLED_LIST,"stg:mt-2 stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border"),children:e.allowedOrigins.map(e=>(0,t.jsxs)("li",{className:"stg:flex stg:items-center stg:justify-between stg:gap-2 stg:px-2.5 stg:py-1.5",children:[(0,t.jsx)("code",{className:"stg:truncate stg:font-mono stg:text-xs stg:text-foreground",children:e}),(0,t.jsx)("button",{type:"button",onClick:()=>d(e),disabled:n,"aria-label":`Remove ${e}`,className:(0,h.cn)("stg:inline-flex stg:size-5 stg:shrink-0 stg:items-center stg:justify-center stg:rounded stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:(0,t.jsx)(tZ,{})})]},e))}),(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:items-start stg:gap-1.5",children:[(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("input",{type:"text",value:a,onChange:e=>{i(e.target.value),l&&o(null)},onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),g())},placeholder:"https://example.com","aria-label":"Add allowed origin","aria-invalid":null!=l,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),l&&(0,t.jsx)("p",{role:"alert",className:"stg:mt-1 stg:text-xs stg:text-destructive",children:l})]}),(0,t.jsx)("button",{type:"button",onClick:()=>void g(),disabled:n||!a.trim(),className:(0,h.cn)("stg:shrink-0 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Add"})]})]})}let tq=[{key:"rateLimited",label:"Rate limited",placeholder:"Shown when a visitor sends messages too quickly"},{key:"unavailable",label:"Unavailable",placeholder:"Shown when the agent is temporarily unavailable"},{key:"conversationEnded",label:"Conversation ended",placeholder:"Shown when a conversation reaches its limit"}];function tY({draft:e,isPending:n,commit:r}){let[a,i]=(0,s.useState)(!1),[l,o]=(0,s.useState)(e.messages),g=l.rateLimited!==e.messages.rateLimited||l.unavailable!==e.messages.unavailable||l.conversationEnded!==e.messages.conversationEnded,d=(0,s.useCallback)(()=>{r({...e,messages:l},"Messages saved")},[r,e,l]);return(0,t.jsxs)("section",{children:[(0,t.jsxs)("button",{type:"button",onClick:()=>i(e=>!e),"aria-expanded":a,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:text-xs stg:font-medium stg:text-muted-foreground","stg:hover:text-foreground","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:[(0,t.jsx)(tQ,{className:(0,h.cn)("stg:size-3 stg:transition-transform",a&&"stg:rotate-90")}),"Customize visitor messages"]}),a&&(0,t.jsxs)("div",{className:"stg:mt-2 stg:flex stg:flex-col stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground",children:"Shown to visitors when a limit is reached. Leave empty to use the platform defaults."}),tq.map(({key:e,label:s,placeholder:n})=>(0,t.jsx)(tK,{label:s,placeholder:n,value:l[e],onChange:t=>o(s=>({...s,[e]:t}))},e)),g&&(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>o(e.messages),disabled:n,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Reset"}),(0,t.jsx)("button",{type:"button",onClick:d,disabled:n,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Save messages"})]})]})]})}function tK({label:e,placeholder:s,value:n,onChange:r}){return(0,t.jsxs)("label",{className:"stg:flex stg:flex-col stg:gap-1",children:[(0,t.jsxs)("span",{className:"stg:flex stg:items-center stg:justify-between stg:text-xs stg:font-medium stg:text-muted-foreground",children:[e,(0,t.jsxs)("span",{className:"stg:tabular-nums stg:text-[0.65rem]",children:[n.length,"/",300]})]}),(0,t.jsx)("textarea",{value:n,onChange:e=>r(e.target.value.slice(0,300)),placeholder:s,rows:2,maxLength:300,className:(0,h.cn)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")})]})}function tG({org:e,slug:n}){let r=(0,s.useMemo)(()=>`import { createPlatformClientAuth } from "@stigmer/sdk/node";
8
+
9
+ const auth = createPlatformClientAuth({
10
+ baseUrl: "https://api.stigmer.ai",
11
+ clientId: process.env.STIGMER_CLIENT_ID,
12
+ clientSecret: process.env.STIGMER_CLIENT_SECRET,
13
+ });
14
+
15
+ // Mint tokens for your own users, then chat with ${e}/${n}
16
+ const { accessToken } = await auth.mintUserToken({
17
+ userId: "user-123",
18
+ });`,[e,n]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-3",children:[(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground",children:"Need your own auth, branding, or UI? Create a platform client and integrate this agent with the Stigmer SDK — the same runtime, full control."}),(0,t.jsx)(tX,{label:"Platform client integration",value:r,copyLabel:"Code",multiline:!0}),(0,t.jsx)("a",{href:"https://stigmer.ai/docs/guides/authentication/platform-client/overview",target:"_blank",rel:"noreferrer",className:(0,h.cn)("stg:text-xs stg:font-medium stg:text-primary stg:hover:text-primary-muted","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring stg:rounded"),children:"Read the platform client guide →"})]})}function tX({label:e,value:s,copyLabel:n,disabled:r,multiline:a,openHref:i}){let{copy:l}=(0,tp.useCopyResource)();return(0,t.jsxs)("section",{className:(0,h.cn)(r&&"stg:opacity-50"),children:[(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:text-muted-foreground",children:e}),(0,t.jsxs)("div",{className:"stg:mt-1.5 stg:flex stg:items-start stg:gap-1.5",children:[a?(0,t.jsx)("pre",{className:(0,h.cn)("stg:min-w-0 stg:flex-1 stg:overflow-x-auto stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-2.5 stg:py-2","stg:font-mono stg:text-xs stg:leading-relaxed stg:text-foreground"),children:s}):(0,t.jsx)(E.TruncatedText,{text:s,className:(0,h.cn)("stg:min-w-0 stg:flex-1 stg:rounded-md stg:border stg:border-border stg:bg-muted-subtle stg:px-2.5 stg:py-1.5","stg:font-mono stg:text-xs stg:text-foreground")}),(0,t.jsxs)("div",{className:"stg:flex stg:shrink-0 stg:flex-col stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>void l(s,n),disabled:r,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:disabled:pointer-events-none stg:disabled:opacity-50"),children:"Copy"}),i&&(0,t.jsx)("a",{href:i,target:"_blank",rel:"noreferrer",className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-center stg:text-xs stg:font-medium","stg:border stg:border-border stg:text-foreground stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Open"})]})]})]})}function tJ(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function tZ(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function tQ({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function t0({agent:e,viewerOrg:n,buildShareUrl:a,className:i}){let{shares:l,isLoading:o,error:g,refetch:d}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>(await s.agentShare.getByAgent((0,P.create)(tR.GetAgentSharesByAgentRequestSchema,{agentId:e,org:t??""}))).items:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{shares:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(e.metadata?.id??"",n||(e.metadata?.org??"")),{allowed:c,shareOrg:u}=function(e,t){let s=e?.metadata?.id??"",n=e?.metadata?.org??"",r=t||n,a=""!==r&&r!==n,i=e?.metadata?.visibility===q.ApiResourceVisibility.visibility_public,{allowed:l}=(0,C.useCheckPermission)(!a&&s?{kind:"agent",id:s}:null,"can_edit"),{allowed:o}=(0,C.useCheckPermission)(a&&i?{kind:"organization",id:r}:null,"can_create_agent_share");return{allowed:!!e&&(a?i&&o:l),shareOrg:r,isCrossOrg:a}}(e,n),{deleteShare:m}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteShare:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentShare.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{confirmState:p,confirm:f,handleConfirm:b,handleCancel:v}=(0,S.useConfirmAction)(),[y,k]=(0,s.useState)(null),N=(0,s.useCallback)(async e=>{let t=e.metadata?.slug??"";if(await f({title:"Delete share?",description:`The link /chat/${e.metadata?.org}/${t} stops working immediately — including for visitors mid-conversation — and its configuration (origins, messages, credential bindings) is gone. To stop serving while keeping the configuration, pause it instead.`,confirmLabel:"Delete",variant:"destructive"}))try{await m(e.metadata?.id??""),r.toast.success("Share deleted"),d()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[f,m,d]);return o?(0,t.jsx)(t5,{}):g?(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load shares"}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",i),children:[0===l.length?(0,t.jsx)(t2,{canCreate:c,onCreateClick:()=>k({mode:"create"})}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[l.length," ",1===l.length?"share":"shares"]}),c&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(t3,{}),onClick:()=>k({mode:"create"}),children:"Create share"})]}),(0,t.jsx)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:(0,t.jsxs)("table",{className:"stg:w-full stg:table-fixed stg:text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"stg:border-b stg:border-border stg:bg-muted-subtle",children:[(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Name"}),(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Link"}),(0,t.jsx)("th",{className:"stg:w-28 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Audience"}),(0,t.jsx)("th",{className:"stg:w-24 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Status"}),(0,t.jsx)("th",{className:"stg:w-16 stg:px-4 stg:py-2 stg:text-right stg:font-medium stg:text-muted-foreground",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"stg:divide-y stg:divide-border",children:l.map(s=>(0,t.jsx)(t1,{share:s,agent:e,buildShareUrl:a,onEditClick:e=>k({mode:"edit",share:e}),onDeleteClick:N,refetch:d},s.metadata?.id))})]})})]}),y&&(0,t.jsx)(tT,{open:!0,onOpenChange:e=>{e||k(null)},agent:e,share:"edit"===y.mode?y.share:void 0,shareOrg:u,buildShareUrl:a,onSharingChanged:d}),(0,t.jsx)(w.ConfirmDialog,{state:p,onConfirm:b,onCancel:v})]})}function t1({share:e,agent:n,buildShareUrl:a,onEditClick:i,onDeleteClick:l,refetch:o}){let d,c=e.metadata,u=c?.id??"",p=c?.org??"",f=c?.slug??"",b=e.spec?.enabled??!1,j=tw(e.spec?.audience),y=p!==(n.metadata?.org??""),{copy:k}=(0,tp.useCopyResource)(),{save:N,isPending:w}=tA(n),{rotateShareLink:S,isPending:A}=tM(u),{allowed:R}=(0,C.useCheckPermission)({kind:"agent_share",id:u},"can_edit"),{allowed:M}=(0,C.useCheckPermission)({kind:"agent_share",id:u},"can_delete"),T=(0,th.chatPath)(p,f),I=(d=a?a(p,f):T,"org"===j?d:(0,th.appendLinkToken)(d,e.status?.shareLinkToken??"")),L=(0,s.useCallback)(()=>{k(I,"Link")},[k,I]),$=(0,s.useCallback)(async()=>{try{await N({...tS(e),enabled:!b},e),r.toast.success(b?"Share paused":"Share resumed"),o()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[N,e,b,o]),O=(0,s.useCallback)(async()=>{try{await S(),r.toast.success("Link reset — the old link no longer works"),o()}catch(e){r.toast.error((0,x.getUserMessage)(e))}},[S,o]);return(0,t.jsxs)("tr",{className:"stg:cursor-pointer stg:transition-colors stg:hover:bg-accent-hover",onClick:()=>i(e),children:[(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[(0,t.jsx)(E.TruncatedText,{text:c?.name||f||"—",className:"stg:font-medium stg:text-foreground"}),y&&(0,t.jsxs)(tx.Tooltip,{children:[(0,t.jsx)(tx.TooltipTrigger,{render:(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.6rem] stg:font-medium stg:uppercase stg:tracking-wide","stg:bg-muted stg:text-muted-foreground stg:border stg:border-border")}),children:"Cross-org"}),(0,t.jsx)(tx.TooltipContent,{side:"top",children:`This share lives in ${p}; the agent lives in ${n.metadata?.org}`})]})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",onClick:e=>e.stopPropagation(),children:(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-1.5",children:[(0,t.jsx)(E.TruncatedText,{text:T,className:"stg:font-mono stg:text-xs stg:text-muted-foreground"}),(0,t.jsx)("button",{type:"button",onClick:L,"aria-label":`Copy link for ${c?.name||f}`,className:(0,h.cn)("stg:shrink-0 stg:rounded stg:p-1 stg:text-muted-foreground","stg:hover:bg-accent-hover stg:hover:text-foreground","stg:focus:outline-none stg:focus:ring-1 stg:focus:ring-ring"),children:(0,t.jsx)(t4,{})})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"org"===j?"Org members":"Public"})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("span",{className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1.5 stg:text-xs",b?"stg:text-foreground":"stg:text-muted-foreground"),children:[(0,t.jsx)("span",{"aria-hidden":"true",className:(0,h.cn)("stg:size-1.5 stg:rounded-full",b?"stg:bg-success":"stg:bg-muted-foreground")}),b?"Active":"Paused"]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5 stg:text-right",onClick:e=>e.stopPropagation(),children:(R||M)&&(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{className:"stg:ml-auto","aria-label":`Actions for ${c?.name||f}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[R&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tc,{}),onSelect:()=>i(e),children:"Edit"}),(0,t.jsx)(v.ActionMenu.Item,{icon:b?(0,t.jsx)(td,{}):(0,t.jsx)(tu.Play,{}),disabled:w,onSelect:()=>void $(),children:b?"Pause":"Resume"}),"public"===j&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tm.RotateCcw,{}),disabled:A,onSelect:()=>void O(),children:"Reset link"})]}),R&&M&&(0,t.jsx)(v.ActionMenu.Separator,{}),M&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:()=>l(e),children:"Delete"})]})]})})]})}function t2({canCreate:e,onCreateClick:s}){return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(t6,{className:"stg:size-10"}),title:"No shares yet",description:"A share gives this agent a hosted chat link you can send or embed — each share is its own channel with its own audience, embed origins, and tool credentials.",action:e?{label:"Create share",onClick:s,icon:(0,t.jsx)(t3,{})}:void 0})}function t5(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}function t3(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function t4(){return(0,t.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"5.5",y:"5.5",width:"8",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2"})]})}function t6({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"4",cy:"8",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"4",r:"2"}),(0,t.jsx)("circle",{cx:"12",cy:"12",r:"2"}),(0,t.jsx)("path",{d:"m5.8 7.1 4.4-2.2M5.8 8.9l4.4 2.2"})]})}var t8=e.i(668093),t9=e.i(652337),t7=e.i(267912);let se={agent:"Agent","mcp-server":"MCP",skill:"Skill","sub-agent":"Sub-Agent"};function st({node:e,depth:n,onNodeClick:r,defaultExpanded:a}){let i=e.children.length>0,l="agent"===e.kind,o="sub-agent"===e.kind&&i,g=l&&i,[d,c]=(0,s.useState)(a),u=null!=e.ref&&null!=r,m=g||o&&d,x=(0,s.useCallback)(()=>{o?c(e=>!e):u&&r(e)},[o,u,r,e]),p=(0,s.useCallback)(e=>{o&&("ArrowRight"!==e.key||d?"ArrowLeft"===e.key&&d&&(e.preventDefault(),c(!1)):(e.preventDefault(),c(!0)))},[o,d]),f=(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[o&&(0,t.jsx)(si,{className:(0,h.cn)("stg:size-3.5 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",d&&"stg:rotate-90")}),(0,t.jsx)(ss,{kind:e.kind,className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),!l&&(0,t.jsx)("span",{className:(0,h.cn)("stg:shrink-0 stg:rounded stg:px-1.5 stg:py-px stg:text-[10px] stg:font-medium stg:leading-tight",function(e){switch(e){case"mcp-server":return"stg:bg-[var(--stgm-status-running-subtle)] stg:text-[var(--stgm-status-running)]";case"skill":return"stg:bg-[var(--stgm-status-pending-subtle)] stg:text-[var(--stgm-status-pending)]";case"sub-agent":return"stg:bg-[var(--stgm-status-ready-subtle)] stg:text-[var(--stgm-status-ready)]";case"agent":return"stg:bg-muted stg:text-muted-foreground"}}(e.kind)),children:se[e.kind]}),(0,t.jsx)("span",{className:"stg:min-w-0 stg:truncate stg:text-sm stg:font-medium stg:text-foreground",children:e.qualifiedLabel??e.label}),e.metadata&&Object.entries(e.metadata).map(([e,s])=>(0,t.jsx)("span",{className:"stg:shrink-0 stg:text-xs stg:text-muted-foreground",children:s},e))]}),b=o||u;return(0,t.jsxs)("li",{role:"treeitem","aria-expanded":o?d:!!g||void 0,className:(0,h.cn)("stg:list-none",n>0&&"stg:relative stg:before:absolute stg:before:left-[-12px] stg:before:top-[14px] stg:before:h-px stg:before:w-3 stg:before:bg-border stg:before:content-['']"),children:[b?(0,t.jsx)("button",{type:"button",onClick:x,onKeyDown:p,tabIndex:-1,className:(0,h.cn)("stg:flex stg:w-full stg:items-center stg:rounded-md stg:px-2 stg:py-1.5 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:f}):(0,t.jsx)("div",{className:"stg:flex stg:items-center stg:px-2 stg:py-1.5",children:f}),e.description&&!l&&(0,t.jsx)("p",{className:(0,h.cn)("stg:px-2 stg:pb-1 stg:text-xs stg:text-muted-foreground",o?"stg:ml-[calc(0.5rem+14px+0.5rem)]":"stg:ml-2"),children:e.description}),m&&(0,t.jsx)("ul",{role:"group",className:(0,h.cn)(O.UNSTYLED_LIST,"stg:relative stg:ml-[11px] stg:border-l stg:border-border stg:pl-3"),children:e.children.map(e=>(0,t.jsx)(st,{node:e,depth:n+1,onNodeClick:r,defaultExpanded:a},e.id))})]})}function ss({kind:e,className:s}){switch(e){case"agent":case"sub-agent":return(0,t.jsx)(sn,{className:s});case"mcp-server":return(0,t.jsx)(sr,{className:s});case"skill":return(0,t.jsx)(sa,{className:s})}}function sn({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M6 9h.01M10 9h.01",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2v3"})]})}function sr({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"5",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"9",width:"12",height:"5",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4.5",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}function sa({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M9 1.5 4 9h4l-1 5.5L12 7H8l1-5.5Z"})})}function si({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function sl({tree:e,onNodeClick:n,defaultExpanded:r=!0,className:a}){let i=(0,s.useRef)(null),l=(0,s.useCallback)(e=>{let t=i.current;if(!t)return;let s=Array.from(t.querySelectorAll("[role='treeitem'] > button, [role='treeitem'] > div")).filter(e=>{let t=e.closest("[role='treeitem']")?.parentElement?.closest("[role='treeitem']");for(;t;){if("false"===t.getAttribute("aria-expanded"))return!1;t=t.parentElement?.closest("[role='treeitem']")}return!0});if(0===s.length)return;let n=document.activeElement,r=n?s.indexOf(n):-1,a=null;switch(e.key){case"ArrowDown":a=r<s.length-1?r+1:0;break;case"ArrowUp":a=r>0?r-1:s.length-1;break;case"Home":a=0;break;case"End":a=s.length-1;break;default:return}e.preventDefault(),s[a].focus()},[]),{root:o}=e;return(0,t.jsxs)("div",{className:(0,h.cn)("stg:py-2",a),children:[(0,t.jsxs)("div",{className:"stg:mb-3 stg:flex stg:items-center stg:gap-2 stg:px-2",children:[(0,t.jsx)(so,{className:"stg:size-4 stg:text-muted-foreground"}),(0,t.jsx)("h3",{className:"stg:text-xs stg:font-medium stg:uppercase stg:tracking-wider stg:text-muted-foreground",children:"Dependency Tree"}),(0,t.jsxs)("span",{className:"stg:text-xs stg:text-muted-foreground",children:[e.nodeCount," ",1===e.nodeCount?"node":"nodes"]})]}),(0,t.jsx)("ul",{ref:i,role:"tree","aria-label":`Dependencies of ${o.label}`,onKeyDown:l,className:(0,h.cn)(O.UNSTYLED_LIST,"stg:rounded-lg stg:border stg:border-border stg:p-2"),children:(0,t.jsx)(st,{node:o,depth:0,onNodeClick:n,defaultExpanded:r})})]})}function so({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("path",{d:"M8 2v4M8 6 4 10M8 6l4 4"}),(0,t.jsx)("circle",{cx:"8",cy:"2",r:"1",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"4",cy:"11",r:"1.5"}),(0,t.jsx)("circle",{cx:"8",cy:"11",r:"1.5"}),(0,t.jsx)("circle",{cx:"12",cy:"11",r:"1.5"})]})}var sg=e.i(261722),sd=e.i(81346),sc=e.i(52595);function su({value:e,onSave:n,renderPicker:r,onItemClick:a,itemIcon:i,resourceLabel:l="resource",editing:o,onEditingChange:g,defaultOrg:d="",disabled:c,isSaving:u,error:m,className:x}){let[p,f]=(0,s.useState)(!1),b=o??p,v=(0,s.useCallback)(e=>{f(e),g?.(e)},[g]);(0,s.useEffect)(()=>{void 0!==o&&f(o)},[o]);let[j,y]=(0,s.useState)([...e]),[k,N]=(0,s.useState)(!1),[C,w]=(0,s.useState)(!1),[S,A]=(0,s.useState)(""),[R,M]=(0,s.useState)(d);(0,s.useCallback)(()=>{y([...e]),v(!0),N(!1),w(!1)},[e,v]);let E=(0,s.useCallback)(()=>{v(!1),y([...e]),N(!1),w(!1)},[e,v]),T=(0,s.useCallback)(async()=>{await n(j)&&(v(!1),N(!1),w(!1))},[j,n,v]),I=(0,s.useCallback)(e=>{y(t=>t.filter((t,s)=>s!==e))},[]),L=(0,s.useCallback)(e=>{y(t=>t.some(t=>t.org===e.org&&t.slug===e.slug)?t:[...t,e]),N(!1)},[]);return c||!b?(0,t.jsx)("div",{className:(0,h.cn)("stg:flex stg:flex-col",x),children:e.length>0?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:e.map((e,s)=>{let n=e.label??e.slug,r=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[i&&(0,t.jsx)("span",{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground",children:i}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:n})]});return a?(0,t.jsx)("button",{type:"button",onClick:()=>a(e),className:(0,h.cn)("stg:w-full stg:px-3 stg:py-2.5 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:r},`${e.org}/${e.slug}`||s):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2.5",children:r},`${e.org}/${e.slug}`||s)})}):(0,t.jsxs)("p",{className:"stg:px-3 stg:py-3 stg:text-xs stg:text-muted-foreground stg:italic",children:["No ",l,"s configured"]})}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:flex stg:flex-col stg:gap-2",x),children:[j.length>0&&(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border stg:rounded-md stg:border stg:border-border",children:j.map((e,s)=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:px-3 stg:py-1.5",children:[i&&(0,t.jsx)("span",{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground",children:i}),(0,t.jsx)("span",{className:"stg:flex-1 stg:text-sm stg:font-medium stg:text-foreground",children:e.label??e.slug}),(0,t.jsx)("button",{type:"button",onClick:()=>I(s),"aria-label":`Remove ${e.label??e.slug}`,className:(0,h.cn)("stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sh,{className:"stg:size-3.5"})})]},`${e.org}/${e.slug}`))}),k&&r?(0,t.jsx)("div",{className:"stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:p-2",children:r(L)}):C?(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:rounded-md stg:border stg:border-border stg:bg-muted-faint stg:p-2",children:[(0,t.jsx)("input",{type:"text",value:R,onChange:e=>M(e.target.value),placeholder:"org",className:(0,h.cn)("stg:w-24 stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"/"}),(0,t.jsx)("input",{type:"text",value:S,onChange:e=>A(e.target.value),placeholder:"slug",onKeyDown:e=>{"Enter"===e.key&&S.trim()?(L({org:R.trim()||d,slug:S.trim(),label:S.trim()}),A(""),w(!1)):"Escape"===e.key&&(w(!1),A(""))},className:(0,h.cn)("stg:flex-1 stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("button",{type:"button",onClick:()=>{S.trim()&&(L({org:R.trim()||d,slug:S.trim(),label:S.trim()}),A(""),w(!1))},disabled:!S.trim(),className:(0,h.cn)("stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sm,{className:"stg:size-3"})})]}):(0,t.jsxs)("button",{type:"button",onClick:()=>r?N(!0):w(!0),className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-muted-foreground stg:hover:text-foreground stg:hover:bg-muted-subtle","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:transition-colors"),children:[(0,t.jsx)(sm,{className:"stg:size-3"}),"Add ",l]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:E,disabled:u,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:bg-background stg:text-foreground stg:hover:bg-accent","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Cancel"}),(0,t.jsxs)("button",{type:"button",onClick:T,disabled:u,className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:[u&&(0,t.jsx)(sx,{}),"Save changes"]})]}),m&&(0,t.jsx)("p",{className:"stg:px-1 stg:text-xs stg:text-destructive",role:"alert",children:m})]})}function sm({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}function sh({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function sx(){return(0,t.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",className:"stg:animate-spin","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 2a6 6 0 1 0 6 6"})})}var sp=e.i(486277),sf=e.i(348990),sb=e.i(388023);function sv({onCreateClick:e,className:s}){return(0,t.jsx)(y.EmptyState,{variant:"first-use",icon:(0,t.jsx)(sj,{}),title:"No instances yet",description:"Create instances to start sessions with this agent using different credentials and settings. Each instance binds environments (secrets, configuration) and can be shared with your team independently.",action:e?{label:"Create instance",onClick:e,icon:(0,t.jsx)(sy,{})}:void 0,className:s})}function sj(){return(0,t.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 20 20",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M10 2L2 6l8 4 8-4-8-4zM2 10l8 4 8-4M2 14l8 4 8-4",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function sy(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function sk({agentId:e,defaultInstanceId:n,org:r,viewerOrg:a,onCreateClick:i,onInstanceClick:l,onStartSessionClick:o,onDeleteClick:g,refreshKey:d,className:c}){let{instances:u,isLoading:m,error:x,refetch:p}=function(e,t){let s=(0,U.useStigmer)(),n=e?async()=>{let n=await s.agentInstance.getByAgent((0,P.create)(sp.GetAgentInstancesByAgentRequestSchema,{agentId:e,org:t??""}));return n.items?[...n.items]:[]}:null,{data:r,isLoading:a,isRefetching:i,error:l,refetch:o}=(0,W.useFetch)(n,[e,t,s],[]);return{instances:r,isLoading:a,isRefetching:i,error:l,refetch:o}}(e,a||r),{environments:f}=(0,sf.useEnvironmentList)(r),b=(0,s.useRef)(d);(0,s.useEffect)(()=>{void 0!==d&&d!==b.current&&(b.current=d,p())},[d,p]);let v=(0,s.useMemo)(()=>u.filter(e=>e.metadata?.id!==n),[u,n]),y=(0,s.useCallback)(e=>{let t=f.find(t=>t.metadata?.slug===e);return t?.metadata?.name??e},[f]);return m?(0,t.jsx)(sC,{}):x?(0,t.jsx)("div",{className:"stg:py-8 stg:text-center stg:text-sm stg:text-destructive",children:"Failed to load instances"}):0===v.length?(0,t.jsx)(sv,{onCreateClick:i,className:c}):(0,t.jsxs)("div",{className:(0,h.cn)("stg:space-y-3",c),children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between",children:[(0,t.jsxs)("h3",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:[v.length," ",1===v.length?"instance":"instances"]}),i&&(0,t.jsx)(j.Button,{variant:"outline",size:"xs",icon:(0,t.jsx)(sw,{}),onClick:i,children:"Create instance"})]}),(0,t.jsx)("div",{className:"stg:overflow-hidden stg:rounded-lg stg:border stg:border-border",children:(0,t.jsxs)("table",{className:"stg:w-full stg:table-fixed stg:text-sm",children:[(0,t.jsx)("thead",{children:(0,t.jsxs)("tr",{className:"stg:border-b stg:border-border stg:bg-muted-subtle",children:[(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Name"}),(0,t.jsx)("th",{className:"stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Environments"}),(0,t.jsx)("th",{className:"stg:w-36 stg:px-4 stg:py-2 stg:text-left stg:font-medium stg:text-muted-foreground",children:"Visibility"}),(0,t.jsx)("th",{className:"stg:w-16 stg:px-4 stg:py-2 stg:text-right stg:font-medium stg:text-muted-foreground",children:"Actions"})]})}),(0,t.jsx)("tbody",{className:"stg:divide-y stg:divide-border",children:v.map(e=>(0,t.jsx)(sN,{instance:e,resolveEnvName:y,onRowClick:l,onStartSessionClick:o,onDeleteClick:g,refetch:p},e.metadata?.id))})]})})]})}function sN({instance:e,resolveEnvName:s,onRowClick:n,onStartSessionClick:r,onDeleteClick:a,refetch:i}){let l=e.metadata,o=l?.id??"",d=l?.labels?.["stigmer.ai/personal"]==="true",c=e.spec?.environmentRefs??[],{allowed:u}=(0,C.useCheckPermission)({kind:"agent_instance",id:o},"can_delete"),x=!!r,p=!!a&&u;return(0,t.jsxs)("tr",{className:(0,h.cn)("stg:transition-colors",n&&"stg:cursor-pointer stg:hover:bg-accent-hover"),onClick:()=>n?.(e),children:[(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:(0,t.jsxs)("div",{className:"stg:min-w-0",children:[(0,t.jsxs)("div",{className:"stg:flex stg:min-w-0 stg:items-center stg:gap-2",children:[(0,t.jsx)(E.TruncatedText,{text:l?.name||l?.slug||"—",className:"stg:font-medium stg:text-foreground"}),d&&(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:shrink-0 stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.6rem] stg:font-medium stg:uppercase stg:tracking-wide","stg:bg-muted stg:text-muted-foreground stg:border stg:border-border"),children:"Personal"})]}),e.spec?.description&&(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground stg:truncate",children:e.spec.description})]})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",children:0===c.length?(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"None"}):(0,t.jsx)("div",{className:"stg:flex stg:flex-wrap stg:gap-1",children:c.map((e,n)=>(0,t.jsx)("span",{className:(0,h.cn)("stg:inline-flex stg:items-center stg:rounded-md stg:px-1.5 stg:py-0.5","stg:text-[0.65rem] stg:font-medium","stg:bg-muted stg:text-muted-foreground","stg:border stg:border-border"),children:s(e.slug)},`${e.slug}-${n}`))})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5",onClick:e=>e.stopPropagation(),children:o?(0,t.jsx)(sb.ResourceVisibilityControl,{kind:"agentInstance",resourceId:o,visibility:l?.visibility??q.ApiResourceVisibility.visibility_private,onChanged:i}):(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:"—"})}),(0,t.jsx)("td",{className:"stg:px-4 stg:py-2.5 stg:text-right",onClick:e=>e.stopPropagation(),children:(x||p)&&(0,t.jsxs)(v.ActionMenu,{children:[(0,t.jsx)(v.ActionMenu.Trigger,{className:"stg:ml-auto","aria-label":`Actions for ${l?.name||l?.slug}`,children:(0,t.jsx)(g.MoreHorizontal,{className:"stg:size-4"})}),(0,t.jsxs)(v.ActionMenu.Content,{children:[x&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(tu.Play,{}),onSelect:()=>r?.(e),children:"Start session"}),x&&p&&(0,t.jsx)(v.ActionMenu.Separator,{}),p&&(0,t.jsx)(v.ActionMenu.Item,{icon:(0,t.jsx)(m.Trash2,{}),variant:"destructive",onSelect:()=>a?.(e),children:"Delete"})]})]})})]})}function sC(){return(0,t.jsx)("div",{className:"stg:space-y-2 stg:py-4",children:[1,2,3].map(e=>(0,t.jsx)("div",{className:"stg:h-12 stg:animate-pulse stg:rounded-md stg:bg-muted-faint"},e))})}function sw(){return(0,t.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M6 2v8M2 6h8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}let sS={id:"overview",label:"Overview"},sA={id:"instances",label:"Instances"},sR={id:"shares",label:"Shares"},sM={id:"dependencies",label:"Dependencies"};function sE({org:e,slug:n,onMcpServerClick:r,onSkillClick:a,onResourceLoad:i,primaryAction:l,actions:o,additionalTabs:g,activeTab:d,onTabChange:c,defaultTab:u,editable:m=!1,onResourceUpdated:h,buildShareUrl:x,viewerOrg:p,onCreateInstanceClick:v,onInstanceClick:j,onInstanceStartSessionClick:y,onInstanceDeleteClick:k,instancesRefreshKey:N,className:C}){let w,{agent:S,isLoading:A,error:R,refetch:M}=(0,ti.useAgent)(e,n),{update:E,isUpdating:I}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{update:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agent.update(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isUpdating:t,error:r,clearError:i}}(),[L,$]=(0,s.useState)(null),O=(0,s.useCallback)(async(e,t)=>{if(!S)return!1;$(null);let s=(0,tl.toAgentUpdateInput)(S);s[e]=t;try{let e=await E(s);return h?.(e),M(),!0}catch(t){return $({field:e,message:(0,ee.toError)(t).message}),!1}},[S,E,h,M]),D=(0,s.useCallback)(()=>$(null),[]),{tree:z,isEmpty:P}=function({agentName:e,agentOrg:t,spec:n}){return(0,s.useMemo)(()=>{if(!n)return{tree:null,isEmpty:!0};let{mcpServerUsages:s,skillRefs:r,subAgents:a}=n;if(!(s.length>0||r.length>0||a.length>0))return{tree:null,isEmpty:!0};let i=1;return{tree:{root:{id:`agent:${e}`,kind:"agent",label:e,children:[...s.filter(e=>e.mcpServerRef).map(e=>{i++;let s=e.mcpServerRef,n=e.enabledTools.length;return{id:`mcp-server:${s.slug}`,kind:"mcp-server",label:s.slug,qualifiedLabel:s.org&&s.org!==t?`${s.org}/${s.slug}`:void 0,metadata:{tools:n>0?`${n} ${1===n?"tool":"tools"}`:"all tools"},children:[],ref:{org:s.org||t,slug:s.slug}}}),...r.map(e=>(i++,{id:`skill:${e.slug}`,kind:"skill",label:e.slug,qualifiedLabel:e.org&&e.org!==t?`${e.org}/${e.slug}`:void 0,children:[],ref:{org:e.org||t,slug:e.slug}})),...a.map(e=>{i++;let s=e.mcpAccess.map(s=>{i++;let n=s.enabledTools.length;return{id:`sub-agent:${e.name}:mcp-server:${s.mcpServer}`,kind:"mcp-server",label:s.mcpServer,metadata:{tools:n>0?`${n} ${1===n?"tool":"tools"}`:"all tools"},children:[],ref:{org:t,slug:s.mcpServer}}}),n=e.skillRefs.map(s=>(i++,{id:`sub-agent:${e.name}:skill:${s.slug}`,kind:"skill",label:s.slug,qualifiedLabel:s.org&&s.org!==t?`${s.org}/${s.slug}`:void 0,children:[],ref:{org:s.org||t,slug:s.slug}})),r={};return e.modelOverride&&(r.model=e.modelOverride),{id:`sub-agent:${e.name}`,kind:"sub-agent",label:e.name,description:e.description||void 0,metadata:Object.keys(r).length>0?r:void 0,children:[...s,...n]}})]},nodeCount:i},isEmpty:!1}},[e,t,n])}({agentName:S?.metadata?.name||S?.metadata?.slug||n,agentOrg:S?.metadata?.org||e,spec:S?.spec}),B=(0,s.useMemo)(()=>P?[sS,sA,sR]:[sS,sA,sR,sM],[P]),{effectiveTabs:W,effectiveActiveTab:_,effectiveOnTabChange:F,activeAdditionalTab:H}=(0,t7.useDetailTabs)({builtInTabs:B,additionalTabs:g,activeTab:d,onTabChange:c,defaultTab:u}),V=(0,s.useCallback)(e=>{e.ref&&("mcp-server"===e.kind?r?.(e.ref):"skill"===e.kind&&a?.(e.ref))},[r,a]),q=(0,s.useRef)(i);q.current=i,(0,s.useEffect)(()=>{S?.metadata?.name&&q.current?.({name:S.metadata.name,id:S.metadata.id})},[S]);let Y=(0,b.useManageAccess)({resource:S?.metadata?{kind:f.ApiResourceKind.agent,kindString:"agent",id:S.metadata.id,org:S.metadata.org,name:S.metadata.name}:null,visibility:S?.metadata?{kind:"agent",current:S.metadata.visibility,org:S.metadata.org,onChanged:M}:void 0});if(A)return(0,t.jsx)(sP,{className:C});if(R)return(0,t.jsx)(to.ErrorMessage,{error:R,retry:M,className:C});if(!S)return(0,t.jsx)(sB,{className:C});let K=S.metadata,G=S.spec,X=S.status?.audit?.specAudit,J=K?.org||e,Z={name:K?.name||K?.slug||"Untitled",id:K?.id||"",org:K?.org,slug:K?.slug,description:void 0,iconUrl:m?void 0:G?.iconUrl,icon:m?(0,t.jsx)(sd.InlineEditImage,{value:G?.iconUrl??"",onSave:e=>O("iconUrl",e||void 0),isSaving:I,fallback:(0,t.jsx)(sU,{className:"stg:size-6 stg:text-muted-foreground"}),disabled:!m}):G?.iconUrl?void 0:(0,t.jsx)(sU,{className:"stg:size-6 stg:text-muted-foreground"}),createdAt:X?.createdAt?(0,T.timestampDate)(X.createdAt):null,updatedAt:X?.updatedAt?(0,T.timestampDate)(X.updatedAt):null},Q=K?(0,t.jsx)(tg.VisibilityBadge,{visibility:K.visibility,onClick:Y.action?Y.open:void 0}):void 0,et=[...o??[],...[{id:"share",label:"Share",group:"sharing",onAction:()=>F(sR.id)},Y.action].filter(e=>null!=e)];return w=H?H.content:"instances"===_?(0,t.jsx)(sk,{agentId:K?.id??"",defaultInstanceId:S.status?.defaultInstanceId,org:e,viewerOrg:p,onCreateClick:v,onInstanceClick:j,onStartSessionClick:y,onDeleteClick:k,refreshKey:N}):"shares"===_?(0,t.jsx)(t0,{agent:S,viewerOrg:p,buildShareUrl:x}):"dependencies"===_&&z?(0,t.jsx)(sl,{tree:z,onNodeClick:V}):(0,t.jsx)(sT,{spec:G,agentOrg:J,description:G?.description,onMcpServerClick:r,onSkillClick:a,editable:m,isSaving:I,saveField:O,saveError:L,clearSaveError:D}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(t8.ResourceDetailShell,{header:Z,visibilityControl:Q,primaryAction:l,actions:et,tabs:W,activeTab:W?_:void 0,onTabChange:W?F:void 0,tabsAriaLabel:"Agent detail sections",className:C,children:w}),Y.dialog]})}function sT({spec:e,agentOrg:n,description:r,onMcpServerClick:a,onSkillClick:i,editable:l,isSaving:o,saveField:g,saveError:d,clearSaveError:c}){let u=e=>d?.field===e?d.message:void 0,m=(0,s.useCallback)(async e=>g?.("instructions",e||void 0)??!1,[g]),h=(0,s.useCallback)(async e=>g?.("mcpServerUsages",e.map(e=>({mcpServerRef:{org:e.org,slug:e.slug}})))??!1,[g]),x=(0,s.useCallback)(async e=>g?.("skillRefs",e.map(e=>({org:e.org,slug:e.slug})))??!1,[g]),p=(0,s.useCallback)(async e=>{let t={};for(let s of e)s.key.trim()&&(t[s.key.trim()]={isSecret:s.isSecret||void 0,description:s.description||void 0,optional:s.optional||void 0});return g?.("env",Object.keys(t).length>0?t:void 0)??!1},[g]),f=(0,s.useMemo)(()=>(e?.mcpServerUsages??[]).map(e=>({org:e.mcpServerRef?.org||n,slug:e.mcpServerRef?.slug??"",label:e.mcpServerRef?.org&&e.mcpServerRef.org!==n?`${e.mcpServerRef.org}/${e.mcpServerRef.slug}`:e.mcpServerRef?.slug??""})),[e?.mcpServerUsages,n]),b=(0,s.useMemo)(()=>(e?.skillRefs??[]).map(e=>({org:e.org||n,slug:e.slug,label:e.org&&e.org!==n?`${e.org}/${e.slug}`:e.slug})),[e?.skillRefs,n]),v=(0,s.useMemo)(()=>Object.entries(e?.env??{}).sort(([e],[t])=>e.localeCompare(t)).map(([e,t])=>({key:e,value:"",isSecret:t.isSecret,description:t.description,optional:t.optional})),[e?.env]),j=l||!!r,y=l||!!e?.instructions,k=l||e&&e.mcpServerUsages.length>0,N=l||e&&e.skillRefs.length>0,C=l||e&&e.subAgents.length>0,w=l||e?.env&&Object.keys(e.env).length>0,[S,A]=(0,s.useState)(!1),[R,M]=(0,s.useState)(!1),[E,T]=(0,s.useState)(!1),I=(0,s.useCallback)(e=>{e&&c?.(),A(e)},[c]),L=(0,s.useCallback)(e=>{e&&c?.(),M(e)},[c]),$=(0,s.useCallback)(e=>{e&&c?.(),T(e)},[c]);return(0,t.jsxs)("div",{className:"stg:flex stg:flex-col stg:gap-6",children:[j&&(0,t.jsx)(t9.Section,{title:"Description",children:l?(0,t.jsx)("div",{className:"stg:max-h-20 stg:overflow-y-auto stg:p-3",children:(0,t.jsx)(sg.InlineEditTextarea,{value:e?.description||"",onSave:e=>g?.("description",e||void 0)??Promise.resolve(!1),isSaving:o,error:u("description"),placeholder:"Add a description",minRows:2})}):(0,t.jsx)("div",{className:"stg:p-3",children:(0,t.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:text-sm stg:text-foreground stg:font-sans",children:r})})}),y&&(0,t.jsx)(t9.Section,{title:"Instructions",children:l?(0,t.jsx)("div",{className:"stg:max-h-72 stg:overflow-y-auto stg:p-3",children:(0,t.jsx)(sg.InlineEditTextarea,{value:e?.instructions??"",onSave:m,isSaving:o,error:u("instructions"),placeholder:"Add instructions for the agent",minRows:4})}):(0,t.jsx)(sI,{text:e?.instructions??""})}),k&&(0,t.jsx)(t9.Section,{title:"MCP Servers",count:e?.mcpServerUsages.length,onEdit:l?()=>I(!S):void 0,children:l?(0,t.jsx)(su,{value:f,onSave:h,isSaving:o,error:u("mcpServerUsages"),editing:S,onEditingChange:I,onItemClick:a?e=>a({org:e.org,slug:e.slug}):void 0,itemIcon:(0,t.jsx)(sW,{className:"stg:size-4"}),resourceLabel:"MCP server",defaultOrg:n}):(0,t.jsx)(sL,{usages:e?.mcpServerUsages??[],defaultOrg:n,onMcpServerClick:a})}),N&&(0,t.jsx)(t9.Section,{title:"Skills",count:e?.skillRefs.length,onEdit:l?()=>L(!R):void 0,children:l?(0,t.jsx)(su,{value:b,onSave:x,isSaving:o,error:u("skillRefs"),editing:R,onEditingChange:L,onItemClick:i?e=>i({org:e.org,slug:e.slug}):void 0,itemIcon:(0,t.jsx)(s_,{className:"stg:size-4"}),resourceLabel:"skill",defaultOrg:n}):(0,t.jsx)(s$,{refs:e?.skillRefs??[],defaultOrg:n,onSkillClick:i})}),C&&(0,t.jsx)(sO,{subAgents:e?.subAgents??[],editable:l,isSaving:o,error:u("subAgents"),onSave:e=>g?.("subAgents",e.length>0?e:void 0)??Promise.resolve(!1)}),w&&(0,t.jsx)(t9.Section,{title:"Environment Variables",count:Object.keys(e?.env??{}).length,onEdit:l?()=>$(!E):void 0,children:l?(0,t.jsx)(sc.InlineEditKeyValue,{value:v,onSave:p,isSaving:o,error:u("env"),editing:E,onEditingChange:$,showSecretToggle:!0,showOptionalToggle:!0,showDescription:!0,keyLabel:"Variable name"}):(0,t.jsx)(sz,{data:e?.env??{}})})]})}function sI({text:e}){let[n,r]=(0,s.useState)(!1),a=(0,s.useRef)(null),[i,l]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let e=a.current;e&&l(e.scrollHeight>e.clientHeight)},[e]),(0,t.jsxs)("div",{className:"stg:relative stg:p-3",children:[(0,t.jsx)("pre",{ref:a,className:(0,h.cn)("stg:whitespace-pre-wrap stg:break-words stg:font-mono stg:text-sm stg:text-foreground stg:overflow-y-auto stg:transition-[max-height] stg:duration-200",!n&&"stg:overflow-hidden"),style:{maxHeight:n?"none":"12rem"},children:e}),!n&&i&&(0,t.jsx)("div",{className:"stg:pointer-events-none stg:absolute stg:inset-x-3 stg:bottom-10 stg:h-8 stg:bg-gradient-to-t stg:from-background stg:to-transparent"}),i&&(0,t.jsx)("button",{type:"button",onClick:()=>r(e=>!e),className:"stg:mt-2 stg:text-xs stg:font-medium stg:text-primary stg:transition-colors stg:hover:text-primary-muted",children:n?"Show less":"Show more"})]})}function sL({usages:e,defaultOrg:s,onMcpServerClick:n}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let a=e.mcpServerRef;if(!a)return null;let i=a.org||s,l=a.org&&a.org!==s?`${a.org}/${a.slug}`:a.slug,o=e.enabledTools.length,g=e.toolApprovalOverrides.length,d=[o>0?`${o} ${1===o?"tool":"tools"}`:"all tools",g>0?`${g} approval ${1===g?"override":"overrides"}`:""].filter(Boolean).join(" · "),c=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(sW,{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:l}),(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:d})]});return n?(0,t.jsx)("button",{type:"button",onClick:()=>n({org:i,slug:a.slug}),className:(0,h.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:c},a.slug||r):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2",children:c},a.slug||r)})})}function s$({refs:e,defaultOrg:s,onSkillClick:n}){return(0,t.jsx)("div",{className:"stg:flex stg:flex-col",children:e.map((e,r)=>{let a=e.org||s,i=e.org&&e.org!==s?`${e.org}/${e.slug}`:e.slug,l=(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-3",children:[(0,t.jsx)(s_,{className:"stg:size-4 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:i})]});return n?(0,t.jsx)("button",{type:"button",onClick:()=>n({org:a,slug:e.slug}),className:(0,h.cn)("stg:w-full stg:rounded-md stg:px-3 stg:py-2 stg:text-left stg:transition-colors","stg:hover:bg-accent-hover","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-inset stg:focus-visible:ring-ring"),children:l},e.slug||r):(0,t.jsx)("div",{className:"stg:px-3 stg:py-2",children:l},e.slug||r)})})}function sO({subAgents:e,editable:n,isSaving:r,error:a,onSave:i}){let[l,o]=(0,s.useState)(new Set),[g,d]=(0,s.useState)(!1),[c,u]=(0,s.useState)(!1),[m,x]=(0,s.useState)({name:"",description:"",instructions:""}),p=(0,s.useCallback)(async t=>{if(!i)return;let s=e.filter((e,s)=>s!==t).map(e=>({name:e.name,description:e.description||void 0,instructions:e.instructions||void 0,mcpAccess:e.mcpAccess.length>0?e.mcpAccess.map(e=>({mcpServer:e.mcpServer,enabledTools:e.enabledTools.length>0?[...e.enabledTools]:void 0})):void 0,skillRefs:e.skillRefs.length>0?e.skillRefs.map(e=>({org:e.org||"",slug:e.slug})):void 0,modelOverride:e.modelOverride||void 0}));await i(s)},[e,i]),f=(0,s.useCallback)(async()=>{if(!i||!m.name.trim())return;let t=e.map(e=>({name:e.name,description:e.description||void 0,instructions:e.instructions||void 0,mcpAccess:e.mcpAccess.length>0?e.mcpAccess.map(e=>({mcpServer:e.mcpServer,enabledTools:e.enabledTools.length>0?[...e.enabledTools]:void 0})):void 0,skillRefs:e.skillRefs.length>0?e.skillRefs.map(e=>({org:e.org||"",slug:e.slug})):void 0,modelOverride:e.modelOverride||void 0})),s={name:m.name.trim(),description:m.description.trim()||void 0,instructions:m.instructions.trim()||void 0};await i([...t,s])&&(x({name:"",description:"",instructions:""}),u(!1))},[e,m,i]);return(0,t.jsx)(t9.Section,{title:"Sub-Agents",count:e.length,onEdit:n?()=>d(e=>!e):void 0,children:(0,t.jsxs)("div",{className:"stg:flex stg:flex-col",children:[e.length>0?(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:e.map((e,s)=>{let n=l.has(s);return(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3 stg:px-3 stg:py-2.5",children:[(0,t.jsxs)("button",{type:"button",onClick:()=>{o(e=>{let t=new Set(e);return t.has(s)?t.delete(s):t.add(s),t})},"aria-expanded":n,className:(0,h.cn)("stg:flex stg:flex-1 stg:items-start stg:gap-3 stg:text-left","stg:focus-visible:outline-none"),children:[(0,t.jsx)(sF,{className:(0,h.cn)("stg:mt-0.5 stg:size-4 stg:shrink-0 stg:text-muted-foreground stg:transition-transform",n&&"stg:rotate-90")}),(0,t.jsxs)("div",{className:"stg:min-w-0 stg:flex-1",children:[(0,t.jsx)("span",{className:"stg:text-sm stg:font-medium stg:text-foreground",children:e.name}),e.description&&(0,t.jsx)("p",{className:"stg:mt-0.5 stg:text-xs stg:text-muted-foreground",children:e.description})]})]}),g&&(0,t.jsx)("button",{type:"button",onClick:()=>p(s),disabled:r,"aria-label":`Remove ${e.name}`,className:(0,h.cn)("stg:mt-0.5 stg:inline-flex stg:size-6 stg:items-center stg:justify-center stg:rounded-md stg:text-muted-foreground","stg:hover:bg-destructive-subtle stg:hover:text-destructive","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:(0,t.jsx)(sH,{className:"stg:size-3.5"})})]}),n&&(0,t.jsx)(sD,{subAgent:e})]},e.name||s)})}):(0,t.jsx)("p",{className:"stg:px-3 stg:py-3 stg:text-xs stg:text-muted-foreground stg:italic",children:"No sub-agents configured"}),n&&g&&!c&&(0,t.jsx)("div",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2",children:(0,t.jsxs)("button",{type:"button",onClick:()=>u(!0),className:(0,h.cn)("stg:inline-flex stg:items-center stg:gap-1 stg:rounded-md stg:px-2.5 stg:py-1.5 stg:text-xs stg:font-medium","stg:border stg:border-dashed stg:border-border stg:text-muted-foreground","stg:hover:border-muted-foreground stg:hover:text-foreground stg:hover:bg-muted-subtle","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring","stg:transition-colors"),children:[(0,t.jsx)(sV,{className:"stg:size-3"}),"Add sub-agent"]})}),a&&(0,t.jsx)("p",{className:"stg:border-t stg:border-border stg:px-3 stg:py-2 stg:text-xs stg:text-destructive",role:"alert",children:a}),n&&c&&(0,t.jsxs)("div",{className:"stg:border-t stg:border-border stg:p-3 stg:space-y-2",children:[(0,t.jsx)("input",{type:"text",value:m.name,onChange:e=>x(t=>({...t,name:e.target.value})),placeholder:"Sub-agent name (required)",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-sm stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("input",{type:"text",value:m.description,onChange:e=>x(t=>({...t,description:e.target.value})),placeholder:"Description (optional)",className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsx)("textarea",{value:m.instructions,onChange:e=>x(t=>({...t,instructions:e.target.value})),placeholder:"Instructions (optional)",rows:2,className:(0,h.cn)("stg:w-full stg:resize-y stg:rounded-md stg:border stg:border-border stg:bg-input-bg stg:px-2 stg:py-1.5 stg:font-mono stg:text-xs stg:text-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring")}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-1.5",children:[(0,t.jsx)("button",{type:"button",onClick:()=>{u(!1),x({name:"",description:"",instructions:""})},className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:border stg:border-border stg:bg-background stg:text-foreground stg:hover:bg-accent","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Cancel"}),(0,t.jsx)("button",{type:"button",onClick:f,disabled:!m.name.trim()||r,className:(0,h.cn)("stg:rounded-md stg:px-2.5 stg:py-1 stg:text-xs stg:font-medium","stg:bg-primary stg:text-primary-foreground stg:hover:bg-primary-hover","stg:disabled:opacity-50","stg:focus-visible:outline-none stg:focus-visible:ring-2 stg:focus-visible:ring-ring"),children:"Add"})]})]})]})})}function sD({subAgent:e}){return(0,t.jsxs)("div",{className:"stg:mb-1 stg:ml-7 stg:space-y-3 stg:border-l stg:border-border stg:pl-4 stg:pt-1",children:[e.instructions&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Instructions"}),(0,t.jsx)("pre",{className:"stg:whitespace-pre-wrap stg:break-words stg:rounded-md stg:bg-muted-subtle stg:p-2 stg:font-mono stg:text-xs stg:text-foreground",children:e.instructions})]}),e.mcpAccess.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"MCP Access"}),(0,t.jsx)("div",{className:"stg:space-y-1",children:e.mcpAccess.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-foreground",children:[(0,t.jsx)(sW,{className:"stg:size-3 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{className:"stg:font-medium",children:e.mcpServer}),(0,t.jsx)("span",{className:"stg:text-muted-foreground",children:e.enabledTools.length>0?`${e.enabledTools.length} ${1===e.enabledTools.length?"tool":"tools"}`:"all tools"})]},e.mcpServer))})]}),e.skillRefs.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Skills"}),(0,t.jsx)("div",{className:"stg:space-y-1",children:e.skillRefs.map(e=>(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:gap-2 stg:text-xs stg:text-foreground",children:[(0,t.jsx)(s_,{className:"stg:size-3 stg:shrink-0 stg:text-muted-foreground"}),(0,t.jsx)("span",{children:e.org?`${e.org}/${e.slug}`:e.slug})]},e.slug))})]}),e.modelOverride&&(0,t.jsxs)("div",{children:[(0,t.jsx)("h4",{className:"stg:mb-1 stg:text-xs stg:font-medium stg:text-muted-foreground",children:"Model Override"}),(0,t.jsx)("span",{className:"stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:font-mono stg:text-xs stg:text-foreground",children:e.modelOverride})]})]})}function sz({data:e}){let s=Object.entries(e).sort(([e],[t])=>e.localeCompare(t));return(0,t.jsx)("div",{className:"stg:flex stg:flex-col stg:divide-y stg:divide-border",children:s.map(([e,s])=>(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3 stg:px-3 stg:py-2",children:[(0,t.jsx)("code",{className:"stg:shrink-0 stg:font-mono stg:text-sm stg:font-medium stg:text-foreground",children:e}),(0,t.jsx)("span",{className:"stg:shrink-0 stg:rounded stg:bg-muted stg:px-1.5 stg:py-0.5 stg:text-[10px] stg:font-medium stg:text-muted-foreground",children:s.isSecret?"secret":"config"}),s.description&&(0,t.jsx)("span",{className:"stg:text-xs stg:text-muted-foreground",children:s.description})]},e))})}function sP({className:e}){return(0,t.jsxs)("div",{className:(0,h.cn)("stg:flex stg:flex-col stg:gap-6",e),"aria-busy":"true","aria-label":"Loading agent details",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-start stg:gap-3",children:[(0,t.jsx)("div",{className:"stg:mt-1 stg:size-6 stg:shrink-0 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsxs)("div",{className:"stg:flex-1 stg:space-y-2",children:[(0,t.jsx)("div",{className:"stg:h-5 stg:w-48 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-3 stg:w-64 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:h-4 stg:w-full stg:max-w-md stg:animate-pulse stg:rounded stg:bg-muted"})]})]}),[40,24,16].map(e=>(0,t.jsxs)("div",{className:"stg:space-y-2",children:[(0,t.jsx)("div",{className:"stg:h-3 stg:w-24 stg:animate-pulse stg:rounded stg:bg-muted"}),(0,t.jsx)("div",{className:"stg:animate-pulse stg:rounded-lg stg:border stg:border-border stg:bg-muted-faint",style:{height:`${4*e}px`}})]},e))]})}function sB({className:e}){return(0,t.jsxs)("div",{role:"status",className:(0,h.cn)("stg:flex stg:flex-col stg:items-center stg:gap-2 stg:py-12 stg:text-center",e),children:[(0,t.jsx)(sU,{className:"stg:size-10 stg:text-muted-foreground-faint"}),(0,t.jsx)("p",{className:"stg:text-sm stg:font-medium stg:text-muted-foreground",children:"Agent not found"}),(0,t.jsx)("p",{className:"stg:text-xs stg:text-muted-foreground-subtle",children:"This agent doesn't exist or you don't have access to it."})]})}function sU({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"3",y:"5",width:"10",height:"8",rx:"1.5"}),(0,t.jsx)("path",{d:"M6 9h.01M10 9h.01",strokeWidth:"2"}),(0,t.jsx)("path",{d:"M8 2v3"})]})}function sW({className:e}){return(0,t.jsxs)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[(0,t.jsx)("rect",{x:"2",y:"2",width:"12",height:"5",rx:"1"}),(0,t.jsx)("rect",{x:"2",y:"9",width:"12",height:"5",rx:"1"}),(0,t.jsx)("circle",{cx:"5",cy:"4.5",r:"0.75",fill:"currentColor",stroke:"none"}),(0,t.jsx)("circle",{cx:"5",cy:"11.5",r:"0.75",fill:"currentColor",stroke:"none"})]})}function s_({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M9 1.5 4 9h4l-1 5.5L12 7H8l1-5.5Z"})})}function sF({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m6 3 5 5-5 5"})})}function sH({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"m4 4 8 8M12 4l-8 8"})})}function sV({className:e}){return(0,t.jsx)("svg",{className:e,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M8 3v10M3 8h10"})})}var sq=e.i(330815);function sY({open:e,onOpenChange:n,org:r,agentId:a,onCreated:i}){let{create:l,isCreating:o,error:g,clearError:d}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{create:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentInstance.create(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isCreating:t,error:r,clearError:i}}(),c=(0,s.useId)(),u=`${c}-title`,m=`${c}-name`,p=`${c}-description`,[f,b]=(0,s.useState)(""),[v,j]=(0,s.useState)(""),[y,k]=(0,s.useState)([]),[N,C]=(0,s.useState)(q.ApiResourceVisibility.visibility_private),w=(0,s.useCallback)(()=>{b(""),j(""),k([]),C(q.ApiResourceVisibility.visibility_private),d()},[d]),S=(0,s.useCallback)(()=>{n(!1),w()},[n,w]),A=(0,s.useCallback)(e=>{e||S()},[S]),R=(0,s.useCallback)(async e=>{if(e.preventDefault(),f.trim())try{let e=await l({name:f.trim(),org:r,agentId:a,description:v.trim()||void 0,environmentRefs:y.length>0?y:void 0,visibility:N});i?.(e),S()}catch{}},[f,r,a,v,y,N,l,i,S]);return(0,t.jsx)($.DialogShell,{open:e,onOpenChange:A,width:"lg","aria-labelledby":u,children:(0,t.jsxs)("form",{onSubmit:R,className:"stg:flex stg:flex-col",children:[(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-between stg:border-b stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsx)("h2",{id:u,className:"stg:text-base stg:font-semibold stg:text-foreground",children:"Create Agent Instance"}),(0,t.jsx)("button",{type:"button",onClick:S,"aria-label":"Close",className:(0,h.cn)("stg:rounded-md stg:p-1 stg:text-muted-foreground","stg:hover:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring"),children:(0,t.jsx)(sK,{})})]}),(0,t.jsxs)("div",{className:"stg:space-y-5 stg:px-6 stg:py-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("label",{htmlFor:m,className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:["Name ",(0,t.jsx)("span",{className:"stg:text-destructive",children:"*"})]}),(0,t.jsx)("input",{id:m,type:"text",required:!0,value:f,onChange:e=>b(e.target.value),placeholder:"e.g. prod, staging, qa-team",disabled:o,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm","stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),autoFocus:!0}),(0,t.jsx)("p",{className:"stg:mt-1 stg:text-[0.65rem] stg:text-muted-foreground",children:"A URL-friendly slug will be generated from this name."})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{htmlFor:p,className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Description"}),(0,t.jsx)("textarea",{id:p,value:v,onChange:e=>j(e.target.value),placeholder:"What is this instance used for?",disabled:o,rows:2,className:(0,h.cn)("stg:w-full stg:rounded-md stg:border stg:border-border stg:bg-background stg:px-3 stg:py-2 stg:text-sm stg:resize-none","stg:text-foreground stg:placeholder:text-muted-foreground","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50")})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Environments"}),(0,t.jsx)("p",{className:"stg:text-[0.65rem] stg:text-muted-foreground stg:mb-2",children:"Bind credentials and configuration to this instance."}),(0,t.jsx)(Y.EnvironmentPicker,{org:r,value:y,onChange:k,disabled:o})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"stg:block stg:text-sm stg:font-medium stg:text-foreground stg:mb-1.5",children:"Visibility"}),(0,t.jsx)(sq.InstanceVisibilitySelector,{visibility:N,onVisibilityChange:C,mode:"create",disabled:o})]}),g&&(0,t.jsx)("div",{className:"stg:rounded-md stg:bg-destructive/10 stg:px-3 stg:py-2 stg:text-sm stg:text-destructive",role:"alert",children:(0,x.getUserMessage)(g)})]}),(0,t.jsxs)("div",{className:"stg:flex stg:items-center stg:justify-end stg:gap-2 stg:border-t stg:border-border stg:px-6 stg:py-4",children:[(0,t.jsx)("button",{type:"button",onClick:S,disabled:o,className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:text-foreground stg:hover:bg-accent-hover","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",disabled:o||!f.trim(),className:(0,h.cn)("stg:rounded-md stg:px-3 stg:py-1.5 stg:text-sm stg:font-medium","stg:bg-primary stg:text-primary-foreground","stg:hover:bg-primary/90","stg:focus:outline-none stg:focus:ring-2 stg:focus:ring-ring stg:focus:ring-offset-2","stg:disabled:cursor-not-allowed stg:disabled:opacity-50"),children:o?"Creating...":"Create Instance"})]})]})})}function sK(){return(0,t.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,t.jsx)("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}var sG=e.i(582321),sX=e.i(352371),sJ=e.i(310057),sZ=e.i(297629),sQ=e.i(451241),s0=e.i(107141),s1=e.i(901352),s2=e.i(472402);function s5({org:e,slug:a}){let i=(0,n.useRouter)(),{setLabel:l}=(0,sJ.useBreadcrumbOverride)(),o=(0,sZ.useActiveOrgSlug)(),{navigateToDetail:g}=(0,sQ.useLibraryNavigation)(),[d,c]=(0,s.useState)(null),[u,m]=(0,s.useState)("Agent"),{copyId:h,copyQualifiedSlug:x}=(0,tp.useCopyResource)(),{confirmState:p,confirm:f,handleConfirm:b,handleCancel:v}=(0,S.useConfirmAction)(),{deleteResource:j,isDeleting:y}=(0,sG.useDeleteResource)("agent",d,u),{deleteInstance:k}=function(){let e=(0,U.useStigmer)(),[t,n]=(0,s.useState)(!1),[r,a]=(0,s.useState)(null),i=(0,s.useCallback)(()=>a(null),[]);return{deleteInstance:(0,s.useCallback)(async t=>{n(!0),a(null);try{return await e.agentInstance.delete(t)}catch(e){throw a((0,ee.toError)(e)),e}finally{n(!1)}},[e]),isDeleting:t,error:r,clearError:i}}(),{agent:N,refetch:C}=(0,ti.useAgent)(e,a),{copyYaml:R,copyJson:M,downloadYaml:E}=(0,sX.useExportResource)({kind:"Agent",resource:N}),[T,I]=(0,s.useState)(!1),[L,$]=(0,s.useState)(!1),[O,D]=(0,s.useState)(0),[z,P]=(0,s.useState)(()=>new URLSearchParams(window.location.search).get("tab")??void 0??"overview"),B=(0,s.useMemo)(()=>N?[{id:"channels",label:"Channels",content:(0,t.jsx)(e7,{agent:N,channelAppsHref:"/settings/channel-apps",sessionHref:e=>`/sessions/${e}`})}]:[],[N]);(0,s.useEffect)(()=>()=>l(null),[l]);let W=(0,s.useCallback)(({name:e,id:t})=>{l(e),c(t),m(e)},[l]),_=(0,s.useCallback)(async()=>{if(await f({title:`Delete ${u}?`,description:"This permanently removes the agent and all of its instances. Past sessions and executions are preserved. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive"}))try{await j(),i.push("/library/agents")}catch{}},[f,j,i,u]),F=(0,s.useMemo)(()=>({id:"start-session",label:"Start session",onAction:()=>i.push((0,s1.getAgentSessionUrl)(e,a))}),[i,e,a]),H=(0,s.useCallback)((e,t)=>`${(0,s2.getAppBaseUrl)()}/chat/${e}/${t}`,[]),V=(0,s.useCallback)(t=>{let s=t.metadata?.id;i.push((0,s1.getAgentSessionUrl)(e,a,s))},[i,e,a]),q=(0,s.useCallback)(async e=>{let t=e.metadata?.name||e.metadata?.slug||"this instance";if(!await f({title:`Delete ${t}?`,description:"This permanently removes the instance and its environment bindings. Sessions already started against it are preserved. This action cannot be undone.",confirmLabel:"Delete",variant:"destructive"}))return;let s=e.metadata?.id;if(s)try{await k(s),r.toast.success("Instance deleted"),D(e=>e+1)}catch{r.toast.error("Failed to delete instance")}},[f,k]),Y=(0,s.useMemo)(()=>[{id:"copy-id",label:"Copy ID",group:"clipboard",onAction:()=>{d&&h(d)},disabled:!d},{id:"copy-slug",label:"Copy slug",group:"clipboard",onAction:()=>x(e,a)},{id:"edit-yaml",label:"Edit YAML",group:"export",onAction:()=>I(!0),disabled:!N},{id:"export-yaml",label:"Export YAML",group:"export",onAction:R,disabled:!N},{id:"export-json",label:"Export JSON",group:"export",onAction:M,disabled:!N},{id:"download-yaml",label:"Download YAML",group:"export",onAction:E,disabled:!N},{id:"delete",label:"Delete",variant:"destructive",group:"danger",onAction:_,disabled:y}],[d,h,x,e,a,R,M,E,N,_,y]);return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(sE,{org:e,slug:a,onResourceLoad:W,onMcpServerClick:({org:e,slug:t})=>g("mcp-servers",e,t),onSkillClick:({org:e,slug:t})=>g("skills",e,t),editable:!0,primaryAction:F,actions:Y,buildShareUrl:H,viewerOrg:o,additionalTabs:B,activeTab:z,onTabChange:P,onCreateInstanceClick:()=>$(!0),onInstanceStartSessionClick:V,onInstanceDeleteClick:q,instancesRefreshKey:O}),(0,t.jsx)(A.EditResourceYamlDialog,{open:T,onOpenChange:I,resource:N,onApplied:C}),(0,t.jsx)(w.ConfirmDialog,{state:p,onConfirm:b,onCancel:v}),d&&(0,t.jsx)(sY,{open:L,onOpenChange:$,org:e,agentId:d,onCreated:()=>{r.toast.success("Instance created"),D(e=>e+1)}})]})}e.s(["AgentDetailPage",0,function(){let e=(0,sQ.useRouteDetailYieldsToOverlay)(),s=(0,s0.useStaticRouteParam)("org",2),n=(0,s0.useStaticRouteParam)("slug");return!e&&s&&n?(0,t.jsx)(s5,{org:s,slug:n}):null},"AgentDetailPageInner",0,s5],63353)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,567047,e=>{"use strict";var t=e.i(843476),s=e.i(271645),r=e.i(618566),n=e.i(55389),c=e.i(297629),a=e.i(102508);function o(){try{return null!=window.opener&&!window.opener.closed}catch{return!1}}function i(){let e=(0,r.useRouter)(),i=(0,r.useSearchParams)(),u=(0,c.useActiveOrgSlug)(),{handleCallback:d,isLoading:l}=(0,n.useGitHubConnection)(u||null),m=i.get("code"),x=i.get("state"),h=!m||!x,[f,g]=(0,s.useState)(h?"Missing authorization code or state parameter":null),p=(0,s.useRef)(!1),[j]=(0,s.useState)(o),b=(0,s.useCallback)(()=>{if(j){try{window.opener?.postMessage({type:n.GITHUB_CALLBACK_MESSAGE_TYPE},window.location.origin)}catch{}window.close()}else e.replace("/")},[j,e]),w=(0,s.useCallback)(e=>{g(e instanceof Error?e.message:"Failed to connect GitHub account")},[]);return((0,s.useEffect)(()=>{h||p.current||!u||l||(p.current=!0,d(m,x,`${window.location.origin}/auth/github/callback`).then(b).catch(w))},[m,x,h,u,l,d,b,w]),f)?(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsxs)("div",{className:"max-w-md space-y-4 text-center",children:[(0,t.jsx)("p",{className:"text-sm text-destructive",children:f}),j?(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:"You can close this window and try again."}):(0,t.jsx)(a.Button,{onClick:()=>e.replace("/"),children:"Back to Home"})]})}):(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-muted-foreground border-t-foreground mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:"Connecting your GitHub account..."})]})})}function u({message:e}){return(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsxs)("div",{className:"text-center space-y-2",children:[(0,t.jsx)("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-muted-foreground border-t-foreground mx-auto"}),(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:e??"Loading..."})]})})}function d(){return"desktop"===(0,r.useSearchParams)().get("source")?(0,t.jsx)(l,{}):(0,t.jsx)(i,{})}function l(){let e=(0,r.useSearchParams)(),n=e.get("code"),c=e.get("state");return((0,s.useEffect)(()=>{if(!n||!c)return;let e=`stigmer://github/callback?code=${encodeURIComponent(n)}&state=${encodeURIComponent(c)}`;window.location.href=e},[n,c]),n&&c)?(0,t.jsx)(u,{message:"Redirecting to Stigmer Desktop..."}):(0,t.jsx)("div",{className:"flex h-screen items-center justify-center",children:(0,t.jsx)("p",{className:"text-sm text-destructive",children:"Missing authorization code or state parameter."})})}e.s(["default",0,function(){return(0,t.jsx)(s.Suspense,{fallback:(0,t.jsx)(u,{}),children:(0,t.jsx)(d,{})})}],567047)}]);