botmancers 0.6.1 → 0.7.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 (244) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +13 -12
  3. package/app/.next/BUILD_ID +1 -1
  4. package/app/.next/app-path-routes-manifest.json +0 -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 +0 -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 +2 -2
  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]/share-policy/route.js +3 -3
  30. package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -1
  31. package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
  32. package/app/.next/server/app/api/bots/availability/route.js +3 -2
  33. package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
  34. package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
  35. package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
  36. package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
  37. package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
  38. package/app/.next/server/app/api/bots/route.js +5 -5
  39. package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
  40. package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
  41. package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
  42. package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
  43. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
  44. package/app/.next/server/app/api/conversations/[id]/messages/route.js +5 -5
  45. package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
  46. package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
  47. package/app/.next/server/app/api/conversations/[id]/stop/route.js +5 -5
  48. package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
  49. package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
  50. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +2 -2
  51. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
  52. package/app/.next/server/app/api/exchanges/[id]/route.js +3 -3
  53. package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
  54. package/app/.next/server/app/api/exchanges/route.js +3 -3
  55. package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
  56. package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
  57. package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
  58. package/app/.next/server/app/api/health/route.js +3 -3
  59. package/app/.next/server/app/api/health/route.js.nft.json +1 -1
  60. package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
  61. package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
  62. package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -1
  63. package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
  64. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js +3 -3
  65. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -1
  66. package/app/.next/server/app/api/shares/route.js +3 -3
  67. package/app/.next/server/app/api/shares/route.js.nft.json +1 -1
  68. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +3 -3
  69. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
  70. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +3 -3
  71. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
  72. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +2 -2
  73. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
  74. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js +3 -3
  75. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -1
  76. package/app/.next/server/app/api/v0/agents/[agentId]/route.js +3 -3
  77. package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
  78. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +3 -3
  79. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
  80. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +3 -3
  81. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
  82. package/app/.next/server/app/api/v0/agents/route.js +3 -3
  83. package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
  84. package/app/.next/server/app/api/v0/capabilities/route.js +3 -3
  85. package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
  86. package/app/.next/server/app/api/v0/conversations/[id]/route.js +2 -2
  87. package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
  88. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +3 -3
  89. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
  90. package/app/.next/server/app/api/v0/exchanges/[id]/route.js +3 -3
  91. package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
  92. package/app/.next/server/app/api/v0/exchanges/route.js +3 -3
  93. package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
  94. package/app/.next/server/app/api/v0/mcp/route.js +3 -3
  95. package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
  96. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js +3 -3
  97. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js +3 -3
  99. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js +3 -3
  101. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/v0/requests/[id]/route.js +2 -2
  103. package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
  104. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js +3 -3
  105. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
  106. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js +3 -3
  107. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -1
  108. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js +3 -3
  109. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -1
  110. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js +3 -3
  111. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -1
  112. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js +3 -3
  113. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -1
  114. package/app/.next/server/app/api/v0/shares/current/route.js +3 -3
  115. package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -1
  116. package/app/.next/server/app/api/v0/shares/route.js +3 -3
  117. package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -1
  118. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +2 -2
  119. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
  120. package/app/.next/server/app/api/wakes/[id]/decision/route.js +2 -2
  121. package/app/.next/server/app/api/wakes/[id]/decision/route.js.nft.json +1 -1
  122. package/app/.next/server/app/api/wakes/[id]/retry/route.js +2 -2
  123. package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
  124. package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
  125. package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
  126. package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
  127. package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
  128. package/app/.next/server/app/exchanges.html +1 -1
  129. package/app/.next/server/app/exchanges.rsc +3 -3
  130. package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
  131. package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
  132. package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
  133. package/app/.next/server/app/index.html +1 -1
  134. package/app/.next/server/app/index.rsc +3 -3
  135. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  136. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  137. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  138. package/app/.next/server/app/page.js.nft.json +1 -1
  139. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  140. package/app/.next/server/app/settings/page.js.nft.json +1 -1
  141. package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  142. package/app/.next/server/app/settings.html +1 -1
  143. package/app/.next/server/app/settings.rsc +3 -3
  144. package/app/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  145. package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  146. package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +3 -3
  147. package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -1
  148. package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +1 -1
  149. package/app/.next/server/app-paths-manifest.json +0 -2
  150. package/app/.next/server/chunks/[root-of-the-server]__0792yb1._.js +44 -0
  151. package/app/.next/server/chunks/[root-of-the-server]__0d3fjix._.js +1 -1
  152. package/app/.next/server/chunks/[root-of-the-server]__0mp8bap._.js +1 -1
  153. package/app/.next/server/chunks/[root-of-the-server]__0qaiqut._.js +4 -4
  154. package/app/.next/server/chunks/[root-of-the-server]__0zrx1iz._.js +1 -1
  155. package/app/.next/server/chunks/[root-of-the-server]__10b5-i-._.js +1 -1
  156. package/app/.next/server/chunks/[root-of-the-server]__17mum5-._.js +1 -1
  157. package/app/.next/server/chunks/[root-of-the-server]__17xl_55._.js +1 -1
  158. package/app/.next/server/chunks/[root-of-the-server]__1j8fg_n._.js +3 -0
  159. package/app/.next/server/chunks/[root-of-the-server]__1x8phwp._.js +44 -0
  160. package/app/.next/server/chunks/[root-of-the-server]__200ep0k._.js +1 -1
  161. package/app/.next/server/chunks/_0061c2q._.js +1 -1
  162. package/app/.next/server/chunks/_057h7zr._.js +3 -0
  163. package/app/.next/server/chunks/_0a2do3x._.js +1 -1
  164. package/app/.next/server/chunks/_1-5mthb._.js +1 -1
  165. package/app/.next/server/chunks/lib_0-opbv7._.js +316 -0
  166. package/app/.next/server/chunks/lib_0aejojj._.js +316 -0
  167. package/app/.next/server/chunks/lib_0il0ml1._.js +316 -0
  168. package/app/.next/server/chunks/lib_0iujsdg._.js +316 -0
  169. package/app/.next/server/chunks/lib_0kik6bx._.js +20 -20
  170. package/app/.next/server/chunks/lib_0pe3tiv._.js +20 -20
  171. package/app/.next/server/chunks/lib_15adnlz._.js +109 -126
  172. package/app/.next/server/chunks/lib_1dehbst._.js +316 -0
  173. package/app/.next/server/chunks/lib_1z4vnh4._.js +316 -0
  174. package/app/.next/server/chunks/lib_1zc7-gl._.js +109 -126
  175. package/app/.next/server/chunks/lib_db_ts_1ttuckb._.js +58 -56
  176. package/app/.next/server/chunks/ssr/_0_fa0na._.js +1 -1
  177. package/app/.next/server/chunks/ssr/_0a6r_bx._.js +3 -0
  178. package/app/.next/server/chunks/ssr/_14d-lxn._.js +3 -0
  179. package/app/.next/server/chunks/ssr/_1cvuhjt._.js +1 -1
  180. package/app/.next/server/chunks/ssr/_1is_iwu._.js +3 -0
  181. package/app/.next/server/chunks/ssr/_1n5mvo5._.js +1 -1
  182. package/app/.next/server/chunks/ssr/_1o94bnv._.js +1 -1
  183. package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +1 -1
  184. package/app/.next/server/middleware-build-manifest.js +3 -3
  185. package/app/.next/server/pages/404.html +1 -1
  186. package/app/.next/server/pages/500.html +1 -1
  187. package/app/.next/server/server-reference-manifest.js +1 -1
  188. package/app/.next/server/server-reference-manifest.json +1 -1
  189. package/app/.next/static/chunks/{22xbkclbkct3s.js → 1ouuczm-gmvxs.js} +1 -1
  190. package/app/.next/static/chunks/{2c953okoei6ip.js → 1w72fds3-utrx.js} +1 -1
  191. package/app/.next/static/chunks/2095-o17ji0fs.css +3 -0
  192. package/app/.next/static/chunks/2q-tgwkalrnms.js +1 -0
  193. package/app/.next/static/chunks/34bv9o9bjkwk0.js +3 -0
  194. package/app/.next/static/chunks/3rwwunh5sdjzg.js +1 -0
  195. package/app/.next/static/chunks/3whw2-l4a2sli.js +1 -0
  196. package/app/.next/static/chunks/3z3mn526_3fwd.js +1 -0
  197. package/app/BUILD_INFO.json +2 -2
  198. package/app/package.json +1 -1
  199. package/app/server.js +1 -1
  200. package/dist/cli.d.ts +1 -1
  201. package/dist/cli.js +2 -2
  202. package/dist/product.d.ts +0 -1
  203. package/dist/product.js +12 -22
  204. package/dist/setup.js +9 -9
  205. package/package.json +1 -2
  206. package/schemas/botmancers.mcp.v2.tools.json +3 -3
  207. package/app/.next/server/app/api/agent-deck/decks/route/app-paths-manifest.json +0 -3
  208. package/app/.next/server/app/api/agent-deck/decks/route/build-manifest.json +0 -12
  209. package/app/.next/server/app/api/agent-deck/decks/route/server-reference-manifest.json +0 -4
  210. package/app/.next/server/app/api/agent-deck/decks/route.js +0 -9
  211. package/app/.next/server/app/api/agent-deck/decks/route.js.nft.json +0 -1
  212. package/app/.next/server/app/api/agent-deck/decks/route_client-reference-manifest.js +0 -3
  213. package/app/.next/server/app/api/agent-deck/settings/route/app-paths-manifest.json +0 -3
  214. package/app/.next/server/app/api/agent-deck/settings/route/build-manifest.json +0 -12
  215. package/app/.next/server/app/api/agent-deck/settings/route/server-reference-manifest.json +0 -4
  216. package/app/.next/server/app/api/agent-deck/settings/route.js +0 -9
  217. package/app/.next/server/app/api/agent-deck/settings/route.js.nft.json +0 -1
  218. package/app/.next/server/app/api/agent-deck/settings/route_client-reference-manifest.js +0 -3
  219. package/app/.next/server/chunks/[root-of-the-server]__0j4pjyg._.js +0 -3
  220. package/app/.next/server/chunks/[root-of-the-server]__0mo_kn3._.js +0 -48
  221. package/app/.next/server/chunks/[root-of-the-server]__1bhzfu_._.js +0 -7
  222. package/app/.next/server/chunks/[root-of-the-server]__1g_n99l._.js +0 -3
  223. package/app/.next/server/chunks/[root-of-the-server]__1t4ybp2._.js +0 -48
  224. package/app/.next/server/chunks/_next-internal_server_app_api_agent-deck_decks_route_actions_0yguyfv.js +0 -3
  225. package/app/.next/server/chunks/_next-internal_server_app_api_agent-deck_settings_route_actions_0z_nbkb.js +0 -3
  226. package/app/.next/server/chunks/lib_0v4d9w0._.js +0 -339
  227. package/app/.next/server/chunks/lib_0zzo6zb._.js +0 -339
  228. package/app/.next/server/chunks/lib_1_u7n-u._.js +0 -339
  229. package/app/.next/server/chunks/lib_1muhwn7._.js +0 -339
  230. package/app/.next/server/chunks/lib_1xnxg-q._.js +0 -339
  231. package/app/.next/server/chunks/ssr/_1i02yyi._.js +0 -3
  232. package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +0 -3
  233. package/app/.next/server/chunks/ssr/app_settings_page_tsx_1t-rdz-._.js +0 -3
  234. package/app/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a._.js +0 -3
  235. package/app/.next/static/chunks/0jon21u-9j2aw.css +0 -3
  236. package/app/.next/static/chunks/14k6cvywgknx2.js +0 -3
  237. package/app/.next/static/chunks/1ku9himlsx-hn.js +0 -1
  238. package/app/.next/static/chunks/1r5tqd-7h1xjn.js +0 -1
  239. package/app/.next/static/chunks/21aqekm5z0j47.js +0 -1
  240. package/app/.next/static/chunks/2t_2gf3xoxz_m.js +0 -1
  241. package/app/.next/static/chunks/34vnvo1qssbaj.js +0 -1
  242. /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → A9sQnaf9i6YzjHNoPgRfU}/_buildManifest.js +0 -0
  243. /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → A9sQnaf9i6YzjHNoPgRfU}/_clientMiddlewareManifest.js +0 -0
  244. /package/app/.next/static/{_yrIZIFsIbXA0Gaxkytjd → A9sQnaf9i6YzjHNoPgRfU}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
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"))},18150,e=>{"use strict";var t=e.i(89171),a=e.i(62294);async function r(){try{let e=a.bots.managementRows().map(e=>{let t=(0,a.serializeAgent)(e.bot);return{id:e.bot.id,name:e.bot.name,hidden:+!!e.bot.hidden,agent:t.agent,deck_id:t.deck_id,deck_name:t.deck_name,needs_deck_selection:t.needs_deck_selection,launch_profile:t.launch_profile,needs_launch_profile:t.needs_launch_profile,source_provider:e.bot.source_provider??null,created_at:e.bot.created_at,last_activity:e.last_activity,blocked:e.blocked}});return t.NextResponse.json(e)}catch(e){return console.error("Error listing agents for management:",e),t.NextResponse.json({error:"Failed to list agents"},{status:500})}}e.s(["GET",0,r])},84629,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),h=e.i(70101),R=e.i(26937),v=e.i(10372),g=e.i(93695),m=e.i(9580);e.i(52474);var f=e.i(220);let x=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/bots/manage/route",pathname:"/api/bots/manage",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/manage/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(18150),...{}}),{workAsyncStorage:E,workUnitAsyncStorage:w,serverHooks:_}=x;async function b(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),x.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/bots/manage/route";E=E.replace(/\/index$/,"")||"/";let w=await x.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:_,deploymentId:b,params:C,nextConfig:y,parsedUrl:A,isDraftMode:T,prerenderManifest:N,routerServerContext:P,isOnDemandRevalidate:S,revalidateOnlyGenerated:q,resolvedPathname:k,clientReferenceManifest:O,serverActionsManifest:H}=w,I=(0,o.normalizeAppPath)(E),M=!!N.routes[k]&&(x.isDev||(0,m.isRouteCacheOwner)(k,x.cacheOwner,N.routes[k])),U=!!(N.dynamicRoutes[I]||M),D=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,A,!1):t.end("This page could not be found"),null);if(U&&!T){let e=N.dynamicRoutes[I];if(e&&!1===e.fallback&&!M){if(y.adapterPath)return await D();throw new g.NoFallbackError}}let j=null;!U||x.isDev||T||(j="/index"===(j=k)?"/":j);let F=!0===x.isDev||!U,K=U&&!F;H&&O&&(0,i.setManifestsSingleton)({page:E,clientReferenceManifest:O,serverActionsManifest:H});let L=e.method||"GET",$=(0,s.getTracer)(),B=$.getActiveScopeSpan(),G=!!(null==P?void 0:P.isWrappedByNextServer),V=!!(0,n.getRequestMeta)(e,"minimalMode"),X=(0,n.getRequestMeta)(e,"incrementalCache")||await x.getIncrementalCache(e,y,N,V);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let z={params:C,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!y.experimental.authInterrupts,useCacheTimeout:y.experimental.useCacheTimeout},cacheComponents:!!y.cacheComponents,validationLevel:y.experimental.instantInsights.validationLevel,isDraftMode:T,supportsDynamicResponse:F,incrementalCache:X,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:y.cacheLife,staticPageGenerationTimeout:y.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>x.onRequestError(e,t,r,n,P)},sharedContext:{buildId:_,deploymentId:b}},W=new l.NodeNextRequest(e),Z=new l.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(W,(0,d.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:a})=>{try{if(!V&&S&&q&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await x.handle(J,z);e.fetchMetrics=z.renderOpts.fetchMetrics;let s=z.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let i=z.renderOpts.collectedTags;if(!U)return await (0,p.sendResponse)(W,Z,n,s),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[v.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,r=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=v.INFINITE_CACHE?!1!==a&&a>0?y.expireTime:void 0:z.renderOpts.collectedExpire;return{value:{kind:f.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 x.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:S})},!1,P),t}},Y=async(n,i)=>{try{var o,l;let n=await x.handleResponse({req:e,nextConfig:y,cacheKey:j,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:q,responseGenerator:Q,waitUntil:r.waitUntil,isMinimalMode:V});if(!U)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==f.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",S?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),T&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);V&&U||s.delete(v.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,R.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(W,Z,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof g.NoFallbackError||await x.onRequestError(e,t,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:S})},!1,P),U)throw t;await (0,p.sendResponse)(W,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 a=$.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")||I,o=`${L} ${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(G&&B)await Y(B,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(u.BaseServerSpan.handleRequest,{spanName:`${L} ${E}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,b,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:w})},"routeModule",0,x,"serverHooks",0,_,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,w])}];
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"))},18150,e=>{"use strict";var t=e.i(89171),a=e.i(62294);async function r(){try{let e=a.bots.managementRows().map(e=>{let t=(0,a.serializeAgent)(e.bot);return{id:e.bot.id,name:e.bot.name,hidden:+!!e.bot.hidden,agent:t.agent,launchable:t.launchable,runtime_connection:t.runtime_connection,source_provider:e.bot.source_provider??null,created_at:e.bot.created_at,last_activity:e.last_activity,blocked:e.blocked}});return t.NextResponse.json(e)}catch(e){return console.error("Error listing agents for management:",e),t.NextResponse.json({error:"Failed to list agents"},{status:500})}}e.s(["GET",0,r])},84629,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),o=e.i(61916),s=e.i(74677),i=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),v=e.i(10372),g=e.i(93695),m=e.i(9580);e.i(52474);var x=e.i(220);let f=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/bots/manage/route",pathname:"/api/bots/manage",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/manage/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(18150),...{}}),{workAsyncStorage:E,workUnitAsyncStorage:b,serverHooks:w}=f;async function C(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),f.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/bots/manage/route";E=E.replace(/\/index$/,"")||"/";let b=await f.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!b)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:w,deploymentId:C,params:y,nextConfig:A,parsedUrl:T,isDraftMode:_,prerenderManifest:N,routerServerContext:P,isOnDemandRevalidate:S,revalidateOnlyGenerated:q,resolvedPathname:O,clientReferenceManifest:H,serverActionsManifest:k}=b,I=(0,i.normalizeAppPath)(E),M=!!N.routes[O]&&(f.isDev||(0,m.isRouteCacheOwner)(O,f.cacheOwner,N.routes[O])),U=!!(N.dynamicRoutes[I]||M),D=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,T,!1):t.end("This page could not be found"),null);if(U&&!_){let e=N.dynamicRoutes[I];if(e&&!1===e.fallback&&!M){if(A.adapterPath)return await D();throw new g.NoFallbackError}}let j=null;!U||f.isDev||_||(j="/index"===(j=O)?"/":j);let F=!0===f.isDev||!U,K=U&&!F;k&&H&&(0,s.setManifestsSingleton)({page:E,clientReferenceManifest:H,serverActionsManifest:k});let L=e.method||"GET",$=(0,o.getTracer)(),B=$.getActiveScopeSpan(),G=!!(null==P?void 0:P.isWrappedByNextServer),V=!!(0,n.getRequestMeta)(e,"minimalMode"),X=(0,n.getRequestMeta)(e,"incrementalCache")||await f.getIncrementalCache(e,A,N,V);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let z={params:y,previewProps:N.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts,useCacheTimeout:A.experimental.useCacheTimeout},cacheComponents:!!A.cacheComponents,validationLevel:A.experimental.instantInsights.validationLevel,isDraftMode:_,supportsDynamicResponse:F,incrementalCache:X,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:A.cacheLife,staticPageGenerationTimeout:A.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>f.onRequestError(e,t,r,n,P)},sharedContext:{buildId:w,deploymentId:C}},W=new l.NodeNextRequest(e),Z=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:a})=>{try{if(!V&&S&&q&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await f.handle(J,z);e.fetchMetrics=z.renderOpts.fetchMetrics;let o=z.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let s=z.renderOpts.collectedTags;if(!U)return await (0,p.sendResponse)(W,Z,n,o),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);s&&(t[v.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==z.renderOpts.collectedRevalidate&&!(z.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&z.renderOpts.collectedRevalidate,r=void 0===z.renderOpts.collectedExpire||z.renderOpts.collectedExpire>=v.INFINITE_CACHE?!1!==a&&a>0?A.expireTime:void 0:z.renderOpts.collectedExpire;return{value:{kind:x.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 f.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:S})},!1,P),t}},Y=async(n,s)=>{try{var i,l;let n=await f.handleResponse({req:e,nextConfig:A,cacheKey:j,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:N,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:q,responseGenerator:Q,waitUntil:r.waitUntil,isMinimalMode:V});if(!U)return;if((null==n||null==(i=n.value)?void 0:i.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});V||t.setHeader("x-nextjs-cache",S?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),_&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let o=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);V&&U||o.delete(v.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||o.get("Cache-Control")||o.set("Cache-Control",(0,R.getCacheControlHeader)(n.cacheControl)),await (0,p.sendResponse)(W,Z,new Response(n.value.body,{headers:o,status:n.value.status||200}));return}catch(t){if(t instanceof g.NoFallbackError||await f.onRequestError(e,t,{routerKind:"App Router",routePath:I,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:S})},!1,P),U)throw t;await (0,p.sendResponse)(W,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:o.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=$.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==d.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")||I,i=`${L} ${r}`;n.setAttributes({"next.route":r,"http.route":r,"next.span_name":i}),n.updateName(i),s&&s!==n&&(s.setAttribute("http.route",r),s.updateName(i))})()}};if(G&&B)await Y(B,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${E}`,kind:o.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,C,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:b})},"routeModule",0,f,"serverHooks",0,w,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,b])}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__0mp8bap._.js.map
@@ -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,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),r=e.i(90027);async function n(e,{params:s}){try{let{id:n,ref:i}=await s;if(!(0,r.agentExists)(a.default,n))return t.NextResponse.json({error:"Agent not found"},{status:404});let o=(0,r.getAgentSession)(a.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,r.sessionDebugExternalId)(a.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),a=e.i(74017),r=e.i(96250),n=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,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),h.isDev&&(0,n.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==r.waitUntil||r.waitUntil.call(r,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,n.getRequestMeta)(e,"minimalMode"),X=(0,n.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,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:x.cacheLife,staticPageGenerationTimeout:x.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>h.onRequestError(e,t,r,n,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 n=await h.handle(Y,B);e.fetchMetrics=B.renderOpts.fetchMetrics;let s=B.renderOpts.pendingWaitUntil;s&&r.waitUntil&&(r.waitUntil(s),s=void 0);let i=B.renderOpts.collectedTags;if(!M)return await (0,_.sendResponse)(V,z,n,s),null;{let e=await n.blob(),t=(0,c.toNodeOutgoingHttpHeaders)(n.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,r=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: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 h.onRequestError(e,t,{routerKind:"App Router",routePath:f,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:T})},!1,w),t}},Q=async(n,i)=>{try{var o,d;let n=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:r.waitUntil,isMinimalMode:K});if(!M)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(d=n.value)?void 0:d.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",T?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),C&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,c.fromNodeOutgoingHttpHeaders)(n.value.headers);K&&M||s.delete(v.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,_.sendResponse)(V,z,new Response(n.value.body,{headers:s,status:n.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(!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=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 r=a.get("next.route")||H,o=`${j} ${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(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,r.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 r=["active","ended","all"],n=["implementation","revision"],s=`
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,
@@ -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 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,r=(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&&n.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},usage:r}}function p(e,t=(0,a.emptyUsage)()){let r=e.provider_created_at??e.created_at,n=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(r)}`,status:"open"===e.lifecycle?"active":"ended",resumable:!1,state:{availability:e.availability,lifecycle:e.lifecycle,resumable:n,busy:1===e.busy||!!e.running,synced_at:e.last_synced_at},created_at:r,ended_at:s,last_activity_at:Math.max(r,e.provider_updated_at??0,e.turn_last_at??0),origin:{conversation:null,work_request:null},context:{workspace:e.workspace},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(`
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 a?l(a):null},"getAgentSession",0,function(e,t,r){let n=g(e,t,r);if(!n){let n=c(e,t,r);if(!n)return;let{usage:s,samples:i}=(0,a.sessionUsageSamples)(e,t,r);return{...p(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{...u(n,i),attempts:s,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&r.includes(e)},"listAgentSessions",0,function(e,t,r="all"){let n=e.prepare(`${s} WHERE b.agent_id = ? ${"active"===r?"AND b.released_at IS NULL":"ended"===r?"AND b.released_at IS NOT NULL":""}`).all(t),o=e.prepare(`${i} AND ps.agent_id = ? ${"active"===r?"AND ps.lifecycle = 'open'":"ended"===r?"AND ps.lifecycle = 'archived'":""}`).all(t),d=(0,a.agentSessionUsage)(e,t);return[...n.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 r=g(e,t,a)?.external_session_id;if(void 0!==r)return r;if(!c(e,t,a))return;let n=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(a,t);return n?.provider_session_id},"sessionTitle",0,function(e,t,a){let r=g(e,t,a);if(r)return u(r).title;let n=c(e,t,a);return n?p(n).title:null}])}];
43
43
 
44
44
  //# sourceMappingURL=%5Broot-of-the-server%5D__0qaiqut._.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=[24836,(t,e,n)=>{e.exports=t.x("https",()=>require("https"))},20635,(t,e,n)=>{e.exports=t.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(t,e,n)=>{e.exports=t.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},49166,t=>{"use strict";var e=t.i(89171);let n="1.0.0";async function r(){return e.NextResponse.json({schema_version:n,supported:{identity:!0,description:!0,avatar:!0,verification:!0},unsupported:{memories:!0,skills:!0,routines:!0,integrations:!0}})}t.s(["GET",0,r,"IMPORT_SCHEMA_VERSION",0,n])},2803,77099,t=>{"use strict";var e=t.i(33405),n=t.i(14747),r=t.i(24836),s=t.i(62294);function o(t){try{let e=new URL(t);if("https:"!==e.protocol||e.username||e.password)return null;return t}catch{return null}}function i(t){let e,n=t.match(/^\s*\[run\]\s*([\s\S]*)$/);if(!n)return null;try{e=JSON.parse(n[1])}catch{return null}if(!e||"object"!=typeof e)return null;let r=e,s="string"==typeof r.page?r.page:"string"==typeof r.html?r.html:void 0,o=void 0===s?{}:{page:s,html:s};return"running"===r.state||"stopped"===r.state?{state:r.state,...o}:"done"===r.state&&"string"==typeof r.output?{state:"done",output:r.output,...o}:null}function a(t){let e={state:t.state};"done"===t.state&&"string"==typeof t.output&&(e.output=t.output);let n="string"==typeof t.page?t.page:"string"==typeof t.html?t.html:void 0;return void 0!==n&&(e.page=n),"[run]\n"+JSON.stringify(e)}t.s(["parseCodingLimbAsk",0,function(t){let e=t.trim();return(e.endsWith(".")&&(e=e.slice(0,-1).trim()),"Ask the coding limb which file holds parsePublicPageReadAsk and reply with that path"===e)?{seconds:4}:"Ask the coding limb which file holds parsePublicPageReadAsk and reply with that path wait 20 seconds"===e?{seconds:20}:null},"parseFileReadAsk",0,function(t){let e=t.trim();return(e.endsWith(".")&&(e=e.slice(0,-1).trim()),"Read the file filemint6.txt"===e)?{seconds:4}:"Read the file filemint6.txt wait 20 seconds"===e?{seconds:20}:null},"parsePublicPageReadAsk",0,function(t){let e=t.trim();if(e.endsWith(".")&&(e=e.slice(0,-1).trim()),"Open https://example.com and reply with one word from it"===e)return{seconds:4};let n=e.match(/^Open https:\/\/example\.com and reply with one word from it wait (\d+) seconds$/);if(n&&"20"===n[1])return{seconds:20};let r=e.match(/^Open (https:\/\/[^\s]+) and reply with the page title$/);if(r){let t=o(r[1]);return t?{seconds:4,url:t}:null}let s=e.match(/^Open (https:\/\/[^\s]+) and reply with the page title wait (\d+) seconds$/);if(s&&"20"===s[2]){let t=o(s[1]);return t?{seconds:20,url:t}:null}return null},"parseRun",0,i,"serializeRun",0,a],77099);var l=t.i(52036),u=t.i(51714);let p=globalThis;p.__botmancerFileRuns||(p.__botmancerFileRuns=new Map);let d=p.__botmancerFileRuns;function c(t,e){if(e.stopped)return!1;let n=s.messages.getById(t),r=n?i(n.content):null;return r?.state==="running"}function m(t){let e=s.messages.getById(t),n=e?i(e.content):null;n&&"running"===n.state&&s.messages.replaceContent(t,a({state:"stopped"}))}function f(t,e){let n=d.get(t);n?.child===e&&d.delete(t)}function g(){let t=(0,l.filesRootPath)(),e=n.default.resolve(t,"filemint6.txt");return"filemint6.txt"===n.default.relative(t,e)&&e.startsWith(t+n.default.sep)?e:null}let h=globalThis;h.__botmancerPageRuns||(h.__botmancerPageRuns=new Map);let _=h.__botmancerPageRuns;function y(t,e){let n=_.get(t);n?.child===e&&_.delete(t)}function R(t,e){return new Promise((n,s)=>{let o=r.default.get(t,{timeout:1e4},r=>{if(301===r.statusCode||302===r.statusCode||307===r.statusCode||308===r.statusCode){let n=r.headers.location;if(n)try{if(new URL(n,t).hostname!==e)return void s(Error("Redirect to different host not allowed"))}catch{s(Error("Invalid redirect location"));return}s(Error("Redirect detected"));return}if(200!==r.statusCode)return void s(Error(`HTTP ${r.statusCode}`));let o="";r.on("data",t=>{(o+=t.toString("utf8")).length>1e5&&(r.destroy(),s(Error("Response too large")))}),r.on("end",()=>n(o))});o.on("error",s),o.on("timeout",()=>{o.destroy(),s(Error("Timeout"))})})}let w=globalThis;w.__botmancerCodingLimbRuns||(w.__botmancerCodingLimbRuns=new Map);let S=w.__botmancerCodingLimbRuns;function b(t,e){let n=S.get(t);n?.child===e&&S.delete(t)}async function v(t,e){let n=process.env.CURSOR_API_KEY;if(n)try{await fetch(`https://api.cursor.com/v1/agents/${t}/runs/${e}/cancel`,{method:"POST",headers:{Authorization:`Bearer ${n}`}})}catch{}}let k=globalThis;k.__botmancerCommandRuns||(k.__botmancerCommandRuns=new Map);let C=k.__botmancerCommandRuns;function x(t,e){let n=C.get(t);n?.child===e&&(n.timer&&clearTimeout(n.timer),C.delete(t))}function I(t){try{t.child.kill("SIGTERM")}catch{}setTimeout(()=>{try{t.child.kill("SIGKILL")}catch{}},2e3).unref?.()}t.s(["beginCodingLimbRun",0,function(t,n){if(4!==n&&20!==n||S.has(t))return;let r=s.messages.getById(t),o=r?i(r.content):null;if(!o||"running"!==o.state)return;let l={child:void 0,stopped:!1,agentId:void 0,runId:void 0},u=(0,e.spawn)("/bin/sleep",[String(n)],{stdio:"ignore"});l.child=u,S.set(t,l),u.on("error",()=>{l.stopped=!0,b(t,u),m(t)}),u.on("exit",async(e,n)=>{if(b(t,u),l.stopped||!c(t,l)||n||0!==e||l.stopped||!c(t,l)){l.stopped&&m(t);return}try{let e=process.env.CURSOR_API_KEY;if(!e){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Error: CURSOR_API_KEY not set"}));return}let n=await fetch("https://api.cursor.com/v1/agents",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({prompt:{text:"Which file holds parsePublicPageReadAsk in not-so-fat/botmancers? Reply with the path. Do not edit, commit, push, or open a pull request."},repos:[{url:"https://github.com/not-so-fat/botmancers",startingRef:"main"}],autoCreatePR:!1,mode:"plan"})});if(l.stopped||!c(t,l)){l.stopped&&m(t);return}if(!n.ok){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:`Create failed: ${n.status}`}));return}let r=await n.json(),o=r.agent?.id,i=r.run?.id;if(!o||!i){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Error: No agent or run ID returned"}));return}if(l.agentId=o,l.runId=i,l.stopped||!c(t,l)){await v(o,i),l.stopped&&m(t);return}let u=0;for(;u<120;){if(await new Promise(t=>setTimeout(t,2e3)),u++,l.stopped||!c(t,l)){await v(o,i),l.stopped&&m(t);return}let n=await fetch(`https://api.cursor.com/v1/agents/${o}/runs/${i}`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:`Poll failed: ${n.status}`}));return}let r=await n.json();if(l.stopped||!c(t,l)){await v(o,i),l.stopped&&m(t);return}if("FINISHED"===r.status){if("string"==typeof r.result&&c(t,l))return void s.messages.replaceContent(t,a({state:"done",output:r.result}));!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Error: No result in response"}));return}if("FAILED"===r.status||"CANCELLED"===r.status){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:`Run ${r.status.toLowerCase()}`}));return}}!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Timeout waiting for result"}))}catch(e){if(!l.stopped&&c(t,l)){let n=e instanceof Error?e.message.slice(0,40):"Unknown";s.messages.replaceContent(t,a({state:"done",output:`Network error: ${n}`}))}}})},"beginCommandRun",0,function(t,n,r={}){let o=(0,u.validateCommandRequest)({command:n.command,args:n.args,waitSeconds:n.waitSeconds}),l=(0,u.resolveCommand)({command:o.command,args:o.args});if(C.has(t))return;let p=s.messages.getById(t),d=p?i(p.content):null;if(!d||"running"!==d.state)return;let f=r.timeoutMs??(0,u.commandTimeoutMs)(o.waitSeconds),g=r.outputMaxBytes??u.COMMAND_OUTPUT_MAX_BYTES,h={child:void 0,stopped:!1},_=(0,e.spawn)("/bin/sleep",[String(o.waitSeconds)],{stdio:"ignore"});h.child=_,C.set(t,h);let y=()=>{h.stopped=!0,x(t,h.child),m(t)};h.timer=setTimeout(()=>{I(h),y()},f),h.timer.unref?.(),s.messages.replaceContent(t,a({state:"running",page:(0,u.commandRunPage)(o,null)})),_.on("error",()=>{I(h),y()}),_.on("exit",(n,r)=>{if(h.stopped||!c(t,h)||r||0!==n){h.stopped&&(x(t,_),m(t));return}let i="",p=!1,d=(0,e.spawn)(l.bin,l.argv,{stdio:["ignore","pipe","ignore"]});h.child=d,C.set(t,h),d.stdout?.on("data",t=>{!p&&(i+=t.toString("utf8"),Buffer.byteLength(i,"utf8")>g&&(p=!0,i=Buffer.from(i,"utf8").subarray(0,g).toString("utf8"),I({child:d})))}),d.on("error",()=>{I(h),y()}),d.on("close",(e,n)=>{if(x(t,d),h.stopped||!c(t,h)){h.stopped&&m(t);return}if((n||0!==e)&&!p)return void m(t);let r=(0,u.commandRunPage)(o,i);s.messages.replaceContent(t,a({state:"done",output:i,page:r}))}),(h.stopped||!c(t,h))&&I(h)})},"beginFileReadRun",0,function(t,n){if(4!==n&&20!==n||d.has(t))return;let r=s.messages.getById(t),o=r?i(r.content):null;if(!o||"running"!==o.state||!g())return;let l={child:void 0,stopped:!1},u=(0,e.spawn)("/bin/sleep",[String(n)],{stdio:"ignore"});l.child=u,d.set(t,l),u.on("error",()=>{l.stopped=!0,f(t,u),m(t)}),u.on("exit",(n,r)=>{if(f(t,u),l.stopped||!c(t,l)||r||0!==n){l.stopped&&m(t);return}let o=g();if(!o||l.stopped){l.stopped&&m(t);return}let i="",p=(0,e.spawn)("/bin/cat",[o],{stdio:["ignore","pipe","ignore"]});if(l.child=p,d.set(t,l),p.stdout?.on("data",t=>{i+=t.toString("utf8")}),p.on("error",()=>{l.stopped=!0,f(t,p),m(t)}),p.on("close",(e,n)=>{if(f(t,p),!c(t,l)||n||0!==e){l.stopped&&m(t);return}let r=i.endsWith("\n")?i.slice(0,-1):"";i===r+"\n"&&"filemint6"===r&&s.messages.replaceContent(t,a({state:"done",output:r}))}),l.stopped||!c(t,l))try{p.kill("SIGTERM")}catch{}})},"beginPublicPageReadRun",0,function(t,n,r){if(4!==n&&20!==n||_.has(t))return;let o=s.messages.getById(t),l=o?i(o.content):null;if(!l||"running"!==l.state)return;let u={child:void 0,stopped:!1},p=(0,e.spawn)("/bin/sleep",[String(n)],{stdio:"ignore"});u.child=p,_.set(t,u),p.on("error",()=>{u.stopped=!0,y(t,p),m(t)}),p.on("exit",async(e,n)=>{if(y(t,p),u.stopped||!c(t,u)||n||0!==e||u.stopped||!c(t,u)){u.stopped&&m(t);return}try{if(r){let e,n=new URL(r),o=await R(r,n.hostname);if(u.stopped||!c(t,u)||(s.messages.replaceContent(t,a({state:"running",page:o})),await new Promise(t=>setTimeout(t,3e3)),u.stopped||!c(t,u))){u.stopped&&m(t);return}let i=(e=o.match(/<title[^>]*>([\s\S]*?)<\/title>/i))&&e[1].replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&apos;/g,"'").replace(/\s+/g," ").trim()||null;i&&c(t,u)&&s.messages.replaceContent(t,a({state:"done",output:i,page:o}))}else{let e=await R("https://example.com","example.com");if(u.stopped||!c(t,u)){u.stopped&&m(t);return}let n=function(t){let e=t.match(/<title[^>]*>([^<]*)<\/title>/i);if(e&&e[1]){let t=e[1].trim().split(/\s+/)[0];if(t)return t}let n=t.match(/<h1[^>]*>([^<]*)<\/h1>/i);if(n&&n[1]){let t=n[1].trim().split(/\s+/)[0];if(t)return t}return null}(e);"Example"===n&&c(t,u)&&s.messages.replaceContent(t,a({state:"done",output:"Example"}))}}catch(t){console.error("Public page fetch failed:",t)}})},"stopCodingLimbRun",0,function(t){let e=S.get(t);if(e&&(e.stopped=!0,e.agentId&&e.runId&&v(e.agentId,e.runId).catch(()=>{})),m(t),e){try{e.child.kill("SIGTERM")}catch{}b(t,e.child)}},"stopCommandRun",0,function(t){let e=C.get(t);e&&(e.stopped=!0),m(t),e&&(I(e),x(t,e.child))},"stopFileReadRun",0,function(t){let e=d.get(t);if(e&&(e.stopped=!0),m(t),e){try{e.child.kill("SIGTERM")}catch{}f(t,e.child)}},"stopPublicPageReadRun",0,function(t){let e=_.get(t);if(e&&(e.stopped=!0),m(t),e){try{e.child.kill("SIGTERM")}catch{}y(t,e.child)}}],2803)},10860,t=>{"use strict";var e=t.i(22734),n=t.i(14747),r=t.i(52036);function s(t){if(!/^[A-Za-z0-9_-]+$/.test(t))return null;let s=(0,r.skillsRootPath)(),o=n.default.resolve(s,t,"SKILL.md");if(!o.startsWith(s+n.default.sep))return null;try{let t=e.default.readFileSync(o,"utf8");return t.trim()?t:null}catch{return null}}function o(t){return/^[A-Za-z0-9_-]+$/.test(t)}function i(t){if(!t)return null;let e=s(t);if(!e)return null;let n=e.match(/ends with the exact token\s+(\S+)/i);return n?n[1]:null}function a(t){return o(t)?`skills/${t}/SKILL.md`:null}t.s(["applySkillEndToken",0,function(t,e){let n=i(t);return n?e?e.trimEnd().endsWith(n)?e:e+"\n"+n:n:e},"isSupportedSkillName",0,o,"localSkillForBot",0,s,"readSkillState",0,function(t){let e=a(t);if(!e)return{path:null,present:!1,content:null,status:"unsupported"};let n=s(t);return null===n?{path:e,present:!1,content:null,status:"absent"}:{path:e,present:!0,content:n,status:"present"}},"skillEndToken",0,i,"writeSkillForBot",0,function(t,s){let o=a(t);if(!o)throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");let i=(0,r.skillsRootPath)(),l=n.default.resolve(i,t,"SKILL.md");if(!l.startsWith(i+n.default.sep))throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");if(!s.trim()){try{e.default.rmSync(l)}catch{}return{path:o,present:!1,content:null,status:"absent"}}return e.default.mkdirSync(n.default.dirname(l),{recursive:!0}),e.default.writeFileSync(l,s),{path:o,present:!0,content:s,status:"present"}}])},38636,(t,e,n)=>{let{createHash:r}=t.r(54799);function s(t){if(Array.isArray(t))return t.map(s);if(null!==t&&"object"==typeof t){let e={};for(let n of Object.keys(t).sort())e[n]=s(t[n]);return e}return t}function o(t){return JSON.stringify(s(t))}function i(t){return null==t?null:String(t)}function a(t){return null==t?null:String(t).trim()||null}e.exports={sortKeysDeep:s,canonicalJson:o,hashSnapshot:function(t){return r("sha256").update(o(t),"utf8").digest("hex")},buildSnapshotInput:function(t,e,n=null){let r=a(t.agent)||"hermes",s=a(t.deck_id);return{agent:r,avatar_accessory:i(t.avatar_accessory),avatar_color:i(t.avatar_color),avatar_eyes:i(t.avatar_eyes),avatar_hands:i(t.avatar_hands),deck_id:s,deck_name:a(t.deck_name),description:null===t.description||void 0===t.description?"":String(t.description),import_operation_id:i(t.import_operation_id),import_schema_version:i(t.import_schema_version),memories:null==n?null:n.map(t=>String(t)),name:String(t.name),needs_deck_selection:null===s||function(t){if(!0===t||1===t)return!0;if("string"==typeof t){let e=t.trim().toLowerCase();return"1"===e||"true"===e}return!1}(t.needs_deck_selection),skill_content:i(e.content),skill_path:i(e.path),skill_present:null===e.present||void 0===e.present?null:!!e.present,source_provider:i(t.source_provider),template_id:i(t.template_id),template_url:i(t.template_url),title:null===t.title||void 0===t.title?"":String(t.title),working_directory:a(t.working_directory)}}}}];
1
+ module.exports=[24836,(t,e,n)=>{e.exports=t.x("https",()=>require("https"))},20635,(t,e,n)=>{e.exports=t.x("next/dist/server/app-render/action-async-storage.external.js",()=>require("next/dist/server/app-render/action-async-storage.external.js"))},24725,(t,e,n)=>{e.exports=t.x("next/dist/server/app-render/after-task-async-storage.external.js",()=>require("next/dist/server/app-render/after-task-async-storage.external.js"))},49166,t=>{"use strict";var e=t.i(89171);let n="1.0.0";async function r(){return e.NextResponse.json({schema_version:n,supported:{identity:!0,description:!0,avatar:!0,verification:!0},unsupported:{memories:!0,skills:!0,routines:!0,integrations:!0}})}t.s(["GET",0,r,"IMPORT_SCHEMA_VERSION",0,n])},2803,77099,t=>{"use strict";var e=t.i(33405),n=t.i(14747),r=t.i(24836),s=t.i(62294);function o(t){try{let e=new URL(t);if("https:"!==e.protocol||e.username||e.password)return null;return t}catch{return null}}function i(t){let e,n=t.match(/^\s*\[run\]\s*([\s\S]*)$/);if(!n)return null;try{e=JSON.parse(n[1])}catch{return null}if(!e||"object"!=typeof e)return null;let r=e,s="string"==typeof r.page?r.page:"string"==typeof r.html?r.html:void 0,o=void 0===s?{}:{page:s,html:s};return"running"===r.state||"stopped"===r.state?{state:r.state,...o}:"done"===r.state&&"string"==typeof r.output?{state:"done",output:r.output,...o}:null}function a(t){let e={state:t.state};"done"===t.state&&"string"==typeof t.output&&(e.output=t.output);let n="string"==typeof t.page?t.page:"string"==typeof t.html?t.html:void 0;return void 0!==n&&(e.page=n),"[run]\n"+JSON.stringify(e)}t.s(["parseCodingLimbAsk",0,function(t){let e=t.trim();return(e.endsWith(".")&&(e=e.slice(0,-1).trim()),"Ask the coding limb which file holds parsePublicPageReadAsk and reply with that path"===e)?{seconds:4}:"Ask the coding limb which file holds parsePublicPageReadAsk and reply with that path wait 20 seconds"===e?{seconds:20}:null},"parseFileReadAsk",0,function(t){let e=t.trim();return(e.endsWith(".")&&(e=e.slice(0,-1).trim()),"Read the file filemint6.txt"===e)?{seconds:4}:"Read the file filemint6.txt wait 20 seconds"===e?{seconds:20}:null},"parsePublicPageReadAsk",0,function(t){let e=t.trim();if(e.endsWith(".")&&(e=e.slice(0,-1).trim()),"Open https://example.com and reply with one word from it"===e)return{seconds:4};let n=e.match(/^Open https:\/\/example\.com and reply with one word from it wait (\d+) seconds$/);if(n&&"20"===n[1])return{seconds:20};let r=e.match(/^Open (https:\/\/[^\s]+) and reply with the page title$/);if(r){let t=o(r[1]);return t?{seconds:4,url:t}:null}let s=e.match(/^Open (https:\/\/[^\s]+) and reply with the page title wait (\d+) seconds$/);if(s&&"20"===s[2]){let t=o(s[1]);return t?{seconds:20,url:t}:null}return null},"parseRun",0,i,"serializeRun",0,a],77099);var l=t.i(52036),u=t.i(51714);let p=globalThis;p.__botmancerFileRuns||(p.__botmancerFileRuns=new Map);let d=p.__botmancerFileRuns;function c(t,e){if(e.stopped)return!1;let n=s.messages.getById(t),r=n?i(n.content):null;return r?.state==="running"}function m(t){let e=s.messages.getById(t),n=e?i(e.content):null;n&&"running"===n.state&&s.messages.replaceContent(t,a({state:"stopped"}))}function f(t,e){let n=d.get(t);n?.child===e&&d.delete(t)}function g(){let t=(0,l.filesRootPath)(),e=n.default.resolve(t,"filemint6.txt");return"filemint6.txt"===n.default.relative(t,e)&&e.startsWith(t+n.default.sep)?e:null}let h=globalThis;h.__botmancerPageRuns||(h.__botmancerPageRuns=new Map);let _=h.__botmancerPageRuns;function y(t,e){let n=_.get(t);n?.child===e&&_.delete(t)}function R(t,e){return new Promise((n,s)=>{let o=r.default.get(t,{timeout:1e4},r=>{if(301===r.statusCode||302===r.statusCode||307===r.statusCode||308===r.statusCode){let n=r.headers.location;if(n)try{if(new URL(n,t).hostname!==e)return void s(Error("Redirect to different host not allowed"))}catch{s(Error("Invalid redirect location"));return}s(Error("Redirect detected"));return}if(200!==r.statusCode)return void s(Error(`HTTP ${r.statusCode}`));let o="";r.on("data",t=>{(o+=t.toString("utf8")).length>1e5&&(r.destroy(),s(Error("Response too large")))}),r.on("end",()=>n(o))});o.on("error",s),o.on("timeout",()=>{o.destroy(),s(Error("Timeout"))})})}let w=globalThis;w.__botmancerCodingLimbRuns||(w.__botmancerCodingLimbRuns=new Map);let S=w.__botmancerCodingLimbRuns;function b(t,e){let n=S.get(t);n?.child===e&&S.delete(t)}async function v(t,e){let n=process.env.CURSOR_API_KEY;if(n)try{await fetch(`https://api.cursor.com/v1/agents/${t}/runs/${e}/cancel`,{method:"POST",headers:{Authorization:`Bearer ${n}`}})}catch{}}let C=globalThis;C.__botmancerCommandRuns||(C.__botmancerCommandRuns=new Map);let k=C.__botmancerCommandRuns;function x(t,e){let n=k.get(t);n?.child===e&&(n.timer&&clearTimeout(n.timer),k.delete(t))}function I(t){try{t.child.kill("SIGTERM")}catch{}setTimeout(()=>{try{t.child.kill("SIGKILL")}catch{}},2e3).unref?.()}t.s(["beginCodingLimbRun",0,function(t,n){if(4!==n&&20!==n||S.has(t))return;let r=s.messages.getById(t),o=r?i(r.content):null;if(!o||"running"!==o.state)return;let l={child:void 0,stopped:!1,agentId:void 0,runId:void 0},u=(0,e.spawn)("/bin/sleep",[String(n)],{stdio:"ignore"});l.child=u,S.set(t,l),u.on("error",()=>{l.stopped=!0,b(t,u),m(t)}),u.on("exit",async(e,n)=>{if(b(t,u),l.stopped||!c(t,l)||n||0!==e||l.stopped||!c(t,l)){l.stopped&&m(t);return}try{let e=process.env.CURSOR_API_KEY;if(!e){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Error: CURSOR_API_KEY not set"}));return}let n=await fetch("https://api.cursor.com/v1/agents",{method:"POST",headers:{Authorization:`Bearer ${e}`,"Content-Type":"application/json"},body:JSON.stringify({prompt:{text:"Which file holds parsePublicPageReadAsk in not-so-fat/botmancers? Reply with the path. Do not edit, commit, push, or open a pull request."},repos:[{url:"https://github.com/not-so-fat/botmancers",startingRef:"main"}],autoCreatePR:!1,mode:"plan"})});if(l.stopped||!c(t,l)){l.stopped&&m(t);return}if(!n.ok){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:`Create failed: ${n.status}`}));return}let r=await n.json(),o=r.agent?.id,i=r.run?.id;if(!o||!i){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Error: No agent or run ID returned"}));return}if(l.agentId=o,l.runId=i,l.stopped||!c(t,l)){await v(o,i),l.stopped&&m(t);return}let u=0;for(;u<120;){if(await new Promise(t=>setTimeout(t,2e3)),u++,l.stopped||!c(t,l)){await v(o,i),l.stopped&&m(t);return}let n=await fetch(`https://api.cursor.com/v1/agents/${o}/runs/${i}`,{headers:{Authorization:`Bearer ${e}`}});if(!n.ok){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:`Poll failed: ${n.status}`}));return}let r=await n.json();if(l.stopped||!c(t,l)){await v(o,i),l.stopped&&m(t);return}if("FINISHED"===r.status){if("string"==typeof r.result&&c(t,l))return void s.messages.replaceContent(t,a({state:"done",output:r.result}));!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Error: No result in response"}));return}if("FAILED"===r.status||"CANCELLED"===r.status){!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:`Run ${r.status.toLowerCase()}`}));return}}!l.stopped&&c(t,l)&&s.messages.replaceContent(t,a({state:"done",output:"Timeout waiting for result"}))}catch(e){if(!l.stopped&&c(t,l)){let n=e instanceof Error?e.message.slice(0,40):"Unknown";s.messages.replaceContent(t,a({state:"done",output:`Network error: ${n}`}))}}})},"beginCommandRun",0,function(t,n,r={}){let o=(0,u.validateCommandRequest)({command:n.command,args:n.args,waitSeconds:n.waitSeconds}),l=(0,u.resolveCommand)({command:o.command,args:o.args});if(k.has(t))return;let p=s.messages.getById(t),d=p?i(p.content):null;if(!d||"running"!==d.state)return;let f=r.timeoutMs??(0,u.commandTimeoutMs)(o.waitSeconds),g=r.outputMaxBytes??u.COMMAND_OUTPUT_MAX_BYTES,h={child:void 0,stopped:!1},_=(0,e.spawn)("/bin/sleep",[String(o.waitSeconds)],{stdio:"ignore"});h.child=_,k.set(t,h);let y=()=>{h.stopped=!0,x(t,h.child),m(t)};h.timer=setTimeout(()=>{I(h),y()},f),h.timer.unref?.(),s.messages.replaceContent(t,a({state:"running",page:(0,u.commandRunPage)(o,null)})),_.on("error",()=>{I(h),y()}),_.on("exit",(n,r)=>{if(h.stopped||!c(t,h)||r||0!==n){h.stopped&&(x(t,_),m(t));return}let i="",p=!1,d=(0,e.spawn)(l.bin,l.argv,{stdio:["ignore","pipe","ignore"]});h.child=d,k.set(t,h),d.stdout?.on("data",t=>{!p&&(i+=t.toString("utf8"),Buffer.byteLength(i,"utf8")>g&&(p=!0,i=Buffer.from(i,"utf8").subarray(0,g).toString("utf8"),I({child:d})))}),d.on("error",()=>{I(h),y()}),d.on("close",(e,n)=>{if(x(t,d),h.stopped||!c(t,h)){h.stopped&&m(t);return}if((n||0!==e)&&!p)return void m(t);let r=(0,u.commandRunPage)(o,i);s.messages.replaceContent(t,a({state:"done",output:i,page:r}))}),(h.stopped||!c(t,h))&&I(h)})},"beginFileReadRun",0,function(t,n){if(4!==n&&20!==n||d.has(t))return;let r=s.messages.getById(t),o=r?i(r.content):null;if(!o||"running"!==o.state||!g())return;let l={child:void 0,stopped:!1},u=(0,e.spawn)("/bin/sleep",[String(n)],{stdio:"ignore"});l.child=u,d.set(t,l),u.on("error",()=>{l.stopped=!0,f(t,u),m(t)}),u.on("exit",(n,r)=>{if(f(t,u),l.stopped||!c(t,l)||r||0!==n){l.stopped&&m(t);return}let o=g();if(!o||l.stopped){l.stopped&&m(t);return}let i="",p=(0,e.spawn)("/bin/cat",[o],{stdio:["ignore","pipe","ignore"]});if(l.child=p,d.set(t,l),p.stdout?.on("data",t=>{i+=t.toString("utf8")}),p.on("error",()=>{l.stopped=!0,f(t,p),m(t)}),p.on("close",(e,n)=>{if(f(t,p),!c(t,l)||n||0!==e){l.stopped&&m(t);return}let r=i.endsWith("\n")?i.slice(0,-1):"";i===r+"\n"&&"filemint6"===r&&s.messages.replaceContent(t,a({state:"done",output:r}))}),l.stopped||!c(t,l))try{p.kill("SIGTERM")}catch{}})},"beginPublicPageReadRun",0,function(t,n,r){if(4!==n&&20!==n||_.has(t))return;let o=s.messages.getById(t),l=o?i(o.content):null;if(!l||"running"!==l.state)return;let u={child:void 0,stopped:!1},p=(0,e.spawn)("/bin/sleep",[String(n)],{stdio:"ignore"});u.child=p,_.set(t,u),p.on("error",()=>{u.stopped=!0,y(t,p),m(t)}),p.on("exit",async(e,n)=>{if(y(t,p),u.stopped||!c(t,u)||n||0!==e||u.stopped||!c(t,u)){u.stopped&&m(t);return}try{if(r){let e,n=new URL(r),o=await R(r,n.hostname);if(u.stopped||!c(t,u)||(s.messages.replaceContent(t,a({state:"running",page:o})),await new Promise(t=>setTimeout(t,3e3)),u.stopped||!c(t,u))){u.stopped&&m(t);return}let i=(e=o.match(/<title[^>]*>([\s\S]*?)<\/title>/i))&&e[1].replace(/<[^>]+>/g,"").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&apos;/g,"'").replace(/\s+/g," ").trim()||null;i&&c(t,u)&&s.messages.replaceContent(t,a({state:"done",output:i,page:o}))}else{let e=await R("https://example.com","example.com");if(u.stopped||!c(t,u)){u.stopped&&m(t);return}let n=function(t){let e=t.match(/<title[^>]*>([^<]*)<\/title>/i);if(e&&e[1]){let t=e[1].trim().split(/\s+/)[0];if(t)return t}let n=t.match(/<h1[^>]*>([^<]*)<\/h1>/i);if(n&&n[1]){let t=n[1].trim().split(/\s+/)[0];if(t)return t}return null}(e);"Example"===n&&c(t,u)&&s.messages.replaceContent(t,a({state:"done",output:"Example"}))}}catch(t){console.error("Public page fetch failed:",t)}})},"stopCodingLimbRun",0,function(t){let e=S.get(t);if(e&&(e.stopped=!0,e.agentId&&e.runId&&v(e.agentId,e.runId).catch(()=>{})),m(t),e){try{e.child.kill("SIGTERM")}catch{}b(t,e.child)}},"stopCommandRun",0,function(t){let e=k.get(t);e&&(e.stopped=!0),m(t),e&&(I(e),x(t,e.child))},"stopFileReadRun",0,function(t){let e=d.get(t);if(e&&(e.stopped=!0),m(t),e){try{e.child.kill("SIGTERM")}catch{}f(t,e.child)}},"stopPublicPageReadRun",0,function(t){let e=_.get(t);if(e&&(e.stopped=!0),m(t),e){try{e.child.kill("SIGTERM")}catch{}y(t,e.child)}}],2803)},10860,t=>{"use strict";var e=t.i(22734),n=t.i(14747),r=t.i(52036);function s(t){if(!/^[A-Za-z0-9_-]+$/.test(t))return null;let s=(0,r.skillsRootPath)(),o=n.default.resolve(s,t,"SKILL.md");if(!o.startsWith(s+n.default.sep))return null;try{let t=e.default.readFileSync(o,"utf8");return t.trim()?t:null}catch{return null}}function o(t){return/^[A-Za-z0-9_-]+$/.test(t)}function i(t){if(!t)return null;let e=s(t);if(!e)return null;let n=e.match(/ends with the exact token\s+(\S+)/i);return n?n[1]:null}function a(t){return o(t)?`skills/${t}/SKILL.md`:null}t.s(["applySkillEndToken",0,function(t,e){let n=i(t);return n?e?e.trimEnd().endsWith(n)?e:e+"\n"+n:n:e},"isSupportedSkillName",0,o,"localSkillForBot",0,s,"readSkillState",0,function(t){let e=a(t);if(!e)return{path:null,present:!1,content:null,status:"unsupported"};let n=s(t);return null===n?{path:e,present:!1,content:null,status:"absent"}:{path:e,present:!0,content:n,status:"present"}},"skillEndToken",0,i,"writeSkillForBot",0,function(t,s){let o=a(t);if(!o)throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");let i=(0,r.skillsRootPath)(),l=n.default.resolve(i,t,"SKILL.md");if(!l.startsWith(i+n.default.sep))throw Error("Skill files need a bot name matching /^[A-Za-z0-9_-]+$/");if(!s.trim()){try{e.default.rmSync(l)}catch{}return{path:o,present:!1,content:null,status:"absent"}}return e.default.mkdirSync(n.default.dirname(l),{recursive:!0}),e.default.writeFileSync(l,s),{path:o,present:!0,content:s,status:"present"}}])},38636,(t,e,n)=>{let{createHash:r}=t.r(54799);function s(t){if(Array.isArray(t))return t.map(s);if(null!==t&&"object"==typeof t){let e={};for(let n of Object.keys(t).sort())e[n]=s(t[n]);return e}return t}function o(t){return JSON.stringify(s(t))}function i(t){return null==t?null:String(t)}function a(t){return null==t?null:String(t).trim()||null}e.exports={sortKeysDeep:s,canonicalJson:o,hashSnapshot:function(t){return r("sha256").update(o(t),"utf8").digest("hex")},buildSnapshotInput:function(t,e,n=null){return{agent:a(t.agent)||"hermes",avatar_accessory:i(t.avatar_accessory),avatar_color:i(t.avatar_color),avatar_eyes:i(t.avatar_eyes),avatar_hands:i(t.avatar_hands),default_workspace:a(t.default_workspace),description:null===t.description||void 0===t.description?"":String(t.description),import_operation_id:i(t.import_operation_id),import_schema_version:i(t.import_schema_version),memories:null==n?null:n.map(t=>String(t)),name:String(t.name),runtime_connection_id:a(t.runtime_connection_id),skill_content:i(e.content),skill_path:i(e.path),skill_present:null===e.present||void 0===e.present?null:!!e.present,source_provider:i(t.source_provider),template_id:i(t.template_id),template_url:i(t.template_url),title:null===t.title||void 0===t.title?"":String(t.title),working_directory:a(t.working_directory)}}}}];
2
2
 
3
3
  //# sourceMappingURL=%5Broot-of-the-server%5D__17mum5-._.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),n=e.i(14747),s=e.i(52036);let a="/v1/chat/completions";class i 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 i("aborted","Hermes request aborted")}async function d(e){var t;let r,n,{config:s,profilePath:a,sessionId:o,messages:d,signal:u}=e,c=e.fetchImpl||((e,t)=>fetch(e,t)),_=(t=s.baseUrl,r=t.replace(/\/+$/,""),n=a.startsWith("/")?a:`/${a}`,`${r}${n}`),p=new AbortController,g=!1,m=setTimeout(()=>{g=!0,p.abort()},s.timeoutMs);m.unref&&m.unref();let f=()=>p.abort();if(u){if(u.aborted)throw clearTimeout(m),l(u,s.timeoutMs);u.addEventListener("abort",f,{once:!0})}try{let e,t;try{e=await c(_,{method:"POST",headers:{Authorization:`Bearer ${s.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":o},body:JSON.stringify({model:s.model,stream:!1,messages:d}),signal:p.signal})}catch(e){if(g)throw new i("timeout",`Hermes request timed out after ${s.timeoutMs} ms`);if(p.signal.aborted)throw l(u??p.signal,s.timeoutMs);throw new i("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 i("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new i("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(m),u&&u.removeEventListener("abort",f)}}e.s(["HERMES_DEFAULT_CHAT_PATH",0,a,"HermesError",0,i,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,s.waitLogPath)(e)}();r.default.mkdirSync(n.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,d,"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 a;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${a}`:a},"hermesSessionIdForBot",0,o,"loadHermesConfig",0,function(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let s=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",a=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",i=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:s.replace(/\/+$/,""),apiKey:n,timeoutMs:(r=Number(t=e.HERMES_TIMEOUT_MS),void 0!==t&&""!==t&&Number.isFinite(r)&&r>0?Math.floor(r):24e4),sessionPrefix:a,model:i}}])},91253,26571,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(54799),s=e.i(62294),a=e.i(52036);let i="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}$/,d=/^sha256:([0-9a-f]{64})$/;class u extends Error{constructor(e){super(e),this.name="ServiceTokenConfigError"}}function c(e){if(!e||!e.trim())return[];let t=[],r=new Set;for(let n of e.split(/[,\s]+/).filter(Boolean)){let e=n.indexOf("="),s=e>0?n.slice(0,e):"",a=d.exec(e>0?n.slice(e+1).toLowerCase():"");if(!l.test(s)||!a)throw new u(`${i} entries must be <service-id>=sha256:<64 hex digits>.`);if(r.has(s))throw new u(`${i} lists service ${s} twice.`);if(o.includes(s))throw new u(`${i} names the reserved engine principal ${s}.`);r.add(s),t.push({serviceId:s,digest:Buffer.from(a[1],"hex")})}return t}e.s(["RESERVED_SERVICE_IDS",0,o,"SERVICE_TOKENS_ENV",0,i,"ServiceTokenConfigError",0,u,"parseServiceTokens",0,c,"serviceTokenAuthenticatorFromEnv",0,function(e=process.env){let t=c(e[i]);return t.length?e=>{let r,s,a=(s=(r=e.headers.get("authorization"))?/^Bearer[ \t]+(\S+)[ \t]*$/i.exec(r):null)?s[1]:null;if(!a||a.length>4096)return null;let i=(0,n.createHash)("sha256").update(a,"utf8").digest(),o=null;for(let e of t)(0,n.timingSafeEqual)(i,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}$/,g=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;class m extends Error{constructor(e){super(e),this.name="ServiceGrantsError"}}function f(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function h(e,t,r){let n=Object.keys(e).find(e=>!t.includes(e));if(void 0!==n)throw new m(`${r} has an unknown field "${n}".`)}let E=null;e.s(["EXCHANGE_KEY_PREFIX",0,"exchange:","MESSAGE_KEY_PREFIX",0,"message:","SERVICE_CAPABILITIES",0,_,"loadServiceGrants",0,function(e=process.env){let l,d=function(e=process.env){let t=(e.BOTMANCERS_SERVICE_GRANTS_PATH||"").trim();if(t)return r.default.resolve(t);let n=(0,a.botmancersHome)(e);return n?r.default.join(n,"config/service-grants.json"):null}(e);if(!d)return{state:"absent",path:null};try{l=t.default.statSync(d)}catch(e){if("ENOENT"===e.code)return{state:"absent",path:d};return{state:"invalid",path:d,reason:"The document cannot be read."}}let b=(0,n.createHash)("sha256").update(e[i]??"","utf8").digest("hex"),S=new Set(s.default.prepare("SELECT id FROM bots").all().map(e=>e.id)),v=(0,n.createHash)("sha256").update([...S].sort().join("\n"),"utf8").digest("hex"),w=[d,l.ino,l.size,l.mode,l.uid,l.mtimeMs,b,v].join(":");if(E&&E.key===w)return E.state;let A=function(e,r,n,s){let a;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 n)return{state:"invalid",path:e,reason:n};if(r.size>65536)return{state:"invalid",path:e,reason:"The document exceeds 65536 bytes."};try{a=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 n;try{n=JSON.parse(e)}catch{throw new m("The document is not valid JSON.")}if(!f(n))throw new m("The document must be a JSON object.");if(h(n,["version","grants"],"The document"),1!==n.version)throw new m("version must be 1.");if(!Array.isArray(n.grants))throw new m("grants must be a list.");if(n.grants.length>512)throw new m("grants has more than 512 entries.");let s=new Map;return n.grants.forEach((e,n)=>{let a=`grants[${n}]`;if(!f(e))throw new m(`${a} must be an object.`);h(e,["service","agent","capabilities"],a);let{service:l,agent:d,capabilities:u}=e;if("string"!=typeof l||!p.test(l))throw new m(`${a}.service must be a configured service id (letters, digits, ".", "_", "-").`);if(o.includes(l))throw new m(`${a}.service names a reserved engine principal.`);if(t&&!t.has(l))throw new m(`${a}.service is not a configured service principal (${i}).`);if("string"!=typeof d||!g.test(d))throw new m(`${a}.agent must be one Agent id; wildcards are not allowed.`);if(r&&!r.has(d))throw new m(`${a}.agent is not a registered Agent.`);if(!Array.isArray(u)||0===u.length)throw new m(`${a}.capabilities must list at least one capability.`);let c=new Set;for(let e of u){if(!("string"==typeof e&&_.includes(e)))throw new m(`${a}.capabilities has an unknown capability.`);if(c.has(e))throw new m(`${a}.capabilities lists ${e} twice.`);c.add(e)}let E=s.get(l)??new Map;if(E.has(d))throw new m(`${a} repeats the grant of service ${l} for that Agent.`);E.set(d,c),s.set(l,E)}),s}(a,n,s)}}catch(t){if(t instanceof m)return{state:"invalid",path:e,reason:t.message};throw t}}(d,l,function(e){try{return new Set(c(e[i]).map(e=>e.serviceId))}catch(e){if(e instanceof u)return`${i} is malformed, so no grant can name a configured service.`;throw e}}(e),S);return E={key:w,state:A},A}],91253)},90027,e=>{"use strict";var t=e.i(62349),r=e.i(28420);let n=["active","ended","all"],s=["implementation","revision"],a=`
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
+ `,i=`
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 o(e){return`${new Date(e).toISOString().slice(0,16).replace("T"," ")} UTC`}function l(e,t){let r=e?.[t];return"string"==typeof r&&r.trim().length>0?r:null}function d(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,r.emptyUsage)()){let a,i=null;try{i=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let c=d(e),_=null===e.released_at?"active":"ended",p=((a=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?a.length>80?`${a.slice(0,79).trimEnd()}…`:a:null)??(c?.kind==="group"?c.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:l(i,"transport")},title:p,status:_,resumable:null===e.released_at&&null!==e.request_id&&null!==e.request_kind&&s.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:c,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:l(i,"cwd")??e.ps_workspace??null},usage:n}}function c(e,t=(0,r.emptyUsage)()){let n=e.provider_created_at??e.created_at,s=null===e.resumable?null:1===e.resumable,a="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:s,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,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 p(e,t,r){return e.prepare(`${i} AND ps.id = ? AND ps.agent_id = ?`).get(r,t)}function g(e,t,r){return e.prepare(`${a} 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?d(r):null},"getAgentSession",0,function(e,t,n){let s=g(e,t,n);if(!s){let s=p(e,t,n);if(!s)return;let{usage:a,samples:i}=(0,r.sessionUsageSamples)(e,t,n);return{...c(s,a),attempts:[],usage_samples:i}}let a=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(s.source_attempt_id,s.source_attempt_id,s.id),{usage:i,samples:o}=(0,r.sessionUsageSamples)(e,t,n);return{...u(s,i),attempts:a,usage_samples:o}},"isSessionFilter",0,function(e){return"string"==typeof e&&n.includes(e)},"listAgentSessions",0,function(e,t,n="all"){let s=e.prepare(`${a} 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),l=(0,r.agentSessionUsage)(e,t);return[...s.map(e=>u(e,l.get(e.id))),...o.map(e=>c(e,l.get(e.id)))].sort(_)},"sessionDebugExternalId",0,function(e,t,r){let n=g(e,t,r)?.external_session_id;if(void 0!==n)return n;if(!p(e,t,r))return;let s=e.prepare("SELECT provider_session_id FROM provider_sessions WHERE id = ? AND agent_id = ?").get(r,t);return s?.provider_session_id},"sessionTitle",0,function(e,t,r){let n=g(e,t,r);if(n)return u(n).title;let s=p(e,t,r);return s?c(s).title:null}])}];
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