botmancers 0.9.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +5 -5
  3. package/app/.next/BUILD_ID +1 -1
  4. package/app/.next/app-path-routes-manifest.json +2 -0
  5. package/app/.next/build-manifest.json +6 -6
  6. package/app/.next/prerender-manifest.json +3 -3
  7. package/app/.next/required-server-files.json +2 -2
  8. package/app/.next/routes-manifest.json +14 -0
  9. package/app/.next/server/app/_global-error/page/build-manifest.json +3 -3
  10. package/app/.next/server/app/_global-error.html +1 -1
  11. package/app/.next/server/app/_global-error.rsc +1 -1
  12. package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  13. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  14. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  15. package/app/.next/server/app/_not-found/page/build-manifest.json +3 -3
  16. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  17. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/app/.next/server/app/_not-found.html +1 -1
  19. package/app/.next/server/app/_not-found.rsc +2 -2
  20. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  21. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  22. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  23. package/app/.next/server/app/agents/[id]/activity/page/build-manifest.json +3 -3
  24. package/app/.next/server/app/agents/[id]/activity/page.js.nft.json +1 -1
  25. package/app/.next/server/app/agents/[id]/activity/page_client-reference-manifest.js +1 -1
  26. package/app/.next/server/app/agents/[id]/config/page/app-paths-manifest.json +3 -0
  27. package/app/.next/server/app/agents/[id]/config/page/build-manifest.json +20 -0
  28. package/app/.next/server/app/agents/[id]/config/page/next-font-manifest.json +11 -0
  29. package/app/.next/server/app/agents/[id]/config/page/react-loadable-manifest.json +1 -0
  30. package/app/.next/server/app/agents/[id]/config/page/server-reference-manifest.json +4 -0
  31. package/app/.next/server/app/agents/[id]/config/page.js +14 -0
  32. package/app/.next/server/app/agents/[id]/config/page.js.nft.json +1 -0
  33. package/app/.next/server/app/agents/[id]/config/page_client-reference-manifest.js +3 -0
  34. package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page/build-manifest.json +3 -3
  35. package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page.js.nft.json +1 -1
  36. package/app/.next/server/app/agents/[id]/conversations/[conversationId]/page_client-reference-manifest.js +1 -1
  37. package/app/.next/server/app/agents/[id]/conversations/page/build-manifest.json +3 -3
  38. package/app/.next/server/app/agents/[id]/conversations/page.js.nft.json +1 -1
  39. package/app/.next/server/app/agents/[id]/conversations/page_client-reference-manifest.js +1 -1
  40. package/app/.next/server/app/agents/[id]/page/build-manifest.json +3 -3
  41. package/app/.next/server/app/agents/[id]/page.js.nft.json +1 -1
  42. package/app/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
  43. package/app/.next/server/app/agents/[id]/sessions/page/build-manifest.json +3 -3
  44. package/app/.next/server/app/agents/[id]/sessions/page.js.nft.json +1 -1
  45. package/app/.next/server/app/agents/[id]/sessions/page_client-reference-manifest.js +1 -1
  46. package/app/.next/server/app/agents/[id]/slack/page/build-manifest.json +3 -3
  47. package/app/.next/server/app/agents/[id]/slack/page.js.nft.json +1 -1
  48. package/app/.next/server/app/agents/[id]/slack/page_client-reference-manifest.js +1 -1
  49. package/app/.next/server/app/api/bots/[id]/activity/route.js.nft.json +1 -1
  50. package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
  51. package/app/.next/server/app/api/bots/[id]/conversations/[conversationId]/route.js.nft.json +1 -1
  52. package/app/.next/server/app/api/bots/[id]/conversations/route.js.nft.json +1 -1
  53. package/app/.next/server/app/api/bots/[id]/overview/route.js.nft.json +1 -1
  54. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -1
  55. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -1
  56. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js.nft.json +1 -1
  57. package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
  58. package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js.nft.json +1 -1
  59. package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -1
  60. package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
  61. package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
  62. package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
  63. package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
  64. package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
  65. package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
  66. package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
  67. package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
  68. package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
  69. package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
  70. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
  71. package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
  72. package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
  73. package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
  74. package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
  75. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
  76. package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
  77. package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
  78. package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
  79. package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
  80. package/app/.next/server/app/api/health/route.js.nft.json +1 -1
  81. package/app/.next/server/app/api/import-capabilities/route.js +1 -1
  82. package/app/.next/server/app/api/import-capabilities/route.js.nft.json +1 -1
  83. package/app/.next/server/app/api/marketplace-handoff/route.js +1 -1
  84. package/app/.next/server/app/api/marketplace-handoff/route.js.nft.json +1 -1
  85. package/app/.next/server/app/api/marketplace-handoff/status/route.js +1 -1
  86. package/app/.next/server/app/api/marketplace-handoff/status/route.js.nft.json +1 -1
  87. package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
  88. package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
  89. package/app/.next/server/app/api/runtime-capacity/route/app-paths-manifest.json +3 -0
  90. package/app/.next/server/app/api/runtime-capacity/route/build-manifest.json +12 -0
  91. package/app/.next/server/app/api/runtime-capacity/route/server-reference-manifest.json +4 -0
  92. package/app/.next/server/app/api/runtime-capacity/route.js +10 -0
  93. package/app/.next/server/app/api/runtime-capacity/route.js.nft.json +1 -0
  94. package/app/.next/server/app/api/runtime-capacity/route_client-reference-manifest.js +3 -0
  95. package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -1
  96. package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
  97. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/shares/route.js.nft.json +1 -1
  99. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
  101. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -1
  103. package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
  104. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
  105. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
  106. package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
  107. package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
  108. package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
  109. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
  110. package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
  111. package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
  112. package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
  113. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -1
  114. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -1
  115. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -1
  116. package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
  117. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
  118. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -1
  119. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -1
  120. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -1
  121. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -1
  122. package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -1
  123. package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -1
  124. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
  125. package/app/.next/server/app/api/wakes/[id]/decision/route.js.nft.json +1 -1
  126. package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
  127. package/app/.next/server/app/bots/[id]/config/page/build-manifest.json +3 -3
  128. package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
  129. package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
  130. package/app/.next/server/app/exchanges/page/build-manifest.json +3 -3
  131. package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
  132. package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
  133. package/app/.next/server/app/exchanges.html +1 -1
  134. package/app/.next/server/app/exchanges.rsc +2 -2
  135. package/app/.next/server/app/exchanges.segments/_full.segment.rsc +2 -2
  136. package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
  137. package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +2 -2
  138. package/app/.next/server/app/index.html +1 -1
  139. package/app/.next/server/app/index.rsc +3 -3
  140. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  141. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  142. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  143. package/app/.next/server/app/page/build-manifest.json +3 -3
  144. package/app/.next/server/app/page.js.nft.json +1 -1
  145. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/settings/page/build-manifest.json +3 -3
  147. package/app/.next/server/app/settings/page.js.nft.json +1 -1
  148. package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app/settings.html +1 -1
  150. package/app/.next/server/app/settings.rsc +2 -2
  151. package/app/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  152. package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  153. package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  154. package/app/.next/server/app/threads/[id]/route.js.nft.json +1 -1
  155. package/app/.next/server/app-paths-manifest.json +2 -0
  156. package/app/.next/server/chunks/[externals]__06_ygwr._.js +3 -0
  157. package/app/.next/server/chunks/{[externals]__1eaoma8._.js → [externals]__0z3qnkl._.js} +2 -2
  158. package/app/.next/server/chunks/[root-of-the-server]__0anfwiu._.js +1 -1
  159. package/app/.next/server/chunks/{[root-of-the-server]__1z5l5cg._.js → [root-of-the-server]__0p1hgpt._.js} +1 -1
  160. package/app/.next/server/chunks/{[root-of-the-server]__1kik2zt._.js → [root-of-the-server]__0v3ksno._.js} +1 -1
  161. package/app/.next/server/chunks/{[root-of-the-server]__1igzl05._.js → [root-of-the-server]__1eugxjw._.js} +1 -1
  162. package/app/.next/server/chunks/[root-of-the-server]__1jxwu9_._.js +1 -1
  163. package/app/.next/server/chunks/{[root-of-the-server]__00ntari._.js → [root-of-the-server]__1nf6z4s._.js} +10 -10
  164. package/app/.next/server/chunks/[root-of-the-server]__1qbadul._.js +5 -0
  165. package/app/.next/server/chunks/_0061c2q._.js +1 -1
  166. package/app/.next/server/chunks/_next-internal_server_app_api_runtime-capacity_route_actions_1dzvg7f.js +3 -0
  167. package/app/.next/server/chunks/ssr/[root-of-the-server]__1tudi1e._.js +3 -0
  168. package/app/.next/server/chunks/ssr/{_14d-lxn._.js → _01ngpwj._.js} +22 -2
  169. package/app/.next/server/chunks/ssr/_06qzsne._.js +23 -0
  170. package/app/.next/server/chunks/ssr/{app_1-nwnha._.js → _0iywd5g._.js} +22 -2
  171. package/app/.next/server/chunks/ssr/{_17ngohj._.js → _0jvl76a._.js} +22 -2
  172. package/app/.next/server/chunks/ssr/_0mxifu3._.js +23 -0
  173. package/app/.next/server/chunks/ssr/_0u7urta._.js +1 -1
  174. package/app/.next/server/chunks/ssr/_next-internal_server_app_agents_[id]_config_page_actions_1cq16xp.js +3 -0
  175. package/app/.next/server/chunks/ssr/app_agents_[id]_0sr4fdg._.js +1 -1
  176. package/app/.next/server/chunks/ssr/app_agents_[id]_config_page_tsx_1f_gu1l._.js +3 -0
  177. package/app/.next/server/chunks/ssr/app_agents_[id]_sessions_page_tsx_0tfup-2._.js +1 -1
  178. package/app/.next/server/chunks/ssr/app_agents_[id]_slack_AgentSlackPage_tsx_20njhs1._.js +1 -1
  179. package/app/.next/server/chunks/ssr/app_components_0bhuhd-._.js +3 -0
  180. package/app/.next/server/chunks/ssr/app_page_tsx_0pxmutw._.js +1 -1
  181. package/app/.next/server/chunks/ssr/lib_0pfn9gs._.js +1 -1
  182. package/app/.next/server/chunks/ssr/lib_agent-registration-ui_ts_1z582mm._.js +1 -1
  183. package/app/.next/server/chunks/ssr/lib_share-view_ts_08psw5o._.js +1 -1
  184. package/app/.next/server/chunks/ssr/{_0gzxfz3._.js → node_modules_next_0x3i8za._.js} +2 -2
  185. package/app/.next/server/chunks/ssr/node_modules_next_dist_0kq7z60._.js +3 -0
  186. package/app/.next/server/middleware-build-manifest.js +6 -6
  187. package/app/.next/server/middleware.js +2 -2
  188. package/app/.next/server/next-font-manifest.js +1 -1
  189. package/app/.next/server/next-font-manifest.json +4 -0
  190. package/app/.next/server/pages/404.html +1 -1
  191. package/app/.next/server/pages/500.html +1 -1
  192. package/app/.next/server/server-reference-manifest.js +1 -1
  193. package/app/.next/server/server-reference-manifest.json +1 -1
  194. package/app/.next/static/chunks/{1ttvnc6qdye8s.js → 04nfr73lkk7pz.js} +1 -1
  195. package/app/.next/static/chunks/{1dhk3pcv7yvm6.js → 0eqgs3167zj2j.js} +1 -1
  196. package/app/.next/static/chunks/0h567k13e53r-.js +1 -0
  197. package/app/.next/static/chunks/10i-rrea371m2.js +1 -0
  198. package/app/.next/static/chunks/17qi6hcgg0nlz.css +3 -0
  199. package/app/.next/static/chunks/1n8wfulak4ltx.js +1 -0
  200. package/app/.next/static/chunks/2dtkykrnob8wk.js +1 -0
  201. package/app/.next/static/chunks/2ebpfmg4vni8e.js +3 -0
  202. package/app/.next/static/chunks/2mmpezlrfmbu5.js +1 -0
  203. package/app/.next/static/chunks/2myfan3i8z-jy.js +1 -0
  204. package/app/.next/static/chunks/{3y5bo6syunkzn.js → 326jto9l-m8vj.js} +1 -1
  205. package/app/.next/static/chunks/3un1mb5bx4x8k.js +22 -0
  206. package/app/.next/static/chunks/{06i_6p0-ipitj.js → 3x56k5qa012au.js} +1 -1
  207. package/app/.next/static/chunks/{turbopack-03rfayxv7ep_b.js → turbopack-2yajevry3z_n6.js} +1 -1
  208. package/app/BUILD_INFO.json +2 -2
  209. package/app/package.json +1 -1
  210. package/app/public/brand/harness/claude.svg +3 -0
  211. package/app/public/brand/harness/codex.png +0 -0
  212. package/app/public/brand/harness/cursor.svg +3 -0
  213. package/app/public/brand/harness/muse.svg +33 -0
  214. package/app/server.js +1 -1
  215. package/package.json +1 -1
  216. package/app/.next/server/chunks/ssr/_0_u9-u6._.js +0 -3
  217. package/app/.next/server/chunks/ssr/_0rvu-il._.js +0 -131
  218. package/app/.next/server/chunks/ssr/_1iq-7cn._.js +0 -3
  219. package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +0 -3
  220. package/app/.next/server/chunks/ssr/node_modules_1nkgb45._.js +0 -23
  221. package/app/.next/static/chunks/19mx3mg6lkumu.js +0 -1
  222. package/app/.next/static/chunks/1ka9dp1l6c0ga.js +0 -3
  223. package/app/.next/static/chunks/2n1u8a2efnt88.js +0 -1
  224. package/app/.next/static/chunks/2sspuxg0tql04.js +0 -1
  225. package/app/.next/static/chunks/2z-e6jheq0ftu.js +0 -22
  226. package/app/.next/static/chunks/3aasli1i-eiio.js +0 -1
  227. package/app/.next/static/chunks/3glqqyr0w46cr.css +0 -3
  228. package/app/.next/static/chunks/3p_p4gnr0d2-x.js +0 -1
  229. package/app/.next/static/chunks/3s9t477v-z09o.js +0 -1
  230. /package/app/.next/static/{HdrhALSm_DBB2VGy3oPxg → 92gsyY5d-nMkxJ7iQxKkY}/_buildManifest.js +0 -0
  231. /package/app/.next/static/{HdrhALSm_DBB2VGy3oPxg → 92gsyY5d-nMkxJ7iQxKkY}/_clientMiddlewareManifest.js +0 -0
  232. /package/app/.next/static/{HdrhALSm_DBB2VGy3oPxg → 92gsyY5d-nMkxJ7iQxKkY}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this Agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)},88204,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(15722),f=a.i(22151),g=a.i(10932);let h="botmancers setup --client cursor";function i(){let[a,d]=(0,c.useState)(!1);return(0,b.jsx)("button",{type:"button",className:"agent-primary-action",onClick:async()=>{try{await navigator.clipboard.writeText(h),d(!0),window.setTimeout(()=>d(!1),1600)}catch{d(!1)}},children:a?"Copied":"Copy setup command"})}function j({rows:a,empty:c}){return a.length?(0,b.jsx)("ul",{className:"agent-work-list",children:a.map(a=>(0,b.jsx)("li",{children:(0,b.jsxs)("span",{children:[(0,b.jsx)("strong",{children:a.title}),(0,b.jsxs)("small",{children:["active"===a.status?"Active now":"Recent"," · ",new Date(a.last_activity_at).toLocaleString()]})]})},a.ref))}):(0,b.jsx)("p",{className:"agent-empty",children:c})}a.s(["default",0,function(){let{id:a,overview:c,loading:k,error:l,notFound:m}=(0,e.useAgentOverview)();if(k)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent overview…"});if(m)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This Agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an Agent"})]});if(l||!c)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Overview unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]});let n=`/bots/${encodeURIComponent(a)}/config`,o=c.conversation?`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(c.conversation.id)}`:`/agents/${encodeURIComponent(a)}/conversations`,p=c.messaging.home_session_ref?"Home session configured":c.messaging.new_sessions_allowed&&c.messaging.default_workspace_set?"Can start a configured session":c.current_work.length>0?"Uses an eligible existing session":"No ready session is known";return(0,b.jsxs)("div",{className:"agent-overview","data-agent-overview":!0,children:[(0,b.jsxs)("div",{className:"agent-overview-grid",children:[(0,b.jsxs)("section",{className:"agent-panel agent-instructions",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Standing instructions"}),(0,b.jsx)("h2",{children:"How this Agent works"})]}),(0,b.jsx)(d.default,{href:n,children:"Config"})]}),(0,b.jsxs)("dl",{children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Rules"}),(0,b.jsx)("dd",{children:c.instructions.rules})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Skill"}),(0,b.jsx)("dd",{children:c.instructions.skill})]})]})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Runtime"}),(0,b.jsx)("h2",{children:c.runtime.available?"Ready to work":"Setup required"})]}),(0,b.jsx)(d.default,{href:n,children:"Config"})]}),(0,b.jsx)("p",{children:c.runtime.available?`${(0,f.agentLabel)(c.runtime.agent)} is connected through ${c.runtime.connection||"the configured runtime"}.`:"This Agent cannot launch with its current registration. Open Config to resolve the connection or session scope."}),(0,b.jsxs)("dl",{className:"agent-runtime-facts",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Heartbeat"}),(0,b.jsx)("dd",{children:c.runtime.last_seen?new Date(c.runtime.last_seen).toLocaleString():"Not reported"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Messaging"}),(0,b.jsx)("dd",{children:p})]})]}),(0,b.jsx)("p",{className:"agent-muted",children:"Messages use the Agent’s configured home session or launch policy. Callers do not choose its runtime, model, or provider session."})]})]}),(0,b.jsxs)("section",{className:"agent-use","aria-labelledby":"open-this-agent",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Open this Agent"}),(0,b.jsx)("h2",{id:"open-this-agent",children:"Make it reachable"}),(0,b.jsxs)("div",{className:"agent-use-grid",children:[(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"01"}),(0,b.jsx)("h3",{children:"Use from a coding agent"}),(0,b.jsxs)("p",{children:["Let another coding agent discover ",c.agent.name," and ask its sessions — so work learned here can travel between agents."]}),(0,b.jsx)("p",{className:"agent-muted",children:"One command connects the client to the bridge and installs the collaboration skill:"}),(0,b.jsx)("pre",{className:"agent-setup-command",children:(0,b.jsx)("code",{children:h})}),(0,b.jsx)(i,{}),(0,b.jsxs)("p",{className:"agent-muted",children:["Swap ",(0,b.jsx)("code",{children:"cursor"})," for ",(0,b.jsx)("code",{children:"codex"})," or ",(0,b.jsx)("code",{children:"claude"}),"."]})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"02"}),(0,b.jsx)("h3",{children:"Share a session to Slack"}),(0,b.jsx)("p",{children:"Open one of this Agent’s sessions to people in Slack — a time-limited, read-only share so others can ask what the session already knows."}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/slack`,children:"Share through Slack"})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"03"}),(0,b.jsx)("h3",{children:"Message in Botmancers"}),(0,b.jsxs)("p",{children:["Talk directly with ",c.agent.name," in a focused conversation when you are the one asking."]}),(0,b.jsx)(d.default,{href:o,children:"Open conversation"})]})]})]}),(0,b.jsxs)("div",{className:"agent-overview-grid agent-work-grid",children:[(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Current work"}),(0,b.jsx)("h2",{children:"Active sessions"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/sessions`,children:"All sessions"})]}),(0,b.jsx)(j,{rows:c.current_work,empty:"No active work right now."})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Recent activity"}),(0,b.jsx)("h2",{children:"Latest work"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/activity`,children:"View activity"})]}),c.recent_activity.length?(0,b.jsx)(g.ActivityList,{items:c.recent_activity,compact:!0}):(0,b.jsx)("p",{className:"agent-empty",children:"No operational activity yet."})]})]})]})}])}];
1
+ module.exports=[10932,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=[{value:"all",label:"All"},{value:"sessions",label:"Sessions"},{value:"conversations",label:"Conversations & exchanges"},{value:"slack",label:"Slack"},{value:"errors",label:"Errors"}],g={filter:"all",requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1};function h(a,b){return"select_filter"===b.type?{...a,filter:b.filter,requestKey:"",activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_started"===b.type?{...a,requestKey:b.key,activity:{state:"loading"},nextCursor:null,loadingMore:!1}:"request_succeeded"===b.type?b.key===a.requestKey?{...a,activity:{state:"ready",items:b.items},nextCursor:b.nextCursor}:a:"request_failed"===b.type?b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null}:a:"load_started"===b.type?b.key===a.requestKey?{...a,loadingMore:!0}:a:"load_succeeded"===b.type&&b.key===a.requestKey&&"ready"===a.activity.state?{...a,activity:{state:"ready",items:[...a.activity.items,...b.items]},nextCursor:b.nextCursor,loadingMore:!1}:"load_failed"===b.type&&b.key===a.requestKey?{...a,activity:{state:"error"},nextCursor:null,loadingMore:!1}:a}function i(a,b,c=null){let d=new URLSearchParams({filter:b,limit:String(20)});return c&&d.set("cursor",c),`/api/bots/${encodeURIComponent(a)}/activity?${d.toString()}`}function j({items:a,compact:d=!1}){return(0,b.jsx)("ol",{className:d?"agent-activity-list is-compact":"agent-activity-list","aria-label":"Agent activity, newest first",children:a.map(a=>(0,b.jsxs)("li",{className:`agent-activity-item is-${a.severity}`,"data-activity-kind":a.kind,children:[(0,b.jsx)("span",{className:"agent-activity-marker","aria-hidden":"true"}),(0,b.jsxs)("div",{className:"agent-activity-card",children:[(0,b.jsxs)("div",{className:"agent-activity-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:"agent-activity-category",children:"conversations"===a.category?"Conversations & exchanges":a.category}),(0,b.jsx)("strong",{children:a.summary}),(0,b.jsx)("time",{dateTime:new Date(a.occurred_at).toISOString(),children:new Date(a.occurred_at).toLocaleString()})]}),a.attention?(0,b.jsx)("span",{className:"agent-activity-attention",children:"Needs attention"}):null]}),(0,b.jsx)("div",{className:"agent-activity-actions",children:(0,b.jsx)(c.default,{href:a.target.href,children:a.target.label})}),!d&&Object.keys(a.details).length?(0,b.jsxs)("details",{className:"agent-activity-details",children:[(0,b.jsx)("summary",{children:"Raw details"}),(0,b.jsx)("dl",{children:Object.entries(a.details).map(([a,c])=>(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:a.replaceAll("_"," ")}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:String(c)})})]},a))}),(0,b.jsx)("p",{children:"Safe structured fields only. Provider transcripts and identifiers are excluded."})]}):null]})]},a.id))})}function k({activity:a,filter:c,nextCursor:d,loadingMore:e,onLoadMore:g}){return(0,b.jsxs)(b.Fragment,{children:["loading"===a.state?(0,b.jsx)("p",{className:"agent-activity-state",role:"status",children:"Loading activity…"}):null,"error"===a.state?(0,b.jsxs)("div",{className:"agent-activity-state is-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"No partial or stale timeline is shown. Refresh to try again."})]}):null,"ready"!==a.state||a.items.length?null:(0,b.jsx)("p",{className:"agent-activity-state",children:"all"===c?"No operational activity has been recorded for this Agent yet.":`No ${f.find(a=>a.value===c)?.label.toLowerCase()} activity matches this filter.`}),"ready"===a.state&&a.items.length?(0,b.jsx)(j,{items:a.items}):null,"ready"===a.state&&d?(0,b.jsx)("button",{type:"button",className:"agent-activity-more",onClick:g,disabled:e,children:e?"Loading…":"Load older activity"}):null]})}a.s(["ActivityList",0,j,"ActivityResults",0,k,"activityPageReducer",0,h,"agentActivityUrl",0,i,"default",0,function(){let{id:a,overview:j,loading:l,error:m,notFound:n}=(0,e.useAgentOverview)(),[o,p]=(0,d.useReducer)(h,g),{filter:q,activity:r,nextCursor:s,loadingMore:t}=o,u=(0,d.useRef)(0),v=(0,d.useCallback)((b=null)=>i(a,q,b),[q,a]);(0,d.useEffect)(()=>{let b=!1,c=++u.current,d=`${a}:${q}:${c}`;return p({type:"request_started",key:d}),fetch(v(),{cache:"no-store"}).then(async a=>{let e=await a.json().catch(()=>null);if(!a.ok||!Array.isArray(e?.activity))throw Error("activity");b||c!==u.current||p({type:"request_succeeded",key:d,items:e.activity,nextCursor:"string"==typeof e.next_cursor?e.next_cursor:null})}).catch(()=>{b||c!==u.current||p({type:"request_failed",key:d})}),()=>{b=!0}},[q,a,v]);let w=async()=>{if(!s||"ready"!==r.state||t)return;let a=o.requestKey;p({type:"load_started",key:a});try{let b=await fetch(v(s),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.activity))throw Error("activity");p({type:"load_succeeded",key:a,items:c.activity,nextCursor:"string"==typeof c.next_cursor?c.next_cursor:null})}catch{p({type:"load_failed",key:a})}};return l?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent activity…"}):n?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):m||!j?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Activity unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]}):(0,b.jsxs)("div",{className:"agent-activity","data-agent-activity-page":!0,children:[(0,b.jsxs)("header",{className:"agent-activity-intro",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Activity"}),(0,b.jsxs)("h2",{children:["What changed for ",j.agent.name]}),(0,b.jsx)("p",{children:"Operational history from Botmancers records. Open the owning page for actions and complete detail."})]}),(0,b.jsx)("div",{className:"agent-activity-filters",role:"group","aria-label":"Filter Agent activity",children:f.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":q===a.value,onClick:()=>p({type:"select_filter",filter:a.value}),children:a.label},a.value))}),(0,b.jsx)(k,{activity:r,filter:q,nextCursor:s,loadingMore:t,onLoadMore:()=>{w()}})]})},"initialActivityPageState",0,g],10932)},88204,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(15722),f=a.i(22151),g=a.i(78627),h=a.i(10932);let i=[{id:"cursor",label:"Cursor"},{id:"codex",label:"Codex"},{id:"claude",label:"Claude Code"}];function j(a){return`botmancers setup --client ${a}`}function k(){let[a,d]=(0,c.useState)("cursor"),[e,f]=(0,c.useState)(null),h=j(a);async function k(a){d(a);try{await navigator.clipboard.writeText(j(a)),f(a),window.setTimeout(()=>f(b=>b===a?null:b),1600)}catch{f(null)}}return(0,b.jsxs)("div",{className:"agent-setup-clients",children:[(0,b.jsx)("div",{className:"agent-setup-client-row",role:"group","aria-label":"Copy setup command for a coding client",children:i.map(c=>{let d=a===c.id,f=e===c.id;return(0,b.jsxs)("button",{type:"button",className:`agent-setup-client${d?" is-active":""}${f?" is-copied":""}`,"aria-pressed":d,"aria-label":f?`Copied setup command for ${c.label}`:`Copy setup command for ${c.label}`,onClick:()=>void k(c.id),children:[(0,b.jsx)(g.HarnessIcon,{agent:c.id,size:14,className:"agent-setup-client-mark"}),(0,b.jsx)("span",{children:f?"Copied":c.label})]},c.id)})}),(0,b.jsx)("pre",{className:"agent-setup-command",children:(0,b.jsx)("code",{children:h})})]})}function l({rows:a,empty:c}){return a.length?(0,b.jsx)("ul",{className:"agent-work-list",children:a.map(a=>(0,b.jsx)("li",{children:(0,b.jsxs)("span",{children:[(0,b.jsx)("strong",{children:a.title}),(0,b.jsxs)("small",{children:["active"===a.status?"Active now":"Recent"," · ",new Date(a.last_activity_at).toLocaleString()]})]})},a.ref))}):(0,b.jsx)("p",{className:"agent-empty",children:c})}a.s(["default",0,function(){let{id:a,overview:c,loading:g,error:i,notFound:j}=(0,e.useAgentOverview)();if(g)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Agent overview…"});if(j)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This Agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an Agent"})]});if(i||!c)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Overview unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]});let m=`/agents/${encodeURIComponent(a)}/config`,n=c.conversation?`/agents/${encodeURIComponent(a)}/conversations/${encodeURIComponent(c.conversation.id)}`:`/agents/${encodeURIComponent(a)}/conversations`,o=c.messaging.home_session_ref?"Home session configured":c.messaging.new_sessions_allowed&&c.messaging.default_workspace_set?"Can start a configured session":c.current_work.length>0?"Uses an eligible existing session":"No ready session is known";return(0,b.jsxs)("div",{className:"agent-overview","data-agent-overview":!0,children:[(0,b.jsxs)("div",{className:"agent-overview-grid",children:[(0,b.jsxs)("section",{className:"agent-panel agent-instructions",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Standing instructions"}),(0,b.jsx)("h2",{children:"How this Agent works"})]}),(0,b.jsx)(d.default,{href:m,children:"Config"})]}),(0,b.jsxs)("dl",{children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Rules"}),(0,b.jsx)("dd",{children:c.instructions.rules})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Skill"}),(0,b.jsx)("dd",{children:c.instructions.skill})]})]})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Runtime"}),(0,b.jsx)("h2",{children:c.runtime.available?"Ready to work":"Setup required"})]}),(0,b.jsx)(d.default,{href:m,children:"Config"})]}),(0,b.jsx)("p",{children:c.runtime.available?`${(0,f.agentLabel)(c.runtime.agent)} is connected through ${c.runtime.connection||"the configured runtime"}.`:"This Agent cannot launch with its current registration. Open Config to resolve the connection or session scope."}),(0,b.jsxs)("dl",{className:"agent-runtime-facts",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Heartbeat"}),(0,b.jsx)("dd",{children:c.runtime.last_seen?new Date(c.runtime.last_seen).toLocaleString():"Not reported"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Messaging"}),(0,b.jsx)("dd",{children:o})]})]}),(0,b.jsx)("p",{className:"agent-muted",children:"Messages use the Agent’s configured home session or launch policy. Callers do not choose its runtime, model, or provider session."})]})]}),(0,b.jsxs)("section",{className:"agent-use","aria-labelledby":"open-this-agent",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Open this Agent"}),(0,b.jsx)("h2",{id:"open-this-agent",children:"Make it reachable"}),(0,b.jsxs)("div",{className:"agent-use-grid",children:[(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"01"}),(0,b.jsx)("h3",{children:"Use from a coding agent"}),(0,b.jsxs)("p",{children:["Let another coding agent discover ",c.agent.name," and ask its sessions — so work learned here can travel between agents."]}),(0,b.jsx)("p",{className:"agent-muted",children:"One command connects the client to the bridge and installs the collaboration skill. Click your client to copy it:"}),(0,b.jsx)(k,{})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"02"}),(0,b.jsx)("h3",{children:"Share a session to Slack"}),(0,b.jsx)("p",{children:"Open one of this Agent’s sessions to people in Slack — a time-limited, read-only share so others can ask what the session already knows."}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/slack`,children:"Share through Slack"})]}),(0,b.jsxs)("article",{children:[(0,b.jsx)("span",{className:"agent-use-number",children:"03"}),(0,b.jsx)("h3",{children:"Message in Botmancers"}),(0,b.jsxs)("p",{children:["Talk directly with ",c.agent.name," in a focused conversation when you are the one asking."]}),(0,b.jsx)(d.default,{href:n,children:"Open conversation"})]})]})]}),(0,b.jsxs)("div",{className:"agent-overview-grid agent-work-grid",children:[(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Current work"}),(0,b.jsx)("h2",{children:"Active sessions"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/sessions`,children:"All sessions"})]}),(0,b.jsx)(l,{rows:c.current_work,empty:"No active work right now."})]}),(0,b.jsxs)("section",{className:"agent-panel",children:[(0,b.jsxs)("div",{className:"agent-panel-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Recent activity"}),(0,b.jsx)("h2",{children:"Latest work"})]}),(0,b.jsx)(d.default,{href:`/agents/${encodeURIComponent(a)}/activity`,children:"View activity"})]}),c.recent_activity.length?(0,b.jsx)(h.ActivityList,{items:c.recent_activity,compact:!0}):(0,b.jsx)("p",{className:"agent-empty",children:"No operational activity yet."})]})]})]})}])}];
2
2
 
3
3
  //# sourceMappingURL=app_agents_%5Bid%5D_0sr4fdg._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[48219,a=>{"use strict";var b=a.i(87924),c=a.i(72131),d=a.i(38246),e=a.i(50944),f=a.i(60193),g=a.i(23464);function h({agentId:a,agentName:d}){let e=(0,c.useId)(),f=(0,c.useId)(),i=(0,c.useId)(),[j,k]=(0,c.useState)(null),[l,m]=(0,c.useState)(""),[n,o]=(0,c.useState)(0),[p,q]=(0,c.useState)("idle"),[r,s]=(0,c.useState)(""),[t,u]=(0,c.useState)(""),[v,w]=(0,c.useState)(""),[x,y]=(0,c.useState)(""),[z,A]=(0,c.useState)("");(0,c.useEffect)(()=>{let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);b||(a.ok&&c?.policy?(m(""),k(c.policy)):m("Could not load the share policy."))}).catch(()=>{b||m("Could not load the share policy.")}),()=>{b=!0}},[a,n]);let B=()=>{s(""),q("idle"),o(a=>a+1)},C=async(b,c)=>{if(!j)return!1;q("saving"),s(""),u("");try{let d=await fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{method:"PUT",headers:{"content-type":"application/json"},body:JSON.stringify({revision:j.revision,...b})}),e=await d.json().catch(()=>null);if(!d.ok||!e?.policy)return q("error"),s("string"==typeof e?.error?.message?e.error.message:"The share policy could not be saved."),!1;return k(e.policy),q("idle"),u(c("number"==typeof e.revoked_contexts?e.revoked_contexts:0)),!0}catch{return q("error"),s("The share policy could not be saved."),!1}},D=async a=>{if(a.preventDefault(),!j)return;let b=(0,g.audienceInputError)(v,x,j.audiences);if(A(b??""),b)return;let c={kind:"slack",team_id:v.trim(),channel_id:x.trim()};await C({audiences:[...j.audiences,c]},()=>`Added ${(0,g.audienceLabel)(c)}.`)&&(w(""),y(""))},E="saving"===p,F=!!j&&"invalid"!==j.state;return(0,b.jsxs)("section",{className:"cfg-card share-policy",id:"session-sharing","aria-labelledby":"cfg-sharing-title",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{id:"cfg-sharing-title",className:"cfg-title",children:"Session sharing"}),E?(0,b.jsx)("span",{className:"text-sm cfg-faint",role:"status",children:"Saving…"}):null]}),(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:["A share lets people in one Slack channel ask one of ",d,"’s sessions questions, read-only, until it expires or you revoke it. Create and revoke shares from Sessions."]}),l?(0,b.jsxs)("p",{className:"text-sm cfg-error",role:"alert",children:[l," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Retry"})]}):null,j||l?null:(0,b.jsx)("p",{className:"text-sm cfg-faint",role:"status",children:"Loading…"}),j?.state==="invalid"?(0,b.jsxs)("p",{className:"text-sm cfg-error mb-3",role:"alert",children:["The share policy file is invalid, so nothing can be shared: ",j.reason," Fix or remove config/session-shares.json, then"," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"reload"}),"."]}):null,j?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("div",{className:"share-policy-toggle",children:[(0,b.jsx)("input",{id:e,type:"checkbox",role:"switch",checked:j.agent.share_from_turn,"aria-checked":j.agent.share_from_turn,disabled:!F||E||!j.agent.share_current.supported&&!j.agent.share_from_turn,"data-share-policy":"share_from_turn",onChange:a=>{let b=a.target.checked;C({share_from_turn:b},a=>b?"Share from a turn is on.":`Share from a turn is off.${a?` Revoked ${a} live turn context${1===a?"":"s"}.`:""}`)}}),(0,b.jsxs)("label",{htmlFor:e,className:"text-sm",children:[(0,b.jsx)("span",{className:"font-medium",children:"Share from a turn"})," (",(0,b.jsx)("code",{className:"cfg-code",children:"share_from_turn"}),")"]})]}),(0,b.jsx)("p",{className:"text-sm cfg-faint share-policy-hint",children:(0,g.shareFromTurnNote)(j)}),j.agent.live_contexts>0?(0,b.jsxs)("p",{className:"text-sm cfg-faint share-policy-hint",children:[j.agent.live_contexts," live turn context",1===j.agent.live_contexts?"":"s"," now."]}):null,(0,b.jsx)("h3",{className:"cfg-title share-policy-sub",children:"Slack channel allowlist"}),(0,b.jsx)("p",{className:"text-sm cfg-faint",children:"Every Agent’s shares use this list. A share can only go to a channel on it."}),0===j.audiences.length?(0,b.jsx)("p",{className:"text-sm cfg-muted share-policy-empty",children:"No channel yet: nothing can be shared to Slack."}):(0,b.jsx)("ul",{className:"share-policy-list","aria-label":"Allowed Slack channels",children:j.audiences.map(a=>(0,b.jsxs)("li",{className:"share-policy-entry",children:[(0,b.jsx)("span",{className:"cfg-code",children:a.channel_id}),(0,b.jsxs)("span",{className:"cfg-faint",children:["workspace ",a.team_id]}),(0,b.jsx)("button",{type:"button",className:"cfg-link text-sm share-policy-remove",disabled:!F||E,"aria-label":`Remove ${(0,g.audienceLabel)(a)}`,onClick:()=>{j&&C({audiences:j.audiences.filter(b=>b.team_id!==a.team_id||b.channel_id!==a.channel_id)},()=>`Removed ${(0,g.audienceLabel)(a)}. Its Slack threads stop being answered.`)},children:"Remove"})]},`${a.team_id}:${a.channel_id}`))}),(0,b.jsxs)("form",{className:"share-policy-add",onSubmit:a=>{D(a)},"aria-label":"Add a Slack channel",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:f,className:"text-sm",children:"Workspace ID"}),(0,b.jsx)("input",{id:f,className:"cfg-input",value:v,placeholder:"T0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{w(a.target.value),A("")}})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("label",{htmlFor:i,className:"text-sm",children:"Channel ID"}),(0,b.jsx)("input",{id:i,className:"cfg-input",value:x,placeholder:"C0123ABCD",autoComplete:"off",spellCheck:!1,disabled:!F||E,"aria-invalid":!!z,onChange:a=>{y(a.target.value),A("")}})]}),(0,b.jsx)("button",{type:"submit",className:"cfg-btn-primary text-sm",disabled:!F||E||!v.trim()||!x.trim(),children:"Add channel"})]}),z?(0,b.jsx)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:z}):null,"error"===p?(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:["Couldn't save: ",r," ",(0,b.jsx)("button",{type:"button",onClick:B,className:"underline hover:no-underline",children:"Reload"})]}):null,(0,b.jsx)("p",{className:"mt-2 text-sm cfg-ok",role:"status",children:t})]}):null]})}var i=a.i(35832),j=a.i(20851),k=a.i(1160),l=a.i(22855),m=a.i(79202),n=a.i(36391);function o({attribute:a,label:d,options:e,current:f,onPick:g,className:h}){let i=(0,c.useId)(),j=`avatar-${a}`;return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{id:i,className:"avatar-group-label",children:d}),(0,b.jsx)("div",{className:h?`avatar-opt-grid ${h}`:"avatar-opt-grid",role:"radiogroup","aria-labelledby":i,children:e.map(c=>(0,b.jsxs)("label",{title:c.label,className:"avatar-opt",children:[(0,b.jsx)("input",{type:"radio",name:j,value:c.id,checked:f[a]===c.id,onChange:()=>g({[a]:c.id}),className:"avatar-opt-input"}),(0,b.jsx)("span",{className:"avatar-opt-art","aria-hidden":"true",children:(0,b.jsx)(n.default,{config:{...f,[a]:c.id},size:44})}),(0,b.jsx)("span",{children:c.label})]},c.id))})]})}var p=a.i(80219);function q({phase:a,onImport:c}){let d=(0,p.marketImportView)(a);return(0,b.jsxs)("div",{className:"mt-3","data-field":"marketplace-import",children:[(0,b.jsx)("button",{type:"button",onClick:c,disabled:d.busy,"aria-busy":d.busy,"aria-describedby":"cfg-market-import-status",className:"cfg-btn-ghost text-sm w-full sm:w-auto",children:"Import from Grok Marketplace"}),(0,b.jsx)("p",{id:"cfg-market-import-status",role:"status","aria-live":"polite",className:"error"===d.tone?"mt-2 text-sm cfg-error":"mt-2 text-xs cfg-faint",children:d.message})]})}var r=a.i(5020);let s="Fix the highlighted fields.",t=[{key:"avatar_accessory",label:"Avatar accessory"},{key:"avatar_color",label:"Avatar color"},{key:"avatar_eyes",label:"Avatar eyes"},{key:"avatar_hands",label:"Avatar hands"},{key:"description",label:"Description (rules)"},{key:"import_operation_id",label:"Import operation ID"},{key:"import_schema_version",label:"Import schema version"},{key:"memories",label:"Remembered facts"},{key:"name",label:"Name"},{key:"skill_content",label:"Skill content"},{key:"skill_path",label:"Skill path"},{key:"skill_present",label:"Skill present"},{key:"source_provider",label:"Source provider"},{key:"template_id",label:"Template ID"},{key:"template_url",label:"Template URL"},{key:"title",label:"Title"}];function u(a){return String(a).padStart(2,"0")}function v(a){let b=new Date(a);return`${b.getFullYear()}-${u(b.getMonth()+1)}-${u(b.getDate())} ${u(b.getHours())}:${u(b.getMinutes())}`}function w(a){let b=new Date(a);return`${u(b.getHours())}:${u(b.getMinutes())}:${u(b.getSeconds())}`}async function x(a){try{return await navigator.clipboard.writeText(a),!0}catch{return!1}}a.s(["default",0,function(){var a;let g=String((0,e.useParams)().id??""),u=(0,e.useRouter)(),[y,z]=(0,c.useState)(!1),[A,B]=(0,c.useState)(null),[C,D]=(0,c.useState)(!0),[E,F]=(0,c.useState)(!1),[G,H]=(0,c.useState)(!1),[I,J]=(0,c.useState)(0),[K,L]=(0,c.useState)(null),[M,N]=(0,c.useState)("clean"),[O,P]=(0,c.useState)(""),[Q,R]=(0,c.useState)(0),[S,T]=(0,c.useState)(!1),[U,V]=(0,c.useState)(""),[W,X]=(0,c.useState)("clean"),[Y,Z]=(0,c.useState)(""),[$,_]=(0,c.useState)(0),[aa,ab]=(0,c.useState)({}),[ac,ad]=(0,c.useState)(""),[ae,af]=(0,c.useState)(!1),[ag,ah]=(0,c.useState)(null),[ai,aj]=(0,c.useState)(!1),ak=(0,m.useRuntimeConnections)(),[al,am]=(0,c.useState)(void 0),[an,ao]=(0,c.useState)("clean"),[ap,aq]=(0,c.useState)(""),[ar,as]=(0,c.useState)(0),[at,au]=(0,c.useState)(null),[av,aw]=(0,c.useState)("clean"),[ax,ay]=(0,c.useState)(""),[az,aA]=(0,c.useState)(0),{phase:aB,startImport:aC}=function(a){let[b,d]=(0,c.useState)("idle");return(0,c.useEffect)(()=>{let b=window.location.search;if(null===(0,p.importedBotId)(b))return;let c=new URL(window.location.href);c.searchParams.delete(p.IMPORT_RETURN_QUERY),window.history.replaceState(null,"",c.pathname+c.search);let e=!1;return(0,p.resolveImportReturn)(b,a,async a=>(await fetch(`/api/bots/${encodeURIComponent(a)}/config`,{cache:"no-store"})).ok).then(a=>{e||("open"===a.kind?window.location.replace(a.path):"missing"===a.kind&&d("missing"))}),()=>{e=!0}},[a]),{phase:b,startImport:async function(){d("checking");try{let a=await fetch(p.HANDOFF_STATUS_PATH,{cache:"no-store"}),b=await a.json().catch(()=>null);if(!a.ok)return void d("failed");if(b?.configured!==!0)return void d("unavailable");d("redirecting"),window.location.href=(0,p.handoffStartPath)(window.location.origin,window.location.pathname),setTimeout(()=>d(a=>"redirecting"===a?"idle":a),4e3)}catch{d("failed")}}}}(g);function aD(){D(!0),F(!1),J(a=>a+1)}(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/sessions?status=all`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(b=>{a||am((b?.sessions??[]).map(a=>({ref:a.ref,title:a.title,status:a.status})))}).catch(()=>{a||am([])}),()=>{a=!0}},[g,I]),(0,c.useEffect)(()=>{if(!g)return;let a=!1;return fetch(`/api/bots/${encodeURIComponent(g)}/config`).then(async b=>{if(a)return;if(404===b.status){H(!0),B(null);return}if(!b.ok)throw Error("request failed");let c=await b.json();a||(B(c),L(c.bot.description??""),H(!1),F(!1))}).catch(()=>{a||F(!0)}).finally(()=>{a||D(!1)}),()=>{a=!0}},[g,I]);let aE=A?.bot.description??"",aF=null!==K&&K!==aE,aG=A?.skill.content??"",aH=S&&U!==aG,aI=A?(0,k.registrationFormFromBot)(A.bot):null,aJ=ae&&null!==ag&&JSON.stringify(ag)!==JSON.stringify(aI),aK=A?.bot.avatar_config??(0,r.resolveAvatar)(A?.bot??{}),aL=at??aK,aM=null!==at&&JSON.stringify(at)!==JSON.stringify(aK),aN=aF||aH||aJ||aM;function aO(a,b){x(b).then(b=>{b&&(ad(a),setTimeout(()=>ad(b=>b===a?"":b),2e3))})}async function aP(){if(A&&null!==K){N("saving"),P("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,description:K})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),N("confirmed"),R(Date.now()),setTimeout(()=>{N(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){N("error"),P(a instanceof Error?a.message:"request failed")}}}function aQ(){A&&(ah((0,k.registrationFormFromBot)(A.bot)),af(!0),aj(!1),ao("clean"),aq(""),ak.retry())}function aR(a){ah(b=>b?{...b,...a}:b),aq(""),ao(a=>"error"===a?"clean":a)}function aS(){af(!1),ah(null),ao("clean"),aq("")}function aT(a){au({...at??aK,...a}),aw("clean"),ay("")}async function aU(){if(A&&at){aw("saving"),ay("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:A.bot.id,avatar:at})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),au(null),aw("confirmed"),aA(Date.now()),setTimeout(()=>{aw(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){aw("error"),ay(a instanceof Error?a.message:"request failed")}}}async function aV(){if(A&&ag){if((0,k.hasRegistrationErrors)((0,k.registrationFormView)(ag,ak.state))){aj(!0),ao("error"),aq(s);return}ao("saving"),aq("");try{let a=await fetch("/api/bots",{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,k.registrationPatchBody)(A.bot.id,ag))});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await fetch(`/api/bots/${encodeURIComponent(g)}/config`);if(!b.ok)throw Error("request failed");B(await b.json()),af(!1),ah(null),ao("confirmed"),as(Date.now()),setTimeout(()=>{ao(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){ao("error"),aq(a instanceof Error?a.message:"request failed")}}}function aW(){V(A?.skill.content??""),T(!0),X("clean"),Z("")}async function aX(){if(A&&(U.trim()||window.confirm("Delete this skill file?"))){X("saving"),Z("");try{let a=await fetch(`/api/bots/${encodeURIComponent(g)}/skill`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:U})});if(!a.ok){let b="request failed";try{let c=await a.json();c.error&&(b=c.error)}catch{}throw Error(b)}let b=await a.json();B(a=>a?{...a,skill:b.skill,currentHash:b.currentHash}:a),T(!1),X("confirmed"),_(Date.now()),setTimeout(()=>{X(a=>"confirmed"===a?"clean":a)},5e3)}catch(a){X("error"),Z(a instanceof Error?a.message:"request failed")}}}if((0,c.useEffect)(()=>{if(!aN)return;let a=a=>{a.preventDefault()};return window.addEventListener("beforeunload",a),()=>window.removeEventListener("beforeunload",a)},[aN]),G)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)("p",{children:"This Agent does not exist or was removed."}),(0,b.jsx)(d.default,{href:"/",children:"Choose an Agent"})]})});if(C&&!A)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto space-y-6",children:[(0,b.jsx)("div",{className:"h-12 rounded-lg animate-pulse cfg-skel"}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,b.jsx)("div",{className:"space-y-6",children:[0,1,2].map(a=>(0,b.jsx)("div",{className:"h-48 rounded-lg animate-pulse cfg-skel"},a))}),(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsx)("div",{className:"h-64 rounded-lg animate-pulse cfg-skel"}),(0,b.jsx)("div",{className:"h-80 rounded-lg animate-pulse cfg-skel"})]})]})]})});if(E&&!A)return(0,b.jsx)("div",{className:"cfg-page cfg-page-framed",children:(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsxs)("header",{className:"mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Config"}),(0,b.jsx)("h2",{className:"text-xl font-bold truncate",children:"Couldn't load agent details"})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash: ",(0,b.jsx)("code",{className:"cfg-code",children:"—"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:(0,b.jsx)("span",{className:"cfg-faint",children:"○ Not loaded"})})]})]}),(0,b.jsx)("div",{className:"grid gap-6 lg:grid-cols-2 items-start",children:[["Skills","Rules","Agent","Template source"],["Launch snapshots","Avatar"]].map(a=>(0,b.jsx)("div",{className:"min-w-0 space-y-6",children:a.map(a=>(0,b.jsxs)("div",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-2",children:a}),(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Couldn't load this section."," ",(0,b.jsx)("button",{onClick:aD,className:"cfg-link",children:"Retry"})]})]},a))},a[0]))})]})});if(!A)return null;let{bot:aY,skill:aZ,currentHash:a$,snapshots:a_}=A,a0=!!(aY.source_provider||aY.template_id||aY.template_url||aY.import_schema_version||aY.import_operation_id),a1="saving"===M?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aF||"error"===M?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===M?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(Q)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a2="saving"===W?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aH||"error"===W?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===W?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w($)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a3="saving"===an?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aJ||"error"===an?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===an?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(ar)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"}),a4="saving"===av?(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saving…"}):aM||"error"===av?(0,b.jsxs)("span",{className:"text-sm cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):"confirmed"===av?(0,b.jsxs)("span",{className:"text-sm cfg-faint",children:["Saved ",w(az)]}):(0,b.jsx)("span",{className:"text-sm cfg-faint",children:"Saved"});return(0,b.jsxs)("div",{className:"cfg-page cfg-page-framed",children:[(0,b.jsxs)("div",{className:"max-w-6xl mx-auto",children:[(0,b.jsxs)("header",{className:"mb-6 flex flex-wrap items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Config"}),(0,b.jsx)("h2",{className:"text-xl font-bold truncate",children:"Standing setup"})]}),(0,b.jsxs)("div",{className:"ml-auto text-right",children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted",children:["Current config hash:"," ",(0,b.jsx)("code",{className:"cfg-code",title:a$,children:a$.slice(0,8)})," ",(0,b.jsx)("button",{onClick:()=>aO("header",a$),className:"cfg-link text-sm",children:"header"===ac?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"text-sm mt-1",children:aN?(0,b.jsxs)("span",{className:"cfg-dirty",children:[(0,b.jsx)("span",{className:"inline-block w-2 h-2 rounded-full cfg-dot-amber mr-1"}),"Unsaved changes"]}):(0,b.jsx)("span",{className:"cfg-faint",children:"● Saved"})})]})]}),(0,b.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2 items-start","data-cfg-layout":"columns",children:[(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"primary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Skills"}),a2]}),"unsupported"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Unsupported name"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"Skill files need an agent name matching /^[A-Za-z0-9_-]+$/ — this name cannot map to a skill path."})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("p",{className:"text-sm cfg-muted mb-3",children:[aZ.path," · ","present"===aZ.status?"Present":"Not present"]}),S?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("textarea",{value:U,onChange:a=>V(a.target.value),rows:8,className:"cfg-input text-sm"}),"error"===W&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",Y,"."," ",(0,b.jsx)("button",{onClick:aX,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aX,disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===W?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){T(!1),X("clean"),Z("")},disabled:!aH||"saving"===W,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}):"present"===aZ.status?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("pre",{className:"text-sm cfg-pre max-h-64 overflow-y-auto",children:aZ.content}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No skill file yet. Create SKILL.md to give this agent standing instructions."}),(0,b.jsx)("button",{onClick:aW,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Create"})]}),(0,b.jsx)("p",{className:"mt-3 text-xs cfg-faint",children:"Appended verbatim as a system message at launch."})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Rules"}),a1]}),(0,b.jsx)("textarea",{value:K??"",onChange:a=>L(a.target.value),rows:8,className:"cfg-input cfg-input-sans text-sm"}),(0,b.jsx)("p",{className:"mt-2 text-xs cfg-faint",children:"Sent verbatim as the standing-rules system message on every turn. This beats the user's request for detail or length."}),"error"===M&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",O,"."," ",(0,b.jsx)("button",{onClick:aP,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aP,disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===M?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){L(aE),N("clean"),P("")},disabled:!aF||"saving"===M,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Agent"}),a3]}),(()=>{if(!ae||!ag){let a=(0,k.registrationReadView)(aY,al);return(0,b.jsxs)("div",{"data-field":"runtime-read",children:[(0,b.jsx)("dl",{className:"text-sm",children:a.rows.map(a=>(0,b.jsxs)("div",{"data-row":a.key,className:"flex flex-col sm:flex-row sm:justify-between gap-x-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:a.label}),(0,b.jsx)("dd",{className:"sm:text-right break-words cfg-muted",children:a.value})]},a.key))}),a.notices.map(a=>(0,b.jsx)("p",{className:"text-sm cfg-dirty mt-2",children:a},a)),(0,b.jsx)("button",{onClick:aQ,className:"mt-3 cfg-btn-ghost text-sm w-full sm:w-auto",children:"Edit"})]})}let a=(0,k.registrationFormView)(ag,ak.state);return(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.RegistrationFields,{idPrefix:"cfg",variant:"config",form:ag,onChange:aR,view:a,showErrors:ai,connections:ak.state,onRetryConnections:ak.retry,onAddConnection:ak.add,workspacePlaceholder:(0,j.defaultWorkdirFor)(aY.id),workspaceHint:(0,j.configWorkspaceHint)(aY.id),sessions:al,includeHomeSession:!0}),"error"===an&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",role:"alert",children:[ap===s?ap:`Couldn't save: ${ap}.`," ",ap===s?null:(0,b.jsx)("button",{onClick:aV,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aV,disabled:!aJ||"saving"===an||a.submitDisabled,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===an?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:aS,disabled:"saving"===an,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:aJ?"Discard":"Cancel"})]})]})})()]}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Template source"}),!a0&&(0,b.jsx)("p",{className:"text-sm cfg-muted mb-3",children:"Created manually in Botmancers — no template source."}),(0,b.jsxs)("dl",{className:"text-sm",children:[(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Source provider"}),(0,b.jsx)("dd",{className:"text-right",children:aY.source_provider??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template ID"}),(0,b.jsx)("dd",{className:"text-right",children:aY.template_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Template URL"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.template_url?(a=aY.template_url).startsWith("http://")||a.startsWith("https://")?(0,b.jsx)("a",{href:aY.template_url,className:"cfg-link",children:aY.template_url}):aY.template_url:"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import schema version"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_schema_version??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Import operation ID"}),(0,b.jsx)("dd",{className:"text-right break-all",children:aY.import_operation_id??"—"})]}),(0,b.jsxs)("div",{className:"flex justify-between gap-4 py-1 border-y cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:"Imported at"}),(0,b.jsx)("dd",{className:"text-right",children:aY.import_timestamp?v(aY.import_timestamp):"—"})]})]}),(0,b.jsx)(q,{phase:aB,onImport:()=>{aC()}})]})]}),(0,b.jsxs)("div",{className:"min-w-0 space-y-6","data-cfg-column":"secondary",children:[(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsx)("h2",{className:"cfg-title mb-3",children:"Launch snapshots"}),0===a_.length?(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"No launches recorded yet."}):(0,b.jsx)("ul",{className:"space-y-3",children:a_.map(a=>{let c=a.hash===a$,d=!!aa[a.id];return(0,b.jsxs)("li",{className:"cfg-row",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,b.jsxs)("p",{className:"text-sm",children:[v(a.created_at)," · ",a.id.slice(0,4),a.transport?` \xb7 ${a.transport}`:null]}),(0,b.jsx)("button",{onClick:()=>ab(b=>({...b,[a.id]:!b[a.id]})),"aria-label":d?"Collapse snapshot detail":"Expand snapshot detail",className:"cfg-chevron px-1",children:d?"▾":"▸"})]}),(0,b.jsxs)("p",{className:"mt-1 text-sm",children:[(0,b.jsx)("code",{className:"cfg-code",children:a.hash.slice(0,12)})," ",(0,b.jsx)("button",{onClick:()=>aO(a.id,a.hash),className:"cfg-link text-sm",children:ac===a.id?"Copied":"Copy"})]}),(0,b.jsx)("p",{className:"mt-1 text-sm",children:c?(0,b.jsx)("span",{className:"cfg-ok",children:"● Matches current config"}):(0,b.jsx)("span",{className:"cfg-faint",children:"○ Config changed since"})}),d&&(0,b.jsxs)("div",{className:"mt-3 pt-3 border-t cfg-line text-sm",children:[(0,b.jsxs)("p",{className:"cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Launch ID:"})," ",a.id]}),(0,b.jsxs)("p",{className:"mt-1 cfg-muted break-all",children:[(0,b.jsx)("span",{className:"font-medium",children:"Hash:"})," ",(0,b.jsx)("code",{className:"cfg-code",children:a.hash})]}),(0,b.jsx)("dl",{className:"mt-2",children:t.map(c=>{let d=a.snapshot[c.key];return(0,b.jsxs)("div",{className:"py-1 border-t cfg-line",children:[(0,b.jsx)("dt",{className:"cfg-faint",children:c.label}),(0,b.jsx)("dd",{className:"whitespace-pre-wrap break-words",children:null==d?(0,b.jsx)("span",{className:"cfg-faint",children:"null"}):Array.isArray(d)?0===d.length?(0,b.jsx)("span",{className:"cfg-faint",children:"(none)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d.map(a=>`- ${a}`).join("\n")}):"boolean"==typeof d?String(d):""===d?(0,b.jsx)("span",{className:"cfg-faint",children:"(empty)"}):(0,b.jsx)("span",{className:"block max-h-32 overflow-y-auto",children:d})})]},c.key)})})]})]},a.id)})})]}),(0,b.jsx)(h,{agentId:aY.id,agentName:aY.name}),(0,b.jsxs)("section",{className:"cfg-card",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,b.jsx)("h2",{className:"cfg-title",children:"Avatar"}),a4]}),(0,b.jsxs)("div",{className:"flex items-center gap-4 mb-4",children:[(0,b.jsx)(n.default,{config:aL,size:96,title:"Avatar live preview"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:"Outline style: the color is the line color, nothing is filled. Pick an option to preview, then Save."})]}),(0,b.jsx)(o,{attribute:"color",label:"Color",options:r.AVATAR_COLORS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"eyes",label:"Eyes",options:r.AVATAR_EYES,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"hands",label:"Hands",options:r.AVATAR_HANDS,current:aL,onPick:aT,className:"mb-3"}),(0,b.jsx)(o,{attribute:"accessory",label:"Accessory",options:r.AVATAR_ACCESSORIES,current:aL,onPick:aT}),"error"===av&&(0,b.jsxs)("p",{className:"mt-2 text-sm cfg-error",children:["Couldn't save: ",ax,"."," ",(0,b.jsx)("button",{onClick:aU,className:"underline hover:no-underline",children:"Retry"})]}),(0,b.jsxs)("div",{className:"mt-3 flex gap-2",children:[(0,b.jsx)("button",{onClick:aU,disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-primary text-sm",children:"saving"===av?"Saving…":"Save"}),(0,b.jsx)("button",{onClick:function(){au(null),aw("clean"),ay("")},disabled:!aM||"saving"===av,className:"flex-1 sm:flex-none cfg-btn-ghost text-sm",children:"Discard"})]})]}),(0,b.jsxs)("section",{className:"cfg-card cfg-danger","aria-labelledby":"cfg-danger-title",children:[(0,b.jsx)("h2",{id:"cfg-danger-title",className:"cfg-title mb-3",children:"Danger zone"}),(0,b.jsx)("p",{className:"text-sm cfg-muted",children:i.DELETE_REMOVES_COPY}),(0,b.jsx)("p",{className:"text-sm cfg-faint mt-2",children:i.DELETE_KEEPS_COPY}),(0,b.jsx)("button",{type:"button",onClick:()=>z(!0),className:"mt-3 delete-btn text-sm w-full sm:w-auto",children:"Delete agent"})]})]})]})]}),y?(0,b.jsx)(f.default,{ids:[aY.id],onCancel:()=>z(!1),onDeleted:a=>u.push(`/?deleted=${Math.max(a.length,1)}`)}):null]})}],48219)}];
2
+
3
+ //# sourceMappingURL=app_agents_%5Bid%5D_config_page_tsx_1f_gu1l._.js.map
@@ -5,6 +5,6 @@ ${I.trim()}
5
5
  ${K}`),F("");let h=g.map(a=>a.context.workspace).filter(a=>!!a);N(a=>[...new Set([...d?[]:a,...h])])}).catch(()=>{f||ae.current!==b||F("Could not load sessions.")})},e);return()=>{f=!0,clearTimeout(g)}},[a,u,I,K,G]),(0,d.useEffect)(()=>{if(!t||null===w)return;if(w.some(a=>a.ref===t)){al.current!==t&&(al.current=t,requestAnimationFrame(()=>requestAnimationFrame(()=>{document.querySelector(`[data-session-ref="${CSS.escape(t)}"]`)?.scrollIntoView({block:"nearest"})})));return}if("all"!==u||I.trim()||K)return;let b=!1;return fetch(`/api/bots/${encodeURIComponent(a)}/sessions/${encodeURIComponent(t)}`,{cache:"no-store"}).then(async a=>{let c=await a.json().catch(()=>null);if(b||!a.ok||!c?.session)return;let d=c.session;x(a=>!a||a.some(a=>a.ref===d.ref)?a:[d,...a])}).catch(()=>{}),()=>{b=!0}},[t,w,a,u,I,K]),(0,d.useEffect)(()=>{w&&(t&&w.some(a=>a.ref===t)?V(t):V(null))},[t,w]),(0,d.useEffect)(()=>{!w||!t||w.some(a=>a.ref===t)||("all"!==u||I.trim()||K)&&o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},[w,t,u,I,K,a,o]),(0,d.useEffect)(()=>{if(!U){let a=ai.current;if(!a||ak.current)return;ai.current=null,a.isConnected&&a.focus();return}ak.current&&(ak.current=!1,aj.current?.focus())},[U]);let an=`${a}
6
6
  ${u}
7
7
  ${I.trim()}
8
- ${K}`,ao=null!==O&&S===an,ap=(0,d.useCallback)(async()=>{if(Q||!w||!O||S!==an)return;R(!0);let b=ae.current;try{let c=await fetch(p(a,u,I,K,O),{cache:"no-store"}),d=await c.json().catch(()=>null);if(ae.current!==b)return;if(!c.ok||!Array.isArray(d?.sessions))return void F("Could not load more sessions.");let e=d.sessions,f=new Set(w.map(a=>a.ref));x([...w,...e.filter(a=>!f.has(a.ref))]),P("string"==typeof d?.next_cursor?d.next_cursor:null),F("");let g=e.map(a=>a.context.workspace).filter(a=>!!a);g.length&&N(a=>[...new Set([...a,...g])])}catch{ae.current===b&&F("Could not load more sessions.")}finally{R(!1)}},[a,u,I,K,Q,w,O,an,S]),aq=(0,d.useCallback)(async()=>{if(!A){B(!0),D("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a)}/sessions/sync`,{method:"POST"}),c=await b.json().catch(()=>null);if(409===b.status)D("A sync is already running.");else if(b.ok){let a=Array.isArray(c?.imported)?c.imported.length:0,b=Array.isArray(c?.updated)?c.updated.length:0;D(`Synced: ${a} imported, ${b} updated.`)}else D("Could not sync sessions.")}catch{D("Could not sync sessions.")}finally{B(!1),H(a=>a+1)}}},[a,A]);(0,d.useEffect)(()=>{let b=!1,c=encodeURIComponent(a);return fetch(`/api/bots/${c}/share-policy`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||ab(a?.policy??null)}).catch(()=>{b||ab(null)}),fetch(`/api/shares?agent_id=${c}&limit=100`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||_(Array.isArray(a?.shares)?a.shares:[])}).catch(()=>{b||_([])}),()=>{b=!0}},[a,ac]),(0,d.useEffect)(()=>{let a=setInterval(()=>ad(a=>a+1),15e3);return()=>clearInterval(a)},[]),(0,d.useEffect)(()=>{if(W||!ah.current)return;let a=ah.current;ah.current=null,a.isConnected&&a.focus()},[W]);let ar=(a=u)=>{x(null),F(""),v(a),H(a=>a+1)},as=""!==I.trim()||""!==K,at=w?.find(a=>a.ref===U)??null,au=(b,c)=>{ai.current=c,ak.current=!0,o.replace(`/agents/${encodeURIComponent(a)}/sessions?session=${encodeURIComponent(b.ref)}`,{scroll:!1})},av=()=>{ah.current=W?.returnTo??null,X(null)};return(0,b.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,b.jsxs)("header",{className:"agent-sessions-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,b.jsxs)("h2",{children:["Review ",h,"’s work"]}),(0,b.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,b.jsxs)("div",{className:"agent-sessions-sync",children:[(0,b.jsxs)("span",{children:["Last synced ",(0,f.formatSyncRelativeTime)(y?.synced_at??null)]}),(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{aq()},disabled:A,children:A?"Refreshing…":"Refresh"})]})]}),(0,b.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,b.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:f.SESSION_FILTER_OPTIONS.map(a=>(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":u===a.value,onClick:()=>{u!==a.value&&ar(a.value)},children:a.label},a.value))}),(0,b.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:I,onChange:a=>J(a.target.value)}),(0,b.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:K,onChange:a=>L(a.target.value),children:[(0,b.jsx)("option",{value:"",children:"All workspaces"}),(0,f.workspaceOptions)(M).map(a=>(0,b.jsx)("option",{value:a.value,title:a.value,children:a.label},a.value))]}),(0,b.jsx)("span",{className:"manage-count","aria-live":"polite",children:w?`${w.length} shown`:""})]}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:C}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,b.jsxs)(b.Fragment,{children:[Y.text," ",Y.id?(0,b.jsx)(c.default,{className:"session-link",href:(0,i.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,b.jsxs)("div",{className:`sessions-review${at?" has-detail":""}`,inert:!!W,children:[(0,b.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,b.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),E?(0,b.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,b.jsx)("p",{className:"delete-error",children:E}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ar(),children:"Retry"})]}):null,w||E?null:(0,b.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),w?(0,b.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${h}`,children:[0===w.length?(0,b.jsx)("li",{className:"delete-copy sessions-state",children:as?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.noMatchingSessionsCopy)(I,K||null)}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{J(""),L("")},children:"Clear search"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.emptySessionsCopy)(u,h,y,am)}),"all"===u&&y?.last_error_code?(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{aq()},disabled:A,children:A?"Retrying…":"Retry"}):null,"all"===u&&!y?.last_error_code&&(y?.out_of_scope_count??0)>0?(0,b.jsx)(c.default,{className:"session-link",href:`/bots/${encodeURIComponent(a)}/config`,children:"Widen the scope in Config"}):null]})}):null,w.map(a=>(0,b.jsx)(r,{row:a,selected:U===a.ref,onSelect:au},a.ref))]}):null,w&&w.length>0&&ao?(0,b.jsx)("div",{className:"sessions-more",children:(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ap()},disabled:Q,children:Q?"Loading…":"Load more"})}):null]}),(0,b.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:at?(0,b.jsx)(s,{row:at,agentId:a,headingRef:aj,origin:m,agents:l,shares:$,sharePolicy:aa,onClose:()=>{ak.current=!1,o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},onAction:(a,b)=>{Z(null),X({mode:a,row:at,returnTo:b})},onSharesChanged:()=>ad(a=>a+1)},at.ref):(0,b.jsxs)("div",{className:"sessions-detail-empty",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{children:"Select a session"}),(0,b.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&m?(0,b.jsx)(j,{mode:W.mode,session:W.row,agents:l,origin:m,onClose:av,onStarted:a=>{Z({id:a,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${m.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${m.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${m.label}.`}),av(),n?.(a)}}):null]})}function r({row:a,selected:c,onSelect:d}){let e=(0,i.sessionRowActions)(a).filter(a=>a.availability.available).length,g=(0,f.workspaceFolderName)(a.context.workspace),h=(0,f.sessionOriginChips)(a),j=(0,f.sessionStateTags)(a);return(0,b.jsx)("li",{className:`session-scan-row is-${a.status}${c?" is-selected":""}`,"data-session-ref":a.ref,children:(0,b.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":c?"true":void 0,onClick:b=>d(a,b.currentTarget),children:[(0,b.jsxs)("span",{className:"session-scan-title-line",children:[(0,b.jsx)("strong",{className:"session-title",children:a.title}),(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)})]}),(0,b.jsxs)("span",{className:"session-scan-context",children:[(0,b.jsx)("span",{className:"session-activity",children:(0,f.formatSessionDate)(a.last_activity_at)}),g?(0,b.jsx)("span",{className:"session-workspace",title:a.context.workspace??void 0,children:g}):null]}),h.length||j.length?(0,b.jsxs)("span",{className:"session-scan-chips",children:[h.map(a=>(0,b.jsx)("span",{className:"session-origin-chip",children:a},a)),j.map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}):null,(0,b.jsx)("span",{className:`session-attention${e?" is-actionable":""}`,children:e?`${e} action${1===e?"":"s"} available`:"Review details"})]})})}function s({row:a,agentId:e,headingRef:g,origin:h,agents:j,shares:k,sharePolicy:l,onClose:n,onAction:o,onSharesChanged:p}){let q,[r,t]=(0,d.useState)(null),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(null),[B,C]=(0,d.useState)(""),[D,E]=(0,d.useState)(!1),F=`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(a.ref)}`,G=(0,i.sessionRowActions)(a),H=G.filter(a=>a.availability.available),I=G.filter(a=>!a.availability.available),J=a.origin.conversation,K=(q=a.origin.conversation)?q.thread_agent_id?`/agents/${encodeURIComponent(q.thread_agent_id)}/conversations`:"group"===q.kind?`/threads/${encodeURIComponent(q.id)}`:null:null,L=(0,f.workRequestLabel)(a),M=(0,f.sessionUsageLine)(a.usage);(0,d.useEffect)(()=>{let a=!1;return fetch(F,{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);a||(b.ok&&Array.isArray(c?.session?.attempts)?(t(c.session.attempts),w({totals:c.session.usage,samples:Array.isArray(c.session.usage_samples)?c.session.usage_samples:[]})):y("Could not load session details."))}).catch(()=>{a||y("Could not load session details.")}),()=>{a=!0}},[F]);let N=(0,d.useCallback)(async()=>{if(null===z)try{let a=await fetch(`${F}?debug=external_session_id`,{cache:"no-store"}),b=await a.json().catch(()=>null),c=b?.debug?.external_session_id;a.ok&&"string"==typeof c?A(c):C("Not available.")}catch{C("Not available.")}},[F,z]),O=async()=>{if(z)try{await navigator.clipboard.writeText(z),E(!0)}catch{E(!1)}};return(0,b.jsxs)("article",{className:"session-detail","data-session-detail":a.ref,children:[(0,b.jsxs)("div",{className:"session-detail-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{ref:g,tabIndex:-1,children:a.title})]}),(0,b.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:n,children:"Back to session list"})]}),(0,b.jsxs)("div",{className:"session-detail-tags",children:[(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)}),(0,f.sessionStateTags)(a).map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}),(0,b.jsxs)("dl",{className:"session-detail-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Last activity"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.last_activity_at)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Started"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.created_at)})]}),null!==a.ended_at?(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Ended"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.ended_at)})]}):null,(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Runtime"}),(0,b.jsx)("dd",{children:(0,f.runtimeLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reported usage"}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${M.quality}`,"aria-hidden":"true",children:M.text}),(0,b.jsx)("span",{className:"session-sr",children:M.label}),M.partial?(0,b.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),a.context.workspace?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Workspace"}),(0,b.jsx)("dd",{children:a.context.workspace})]}):null,(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsx)("dd",{children:K&&J?(0,b.jsx)(c.default,{className:"session-link",href:K,children:J.label}):J?.label??"Not recorded"})]}),L?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Work request"}),(0,b.jsx)("dd",{children:L})]}):null]}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${a.ref}`,children:[(0,b.jsx)("h4",{id:`actions-${a.ref}`,children:"Actions"}),h&&H.length?(0,b.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${a.title}`,children:H.map(a=>(0,b.jsx)("button",{type:"button",className:"session-action","data-session-action":a.action,"aria-haspopup":"dialog",onClick:b=>o((0,i.sessionDialogMode)(a.action),b.currentTarget),children:a.label},a.action))}):null,!h&&H.length?(0,b.jsx)("p",{className:"session-unavailable",children:"Open this Agent’s Conversation before starting an action."}):null,I.length?(0,b.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${a.title}`,children:I.map(a=>(0,b.jsxs)("li",{children:[(0,b.jsxs)("strong",{children:[a.label,":"]})," ",a.availability.available?"":a.availability.reason]},a.action))}):null]}),(0,b.jsx)("section",{className:"session-detail-section",children:(0,b.jsx)(m,{row:a,shares:k,policy:l,onChanged:p})}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${a.ref}`,children:[(0,b.jsx)("h4",{id:`runs-${a.ref}`,children:"Runs and usage"}),x?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:x}):null,r||x?null:(0,b.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),r?(0,b.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===r.length?(0,b.jsx)("li",{children:"No recorded runs."}):null,r.map(a=>(0,b.jsxs)("li",{children:[(0,f.formatSessionDate)(a.started_at)," · ",(0,f.attemptLabel)(a)]},`${a.request_id}-${a.attempt_number}`))]}):null,v?(0,b.jsx)(u,{totals:v.totals,samples:v.samples}):null]}),(0,b.jsxs)("details",{className:"session-debug session-detail-section",onToggle:a=>{a.currentTarget.open&&N()},children:[(0,b.jsx)("summary",{children:"Local debug: provider session ID"}),(0,b.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),B?(0,b.jsx)("p",{className:"delete-error",children:B}):null,z?(0,b.jsxs)("div",{className:"session-debug-value",children:[(0,b.jsx)("code",{children:z}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{O()},children:D?"Copied":"Copy"})]}):null]})]})}let t=["input_tokens","output_tokens","cost_usd"];function u({totals:a,samples:c}){let e=(0,d.useId)();return(0,b.jsxs)("section",{className:"session-usage-detail","aria-labelledby":e,children:[(0,b.jsx)("h5",{id:e,className:"session-usage-head",children:"Reported usage"}),(0,b.jsx)("dl",{className:"session-usage-totals",children:t.map(c=>{let d=(0,f.usageMetricView)(c,a?.[c],!0);return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:d.name}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${d.quality}`,"aria-hidden":"true",children:d.text}),(0,b.jsxs)("span",{className:"session-sr",children:[d.label,"."]}),(0,b.jsx)("span",{className:`session-usage-coverage is-${d.quality}`,children:d.coverage})]})]},c)})}),0===c.length?(0,b.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,b.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:c.map((a,c)=>{let d=(0,f.usageSampleValues)(a);return(0,b.jsxs)("li",{children:[(0,b.jsxs)("span",{className:"session-usage-run",children:[(0,f.formatSessionDate)(a.observed_at)," · ",(0,f.usageSampleLabel)(a,c)]}),(0,b.jsxs)("span",{className:"session-usage-values",children:[(0,b.jsxs)("span",{className:null===a.input_tokens?"is-unavailable":void 0,children:["In ",d.input]}),(0,b.jsxs)("span",{className:null===a.output_tokens?"is-unavailable":void 0,children:["Out ",d.output]}),(0,b.jsxs)("span",{className:null===a.cost_usd?"is-unavailable":void 0,children:["Cost ",d.cost]})]})]},`${a.observed_at}-${c}`)})})]})}var v=a.i(15722);a.s(["default",0,function(){let{id:a,agents:d,overview:e,loading:f,error:g,notFound:h}=(0,v.useAgentOverview)();return f?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):h?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):g||!e?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Sessions unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]}):(0,b.jsx)(q,{agentId:a,agentName:e.agent.name,agentProvider:e.runtime.agent,agents:d.map(a=>({id:a.id,name:a.name})),origin:e.conversation?{conversationId:e.conversation.id,label:`${e.agent.name} conversation`}:null})}],26847)}];
8
+ ${K}`,ao=null!==O&&S===an,ap=(0,d.useCallback)(async()=>{if(Q||!w||!O||S!==an)return;R(!0);let b=ae.current;try{let c=await fetch(p(a,u,I,K,O),{cache:"no-store"}),d=await c.json().catch(()=>null);if(ae.current!==b)return;if(!c.ok||!Array.isArray(d?.sessions))return void F("Could not load more sessions.");let e=d.sessions,f=new Set(w.map(a=>a.ref));x([...w,...e.filter(a=>!f.has(a.ref))]),P("string"==typeof d?.next_cursor?d.next_cursor:null),F("");let g=e.map(a=>a.context.workspace).filter(a=>!!a);g.length&&N(a=>[...new Set([...a,...g])])}catch{ae.current===b&&F("Could not load more sessions.")}finally{R(!1)}},[a,u,I,K,Q,w,O,an,S]),aq=(0,d.useCallback)(async()=>{if(!A){B(!0),D("");try{let b=await fetch(`/api/bots/${encodeURIComponent(a)}/sessions/sync`,{method:"POST"}),c=await b.json().catch(()=>null);if(409===b.status)D("A sync is already running.");else if(b.ok){let a=Array.isArray(c?.imported)?c.imported.length:0,b=Array.isArray(c?.updated)?c.updated.length:0;D(`Synced: ${a} imported, ${b} updated.`)}else D("Could not sync sessions.")}catch{D("Could not sync sessions.")}finally{B(!1),H(a=>a+1)}}},[a,A]);(0,d.useEffect)(()=>{let b=!1,c=encodeURIComponent(a);return fetch(`/api/bots/${c}/share-policy`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||ab(a?.policy??null)}).catch(()=>{b||ab(null)}),fetch(`/api/shares?agent_id=${c}&limit=100`,{cache:"no-store"}).then(a=>a.ok?a.json():null).then(a=>{b||_(Array.isArray(a?.shares)?a.shares:[])}).catch(()=>{b||_([])}),()=>{b=!0}},[a,ac]),(0,d.useEffect)(()=>{let a=setInterval(()=>ad(a=>a+1),15e3);return()=>clearInterval(a)},[]),(0,d.useEffect)(()=>{if(W||!ah.current)return;let a=ah.current;ah.current=null,a.isConnected&&a.focus()},[W]);let ar=(a=u)=>{x(null),F(""),v(a),H(a=>a+1)},as=""!==I.trim()||""!==K,at=w?.find(a=>a.ref===U)??null,au=(b,c)=>{ai.current=c,ak.current=!0,o.replace(`/agents/${encodeURIComponent(a)}/sessions?session=${encodeURIComponent(b.ref)}`,{scroll:!1})},av=()=>{ah.current=W?.returnTo??null,X(null)};return(0,b.jsxs)("div",{className:"agent-sessions-page","data-agent-sessions-page":!0,children:[(0,b.jsxs)("header",{className:"agent-sessions-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Sessions"}),(0,b.jsxs)("h2",{children:["Review ",h,"’s work"]}),(0,b.jsx)("p",{children:"Scan runtime sessions, then open one for actions and operational detail."})]}),(0,b.jsxs)("div",{className:"agent-sessions-sync",children:[(0,b.jsxs)("span",{children:["Last synced ",(0,f.formatSyncRelativeTime)(y?.synced_at??null)]}),(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{aq()},disabled:A,children:A?"Refreshing…":"Refresh"})]})]}),(0,b.jsxs)("div",{className:"sessions-filter",role:"group","aria-label":"Filter sessions",children:[(0,b.jsx)("div",{className:"sessions-status-filter",role:"group","aria-label":"Show sessions",children:f.SESSION_FILTER_OPTIONS.map(a=>(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn","aria-pressed":u===a.value,onClick:()=>{u!==a.value&&ar(a.value)},children:a.label},a.value))}),(0,b.jsx)("input",{type:"search",className:"sessions-search","aria-label":"Search sessions by title",placeholder:"Search by title",value:I,onChange:a=>J(a.target.value)}),(0,b.jsxs)("select",{className:"sessions-workspace","aria-label":"Filter sessions by workspace",value:K,onChange:a=>L(a.target.value),children:[(0,b.jsx)("option",{value:"",children:"All workspaces"}),(0,f.workspaceOptions)(M).map(a=>(0,b.jsx)("option",{value:a.value,title:a.value,children:a.label},a.value))]}),(0,b.jsx)("span",{className:"manage-count","aria-live":"polite",children:w?`${w.length} shown`:""})]}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:C}),(0,b.jsx)("div",{className:"exchange-started",role:"status",children:Y?(0,b.jsxs)(b.Fragment,{children:[Y.text," ",Y.id?(0,b.jsx)(c.default,{className:"session-link",href:(0,i.detailsHref)(Y.id),children:"View in Exchanges"}):null]}):null}),(0,b.jsxs)("div",{className:`sessions-review${at?" has-detail":""}`,inert:!!W,children:[(0,b.jsxs)("section",{className:"sessions-list-pane","aria-labelledby":"sessions-list-title",children:[(0,b.jsx)("h3",{id:"sessions-list-title",className:"session-sr",children:"Session list"}),E?(0,b.jsxs)("div",{className:"sessions-state",role:"alert",children:[(0,b.jsx)("p",{className:"delete-error",children:E}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>ar(),children:"Retry"})]}):null,w||E?null:(0,b.jsx)("p",{className:"delete-copy sessions-state",role:"status",children:"Loading sessions…"}),w?(0,b.jsxs)("ul",{className:"sessions-list","aria-label":`Sessions for ${h}`,children:[0===w.length?(0,b.jsx)("li",{className:"delete-copy sessions-state",children:as?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.noMatchingSessionsCopy)(I,K||null)}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{J(""),L("")},children:"Clear search"})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("p",{children:(0,f.emptySessionsCopy)(u,h,y,am)}),"all"===u&&y?.last_error_code?(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{aq()},disabled:A,children:A?"Retrying…":"Retry"}):null,"all"===u&&!y?.last_error_code&&(y?.out_of_scope_count??0)>0?(0,b.jsx)(c.default,{className:"session-link",href:`/agents/${encodeURIComponent(a)}/config`,children:"Widen the scope in Config"}):null]})}):null,w.map(a=>(0,b.jsx)(r,{row:a,selected:U===a.ref,onSelect:au},a.ref))]}):null,w&&w.length>0&&ao?(0,b.jsx)("div",{className:"sessions-more",children:(0,b.jsx)("button",{type:"button",className:"sessions-filter-btn",onClick:()=>{ap()},disabled:Q,children:Q?"Loading…":"Load more"})}):null]}),(0,b.jsx)("section",{className:"sessions-detail-pane","aria-label":"Session detail",children:at?(0,b.jsx)(s,{row:at,agentId:a,headingRef:aj,origin:m,agents:l,shares:$,sharePolicy:aa,onClose:()=>{ak.current=!1,o.replace(`/agents/${encodeURIComponent(a)}/sessions`,{scroll:!1})},onAction:(a,b)=>{Z(null),X({mode:a,row:at,returnTo:b})},onSharesChanged:()=>ad(a=>a+1)},at.ref):(0,b.jsxs)("div",{className:"sessions-detail-empty",children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{children:"Select a session"}),(0,b.jsx)("p",{children:"Actions, usage, origin, shares, and debug detail appear here."})]})})]}),W&&m?(0,b.jsx)(j,{mode:W.mode,session:W.row,agents:l,origin:m,onClose:av,onStarted:a=>{Z({id:a,text:"ask"===W.mode?`Asked ${W.row.agent.name}’s session. The answer arrives in ${m.label}.`:"resume"===W.mode?`Resumed work in ${W.row.agent.name}’s session. Progress shows in ${m.label}.`:`Handoff started from ${W.row.agent.name}’s session. Progress shows in ${m.label}.`}),av(),n?.(a)}}):null]})}function r({row:a,selected:c,onSelect:d}){let e=(0,i.sessionRowActions)(a).filter(a=>a.availability.available).length,g=(0,f.workspaceFolderName)(a.context.workspace),h=(0,f.sessionOriginChips)(a),j=(0,f.sessionStateTags)(a);return(0,b.jsx)("li",{className:`session-scan-row is-${a.status}${c?" is-selected":""}`,"data-session-ref":a.ref,children:(0,b.jsxs)("button",{type:"button",className:"session-scan-button","aria-current":c?"true":void 0,onClick:b=>d(a,b.currentTarget),children:[(0,b.jsxs)("span",{className:"session-scan-title-line",children:[(0,b.jsx)("strong",{className:"session-title",children:a.title}),(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)})]}),(0,b.jsxs)("span",{className:"session-scan-context",children:[(0,b.jsx)("span",{className:"session-activity",children:(0,f.formatSessionDate)(a.last_activity_at)}),g?(0,b.jsx)("span",{className:"session-workspace",title:a.context.workspace??void 0,children:g}):null]}),h.length||j.length?(0,b.jsxs)("span",{className:"session-scan-chips",children:[h.map(a=>(0,b.jsx)("span",{className:"session-origin-chip",children:a},a)),j.map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}):null,(0,b.jsx)("span",{className:`session-attention${e?" is-actionable":""}`,children:e?`${e} action${1===e?"":"s"} available`:"Review details"})]})})}function s({row:a,agentId:e,headingRef:g,origin:h,agents:j,shares:k,sharePolicy:l,onClose:n,onAction:o,onSharesChanged:p}){let q,[r,t]=(0,d.useState)(null),[v,w]=(0,d.useState)(null),[x,y]=(0,d.useState)(""),[z,A]=(0,d.useState)(null),[B,C]=(0,d.useState)(""),[D,E]=(0,d.useState)(!1),F=`/api/bots/${encodeURIComponent(e)}/sessions/${encodeURIComponent(a.ref)}`,G=(0,i.sessionRowActions)(a),H=G.filter(a=>a.availability.available),I=G.filter(a=>!a.availability.available),J=a.origin.conversation,K=(q=a.origin.conversation)?q.thread_agent_id?`/agents/${encodeURIComponent(q.thread_agent_id)}/conversations`:"group"===q.kind?`/threads/${encodeURIComponent(q.id)}`:null:null,L=(0,f.workRequestLabel)(a),M=(0,f.sessionUsageLine)(a.usage);(0,d.useEffect)(()=>{let a=!1;return fetch(F,{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);a||(b.ok&&Array.isArray(c?.session?.attempts)?(t(c.session.attempts),w({totals:c.session.usage,samples:Array.isArray(c.session.usage_samples)?c.session.usage_samples:[]})):y("Could not load session details."))}).catch(()=>{a||y("Could not load session details.")}),()=>{a=!0}},[F]);let N=(0,d.useCallback)(async()=>{if(null===z)try{let a=await fetch(`${F}?debug=external_session_id`,{cache:"no-store"}),b=await a.json().catch(()=>null),c=b?.debug?.external_session_id;a.ok&&"string"==typeof c?A(c):C("Not available.")}catch{C("Not available.")}},[F,z]),O=async()=>{if(z)try{await navigator.clipboard.writeText(z),E(!0)}catch{E(!1)}};return(0,b.jsxs)("article",{className:"session-detail","data-session-detail":a.ref,children:[(0,b.jsxs)("div",{className:"session-detail-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Session detail"}),(0,b.jsx)("h3",{ref:g,tabIndex:-1,children:a.title})]}),(0,b.jsx)("button",{type:"button",className:"pin-word session-detail-close",onClick:n,children:"Back to session list"})]}),(0,b.jsxs)("div",{className:"session-detail-tags",children:[(0,b.jsx)("span",{className:`manage-tag session-status is-${a.status}`,children:(0,f.statusLabel)(a)}),(0,f.sessionStateTags)(a).map(a=>(0,b.jsx)("span",{className:`manage-tag session-state-tag is-${a.toLowerCase()}`,children:a},a))]}),(0,b.jsxs)("dl",{className:"session-detail-meta",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Last activity"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.last_activity_at)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Started"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.created_at)})]}),null!==a.ended_at?(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Ended"}),(0,b.jsx)("dd",{children:(0,f.formatSessionDate)(a.ended_at)})]}):null,(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Runtime"}),(0,b.jsx)("dd",{children:(0,f.runtimeLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Reported usage"}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${M.quality}`,"aria-hidden":"true",children:M.text}),(0,b.jsx)("span",{className:"session-sr",children:M.label}),M.partial?(0,b.jsx)("span",{className:"manage-tag session-usage-tag",children:"Partial"}):null]})]}),a.context.workspace?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Workspace"}),(0,b.jsx)("dd",{children:a.context.workspace})]}):null,(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Origin"}),(0,b.jsx)("dd",{children:K&&J?(0,b.jsx)(c.default,{className:"session-link",href:K,children:J.label}):J?.label??"Not recorded"})]}),L?(0,b.jsxs)("div",{className:"is-wide",children:[(0,b.jsx)("dt",{children:"Work request"}),(0,b.jsx)("dd",{children:L})]}):null]}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`actions-${a.ref}`,children:[(0,b.jsx)("h4",{id:`actions-${a.ref}`,children:"Actions"}),h&&H.length?(0,b.jsx)("div",{className:"session-actions",role:"group","aria-label":`Actions for ${a.title}`,children:H.map(a=>(0,b.jsx)("button",{type:"button",className:"session-action","data-session-action":a.action,"aria-haspopup":"dialog",onClick:b=>o((0,i.sessionDialogMode)(a.action),b.currentTarget),children:a.label},a.action))}):null,!h&&H.length?(0,b.jsx)("p",{className:"session-unavailable",children:"Open this Agent’s Conversation before starting an action."}):null,I.length?(0,b.jsx)("ul",{className:"session-unavailable","aria-label":`Unavailable actions for ${a.title}`,children:I.map(a=>(0,b.jsxs)("li",{children:[(0,b.jsxs)("strong",{children:[a.label,":"]})," ",a.availability.available?"":a.availability.reason]},a.action))}):null]}),(0,b.jsx)("section",{className:"session-detail-section",children:(0,b.jsx)(m,{row:a,shares:k,policy:l,onChanged:p})}),(0,b.jsxs)("section",{className:"session-detail-section","aria-labelledby":`runs-${a.ref}`,children:[(0,b.jsx)("h4",{id:`runs-${a.ref}`,children:"Runs and usage"}),x?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:x}):null,r||x?null:(0,b.jsx)("p",{className:"delete-copy",role:"status",children:"Loading details…"}),r?(0,b.jsxs)("ol",{className:"session-attempts","aria-label":"Runs in this session",children:[0===r.length?(0,b.jsx)("li",{children:"No recorded runs."}):null,r.map(a=>(0,b.jsxs)("li",{children:[(0,f.formatSessionDate)(a.started_at)," · ",(0,f.attemptLabel)(a)]},`${a.request_id}-${a.attempt_number}`))]}):null,v?(0,b.jsx)(u,{totals:v.totals,samples:v.samples}):null]}),(0,b.jsxs)("details",{className:"session-debug session-detail-section",onToggle:a=>{a.currentTarget.open&&N()},children:[(0,b.jsx)("summary",{children:"Local debug: provider session ID"}),(0,b.jsx)("p",{className:"session-debug-note",children:"For local troubleshooting only. Botmancers resumes sessions for you; you never need to copy this."}),B?(0,b.jsx)("p",{className:"delete-error",children:B}):null,z?(0,b.jsxs)("div",{className:"session-debug-value",children:[(0,b.jsx)("code",{children:z}),(0,b.jsx)("button",{type:"button",className:"pin-word",onClick:()=>{O()},children:D?"Copied":"Copy"})]}):null]})]})}let t=["input_tokens","output_tokens","cost_usd"];function u({totals:a,samples:c}){let e=(0,d.useId)();return(0,b.jsxs)("section",{className:"session-usage-detail","aria-labelledby":e,children:[(0,b.jsx)("h5",{id:e,className:"session-usage-head",children:"Reported usage"}),(0,b.jsx)("dl",{className:"session-usage-totals",children:t.map(c=>{let d=(0,f.usageMetricView)(c,a?.[c],!0);return(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:d.name}),(0,b.jsxs)("dd",{children:[(0,b.jsx)("span",{className:`session-usage is-${d.quality}`,"aria-hidden":"true",children:d.text}),(0,b.jsxs)("span",{className:"session-sr",children:[d.label,"."]}),(0,b.jsx)("span",{className:`session-usage-coverage is-${d.quality}`,children:d.coverage})]})]},c)})}),0===c.length?(0,b.jsx)("p",{className:"session-usage-none",children:"No run in this session reported usage."}):(0,b.jsx)("ol",{className:"session-usage-runs","aria-label":"Reported usage by run",children:c.map((a,c)=>{let d=(0,f.usageSampleValues)(a);return(0,b.jsxs)("li",{children:[(0,b.jsxs)("span",{className:"session-usage-run",children:[(0,f.formatSessionDate)(a.observed_at)," · ",(0,f.usageSampleLabel)(a,c)]}),(0,b.jsxs)("span",{className:"session-usage-values",children:[(0,b.jsxs)("span",{className:null===a.input_tokens?"is-unavailable":void 0,children:["In ",d.input]}),(0,b.jsxs)("span",{className:null===a.output_tokens?"is-unavailable":void 0,children:["Out ",d.output]}),(0,b.jsxs)("span",{className:null===a.cost_usd?"is-unavailable":void 0,children:["Cost ",d.cost]})]})]},`${a.observed_at}-${c}`)})})]})}var v=a.i(15722);a.s(["default",0,function(){let{id:a,agents:d,overview:e,loading:f,error:g,notFound:h}=(0,v.useAgentOverview)();return f?(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading sessions…"}):h?(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]}):g||!e?(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Sessions unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent. Refresh to try again."})]}):(0,b.jsx)(q,{agentId:a,agentName:e.agent.name,agentProvider:e.runtime.agent,agents:d.map(a=>({id:a.id,name:a.name})),origin:e.conversation?{conversationId:e.conversation.id,label:`${e.agent.name} conversation`}:null})}],26847)}];
9
9
 
10
10
  //# sourceMappingURL=app_agents_%5Bid%5D_sessions_page_tsx_0tfup-2._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[632,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=["disabled","misconfigured","connecting","connected","reconnecting","failed","stopped"],g=["slack_tokens_absent","app_token_missing","bot_token_missing","app_token_invalid","bot_token_invalid","share_config_absent","share_config_invalid","share_config_no_audience","workspace_not_allowlisted","slack_auth_failed","slack_connect_failed"],h={app_token_missing:"Add the Socket Mode app token to the Botmancers core environment, then restart Botmancers.",bot_token_missing:"Add the bot token to the Botmancers core environment, then restart Botmancers.",app_token_invalid:"Replace the Socket Mode app token with a valid value, then restart Botmancers.",bot_token_invalid:"Replace the bot token with a valid value, then restart Botmancers.",share_config_absent:"Add an allowlisted Slack channel in Agent Config, then restart Botmancers.",share_config_invalid:"Repair the session sharing policy in Agent Config, then restart Botmancers.",share_config_no_audience:"Add an allowlisted Slack channel in Agent Config, then restart Botmancers.",workspace_not_allowlisted:"Allowlist a channel from the workspace connected to the Botmancers Slack app, then restart Botmancers."};function i(a){switch(a.state){case"disabled":return{label:"Disabled",summary:"The optional Botmancers Slack relay is off.",guidance:"To use Slack sharing, configure both Slack relay credentials and at least one allowlisted channel, then restart Botmancers.",tone:"quiet"};case"misconfigured":return{label:"Needs configuration",summary:"The Botmancers Slack relay cannot start with its current configuration.",guidance:h[a.reason??"share_config_invalid"]??"Review the Slack relay credentials and sharing allowlist, then restart Botmancers.",tone:"warning"};case"connecting":return{label:"Connecting",summary:"The Botmancers Slack relay is opening its Socket Mode connection.",guidance:"Wait a moment, then refresh. Existing shares remain bounded to their exact sessions.",tone:"working"};case"connected":return{label:"Connected",summary:"The single Botmancers Slack relay is connected.",guidance:"It can post and answer eligible shared-session threads for all Agents on this Botmancers instance.",tone:"good"};case"reconnecting":return{label:"Reconnecting",summary:"The Botmancers Slack relay lost its connection and is reconnecting.",guidance:"Wait and refresh. Pending work is recovered after the connection returns; do not recreate shares just for a reconnect.",tone:"working"};case"failed":return{label:"Failed",summary:"The Botmancers Slack relay could not authenticate or connect.",guidance:"slack_auth_failed"===a.reason?"Check the configured Slack app and bot credentials, then restart Botmancers.":"Check Slack connectivity and the Socket Mode app configuration, then restart Botmancers.",tone:"warning"};case"stopped":return{label:"Stopped",summary:"The Botmancers Slack relay is not running.",guidance:"Start or restart Botmancers. Existing share records remain available for review.",tone:"quiet"}}}let j=[{value:"all",label:"All states"},{value:"active",label:"Live"},{value:"expired",label:"Expired"},{value:"revoked",label:"Revoked"}];var k=a.i(23464);function l({agentId:a,agentName:d,relay:e,policy:f,shares:g,filter:h,nextCursor:i,refreshing:k,loadingMore:q,onFilter:r,onRefresh:s,onLoadMore:t,onSharesChanged:u}){let v=`/agents/${encodeURIComponent(a)}/sessions`,w=`/bots/${encodeURIComponent(a)}/config#session-sharing`;return(0,b.jsxs)("div",{className:"agent-slack","data-agent-slack-page":!0,children:[(0,b.jsxs)("header",{className:"agent-slack-intro",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Slack"}),(0,b.jsx)("h2",{children:"Relay health and shared sessions"}),(0,b.jsxs)("p",{children:["Botmancers runs one optional Slack relay. ",d," does not have a separate Slack app; below are only the session threads shared for this Agent."]})]}),(0,b.jsx)("button",{type:"button",className:"agent-slack-refresh",onClick:s,disabled:k,children:k?"Refreshing…":"Refresh"})]}),(0,b.jsxs)("section",{className:"agent-slack-relay","aria-labelledby":"relay-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Botmancers-wide connection"}),(0,b.jsx)("h3",{id:"relay-heading",children:"Slack relay"})]}),"ready"===e.state?(0,b.jsx)(m,{health:e.value}):null]}),"loading"===e.state?(0,b.jsx)("p",{role:"status",children:"Checking the relay…"}):null,"error"===e.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Relay health unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not read the redacted health status. Refresh to try again."})]}):null,"ready"===e.state?(0,b.jsx)(n,{health:e.value}):null]}),(0,b.jsxs)("section",{className:"agent-slack-policy","aria-labelledby":"policy-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,b.jsx)("h3",{id:"policy-heading",children:"Sharing readiness"})]}),(0,b.jsx)(c.default,{href:w,children:"Edit in Config"})]}),"loading"===f.state?(0,b.jsx)("p",{role:"status",children:"Checking sharing policy…"}):null,"error"===f.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Sharing policy unavailable"}),(0,b.jsx)("p",{children:"Refresh, or open Config to review this Agent’s stored policy."})]}):null,"ready"===f.state?(0,b.jsx)(o,{policy:f.value}):null]}),(0,b.jsxs)("section",{className:"agent-slack-shares","aria-labelledby":"shares-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head agent-slack-shares-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,b.jsx)("h3",{id:"shares-heading",children:"Shared session threads"}),(0,b.jsx)("p",{children:"Each share is ask-only and can reach exactly one owning session."})]}),(0,b.jsx)(c.default,{className:"agent-primary-action",href:v,children:"Share a session"})]}),(0,b.jsx)("div",{className:"agent-slack-filters",role:"group","aria-label":"Filter shares by state",children:j.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":h===a.value,onClick:()=>r(a.value),children:a.label},a.value))}),"loading"===g.state?(0,b.jsx)("p",{className:"agent-slack-empty",role:"status",children:"Loading shared sessions…"}):null,"error"===g.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Shared sessions unavailable"}),(0,b.jsx)("p",{children:"No partial or stale list is shown. Refresh to try again."})]}):null,"ready"===g.state&&0===g.value.length?(0,b.jsx)("p",{className:"agent-slack-empty",children:"all"===h?`No sessions from ${d} have been shared to Slack yet.`:`No ${j.find(a=>a.value===h)?.label.toLowerCase()} shares for ${d}.`}):null,"ready"===g.state&&g.value.length>0?(0,b.jsx)("ul",{className:"agent-slack-share-list","aria-label":`Slack shares for ${d}`,children:g.value.map(c=>(0,b.jsx)(p,{share:c,agentId:a,onChanged:u},c.share_ref))}):null,"ready"===g.state&&i?(0,b.jsx)("button",{type:"button",className:"agent-slack-more",onClick:t,disabled:q,children:q?"Loading…":"Load more shares"}):null]})]})}function m({health:a}){let c=i(a);return(0,b.jsx)("span",{className:`agent-slack-status is-${c.tone}`,"data-relay-state":a.state,children:c.label})}function n({health:a}){let c=i(a);return(0,b.jsxs)("div",{className:"agent-slack-relay-copy",children:[(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:c.summary})}),(0,b.jsx)("p",{children:c.guidance}),"connected"===a.state&&a.connections>0?(0,b.jsxs)("p",{className:"agent-muted",children:["Connections opened this run: ",a.connections]}):null]})}function o({policy:a}){let c="loaded"===a.state&&a.audiences.length>0;return(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:c?"Ready to create session shares.":"invalid"===a.state?"The sharing policy needs repair.":"No Slack audience is allowlisted yet."})}),(0,b.jsxs)("p",{className:"agent-muted",children:["Share from a running Agent turn: ",a.agent.share_from_turn?"On":"Off",". Session owners can still share eligible sessions from Sessions."]}),a.audiences.length?(0,b.jsx)("ul",{className:"agent-slack-audiences","aria-label":"Allowed Slack audiences",children:a.audiences.map(a=>(0,b.jsx)("li",{children:(0,k.audienceLabel)(a)},`${a.team_id}:${a.channel_id}`))}):(0,b.jsx)("p",{className:"agent-slack-empty",children:"No allowlisted Slack channels."})]})}function p({share:a,agentId:e,onChanged:f}){let[g,h]=(0,d.useState)(!1),[i,j]=(0,d.useState)(!1),[l,m]=(0,d.useState)(""),n=(0,d.useRef)(null),o=(0,k.shareIsLive)(a),q=`/agents/${encodeURIComponent(e)}/sessions?session=${encodeURIComponent(a.session_ref)}`,r=async()=>{j(!0),m("");try{let b=await fetch(`/api/shares/${encodeURIComponent(a.share_ref)}/revoke`,{method:"POST"}),c=await b.json().catch(()=>null);if(!b.ok)throw Error("string"==typeof c?.error?.message?c.error.message:"The share could not be revoked.");h(!1),f()}catch(a){m(a instanceof Error?a.message:"The share could not be revoked.")}finally{j(!1)}};return(0,b.jsxs)("li",{className:`agent-slack-share is-${a.status}`,"data-share-ref":a.share_ref,"data-share-status":a.status,children:[(0,b.jsxs)("div",{className:"agent-slack-share-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:`agent-slack-status is-share-${a.status}`,children:k.SHARE_STATUS_LABELS[a.status]}),(0,b.jsx)("strong",{children:(0,k.audienceLabel)(a.audience)}),(0,b.jsxs)("small",{children:[(0,k.turnsLabel)(a)," · ",(0,k.expiryLabel)(a)]})]}),(0,b.jsx)("span",{className:"agent-slack-detail-hint",children:"Open for details"})]}),(0,b.jsx)("p",{className:"agent-slack-state-note",children:(0,k.shareStatusNote)(a)}),(0,b.jsxs)("details",{className:"agent-slack-details",children:[(0,b.jsx)("summary",{children:"Details"}),(0,b.jsxs)("dl",{className:"agent-slack-share-details",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Owning session"}),(0,b.jsx)("dd",{children:(0,b.jsx)(c.default,{href:q,children:a.session_ref})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Posted thread"}),(0,b.jsx)("dd",{children:(0,k.threadLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Creation path"}),(0,b.jsx)("dd",{children:"current_session"===a.created_via?"Running Agent turn":"owner"===a.created_by?"Agent Sessions":"Session share API"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Created by"}),(0,b.jsx)("dd",{children:(0,k.createdByLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Authority"}),(0,b.jsx)("dd",{children:"Ask only · exact session"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Share reference"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:a.share_ref})})]})]})]}),(0,b.jsxs)("div",{className:"agent-slack-share-actions",children:[(0,b.jsx)(c.default,{href:q,children:"Open owning session"}),o&&!g?(0,b.jsx)("button",{ref:n,type:"button",className:"agent-slack-revoke","data-share-action":"revoke",onClick:()=>h(!0),children:"Revoke"}):null]}),g?(0,b.jsxs)("div",{className:"agent-slack-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,b.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,b.jsxs)("div",{children:[(0,b.jsx)("button",{type:"button",className:"agent-slack-revoke","data-share-action":"confirm-revoke",disabled:i,onClick:()=>{r()},children:i?"Revoking…":"Revoke share"}),(0,b.jsx)("button",{type:"button",disabled:i,onClick:()=>{h(!1),requestAnimationFrame(()=>n.current?.focus())},children:"Keep it"})]})]}):null,l?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:l}):null]})}a.s(["AgentSlackView",0,l,"default",0,function(){let{id:a,overview:h,loading:i,error:j,notFound:k}=(0,e.useAgentOverview)(),[m,n]=(0,d.useState)({state:"loading"}),[o,p]=(0,d.useState)({state:"loading"}),[q,r]=(0,d.useState)({state:"loading"}),[s,t]=(0,d.useState)("all"),[u,v]=(0,d.useState)(null),[w,x]=(0,d.useState)(!1),[y,z]=(0,d.useState)(!1),[A,B]=(0,d.useState)(0),[C,D]=(0,d.useState)(""),E=(0,d.useRef)(0),F=(0,d.useCallback)((b=null)=>{let c=new URLSearchParams({agent_id:a,limit:String(12)});return"all"!==s&&c.set("state",s),b&&c.set("cursor",b),`/api/shares?${c.toString()}`},[s,a]);(0,d.useEffect)(()=>{let b=!1,c=++E.current;return Promise.allSettled([fetch("/api/health",{cache:"no-store"}).then(async a=>(function(a){if(!a||"object"!=typeof a||!f.includes(a.state))return null;let b=null===a.reason?null:g.includes(a.reason)?a.reason:null;return{state:a.state,reason:b,since:Number.isFinite(a.since)?Number(a.since):0,connections:Number.isInteger(a.connections)&&Number(a.connections)>=0?Number(a.connections):0}})((await a.json().catch(()=>null))?.slack)),fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let b=await a.json().catch(()=>null);if(!a.ok||!b?.policy)throw Error("policy");return b.policy}),fetch(F(),{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.shares))throw Error("shares");return{shares:c.shares.filter(b=>b.agent.id===a),cursor:"string"==typeof c.next_cursor?c.next_cursor:null}})]).then(([d,e,f])=>{b||c!==E.current||(n("fulfilled"===d.status&&d.value?{state:"ready",value:d.value}:{state:"error"}),p("fulfilled"===e.status?{state:"ready",value:e.value}:{state:"error"}),"fulfilled"===f.status?(r({state:"ready",value:f.value.shares}),v(f.value.cursor)):r({state:"error"}),D(a))}).finally(()=>{b||c!==E.current||z(!1)}),()=>{b=!0}},[a,A,F]);let G=()=>{z(!0),n({state:"loading"}),p({state:"loading"}),r({state:"loading"}),v(null),B(a=>a+1)},H=async()=>{if(u&&!w&&"ready"===q.state){x(!0);try{let b=await fetch(F(u),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.shares))throw Error("shares");let d=c.shares.filter(b=>b.agent.id===a);r({state:"ready",value:[...q.value,...d]}),v("string"==typeof c.next_cursor?c.next_cursor:null)}catch{r({state:"error"})}finally{x(!1)}}};if(i)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Slack operations…"});if(k)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]});if(j||!h)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Slack page unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]});let I=C!==a;return(0,b.jsx)(l,{agentId:a,agentName:h.agent.name,relay:I?{state:"loading"}:m,policy:I?{state:"loading"}:o,shares:I?{state:"loading"}:q,filter:s,nextCursor:u,refreshing:y,loadingMore:w,onFilter:a=>{a!==s&&(r({state:"loading"}),v(null),t(a))},onRefresh:G,onLoadMore:()=>{H()},onSharesChanged:G})}],632)}];
1
+ module.exports=[632,a=>{"use strict";var b=a.i(87924),c=a.i(38246),d=a.i(72131),e=a.i(15722);let f=["disabled","misconfigured","connecting","connected","reconnecting","failed","stopped"],g=["slack_tokens_absent","app_token_missing","bot_token_missing","app_token_invalid","bot_token_invalid","share_config_absent","share_config_invalid","share_config_no_audience","workspace_not_allowlisted","slack_auth_failed","slack_connect_failed"],h={app_token_missing:"Add the Socket Mode app token to the Botmancers core environment, then restart Botmancers.",bot_token_missing:"Add the bot token to the Botmancers core environment, then restart Botmancers.",app_token_invalid:"Replace the Socket Mode app token with a valid value, then restart Botmancers.",bot_token_invalid:"Replace the bot token with a valid value, then restart Botmancers.",share_config_absent:"Add an allowlisted Slack channel in Agent Config, then restart Botmancers.",share_config_invalid:"Repair the session sharing policy in Agent Config, then restart Botmancers.",share_config_no_audience:"Add an allowlisted Slack channel in Agent Config, then restart Botmancers.",workspace_not_allowlisted:"Allowlist a channel from the workspace connected to the Botmancers Slack app, then restart Botmancers."};function i(a){switch(a.state){case"disabled":return{label:"Disabled",summary:"The optional Botmancers Slack relay is off.",guidance:"To use Slack sharing, configure both Slack relay credentials and at least one allowlisted channel, then restart Botmancers.",tone:"quiet"};case"misconfigured":return{label:"Needs configuration",summary:"The Botmancers Slack relay cannot start with its current configuration.",guidance:h[a.reason??"share_config_invalid"]??"Review the Slack relay credentials and sharing allowlist, then restart Botmancers.",tone:"warning"};case"connecting":return{label:"Connecting",summary:"The Botmancers Slack relay is opening its Socket Mode connection.",guidance:"Wait a moment, then refresh. Existing shares remain bounded to their exact sessions.",tone:"working"};case"connected":return{label:"Connected",summary:"The single Botmancers Slack relay is connected.",guidance:"It can post and answer eligible shared-session threads for all Agents on this Botmancers instance.",tone:"good"};case"reconnecting":return{label:"Reconnecting",summary:"The Botmancers Slack relay lost its connection and is reconnecting.",guidance:"Wait and refresh. Pending work is recovered after the connection returns; do not recreate shares just for a reconnect.",tone:"working"};case"failed":return{label:"Failed",summary:"The Botmancers Slack relay could not authenticate or connect.",guidance:"slack_auth_failed"===a.reason?"Check the configured Slack app and bot credentials, then restart Botmancers.":"Check Slack connectivity and the Socket Mode app configuration, then restart Botmancers.",tone:"warning"};case"stopped":return{label:"Stopped",summary:"The Botmancers Slack relay is not running.",guidance:"Start or restart Botmancers. Existing share records remain available for review.",tone:"quiet"}}}let j=[{value:"all",label:"All states"},{value:"active",label:"Live"},{value:"expired",label:"Expired"},{value:"revoked",label:"Revoked"}];var k=a.i(23464);function l({agentId:a,agentName:d,relay:e,policy:f,shares:g,filter:h,nextCursor:i,refreshing:k,loadingMore:q,onFilter:r,onRefresh:s,onLoadMore:t,onSharesChanged:u}){let v=`/agents/${encodeURIComponent(a)}/sessions`,w=`/agents/${encodeURIComponent(a)}/config#session-sharing`;return(0,b.jsxs)("div",{className:"agent-slack","data-agent-slack-page":!0,children:[(0,b.jsxs)("header",{className:"agent-slack-intro",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Slack"}),(0,b.jsx)("h2",{children:"Relay health and shared sessions"}),(0,b.jsxs)("p",{children:["Botmancers runs one optional Slack relay. ",d," does not have a separate Slack app; below are only the session threads shared for this Agent."]})]}),(0,b.jsx)("button",{type:"button",className:"agent-slack-refresh",onClick:s,disabled:k,children:k?"Refreshing…":"Refresh"})]}),(0,b.jsxs)("section",{className:"agent-slack-relay","aria-labelledby":"relay-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"Botmancers-wide connection"}),(0,b.jsx)("h3",{id:"relay-heading",children:"Slack relay"})]}),"ready"===e.state?(0,b.jsx)(m,{health:e.value}):null]}),"loading"===e.state?(0,b.jsx)("p",{role:"status",children:"Checking the relay…"}):null,"error"===e.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Relay health unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not read the redacted health status. Refresh to try again."})]}):null,"ready"===e.state?(0,b.jsx)(n,{health:e.value}):null]}),(0,b.jsxs)("section",{className:"agent-slack-policy","aria-labelledby":"policy-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,b.jsx)("h3",{id:"policy-heading",children:"Sharing readiness"})]}),(0,b.jsx)(c.default,{href:w,children:"Edit in Config"})]}),"loading"===f.state?(0,b.jsx)("p",{role:"status",children:"Checking sharing policy…"}):null,"error"===f.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Sharing policy unavailable"}),(0,b.jsx)("p",{children:"Refresh, or open Config to review this Agent’s stored policy."})]}):null,"ready"===f.state?(0,b.jsx)(o,{policy:f.value}):null]}),(0,b.jsxs)("section",{className:"agent-slack-shares","aria-labelledby":"shares-heading",children:[(0,b.jsxs)("div",{className:"agent-slack-section-head agent-slack-shares-head",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{className:"agent-eyebrow",children:"This Agent"}),(0,b.jsx)("h3",{id:"shares-heading",children:"Shared session threads"}),(0,b.jsx)("p",{children:"Each share is ask-only and can reach exactly one owning session."})]}),(0,b.jsx)(c.default,{className:"agent-primary-action",href:v,children:"Share a session"})]}),(0,b.jsx)("div",{className:"agent-slack-filters",role:"group","aria-label":"Filter shares by state",children:j.map(a=>(0,b.jsx)("button",{type:"button","aria-pressed":h===a.value,onClick:()=>r(a.value),children:a.label},a.value))}),"loading"===g.state?(0,b.jsx)("p",{className:"agent-slack-empty",role:"status",children:"Loading shared sessions…"}):null,"error"===g.state?(0,b.jsxs)("div",{className:"agent-slack-error",role:"alert",children:[(0,b.jsx)("strong",{children:"Shared sessions unavailable"}),(0,b.jsx)("p",{children:"No partial or stale list is shown. Refresh to try again."})]}):null,"ready"===g.state&&0===g.value.length?(0,b.jsx)("p",{className:"agent-slack-empty",children:"all"===h?`No sessions from ${d} have been shared to Slack yet.`:`No ${j.find(a=>a.value===h)?.label.toLowerCase()} shares for ${d}.`}):null,"ready"===g.state&&g.value.length>0?(0,b.jsx)("ul",{className:"agent-slack-share-list","aria-label":`Slack shares for ${d}`,children:g.value.map(c=>(0,b.jsx)(p,{share:c,agentId:a,onChanged:u},c.share_ref))}):null,"ready"===g.state&&i?(0,b.jsx)("button",{type:"button",className:"agent-slack-more",onClick:t,disabled:q,children:q?"Loading…":"Load more shares"}):null]})]})}function m({health:a}){let c=i(a);return(0,b.jsx)("span",{className:`agent-slack-status is-${c.tone}`,"data-relay-state":a.state,children:c.label})}function n({health:a}){let c=i(a);return(0,b.jsxs)("div",{className:"agent-slack-relay-copy",children:[(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:c.summary})}),(0,b.jsx)("p",{children:c.guidance}),"connected"===a.state&&a.connections>0?(0,b.jsxs)("p",{className:"agent-muted",children:["Connections opened this run: ",a.connections]}):null]})}function o({policy:a}){let c="loaded"===a.state&&a.audiences.length>0;return(0,b.jsxs)("div",{children:[(0,b.jsx)("p",{children:(0,b.jsx)("strong",{children:c?"Ready to create session shares.":"invalid"===a.state?"The sharing policy needs repair.":"No Slack audience is allowlisted yet."})}),(0,b.jsxs)("p",{className:"agent-muted",children:["Share from a running Agent turn: ",a.agent.share_from_turn?"On":"Off",". Session owners can still share eligible sessions from Sessions."]}),a.audiences.length?(0,b.jsx)("ul",{className:"agent-slack-audiences","aria-label":"Allowed Slack audiences",children:a.audiences.map(a=>(0,b.jsx)("li",{children:(0,k.audienceLabel)(a)},`${a.team_id}:${a.channel_id}`))}):(0,b.jsx)("p",{className:"agent-slack-empty",children:"No allowlisted Slack channels."})]})}function p({share:a,agentId:e,onChanged:f}){let[g,h]=(0,d.useState)(!1),[i,j]=(0,d.useState)(!1),[l,m]=(0,d.useState)(""),n=(0,d.useRef)(null),o=(0,k.shareIsLive)(a),q=`/agents/${encodeURIComponent(e)}/sessions?session=${encodeURIComponent(a.session_ref)}`,r=async()=>{j(!0),m("");try{let b=await fetch(`/api/shares/${encodeURIComponent(a.share_ref)}/revoke`,{method:"POST"}),c=await b.json().catch(()=>null);if(!b.ok)throw Error("string"==typeof c?.error?.message?c.error.message:"The share could not be revoked.");h(!1),f()}catch(a){m(a instanceof Error?a.message:"The share could not be revoked.")}finally{j(!1)}};return(0,b.jsxs)("li",{className:`agent-slack-share is-${a.status}`,"data-share-ref":a.share_ref,"data-share-status":a.status,children:[(0,b.jsxs)("div",{className:"agent-slack-share-summary",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("span",{className:`agent-slack-status is-share-${a.status}`,children:k.SHARE_STATUS_LABELS[a.status]}),(0,b.jsx)("strong",{children:(0,k.audienceLabel)(a.audience)}),(0,b.jsxs)("small",{children:[(0,k.turnsLabel)(a)," · ",(0,k.expiryLabel)(a)]})]}),(0,b.jsx)("span",{className:"agent-slack-detail-hint",children:"Open for details"})]}),(0,b.jsx)("p",{className:"agent-slack-state-note",children:(0,k.shareStatusNote)(a)}),(0,b.jsxs)("details",{className:"agent-slack-details",children:[(0,b.jsx)("summary",{children:"Details"}),(0,b.jsxs)("dl",{className:"agent-slack-share-details",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Owning session"}),(0,b.jsx)("dd",{children:(0,b.jsx)(c.default,{href:q,children:a.session_ref})})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Posted thread"}),(0,b.jsx)("dd",{children:(0,k.threadLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Creation path"}),(0,b.jsx)("dd",{children:"current_session"===a.created_via?"Running Agent turn":"owner"===a.created_by?"Agent Sessions":"Session share API"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Created by"}),(0,b.jsx)("dd",{children:(0,k.createdByLabel)(a)})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Authority"}),(0,b.jsx)("dd",{children:"Ask only · exact session"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)("dt",{children:"Share reference"}),(0,b.jsx)("dd",{children:(0,b.jsx)("code",{children:a.share_ref})})]})]})]}),(0,b.jsxs)("div",{className:"agent-slack-share-actions",children:[(0,b.jsx)(c.default,{href:q,children:"Open owning session"}),o&&!g?(0,b.jsx)("button",{ref:n,type:"button",className:"agent-slack-revoke","data-share-action":"revoke",onClick:()=>h(!0),children:"Revoke"}):null]}),g?(0,b.jsxs)("div",{className:"agent-slack-confirm",role:"group","aria-label":"Confirm revoke",children:[(0,b.jsx)("p",{children:"Revoke this share? The next Slack question in its thread gets the revoked notice. This can’t be undone."}),(0,b.jsxs)("div",{children:[(0,b.jsx)("button",{type:"button",className:"agent-slack-revoke","data-share-action":"confirm-revoke",disabled:i,onClick:()=>{r()},children:i?"Revoking…":"Revoke share"}),(0,b.jsx)("button",{type:"button",disabled:i,onClick:()=>{h(!1),requestAnimationFrame(()=>n.current?.focus())},children:"Keep it"})]})]}):null,l?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:l}):null]})}a.s(["AgentSlackView",0,l,"default",0,function(){let{id:a,overview:h,loading:i,error:j,notFound:k}=(0,e.useAgentOverview)(),[m,n]=(0,d.useState)({state:"loading"}),[o,p]=(0,d.useState)({state:"loading"}),[q,r]=(0,d.useState)({state:"loading"}),[s,t]=(0,d.useState)("all"),[u,v]=(0,d.useState)(null),[w,x]=(0,d.useState)(!1),[y,z]=(0,d.useState)(!1),[A,B]=(0,d.useState)(0),[C,D]=(0,d.useState)(""),E=(0,d.useRef)(0),F=(0,d.useCallback)((b=null)=>{let c=new URLSearchParams({agent_id:a,limit:String(12)});return"all"!==s&&c.set("state",s),b&&c.set("cursor",b),`/api/shares?${c.toString()}`},[s,a]);(0,d.useEffect)(()=>{let b=!1,c=++E.current;return Promise.allSettled([fetch("/api/health",{cache:"no-store"}).then(async a=>(function(a){if(!a||"object"!=typeof a||!f.includes(a.state))return null;let b=null===a.reason?null:g.includes(a.reason)?a.reason:null;return{state:a.state,reason:b,since:Number.isFinite(a.since)?Number(a.since):0,connections:Number.isInteger(a.connections)&&Number(a.connections)>=0?Number(a.connections):0}})((await a.json().catch(()=>null))?.slack)),fetch(`/api/bots/${encodeURIComponent(a)}/share-policy`,{cache:"no-store"}).then(async a=>{let b=await a.json().catch(()=>null);if(!a.ok||!b?.policy)throw Error("policy");return b.policy}),fetch(F(),{cache:"no-store"}).then(async b=>{let c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.shares))throw Error("shares");return{shares:c.shares.filter(b=>b.agent.id===a),cursor:"string"==typeof c.next_cursor?c.next_cursor:null}})]).then(([d,e,f])=>{b||c!==E.current||(n("fulfilled"===d.status&&d.value?{state:"ready",value:d.value}:{state:"error"}),p("fulfilled"===e.status?{state:"ready",value:e.value}:{state:"error"}),"fulfilled"===f.status?(r({state:"ready",value:f.value.shares}),v(f.value.cursor)):r({state:"error"}),D(a))}).finally(()=>{b||c!==E.current||z(!1)}),()=>{b=!0}},[a,A,F]);let G=()=>{z(!0),n({state:"loading"}),p({state:"loading"}),r({state:"loading"}),v(null),B(a=>a+1)},H=async()=>{if(u&&!w&&"ready"===q.state){x(!0);try{let b=await fetch(F(u),{cache:"no-store"}),c=await b.json().catch(()=>null);if(!b.ok||!Array.isArray(c?.shares))throw Error("shares");let d=c.shares.filter(b=>b.agent.id===a);r({state:"ready",value:[...q.value,...d]}),v("string"==typeof c.next_cursor?c.next_cursor:null)}catch{r({state:"error"})}finally{x(!1)}}};if(i)return(0,b.jsx)("div",{className:"agent-state",role:"status",children:"Loading Slack operations…"});if(k)return(0,b.jsxs)("div",{className:"agent-state",children:[(0,b.jsx)("h2",{children:"Agent not found"}),(0,b.jsx)(c.default,{href:"/",children:"Choose an Agent"})]});if(j||!h)return(0,b.jsxs)("div",{className:"agent-state",role:"alert",children:[(0,b.jsx)("h2",{children:"Slack page unavailable"}),(0,b.jsx)("p",{children:"Botmancers could not load this Agent."})]});let I=C!==a;return(0,b.jsx)(l,{agentId:a,agentName:h.agent.name,relay:I?{state:"loading"}:m,policy:I?{state:"loading"}:o,shares:I?{state:"loading"}:q,filter:s,nextCursor:u,refreshing:y,loadingMore:w,onFilter:a=>{a!==s&&(r({state:"loading"}),v(null),t(a))},onRefresh:G,onLoadMore:()=>{H()},onSharesChanged:G})}],632)}];
2
2
 
3
3
  //# sourceMappingURL=app_agents_%5Bid%5D_slack_AgentSlackPage_tsx_20njhs1._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[36391,5020,a=>{"use strict";var b=a.i(87924),c=a.i(72131);let d=[{id:"purple",label:"Purple",hex:"#7C3AED"},{id:"blue",label:"Blue",hex:"#2563EB"},{id:"teal",label:"Teal",hex:"#0D9488"},{id:"green",label:"Green",hex:"#16A34A"},{id:"amber",label:"Amber",hex:"#B45309"},{id:"orange",label:"Orange",hex:"#EA580C"},{id:"pink",label:"Pink",hex:"#DB2777"},{id:"slate",label:"Slate",hex:"#64748B"}],e=[{id:"dots",label:"Round dots"},{id:"sleepy",label:"Sleepy"},{id:"happy",label:"Happy arcs"},{id:"wide",label:"Wide ovals"}],f=[{id:"folded",label:"Folded arms"},{id:"reaching",label:"Reaching right"},{id:"waving",label:"Waving"}],g=[{id:"none",label:"None"},{id:"crown",label:"Crown"},{id:"glasses",label:"Glasses"},{id:"headset",label:"Headset"},{id:"hat",label:"Hat"},{id:"bow",label:"Bow"}],h={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},i={...h,accessory:"crown"};function j(a,b){return"string"==typeof b&&a.some(a=>a.id===b)}function k(a){let b=j(d,a.avatar_color)?a.avatar_color:h.color,c=j(e,a.avatar_eyes)?a.avatar_eyes:h.eyes;return{color:b,eyes:c,hands:j(f,a.avatar_hands)?a.avatar_hands:h.hands,accessory:j(g,a.avatar_accessory)?a.avatar_accessory:"chief-of-staff"===String(a.name??"").trim().toLowerCase()?i.accessory:h.accessory}}let l=[{x:70,y:70.5,w:38,h:6},{x:70,y:82,w:38,h:6}];function m(a){return l.map(b=>`<rect x="${b.x}" y="${b.y}" width="${b.w}" height="${b.h}" rx="${b.h/2}" ${a}/>`).join("")}function n(a,b="static"){var c,e;let f,g,h=d.find(b=>b.id===a.color)?.hex??d[0].hex,i=String(b).replace(/[^A-Za-z0-9_-]/g,"")||"static",j=`avatar-knockout-${i}`,k=`fill="none" stroke="${h}" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"`,l=(c=a.hands,e=a.accessory,f=[],"reaching"===c&&f.push({x1:87.6,y1:69,x2:90.4,y2:86.5,w:8}),"waving"===c&&f.push({x1:35,y1:59,x2:28,y2:72,w:10}),"crown"===e&&f.push({x1:44,y1:30,x2:76,y2:30,w:9}),"hat"===e&&f.push({x1:38,y1:34,x2:82,y2:34,w:9}),"bow"===e&&f.push({x1:60,y1:28.5,x2:84,y2:28,w:10}),"headset"===e&&(f.push({x1:42,y1:24.5,x2:78,y2:24.5,w:10}),f.push({x1:33,y1:55,x2:37,y2:64,w:8}),f.push({x1:83,y1:55,x2:87,y2:64,w:8})),"glasses"===e&&(f.push({x1:29,y1:56,x2:34,y2:62,w:8}),f.push({x1:86,y1:62,x2:91,y2:56,w:8})),f).map(a=>`<line x1="${a.x1}" y1="${a.y1}" x2="${a.x2}" y2="${a.y2}" stroke="#000000" stroke-width="${a.w}" stroke-linecap="round"/>`).join(""),o=`avatar-arms-${i}`,p="reaching"===a.hands,q=p?`<mask id="${o}"><rect x="0" y="0" width="120" height="120" fill="#ffffff"/>${m('fill="#000000" stroke="#000000" stroke-width="7"')}</mask>`:"",r=function(a,b){let c=`fill="none" stroke="${b}" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"`;switch(a){case"sleepy":return`<g data-avatar-layer="eyes" data-avatar-eyes="sleepy"><path d="M42 61 Q48 64 54 61" ${c}/><path d="M66 61 Q72 64 78 61" ${c}/></g>`;case"happy":return`<g data-avatar-layer="eyes" data-avatar-eyes="happy"><path d="M42 63 Q48 54 54 63" ${c}/><path d="M66 63 Q72 54 78 63" ${c}/></g>`;case"wide":return`<g data-avatar-layer="eyes" data-avatar-eyes="wide"><ellipse cx="48" cy="60" rx="5.5" ry="8" ${c}/><ellipse cx="72" cy="60" rx="5.5" ry="8" ${c}/></g>`;default:return`<g data-avatar-layer="eyes" data-avatar-eyes="dots"><circle cx="48" cy="60" r="3.5" ${c}/><circle cx="72" cy="60" r="3.5" ${c}/></g>`}}(a.eyes,h),s=function(a,b){let c=`fill="none" stroke="${b}" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"`;switch(a){case"crown":return`<g data-avatar-layer="accessory" data-avatar-accessory="crown"><path d="M44 31 L46.5 14 L54 24 L60 10 L66 24 L73.5 14 L76 31 Z" ${c}/></g>`;case"glasses":return`<g data-avatar-layer="accessory" data-avatar-accessory="glasses"><circle cx="48" cy="60" r="9" ${c}/><circle cx="72" cy="60" r="9" ${c}/><path d="M57 60 Q60 57 63 60" ${c}/><path d="M39 59 L32 57" ${c}/><path d="M81 59 L88 57" ${c}/></g>`;case"headset":return`<g data-avatar-layer="accessory" data-avatar-accessory="headset"><path d="M36 62 Q34 24 60 24 Q86 24 84 62" ${c}/><rect x="79" y="54" width="10" height="17" rx="5" ${c}/><path d="M84 71 Q80 84 66 84" ${c}/></g>`;case"hat":return`<g data-avatar-layer="accessory" data-avatar-accessory="hat"><path d="M38 34 Q60 40 82 34" ${c}/><path d="M46 34 Q48 14 60 14 Q72 14 74 34" ${c}/></g>`;case"bow":return`<g data-avatar-layer="accessory" data-avatar-accessory="bow"><circle cx="79" cy="29" r="3.5" ${c}/><path d="M76 27 L62 18 Q60 26 66 32 Z" ${c}/><path d="M82 27 L95 19 Q97 27 91 32 Z" ${c}/></g>`;default:return'<g data-avatar-layer="accessory" data-avatar-accessory="none"></g>'}}(a.accessory,h);return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 120" role="img" data-avatar-color="${a.color}" data-avatar-eyes="${a.eyes}" data-avatar-hands="${a.hands}" data-avatar-accessory="${a.accessory}"><mask id="${j}"><rect x="0" y="0" width="120" height="120" fill="#ffffff"/>${l}</mask>`+q+`<g data-avatar-layer="body" mask="url(#${j})">`+`<path d="M60 28 C75 28 84 39 85.5 56 L91 90 C92.5 98 87 102 79 102 L41 102 C33 102 27.5 98 29 90 L34.5 56 C36 39 45 28 60 28 Z" ${k}/>`+`<path d="M54 71 Q60 75.5 66 71" ${k}/>`+`<path data-avatar-brows="straight" d="${g="wide"===a.eyes?45:46,`M42 ${g} H54 M66 ${g} H78`}" fill="none" stroke="${h}" stroke-width="4.8" stroke-linecap="round"/>`+"</g>"+(p?`<g mask="url(#${o})">${r}</g>`:r)+function(a,b){let c=`fill="none" stroke="${b}" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round"`;switch(a){case"reaching":return'<g data-avatar-layer="hands" data-avatar-hands="reaching">'+m(c)+"</g>";case"waving":return`<g data-avatar-layer="hands" data-avatar-hands="waving"><path d="M32 68 Q24 60 22 48" ${c}/><circle cx="21" cy="41" r="5" ${c}/><path d="M11 36 Q9 46 12 54" ${c}/></g>`;default:return`<g data-avatar-layer="hands" data-avatar-hands="folded"><rect x="44" y="79" width="32" height="9" rx="4.5" ${c}/><rect x="46" y="90" width="28" height="9" rx="4.5" ${c}/></g>`}}(a.hands,h)+(p?`<g mask="url(#${o})">${s}</g>`:s)+"</svg>"}a.s(["AVATAR_ACCESSORIES",0,g,"AVATAR_COLORS",0,d,"AVATAR_EYES",0,e,"AVATAR_HANDS",0,f,"renderAvatarSvg",0,n,"resolveAvatar",0,k],5020),a.s(["default",0,function({bot:a,config:d,size:e=28,className:f,title:g}){let h=(0,c.useId)().replace(/[^A-Za-z0-9_-]/g,"")||"avatar",i=n(d??a?.avatar_config??k(a??{}),h).replace("<svg ",`<svg width="${e}" height="${e}" `);return(0,b.jsx)("span",{className:f??"bot-avatar",style:{display:"inline-flex",width:e,height:e,flex:"none"},title:g,"aria-label":g??"Agent avatar",role:"img",dangerouslySetInnerHTML:{__html:i}})}],36391)},60193,35832,a=>{"use strict";var b=a.i(87924),c=a.i(72131);let d="Permanently removes each agent with its direct conversation, messages, queue rows, approvals, launch snapshots, memories, one-shots, routines, and pending questions. There is no undo.",e="Skill files, working directories, Hermes profiles, and imported source files stay on disk.";function f(a){return"chief"===a?"Chief of Staff cannot be deleted.":"Working now — stop it or let it finish before deleting."}function g(a){return 1===a?"Delete agent":`Delete ${a} agents`}a.s(["DELETE_KEEPS_COPY",0,e,"DELETE_REMOVES_COPY",0,d,"blockedReasonCopy",0,f,"deleteConfirmLabel",0,g,"deletedStatusLine",0,function(a){return 1===a?"Deleted 1 agent.":`Deleted ${a} agents.`}],35832),a.s(["default",0,function({ids:a,onCancel:h,onDeleted:i}){let j=(0,c.useId)(),[k,l]=(0,c.useState)(null),[m,n]=(0,c.useState)(""),[o,p]=(0,c.useState)(""),[q,r]=(0,c.useState)(!1),s=(0,c.useRef)(null),t=(0,c.useRef)(null),u=a.join("\n");(0,c.useEffect)(()=>{let a=!1;return fetch("/api/bots/delete-preview",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:u.split("\n")})}).then(async b=>{let c=await b.json().catch(()=>null);if(!a){if(!b.ok)return void n("string"==typeof c?.error?c.error:"Could not load the deletion preview.");l(c)}}).catch(()=>{a||n("Could not load the deletion preview.")}),()=>{a=!0}},[u]),(0,c.useEffect)(()=>{s.current?.focus()},[]),(0,c.useEffect)(()=>{let a=a=>{"Escape"===a.key&&(a.stopPropagation(),q||h())};return document.addEventListener("keydown",a,!0),()=>document.removeEventListener("keydown",a,!0)},[q,h]);let v=a.length,w=!k||k.blocked.length>0||k.missing.length>0,x=async()=>{if(!q&&!w){r(!0),p("");try{let b=await fetch("/api/bots",{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:a})}),c=await b.json().catch(()=>null);if(!b.ok){p("string"==typeof c?.error&&c.error?c.error:`Delete failed (${b.status}).`),r(!1),requestAnimationFrame(()=>s.current?.focus());return}i(Array.isArray(c?.deleted)?c.deleted:[])}catch{p("Delete failed: the server did not respond."),r(!1),requestAnimationFrame(()=>s.current?.focus())}}};return(0,b.jsx)("div",{className:"modal-scrim delete-scrim",onKeyDown:a=>{if("Tab"!==a.key||!t.current)return;let b=Array.from(t.current.querySelectorAll("button:not(:disabled)"));if(0===b.length)return;let c=b[0],d=b[b.length-1];a.shiftKey&&document.activeElement===c?(a.preventDefault(),d.focus()):a.shiftKey||document.activeElement!==d||(a.preventDefault(),c.focus())},children:(0,b.jsxs)("div",{ref:t,className:"delete-card",role:"alertdialog","aria-modal":"true","aria-labelledby":j,"data-testid":"delete-agents-dialog",children:[(0,b.jsx)("h2",{id:j,className:"delete-title",children:1===v?"Delete this agent permanently?":`Delete ${v} agents permanently?`}),m?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:m}):null,k||m?null:(0,b.jsx)("p",{className:"delete-copy",children:"Checking what will be removed…"}),k?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsxs)("ul",{className:"delete-names","aria-label":"Agents to delete",children:[k.agents.map(a=>(0,b.jsx)("li",{children:a.name},a.id)),k.missing.map(a=>(0,b.jsxs)("li",{children:["Not found: ",a]},a))]}),k.blocked.length>0?(0,b.jsxs)("div",{className:"delete-blocked",role:"alert",children:[(0,b.jsx)("p",{children:"Nothing can be deleted until these are deselected:"}),(0,b.jsx)("ul",{children:k.blocked.map(a=>(0,b.jsxs)("li",{children:[a.name," — ",f(a.reason)]},a.id))})]}):null,(0,b.jsx)("p",{className:"delete-copy",children:d}),(0,b.jsx)("p",{className:"delete-copy delete-keeps",children:e})]}):null,o?(0,b.jsx)("p",{className:"delete-error",role:"alert",children:o}):null,(0,b.jsxs)("div",{className:"form-actions delete-actions",children:[(0,b.jsx)("button",{ref:s,type:"button",className:"cancel-btn",onClick:h,disabled:q,children:"Cancel"}),(0,b.jsx)("button",{type:"button",className:"delete-btn",onClick:()=>{x()},disabled:q||w,children:q?"Deleting…":g(v)})]})]})})}],60193)}];
2
+
3
+ //# sourceMappingURL=app_components_0bhuhd-._.js.map