botmancers 0.6.1 → 0.8.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 (266) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/README.md +13 -12
  3. package/app/.next/BUILD_ID +1 -1
  4. package/app/.next/app-path-routes-manifest.json +1 -2
  5. package/app/.next/build-manifest.json +3 -3
  6. package/app/.next/prerender-manifest.json +4 -4
  7. package/app/.next/required-server-files.json +2 -2
  8. package/app/.next/routes-manifest.json +8 -12
  9. package/app/.next/server/app/_global-error.html +1 -1
  10. package/app/.next/server/app/_global-error.rsc +1 -1
  11. package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  14. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/app/.next/server/app/_not-found.html +1 -1
  17. package/app/.next/server/app/_not-found.rsc +2 -2
  18. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  19. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  20. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  21. package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
  22. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js +2 -2
  23. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -1
  24. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -1
  25. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js +3 -3
  26. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js.nft.json +1 -1
  27. package/app/.next/server/app/api/bots/[id]/sessions/route.js +5 -5
  28. package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
  29. package/app/.next/server/app/api/bots/[id]/sessions/sync/route/app-paths-manifest.json +3 -0
  30. package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js +11 -0
  31. package/app/.next/server/app/api/bots/[id]/sessions/sync/route.js.nft.json +1 -0
  32. package/app/.next/server/app/api/bots/[id]/sessions/sync/route_client-reference-manifest.js +3 -0
  33. package/app/.next/server/app/api/bots/[id]/share-policy/route.js +3 -3
  34. package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -1
  35. package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
  36. package/app/.next/server/app/api/bots/availability/route.js +3 -2
  37. package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
  38. package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
  39. package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
  40. package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
  41. package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
  42. package/app/.next/server/app/api/bots/route.js +4 -4
  43. package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
  44. package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
  45. package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
  46. package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
  47. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
  48. package/app/.next/server/app/api/conversations/[id]/messages/route.js +5 -5
  49. package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
  50. package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
  51. package/app/.next/server/app/api/conversations/[id]/stop/route.js +6 -6
  52. package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
  53. package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
  54. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +2 -2
  55. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
  56. package/app/.next/server/app/api/exchanges/[id]/route.js +3 -3
  57. package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
  58. package/app/.next/server/app/api/exchanges/route.js +2 -2
  59. package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
  60. package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
  61. package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
  62. package/app/.next/server/app/api/health/route.js +2 -2
  63. package/app/.next/server/app/api/health/route.js.nft.json +1 -1
  64. package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
  65. package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
  66. package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -1
  67. package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
  68. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js +3 -3
  69. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
  70. package/app/.next/server/app/api/shares/route.js +3 -3
  71. package/app/.next/server/app/api/shares/route.js.nft.json +1 -1
  72. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +3 -3
  73. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
  74. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +3 -3
  75. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
  76. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +2 -2
  77. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
  78. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js +3 -3
  79. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -1
  80. package/app/.next/server/app/api/v0/agents/[agentId]/route.js +3 -3
  81. package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
  82. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +3 -3
  83. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
  84. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +3 -3
  85. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
  86. package/app/.next/server/app/api/v0/agents/route.js +3 -3
  87. package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
  88. package/app/.next/server/app/api/v0/capabilities/route.js +3 -3
  89. package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
  90. package/app/.next/server/app/api/v0/conversations/[id]/route.js +2 -2
  91. package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
  92. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +3 -3
  93. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
  94. package/app/.next/server/app/api/v0/exchanges/[id]/route.js +3 -3
  95. package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
  96. package/app/.next/server/app/api/v0/exchanges/route.js +3 -3
  97. package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/v0/mcp/route.js +4 -4
  99. package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js +3 -3
  101. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js +3 -3
  103. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -1
  104. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js +3 -3
  105. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -1
  106. package/app/.next/server/app/api/v0/requests/[id]/route.js +2 -2
  107. package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
  108. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js +3 -3
  109. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
  110. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js +3 -3
  111. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -1
  112. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js +3 -3
  113. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -1
  114. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js +3 -3
  115. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -1
  116. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js +3 -3
  117. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -1
  118. package/app/.next/server/app/api/v0/shares/current/route.js +3 -3
  119. package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -1
  120. package/app/.next/server/app/api/v0/shares/route.js +3 -3
  121. package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -1
  122. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +2 -2
  123. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
  124. package/app/.next/server/app/api/wakes/[id]/decision/route.js +2 -2
  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 +2 -2
  127. package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
  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.js.nft.json +1 -1
  131. package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
  132. package/app/.next/server/app/exchanges.html +1 -1
  133. package/app/.next/server/app/exchanges.rsc +3 -3
  134. package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
  135. package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
  136. package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
  137. package/app/.next/server/app/index.html +1 -1
  138. package/app/.next/server/app/index.rsc +3 -3
  139. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  140. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  141. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  142. package/app/.next/server/app/page.js.nft.json +1 -1
  143. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  144. package/app/.next/server/app/settings/page.js.nft.json +1 -1
  145. package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  146. package/app/.next/server/app/settings.html +1 -1
  147. package/app/.next/server/app/settings.rsc +3 -3
  148. package/app/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  149. package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  150. package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +3 -3
  151. package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -1
  152. package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +1 -1
  153. package/app/.next/server/app-paths-manifest.json +1 -2
  154. package/app/.next/server/chunks/[root-of-the-server]__0d3fjix._.js +1 -1
  155. package/app/.next/server/chunks/[root-of-the-server]__0hhill-._.js +3 -0
  156. package/app/.next/server/chunks/[root-of-the-server]__0k8wfe2._.js +3 -0
  157. package/app/.next/server/chunks/[root-of-the-server]__0mp8bap._.js +1 -1
  158. package/app/.next/server/chunks/[root-of-the-server]__0qaiqut._.js +5 -5
  159. package/app/.next/server/chunks/[root-of-the-server]__0qqsovi._.js +3 -0
  160. package/app/.next/server/chunks/[root-of-the-server]__0zrx1iz._.js +1 -1
  161. package/app/.next/server/chunks/[root-of-the-server]__10b5-i-._.js +1 -1
  162. package/app/.next/server/chunks/[root-of-the-server]__17xl_55._.js +1 -1
  163. package/app/.next/server/chunks/[root-of-the-server]__1j8fg_n._.js +3 -0
  164. package/app/.next/server/chunks/[root-of-the-server]__1x8phwp._.js +44 -0
  165. package/app/.next/server/chunks/[root-of-the-server]__200ep0k._.js +1 -1
  166. package/app/.next/server/chunks/_0061c2q._.js +1 -1
  167. package/app/.next/server/chunks/_057h7zr._.js +3 -0
  168. package/app/.next/server/chunks/_0_b7py8._.js +3 -0
  169. package/app/.next/server/chunks/_0a2do3x._.js +1 -1
  170. package/app/.next/server/chunks/_1-5mthb._.js +1 -1
  171. package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_sessions_sync_route_actions_00y6n-f.js +3 -0
  172. package/app/.next/server/chunks/lib_0-opbv7._.js +330 -0
  173. package/app/.next/server/chunks/lib_0aejojj._.js +330 -0
  174. package/app/.next/server/chunks/lib_0il0ml1._.js +330 -0
  175. package/app/.next/server/chunks/lib_0iujsdg._.js +330 -0
  176. package/app/.next/server/chunks/lib_0kik6bx._.js +20 -20
  177. package/app/.next/server/chunks/lib_0pe3tiv._.js +20 -20
  178. package/app/.next/server/chunks/{lib_1zc7-gl._.js → lib_15a9ejf._.js} +122 -130
  179. package/app/.next/server/chunks/{lib_15adnlz._.js → lib_19pzc33._.js} +122 -130
  180. package/app/.next/server/chunks/lib_1a4ucxv._.js +330 -0
  181. package/app/.next/server/chunks/lib_1dehbst._.js +330 -0
  182. package/app/.next/server/chunks/lib_1z4vnh4._.js +330 -0
  183. package/app/.next/server/chunks/lib_1z7d95m._.js +2181 -0
  184. package/app/.next/server/chunks/lib_db_ts_1ttuckb._.js +58 -56
  185. package/app/.next/server/chunks/lib_service-api-http_ts_0xzqhny._.js +5 -5
  186. package/app/.next/server/chunks/ssr/_00ysoah._.js +3 -0
  187. package/app/.next/server/chunks/ssr/_14d-lxn._.js +3 -0
  188. package/app/.next/server/chunks/ssr/_1cvuhjt._.js +1 -1
  189. package/app/.next/server/chunks/ssr/_1lkd0ui._.js +3 -0
  190. package/app/.next/server/chunks/ssr/_1n5mvo5._.js +1 -1
  191. package/app/.next/server/chunks/ssr/_1o94bnv._.js +8 -1
  192. package/app/.next/server/chunks/ssr/_1r5kd5j._.js +3 -0
  193. package/app/.next/server/chunks/ssr/app_1-nwnha._.js +3 -0
  194. package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +1 -1
  195. package/app/.next/server/chunks/ssr/lib_exchange-view_ts_1a4q9ju._.js +3 -0
  196. package/app/.next/server/instrumentation.js +1 -1
  197. package/app/.next/server/middleware-build-manifest.js +3 -3
  198. package/app/.next/server/pages/404.html +1 -1
  199. package/app/.next/server/pages/500.html +1 -1
  200. package/app/.next/server/server-reference-manifest.js +1 -1
  201. package/app/.next/server/server-reference-manifest.json +1 -1
  202. package/app/.next/static/chunks/0y1ihx4vq8du3.js +10 -0
  203. package/app/.next/static/chunks/1c2dl2ga-lqcb.css +3 -0
  204. package/app/.next/static/chunks/2q-tgwkalrnms.js +1 -0
  205. package/app/.next/static/chunks/2qf-mb__71dkk.js +1 -0
  206. package/app/.next/static/chunks/399dvlpyl00wn.js +1 -0
  207. package/app/.next/static/chunks/3b7r6u9nfsjb1.js +1 -0
  208. package/app/.next/static/chunks/3f1v-zuki9k7k.js +1 -0
  209. package/app/.next/static/chunks/3whw2-l4a2sli.js +1 -0
  210. package/app/BUILD_INFO.json +2 -2
  211. package/app/package.json +1 -1
  212. package/app/server.js +1 -1
  213. package/dist/cli.d.ts +1 -1
  214. package/dist/cli.js +2 -2
  215. package/dist/product.d.ts +0 -1
  216. package/dist/product.js +12 -22
  217. package/dist/setup.js +9 -9
  218. package/package.json +1 -2
  219. package/schemas/botmancers.mcp.v2.tools.json +3 -3
  220. package/app/.next/server/app/api/agent-deck/decks/route/app-paths-manifest.json +0 -3
  221. package/app/.next/server/app/api/agent-deck/decks/route.js +0 -9
  222. package/app/.next/server/app/api/agent-deck/decks/route.js.nft.json +0 -1
  223. package/app/.next/server/app/api/agent-deck/decks/route_client-reference-manifest.js +0 -3
  224. package/app/.next/server/app/api/agent-deck/settings/route/app-paths-manifest.json +0 -3
  225. package/app/.next/server/app/api/agent-deck/settings/route/build-manifest.json +0 -12
  226. package/app/.next/server/app/api/agent-deck/settings/route/server-reference-manifest.json +0 -4
  227. package/app/.next/server/app/api/agent-deck/settings/route.js +0 -9
  228. package/app/.next/server/app/api/agent-deck/settings/route.js.nft.json +0 -1
  229. package/app/.next/server/app/api/agent-deck/settings/route_client-reference-manifest.js +0 -3
  230. package/app/.next/server/chunks/[root-of-the-server]__0e_agq4._.js +0 -3
  231. package/app/.next/server/chunks/[root-of-the-server]__0j4pjyg._.js +0 -3
  232. package/app/.next/server/chunks/[root-of-the-server]__0mo_kn3._.js +0 -48
  233. package/app/.next/server/chunks/[root-of-the-server]__17mum5-._.js +0 -3
  234. package/app/.next/server/chunks/[root-of-the-server]__1bhzfu_._.js +0 -7
  235. package/app/.next/server/chunks/[root-of-the-server]__1g_n99l._.js +0 -3
  236. package/app/.next/server/chunks/[root-of-the-server]__1t4ybp2._.js +0 -48
  237. package/app/.next/server/chunks/_0qv-4by._.js +0 -3
  238. package/app/.next/server/chunks/_next-internal_server_app_api_agent-deck_decks_route_actions_0yguyfv.js +0 -3
  239. package/app/.next/server/chunks/_next-internal_server_app_api_agent-deck_settings_route_actions_0z_nbkb.js +0 -3
  240. package/app/.next/server/chunks/lib_0v4d9w0._.js +0 -339
  241. package/app/.next/server/chunks/lib_0v6lblw._.js +0 -5
  242. package/app/.next/server/chunks/lib_0zzo6zb._.js +0 -339
  243. package/app/.next/server/chunks/lib_1_u7n-u._.js +0 -339
  244. package/app/.next/server/chunks/lib_1muhwn7._.js +0 -339
  245. package/app/.next/server/chunks/lib_1xnxg-q._.js +0 -339
  246. package/app/.next/server/chunks/ssr/_0_fa0na._.js +0 -3
  247. package/app/.next/server/chunks/ssr/_0epgorw._.js +0 -3
  248. package/app/.next/server/chunks/ssr/_1i02yyi._.js +0 -3
  249. package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +0 -3
  250. package/app/.next/server/chunks/ssr/app_exchanges_page_tsx_0j-n2a1._.js +0 -3
  251. package/app/.next/server/chunks/ssr/app_settings_page_tsx_1t-rdz-._.js +0 -3
  252. package/app/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a._.js +0 -3
  253. package/app/.next/static/chunks/0jon21u-9j2aw.css +0 -3
  254. package/app/.next/static/chunks/14k6cvywgknx2.js +0 -3
  255. package/app/.next/static/chunks/1ku9himlsx-hn.js +0 -1
  256. package/app/.next/static/chunks/1r5tqd-7h1xjn.js +0 -1
  257. package/app/.next/static/chunks/21aqekm5z0j47.js +0 -1
  258. package/app/.next/static/chunks/22xbkclbkct3s.js +0 -1
  259. package/app/.next/static/chunks/2c953okoei6ip.js +0 -1
  260. package/app/.next/static/chunks/2t_2gf3xoxz_m.js +0 -1
  261. package/app/.next/static/chunks/34vnvo1qssbaj.js +0 -1
  262. /package/app/.next/server/app/api/{agent-deck/decks → bots/[id]/sessions/sync}/route/build-manifest.json +0 -0
  263. /package/app/.next/server/app/api/{agent-deck/decks → bots/[id]/sessions/sync}/route/server-reference-manifest.json +0 -0
  264. /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → 3rSDqQK0KGcTDI98uoZRy}/_buildManifest.js +0 -0
  265. /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → 3rSDqQK0KGcTDI98uoZRy}/_clientMiddlewareManifest.js +0 -0
  266. /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → 3rSDqQK0KGcTDI98uoZRy}/_ssgManifest.js +0 -0
@@ -1,4 +1,4 @@
1
- module.exports=[85148,(e,t,a)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,a)=>{t.exports=e.x("fs",()=>require("fs"))},20635,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,a)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},8637,e=>{"use strict";var t=e.i(89171),a=e.i(62294),n=e.i(90027);async function r(e,{params:s}){try{let{id:r,ref:i}=await s;if(!(0,n.agentExists)(a.default,r))return t.NextResponse.json({error:"Agent not found"},{status:404});let o=(0,n.getAgentSession)(a.default,r,i);if(!o)return t.NextResponse.json({error:"Session not found"},{status:404});if("external_session_id"===new URL(e.url).searchParams.get("debug"))return t.NextResponse.json({session:o,debug:{external_session_id:(0,n.sessionDebugExternalId)(a.default,r,i)??null}});return t.NextResponse.json({session:o})}catch(e){return console.error("Error reading agent session:",e),t.NextResponse.json({error:"Failed to read session"},{status:500})}}e.s(["GET",0,r])},84098,e=>{"use strict";var t=e.i(47909),a=e.i(74017),n=e.i(96250),r=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),p=e.i(47587),_=e.i(66012),c=e.i(70101),g=e.i(26937),v=e.i(10372),E=e.i(93695),b=e.i(9580);e.i(52474);var m=e.i(220);let h=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/bots/[id]/sessions/[ref]/route",pathname:"/api/bots/[id]/sessions/[ref]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/sessions/[ref]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(8637),...{}}),{workAsyncStorage:f,workUnitAsyncStorage:R,serverHooks:S}=h;async function A(e,t,n){n.requestMeta&&(0,r.setRequestMeta)(e,n.requestMeta),h.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let f="/api/bots/[id]/sessions/[ref]/route";f=f.replace(/\/index$/,"")||"/";let R=await h.prepare(e,t,{srcPage:f,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:S,deploymentId:A,params:y,nextConfig:x,parsedUrl:N,isDraftMode:C,prerenderManifest:O,routerServerContext:w,isOnDemandRevalidate:T,revalidateOnlyGenerated:q,resolvedPathname:k,clientReferenceManifest:L,serverActionsManifest:I}=R,H=(0,o.normalizeAppPath)(f),D=!!O.routes[k]&&(h.isDev||(0,b.isRouteCacheOwner)(k,h.cacheOwner,O.routes[k])),M=!!(O.dynamicRoutes[H]||D),F=async()=>((null==w?void 0:w.render404)?await w.render404(e,t,N,!1):t.end("This page could not be found"),null);if(M&&!C){let e=O.dynamicRoutes[H];if(e&&!1===e.fallback&&!D){if(x.adapterPath)return await F();throw new E.NoFallbackError}}let P=null;!M||h.isDev||C||(P="/index"===(P=k)?"/":P);let U=!0===h.isDev||!M,$=M&&!U;I&&L&&(0,i.setManifestsSingleton)({page:f,clientReferenceManifest:L,serverActionsManifest:I});let j=e.method||"GET",W=(0,s.getTracer)(),J=W.getActiveScopeSpan(),G=!!(null==w?void 0:w.isWrappedByNextServer),K=!!(0,r.getRequestMeta)(e,"minimalMode"),X=(0,r.getRequestMeta)(e,"incrementalCache")||await h.getIncrementalCache(e,x,O,K);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let B={params:y,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts,useCacheTimeout:x.experimental.useCacheTimeout},cacheComponents:!!x.cacheComponents,validationLevel:x.experimental.instantInsights.validationLevel,isDraftMode:C,supportsDynamicResponse:U,incrementalCache:X,hmrRefreshHash:(0,r.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:x.cacheLife,staticPageGenerationTimeout:x.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,n,r)=>h.onRequestError(e,t,n,r,w)},sharedContext:{buildId:S,deploymentId:A}},V=new d.NodeNextRequest(e),z=new d.NodeNextResponse(t),Y=l.NextRequestAdapter.fromNodeNextRequest(V,(0,l.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:a})=>{try{if(!K&&T&&q&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await h.handle(Y,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let s=B.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let i=B.renderOpts.collectedTags;if(!M)return await (0,_.sendResponse)(V,z,r,s),null;{let e=await r.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(r.headers);i&&(t[v.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==B.renderOpts.collectedRevalidate&&!(B.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&B.renderOpts.collectedRevalidate,n=void 0===B.renderOpts.collectedExpire||B.renderOpts.collectedExpire>=v.INFINITE_CACHE?!1!==a&&a>0?x.expireTime:void 0:B.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:r.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:n}}}}catch(t){throw(null==a?void 0:a.isStale)&&await h.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,w),t}},Q=async(r,i)=>{try{var o,d;let r=await h.handleResponse({req:e,nextConfig:x,cacheKey:P,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:q,responseGenerator:Z,waitUntil:n.waitUntil,isMinimalMode:K});if(!M)return;if((null==r||null==(o=r.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==r||null==(d=r.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":r.isMiss?"MISS":r.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,c.fromNodeOutgoingHttpHeaders)(r.value.headers);K&&M||s.delete(v.NEXT_CACHE_TAGS_HEADER),!r.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,g.getCacheControlHeader)(r.cacheControl)),await (0,_.sendResponse)(V,z,new Response(r.value.body,{headers:s,status:r.value.status||200}));return}catch(t){if(t instanceof E.NoFallbackError||await h.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,w),M)throw t;await (0,_.sendResponse)(V,z,new Response(null,{status:500}));return}finally{(()=>{if(!r)return;let e=t.statusCode;r.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(r.setStatus({code:s.SpanStatusCode.ERROR}),r.setAttribute("error.type",e.toString()));let a=W.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=a.get("next.route")||H,o=`${j} ${n}`;r.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),r.updateName(o),i&&i!==r&&(i.setAttribute("http.route",n),i.updateName(o))})()}};if(G&&J)await Q(J,void 0);else{let t=W.getActiveScopeSpan();await W.withPropagatedContext(e.headers,()=>W.trace(u.BaseServerSpan.handleRequest,{spanName:`${j} ${f}`,kind:s.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},e=>Q(e,t)),void 0,!G)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:f,workUnitAsyncStorage:R})},"routeModule",0,h,"serverHooks",0,S,"workAsyncStorage",0,f,"workUnitAsyncStorage",0,R])},90027,e=>{"use strict";var t=e.i(62349),a=e.i(28420);let n=["active","ended","all"],r=["implementation","revision"],s=`
1
+ module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},8637,e=>{"use strict";var t=e.i(89171),r=e.i(62294),a=e.i(90027);async function n(e,{params:s}){try{let{id:n,ref:i}=await s;if(!(0,a.agentExists)(r.default,n))return t.NextResponse.json({error:"Agent not found"},{status:404});let o=(0,a.getAgentSession)(r.default,n,i);if(!o)return t.NextResponse.json({error:"Session not found"},{status:404});if("external_session_id"===new URL(e.url).searchParams.get("debug"))return t.NextResponse.json({session:o,debug:{external_session_id:(0,a.sessionDebugExternalId)(r.default,n,i)??null}});return t.NextResponse.json({session:o})}catch(e){return console.error("Error reading agent session:",e),t.NextResponse.json({error:"Failed to read session"},{status:500})}}e.s(["GET",0,n])},84098,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),p=e.i(47587),c=e.i(66012),_=e.i(70101),g=e.i(26937),f=e.i(10372),m=e.i(93695),b=e.i(9580);e.i(52474);var h=e.i(220);let v=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/[id]/sessions/[ref]/route",pathname:"/api/bots/[id]/sessions/[ref]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/sessions/[ref]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(8637),...{}}),{workAsyncStorage:E,workUnitAsyncStorage:S,serverHooks:R}=v;async function A(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),v.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/bots/[id]/sessions/[ref]/route";E=E.replace(/\/index$/,"")||"/";let S=await v.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!S)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:R,deploymentId:A,params:y,nextConfig:x,parsedUrl:N,isDraftMode:w,prerenderManifest:C,routerServerContext:O,isOnDemandRevalidate:T,revalidateOnlyGenerated:q,resolvedPathname:k,clientReferenceManifest:L,serverActionsManifest:I}=S,H=(0,o.normalizeAppPath)(E),P=!!C.routes[k]&&(v.isDev||(0,b.isRouteCacheOwner)(k,v.cacheOwner,C.routes[k])),M=!!(C.dynamicRoutes[H]||P),D=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,N,!1):t.end("This page could not be found"),null);if(M&&!w){let e=C.dynamicRoutes[H];if(e&&!1===e.fallback&&!P){if(x.adapterPath)return await D();throw new m.NoFallbackError}}let F=null;!M||v.isDev||w||(F="/index"===(F=k)?"/":F);let $=!0===v.isDev||!M,U=M&&!$;I&&L&&(0,i.setManifestsSingleton)({page:E,clientReferenceManifest:L,serverActionsManifest:I});let j=e.method||"GET",W=(0,s.getTracer)(),J=W.getActiveScopeSpan(),B=!!(null==O?void 0:O.isWrappedByNextServer),G=!!(0,n.getRequestMeta)(e,"minimalMode"),K=(0,n.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,x,C,G);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let X={params:y,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!x.experimental.authInterrupts,useCacheTimeout:x.experimental.useCacheTimeout},cacheComponents:!!x.cacheComponents,validationLevel:x.experimental.instantInsights.validationLevel,isDraftMode:w,supportsDynamicResponse:$,incrementalCache:K,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:x.cacheLife,staticPageGenerationTimeout:x.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>v.onRequestError(e,t,a,n,O)},sharedContext:{buildId:R,deploymentId:A}},V=new l.NodeNextRequest(e),z=new l.NodeNextResponse(t),Y=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:r})=>{try{if(!G&&T&&q&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await v.handle(Y,X);e.fetchMetrics=X.renderOpts.fetchMetrics;let s=X.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let i=X.renderOpts.collectedTags;if(!M)return await (0,c.sendResponse)(V,z,n,s),null;{let e=await n.blob(),t=(0,_.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[f.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=f.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,a=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=f.INFINITE_CACHE?!1!==r&&r>0?x.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:h.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:T})},!1,O),t}},Q=async(n,i)=>{try{var o,l;let n=await v.handleResponse({req:e,nextConfig:x,cacheKey:F,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:q,responseGenerator:Z,waitUntil:a.waitUntil,isMinimalMode:G});if(!M)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==h.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",T?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),w&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,_.fromNodeOutgoingHttpHeaders)(n.value.headers);G&&M||s.delete(f.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,g.getCacheControlHeader)(n.cacheControl)),await (0,c.sendResponse)(V,z,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof m.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:U,isOnDemandRevalidate:T})},!1,O),M)throw t;await (0,c.sendResponse)(V,z,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=W.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||H,o=`${j} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":o}),n.updateName(o),i&&i!==n&&(i.setAttribute("http.route",a),i.updateName(o))})()}};if(B&&J)await Q(J,void 0);else{let t=W.getActiveScopeSpan();await W.withPropagatedContext(e.headers,()=>W.trace(u.BaseServerSpan.handleRequest,{spanName:`${j} ${E}`,kind:s.SpanKind.SERVER,attributes:{"http.method":j,"http.target":e.url}},e=>Q(e,t)),void 0,!B)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:S})},"routeModule",0,v,"serverHooks",0,R,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,S])},90027,46309,e=>{"use strict";var t=e.i(54799),r=e.i(62349),a=e.i(28420);function n(e,t){return t.at-e.at||t.tie-e.tie||(e.id<t.id?-1:+(e.id>t.id))}function s(e,t){return Buffer.from(JSON.stringify({s:e,a:t.at,t:t.tie,i:t.id}),"utf8").toString("base64url")}class i extends Error{constructor(){super("cursor is not a cursor of this list."),this.name="InvalidPageCursorError"}}function o(e,t){let r;if(null===t||""===t)return null;if(t.length>1024)throw new i;try{r=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw new i}if(!r||r.s!==e||"number"!=typeof r.a||"number"!=typeof r.t||"string"!=typeof r.i)throw new i;return{at:r.a,tie:r.t,id:r.i}}function l(e,t,r,a,i){let l=o(e,a),d=[...t].sort((e,t)=>n(r(e),r(t))),u=l?d.filter(e=>n(r(e),l)>0):d,p=u.slice(0,i),c=u.length>i?s(e,r(p[p.length-1])):null;return{items:p,next_cursor:c}}e.s(["InvalidPageCursorError",0,i,"decodePageCursor",0,o,"encodePageCursor",0,s,"paginateRows",0,l],46309);let d=["active","ended","all"];function u(e){return"string"==typeof e&&d.includes(e)}let p=["implementation","revision"],c=`
2
2
  SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
3
3
  c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
4
4
  r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
@@ -17,7 +17,7 @@ module.exports=[85148,(e,t,a)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",
17
17
  LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
18
18
  LEFT JOIN bots tb ON tb.id = c.bot_id
19
19
  LEFT JOIN groups g ON g.id = c.group_id
20
- `,i=`
20
+ `,_=`
21
21
  SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
22
22
  ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
23
23
  ps.last_synced_at, ps.created_at, ps.updated_at,
@@ -26,19 +26,19 @@ module.exports=[85148,(e,t,a)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",
26
26
  FROM provider_sessions ps
27
27
  JOIN bots bot ON bot.id = ps.agent_id
28
28
  WHERE ps.binding_id IS NULL
29
- `;function o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function d(e,t){let a=e?.[t];return"string"==typeof a&&a.trim().length>0?a:null}function l(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function u(e,n=(0,a.emptyUsage)()){let s,i=null;try{i=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let p=l(e),_=null===e.released_at?"active":"ended",c=((s=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?s.length>80?`${s.slice(0,79).trimEnd()}…`:s:null)??(p?.kind==="group"?p.label:null)??`${e.agent_name} \xb7 ${o(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:d(i,"transport")},title:c,status:_,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&r.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,t.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:p,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:d(i,"cwd")??e.ps_workspace??null,deck:d(i,"deck")},usage:n}}function p(e,t=(0,a.emptyUsage)()){let n=e.provider_created_at??e.created_at,r=null===e.resumable?null:1===e.resumable,s="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:e.title??`${e.agent_name} \xb7 ${o(n)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:r,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:n,ended_at:s,last_activity_at:Math.max(n,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace,deck:null},usage:t}}function _(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function c(e,t,a){return e.prepare(`${i} AND ps.id = ? AND ps.agent_id = ?`).get(a,t)}function g(e,t,a){return e.prepare(`${s} WHERE b.id = ? AND b.agent_id = ?`).get(a,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let a=e.prepare(`
29
+ `;function g(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function f(e,t){let r=e?.[t];return"string"==typeof r&&r.trim().length>0?r:null}function m(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function b(e,t=(0,a.emptyUsage)()){let n,s=null;try{s=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let i=m(e),o=null===e.released_at?"active":"ended",l=((n=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?n.length>80?`${n.slice(0,79).trimEnd()}…`:n:null)??(i?.kind==="group"?i.label:null)??`${e.agent_name} \xb7 ${g(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:f(s,"transport")},title:l,status:o,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&p.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,r.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:i,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:f(s,"cwd")??e.ps_workspace??null},usage:t}}function h(e,t=(0,a.emptyUsage)()){var r;let n=e.provider_created_at??e.created_at,s=null===e.resumable?null:1===e.resumable,i="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null,o=(e.title??"").trim().length>0?e.title:null,l=(r=e.workspace)?r.split("/").filter(e=>e.length>0).pop()??null:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:o??(l?`${l} \xb7 ${g(n)}`:`${e.agent_name} \xb7 ${g(n)}`),status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:s,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:n,ended_at:i,last_activity_at:Math.max(n,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace},usage:t}}function v(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function E(e,t,r="all"){let n=e.prepare(`${c} WHERE b.agent_id = ? ${"active"===r?"AND b.released_at IS NULL":"ended"===r?"AND b.released_at IS NOT NULL":""}`).all(t),s=e.prepare(`${_} AND ps.agent_id = ? ${"active"===r?"AND ps.lifecycle = 'open'":"ended"===r?"AND ps.lifecycle = 'archived'":""}`).all(t),i=(0,a.agentSessionUsage)(e,t);return[...n.map(e=>b(e,i.get(e.id))),...s.map(e=>h(e,i.get(e.id)))].sort(v)}let S=Object.freeze({default:50,max:200});function R(e,t,r){return e.prepare(`${_} AND ps.id = ? AND ps.agent_id = ?`).get(r,t)}function A(e,t,r){return e.prepare(`${c} WHERE b.id = ? AND b.agent_id = ?`).get(r,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let r=e.prepare(`
30
30
  SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
31
31
  tb.name AS thread_agent_name, g.name AS group_name
32
32
  FROM conversations c
33
33
  LEFT JOIN bots tb ON tb.id = c.bot_id
34
34
  LEFT JOIN groups g ON g.id = c.group_id
35
35
  WHERE c.id = ?
36
- `).get(t);return a?l(a):null},"getAgentSession",0,function(e,t,n){let r=g(e,t,n);if(!r){let r=c(e,t,n);if(!r)return;let{usage:s,samples:i}=(0,a.sessionUsageSamples)(e,t,n);return{...p(r,s),attempts:[],usage_samples:i}}let s=e.prepare(`
36
+ `).get(t);return r?m(r):null},"getAgentSession",0,function(e,t,r){let n=A(e,t,r);if(!n){let n=R(e,t,r);if(!n)return;let{usage:s,samples:i}=(0,a.sessionUsageSamples)(e,t,r);return{...h(n,s),attempts:[],usage_samples:i}}let s=e.prepare(`
37
37
  SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
38
38
  CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
39
39
  FROM work_attempts a
40
40
  WHERE a.id = ? OR a.resumed_session_binding_id = ?
41
41
  ORDER BY a.started_at ASC, a.id ASC
42
- `).all(r.source_attempt_id,r.source_attempt_id,r.id),{usage:i,samples:o}=(0,a.sessionUsageSamples)(e,t,n);return{...u(r,i),attempts:s,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&n.includes(e)},"listAgentSessions",0,function(e,t,n="all"){let r=e.prepare(`${s} WHERE b.agent_id = ? ${"active"===n?"AND b.released_at IS NULL":"ended"===n?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${i} AND ps.agent_id = ? ${"active"===n?"AND ps.lifecycle = 'open'":"ended"===n?"AND ps.lifecycle = 'archived'":""}`).all(t),d=(0,a.agentSessionUsage)(e,t);return[...r.map(e=>u(e,d.get(e.id))),...o.map(e=>p(e,d.get(e.id)))].sort(_)},"sessionDebugExternalId",0,function(e,t,a){let n=g(e,t,a)?.external_session_id;if(void 0!==n)return n;if(!c(e,t,a))return;let r=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(a,t);return r?.provider_session_id},"sessionTitle",0,function(e,t,a){let n=g(e,t,a);if(n)return u(n).title;let r=c(e,t,a);return r?p(r).title:null}])}];
42
+ `).all(n.source_attempt_id,n.source_attempt_id,n.id),{usage:i,samples:o}=(0,a.sessionUsageSamples)(e,t,r);return{...b(n,i),attempts:s,usage_samples:o}},"isSessionFilter",0,u,"listAgentSessionPage",0,function(e,r,a={}){let n=a.status??"all";if(!u(n))throw Error("status must be active, ended, or all.");let s=a.limit??S.default;if(!Number.isInteger(s)||s<1)throw Error("limit must be a positive integer.");let i=(a.q??"").trim().toLowerCase(),o=a.workspace??"",d=E(e,r,n).filter(e=>(""===i||e.title.toLowerCase().includes(i))&&(""===o||e.context.workspace===o)),p=l(`owner-sessions:${r}:${n}:${(0,t.createHash)("sha256").update(JSON.stringify([i,o])).digest("hex")}`,d,e=>({at:e.last_activity_at,tie:e.created_at,id:e.ref}),a.cursor??null,s);return{sessions:p.items,next_cursor:p.next_cursor}},"listAgentSessions",0,E,"parseSessionListLimit",0,function(e){if(null===e||""===e)return S.default;if(!/^\d+$/.test(e)||1>Number(e))throw Error("limit must be a positive integer.");return Math.min(Number(e),S.max)},"sessionDebugExternalId",0,function(e,t,r){let a=A(e,t,r)?.external_session_id;if(void 0!==a)return a;if(!R(e,t,r))return;let n=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(r,t);return n?.provider_session_id},"sessionTitle",0,function(e,t,r){let a=A(e,t,r);if(a)return b(a).title;let n=R(e,t,r);return n?h(n).title:null}],90027)}];
43
43
 
44
44
  //# sourceMappingURL=%5Broot-of-the-server%5D__0qaiqut._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},53293,e=>{"use strict";var t=e.i(89171),r=e.i(62294),s=e.i(90027),n=e.i(46309),a=e.i(674),i=e.i(16789),o=e.i(2728);async function l(e,{params:u}){try{let l,d,{id:c}=await u;if(!(0,s.agentExists)(r.default,c))return t.NextResponse.json({error:"Agent not found"},{status:404});let p=new URL(e.url).searchParams,h=p.get("status")??"all";if(!(0,s.isSessionFilter)(h))return t.NextResponse.json({error:"status must be active, ended, or all"},{status:400});try{l=(0,s.parseSessionListLimit)(p.get("limit"))}catch{return t.NextResponse.json({error:"limit must be a positive integer."},{status:400})}try{d=(0,s.listAgentSessionPage)(r.default,c,{status:h,q:p.get("q"),workspace:p.get("workspace"),cursor:p.get("cursor"),limit:l})}catch(e){if(e instanceof n.InvalidPageCursorError)return t.NextResponse.json({error:"cursor is not a cursor of this list."},{status:400});throw e}return await (0,i.warmAgentProvider)(r.default,c,{onlyWithSessions:!0}),t.NextResponse.json({status:h,synced_at:(0,o.agentSessionsSyncedAt)(r.default,c),sync:(0,i.getAgentSyncState)(r.default,c),sessions:(0,a.sessionsWithActions)(c,d.sessions),next_cursor:d.next_cursor})}catch(e){return console.error("Error listing agent sessions:",e),t.NextResponse.json({error:"Failed to list sessions"},{status:500})}}e.s(["GET",0,l])},58554,e=>{"use strict";var t=e.i(47909),r=e.i(74017),s=e.i(96250),n=e.i(59756),a=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),R=e.i(26937),g=e.i(10372),v=e.i(93695),f=e.i(9580);e.i(52474);var x=e.i(220);let m=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/[id]/sessions/route",pathname:"/api/bots/[id]/sessions",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/sessions/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(53293),...{}}),{workAsyncStorage:y,workUnitAsyncStorage:E,serverHooks:w}=m;async function A(e,t,s){s.requestMeta&&(0,n.setRequestMeta)(e,s.requestMeta),m.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let y="/api/bots/[id]/sessions/route";y=y.replace(/\/index$/,"")||"/";let E=await m.prepare(e,t,{srcPage:y,multiZoneDraftMode:!1});if(!E)return t.statusCode=400,t.end("Bad Request"),null==s.waitUntil||s.waitUntil.call(s,Promise.resolve()),null;let{buildId:w,deploymentId:A,params:C,nextConfig:S,parsedUrl:b,isDraftMode:T,prerenderManifest:_,routerServerContext:N,isOnDemandRevalidate:P,revalidateOnlyGenerated:O,resolvedPathname:q,clientReferenceManifest:H,serverActionsManifest:I}=E,M=(0,o.normalizeAppPath)(y),j=!!_.routes[q]&&(m.isDev||(0,f.isRouteCacheOwner)(q,m.cacheOwner,_.routes[q])),k=!!(_.dynamicRoutes[M]||j),U=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,b,!1):t.end("This page could not be found"),null);if(k&&!T){let e=_.dynamicRoutes[M];if(e&&!1===e.fallback&&!j){if(S.adapterPath)return await U();throw new v.NoFallbackError}}let D=null;!k||m.isDev||T||(D="/index"===(D=q)?"/":D);let F=!0===m.isDev||!k,L=k&&!F;I&&H&&(0,i.setManifestsSingleton)({page:y,clientReferenceManifest:H,serverActionsManifest:I});let K=e.method||"GET",B=(0,a.getTracer)(),$=B.getActiveScopeSpan(),G=!!(null==N?void 0:N.isWrappedByNextServer),W=!!(0,n.getRequestMeta)(e,"minimalMode"),X=(0,n.getRequestMeta)(e,"incrementalCache")||await m.getIncrementalCache(e,S,_,W);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let V={params:C,previewProps:_.preview,renderOpts:{experimental:{authInterrupts:!!S.experimental.authInterrupts,useCacheTimeout:S.experimental.useCacheTimeout},cacheComponents:!!S.cacheComponents,validationLevel:S.experimental.instantInsights.validationLevel,isDraftMode:T,supportsDynamicResponse:F,incrementalCache:X,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:S.cacheLife,staticPageGenerationTimeout:S.staticPageGenerationTimeout,waitUntil:s.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,s,n)=>m.onRequestError(e,t,s,n,N)},sharedContext:{buildId:w,deploymentId:A}},z=new l.NodeNextRequest(e),Z=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!W&&P&&O&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await m.handle(J,V);e.fetchMetrics=V.renderOpts.fetchMetrics;let a=V.renderOpts.pendingWaitUntil;a&&s.waitUntil&&(s.waitUntil(a),a=void 0);let i=V.renderOpts.collectedTags;if(!k)return await (0,p.sendResponse)(z,Z,n,a),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[g.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==V.renderOpts.collectedRevalidate&&!(V.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&V.renderOpts.collectedRevalidate,s=void 0===V.renderOpts.collectedExpire||V.renderOpts.collectedExpire>=g.INFINITE_CACHE?!1!==r&&r>0?S.expireTime:void 0:V.renderOpts.collectedExpire;return{value:{kind:x.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:s}}}}catch(t){throw(null==r?void 0:r.isStale)&&await m.onRequestError(e,t,{routerKind:"App Router",routePath:y,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:P})},!1,N),t}},Y=async(n,i)=>{try{var o,l;let n=await m.handleResponse({req:e,nextConfig:S,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:P,revalidateOnlyGenerated:O,responseGenerator:Q,waitUntil:s.waitUntil,isMinimalMode:W});if(!k)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});W||t.setHeader("x-nextjs-cache",P?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),T&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let a=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);W&&k||a.delete(g.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||a.get("Cache-Control")||a.set("Cache-Control",(0,R.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(z,Z,new Response(n.value.body,{headers:a,status:n.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await m.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:P})},!1,N),k)throw t;await (0,p.sendResponse)(z,Z,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:a.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let s=r.get("next.route")||M,o=`${K} ${s}`;n.setAttributes({"next.route":s,"http.route":s,"next.span_name":o}),n.updateName(o),i&&i!==n&&(i.setAttribute("http.route",s),i.updateName(o))})()}};if(G&&$)await Y($,void 0);else{let t=B.getActiveScopeSpan();await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${K} ${y}`,kind:a.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,s.patchFetch)({workAsyncStorage:y,workUnitAsyncStorage:E})},"routeModule",0,m,"serverHooks",0,w,"workAsyncStorage",0,y,"workUnitAsyncStorage",0,E])},2728,e=>{"use strict";e.i(62294),e.i(16789);let t=Symbol.for("botmancers.session-sync-inflight");function r(){let e=globalThis;return e[t]||(e[t]=new Set),e[t]}Symbol.for("botmancers.session-sync-loop"),e.s(["agentSessionsSyncedAt",0,function(e,t){let r=e.prepare("SELECT MAX(last_synced_at) AS synced_at FROM provider_sessions WHERE agent_id = ?").get(t);return r?.synced_at??null},"endAgentSync",0,function(e){r().delete(e)},"tryBeginAgentSync",0,function(e){let t=r();return!t.has(e)&&(t.add(e),!0)}])}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0qqsovi._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[54799,(e,r,t)=>{r.exports=e.x("crypto",()=>require("crypto"))},22734,(e,r,t)=>{r.exports=e.x("fs",()=>require("fs"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,r,t)=>{r.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,r,t)=>{r.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,r,t)=>{r.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},62349,16979,e=>{"use strict";let r=[{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"}],t=[{id:"dots",label:"Round dots"},{id:"sleepy",label:"Sleepy"},{id:"happy",label:"Happy arcs"},{id:"wide",label:"Wide ovals"}],n=[{id:"folded",label:"Folded arms"},{id:"reaching",label:"Reaching right"},{id:"waving",label:"Waving"}],i=[{id:"none",label:"None"},{id:"crown",label:"Crown"},{id:"glasses",label:"Glasses"},{id:"headset",label:"Headset"},{id:"hat",label:"Hat"},{id:"bow",label:"Bow"}],a={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},s={...a,accessory:"crown"};function o(e){return"chief-of-staff"===String(e??"").trim().toLowerCase()}function l(e,r){return"string"==typeof r&&e.some(e=>e.id===r)}function c(e){let c=l(r,e.avatar_color)?e.avatar_color:a.color,d=l(t,e.avatar_eyes)?e.avatar_eyes:a.eyes;return{color:c,eyes:d,hands:l(n,e.avatar_hands)?e.avatar_hands:a.hands,accessory:l(i,e.avatar_accessory)?e.avatar_accessory:o(e.name)?s.accessory:a.accessory}}e.s(["isChiefOfStaffName",0,o,"resolveAvatar",0,c,"validateAvatarInput",0,function(e){let a=[],s={};if(null==e)return{errors:a,fields:s};if("object"!=typeof e||Array.isArray(e))return{errors:["Invalid avatar: expected an object with color, eyes, hands, and accessory."],fields:s};if(void 0!==e.color)try{s.avatar_color=function(e){if(l(r,e))return e;throw Error(`Invalid avatar color: ${JSON.stringify(String(e))}. Expected one of ${r.map(e=>e.id).join("|")}.`)}(e.color)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.eyes)try{s.avatar_eyes=function(e){if(l(t,e))return e;throw Error(`Invalid avatar eyes: ${JSON.stringify(String(e))}. Expected one of ${t.map(e=>e.id).join("|")}.`)}(e.eyes)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.hands)try{s.avatar_hands=function(e){if(l(n,e))return e;throw Error(`Invalid avatar hands: ${JSON.stringify(String(e))}. Expected one of ${n.map(e=>e.id).join("|")}.`)}(e.hands)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.accessory)try{s.avatar_accessory=function(e){if(l(i,e))return e;throw Error(`Invalid avatar accessory: ${JSON.stringify(String(e))}. Expected one of ${i.map(e=>e.id).join("|")}.`)}(e.accessory)}catch(e){a.push(e instanceof Error?e.message:String(e))}return{errors:a,fields:s}}],16979);let d=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},f="hermes",_={hermes:"hermes-gateway",cursor:"agent-deck-run",claude:"agent-deck-run",codex:"agent-deck-run",muse:"agent-deck-run"};function g(e){return _[e]}class p extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${d.join("|")}.`)}}class h extends Error{code="invalid-deck";constructor(e){super(`Invalid deck ID: ${JSON.stringify("string"==typeof e?e:String(e))}. Select a deck from the configured Agent Deck server.`)}}let m="Deck ID is required. Select an Agent Deck before saving this agent.",k=`Agent is required. Expected one of ${d.join("|")}.`,y="Fields runtime/agent_client are no longer accepted. Send agent (hermes|cursor|claude|codex|muse) and deck_id instead.",v="deck_name is a read-only legacy reference. Select a deck_id from the configured Agent Deck server instead.";function x(e){if(null==e)return null;let r=String(e).trim();if(!r)return null;if(d.includes(r))return r;throw new p(e)}function b(e){return null==e?null:String(e).trim()||null}function E(e){if(null==e)return null;if("string"!=typeof e)throw new h(e);let r=e.trim();if(!r)return null;if(!function(e){if(e.length>200||/\s/.test(e))return!1;for(let r=0;r<e.length;r++){let t=e.charCodeAt(r);if(t<32||127===t)return!1}return!0}(r))throw new h(e);return r}function w(e){if(!0===e||1===e)return!0;if("string"==typeof e){let r=e.trim().toLowerCase();return"1"===r||"true"===r}return!1}function S(e){let r,t=f,n=!0;try{t=x(e.agent)??f}catch{n=!1}let i=b(e.deck_id),a=b(e.deck_name),s=b(e.working_directory);if("launch_profile"in e){let t=e.launch_profile;r="direct"===t||"agent_deck"===t?t:null}else r=i?"agent_deck":null;let o="direct"!==r&&(null===i||w(e.needs_deck_selection)),l=null;return n?r?!function(e){if(!("session_scope_kind"in e))return!0;let r=e.session_scope_kind,t=[];try{t=e.session_scope_items?JSON.parse(e.session_scope_items):[]}catch{return!1}if(!Array.isArray(t))return!1;let n=t.filter(e=>"string"==typeof e&&e.trim()).length;return"all_provider_sessions"===r?0===n:("workspaces"===r||"sessions"===r)&&n>0}(e)?l="session_scope":"agent_deck"===r&&o?l="deck":"direct"===r&&"hermes-gateway"!==g(t)&&(l="direct_runtime"):l="launch_profile":l="agent",{agent:t,deck_id:"direct"===r?null:i,deck_name:a,working_directory:"direct"===r?null:s,needs_deck_selection:o,launch_profile:r,needs_launch_profile:null===r,launchable:null===l,launch_blocker:l}}let A=["codex","claude","cursor","muse"];function j(e){let r=b(e);return r&&A.includes(r)?r:null}let R=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection"];e.s(["AGENTS",0,d,"AGENT_LABELS",0,u,"DECK_REQUIRED_ERROR",0,m,"DEFAULT_AGENT",0,f,"LEGACY_DECK_NAME_FIELD_ERROR",0,v,"LEGACY_RUNTIME_FIELD_ERROR",0,y,"agentLabel",0,function(e){return d.includes(String(e))?u[e]:String(e??"")},"agentTransport",0,g,"applyAgentUpdate",0,function(e,r){let t=S(e),n=r.agent??t.agent,i=void 0!==r.working_directory?r.working_directory:t.working_directory;return void 0!==r.deck_id?{agent:n,deck_id:r.deck_id,deck_name:null,working_directory:i,needs_deck_selection:!1}:{agent:n,deck_id:t.deck_id,deck_name:t.deck_name,working_directory:i,needs_deck_selection:t.needs_deck_selection}},"buildAvailabilityPayload",0,function(e){let r=[];for(let t of d)e.includes(t)&&r.push({agent:t,label:u[t],launchable:!0});return{agents:r}},"hasAgentUpdate",0,function(e){return["agent","deck_id","working_directory","runtime","agent_client","deck_name"].some(r=>void 0!==e[r])},"migrateLegacyAgentFields",0,function(e){let r=b(e.deck_id),t=b(e.deck_name),n=b(e.working_directory);try{let a=x(e.agent);if(a){var i;return{agent:a,deck_id:r,deck_name:t,working_directory:n,needs_deck_selection:null===r||(i=e.needs_deck_selection,w(i)),migrated:!1}}}catch{}let a=b(e.runtime),s=f,o=w(e.needs_deck_reselection);if("agent-deck"===a){let r=j(e.agent_client);r?s=r:o=!0}else if("hermes"!==a){let r=j(e.coding_runtime);r&&t&&n&&(s=r,o=!0)}return{agent:s,deck_id:r,deck_name:t,working_directory:n,needs_deck_selection:null===r||o,migrated:!0}},"normalizeAgent",0,x,"parseRequestDeckId",0,E,"resolveAgent",0,S,"serializeBot",0,function(e){let r=S(e),t={...e};for(let e of R)delete t[e];return{...t,agent:r.agent,deck_id:r.deck_id,deck_name:r.deck_name,working_directory:r.working_directory,needs_deck_selection:r.needs_deck_selection,launch_profile:r.launch_profile,needs_launch_profile:r.needs_launch_profile,launchable:r.launchable,launch_blocker:r.launch_blocker,avatar_config:c(e)}},"validateUpdateAgent",0,function(e){let r=[],t={};if((void 0!==e.runtime||void 0!==e.agent_client)&&r.push(y),void 0!==e.deck_name&&r.push(v),void 0!==e.agent)try{let n=x(e.agent);n?t.agent=n:r.push(k)}catch(e){r.push(e instanceof Error?e.message:String(e))}if(void 0!==e.deck_id)try{let n=E(e.deck_id);n?t.deck_id=n:r.push(m)}catch(e){r.push(e instanceof Error?e.message:String(e))}return void 0!==e.working_directory&&(t.working_directory=b(e.working_directory)),{errors:r,fields:t}}],62349)},52036,e=>{"use strict";var r=e.i(14747);function t(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?r.default.resolve(n):null}function n(e,r){return(e[r]||"").trim()||null}e.s(["botmancersHome",0,t,"dbPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_DB_PATH");if(i)return i;let a=t(e);return a?r.default.join(a,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_FILES_ROOT");if(i)return r.default.resolve(i);let a=t(e);return a?r.default.join(a,"files"):r.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_SKILLS_ROOT");if(i)return r.default.resolve(i);let a=t(e);return a?r.default.join(a,"skills"):r.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let i=n(e,"HERMES_WAIT_LOG_PATH");if(i)return i;let a=t(e);return a?r.default.join(a,"logs/specialist-waits.jsonl"):r.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
1
+ module.exports=[54799,(e,r,t)=>{r.exports=e.x("crypto",()=>require("crypto"))},22734,(e,r,t)=>{r.exports=e.x("fs",()=>require("fs"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,r,t)=>{r.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,r,t)=>{r.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,r,t)=>{r.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},62349,16979,e=>{"use strict";let r=[{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"}],t=[{id:"dots",label:"Round dots"},{id:"sleepy",label:"Sleepy"},{id:"happy",label:"Happy arcs"},{id:"wide",label:"Wide ovals"}],n=[{id:"folded",label:"Folded arms"},{id:"reaching",label:"Reaching right"},{id:"waving",label:"Waving"}],s=[{id:"none",label:"None"},{id:"crown",label:"Crown"},{id:"glasses",label:"Glasses"},{id:"headset",label:"Headset"},{id:"hat",label:"Hat"},{id:"bow",label:"Bow"}],a={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},i={...a,accessory:"crown"};function o(e){return"chief-of-staff"===String(e??"").trim().toLowerCase()}function l(e,r){return"string"==typeof r&&e.some(e=>e.id===r)}function c(e){let c=l(r,e.avatar_color)?e.avatar_color:a.color,d=l(t,e.avatar_eyes)?e.avatar_eyes:a.eyes;return{color:c,eyes:d,hands:l(n,e.avatar_hands)?e.avatar_hands:a.hands,accessory:l(s,e.avatar_accessory)?e.avatar_accessory:o(e.name)?i.accessory:a.accessory}}e.s(["isChiefOfStaffName",0,o,"resolveAvatar",0,c,"validateAvatarInput",0,function(e){let a=[],i={};if(null==e)return{errors:a,fields:i};if("object"!=typeof e||Array.isArray(e))return{errors:["Invalid avatar: expected an object with color, eyes, hands, and accessory."],fields:i};if(void 0!==e.color)try{i.avatar_color=function(e){if(l(r,e))return e;throw Error(`Invalid avatar color: ${JSON.stringify(String(e))}. Expected one of ${r.map(e=>e.id).join("|")}.`)}(e.color)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.eyes)try{i.avatar_eyes=function(e){if(l(t,e))return e;throw Error(`Invalid avatar eyes: ${JSON.stringify(String(e))}. Expected one of ${t.map(e=>e.id).join("|")}.`)}(e.eyes)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.hands)try{i.avatar_hands=function(e){if(l(n,e))return e;throw Error(`Invalid avatar hands: ${JSON.stringify(String(e))}. Expected one of ${n.map(e=>e.id).join("|")}.`)}(e.hands)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.accessory)try{i.avatar_accessory=function(e){if(l(s,e))return e;throw Error(`Invalid avatar accessory: ${JSON.stringify(String(e))}. Expected one of ${s.map(e=>e.id).join("|")}.`)}(e.accessory)}catch(e){a.push(e instanceof Error?e.message:String(e))}return{errors:a,fields:i}}],16979);let d=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},p="hermes",f={hermes:"hermes-gateway",cursor:"session-provider",claude:"session-provider",codex:"session-provider",muse:"session-provider"};class g extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${d.join("|")}.`)}}function m(e){if(null==e)return null;let r=String(e).trim();if(!r)return null;if(d.includes(r))return r;throw new g(e)}function _(e){return null==e?null:String(e).trim()||null}function h(e){let r=p,t=!0;try{r=m(e.agent)??p}catch{t=!1}let n=_(e.runtime_connection_id),s=null;return t?n?!function(e){if(!("session_scope_kind"in e))return!0;let r=e.session_scope_kind,t=[];try{t=e.session_scope_items?JSON.parse(e.session_scope_items):[]}catch{return!1}if(!Array.isArray(t))return!1;let n=t.filter(e=>"string"==typeof e&&e.trim()).length;return"all_provider_sessions"===r?0===n:("workspaces"===r||"sessions"===r)&&n>0}(e)&&(s="session_scope"):s="connection":s="agent",{agent:r,runtime_connection_id:n,launchable:null===s,launch_blocker:s}}d.join("|");let x=["codex","claude","cursor","muse"];function v(e){let r=_(e);return r&&x.includes(r)?r:null}let y=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection","deck_id","deck_name","working_directory","needs_deck_selection","launch_profile"];e.s(["AGENTS",0,d,"AGENT_LABELS",0,u,"DEFAULT_AGENT",0,p,"LEGACY_RUNTIME_FIELD_ERROR",0,"Fields runtime/agent_client are no longer accepted. Register with a runtime connection, session scope, and policy instead.","REMOVED_LAUNCH_FIELD_ERROR",0,"Fields launch_profile/deck_id/deck_name/working_directory are no longer accepted. An Agent launches direct from its runtime connection, session scope, default workspace, and policy.","agentTransport",0,function(e){return f[e]},"buildAvailabilityPayload",0,function(e){let r=[];for(let t of d)e.includes(t)&&r.push({agent:t,label:u[t],launchable:!0});return{agents:r}},"migrateLegacyAgentFields",0,function(e){try{let r=m(e.agent);if(r)return{agent:r,migrated:!1}}catch{}let r=_(e.runtime),t=p;if("agent-deck"===r)t=v(e.agent_client)??p;else if("hermes"!==r){let r=v(e.coding_runtime),n=_(e.deck_name),s=_(e.working_directory);r&&n&&s&&(t=r)}return{agent:t,migrated:!0}},"normalizeAgent",0,m,"resolveAgent",0,h,"serializeBot",0,function(e){let r=h(e),t={...e};for(let e of y)delete t[e];return{...t,agent:r.agent,runtime_connection_id:r.runtime_connection_id,launchable:r.launchable,launch_blocker:r.launch_blocker,avatar_config:c(e)}}],62349)},52036,e=>{"use strict";var r=e.i(14747);function t(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?r.default.resolve(n):null}function n(e,r){return(e[r]||"").trim()||null}e.s(["botmancersHome",0,t,"dbPath",0,function(e=process.env){let s=n(e,"BOTMANCERS_DB_PATH");if(s)return s;let a=t(e);return a?r.default.join(a,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let s=n(e,"BOTMANCERS_FILES_ROOT");if(s)return r.default.resolve(s);let a=t(e);return a?r.default.join(a,"files"):r.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let s=n(e,"BOTMANCERS_SKILLS_ROOT");if(s)return r.default.resolve(s);let a=t(e);return a?r.default.join(a,"skills"):r.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let s=n(e,"HERMES_WAIT_LOG_PATH");if(s)return s;let a=t(e);return a?r.default.join(a,"logs/specialist-waits.jsonl"):r.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0zrx1iz._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},88831,e=>{"use strict";var t=e.i(89171),r=e.i(62294),n=e.i(10860),a=e.i(38636);function s(e){let t=r.bots.getById(e);if(!t)return null;let s=(0,n.readSkillState)(t.name);return{bot:t,skill:s,currentHash:(0,a.hashSnapshot)((0,a.buildSnapshotInput)(t,s,r.memories.latestFacts(t.id)))}}async function i(e,{params:a}){try{let{id:i}=await a,o=r.bots.getById(i);if(!o)return t.NextResponse.json({error:"Bot not found"},{status:404});let l=await e.json(),u=void 0===l.content||null===l.content?"":String(l.content);try{(0,n.writeSkillForBot)(o.name,u)}catch(e){return t.NextResponse.json({error:e instanceof Error?e.message:"Failed to save skill"},{status:400})}return t.NextResponse.json(s(i))}catch(e){return console.error("Error saving skill:",e),t.NextResponse.json({error:"Failed to save skill"},{status:500})}}async function o(e,{params:a}){try{let{id:e}=await a,i=r.bots.getById(e);if(!i)return t.NextResponse.json({error:"Bot not found"},{status:404});try{(0,n.writeSkillForBot)(i.name,"")}catch(e){return t.NextResponse.json({error:e instanceof Error?e.message:"Failed to delete skill"},{status:400})}return t.NextResponse.json(s(e))}catch(e){return console.error("Error deleting skill:",e),t.NextResponse.json({error:"Failed to delete skill"},{status:500})}}e.s(["DELETE",0,o,"PUT",0,i])},15418,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),m=e.i(10372),v=e.i(93695),R=e.i(9580);e.i(52474);var g=e.i(220);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/[id]/skill/route",pathname:"/api/bots/[id]/skill",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/skill/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(88831),...{}}),{workAsyncStorage:_,workUnitAsyncStorage:y,serverHooks:S}=x;async function k(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),x.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let _="/api/bots/[id]/skill/route";_=_.replace(/\/index$/,"")||"/";let y=await x.prepare(e,t,{srcPage:_,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:S,deploymentId:k,params:w,nextConfig:E,parsedUrl:b,isDraftMode:C,prerenderManifest:A,routerServerContext:N,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:q,clientReferenceManifest:I,serverActionsManifest:O}=y,j=(0,o.normalizeAppPath)(_),H=!!A.routes[q]&&(x.isDev||(0,R.isRouteCacheOwner)(q,x.cacheOwner,A.routes[q])),F=!!(A.dynamicRoutes[j]||H),M=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,b,!1):t.end("This page could not be found"),null);if(F&&!C){let e=A.dynamicRoutes[j];if(e&&!1===e.fallback&&!H){if(E.adapterPath)return await M();throw new v.NoFallbackError}}let U=null;!F||x.isDev||C||(U="/index"===(U=q)?"/":U);let B=!0===x.isDev||!F,D=F&&!B;O&&I&&(0,i.setManifestsSingleton)({page:_,clientReferenceManifest:I,serverActionsManifest:O});let L=e.method||"GET",$=(0,s.getTracer)(),K=$.getActiveScopeSpan(),z=!!(null==N?void 0:N.isWrappedByNextServer),G=!!(0,a.getRequestMeta)(e,"minimalMode"),W=(0,a.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,E,A,G);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let Z={params:w,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!E.experimental.authInterrupts,useCacheTimeout:E.experimental.useCacheTimeout},cacheComponents:!!E.cacheComponents,validationLevel:E.experimental.instantInsights.validationLevel,isDraftMode:C,supportsDynamicResponse:B,incrementalCache:W,hmrRefreshHash:(0,a.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:E.cacheLife,staticPageGenerationTimeout:E.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>x.onRequestError(e,t,n,a,N)},sharedContext:{buildId:S,deploymentId:k}},V=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!G&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await x.handle(J,Z);e.fetchMetrics=Z.renderOpts.fetchMetrics;let s=Z.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let i=Z.renderOpts.collectedTags;if(!F)return await (0,p.sendResponse)(V,X,a,s),null;{let e=await a.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(a.headers);i&&(t[m.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==Z.renderOpts.collectedRevalidate&&!(Z.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&Z.renderOpts.collectedRevalidate,n=void 0===Z.renderOpts.collectedExpire||Z.renderOpts.collectedExpire>=m.INFINITE_CACHE?!1!==r&&r>0?E.expireTime:void 0:Z.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:_,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,N),t}},Y=async(a,i)=>{try{var o,l;let a=await x.handleResponse({req:e,nextConfig:E,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:Q,waitUntil:n.waitUntil,isMinimalMode:G});if(!F)return;if((null==a||null==(o=a.value)?void 0:o.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==a||null==(l=a.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",T?"REVALIDATED":a.isMiss?"MISS":a.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,h.fromNodeOutgoingHttpHeaders)(a.value.headers);G&&F||s.delete(m.NEXT_CACHE_TAGS_HEADER),!a.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,f.getCacheControlHeader)(a.cacheControl)),await (0,p.sendResponse)(V,X,new Response(a.value.body,{headers:s,status:a.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,N),F)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!a)return;let e=t.statusCode;a.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(a.setStatus({code:s.SpanStatusCode.ERROR}),a.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||j,o=`${L} ${n}`;a.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),a.updateName(o),i&&i!==a&&(i.setAttribute("http.route",n),i.updateName(o))})()}};if(z&&K)await Y(K,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${_}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Y(e,t)),void 0,!z)}}e.s(["handler",0,k,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:_,workUnitAsyncStorage:y})},"routeModule",0,x,"serverHooks",0,S,"workAsyncStorage",0,_,"workUnitAsyncStorage",0,y])},10860,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(52036);function a(e){if(!/^[A-Za-z0-9_-]+$/.test(e))return null;let a=(0,n.skillsRootPath)(),s=r.default.resolve(a,e,"SKILL.md");if(!s.startsWith(a+r.default.sep))return null;try{let e=t.default.readFileSync(s,"utf8");return e.trim()?e:null}catch{return null}}function s(e){return/^[A-Za-z0-9_-]+$/.test(e)}function i(e){if(!e)return null;let t=a(e);if(!t)return null;let r=t.match(/ends with the exact token\s+(\S+)/i);return r?r[1]:null}function o(e){return s(e)?`skills/${e}/SKILL.md`:null}e.s(["applySkillEndToken",0,function(e,t){let r=i(e);return r?t?t.trimEnd().endsWith(r)?t:t+"\n"+r:r:t},"isSupportedSkillName",0,s,"localSkillForBot",0,a,"readSkillState",0,function(e){let t=o(e);if(!t)return{path:null,present:!1,content:null,status:"unsupported"};let r=a(e);return null===r?{path:t,present:!1,content:null,status:"absent"}:{path:t,present:!0,content:r,status:"present"}},"skillEndToken",0,i,"writeSkillForBot",0,function(e,a){let s=o(e);if(!s)throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");let i=(0,n.skillsRootPath)(),l=r.default.resolve(i,e,"SKILL.md");if(!l.startsWith(i+r.default.sep))throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");if(!a.trim()){try{t.default.rmSync(l)}catch{}return{path:s,present:!1,content:null,status:"absent"}}return t.default.mkdirSync(r.default.dirname(l),{recursive:!0}),t.default.writeFileSync(l,a),{path:s,present:!0,content:a,status:"present"}}])},38636,(e,t,r)=>{let{createHash:n}=e.r(54799);function a(e){if(Array.isArray(e))return e.map(a);if(null!==e&&"object"==typeof e){let t={};for(let r of Object.keys(e).sort())t[r]=a(e[r]);return t}return e}function s(e){return JSON.stringify(a(e))}function i(e){return null==e?null:String(e)}function o(e){return null==e?null:String(e).trim()||null}t.exports={sortKeysDeep:a,canonicalJson:s,hashSnapshot:function(e){return n("sha256").update(s(e),"utf8").digest("hex")},buildSnapshotInput:function(e,t,r=null){let n=o(e.agent)||"hermes",a=o(e.deck_id);return{agent:n,avatar_accessory:i(e.avatar_accessory),avatar_color:i(e.avatar_color),avatar_eyes:i(e.avatar_eyes),avatar_hands:i(e.avatar_hands),deck_id:a,deck_name:o(e.deck_name),description:null===e.description||void 0===e.description?"":String(e.description),import_operation_id:i(e.import_operation_id),import_schema_version:i(e.import_schema_version),memories:null==r?null:r.map(e=>String(e)),name:String(e.name),needs_deck_selection:null===a||function(e){if(!0===e||1===e)return!0;if("string"==typeof e){let t=e.trim().toLowerCase();return"1"===t||"true"===t}return!1}(e.needs_deck_selection),skill_content:i(t.content),skill_path:i(t.path),skill_present:null===t.present||void 0===t.present?null:!!t.present,source_provider:i(e.source_provider),template_id:i(e.template_id),template_url:i(e.template_url),title:null===e.title||void 0===e.title?"":String(e.title),working_directory:o(e.working_directory)}}}}];
1
+ module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},88831,e=>{"use strict";var t=e.i(89171),r=e.i(62294),n=e.i(10860),a=e.i(38636);function s(e){let t=r.bots.getById(e);if(!t)return null;let s=(0,n.readSkillState)(t.name);return{bot:t,skill:s,currentHash:(0,a.hashSnapshot)((0,a.buildSnapshotInput)(t,s,r.memories.latestFacts(t.id)))}}async function i(e,{params:a}){try{let{id:i}=await a,o=r.bots.getById(i);if(!o)return t.NextResponse.json({error:"Bot not found"},{status:404});let l=await e.json(),u=void 0===l.content||null===l.content?"":String(l.content);try{(0,n.writeSkillForBot)(o.name,u)}catch(e){return t.NextResponse.json({error:e instanceof Error?e.message:"Failed to save skill"},{status:400})}return t.NextResponse.json(s(i))}catch(e){return console.error("Error saving skill:",e),t.NextResponse.json({error:"Failed to save skill"},{status:500})}}async function o(e,{params:a}){try{let{id:e}=await a,i=r.bots.getById(e);if(!i)return t.NextResponse.json({error:"Bot not found"},{status:404});try{(0,n.writeSkillForBot)(i.name,"")}catch(e){return t.NextResponse.json({error:e instanceof Error?e.message:"Failed to delete skill"},{status:400})}return t.NextResponse.json(s(e))}catch(e){return console.error("Error deleting skill:",e),t.NextResponse.json({error:"Failed to delete skill"},{status:500})}}e.s(["DELETE",0,o,"PUT",0,i])},15418,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),m=e.i(10372),v=e.i(93695),R=e.i(9580);e.i(52474);var g=e.i(220);let x=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/[id]/skill/route",pathname:"/api/bots/[id]/skill",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/skill/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(88831),...{}}),{workAsyncStorage:S,workUnitAsyncStorage:_,serverHooks:y}=x;async function w(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),x.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let S="/api/bots/[id]/skill/route";S=S.replace(/\/index$/,"")||"/";let _=await x.prepare(e,t,{srcPage:S,multiZoneDraftMode:!1});if(!_)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,deploymentId:w,params:E,nextConfig:k,parsedUrl:b,isDraftMode:C,prerenderManifest:A,routerServerContext:N,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,resolvedPathname:q,clientReferenceManifest:I,serverActionsManifest:O}=_,j=(0,o.normalizeAppPath)(S),H=!!A.routes[q]&&(x.isDev||(0,R.isRouteCacheOwner)(q,x.cacheOwner,A.routes[q])),F=!!(A.dynamicRoutes[j]||H),M=async()=>((null==N?void 0:N.render404)?await N.render404(e,t,b,!1):t.end("This page could not be found"),null);if(F&&!C){let e=A.dynamicRoutes[j];if(e&&!1===e.fallback&&!H){if(k.adapterPath)return await M();throw new v.NoFallbackError}}let U=null;!F||x.isDev||C||(U="/index"===(U=q)?"/":U);let B=!0===x.isDev||!F,D=F&&!B;O&&I&&(0,i.setManifestsSingleton)({page:S,clientReferenceManifest:I,serverActionsManifest:O});let L=e.method||"GET",$=(0,s.getTracer)(),K=$.getActiveScopeSpan(),z=!!(null==N?void 0:N.isWrappedByNextServer),G=!!(0,a.getRequestMeta)(e,"minimalMode"),W=(0,a.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,k,A,G);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let Z={params:E,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!k.experimental.authInterrupts,useCacheTimeout:k.experimental.useCacheTimeout},cacheComponents:!!k.cacheComponents,validationLevel:k.experimental.instantInsights.validationLevel,isDraftMode:C,supportsDynamicResponse:B,incrementalCache:W,hmrRefreshHash:(0,a.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:k.cacheLife,staticPageGenerationTimeout:k.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>x.onRequestError(e,t,n,a,N)},sharedContext:{buildId:y,deploymentId:w}},V=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!G&&T&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await x.handle(J,Z);e.fetchMetrics=Z.renderOpts.fetchMetrics;let s=Z.renderOpts.pendingWaitUntil;s&&n.waitUntil&&(n.waitUntil(s),s=void 0);let i=Z.renderOpts.collectedTags;if(!F)return await (0,p.sendResponse)(V,X,a,s),null;{let e=await a.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(a.headers);i&&(t[m.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==Z.renderOpts.collectedRevalidate&&!(Z.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&Z.renderOpts.collectedRevalidate,n=void 0===Z.renderOpts.collectedExpire||Z.renderOpts.collectedExpire>=m.INFINITE_CACHE?!1!==r&&r>0?k.expireTime:void 0:Z.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await x.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,N),t}},Y=async(a,i)=>{try{var o,l;let a=await x.handleResponse({req:e,nextConfig:k,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:T,revalidateOnlyGenerated:P,responseGenerator:Q,waitUntil:n.waitUntil,isMinimalMode:G});if(!F)return;if((null==a||null==(o=a.value)?void 0:o.kind)!==g.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==a||null==(l=a.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",T?"REVALIDATED":a.isMiss?"MISS":a.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,h.fromNodeOutgoingHttpHeaders)(a.value.headers);G&&F||s.delete(m.NEXT_CACHE_TAGS_HEADER),!a.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,f.getCacheControlHeader)(a.cacheControl)),await (0,p.sendResponse)(V,X,new Response(a.value.body,{headers:s,status:a.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:j,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:D,isOnDemandRevalidate:T})},!1,N),F)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!a)return;let e=t.statusCode;a.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(a.setStatus({code:s.SpanStatusCode.ERROR}),a.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||j,o=`${L} ${n}`;a.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),a.updateName(o),i&&i!==a&&(i.setAttribute("http.route",n),i.updateName(o))})()}};if(z&&K)await Y(K,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${S}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Y(e,t)),void 0,!z)}}e.s(["handler",0,w,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:_})},"routeModule",0,x,"serverHooks",0,y,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,_])},10860,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(52036);function a(e){if(!/^[A-Za-z0-9_-]+$/.test(e))return null;let a=(0,n.skillsRootPath)(),s=r.default.resolve(a,e,"SKILL.md");if(!s.startsWith(a+r.default.sep))return null;try{let e=t.default.readFileSync(s,"utf8");return e.trim()?e:null}catch{return null}}function s(e){return/^[A-Za-z0-9_-]+$/.test(e)}function i(e){if(!e)return null;let t=a(e);if(!t)return null;let r=t.match(/ends with the exact token\s+(\S+)/i);return r?r[1]:null}function o(e){return s(e)?`skills/${e}/SKILL.md`:null}e.s(["applySkillEndToken",0,function(e,t){let r=i(e);return r?t?t.trimEnd().endsWith(r)?t:t+"\n"+r:r:t},"isSupportedSkillName",0,s,"localSkillForBot",0,a,"readSkillState",0,function(e){let t=o(e);if(!t)return{path:null,present:!1,content:null,status:"unsupported"};let r=a(e);return null===r?{path:t,present:!1,content:null,status:"absent"}:{path:t,present:!0,content:r,status:"present"}},"skillEndToken",0,i,"writeSkillForBot",0,function(e,a){let s=o(e);if(!s)throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");let i=(0,n.skillsRootPath)(),l=r.default.resolve(i,e,"SKILL.md");if(!l.startsWith(i+r.default.sep))throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");if(!a.trim()){try{t.default.rmSync(l)}catch{}return{path:s,present:!1,content:null,status:"absent"}}return t.default.mkdirSync(r.default.dirname(l),{recursive:!0}),t.default.writeFileSync(l,a),{path:s,present:!0,content:a,status:"present"}}])},38636,(e,t,r)=>{let{createHash:n}=e.r(54799);function a(e){if(Array.isArray(e))return e.map(a);if(null!==e&&"object"==typeof e){let t={};for(let r of Object.keys(e).sort())t[r]=a(e[r]);return t}return e}function s(e){return JSON.stringify(a(e))}function i(e){return null==e?null:String(e)}function o(e){return null==e?null:String(e).trim()||null}t.exports={sortKeysDeep:a,canonicalJson:s,hashSnapshot:function(e){return n("sha256").update(s(e),"utf8").digest("hex")},buildSnapshotInput:function(e,t,r=null){return{agent:o(e.agent)||"hermes",avatar_accessory:i(e.avatar_accessory),avatar_color:i(e.avatar_color),avatar_eyes:i(e.avatar_eyes),avatar_hands:i(e.avatar_hands),default_workspace:o(e.default_workspace),description:null===e.description||void 0===e.description?"":String(e.description),import_operation_id:i(e.import_operation_id),import_schema_version:i(e.import_schema_version),memories:null==r?null:r.map(e=>String(e)),name:String(e.name),runtime_connection_id:o(e.runtime_connection_id),skill_content:i(t.content),skill_path:i(t.path),skill_present:null===t.present||void 0===t.present?null:!!t.present,source_provider:i(e.source_provider),template_id:i(e.template_id),template_url:i(e.template_url),title:null===e.title||void 0===e.title?"":String(e.title),working_directory:o(e.working_directory)}}}}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__10b5-i-._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},24834,e=>{"use strict";var t=e.i(89171),r=e.i(62294),n=e.i(10860),a=e.i(38636);async function i(e,{params:s}){try{let{id:e}=await s,i=r.bots.getById(e);if(!i)return t.NextResponse.json({error:"Bot not found"},{status:404});let o=(0,n.readSkillState)(i.name),l=(0,a.hashSnapshot)((0,a.buildSnapshotInput)(i,o,r.memories.latestFacts(i.id))),u=r.launchSnapshots.listByBot(e).map(e=>({id:e.id,bot_id:e.bot_id,created_at:e.created_at,hash:e.hash,transport:e.transport,snapshot:JSON.parse(e.snapshot)}));return t.NextResponse.json({bot:(0,r.serializeAgent)(i),skill:o,currentHash:l,snapshots:u})}catch(e){return console.error("Error fetching bot config:",e),t.NextResponse.json({error:"Failed to fetch bot config"},{status:500})}}e.s(["GET",0,i])},30124,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),m=e.i(10372),v=e.i(93695),g=e.i(9580);e.i(52474);var R=e.i(220);let _=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/[id]/config/route",pathname:"/api/bots/[id]/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/config/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(24834),...{}}),{workAsyncStorage:S,workUnitAsyncStorage:x,serverHooks:y}=_;async function w(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),_.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let S="/api/bots/[id]/config/route";S=S.replace(/\/index$/,"")||"/";let x=await _.prepare(e,t,{srcPage:S,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,deploymentId:w,params:E,nextConfig:b,parsedUrl:k,isDraftMode:C,prerenderManifest:A,routerServerContext:T,isOnDemandRevalidate:N,revalidateOnlyGenerated:P,resolvedPathname:O,clientReferenceManifest:q,serverActionsManifest:I}=x,H=(0,o.normalizeAppPath)(S),j=!!A.routes[O]&&(_.isDev||(0,g.isRouteCacheOwner)(O,_.cacheOwner,A.routes[O])),M=!!(A.dynamicRoutes[H]||j),U=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,k,!1):t.end("This page could not be found"),null);if(M&&!C){let e=A.dynamicRoutes[H];if(e&&!1===e.fallback&&!j){if(b.adapterPath)return await U();throw new v.NoFallbackError}}let D=null;!M||_.isDev||C||(D="/index"===(D=O)?"/":D);let F=!0===_.isDev||!M,L=M&&!F;I&&q&&(0,s.setManifestsSingleton)({page:S,clientReferenceManifest:q,serverActionsManifest:I});let B=e.method||"GET",$=(0,i.getTracer)(),K=$.getActiveScopeSpan(),z=!!(null==T?void 0:T.isWrappedByNextServer),G=!!(0,a.getRequestMeta)(e,"minimalMode"),W=(0,a.getRequestMeta)(e,"incrementalCache")||await _.getIncrementalCache(e,b,A,G);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let Z={params:E,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts,useCacheTimeout:b.experimental.useCacheTimeout},cacheComponents:!!b.cacheComponents,validationLevel:b.experimental.instantInsights.validationLevel,isDraftMode:C,supportsDynamicResponse:F,incrementalCache:W,hmrRefreshHash:(0,a.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:b.cacheLife,staticPageGenerationTimeout:b.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>_.onRequestError(e,t,n,a,T)},sharedContext:{buildId:y,deploymentId:w}},V=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!G&&N&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await _.handle(J,Z);e.fetchMetrics=Z.renderOpts.fetchMetrics;let i=Z.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let s=Z.renderOpts.collectedTags;if(!M)return await (0,p.sendResponse)(V,X,a,i),null;{let e=await a.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(a.headers);s&&(t[m.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==Z.renderOpts.collectedRevalidate&&!(Z.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&Z.renderOpts.collectedRevalidate,n=void 0===Z.renderOpts.collectedExpire||Z.renderOpts.collectedExpire>=m.INFINITE_CACHE?!1!==r&&r>0?b.expireTime:void 0:Z.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await _.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:N})},!1,T),t}},Y=async(a,s)=>{try{var o,l;let a=await _.handleResponse({req:e,nextConfig:b,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:P,responseGenerator:Q,waitUntil:n.waitUntil,isMinimalMode:G});if(!M)return;if((null==a||null==(o=a.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==a||null==(l=a.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",N?"REVALIDATED":a.isMiss?"MISS":a.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(a.value.headers);G&&M||i.delete(m.NEXT_CACHE_TAGS_HEADER),!a.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,f.getCacheControlHeader)(a.cacheControl)),await (0,p.sendResponse)(V,X,new Response(a.value.body,{headers:i,status:a.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await _.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:N})},!1,T),M)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!a)return;let e=t.statusCode;a.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(a.setStatus({code:i.SpanStatusCode.ERROR}),a.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||H,o=`${B} ${n}`;a.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),a.updateName(o),s&&s!==a&&(s.setAttribute("http.route",n),s.updateName(o))})()}};if(z&&K)await Y(K,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${B} ${S}`,kind:i.SpanKind.SERVER,attributes:{"http.method":B,"http.target":e.url}},e=>Y(e,t)),void 0,!z)}}e.s(["handler",0,w,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:x})},"routeModule",0,_,"serverHooks",0,y,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,x])},10860,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(52036);function a(e){if(!/^[A-Za-z0-9_-]+$/.test(e))return null;let a=(0,n.skillsRootPath)(),i=r.default.resolve(a,e,"SKILL.md");if(!i.startsWith(a+r.default.sep))return null;try{let e=t.default.readFileSync(i,"utf8");return e.trim()?e:null}catch{return null}}function i(e){return/^[A-Za-z0-9_-]+$/.test(e)}function s(e){if(!e)return null;let t=a(e);if(!t)return null;let r=t.match(/ends with the exact token\s+(\S+)/i);return r?r[1]:null}function o(e){return i(e)?`skills/${e}/SKILL.md`:null}e.s(["applySkillEndToken",0,function(e,t){let r=s(e);return r?t?t.trimEnd().endsWith(r)?t:t+"\n"+r:r:t},"isSupportedSkillName",0,i,"localSkillForBot",0,a,"readSkillState",0,function(e){let t=o(e);if(!t)return{path:null,present:!1,content:null,status:"unsupported"};let r=a(e);return null===r?{path:t,present:!1,content:null,status:"absent"}:{path:t,present:!0,content:r,status:"present"}},"skillEndToken",0,s,"writeSkillForBot",0,function(e,a){let i=o(e);if(!i)throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");let s=(0,n.skillsRootPath)(),l=r.default.resolve(s,e,"SKILL.md");if(!l.startsWith(s+r.default.sep))throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");if(!a.trim()){try{t.default.rmSync(l)}catch{}return{path:i,present:!1,content:null,status:"absent"}}return t.default.mkdirSync(r.default.dirname(l),{recursive:!0}),t.default.writeFileSync(l,a),{path:i,present:!0,content:a,status:"present"}}])},38636,(e,t,r)=>{let{createHash:n}=e.r(54799);function a(e){if(Array.isArray(e))return e.map(a);if(null!==e&&"object"==typeof e){let t={};for(let r of Object.keys(e).sort())t[r]=a(e[r]);return t}return e}function i(e){return JSON.stringify(a(e))}function s(e){return null==e?null:String(e)}function o(e){return null==e?null:String(e).trim()||null}t.exports={sortKeysDeep:a,canonicalJson:i,hashSnapshot:function(e){return n("sha256").update(i(e),"utf8").digest("hex")},buildSnapshotInput:function(e,t,r=null){let n=o(e.agent)||"hermes",a=o(e.deck_id);return{agent:n,avatar_accessory:s(e.avatar_accessory),avatar_color:s(e.avatar_color),avatar_eyes:s(e.avatar_eyes),avatar_hands:s(e.avatar_hands),deck_id:a,deck_name:o(e.deck_name),description:null===e.description||void 0===e.description?"":String(e.description),import_operation_id:s(e.import_operation_id),import_schema_version:s(e.import_schema_version),memories:null==r?null:r.map(e=>String(e)),name:String(e.name),needs_deck_selection:null===a||function(e){if(!0===e||1===e)return!0;if("string"==typeof e){let t=e.trim().toLowerCase();return"1"===t||"true"===t}return!1}(e.needs_deck_selection),skill_content:s(t.content),skill_path:s(t.path),skill_present:null===t.present||void 0===t.present?null:!!t.present,source_provider:s(e.source_provider),template_id:s(e.template_id),template_url:s(e.template_url),title:null===e.title||void 0===e.title?"":String(e.title),working_directory:o(e.working_directory)}}}}];
1
+ module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},24834,e=>{"use strict";var t=e.i(89171),r=e.i(62294),n=e.i(10860),a=e.i(38636);async function i(e,{params:s}){try{let{id:e}=await s,i=r.bots.getById(e);if(!i)return t.NextResponse.json({error:"Bot not found"},{status:404});let o=(0,n.readSkillState)(i.name),l=(0,a.hashSnapshot)((0,a.buildSnapshotInput)(i,o,r.memories.latestFacts(i.id))),u=r.launchSnapshots.listByBot(e).map(e=>({id:e.id,bot_id:e.bot_id,created_at:e.created_at,hash:e.hash,transport:e.transport,snapshot:JSON.parse(e.snapshot)}));return t.NextResponse.json({bot:(0,r.serializeAgent)(i),skill:o,currentHash:l,snapshots:u})}catch(e){return console.error("Error fetching bot config:",e),t.NextResponse.json({error:"Failed to fetch bot config"},{status:500})}}e.s(["GET",0,i])},30124,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),a=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),f=e.i(26937),m=e.i(10372),v=e.i(93695),g=e.i(9580);e.i(52474);var R=e.i(220);let _=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/[id]/config/route",pathname:"/api/bots/[id]/config",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/[id]/config/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(24834),...{}}),{workAsyncStorage:S,workUnitAsyncStorage:x,serverHooks:y}=_;async function w(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),_.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let S="/api/bots/[id]/config/route";S=S.replace(/\/index$/,"")||"/";let x=await _.prepare(e,t,{srcPage:S,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:y,deploymentId:w,params:E,nextConfig:b,parsedUrl:C,isDraftMode:k,prerenderManifest:A,routerServerContext:T,isOnDemandRevalidate:N,revalidateOnlyGenerated:P,resolvedPathname:O,clientReferenceManifest:q,serverActionsManifest:I}=x,H=(0,o.normalizeAppPath)(S),j=!!A.routes[O]&&(_.isDev||(0,g.isRouteCacheOwner)(O,_.cacheOwner,A.routes[O])),M=!!(A.dynamicRoutes[H]||j),U=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,C,!1):t.end("This page could not be found"),null);if(M&&!k){let e=A.dynamicRoutes[H];if(e&&!1===e.fallback&&!j){if(b.adapterPath)return await U();throw new v.NoFallbackError}}let D=null;!M||_.isDev||k||(D="/index"===(D=O)?"/":D);let F=!0===_.isDev||!M,L=M&&!F;I&&q&&(0,s.setManifestsSingleton)({page:S,clientReferenceManifest:q,serverActionsManifest:I});let B=e.method||"GET",$=(0,i.getTracer)(),K=$.getActiveScopeSpan(),z=!!(null==T?void 0:T.isWrappedByNextServer),G=!!(0,a.getRequestMeta)(e,"minimalMode"),W=(0,a.getRequestMeta)(e,"incrementalCache")||await _.getIncrementalCache(e,b,A,G);null==W||W.resetRequestCache(),globalThis.__incrementalCache=W;let Z={params:E,previewProps:A.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts,useCacheTimeout:b.experimental.useCacheTimeout},cacheComponents:!!b.cacheComponents,validationLevel:b.experimental.instantInsights.validationLevel,isDraftMode:k,supportsDynamicResponse:F,incrementalCache:W,hmrRefreshHash:(0,a.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:b.cacheLife,staticPageGenerationTimeout:b.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>_.onRequestError(e,t,n,a,T)},sharedContext:{buildId:y,deploymentId:w}},V=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!G&&N&&P&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await _.handle(J,Z);e.fetchMetrics=Z.renderOpts.fetchMetrics;let i=Z.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let s=Z.renderOpts.collectedTags;if(!M)return await (0,p.sendResponse)(V,X,a,i),null;{let e=await a.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(a.headers);s&&(t[m.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==Z.renderOpts.collectedRevalidate&&!(Z.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&Z.renderOpts.collectedRevalidate,n=void 0===Z.renderOpts.collectedExpire||Z.renderOpts.collectedExpire>=m.INFINITE_CACHE?!1!==r&&r>0?b.expireTime:void 0:Z.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:a.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await _.onRequestError(e,t,{routerKind:"App Router",routePath:S,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:N})},!1,T),t}},Y=async(a,s)=>{try{var o,l;let a=await _.handleResponse({req:e,nextConfig:b,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:A,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:P,responseGenerator:Q,waitUntil:n.waitUntil,isMinimalMode:G});if(!M)return;if((null==a||null==(o=a.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==a||null==(l=a.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});G||t.setHeader("x-nextjs-cache",N?"REVALIDATED":a.isMiss?"MISS":a.isStale?"STALE":"HIT"),k&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(a.value.headers);G&&M||i.delete(m.NEXT_CACHE_TAGS_HEADER),!a.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,f.getCacheControlHeader)(a.cacheControl)),await (0,p.sendResponse)(V,X,new Response(a.value.body,{headers:i,status:a.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await _.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:N})},!1,T),M)throw t;await (0,p.sendResponse)(V,X,new Response(null,{status:500}));return}finally{(()=>{if(!a)return;let e=t.statusCode;a.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(a.setStatus({code:i.SpanStatusCode.ERROR}),a.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||H,o=`${B} ${n}`;a.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),a.updateName(o),s&&s!==a&&(s.setAttribute("http.route",n),s.updateName(o))})()}};if(z&&K)await Y(K,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${B} ${S}`,kind:i.SpanKind.SERVER,attributes:{"http.method":B,"http.target":e.url}},e=>Y(e,t)),void 0,!z)}}e.s(["handler",0,w,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:S,workUnitAsyncStorage:x})},"routeModule",0,_,"serverHooks",0,y,"workAsyncStorage",0,S,"workUnitAsyncStorage",0,x])},10860,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(52036);function a(e){if(!/^[A-Za-z0-9_-]+$/.test(e))return null;let a=(0,n.skillsRootPath)(),i=r.default.resolve(a,e,"SKILL.md");if(!i.startsWith(a+r.default.sep))return null;try{let e=t.default.readFileSync(i,"utf8");return e.trim()?e:null}catch{return null}}function i(e){return/^[A-Za-z0-9_-]+$/.test(e)}function s(e){if(!e)return null;let t=a(e);if(!t)return null;let r=t.match(/ends with the exact token\s+(\S+)/i);return r?r[1]:null}function o(e){return i(e)?`skills/${e}/SKILL.md`:null}e.s(["applySkillEndToken",0,function(e,t){let r=s(e);return r?t?t.trimEnd().endsWith(r)?t:t+"\n"+r:r:t},"isSupportedSkillName",0,i,"localSkillForBot",0,a,"readSkillState",0,function(e){let t=o(e);if(!t)return{path:null,present:!1,content:null,status:"unsupported"};let r=a(e);return null===r?{path:t,present:!1,content:null,status:"absent"}:{path:t,present:!0,content:r,status:"present"}},"skillEndToken",0,s,"writeSkillForBot",0,function(e,a){let i=o(e);if(!i)throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");let s=(0,n.skillsRootPath)(),l=r.default.resolve(s,e,"SKILL.md");if(!l.startsWith(s+r.default.sep))throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");if(!a.trim()){try{t.default.rmSync(l)}catch{}return{path:i,present:!1,content:null,status:"absent"}}return t.default.mkdirSync(r.default.dirname(l),{recursive:!0}),t.default.writeFileSync(l,a),{path:i,present:!0,content:a,status:"present"}}])},38636,(e,t,r)=>{let{createHash:n}=e.r(54799);function a(e){if(Array.isArray(e))return e.map(a);if(null!==e&&"object"==typeof e){let t={};for(let r of Object.keys(e).sort())t[r]=a(e[r]);return t}return e}function i(e){return JSON.stringify(a(e))}function s(e){return null==e?null:String(e)}function o(e){return null==e?null:String(e).trim()||null}t.exports={sortKeysDeep:a,canonicalJson:i,hashSnapshot:function(e){return n("sha256").update(i(e),"utf8").digest("hex")},buildSnapshotInput:function(e,t,r=null){return{agent:o(e.agent)||"hermes",avatar_accessory:s(e.avatar_accessory),avatar_color:s(e.avatar_color),avatar_eyes:s(e.avatar_eyes),avatar_hands:s(e.avatar_hands),default_workspace:o(e.default_workspace),description:null===e.description||void 0===e.description?"":String(e.description),import_operation_id:s(e.import_operation_id),import_schema_version:s(e.import_schema_version),memories:null==r?null:r.map(e=>String(e)),name:String(e.name),runtime_connection_id:o(e.runtime_connection_id),skill_content:s(t.content),skill_path:s(t.path),skill_present:null===t.present||void 0===t.present?null:!!t.present,source_provider:s(e.source_provider),template_id:s(e.template_id),template_url:s(e.template_url),title:null===e.title||void 0===e.title?"":String(e.title),working_directory:o(e.working_directory)}}}}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__17xl_55._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},20635,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(e,t,r)=>{t.exports=e.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},51749,e=>{"use strict";var t=e.i(54799),r=e.i(22734),s=e.i(14747),o=e.i(52036);let a="/v1/chat/completions";class n extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function i(e,t){return`${t.sessionPrefix}${e}`}function l(e,t){return new n("aborted","Hermes request aborted")}async function c(e){var t;let r,s,{config:o,profilePath:a,sessionId:i,messages:c,signal:u}=e,m=e.fetchImpl||((e,t)=>fetch(e,t)),d=(t=o.baseUrl,r=t.replace(/\/+$/,""),s=a.startsWith("/")?a:`/${a}`,`${r}${s}`),p=new AbortController,h=!1,f=setTimeout(()=>{h=!0,p.abort()},o.timeoutMs);f.unref&&f.unref();let E=()=>p.abort();if(u){if(u.aborted)throw clearTimeout(f),l(u,o.timeoutMs);u.addEventListener("abort",E,{once:!0})}try{let e,t;try{e=await m(d,{method:"POST",headers:{Authorization:`Bearer ${o.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":i},body:JSON.stringify({model:o.model,stream:!1,messages:c}),signal:p.signal})}catch(e){if(h)throw new n("timeout",`Hermes request timed out after ${o.timeoutMs} ms`);if(p.signal.aborted)throw l(u??p.signal,o.timeoutMs);throw new n("network",`Hermes request failed: ${String(e)}`)}let r="";try{r=await e.text()}catch{r=""}if(!e.ok){let t=`Hermes turn failed with status ${e.status}`;try{let e=JSON.parse(r);e?.error?.message&&(t=e.error.message)}catch{let e=r.trim().slice(0,120);e&&(t=`${t}: ${e}`)}throw new n("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new n("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(f),u&&u.removeEventListener("abort",E)}}e.s(["HERMES_DEFAULT_CHAT_PATH",0,a,"HermesError",0,n,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,o.waitLogPath)(e)}();r.default.mkdirSync(s.default.dirname(t),{recursive:!0}),r.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,c,"hermesFreshSessionIdForBot",0,function(e,r){return`${i(e,r)}-x-${(0,t.randomUUID)()}`},"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return a;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${a}`:a},"hermesSessionIdForBot",0,i,"loadHermesConfig",0,function(e=process.env){var t;let r,s=(e.HERMES_API_SERVER_KEY||"").trim();if(!s)return null;let o=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",a=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",n=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:o.replace(/\/+$/,""),apiKey:s,timeoutMs:(r=Number(t=e.HERMES_TIMEOUT_MS),void 0!==t&&""!==t&&Number.isFinite(r)&&r>0?Math.floor(r):24e4),sessionPrefix:a,model:n}}])}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1j8fg_n._.js.map
@@ -0,0 +1,44 @@
1
+ module.exports=[85148,(e,t,r)=>{t.exports=e.x("better-sqlite3-90e2652d1716b047",()=>require("better-sqlite3-90e2652d1716b047"))},33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},51749,e=>{"use strict";var t=e.i(54799),r=e.i(22734),s=e.i(14747),n=e.i(52036);let i="/v1/chat/completions";class a extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function o(e,t){return`${t.sessionPrefix}${e}`}function l(e,t){return new a("aborted","Hermes request aborted")}async function u(e){var t;let r,s,{config:n,profilePath:i,sessionId:o,messages:u,signal:d}=e,c=e.fetchImpl||((e,t)=>fetch(e,t)),_=(t=n.baseUrl,r=t.replace(/\/+$/,""),s=i.startsWith("/")?i:`/${i}`,`${r}${s}`),p=new AbortController,f=!1,g=setTimeout(()=>{f=!0,p.abort()},n.timeoutMs);g.unref&&g.unref();let m=()=>p.abort();if(d){if(d.aborted)throw clearTimeout(g),l(d,n.timeoutMs);d.addEventListener("abort",m,{once:!0})}try{let e,t;try{e=await c(_,{method:"POST",headers:{Authorization:`Bearer ${n.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":o},body:JSON.stringify({model:n.model,stream:!1,messages:u}),signal:p.signal})}catch(e){if(f)throw new a("timeout",`Hermes request timed out after ${n.timeoutMs} ms`);if(p.signal.aborted)throw l(d??p.signal,n.timeoutMs);throw new a("network",`Hermes request failed: ${String(e)}`)}let r="";try{r=await e.text()}catch{r=""}if(!e.ok){let t=`Hermes turn failed with status ${e.status}`;try{let e=JSON.parse(r);e?.error?.message&&(t=e.error.message)}catch{let e=r.trim().slice(0,120);e&&(t=`${t}: ${e}`)}throw new a("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new a("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(g),d&&d.removeEventListener("abort",m)}}e.s(["HERMES_DEFAULT_CHAT_PATH",0,i,"HermesError",0,a,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,n.waitLogPath)(e)}();r.default.mkdirSync(s.default.dirname(t),{recursive:!0}),r.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,u,"hermesFreshSessionIdForBot",0,function(e,r){return`${o(e,r)}-x-${(0,t.randomUUID)()}`},"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return i;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${i}`:i},"hermesSessionIdForBot",0,o,"loadHermesConfig",0,function(e=process.env){var t;let r,s=(e.HERMES_API_SERVER_KEY||"").trim();if(!s)return null;let n=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",i=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",a=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:n.replace(/\/+$/,""),apiKey:s,timeoutMs:(r=Number(t=e.HERMES_TIMEOUT_MS),void 0!==t&&""!==t&&Number.isFinite(r)&&r>0?Math.floor(r):24e4),sessionPrefix:i,model:a}}])},91253,26571,e=>{"use strict";var t=e.i(22734),r=e.i(14747),s=e.i(54799),n=e.i(62294),i=e.i(52036);let a="BOTMANCERS_SERVICE_TOKENS",o=["botmancers-exchanges","botmancers-engine","botmancers-session-share","botmancers-session-context"],l=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,u=/^sha256:([0-9a-f]{64})$/;class d extends Error{constructor(e){super(e),this.name="ServiceTokenConfigError"}}function c(e){if(!e||!e.trim())return[];let t=[],r=new Set;for(let s of e.split(/[,\s]+/).filter(Boolean)){let e=s.indexOf("="),n=e>0?s.slice(0,e):"",i=u.exec(e>0?s.slice(e+1).toLowerCase():"");if(!l.test(n)||!i)throw new d(`${a} entries must be <service-id>=sha256:<64 hex digits>.`);if(r.has(n))throw new d(`${a} lists service ${n} twice.`);if(o.includes(n))throw new d(`${a} names the reserved engine principal ${n}.`);r.add(n),t.push({serviceId:n,digest:Buffer.from(i[1],"hex")})}return t}e.s(["RESERVED_SERVICE_IDS",0,o,"SERVICE_TOKENS_ENV",0,a,"ServiceTokenConfigError",0,d,"parseServiceTokens",0,c,"serviceTokenAuthenticatorFromEnv",0,function(e=process.env){let t=c(e[a]);return t.length?e=>{let r,n,i=(n=(r=e.headers.get("authorization"))?/^Bearer[ \t]+(\S+)[ \t]*$/i.exec(r):null)?n[1]:null;if(!i||i.length>4096)return null;let a=(0,s.createHash)("sha256").update(i,"utf8").digest(),o=null;for(let e of t)(0,s.timingSafeEqual)(a,e.digest)&&null===o&&(o=e.serviceId);return o?{kind:"service",id:o}:null}:null}],26571);let _=["agents:read","sessions:read","conversations:read","sessions:message","exchanges:read","exchanges:create","sessions:start","sessions:resume","shares:create"],p=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,f=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;class g extends Error{constructor(e){super(e),this.name="ServiceGrantsError"}}function m(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function h(e,t,r){let s=Object.keys(e).find(e=>!t.includes(e));if(void 0!==s)throw new g(`${r} has an unknown field "${s}".`)}let b=null;e.s(["EXCHANGE_KEY_PREFIX",0,"exchange:","MESSAGE_KEY_PREFIX",0,"message:","SERVICE_CAPABILITIES",0,_,"loadServiceGrants",0,function(e=process.env){let l,u=function(e=process.env){let t=(e.BOTMANCERS_SERVICE_GRANTS_PATH||"").trim();if(t)return r.default.resolve(t);let s=(0,i.botmancersHome)(e);return s?r.default.join(s,"config/service-grants.json"):null}(e);if(!u)return{state:"absent",path:null};try{l=t.default.statSync(u)}catch(e){if("ENOENT"===e.code)return{state:"absent",path:u};return{state:"invalid",path:u,reason:"The document cannot be read."}}let E=(0,s.createHash)("sha256").update(e[a]??"","utf8").digest("hex"),S=new Set(n.default.prepare("SELECT id FROM bots").all().map(e=>e.id)),v=(0,s.createHash)("sha256").update([...S].sort().join("\n"),"utf8").digest("hex"),w=[u,l.ino,l.size,l.mode,l.uid,l.mtimeMs,E,v].join(":");if(b&&b.key===w)return b.state;let y=function(e,r,s,n){let i;if(!r.isFile())return{state:"invalid",path:e,reason:"The document is not a regular file."};if("function"==typeof process.getuid&&r.uid!==process.getuid())return{state:"invalid",path:e,reason:"The document must be owned by the user running Botmancers."};if((63&r.mode)!=0)return{state:"invalid",path:e,reason:"The document must not be readable or writable by group or others (chmod 600)."};if("string"==typeof s)return{state:"invalid",path:e,reason:s};if(r.size>65536)return{state:"invalid",path:e,reason:"The document exceeds 65536 bytes."};try{i=t.default.readFileSync(e,"utf8")}catch{return{state:"invalid",path:e,reason:"The document cannot be read."}}try{return{state:"loaded",path:e,grants:function(e,t,r){let s;try{s=JSON.parse(e)}catch{throw new g("The document is not valid JSON.")}if(!m(s))throw new g("The document must be a JSON object.");if(h(s,["version","grants"],"The document"),1!==s.version)throw new g("version must be 1.");if(!Array.isArray(s.grants))throw new g("grants must be a list.");if(s.grants.length>512)throw new g("grants has more than 512 entries.");let n=new Map;return s.grants.forEach((e,s)=>{let i=`grants[${s}]`;if(!m(e))throw new g(`${i} must be an object.`);h(e,["service","agent","capabilities"],i);let{service:l,agent:u,capabilities:d}=e;if("string"!=typeof l||!p.test(l))throw new g(`${i}.service must be a configured service id (letters, digits, ".", "_", "-").`);if(o.includes(l))throw new g(`${i}.service names a reserved engine principal.`);if(t&&!t.has(l))throw new g(`${i}.service is not a configured service principal (${a}).`);if("string"!=typeof u||!f.test(u))throw new g(`${i}.agent must be one Agent id; wildcards are not allowed.`);if(r&&!r.has(u))throw new g(`${i}.agent is not a registered Agent.`);if(!Array.isArray(d)||0===d.length)throw new g(`${i}.capabilities must list at least one capability.`);let c=new Set;for(let e of d){if(!("string"==typeof e&&_.includes(e)))throw new g(`${i}.capabilities has an unknown capability.`);if(c.has(e))throw new g(`${i}.capabilities lists ${e} twice.`);c.add(e)}let b=n.get(l)??new Map;if(b.has(u))throw new g(`${i} repeats the grant of service ${l} for that Agent.`);b.set(u,c),n.set(l,b)}),n}(i,s,n)}}catch(t){if(t instanceof g)return{state:"invalid",path:e,reason:t.message};throw t}}(u,l,function(e){try{return new Set(c(e[a]).map(e=>e.serviceId))}catch(e){if(e instanceof d)return`${a} is malformed, so no grant can name a configured service.`;throw e}}(e),S);return b={key:w,state:y},y}],91253)},90027,46309,e=>{"use strict";var t=e.i(54799),r=e.i(62349),s=e.i(28420);function n(e,t){return t.at-e.at||t.tie-e.tie||(e.id<t.id?-1:+(e.id>t.id))}function i(e,t){return Buffer.from(JSON.stringify({s:e,a:t.at,t:t.tie,i:t.id}),"utf8").toString("base64url")}class a extends Error{constructor(){super("cursor is not a cursor of this list."),this.name="InvalidPageCursorError"}}function o(e,t){let r;if(null===t||""===t)return null;if(t.length>1024)throw new a;try{r=JSON.parse(Buffer.from(t,"base64url").toString("utf8"))}catch{throw new a}if(!r||r.s!==e||"number"!=typeof r.a||"number"!=typeof r.t||"string"!=typeof r.i)throw new a;return{at:r.a,tie:r.t,id:r.i}}function l(e,t,r,s,a){let l=o(e,s),u=[...t].sort((e,t)=>n(r(e),r(t))),d=l?u.filter(e=>n(r(e),l)>0):u,c=d.slice(0,a),_=d.length>a?i(e,r(c[c.length-1])):null;return{items:c,next_cursor:_}}e.s(["InvalidPageCursorError",0,a,"decodePageCursor",0,o,"encodePageCursor",0,i,"paginateRows",0,l],46309);let u=["active","ended","all"];function d(e){return"string"==typeof e&&u.includes(e)}let c=["implementation","revision"],_=`
2
+ SELECT b.*, bot.name AS agent_name, bot.agent AS agent_runtime, r.id AS origin_request_id, c.id AS origin_conversation_id,
3
+ c.type AS conversation_type, c.bot_id AS conversation_bot_id, tb.name AS thread_agent_name, g.name AS group_name,
4
+ r.intent AS request_intent, r.execution_kind AS request_kind, r.state AS request_state,
5
+ r.source_conversation_id AS request_conversation_id, r.target_agent_id AS request_target_agent_id,
6
+ sa.launch_snapshot AS source_snapshot, sa.finished_at AS source_finished_at,
7
+ (SELECT MAX(COALESCE(ra.finished_at, ra.started_at)) FROM work_attempts ra WHERE ra.resumed_session_binding_id = b.id) AS resumed_last_at,
8
+ EXISTS (SELECT 1 FROM work_attempts oa WHERE oa.resumed_session_binding_id = b.id AND oa.finished_at IS NULL) AS attempt_running,
9
+ ps.availability AS ps_availability, ps.lifecycle AS ps_lifecycle, ps.resumable AS ps_resumable, ps.busy AS ps_busy,
10
+ ps.workspace AS ps_workspace, ps.last_synced_at AS ps_synced_at,
11
+ EXISTS (SELECT 1 FROM provider_session_turns pt WHERE pt.session_ref = ps.id AND pt.state = 'running') AS ps_running
12
+ FROM session_bindings b
13
+ JOIN bots bot ON bot.id = b.agent_id
14
+ LEFT JOIN provider_sessions ps ON ps.binding_id = b.id
15
+ LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
16
+ LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
17
+ LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
18
+ LEFT JOIN bots tb ON tb.id = c.bot_id
19
+ LEFT JOIN groups g ON g.id = c.group_id
20
+ `,p=`
21
+ SELECT ps.id, ps.agent_id, bot.name AS agent_name, ps.provider_kind, ps.title, ps.workspace,
22
+ ps.provider_created_at, ps.provider_updated_at, ps.availability, ps.lifecycle, ps.resumable, ps.busy,
23
+ ps.last_synced_at, ps.created_at, ps.updated_at,
24
+ (SELECT MAX(COALESCE(t.finished_at, t.created_at)) FROM provider_session_turns t WHERE t.session_ref = ps.id) AS turn_last_at,
25
+ EXISTS (SELECT 1 FROM provider_session_turns t WHERE t.session_ref = ps.id AND t.state = 'running') AS running
26
+ FROM provider_sessions ps
27
+ JOIN bots bot ON bot.id = ps.agent_id
28
+ WHERE ps.binding_id IS NULL
29
+ `;function f(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function g(e,t){let r=e?.[t];return"string"==typeof r&&r.trim().length>0?r:null}function m(e){let t=e.origin_conversation_id;return t?"group"===e.conversation_type?{id:t,kind:"group",label:e.group_name?`Group ${e.group_name}`:"Group thread",thread_agent_id:null}:"bot"===e.conversation_type&&e.conversation_bot_id?{id:t,kind:"direct",label:e.thread_agent_name?`${e.thread_agent_name} thread`:"Agent thread",thread_agent_id:e.thread_agent_name?e.conversation_bot_id:null}:{id:t,kind:"agent_api",label:"Agent API conversation",thread_agent_id:null}:null}function h(e,t=(0,s.emptyUsage)()){let n,i=null;try{i=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let a=m(e),o=null===e.released_at?"active":"ended",l=((n=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?n.length>80?`${n.slice(0,79).trimEnd()}…`:n:null)??(a?.kind==="group"?a.label:null)??`${e.agent_name} \xb7 ${f(e.created_at)}`;return{ref:e.id,source:"botmancers",agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:g(i,"transport")},title:l,status:o,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&c.includes(e.request_kind)&&e.request_target_agent_id===e.agent_id&&(e.conversation_id??"")===(e.request_conversation_id??"")&&e.adapter===(0,r.resolveAgent)({agent:e.agent_runtime}).agent,state:{availability:e.ps_availability??"available",lifecycle:e.ps_lifecycle??"open",resumable:null===e.ps_resumable||void 0===e.ps_resumable?null:1===e.ps_resumable,busy:1===e.ps_busy||!!e.attempt_running||!!e.ps_running,synced_at:e.ps_synced_at??null},created_at:e.created_at,ended_at:e.released_at,last_activity_at:Math.max(e.created_at,e.released_at??0,e.source_finished_at??0,e.resumed_last_at??0),origin:{conversation:a,work_request:e.origin_request_id&&e.request_kind&&e.request_state?{id:e.origin_request_id,execution_kind:e.request_kind,state:e.request_state}:null},context:{workspace:g(i,"cwd")??e.ps_workspace??null},usage:t}}function b(e,t=(0,s.emptyUsage)()){var r;let n=e.provider_created_at??e.created_at,i=null===e.resumable?null:1===e.resumable,a="archived"===e.lifecycle?e.provider_updated_at??e.updated_at:null,o=(e.title??"").trim().length>0?e.title:null,l=(r=e.workspace)?r.split("/").filter(e=>e.length>0).pop()??null:null;return{ref:e.id,source:"native",agent:{id:e.agent_id,name:e.agent_name,adapter:e.provider_kind,transport:null},title:o??(l?`${l} \xb7 ${f(n)}`:`${e.agent_name} \xb7 ${f(n)}`),status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:i,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:n,ended_at:a,last_activity_at:Math.max(n,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace},usage:t}}function E(e,t){return t.last_activity_at-e.last_activity_at||t.created_at-e.created_at||(e.ref<t.ref?-1:+(e.ref>t.ref))}function S(e,t,r="all"){let n=e.prepare(`${_} WHERE b.agent_id = ? ${"active"===r?"AND b.released_at IS NULL":"ended"===r?"AND b.released_at IS NOT NULL":""}`).all(t),i=e.prepare(`${p} AND ps.agent_id = ? ${"active"===r?"AND ps.lifecycle = 'open'":"ended"===r?"AND ps.lifecycle = 'archived'":""}`).all(t),a=(0,s.agentSessionUsage)(e,t);return[...n.map(e=>h(e,a.get(e.id))),...i.map(e=>b(e,a.get(e.id)))].sort(E)}let v=Object.freeze({default:50,max:200});function w(e,t,r){return e.prepare(`${p} AND ps.id = ? AND ps.agent_id = ?`).get(r,t)}function y(e,t,r){return e.prepare(`${_} WHERE b.id = ? AND b.agent_id = ?`).get(r,t)}e.s(["agentExists",0,function(e,t){return!!e.prepare("SELECT 1 FROM bots WHERE id = ?").get(t)},"conversationRef",0,function(e,t){let r=e.prepare(`
30
+ SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
31
+ tb.name AS thread_agent_name, g.name AS group_name
32
+ FROM conversations c
33
+ LEFT JOIN bots tb ON tb.id = c.bot_id
34
+ LEFT JOIN groups g ON g.id = c.group_id
35
+ WHERE c.id = ?
36
+ `).get(t);return r?m(r):null},"getAgentSession",0,function(e,t,r){let n=y(e,t,r);if(!n){let n=w(e,t,r);if(!n)return;let{usage:i,samples:a}=(0,s.sessionUsageSamples)(e,t,r);return{...b(n,i),attempts:[],usage_samples:a}}let i=e.prepare(`
37
+ SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
38
+ CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
39
+ FROM work_attempts a
40
+ WHERE a.id = ? OR a.resumed_session_binding_id = ?
41
+ ORDER BY a.started_at ASC, a.id ASC
42
+ `).all(n.source_attempt_id,n.source_attempt_id,n.id),{usage:a,samples:o}=(0,s.sessionUsageSamples)(e,t,r);return{...h(n,a),attempts:i,usage_samples:o}},"isSessionFilter",0,d,"listAgentSessionPage",0,function(e,r,s={}){let n=s.status??"all";if(!d(n))throw Error("status must be active, ended, or all.");let i=s.limit??v.default;if(!Number.isInteger(i)||i<1)throw Error("limit must be a positive integer.");let a=(s.q??"").trim().toLowerCase(),o=s.workspace??"",u=S(e,r,n).filter(e=>(""===a||e.title.toLowerCase().includes(a))&&(""===o||e.context.workspace===o)),c=l(`owner-sessions:${r}:${n}:${(0,t.createHash)("sha256").update(JSON.stringify([a,o])).digest("hex")}`,u,e=>({at:e.last_activity_at,tie:e.created_at,id:e.ref}),s.cursor??null,i);return{sessions:c.items,next_cursor:c.next_cursor}},"listAgentSessions",0,S,"parseSessionListLimit",0,function(e){if(null===e||""===e)return v.default;if(!/^\d+$/.test(e)||1>Number(e))throw Error("limit must be a positive integer.");return Math.min(Number(e),v.max)},"sessionDebugExternalId",0,function(e,t,r){let s=y(e,t,r)?.external_session_id;if(void 0!==s)return s;if(!w(e,t,r))return;let n=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(r,t);return n?.provider_session_id},"sessionTitle",0,function(e,t,r){let s=y(e,t,r);if(s)return h(s).title;let n=w(e,t,r);return n?b(n).title:null}],90027)}];
43
+
44
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1x8phwp._.js.map
@@ -1,3 +1,3 @@
1
- module.exports=[54799,(e,r,t)=>{r.exports=e.x("crypto",()=>require("crypto"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,r,t)=>{r.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,r,t)=>{r.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,r,t)=>{r.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},62349,16979,e=>{"use strict";let r=[{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"}],t=[{id:"dots",label:"Round dots"},{id:"sleepy",label:"Sleepy"},{id:"happy",label:"Happy arcs"},{id:"wide",label:"Wide ovals"}],n=[{id:"folded",label:"Folded arms"},{id:"reaching",label:"Reaching right"},{id:"waving",label:"Waving"}],i=[{id:"none",label:"None"},{id:"crown",label:"Crown"},{id:"glasses",label:"Glasses"},{id:"headset",label:"Headset"},{id:"hat",label:"Hat"},{id:"bow",label:"Bow"}],a={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},s={...a,accessory:"crown"};function o(e){return"chief-of-staff"===String(e??"").trim().toLowerCase()}function l(e,r){return"string"==typeof r&&e.some(e=>e.id===r)}function c(e){let c=l(r,e.avatar_color)?e.avatar_color:a.color,d=l(t,e.avatar_eyes)?e.avatar_eyes:a.eyes;return{color:c,eyes:d,hands:l(n,e.avatar_hands)?e.avatar_hands:a.hands,accessory:l(i,e.avatar_accessory)?e.avatar_accessory:o(e.name)?s.accessory:a.accessory}}e.s(["isChiefOfStaffName",0,o,"resolveAvatar",0,c,"validateAvatarInput",0,function(e){let a=[],s={};if(null==e)return{errors:a,fields:s};if("object"!=typeof e||Array.isArray(e))return{errors:["Invalid avatar: expected an object with color, eyes, hands, and accessory."],fields:s};if(void 0!==e.color)try{s.avatar_color=function(e){if(l(r,e))return e;throw Error(`Invalid avatar color: ${JSON.stringify(String(e))}. Expected one of ${r.map(e=>e.id).join("|")}.`)}(e.color)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.eyes)try{s.avatar_eyes=function(e){if(l(t,e))return e;throw Error(`Invalid avatar eyes: ${JSON.stringify(String(e))}. Expected one of ${t.map(e=>e.id).join("|")}.`)}(e.eyes)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.hands)try{s.avatar_hands=function(e){if(l(n,e))return e;throw Error(`Invalid avatar hands: ${JSON.stringify(String(e))}. Expected one of ${n.map(e=>e.id).join("|")}.`)}(e.hands)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.accessory)try{s.avatar_accessory=function(e){if(l(i,e))return e;throw Error(`Invalid avatar accessory: ${JSON.stringify(String(e))}. Expected one of ${i.map(e=>e.id).join("|")}.`)}(e.accessory)}catch(e){a.push(e instanceof Error?e.message:String(e))}return{errors:a,fields:s}}],16979);let d=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},f="hermes",_={hermes:"hermes-gateway",cursor:"agent-deck-run",claude:"agent-deck-run",codex:"agent-deck-run",muse:"agent-deck-run"};function g(e){return _[e]}class p extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${d.join("|")}.`)}}class h extends Error{code="invalid-deck";constructor(e){super(`Invalid deck ID: ${JSON.stringify("string"==typeof e?e:String(e))}. Select a deck from the configured Agent Deck server.`)}}let m="Deck ID is required. Select an Agent Deck before saving this agent.",k=`Agent is required. Expected one of ${d.join("|")}.`,y="Fields runtime/agent_client are no longer accepted. Send agent (hermes|cursor|claude|codex|muse) and deck_id instead.",v="deck_name is a read-only legacy reference. Select a deck_id from the configured Agent Deck server instead.";function x(e){if(null==e)return null;let r=String(e).trim();if(!r)return null;if(d.includes(r))return r;throw new p(e)}function b(e){return null==e?null:String(e).trim()||null}function E(e){if(null==e)return null;if("string"!=typeof e)throw new h(e);let r=e.trim();if(!r)return null;if(!function(e){if(e.length>200||/\s/.test(e))return!1;for(let r=0;r<e.length;r++){let t=e.charCodeAt(r);if(t<32||127===t)return!1}return!0}(r))throw new h(e);return r}function w(e){if(!0===e||1===e)return!0;if("string"==typeof e){let r=e.trim().toLowerCase();return"1"===r||"true"===r}return!1}function S(e){let r,t=f,n=!0;try{t=x(e.agent)??f}catch{n=!1}let i=b(e.deck_id),a=b(e.deck_name),s=b(e.working_directory);if("launch_profile"in e){let t=e.launch_profile;r="direct"===t||"agent_deck"===t?t:null}else r=i?"agent_deck":null;let o="direct"!==r&&(null===i||w(e.needs_deck_selection)),l=null;return n?r?!function(e){if(!("session_scope_kind"in e))return!0;let r=e.session_scope_kind,t=[];try{t=e.session_scope_items?JSON.parse(e.session_scope_items):[]}catch{return!1}if(!Array.isArray(t))return!1;let n=t.filter(e=>"string"==typeof e&&e.trim()).length;return"all_provider_sessions"===r?0===n:("workspaces"===r||"sessions"===r)&&n>0}(e)?l="session_scope":"agent_deck"===r&&o?l="deck":"direct"===r&&"hermes-gateway"!==g(t)&&(l="direct_runtime"):l="launch_profile":l="agent",{agent:t,deck_id:"direct"===r?null:i,deck_name:a,working_directory:"direct"===r?null:s,needs_deck_selection:o,launch_profile:r,needs_launch_profile:null===r,launchable:null===l,launch_blocker:l}}let A=["codex","claude","cursor","muse"];function j(e){let r=b(e);return r&&A.includes(r)?r:null}let R=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection"];e.s(["AGENTS",0,d,"AGENT_LABELS",0,u,"DECK_REQUIRED_ERROR",0,m,"DEFAULT_AGENT",0,f,"LEGACY_DECK_NAME_FIELD_ERROR",0,v,"LEGACY_RUNTIME_FIELD_ERROR",0,y,"agentLabel",0,function(e){return d.includes(String(e))?u[e]:String(e??"")},"agentTransport",0,g,"applyAgentUpdate",0,function(e,r){let t=S(e),n=r.agent??t.agent,i=void 0!==r.working_directory?r.working_directory:t.working_directory;return void 0!==r.deck_id?{agent:n,deck_id:r.deck_id,deck_name:null,working_directory:i,needs_deck_selection:!1}:{agent:n,deck_id:t.deck_id,deck_name:t.deck_name,working_directory:i,needs_deck_selection:t.needs_deck_selection}},"buildAvailabilityPayload",0,function(e){let r=[];for(let t of d)e.includes(t)&&r.push({agent:t,label:u[t],launchable:!0});return{agents:r}},"hasAgentUpdate",0,function(e){return["agent","deck_id","working_directory","runtime","agent_client","deck_name"].some(r=>void 0!==e[r])},"migrateLegacyAgentFields",0,function(e){let r=b(e.deck_id),t=b(e.deck_name),n=b(e.working_directory);try{let a=x(e.agent);if(a){var i;return{agent:a,deck_id:r,deck_name:t,working_directory:n,needs_deck_selection:null===r||(i=e.needs_deck_selection,w(i)),migrated:!1}}}catch{}let a=b(e.runtime),s=f,o=w(e.needs_deck_reselection);if("agent-deck"===a){let r=j(e.agent_client);r?s=r:o=!0}else if("hermes"!==a){let r=j(e.coding_runtime);r&&t&&n&&(s=r,o=!0)}return{agent:s,deck_id:r,deck_name:t,working_directory:n,needs_deck_selection:null===r||o,migrated:!0}},"normalizeAgent",0,x,"parseRequestDeckId",0,E,"resolveAgent",0,S,"serializeBot",0,function(e){let r=S(e),t={...e};for(let e of R)delete t[e];return{...t,agent:r.agent,deck_id:r.deck_id,deck_name:r.deck_name,working_directory:r.working_directory,needs_deck_selection:r.needs_deck_selection,launch_profile:r.launch_profile,needs_launch_profile:r.needs_launch_profile,launchable:r.launchable,launch_blocker:r.launch_blocker,avatar_config:c(e)}},"validateUpdateAgent",0,function(e){let r=[],t={};if((void 0!==e.runtime||void 0!==e.agent_client)&&r.push(y),void 0!==e.deck_name&&r.push(v),void 0!==e.agent)try{let n=x(e.agent);n?t.agent=n:r.push(k)}catch(e){r.push(e instanceof Error?e.message:String(e))}if(void 0!==e.deck_id)try{let n=E(e.deck_id);n?t.deck_id=n:r.push(m)}catch(e){r.push(e instanceof Error?e.message:String(e))}return void 0!==e.working_directory&&(t.working_directory=b(e.working_directory)),{errors:r,fields:t}}],62349)},52036,e=>{"use strict";var r=e.i(14747);function t(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?r.default.resolve(n):null}function n(e,r){return(e[r]||"").trim()||null}e.s(["botmancersHome",0,t,"dbPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_DB_PATH");if(i)return i;let a=t(e);return a?r.default.join(a,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_FILES_ROOT");if(i)return r.default.resolve(i);let a=t(e);return a?r.default.join(a,"files"):r.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_SKILLS_ROOT");if(i)return r.default.resolve(i);let a=t(e);return a?r.default.join(a,"skills"):r.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let i=n(e,"HERMES_WAIT_LOG_PATH");if(i)return i;let a=t(e);return a?r.default.join(a,"logs/specialist-waits.jsonl"):r.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
1
+ module.exports=[54799,(e,r,t)=>{r.exports=e.x("crypto",()=>require("crypto"))},70406,(e,r,t)=>{r.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,r,t)=>{r.exports=e.x("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js",()=>require("next/dist/compiled/next-server/app-page-turbo.runtime.prod.js"))},56704,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-async-storage.external.js",()=>require("next/dist/server/app-render/work-async-storage.external.js"))},32319,(e,r,t)=>{r.exports=e.x("next/dist/server/app-render/work-unit-async-storage.external.js",()=>require("next/dist/server/app-render/work-unit-async-storage.external.js"))},59043,(e,r,t)=>{r.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,r,t)=>{r.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,r,t)=>{r.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,r,t)=>{r.exports=e.x("path",()=>require("path"))},62349,16979,e=>{"use strict";let r=[{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"}],t=[{id:"dots",label:"Round dots"},{id:"sleepy",label:"Sleepy"},{id:"happy",label:"Happy arcs"},{id:"wide",label:"Wide ovals"}],n=[{id:"folded",label:"Folded arms"},{id:"reaching",label:"Reaching right"},{id:"waving",label:"Waving"}],s=[{id:"none",label:"None"},{id:"crown",label:"Crown"},{id:"glasses",label:"Glasses"},{id:"headset",label:"Headset"},{id:"hat",label:"Hat"},{id:"bow",label:"Bow"}],a={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},i={...a,accessory:"crown"};function o(e){return"chief-of-staff"===String(e??"").trim().toLowerCase()}function l(e,r){return"string"==typeof r&&e.some(e=>e.id===r)}function c(e){let c=l(r,e.avatar_color)?e.avatar_color:a.color,d=l(t,e.avatar_eyes)?e.avatar_eyes:a.eyes;return{color:c,eyes:d,hands:l(n,e.avatar_hands)?e.avatar_hands:a.hands,accessory:l(s,e.avatar_accessory)?e.avatar_accessory:o(e.name)?i.accessory:a.accessory}}e.s(["isChiefOfStaffName",0,o,"resolveAvatar",0,c,"validateAvatarInput",0,function(e){let a=[],i={};if(null==e)return{errors:a,fields:i};if("object"!=typeof e||Array.isArray(e))return{errors:["Invalid avatar: expected an object with color, eyes, hands, and accessory."],fields:i};if(void 0!==e.color)try{i.avatar_color=function(e){if(l(r,e))return e;throw Error(`Invalid avatar color: ${JSON.stringify(String(e))}. Expected one of ${r.map(e=>e.id).join("|")}.`)}(e.color)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.eyes)try{i.avatar_eyes=function(e){if(l(t,e))return e;throw Error(`Invalid avatar eyes: ${JSON.stringify(String(e))}. Expected one of ${t.map(e=>e.id).join("|")}.`)}(e.eyes)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.hands)try{i.avatar_hands=function(e){if(l(n,e))return e;throw Error(`Invalid avatar hands: ${JSON.stringify(String(e))}. Expected one of ${n.map(e=>e.id).join("|")}.`)}(e.hands)}catch(e){a.push(e instanceof Error?e.message:String(e))}if(void 0!==e.accessory)try{i.avatar_accessory=function(e){if(l(s,e))return e;throw Error(`Invalid avatar accessory: ${JSON.stringify(String(e))}. Expected one of ${s.map(e=>e.id).join("|")}.`)}(e.accessory)}catch(e){a.push(e instanceof Error?e.message:String(e))}return{errors:a,fields:i}}],16979);let d=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},p="hermes",f={hermes:"hermes-gateway",cursor:"session-provider",claude:"session-provider",codex:"session-provider",muse:"session-provider"};class g extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${d.join("|")}.`)}}function m(e){if(null==e)return null;let r=String(e).trim();if(!r)return null;if(d.includes(r))return r;throw new g(e)}function _(e){return null==e?null:String(e).trim()||null}function h(e){let r=p,t=!0;try{r=m(e.agent)??p}catch{t=!1}let n=_(e.runtime_connection_id),s=null;return t?n?!function(e){if(!("session_scope_kind"in e))return!0;let r=e.session_scope_kind,t=[];try{t=e.session_scope_items?JSON.parse(e.session_scope_items):[]}catch{return!1}if(!Array.isArray(t))return!1;let n=t.filter(e=>"string"==typeof e&&e.trim()).length;return"all_provider_sessions"===r?0===n:("workspaces"===r||"sessions"===r)&&n>0}(e)&&(s="session_scope"):s="connection":s="agent",{agent:r,runtime_connection_id:n,launchable:null===s,launch_blocker:s}}d.join("|");let v=["codex","claude","cursor","muse"];function x(e){let r=_(e);return r&&v.includes(r)?r:null}let y=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection","deck_id","deck_name","working_directory","needs_deck_selection","launch_profile"];e.s(["AGENTS",0,d,"AGENT_LABELS",0,u,"DEFAULT_AGENT",0,p,"LEGACY_RUNTIME_FIELD_ERROR",0,"Fields runtime/agent_client are no longer accepted. Register with a runtime connection, session scope, and policy instead.","REMOVED_LAUNCH_FIELD_ERROR",0,"Fields launch_profile/deck_id/deck_name/working_directory are no longer accepted. An Agent launches direct from its runtime connection, session scope, default workspace, and policy.","agentTransport",0,function(e){return f[e]},"buildAvailabilityPayload",0,function(e){let r=[];for(let t of d)e.includes(t)&&r.push({agent:t,label:u[t],launchable:!0});return{agents:r}},"migrateLegacyAgentFields",0,function(e){try{let r=m(e.agent);if(r)return{agent:r,migrated:!1}}catch{}let r=_(e.runtime),t=p;if("agent-deck"===r)t=x(e.agent_client)??p;else if("hermes"!==r){let r=x(e.coding_runtime),n=_(e.deck_name),s=_(e.working_directory);r&&n&&s&&(t=r)}return{agent:t,migrated:!0}},"normalizeAgent",0,m,"resolveAgent",0,h,"serializeBot",0,function(e){let r=h(e),t={...e};for(let e of y)delete t[e];return{...t,agent:r.agent,runtime_connection_id:r.runtime_connection_id,launchable:r.launchable,launch_blocker:r.launch_blocker,avatar_config:c(e)}}],62349)},52036,e=>{"use strict";var r=e.i(14747);function t(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?r.default.resolve(n):null}function n(e,r){return(e[r]||"").trim()||null}e.s(["botmancersHome",0,t,"dbPath",0,function(e=process.env){let s=n(e,"BOTMANCERS_DB_PATH");if(s)return s;let a=t(e);return a?r.default.join(a,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let s=n(e,"BOTMANCERS_FILES_ROOT");if(s)return r.default.resolve(s);let a=t(e);return a?r.default.join(a,"files"):r.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let s=n(e,"BOTMANCERS_SKILLS_ROOT");if(s)return r.default.resolve(s);let a=t(e);return a?r.default.join(a,"skills"):r.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let s=n(e,"HERMES_WAIT_LOG_PATH");if(s)return s;let a=t(e);return a?r.default.join(a,"logs/specialist-waits.jsonl"):r.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__200ep0k._.js.map
@@ -45,6 +45,6 @@ module.exports=[57007,e=>{"use strict";var t=e.i(62294),a=e.i(52036);e.i(54799),
45
45
  );
46
46
  CREATE UNIQUE INDEX IF NOT EXISTS idx_slack_questions_turn ON slack_questions(share_ref, turn_ref) WHERE turn_ref IS NOT NULL;
47
47
  CREATE INDEX IF NOT EXISTS idx_slack_questions_state ON slack_questions(state, created_at);
48
- `),e.i(90440),e.i(82554);let r=Symbol.for("botmancers.slack-runtime"),n=globalThis;async function s(){let e="ok";try{t.default.prepare("SELECT 1").get()}catch{e="error"}return Response.json({status:"ok"===e?"ok":"degraded",service:"botmancers-core",version:"0.6.1",commit:"37fd03570d80dad5a36f4ce5e901641aa2dd4295",engine:e,home:(0,a.botmancersHome)(),slack:{...(!n[r]&&(n[r]={status:{state:"stopped",reason:null,since:Date.now(),connections:0},relay:null,clients:null,stop:null,starting:null}),n[r]).status}},{status:"ok"===e?200:503,headers:{"cache-control":"no-store"}})}e.s(["GET",0,s,"dynamic",0,"force-dynamic"],57007)},61370,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),T=e.i(70101),h=e.i(26937),E=e.i(10372),_=e.i(93695),N=e.i(9580);e.i(52474);var R=e.i(220);let v=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/health/route",pathname:"/api/health",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/health/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(57007),...{}}),{workAsyncStorage:m,workUnitAsyncStorage:f,serverHooks:g}=v;async function L(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),v.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/health/route";m=m.replace(/\/index$/,"")||"/";let f=await v.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:g,deploymentId:L,params:C,nextConfig:w,parsedUrl:O,isDraftMode:I,prerenderManifest:y,routerServerContext:U,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,resolvedPathname:x,clientReferenceManifest:b,serverActionsManifest:X}=f,k=(0,o.normalizeAppPath)(m),P=!!y.routes[x]&&(v.isDev||(0,N.isRouteCacheOwner)(x,v.cacheOwner,y.routes[x])),q=!!(y.dynamicRoutes[k]||P),H=async()=>((null==U?void 0:U.render404)?await U.render404(e,t,O,!1):t.end("This page could not be found"),null);if(q&&!I){let e=y.dynamicRoutes[k];if(e&&!1===e.fallback&&!P){if(w.adapterPath)return await H();throw new _.NoFallbackError}}let M=null;!q||v.isDev||I||(M="/index"===(M=x)?"/":M);let D=!0===v.isDev||!q,K=q&&!D;X&&b&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:b,serverActionsManifest:X});let F=e.method||"GET",G=(0,s.getTracer)(),j=G.getActiveScopeSpan(),B=!!(null==U?void 0:U.isWrappedByNextServer),$=!!(0,n.getRequestMeta)(e,"minimalMode"),Y=(0,n.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,w,y,$);null==Y||Y.resetRequestCache(),globalThis.__incrementalCache=Y;let Q={params:C,previewProps:y.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:I,supportsDynamicResponse:D,incrementalCache:Y,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>v.onRequestError(e,t,r,n,U)},sharedContext:{buildId:g,deploymentId:L}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),z=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:a})=>{try{if(!$&&A&&S&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await v.handle(z,Q);e.fetchMetrics=Q.renderOpts.fetchMetrics;let s=Q.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let i=Q.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(V,W,n,s),null;{let e=await n.blob(),t=(0,T.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[E.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==Q.renderOpts.collectedRevalidate&&!(Q.renderOpts.collectedRevalidate>=E.INFINITE_CACHE)&&Q.renderOpts.collectedRevalidate,r=void 0===Q.renderOpts.collectedExpire||Q.renderOpts.collectedExpire>=E.INFINITE_CACHE?!1!==a&&a>0?w.expireTime:void 0:Q.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:A})},!1,U),t}},J=async(n,i)=>{try{var o,l;let n=await v.handleResponse({req:e,nextConfig:w,cacheKey:M,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,responseGenerator:Z,waitUntil:r.waitUntil,isMinimalMode:$});if(!q)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});$||t.setHeader("x-nextjs-cache",A?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),I&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,T.fromNodeOutgoingHttpHeaders)(n.value.headers);$&&q||s.delete(E.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,h.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(V,W,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof _.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:A})},!1,U),q)throw t;await (0,p.sendResponse)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=G.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route")||k,o=`${F} ${r}`;n.setAttributes({"next.route":r,"http.route":r,"next.span_name":o}),n.updateName(o),i&&i!==n&&(i.setAttribute("http.route",r),i.updateName(o))})()}};if(B&&j)await J(j,void 0);else{let t=G.getActiveScopeSpan();await G.withPropagatedContext(e.headers,()=>G.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${m}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},e=>J(e,t)),void 0,!B)}}e.s(["handler",0,L,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:f})},"routeModule",0,v,"serverHooks",0,g,"workAsyncStorage",0,m,"workUnitAsyncStorage",0,f])}];
48
+ `),e.i(90440),e.i(82554);let r=Symbol.for("botmancers.slack-runtime"),n=globalThis;async function s(){let e="ok";try{t.default.prepare("SELECT 1").get()}catch{e="error"}return Response.json({status:"ok"===e?"ok":"degraded",service:"botmancers-core",version:"0.8.0",commit:"a2e83251202536e4873bc876544841cfc5e2f80d",engine:e,home:(0,a.botmancersHome)(),slack:{...(!n[r]&&(n[r]={status:{state:"stopped",reason:null,since:Date.now(),connections:0},relay:null,clients:null,stop:null,starting:null}),n[r]).status}},{status:"ok"===e?200:503,headers:{"cache-control":"no-store"}})}e.s(["GET",0,s,"dynamic",0,"force-dynamic"],57007)},61370,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),u=e.i(95169),c=e.i(47587),p=e.i(66012),T=e.i(70101),h=e.i(26937),E=e.i(10372),_=e.i(93695),N=e.i(9580);e.i(52474);var R=e.i(220);let v=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/health/route",pathname:"/api/health",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/health/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(57007),...{}}),{workAsyncStorage:m,workUnitAsyncStorage:f,serverHooks:g}=v;async function L(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),v.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/health/route";m=m.replace(/\/index$/,"")||"/";let f=await v.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:g,deploymentId:L,params:C,nextConfig:w,parsedUrl:O,isDraftMode:I,prerenderManifest:y,routerServerContext:U,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,resolvedPathname:x,clientReferenceManifest:b,serverActionsManifest:X}=f,k=(0,o.normalizeAppPath)(m),P=!!y.routes[x]&&(v.isDev||(0,N.isRouteCacheOwner)(x,v.cacheOwner,y.routes[x])),q=!!(y.dynamicRoutes[k]||P),H=async()=>((null==U?void 0:U.render404)?await U.render404(e,t,O,!1):t.end("This page could not be found"),null);if(q&&!I){let e=y.dynamicRoutes[k];if(e&&!1===e.fallback&&!P){if(w.adapterPath)return await H();throw new _.NoFallbackError}}let M=null;!q||v.isDev||I||(M="/index"===(M=x)?"/":M);let D=!0===v.isDev||!q,K=q&&!D;X&&b&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:b,serverActionsManifest:X});let F=e.method||"GET",G=(0,s.getTracer)(),j=G.getActiveScopeSpan(),B=!!(null==U?void 0:U.isWrappedByNextServer),$=!!(0,n.getRequestMeta)(e,"minimalMode"),Y=(0,n.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,w,y,$);null==Y||Y.resetRequestCache(),globalThis.__incrementalCache=Y;let Q={params:C,previewProps:y.preview,renderOpts:{experimental:{authInterrupts:!!w.experimental.authInterrupts,useCacheTimeout:w.experimental.useCacheTimeout},cacheComponents:!!w.cacheComponents,validationLevel:w.experimental.instantInsights.validationLevel,isDraftMode:I,supportsDynamicResponse:D,incrementalCache:Y,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:w.cacheLife,staticPageGenerationTimeout:w.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>v.onRequestError(e,t,r,n,U)},sharedContext:{buildId:g,deploymentId:L}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),z=d.NextRequestAdapter.fromNodeNextRequest(V,(0,d.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:a})=>{try{if(!$&&A&&S&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await v.handle(z,Q);e.fetchMetrics=Q.renderOpts.fetchMetrics;let s=Q.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let i=Q.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(V,W,n,s),null;{let e=await n.blob(),t=(0,T.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[E.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==Q.renderOpts.collectedRevalidate&&!(Q.renderOpts.collectedRevalidate>=E.INFINITE_CACHE)&&Q.renderOpts.collectedRevalidate,r=void 0===Q.renderOpts.collectedExpire||Q.renderOpts.collectedExpire>=E.INFINITE_CACHE?!1!==a&&a>0?w.expireTime:void 0:Q.renderOpts.collectedExpire;return{value:{kind:R.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:a,expire:r}}}}catch(t){throw(null==a?void 0:a.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:m,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:A})},!1,U),t}},J=async(n,i)=>{try{var o,l;let n=await v.handleResponse({req:e,nextConfig:w,cacheKey:M,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:y,isRoutePPREnabled:!1,isOnDemandRevalidate:A,revalidateOnlyGenerated:S,responseGenerator:Z,waitUntil:r.waitUntil,isMinimalMode:$});if(!q)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==R.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});$||t.setHeader("x-nextjs-cache",A?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),I&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,T.fromNodeOutgoingHttpHeaders)(n.value.headers);$&&q||s.delete(E.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,h.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(V,W,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof _.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:k,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:A})},!1,U),q)throw t;await (0,p.sendResponse)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=G.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==u.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${a.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let r=a.get("next.route")||k,o=`${F} ${r}`;n.setAttributes({"next.route":r,"http.route":r,"next.span_name":o}),n.updateName(o),i&&i!==n&&(i.setAttribute("http.route",r),i.updateName(o))})()}};if(B&&j)await J(j,void 0);else{let t=G.getActiveScopeSpan();await G.withPropagatedContext(e.headers,()=>G.trace(u.BaseServerSpan.handleRequest,{spanName:`${F} ${m}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},e=>J(e,t)),void 0,!B)}}e.s(["handler",0,L,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:f})},"routeModule",0,v,"serverHooks",0,g,"workAsyncStorage",0,m,"workUnitAsyncStorage",0,f])}];
49
49
 
50
50
  //# sourceMappingURL=_0061c2q._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[49091,e=>{"use strict";var t=e.i(89171),r=e.i(33405),a=e.i(62349),n=e.i(51749);let i=["codex","claude","cursor","muse"];class o extends Error{code="invalid-provider";constructor(e){super(`Invalid provider: ${JSON.stringify(String(e))}. Expected one of ${i.join("|")}.`)}}let s={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},l=function(e){let[t,...a]=e;return new Promise(e=>{(0,r.execFile)(t,a,{maxBuffer:4194304},(r,a,n)=>{r&&"ENOENT"===r.code?e({stdout:"",stderr:`Command not found: ${t}`,exitCode:127}):e({stdout:String(a??""),stderr:String(n??""),exitCode:r&&"number"==typeof r.code?r.code:+!!r})})})};async function u(e){let t=s[function(e){if("string"==typeof e&&i.includes(e))return e;throw new o(e)}(e)];try{let e=await l(t);return 0===e.exitCode}catch{return!1}}async function d(e){if("hermes-gateway"===(0,a.agentTransport)(e))try{return null!==(0,n.loadHermesConfig)()}catch{return!1}return u(e)}async function c(){let e=[];for(let t of a.AGENTS)await d(t)&&e.push(t);return e}async function p(){try{let e=await c();return t.NextResponse.json((0,a.buildAvailabilityPayload)(e))}catch(e){return console.error("Error probing agents:",e),t.NextResponse.json({error:"Failed to probe agents"},{status:500})}}e.s(["GET",0,p],49091)},26784,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),i=e.i(61916),o=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),h=e.i(70101),v=e.i(26937),R=e.i(10372),f=e.i(93695),g=e.i(9580);e.i(52474);var m=e.i(220);let E=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/availability/route",pathname:"/api/bots/availability",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/availability/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(49091),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:x,serverHooks:C}=E;async function y(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),E.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/bots/availability/route";w=w.replace(/\/index$/,"")||"/";let x=await E.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!x)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:C,deploymentId:y,params:b,nextConfig:A,parsedUrl:T,isDraftMode:S,prerenderManifest:N,routerServerContext:P,isOnDemandRevalidate:O,revalidateOnlyGenerated:_,resolvedPathname:H,clientReferenceManifest:q,serverActionsManifest:I}=x,M=(0,s.normalizeAppPath)(w),U=!!N.routes[H]&&(E.isDev||(0,g.isRouteCacheOwner)(H,E.cacheOwner,N.routes[H])),D=!!(N.dynamicRoutes[M]||U),k=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,T,!1):t.end("This page could not be found"),null);if(D&&!S){let e=N.dynamicRoutes[M];if(e&&!1===e.fallback&&!U){if(A.adapterPath)return await k();throw new f.NoFallbackError}}let j=null;!D||E.isDev||S||(j="/index"===(j=H)?"/":j);let F=!0===E.isDev||!D,$=D&&!F;I&&q&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:q,serverActionsManifest:I});let K=e.method||"GET",B=(0,i.getTracer)(),G=B.getActiveScopeSpan(),L=!!(null==P?void 0:P.isWrappedByNextServer),V=!!(0,n.getRequestMeta)(e,"minimalMode"),X=(0,n.getRequestMeta)(e,"incrementalCache")||await E.getIncrementalCache(e,A,N,V);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let W={params:b,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts,useCacheTimeout:A.experimental.useCacheTimeout},cacheComponents:!!A.cacheComponents,validationLevel:A.experimental.instantInsights.validationLevel,isDraftMode:S,supportsDynamicResponse:F,incrementalCache:X,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:A.cacheLife,staticPageGenerationTimeout:A.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>E.onRequestError(e,t,a,n,P)},sharedContext:{buildId:C,deploymentId:y}},z=new l.NodeNextRequest(e),J=new l.NodeNextResponse(t),Z=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!V&&O&&_&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await E.handle(Z,W);e.fetchMetrics=W.renderOpts.fetchMetrics;let i=W.renderOpts.pendingWaitUntil;i&&a.waitUntil&&(a.waitUntil(i),i=void 0);let o=W.renderOpts.collectedTags;if(!D)return await (0,p.sendResponse)(z,J,n,i),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);o&&(t[R.NEXT_CACHE_TAGS_HEADER]=o),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=R.INFINITE_CACHE?!1!==r&&r>0?A.expireTime:void 0:W.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await E.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:O})},!1,P),t}},Y=async(n,o)=>{try{var s,l;let n=await E.handleResponse({req:e,nextConfig:A,cacheKey:j,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:O,revalidateOnlyGenerated:_,responseGenerator:Q,waitUntil:a.waitUntil,isMinimalMode:V});if(!D)return;if((null==n||null==(s=n.value)?void 0:s.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});V||t.setHeader("x-nextjs-cache",O?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),S&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);V&&D||i.delete(R.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,v.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(z,J,new Response(n.value.body,{headers:i,status:n.value.status||200}));return}catch(t){if(t instanceof f.NoFallbackError||await E.onRequestError(e,t,{routerKind:"App Router",routePath:M,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:O})},!1,P),D)throw t;await (0,p.sendResponse)(z,J,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:i.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||M,s=`${K} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":s}),n.updateName(s),o&&o!==n&&(o.setAttribute("http.route",a),o.updateName(s))})()}};if(L&&G)await Y(G,void 0);else{let t=B.getActiveScopeSpan();await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${K} ${w}`,kind:i.SpanKind.SERVER,attributes:{"http.method":K,"http.target":e.url}},e=>Y(e,t)),void 0,!L)}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:x})},"routeModule",0,E,"serverHooks",0,C,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,x])}];
2
+
3
+ //# sourceMappingURL=_057h7zr._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[69449,e=>{"use strict";async function s(){let{runSlackInServer:s}=await e.A(61891);s();let{runShareSweeperInServer:r}=await e.A(99787);r();let{runSessionSyncInServer:t}=await e.A(87528);t()}e.s(["register",0,s])},99787,e=>{e.v(s=>Promise.all(["server/chunks/[root-of-the-server]__0888o0_._.js","server/chunks/lib_15a9ejf._.js"].map(s=>e.l(s))).then(()=>s(97350)))},87528,e=>{e.v(s=>Promise.all(["server/chunks/[root-of-the-server]__0k8wfe2._.js","server/chunks/lib_1z7d95m._.js"].map(s=>e.l(s))).then(()=>s(7185)))},61891,e=>{e.v(s=>Promise.all(["server/chunks/[externals]__17bolvp._.js","server/chunks/lib_19pzc33._.js","server/chunks/lib_slack-runtime_ts_0fgsejy._.js"].map(s=>e.l(s))).then(()=>s(15050)))}];
2
+
3
+ //# sourceMappingURL=_0_b7py8._.js.map