botmancers 0.3.0 → 0.4.2

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 (357) hide show
  1. package/CHANGELOG.md +79 -1
  2. package/README.md +162 -21
  3. package/app/.next/BUILD_ID +1 -1
  4. package/app/.next/app-path-routes-manifest.json +20 -1
  5. package/app/.next/build-manifest.json +3 -3
  6. package/app/.next/prerender-manifest.json +32 -4
  7. package/app/.next/required-server-files.json +2 -2
  8. package/app/.next/routes-manifest.json +143 -0
  9. package/app/.next/server/app/_global-error/page.js +1 -1
  10. package/app/.next/server/app/_global-error/page.js.nft.json +1 -1
  11. package/app/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  12. package/app/.next/server/app/_global-error.html +1 -1
  13. package/app/.next/server/app/_global-error.rsc +1 -1
  14. package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  15. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  16. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  17. package/app/.next/server/app/_not-found/page.js +1 -1
  18. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/app/.next/server/app/_not-found.html +1 -1
  21. package/app/.next/server/app/_not-found.rsc +2 -2
  22. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  23. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  24. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  25. package/app/.next/server/app/api/agent-deck/decks/route.js +2 -2
  26. package/app/.next/server/app/api/agent-deck/decks/route.js.nft.json +1 -1
  27. package/app/.next/server/app/api/agent-deck/settings/route.js +2 -2
  28. package/app/.next/server/app/api/agent-deck/settings/route.js.nft.json +1 -1
  29. package/app/.next/server/app/api/bots/[id]/config/route.js +2 -2
  30. package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
  31. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route/app-paths-manifest.json +3 -0
  32. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route/build-manifest.json +12 -0
  33. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route/server-reference-manifest.json +4 -0
  34. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js +9 -0
  35. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -0
  36. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route_client-reference-manifest.js +3 -0
  37. package/app/.next/server/app/api/bots/[id]/sessions/route/app-paths-manifest.json +3 -0
  38. package/app/.next/server/app/api/bots/[id]/sessions/route/build-manifest.json +12 -0
  39. package/app/.next/server/app/api/bots/[id]/sessions/route/server-reference-manifest.json +4 -0
  40. package/app/.next/server/app/api/bots/[id]/sessions/route.js +9 -0
  41. package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -0
  42. package/app/.next/server/app/api/bots/[id]/sessions/route_client-reference-manifest.js +3 -0
  43. package/app/.next/server/app/api/bots/[id]/skill/route.js +2 -2
  44. package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
  45. package/app/.next/server/app/api/bots/availability/route.js +1 -1
  46. package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
  47. package/app/.next/server/app/api/bots/delete-preview/route.js +3 -3
  48. package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
  49. package/app/.next/server/app/api/bots/import/route.js +2 -2
  50. package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
  51. package/app/.next/server/app/api/bots/manage/route.js +2 -2
  52. package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
  53. package/app/.next/server/app/api/bots/name-migrations/route.js +2 -2
  54. package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
  55. package/app/.next/server/app/api/bots/route.js +6 -6
  56. package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
  57. package/app/.next/server/app/api/conversations/[id]/approve/route.js +2 -2
  58. package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
  59. package/app/.next/server/app/api/conversations/[id]/deny/route.js +2 -2
  60. package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
  61. package/app/.next/server/app/api/conversations/[id]/draft/route.js +2 -2
  62. package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
  63. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js +2 -2
  64. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
  65. package/app/.next/server/app/api/conversations/[id]/messages/route.js +6 -6
  66. package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
  67. package/app/.next/server/app/api/conversations/[id]/route.js +2 -2
  68. package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
  69. package/app/.next/server/app/api/conversations/[id]/stop/route.js +3 -3
  70. package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
  71. package/app/.next/server/app/api/conversations/route.js +2 -2
  72. package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
  73. package/app/.next/server/app/api/exchanges/[id]/cancel/route/app-paths-manifest.json +3 -0
  74. package/app/.next/server/app/api/exchanges/[id]/cancel/route/build-manifest.json +12 -0
  75. package/app/.next/server/app/api/exchanges/[id]/cancel/route/server-reference-manifest.json +4 -0
  76. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +11 -0
  77. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -0
  78. package/app/.next/server/app/api/exchanges/[id]/cancel/route_client-reference-manifest.js +3 -0
  79. package/app/.next/server/app/api/exchanges/[id]/route/app-paths-manifest.json +3 -0
  80. package/app/.next/server/app/api/exchanges/[id]/route/build-manifest.json +12 -0
  81. package/app/.next/server/app/api/exchanges/[id]/route/server-reference-manifest.json +4 -0
  82. package/app/.next/server/app/api/exchanges/[id]/route.js +11 -0
  83. package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -0
  84. package/app/.next/server/app/api/exchanges/[id]/route_client-reference-manifest.js +3 -0
  85. package/app/.next/server/app/api/exchanges/route/app-paths-manifest.json +3 -0
  86. package/app/.next/server/app/api/exchanges/route/build-manifest.json +12 -0
  87. package/app/.next/server/app/api/exchanges/route/server-reference-manifest.json +4 -0
  88. package/app/.next/server/app/api/exchanges/route.js +12 -0
  89. package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -0
  90. package/app/.next/server/app/api/exchanges/route_client-reference-manifest.js +3 -0
  91. package/app/.next/server/app/api/files/[name]/route.js +1 -1
  92. package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
  93. package/app/.next/server/app/api/groups/route.js +2 -2
  94. package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
  95. package/app/.next/server/app/api/health/route.js.nft.json +1 -1
  96. package/app/.next/server/app/api/import-capabilities/route.js +1 -1
  97. package/app/.next/server/app/api/import-capabilities/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/marketplace-handoff/route.js +1 -1
  99. package/app/.next/server/app/api/marketplace-handoff/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/marketplace-handoff/status/route.js +1 -1
  101. package/app/.next/server/app/api/marketplace-handoff/status/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/mcp/route.js +2 -2
  103. package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
  104. package/app/.next/server/app/api/messages/[id]/between/route.js +2 -2
  105. package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
  106. package/app/.next/server/app/api/service-grants/route/app-paths-manifest.json +3 -0
  107. package/app/.next/server/app/api/service-grants/route/build-manifest.json +12 -0
  108. package/app/.next/server/app/api/service-grants/route/server-reference-manifest.json +4 -0
  109. package/app/.next/server/app/api/service-grants/route.js +9 -0
  110. package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -0
  111. package/app/.next/server/app/api/service-grants/route_client-reference-manifest.js +3 -0
  112. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route/app-paths-manifest.json +3 -0
  113. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route/build-manifest.json +12 -0
  114. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route/server-reference-manifest.json +4 -0
  115. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +11 -0
  116. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -0
  117. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route_client-reference-manifest.js +3 -0
  118. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route/app-paths-manifest.json +3 -0
  119. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route/build-manifest.json +12 -0
  120. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route/server-reference-manifest.json +4 -0
  121. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +11 -0
  122. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -0
  123. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route_client-reference-manifest.js +3 -0
  124. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +4 -3
  125. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
  126. package/app/.next/server/app/api/v0/agents/[agentId]/route/app-paths-manifest.json +3 -0
  127. package/app/.next/server/app/api/v0/agents/[agentId]/route/build-manifest.json +12 -0
  128. package/app/.next/server/app/api/v0/agents/[agentId]/route/server-reference-manifest.json +4 -0
  129. package/app/.next/server/app/api/v0/agents/[agentId]/route.js +11 -0
  130. package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -0
  131. package/app/.next/server/app/api/v0/agents/[agentId]/route_client-reference-manifest.js +3 -0
  132. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route/app-paths-manifest.json +3 -0
  133. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route/build-manifest.json +12 -0
  134. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route/server-reference-manifest.json +4 -0
  135. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +11 -0
  136. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -0
  137. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route_client-reference-manifest.js +3 -0
  138. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route/app-paths-manifest.json +3 -0
  139. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route/build-manifest.json +12 -0
  140. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route/server-reference-manifest.json +4 -0
  141. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +11 -0
  142. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -0
  143. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route_client-reference-manifest.js +3 -0
  144. package/app/.next/server/app/api/v0/agents/route/app-paths-manifest.json +3 -0
  145. package/app/.next/server/app/api/v0/agents/route/build-manifest.json +12 -0
  146. package/app/.next/server/app/api/v0/agents/route/server-reference-manifest.json +4 -0
  147. package/app/.next/server/app/api/v0/agents/route.js +11 -0
  148. package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -0
  149. package/app/.next/server/app/api/v0/agents/route_client-reference-manifest.js +3 -0
  150. package/app/.next/server/app/api/v0/capabilities/route/app-paths-manifest.json +3 -0
  151. package/app/.next/server/app/api/v0/capabilities/route/build-manifest.json +12 -0
  152. package/app/.next/server/app/api/v0/capabilities/route/server-reference-manifest.json +4 -0
  153. package/app/.next/server/app/api/v0/capabilities/route.js +11 -0
  154. package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -0
  155. package/app/.next/server/app/api/v0/capabilities/route_client-reference-manifest.js +3 -0
  156. package/app/.next/server/app/api/v0/conversations/[id]/route.js +4 -3
  157. package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
  158. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route/app-paths-manifest.json +3 -0
  159. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route/build-manifest.json +12 -0
  160. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route/server-reference-manifest.json +4 -0
  161. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +11 -0
  162. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -0
  163. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route_client-reference-manifest.js +3 -0
  164. package/app/.next/server/app/api/v0/exchanges/[id]/route/app-paths-manifest.json +3 -0
  165. package/app/.next/server/app/api/v0/exchanges/[id]/route/build-manifest.json +12 -0
  166. package/app/.next/server/app/api/v0/exchanges/[id]/route/server-reference-manifest.json +4 -0
  167. package/app/.next/server/app/api/v0/exchanges/[id]/route.js +11 -0
  168. package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -0
  169. package/app/.next/server/app/api/v0/exchanges/[id]/route_client-reference-manifest.js +3 -0
  170. package/app/.next/server/app/api/v0/exchanges/route/app-paths-manifest.json +3 -0
  171. package/app/.next/server/app/api/v0/exchanges/route/build-manifest.json +12 -0
  172. package/app/.next/server/app/api/v0/exchanges/route/server-reference-manifest.json +4 -0
  173. package/app/.next/server/app/api/v0/exchanges/route.js +11 -0
  174. package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -0
  175. package/app/.next/server/app/api/v0/exchanges/route_client-reference-manifest.js +3 -0
  176. package/app/.next/server/app/api/v0/mcp/route.js +5 -3
  177. package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
  178. package/app/.next/server/app/api/v0/requests/[id]/route.js +4 -3
  179. package/app/.next/server/app/api/v0/requests/[id]/route.js.nft.json +1 -1
  180. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route/app-paths-manifest.json +3 -0
  181. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route/build-manifest.json +12 -0
  182. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route/server-reference-manifest.json +4 -0
  183. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js +11 -0
  184. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -0
  185. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route_client-reference-manifest.js +3 -0
  186. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +5 -5
  187. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
  188. package/app/.next/server/app/api/wakes/[id]/decision/route.js +5 -5
  189. package/app/.next/server/app/api/wakes/[id]/decision/route.js.nft.json +1 -1
  190. package/app/.next/server/app/api/wakes/[id]/retry/route.js +5 -5
  191. package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
  192. package/app/.next/server/app/bots/[id]/config/page.js +1 -1
  193. package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
  194. package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
  195. package/app/.next/server/app/exchanges/page/app-paths-manifest.json +3 -0
  196. package/app/.next/server/app/exchanges/page/build-manifest.json +20 -0
  197. package/app/.next/server/app/exchanges/page/next-font-manifest.json +11 -0
  198. package/app/.next/server/app/exchanges/page/react-loadable-manifest.json +1 -0
  199. package/app/.next/server/app/exchanges/page/server-reference-manifest.json +4 -0
  200. package/app/.next/server/app/exchanges/page.js +13 -0
  201. package/app/.next/server/app/exchanges/page.js.nft.json +1 -0
  202. package/app/.next/server/app/exchanges/page_client-reference-manifest.js +3 -0
  203. package/app/.next/server/app/exchanges.html +1 -0
  204. package/app/.next/server/app/exchanges.meta +34 -0
  205. package/app/.next/server/app/exchanges.rsc +22 -0
  206. package/app/.next/server/app/exchanges.segments/_full.segment.rsc +22 -0
  207. package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +4 -0
  208. package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +26 -0
  209. package/app/.next/server/app/index.html +1 -1
  210. package/app/.next/server/app/index.rsc +3 -3
  211. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  212. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  213. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  214. package/app/.next/server/app/page.js +1 -1
  215. package/app/.next/server/app/page.js.nft.json +1 -1
  216. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  217. package/app/.next/server/app/settings/page.js +1 -1
  218. package/app/.next/server/app/settings/page.js.nft.json +1 -1
  219. package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  220. package/app/.next/server/app/settings.html +1 -1
  221. package/app/.next/server/app/settings.rsc +2 -2
  222. package/app/.next/server/app/settings.segments/_full.segment.rsc +2 -2
  223. package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  224. package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +2 -2
  225. package/app/.next/server/app/threads/[id]/page/app-paths-manifest.json +3 -0
  226. package/app/.next/server/app/threads/[id]/page/build-manifest.json +20 -0
  227. package/app/.next/server/app/threads/[id]/page/next-font-manifest.json +11 -0
  228. package/app/.next/server/app/threads/[id]/page/react-loadable-manifest.json +1 -0
  229. package/app/.next/server/app/threads/[id]/page/server-reference-manifest.json +4 -0
  230. package/app/.next/server/app/threads/[id]/page.js +13 -0
  231. package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -0
  232. package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +3 -0
  233. package/app/.next/server/app-paths-manifest.json +20 -1
  234. package/app/.next/server/chunks/0ivl_api_v0_agents_[agentId]_conversations_[conversationId]_route_actions_0lvijtu.js +3 -0
  235. package/app/.next/server/chunks/1oeh_server_app_api_v0_agents_[agentId]_conversations_route_actions_0ko3117.js +3 -0
  236. package/app/.next/server/chunks/1oeh_server_app_api_v0_agents_[agentId]_sessions_[ref]_route_actions_0o7q3vt.js +3 -0
  237. package/app/.next/server/chunks/{[externals]__18bqksw._.js → [externals]__06lqs5i._.js} +1 -1
  238. package/app/.next/server/chunks/{[root-of-the-server]__1vxmbdl._.js → [root-of-the-server]__0-45blq._.js} +1 -1
  239. package/app/.next/server/chunks/[root-of-the-server]__0ab4e_k._.js +1 -1
  240. package/app/.next/server/chunks/[root-of-the-server]__0izjfmr._.js +285 -53
  241. package/app/.next/server/chunks/{[root-of-the-server]__07l_rgn._.js → [root-of-the-server]__0j0i8xz._.js} +1 -1
  242. package/app/.next/server/chunks/[root-of-the-server]__0wtzcge._.js +3 -0
  243. package/app/.next/server/chunks/{[root-of-the-server]__19hjzs0._.js → [root-of-the-server]__15hknun._.js} +1 -1
  244. package/app/.next/server/chunks/{[root-of-the-server]__08i4wq6._.js → [root-of-the-server]__16ikszu._.js} +1 -1
  245. package/app/.next/server/chunks/{[root-of-the-server]__1khwkvb._.js → [root-of-the-server]__1c3e2ds._.js} +1 -1
  246. package/app/.next/server/chunks/[root-of-the-server]__1kvvdpx._.js +2 -2
  247. package/app/.next/server/chunks/[root-of-the-server]__1qoa704._.js +2 -2
  248. package/app/.next/server/chunks/[root-of-the-server]__1slu7d7._.js +7 -0
  249. package/app/.next/server/chunks/_06rti77._.js +30 -0
  250. package/app/.next/server/chunks/_09k38l1._.js +3 -0
  251. package/app/.next/server/chunks/_0dlg5kj._.js +30 -0
  252. package/app/.next/server/chunks/_0dyculb._.js +30 -0
  253. package/app/.next/server/chunks/_0eig2jc._.js +30 -0
  254. package/app/.next/server/chunks/_0ggf7vy._.js +1 -1
  255. package/app/.next/server/chunks/_0kghtb6._.js +3 -0
  256. package/app/.next/server/chunks/_0th2j4w._.js +1 -1
  257. package/app/.next/server/chunks/_0uz7r06._.js +30 -0
  258. package/app/.next/server/chunks/_0x05ts4._.js +3 -0
  259. package/app/.next/server/chunks/_0y3geoj._.js +30 -0
  260. package/app/.next/server/chunks/_1-5mthb._.js +1 -1
  261. package/app/.next/server/chunks/_12tq5uv._.js +30 -0
  262. package/app/.next/server/chunks/_147-4gl._.js +3 -0
  263. package/app/.next/server/chunks/_14ky6a2._.js +30 -0
  264. package/app/.next/server/chunks/_16kbxdt._.js +30 -0
  265. package/app/.next/server/chunks/_1963m2f._.js +30 -0
  266. package/app/.next/server/chunks/_1_34_h3._.js +30 -0
  267. package/app/.next/server/chunks/_1cc-2mx._.js +3 -0
  268. package/app/.next/server/chunks/_1inyx08._.js +1 -1
  269. package/app/.next/server/chunks/_1nurj3f._.js +30 -0
  270. package/app/.next/server/chunks/_1p2rf_n._.js +30 -0
  271. package/app/.next/server/chunks/_1u6tw78._.js +30 -0
  272. package/app/.next/server/chunks/_20azcus._.js +3 -0
  273. package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_sessions_[ref]_route_actions_02gp9-5.js +3 -0
  274. package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_sessions_route_actions_1s_wxg4.js +3 -0
  275. package/app/.next/server/chunks/_next-internal_server_app_api_exchanges_[id]_cancel_route_actions_0lh0fl4.js +3 -0
  276. package/app/.next/server/chunks/_next-internal_server_app_api_exchanges_[id]_route_actions_1w4jhin.js +3 -0
  277. package/app/.next/server/chunks/_next-internal_server_app_api_exchanges_route_actions_028wchg.js +3 -0
  278. package/app/.next/server/chunks/_next-internal_server_app_api_service-grants_route_actions_1459xk1.js +3 -0
  279. package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_[agentId]_route_actions_127sxvv.js +3 -0
  280. package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_[agentId]_sessions_route_actions_0pm6tcu.js +3 -0
  281. package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_route_actions_00azkhd.js +3 -0
  282. package/app/.next/server/chunks/_next-internal_server_app_api_v0_capabilities_route_actions_0d-eefd.js +3 -0
  283. package/app/.next/server/chunks/_next-internal_server_app_api_v0_exchanges_[id]_cancel_route_actions_1hb2q7i.js +3 -0
  284. package/app/.next/server/chunks/_next-internal_server_app_api_v0_exchanges_[id]_route_actions_098f50-.js +3 -0
  285. package/app/.next/server/chunks/_next-internal_server_app_api_v0_exchanges_route_actions_1ftmhhm.js +3 -0
  286. package/app/.next/server/chunks/_next-internal_server_app_api_v0_sessions_[ref]_messages_route_actions_1-rgf_k.js +3 -0
  287. package/app/.next/server/chunks/lib_0kik6bx._.js +1 -1
  288. package/app/.next/server/chunks/lib_0pe3tiv._.js +1 -1
  289. package/app/.next/server/chunks/lib_0t3s3rj._.js +30 -0
  290. package/app/.next/server/chunks/lib_0zxi6rx._.js +148 -0
  291. package/app/.next/server/chunks/lib_12udr7g._.js +148 -0
  292. package/app/.next/server/chunks/lib_service-api-http_ts_0xzqhny._.js +25 -0
  293. package/app/.next/server/chunks/lib_session-catalog_ts_1i7f38f._.js +30 -0
  294. package/app/.next/server/chunks/ssr/{[root-of-the-server]__0sq4frf._.js → [root-of-the-server]__03186rx._.js} +1 -1
  295. package/app/.next/server/chunks/ssr/[root-of-the-server]__03xw2d9._.js +3 -0
  296. package/app/.next/server/chunks/ssr/{[root-of-the-server]__1x7o-fe._.js → [root-of-the-server]__0zzcbqg._.js} +1 -1
  297. package/app/.next/server/chunks/ssr/{[root-of-the-server]__029oxo_._.js → [root-of-the-server]__1feicqq._.js} +1 -1
  298. package/app/.next/server/chunks/ssr/[root-of-the-server]__1t063pe._.js +3 -0
  299. package/app/.next/server/chunks/ssr/_00ysoah._.js +3 -0
  300. package/app/.next/server/chunks/ssr/_157wnb_._.js +3 -0
  301. package/app/.next/server/chunks/ssr/_1o94bnv._.js +1 -1
  302. package/app/.next/server/chunks/ssr/_next-internal_server_app_exchanges_page_actions_0hcso2x.js +3 -0
  303. package/app/.next/server/chunks/ssr/_next-internal_server_app_threads_[id]_page_actions_1fte2n3.js +3 -0
  304. package/app/.next/server/chunks/ssr/app_1-nwnha._.js +3 -0
  305. package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +3 -0
  306. package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +3 -0
  307. package/app/.next/server/chunks/ssr/node_modules_1nkgb45._.js +23 -0
  308. package/app/.next/server/chunks/ssr/node_modules_next_0x3i8za._.js +131 -0
  309. package/app/.next/server/middleware-build-manifest.js +3 -3
  310. package/app/.next/server/middleware.js +1 -1
  311. package/app/.next/server/next-font-manifest.js +1 -1
  312. package/app/.next/server/next-font-manifest.json +8 -0
  313. package/app/.next/server/pages/404.html +1 -1
  314. package/app/.next/server/pages/500.html +1 -1
  315. package/app/.next/server/prefetch-hints.json +14 -0
  316. package/app/.next/server/server-reference-manifest.js +1 -1
  317. package/app/.next/server/server-reference-manifest.json +1 -1
  318. package/app/.next/static/chunks/1i5xroz391zkb.js +1 -0
  319. package/app/.next/static/chunks/{3zqbpbm93yqzh.css → 1vz50l951sr9e.css} +1 -1
  320. package/app/.next/static/chunks/24ggj819yt3y6.js +1 -0
  321. package/app/.next/static/chunks/2_8lcalraul5s.js +3 -0
  322. package/app/.next/static/chunks/30i0-l04mmdvk.js +1 -0
  323. package/app/BUILD_INFO.json +2 -2
  324. package/app/package.json +1 -1
  325. package/app/server.js +1 -1
  326. package/dist/cli.d.ts +1 -1
  327. package/dist/cli.js +33 -5
  328. package/dist/clients.d.ts +86 -0
  329. package/dist/clients.js +635 -0
  330. package/dist/config.js +2 -2
  331. package/dist/contract.d.ts +6 -1
  332. package/dist/contract.js +28 -8
  333. package/dist/index.d.ts +1 -1
  334. package/dist/index.js +3 -3
  335. package/dist/managed.js +7 -0
  336. package/dist/product.d.ts +2 -0
  337. package/dist/product.js +6 -0
  338. package/dist/server.js +5 -4
  339. package/dist/upstream.js +21 -7
  340. package/package.json +7 -6
  341. package/schemas/botmancers.mcp.v2.tools.json +2981 -0
  342. package/skills/botmancers-collaboration/SKILL.md +99 -0
  343. package/skills/botmancers-collaboration/references/workflows.md +209 -0
  344. package/app/.next/server/chunks/[root-of-the-server]__09d-yrq._.js +0 -3
  345. package/app/.next/server/chunks/[root-of-the-server]__0za34e1._.js +0 -7
  346. package/app/.next/server/chunks/[root-of-the-server]__1fjpie4._.js +0 -3
  347. package/app/.next/server/chunks/[root-of-the-server]__1qanlbg._.js +0 -3
  348. package/app/.next/server/chunks/[root-of-the-server]__20wve4_._.js +0 -3
  349. package/app/.next/server/chunks/lib_051fv4x._.js +0 -111
  350. package/app/.next/server/chunks/lib_07adeq3._.js +0 -111
  351. package/app/.next/server/chunks/ssr/_0k_7i66._.js +0 -131
  352. package/app/.next/server/chunks/ssr/_1flnty7._.js +0 -23
  353. package/app/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a._.js +0 -3
  354. package/app/.next/static/chunks/0qbtymorcz-l9.js +0 -3
  355. /package/app/.next/static/{u4r8RPgEfpxk-DGXeKV6g → ewp56HqU5-d9bpFog3bli}/_buildManifest.js +0 -0
  356. /package/app/.next/static/{u4r8RPgEfpxk-DGXeKV6g → ewp56HqU5-d9bpFog3bli}/_clientMiddlewareManifest.js +0 -0
  357. /package/app/.next/static/{u4r8RPgEfpxk-DGXeKV6g → ewp56HqU5-d9bpFog3bli}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
1
  module.exports=[54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.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"))},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"))},56704,(e,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},50755,e=>{"use strict";var t=e.i(89171),r=e.i(20121);async function a(){return t.NextResponse.json({configured:(0,r.isMarketConfigured)()})}e.s(["GET",0,a,"dynamic",0,"force-dynamic"])},73744,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),o=e.i(74677),i=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),p=e.i(47587),c=e.i(66012),h=e.i(70101),x=e.i(26937),R=e.i(10372),v=e.i(93695),f=e.i(9580);e.i(52474);var m=e.i(220);let g=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/marketplace-handoff/status/route",pathname:"/api/marketplace-handoff/status",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/marketplace-handoff/status/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(50755),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:y,serverHooks:E}=g;async function C(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),g.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/marketplace-handoff/status/route";w=w.replace(/\/index$/,"")||"/";let y=await g.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!y)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:E,deploymentId:C,params:A,nextConfig:b,parsedUrl:T,isDraftMode:q,prerenderManifest:P,routerServerContext:k,isOnDemandRevalidate:S,revalidateOnlyGenerated:N,resolvedPathname:O,clientReferenceManifest:_,serverActionsManifest:j}=y,H=(0,i.normalizeAppPath)(w),U=!!P.routes[O]&&(g.isDev||(0,f.isRouteCacheOwner)(O,g.cacheOwner,P.routes[O])),M=!!(P.dynamicRoutes[H]||U),I=async()=>((null==k?void 0:k.render404)?await k.render404(e,t,T,!1):t.end("This page could not be found"),null);if(M&&!q){let e=P.dynamicRoutes[H];if(e&&!1===e.fallback&&!U){if(b.adapterPath)return await I();throw new v.NoFallbackError}}let D=null;!M||g.isDev||q||(D="/index"===(D=O)?"/":D);let L=!0===g.isDev||!M,K=M&&!L;j&&_&&(0,o.setManifestsSingleton)({page:w,clientReferenceManifest:_,serverActionsManifest:j});let F=e.method||"GET",$=(0,s.getTracer)(),B=$.getActiveScopeSpan(),G=!!(null==k?void 0:k.isWrappedByNextServer),V=!!(0,n.getRequestMeta)(e,"minimalMode"),X=(0,n.getRequestMeta)(e,"incrementalCache")||await g.getIncrementalCache(e,b,P,V);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let W={params:A,previewProps:P.preview,renderOpts:{experimental:{authInterrupts:!!b.experimental.authInterrupts,useCacheTimeout:b.experimental.useCacheTimeout},cacheComponents:!!b.cacheComponents,validationLevel:b.experimental.instantInsights.validationLevel,isDraftMode:q,supportsDynamicResponse:L,incrementalCache:X,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:b.cacheLife,staticPageGenerationTimeout:b.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>g.onRequestError(e,t,a,n,k)},sharedContext:{buildId:E,deploymentId:C}},z=new l.NodeNextRequest(e),Q=new l.NodeNextResponse(t),Z=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t)),J=async({previousCacheEntry:r})=>{try{if(!V&&S&&N&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let n=await g.handle(Z,W);e.fetchMetrics=W.renderOpts.fetchMetrics;let s=W.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let o=W.renderOpts.collectedTags;if(!M)return await (0,c.sendResponse)(z,Q,n,s),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);o&&(t[R.NEXT_CACHE_TAGS_HEADER]=o),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=R.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=R.INFINITE_CACHE?!1!==r&&r>0?b.expireTime:void 0:W.renderOpts.collectedExpire;return{value:{kind:m.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await g.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:S})},!1,k),t}},Y=async(n,o)=>{try{var i,l;let n=await g.handleResponse({req:e,nextConfig:b,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:P,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:N,responseGenerator:J,waitUntil:a.waitUntil,isMinimalMode:V});if(!M)return;if((null==n||null==(i=n.value)?void 0:i.kind)!==m.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});V||t.setHeader("x-nextjs-cache",S?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),q&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);V&&M||s.delete(R.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,x.getCacheControlHeader)(n.cacheControl)),await (0,c.sendResponse)(z,Q,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await g.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,p.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:S})},!1,k),M)throw t;await (0,c.sendResponse)(z,Q,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||H,i=`${F} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":i}),n.updateName(i),o&&o!==n&&(o.setAttribute("http.route",a),o.updateName(i))})()}};if(G&&B)await Y(B,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(d.BaseServerSpan.handleRequest,{spanName:`${F} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":F,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,C,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:y})},"routeModule",0,g,"serverHooks",0,E,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,y])},20121,e=>{"use strict";function t(e=process.env){return(e.CLONE_MARKET_URL||"").trim()}e.s(["buildHandoffDestination",0,function(e,r=process.env){let a,n=t(r);if(!n)return null;try{a=new URL(n)}catch{return null}return"http:"!==a.protocol&&"https:"!==a.protocol?null:(a.username="",a.password="",a.hash="",a.search="",a.searchParams.set("target","botmancers"),a.searchParams.set("return",e.toString()),a)},"cleanReturnUrl",0,function(e){let t;try{t=new URL(e)}catch{return null}return"http:"!==t.protocol&&"https:"!==t.protocol?null:(t.username="",t.password="",t.hash="",t)},"invalidHandoffQuery",0,function(e){let t=[...new URL(e.url).searchParams.keys()];return 1!==t.length||"return"!==t[0]},"isMarketConfigured",0,function(e=process.env){return t(e).length>0}])}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__07l_rgn._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0j0i8xz._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},43345,e=>{"use strict";var t=e.i(62294),r=e.i(26571),n=e.i(45383);let i=["authentication_unavailable","unauthenticated","principal_mismatch","agent_not_found","conversation_not_found","request_not_found"];async function a(e,r){let a,s=null,o=!1,c=null;try{a=await e(e=>{s=e},()=>{let e=s;r&&e&&"service"===e.kind&&t.serviceAudit.append({principal:e,operation:r.operation,capability:"participant",targetKind:r.targetKind,targetRef:r.targetRef,outcome:"allowed",code:null}),o=!0})}catch(e){if(e instanceof n.AgentApiError)c=e.code,a=Response.json({error:{code:e.code,message:e.message}},{status:e.status});else console.error("Agent conversation API error:",e),c="internal_error",a=Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}let d=s;if(o&&null===c)return a;if(r&&d&&"service"===d.kind)try{t.serviceAudit.append({principal:d,operation:r.operation,capability:"participant",targetKind:r.targetKind,targetRef:r.targetRef,outcome:null===c?"allowed":"internal_error"===c?"error":i.includes(c)?"denied":"rejected",code:c})}catch(e){return console.error("Service audit append failed:",e instanceof Error?e.message:"unknown error"),Response.json({error:{code:"internal_error",message:"The request could not be processed."}},{status:500})}return a}async function s(e){let t,i=function(){try{return(0,r.serviceTokenAuthenticatorFromEnv)()}catch(e){if(e instanceof r.ServiceTokenConfigError)return console.error(`Agent API authentication disabled: ${e.message}`),null;throw e}}();if(!i)throw new n.AgentApiError("authentication_unavailable","No authenticator is configured for the agent conversation API.");try{t=await i(e)}catch{t=null}if(!t||!(0,n.isPrincipalKind)(t.kind)||"string"!=typeof t.id||!t.id.trim())throw new n.AgentApiError("unauthenticated","Authentication failed.");return{kind:t.kind,id:t.id}}async function o(e,t){return a(async(r,i)=>{var a;let o,c=await s(e);r(c);try{let t=await e.json();if(!t||"object"!=typeof t||Array.isArray(t))throw Error("not an object");o=t}catch{throw new n.AgentApiError("invalid_request","The request body must be a JSON object.")}let d=null==(a=o.principal)?null:{kind:a.kind,id:String(a.id??"")};if(d&&!(0,n.samePrincipal)(d,c))throw new n.AgentApiError("principal_mismatch","The declared principal does not match the authenticated principal.");let l=e.headers.get("idempotency-key"),u="string"==typeof o.idempotencyKey?o.idempotencyKey:null;if(l&&u&&l!==u)throw new n.AgentApiError("invalid_request","Idempotency-Key header and body idempotencyKey differ.");let f=l??u??"";if(f.toLowerCase().startsWith(n.MCP_IDEMPOTENCY_PREFIX))throw new n.AgentApiError("invalid_request",`Idempotency keys starting with "${n.MCP_IDEMPOTENCY_PREFIX}" are reserved for the MCP bridge.`);let{accepted:h,dispatched:p}=(0,n.acceptAgentMessage)(c,{agentId:t,content:"string"==typeof o.content?o.content:"",idempotencyKey:f,conversationId:"string"==typeof o.conversationId?o.conversationId:null==o.conversationId?null:""},i);return!0===o.wait?(await p,Response.json({...(0,n.getAgentRequest)(c,h.requestId),replayed:h.replayed})):Response.json(h,{status:h.replayed?200:202})},{operation:"agents.message",targetKind:"agent",targetRef:t})}async function c(e,t){return a(async r=>{let i=await s(e);return r(i),Response.json((0,n.getConversation)(i,t))},{operation:"conversations.read",targetKind:"conversation",targetRef:t})}async function d(e,t){return a(async r=>{let i=await s(e);return r(i),Response.json((0,n.getAgentRequest)(i,t))},{operation:"requests.read",targetKind:"request",targetRef:t})}e.s(["authenticate",0,s,"handleGetAgentRequest",0,d,"handleGetConversation",0,c,"handleSendAgentMessage",0,o])},67505,e=>{"use strict";var t=e.i(22734),r=e.i(46786),n=e.i(14747),i=e.i(62294);let a="http://127.0.0.1:1111",s="agent_deck_server_url";class o extends Error{code="invalid-agent-deck-server-url";constructor(e){super(`Invalid Agent Deck server URL: ${JSON.stringify(String(e??""))}. Expected an http(s) URL such as ${a}.`)}}function c(e){let t;if("string"!=typeof e)throw new o(e);let r=e.trim();if(!r)throw new o(e);try{t=new URL(r)}catch{throw new o(e)}if("http:"!==t.protocol&&"https:"!==t.protocol||!t.hostname)throw new o(e);return t.toString().replace(/\/+$/,"")}function d(){try{let e=i.workspaceSettings.get(s);if(null===e)return a;return c(e)}catch{return a}}function l(e){return`${c(e)}/api/launch/decks`}class u extends Error{code;attemptedUrls;constructor(e,t,r="agent-deck-discovery-failed"){super(e),this.code=r,this.attemptedUrls=t}}function f(e,t){let r=globalThis.fetch;if("function"!=typeof r)throw Error("fetch is not available in this runtime.");return r(e,t).then(e=>({json:()=>e.json()}))}function h(e){try{return JSON.stringify(e??"").includes("GRANT_REQUIRED")}catch{return!1}}async function p(e){let t,r=l(e?.serverUrl!==void 0?c(e.serverUrl):d()),n=e?.fetchImpl??f;try{let e=await n(r,{method:"GET"});t=await e.json()}catch(e){if(e instanceof u){if(0===e.attemptedUrls.length)throw new u(e.message,[r],e.code);throw e}throw new u(`Cannot reach the Agent Deck server at ${r}: ${e instanceof Error?e.message:String(e)}. Check the workspace Agent Deck URL and that the server is running.`,[r],"connection-failed")}if(h(t))throw new u("Agent Deck server refused deck discovery with GRANT_REQUIRED. Only GET /api/launch/decks is supported; GET /api/decks must not be used.",[r],"grant-required");try{var i=t;if("object"!=typeof i||null===i)throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');if(h(i))throw new u("Agent Deck server refused deck discovery with GRANT_REQUIRED. Only GET /api/launch/decks is supported; GET /api/decks must not be used.",[],"grant-required");if(!0!==i.success)throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');let e=i.data,r=e?.decks;if(!Array.isArray(r))throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');let n=r.map(e=>{if("object"!=typeof e||null===e)throw Error("Expected every deck to carry a string id and name.");let t="string"==typeof e.id?e.id.trim():"",r="string"==typeof e.name?e.name.trim():"";if(!t||!r)throw Error("Expected every deck to carry a string id and name.");return{id:t,name:r}});return n.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id)),n}catch(e){if(e instanceof u)throw e;throw new u(`Agent Deck server at ${r} returned an unexpected deck payload: ${e instanceof Error?e.message:String(e)}`,[r],"invalid-payload")}}function g(e){if(e&&e.trim())return e;let t=(process.env.HOME??"").trim();return t||r.default.homedir()}e.s(["AgentDeckDiscoveryError",0,u,"DEFAULT_AGENT_DECK_SERVER_URL",0,a,"InvalidAgentDeckServerUrlError",0,o,"agentDeckDecksUrl",0,l,"getAgentDeckServerUrl",0,d,"isLocalAgentDeckUrl",0,function(e){let t;try{t=new URL("string"==typeof e?e.trim():"")}catch{return!1}let r=t.hostname.trim().toLowerCase().replace(/^\[|\]$/g,"");return!!("localhost"===r||"::1"===r||"::ffff:127.0.0.1"===r||/^127\.\d+\.\d+\.\d+$/.test(r))},"listAgentDecks",0,p,"remoteLaunchUnsupportedMessage",0,function(e){return`[Deck failed] Remote Agent Deck launch is not supported: the workspace Agent Deck server is non-local and remote \`agent-deck run\` targeting is unconfirmed. Point the workspace server URL at the local Agent Deck server to launch. (server_url=${e})`},"resolveAndEnsureBotWorkdir",0,function(e,r,i){let a=function(e,t,r){let i="string"==typeof t?t.trim():"";if(i)return"~"===i?g(r):i.startsWith("~/")||i.startsWith("~\\")?n.default.join(g(r),i.slice(2)):i;let a=String(e??"").trim();if(!a)throw Error("defaultBotWorkdir requires a bot id.");let s=g(r);return n.default.resolve(s,".botmancers",a)}(e,r,i);return t.default.mkdirSync(a,{recursive:!0}),a},"setAgentDeckServerUrl",0,function(e){let t=c(e);return i.workspaceSettings.set(s,t),t}])},35631,26571,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(54799),i=e.i(62294),a=e.i(52036);let s="BOTMANCERS_SERVICE_TOKENS",o=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,c=/^sha256:([0-9a-f]{64})$/;class d extends Error{constructor(e){super(e),this.name="ServiceTokenConfigError"}}function l(e){if(!e||!e.trim())return[];let t=[],r=new Set;for(let n of e.split(/[,\s]+/).filter(Boolean)){let e=n.indexOf("="),i=e>0?n.slice(0,e):"",a=c.exec(e>0?n.slice(e+1).toLowerCase():"");if(!o.test(i)||!a)throw new d(`${s} entries must be <service-id>=sha256:<64 hex digits>.`);if(r.has(i))throw new d(`${s} lists service ${i} twice.`);r.add(i),t.push({serviceId:i,digest:Buffer.from(a[1],"hex")})}return t}e.s(["SERVICE_TOKENS_ENV",0,s,"ServiceTokenConfigError",0,d,"parseServiceTokens",0,l,"serviceTokenAuthenticatorFromEnv",0,function(e=process.env){let t=l(e[s]);return t.length?e=>{let r,i,a=(i=(r=e.headers.get("authorization"))?/^Bearer[ \t]+(\S+)[ \t]*$/i.exec(r):null)?i[1]:null;if(!a||a.length>4096)return null;let s=(0,n.createHash)("sha256").update(a,"utf8").digest(),o=null;for(let e of t)(0,n.timingSafeEqual)(s,e.digest)&&null===o&&(o=e.serviceId);return o?{kind:"service",id:o}:null}:null}],26571);let u=["agents:read","sessions:read","conversations:read","sessions:message","exchanges:read","exchanges:create"],f=["botmancers-exchanges","botmancers-engine"],h=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,p=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;class g extends Error{constructor(e){super(e),this.name="ServiceGrantsError"}}function w(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function m(e,t,r){let n=Object.keys(e).find(e=>!t.includes(e));if(void 0!==n)throw new g(`${r} has an unknown field "${n}".`)}let v=null;e.s(["EXCHANGE_KEY_PREFIX",0,"exchange:","MESSAGE_KEY_PREFIX",0,"message:","SERVICE_CAPABILITIES",0,u,"loadServiceGrants",0,function(e=process.env){let o,c=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(!c)return{state:"absent",path:null};try{o=t.default.statSync(c)}catch(e){if("ENOENT"===e.code)return{state:"absent",path:c};return{state:"invalid",path:c,reason:"The document cannot be read."}}let y=(0,n.createHash)("sha256").update(e[s]??"","utf8").digest("hex"),E=new Set(i.default.prepare("SELECT id FROM bots").all().map(e=>e.id)),A=(0,n.createHash)("sha256").update([...E].sort().join("\n"),"utf8").digest("hex"),k=[c,o.ino,o.size,o.mode,o.uid,o.mtimeMs,y,A].join(":");if(v&&v.key===k)return v.state;let b=function(e,r,n,i){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 g("The document is not valid JSON.")}if(!w(n))throw new g("The document must be a JSON object.");if(m(n,["version","grants"],"The document"),1!==n.version)throw new g("version must be 1.");if(!Array.isArray(n.grants))throw new g("grants must be a list.");if(n.grants.length>512)throw new g("grants has more than 512 entries.");let i=new Map;return n.grants.forEach((e,n)=>{let a=`grants[${n}]`;if(!w(e))throw new g(`${a} must be an object.`);m(e,["service","agent","capabilities"],a);let{service:o,agent:c,capabilities:d}=e;if("string"!=typeof o||!h.test(o))throw new g(`${a}.service must be a configured service id (letters, digits, ".", "_", "-").`);if(f.includes(o))throw new g(`${a}.service names a reserved engine principal.`);if(t&&!t.has(o))throw new g(`${a}.service is not a configured service principal (${s}).`);if("string"!=typeof c||!p.test(c))throw new g(`${a}.agent must be one Agent id; wildcards are not allowed.`);if(r&&!r.has(c))throw new g(`${a}.agent is not a registered Agent.`);if(!Array.isArray(d)||0===d.length)throw new g(`${a}.capabilities must list at least one capability.`);let l=new Set;for(let e of d){if(!("string"==typeof e&&u.includes(e)))throw new g(`${a}.capabilities has an unknown capability.`);if(l.has(e))throw new g(`${a}.capabilities lists ${e} twice.`);l.add(e)}let v=i.get(o)??new Map;if(v.has(c))throw new g(`${a} repeats the grant of service ${o} for that Agent.`);v.set(c,l),i.set(o,v)}),i}(a,n,i)}}catch(t){if(t instanceof g)return{state:"invalid",path:e,reason:t.message};throw t}}(c,o,function(e){try{return new Set(l(e[s]).map(e=>e.serviceId))}catch(e){if(e instanceof d)return`${s} is malformed, so no grant can name a configured service.`;throw e}}(e),E);return v={key:k,state:b},b}],35631)}];
2
+
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__0wtzcge._.js.map
@@ -1,3 +1,3 @@
1
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"))},20635,(e,r,t)=>{r.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,r,t)=>{r.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"))},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"}],a=[{id:"none",label:"None"},{id:"crown",label:"Crown"},{id:"glasses",label:"Glasses"},{id:"headset",label:"Headset"},{id:"hat",label:"Hat"},{id:"bow",label:"Bow"}],i={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},s={...i,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:i.color,d=l(t,e.avatar_eyes)?e.avatar_eyes:i.eyes;return{color:c,eyes:d,hands:l(n,e.avatar_hands)?e.avatar_hands:i.hands,accessory:l(a,e.avatar_accessory)?e.avatar_accessory:o(e.name)?s.accessory:i.accessory}}e.s(["isChiefOfStaffName",0,o,"resolveAvatar",0,c,"validateAvatarInput",0,function(e){let i=[],s={};if(null==e)return{errors:i,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){i.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){i.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){i.push(e instanceof Error?e.message:String(e))}if(void 0!==e.accessory)try{s.avatar_accessory=function(e){if(l(a,e))return e;throw Error(`Invalid avatar accessory: ${JSON.stringify(String(e))}. Expected one of ${a.map(e=>e.id).join("|")}.`)}(e.accessory)}catch(e){i.push(e instanceof Error?e.message:String(e))}return{errors:i,fields:s}}],16979);let d=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},f="hermes",g={hermes:"hermes-gateway",cursor:"agent-deck-run",claude:"agent-deck-run",codex:"agent-deck-run",muse:"agent-deck-run"};class p extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${d.join("|")}.`)}}class _ 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 h="Deck ID is required. Select an Agent Deck before saving this agent.",m=`Agent is required. Expected one of ${d.join("|")}.`;function y(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 v(e){return null==e?null:String(e).trim()||null}function x(e){if(null==e)return null;if("string"!=typeof e)throw new _(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 _(e);return r}function k(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 b(e){let r=f,t=!0;try{r=y(e.agent)??f}catch{t=!1}let n=v(e.deck_id),a=v(e.deck_name),i=v(e.working_directory),s=null===n||k(e.needs_deck_selection),o=t&&!s;return{agent:r,deck_id:n,deck_name:a,working_directory:i,needs_deck_selection:s,launchable:o}}let w=["codex","claude","cursor","muse"];function S(e){let r=v(e);return r&&w.includes(r)?r:null}let E=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection"];function A(e,r){(void 0!==e.runtime||void 0!==e.agent_client)&&r.push("Fields runtime/agent_client are no longer accepted. Send agent (hermes|cursor|claude|codex|muse) and deck_id instead."),void 0!==e.deck_name&&r.push("deck_name is a read-only legacy reference. Select a deck_id from the configured Agent Deck server instead.")}e.s(["AGENTS",0,d,"DEFAULT_AGENT",0,f,"agentTransport",0,function(e){return g[e]},"applyAgentUpdate",0,function(e,r){let t=b(e),n=r.agent??t.agent,a=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:a,needs_deck_selection:!1}:{agent:n,deck_id:t.deck_id,deck_name:t.deck_name,working_directory:a,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=v(e.deck_id),t=v(e.deck_name),n=v(e.working_directory);try{let i=y(e.agent);if(i){var a;return{agent:i,deck_id:r,deck_name:t,working_directory:n,needs_deck_selection:null===r||(a=e.needs_deck_selection,k(a)),migrated:!1}}}catch{}let i=v(e.runtime),s=f,o=k(e.needs_deck_reselection);if("agent-deck"===i){let r=S(e.agent_client);r?s=r:o=!0}else if("hermes"!==i){let r=S(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}},"resolveAgent",0,b,"serializeBot",0,function(e){let r=b(e),t={...e};for(let e of E)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,launchable:r.launchable,avatar_config:c(e)}},"validateCreateAgent",0,function(e){let r=[];A(e,r);let t=f;try{t=y(e.agent)??f}catch(e){r.push(e instanceof Error?e.message:String(e))}let n=null;try{(n=x(e.deck_id))||r.push(h)}catch(e){r.push(e instanceof Error?e.message:String(e))}return{errors:r,normalized:{agent:t,deck_id:n??"",working_directory:v(e.working_directory)}}},"validateUpdateAgent",0,function(e){let r=[],t={};if(A(e,r),void 0!==e.agent)try{let n=y(e.agent);n?t.agent=n:r.push(m)}catch(e){r.push(e instanceof Error?e.message:String(e))}if(void 0!==e.deck_id)try{let n=x(e.deck_id);n?t.deck_id=n:r.push(h)}catch(e){r.push(e instanceof Error?e.message:String(e))}return void 0!==e.working_directory&&(t.working_directory=v(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 a=n(e,"BOTMANCERS_DB_PATH");if(a)return a;let i=t(e);return i?r.default.join(i,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let a=n(e,"BOTMANCERS_FILES_ROOT");if(a)return r.default.resolve(a);let i=t(e);return i?r.default.join(i,"files"):r.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let a=n(e,"BOTMANCERS_SKILLS_ROOT");if(a)return r.default.resolve(a);let i=t(e);return i?r.default.join(i,"skills"):r.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let a=n(e,"HERMES_WAIT_LOG_PATH");if(a)return a;let i=t(e);return i?r.default.join(i,"logs/specialist-waits.jsonl"):r.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__19hjzs0._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__15hknun._.js.map
@@ -1,3 +1,3 @@
1
1
  module.exports=[54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.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"))},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"))},56704,(e,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},28244,e=>{"use strict";var t=e.i(89171),r=e.i(22734),n=e.i(14747),a=e.i(25211),i=e.i(85072);async function s(e,{params:o}){try{let e,{name:s}=await o;if(!(0,a.isSafeFileName)(s))return t.NextResponse.json({error:"Invalid file name"},{status:400});let l=(0,i.filesRoot)(),u=n.default.join(l,s);if(!u.startsWith(l+n.default.sep))return t.NextResponse.json({error:"Invalid file name"},{status:400});try{e=r.default.statSync(u)}catch{return t.NextResponse.json({error:"File not found"},{status:404})}if(!e.isFile())return t.NextResponse.json({error:"File not found"},{status:404});let c=r.default.readFileSync(u),d=s.endsWith(".txt")?"text/plain; charset=utf-8":"application/octet-stream";return new t.NextResponse(new Uint8Array(c),{status:200,headers:{"Content-Type":d,"Content-Disposition":`attachment; filename="${s}"`,"Content-Length":String(c.length)}})}catch(e){return console.error("Error serving file:",e),t.NextResponse.json({error:"Failed to serve file"},{status:500})}}e.s(["GET",0,s])},36261,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),c=e.i(95169),d=e.i(47587),f=e.i(66012),p=e.i(70101),h=e.i(26937),m=e.i(10372),w=e.i(93695),y=e.i(9580);e.i(52474);var x=e.i(220);let g=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/files/[name]/route",pathname:"/api/files/[name]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/files/[name]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(28244),...{}}),{workAsyncStorage:v,workUnitAsyncStorage:R,serverHooks:b}=g;async function A(e,t,n){n.requestMeta&&(0,a.setRequestMeta)(e,n.requestMeta),g.isDev&&(0,a.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let v="/api/files/[name]/route";v=v.replace(/\/index$/,"")||"/";let R=await g.prepare(e,t,{srcPage:v,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:b,deploymentId:A,params:S,nextConfig:C,parsedUrl:E,isDraftMode:N,prerenderManifest:O,routerServerContext:T,isOnDemandRevalidate:_,revalidateOnlyGenerated:j,resolvedPathname:k,clientReferenceManifest:q,serverActionsManifest:P}=R,$=(0,o.normalizeAppPath)(v),H=!!O.routes[k]&&(g.isDev||(0,y.isRouteCacheOwner)(k,g.cacheOwner,O.routes[k])),F=!!(O.dynamicRoutes[$]||H),I=async()=>((null==T?void 0:T.render404)?await T.render404(e,t,E,!1):t.end("This page could not be found"),null);if(F&&!N){let e=O.dynamicRoutes[$];if(e&&!1===e.fallback&&!H){if(C.adapterPath)return await I();throw new w.NoFallbackError}}let M=null;!F||g.isDev||N||(M="/index"===(M=k)?"/":M);let D=!0===g.isDev||!F,L=F&&!D;P&&q&&(0,s.setManifestsSingleton)({page:v,clientReferenceManifest:q,serverActionsManifest:P});let U=e.method||"GET",B=(0,i.getTracer)(),z=B.getActiveScopeSpan(),Z=!!(null==T?void 0:T.isWrappedByNextServer),J=!!(0,a.getRequestMeta)(e,"minimalMode"),K=(0,a.getRequestMeta)(e,"incrementalCache")||await g.getIncrementalCache(e,C,O,J);null==K||K.resetRequestCache(),globalThis.__incrementalCache=K;let G={params:S,previewProps:O.preview,renderOpts:{experimental:{authInterrupts:!!C.experimental.authInterrupts,useCacheTimeout:C.experimental.useCacheTimeout},cacheComponents:!!C.cacheComponents,validationLevel:C.experimental.instantInsights.validationLevel,isDraftMode:N,supportsDynamicResponse:D,incrementalCache:K,hmrRefreshHash:(0,a.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:C.cacheLife,staticPageGenerationTimeout:C.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,a)=>g.onRequestError(e,t,n,a,T)},sharedContext:{buildId:b,deploymentId:A}},W=new l.NodeNextRequest(e),X=new l.NodeNextResponse(t),V=u.NextRequestAdapter.fromNodeNextRequest(W,(0,u.signalFromNodeResponse)(t)),Y=async({previousCacheEntry:r})=>{try{if(!J&&_&&j&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let a=await g.handle(V,G);e.fetchMetrics=G.renderOpts.fetchMetrics;let i=G.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let s=G.renderOpts.collectedTags;if(!F)return await (0,f.sendResponse)(W,X,a,i),null;{let e=await a.blob(),t=(0,p.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!==G.renderOpts.collectedRevalidate&&!(G.renderOpts.collectedRevalidate>=m.INFINITE_CACHE)&&G.renderOpts.collectedRevalidate,n=void 0===G.renderOpts.collectedExpire||G.renderOpts.collectedExpire>=m.INFINITE_CACHE?!1!==r&&r>0?C.expireTime:void 0:G.renderOpts.collectedExpire;return{value:{kind:x.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 g.onRequestError(e,t,{routerKind:"App Router",routePath:v,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:_})},!1,T),t}},Q=async(a,s)=>{try{var o,l;let a=await g.handleResponse({req:e,nextConfig:C,cacheKey:M,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:O,isRoutePPREnabled:!1,isOnDemandRevalidate:_,revalidateOnlyGenerated:j,responseGenerator:Y,waitUntil:n.waitUntil,isMinimalMode:J});if(!F)return;if((null==a||null==(o=a.value)?void 0:o.kind)!==x.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});J||t.setHeader("x-nextjs-cache",_?"REVALIDATED":a.isMiss?"MISS":a.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,p.fromNodeOutgoingHttpHeaders)(a.value.headers);J&&F||i.delete(m.NEXT_CACHE_TAGS_HEADER),!a.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,h.getCacheControlHeader)(a.cacheControl)),await (0,f.sendResponse)(W,X,new Response(a.value.body,{headers:i,status:a.value.status||200}));return}catch(t){if(t instanceof w.NoFallbackError||await g.onRequestError(e,t,{routerKind:"App Router",routePath:$,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:L,isOnDemandRevalidate:_})},!1,T),F)throw t;await (0,f.sendResponse)(W,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=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==c.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")||$,o=`${U} ${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&&z)await Q(z,void 0);else{let t=B.getActiveScopeSpan();await B.withPropagatedContext(e.headers,()=>B.trace(c.BaseServerSpan.handleRequest,{spanName:`${U} ${v}`,kind:i.SpanKind.SERVER,attributes:{"http.method":U,"http.target":e.url}},e=>Q(e,t)),void 0,!Z)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:v,workUnitAsyncStorage:R})},"routeModule",0,g,"serverHooks",0,b,"workAsyncStorage",0,v,"workUnitAsyncStorage",0,R])},85072,3620,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(25211);class a extends Error{}function i(e,t){return RegExp("\\b"+t+"\\b","i").test(e)}function s(e){return e.trim().replace(/^[@"'`]+|["'`]+$/g,"").replace(/[.?!;,:'"`]+$/g,"").trim()}function o(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new a("draft needs {channel, recipient, body}");if("email"!==e.channel&&"slack"!==e.channel)throw new a("draft channel must be email or slack");if("string"!=typeof e.recipient)throw new a("draft needs a recipient string");if("string"!=typeof e.body)throw new a("draft needs a body string");let t=e.recipient.trim(),r=e.body.trim();if(t.length>256)throw new a("draft recipient is too long");if(!r)throw new a("draft needs a body");if(Buffer.byteLength(r,"utf8")>32768)throw new a("draft body is too large");return{channel:e.channel,recipient:t,body:r}}e.s(["createDraft",0,function(e){let t=o(e);return{channel:t.channel,recipient:t.recipient,body:t.body,state:"open"}},"parseDraftRequest",0,function(e){let t=(e||"").trim();if(!t||/^\s*(create a specialist|duplicate)\b/i.test(t))return null;let r=null;if(i(t,"email")?r="email":i(t,"slack")&&(r="slack"),!r)return null;let n=/\b(draft|write|compose|create|prepare|send)\b/i.test(t),a=/\bplease\b/i.test(t),l=/\b(can|could|would)\s+you\b/i.test(t),u=/^\s*(please\s+)?(email|slack)\b/i.test(t);if(!n&&!a&&!l&&!u)return null;let c=function(e){if(e.toLowerCase().includes("one-line note"))return"One-line note.";let t=e.toLowerCase(),r=-1,n="";for(let e of["that says","saying","note:"]){let a=t.indexOf(e);a>=0&&(r<0||a<r)&&(r=a,n=e)}return r<0?null:e.slice(r+n.length).trim()||null}(t);if(c){let e=function(e){let t=e.toLowerCase(),r=-1;for(let e of["that says","saying","note:"]){let n=t.indexOf(e);n>=0&&(r<0||n<r)&&(r=n)}return r<0?e:e.slice(0,r)}(t),n="",a=e.match(/\bto\s+@?([A-Za-z0-9_.-]+(?:@[A-Za-z0-9_.-]+\.[A-Za-z]+)?)/i);if(a)n=s(a[1]||"");else{let t=e.match(/\b(email|slack)\b\s+@?([A-Za-z0-9_.-]+)/i);if(t){let e=s(t[2]||"");e&&!["to","a","an","the","that","saying","note"].includes(e.toLowerCase())&&(n=e)}}try{return o({channel:r,recipient:n,body:c})}catch{return null}}if(!u)return null;let d=t.match(/^\s*(?:please\s+)?(?:email|slack)\s+@?([A-Za-z0-9_.-]+)\s+(.+?)\s*[.?!]?\s*$/i);if(!d)return null;let f=s(d[1]||""),p=(d[2]||"").trim();if(!f||["to","a","an","the","that","saying","note"].includes(f.toLowerCase())||!p||p.length<2)return null;try{return o({channel:r,recipient:f,body:p})}catch{return null}},"validateDraftRequest",0,o],3620);var l=e.i(52036);class u extends Error{}function c(){return(0,l.filesRootPath)()}function d(e){let t=f(e),n=c(),a=r.default.resolve(n,t);if(a!==n&&!a.startsWith(n+r.default.sep))throw new u(`refused: path traversal in ${JSON.stringify(e)}`);return a}function f(e){if("string"!=typeof e||!e)throw new u("file needs a name");if(e.length>128)throw new u(`refused: file name too long ${JSON.stringify(e)}`);if(!(0,n.isSafeFileName)(e))throw new u(`refused: unsafe file name ${JSON.stringify(e)}`);return e}function p(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new u("file needs {name, content}");return{name:f(e.name),content:function(e){if("string"!=typeof e)throw new u("file needs string content");let t=Buffer.byteLength(e,"utf8");if(0===t)throw new u("file needs content");if(t>65536)throw new u("refused: file content exceeds 65536 bytes");return e}(e.content)}}e.s(["ARTIFACT_MAX_BYTES",0,65536,"artifactCardText",0,function(e){return`[file] ${e}`},"filesRoot",0,c,"parseFileWriteRequest",0,function(e){let t,r=(e||"").trim();if(!r||!/\b(write|create|make)\b/i.test(r)||!/\bfile\b/i.test(r)||!/\bfile\b\s+(named|called)\b/i.test(r))return null;let n=r.match(/\bfile\b\s+(?:named|called)\s+([`"'\u201c\u201d]?\S+?[`"'\u201c\u201d]?)(?:\s+|$)/i);if(!n)return null;let a=(t=(n[1]||"").trim().replace(/^["'`\u201c\u201d]+|["'`\u201c\u201d]+$/g,"").replace(/[?!;,:'"`]+$/,"").trim(),/^\.+$/.test(t)?t:t.replace(/[.]+$/,""));if(!a)return null;let i=r.match(/(?:whose\s+contents?\s+are\s+the\s+word|containing\s+the\s+word|with\s+the\s+word)\s+[`"'\u201c\u201d]?([A-Za-z0-9_-]+)[`"'\u201c\u201d]?/i);if(i)return{name:a,content:i[1]};let s=r.match(/(?:containing|with\s+contents?)\s+["\u201c](.+?)["\u201d]/i);if(s&&s[1].trim())return{name:a,content:s[1]};let o=r.match(/(?:containing|with\s+contents?)\s*:\s*(.+?)\s*$/i);if(o&&o[1].trim()){let e=o[1].trim().replace(/^["'`\u201c\u201d]+|["'`\u201c\u201d]+$/g,"").trim();if(e)return{name:a,content:e}}let l=r.match(/(?:containing|with\s+contents?)\s+(?!the\s+word\b)(.+?)\s*$/i);if(l&&l[1].trim()){let e=l[1].trim().replace(/^["'`\u201c\u201d]+|["'`\u201c\u201d]+$/g,"").trim();if(e=e.replace(/[.?!]+$/,"").trim())return{name:a,content:e}}return null},"parseTypedResult",0,function(e){for(let t of function(e){let t=[];for(let r of(e||"").split(/\r?\n/)){let e=r.match(/^\s*\[produce\]\s*(\{.*\})\s*$/i);if(e)try{t.push(JSON.parse(e[1]))}catch{}}return t}(e))if(!(!t||"object"!=typeof t||Array.isArray(t))){if("draft"===t.type)try{let e=o({channel:t.channel,recipient:t.recipient??"",body:t.body});return{kind:"draft",draft:e}}catch{break}if("file"===t.type)try{let e=p({name:t.name,content:t.content});return{kind:"file",file:e}}catch{}break}return null},"resolveArtifactPath",0,d,"validateArtifact",0,p,"writeArtifactFile",0,function(e,r,n){let a=p({name:e,content:r}),i=c();t.default.mkdirSync(i,{recursive:!0});let s=d(a.name);if(t.default.existsSync(s)){let e;try{e=t.default.statSync(s)}catch{throw new u(`refused: cannot stat ${JSON.stringify(a.name)}`)}if(!e.isFile())throw new u(`refused: not a file ${JSON.stringify(a.name)}`);if(!n?.allowOverwrite)throw new u(`refused: ${JSON.stringify(a.name)} already exists`)}return t.default.writeFileSync(s,a.content,"utf8"),s}],85072)},25211,e=>{"use strict";let t=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;e.s(["isSafeFileName",0,function(e){return t.test(e)},"parseApprovalCode",0,function(e){let t=e.match(/approve using the code ([A-Za-z0-9][A-Za-z0-9_-]*)/i);return t?t[1]:null},"parseDraft",0,function(e){let t,r=e.match(/^\s*\[draft\]\s*([\s\S]*)$/);if(!r)return null;try{t=JSON.parse(r[1])}catch{return null}if(!t||"object"!=typeof t)return null;let n=t;return"email"!==n.channel&&"slack"!==n.channel||"open"!==n.state&&"sent"!==n.state&&"discarded"!==n.state||"string"!=typeof n.recipient||"string"!=typeof n.body?null:{channel:n.channel,recipient:n.recipient,body:n.body,state:n.state}},"parseFileNames",0,function(e){let t=[];for(let r of e.split("\n")){let e=r.match(/^\s*\[file\]\s*(\S+)\s*$/i);e&&!t.includes(e[1])&&t.push(e[1])}return t},"serializeDraft",0,function(e){return"[draft]\n"+JSON.stringify({channel:e.channel,recipient:e.recipient,body:e.body,state:e.state})}])},52036,e=>{"use strict";var t=e.i(14747);function r(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?t.default.resolve(n):null}function n(e,t){return(e[t]||"").trim()||null}e.s(["botmancersHome",0,r,"dbPath",0,function(e=process.env){let a=n(e,"BOTMANCERS_DB_PATH");if(a)return a;let i=r(e);return i?t.default.join(i,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let a=n(e,"BOTMANCERS_FILES_ROOT");if(a)return t.default.resolve(a);let i=r(e);return i?t.default.join(i,"files"):t.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let a=n(e,"BOTMANCERS_SKILLS_ROOT");if(a)return t.default.resolve(a);let i=r(e);return i?t.default.join(i,"skills"):t.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let a=n(e,"HERMES_WAIT_LOG_PATH");if(a)return a;let i=r(e);return i?t.default.join(i,"logs/specialist-waits.jsonl"):t.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__08i4wq6._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__16ikszu._.js.map
@@ -1,3 +1,3 @@
1
1
  module.exports=[54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.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"))},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"))},56704,(e,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},49166,e=>{"use strict";var t=e.i(89171);let r="1.0.0";async function a(){return t.NextResponse.json({schema_version:r,supported:{identity:!0,description:!0,avatar:!0,verification:!0},unsupported:{memories:!0,skills:!0,routines:!0,integrations:!0}})}e.s(["GET",0,a,"IMPORT_SCHEMA_VERSION",0,r])},54504,e=>{"use strict";var t=e.i(47909),r=e.i(74017),a=e.i(96250),n=e.i(59756),s=e.i(61916),i=e.i(74677),o=e.i(69741),l=e.i(16795),d=e.i(87718),p=e.i(95169),u=e.i(47587),c=e.i(66012),x=e.i(70101),h=e.i(26937),v=e.i(10372),R=e.i(93695),m=e.i(9580);e.i(52474);var g=e.i(220);let f=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/import-capabilities/route",pathname:"/api/import-capabilities",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/import-capabilities/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(49166),...{}}),{workAsyncStorage:w,workUnitAsyncStorage:E,serverHooks:C}=f;async function y(e,t,a){a.requestMeta&&(0,n.setRequestMeta)(e,a.requestMeta),f.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let w="/api/import-capabilities/route";w=w.replace(/\/index$/,"")||"/";let E=await f.prepare(e,t,{srcPage:w,multiZoneDraftMode:!1});if(!E)return t.statusCode=400,t.end("Bad Request"),null==a.waitUntil||a.waitUntil.call(a,Promise.resolve()),null;let{buildId:C,deploymentId:y,params:b,nextConfig:A,parsedUrl:T,isDraftMode:q,prerenderManifest:S,routerServerContext:P,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,resolvedPathname:_,clientReferenceManifest:j,serverActionsManifest:k}=E,H=(0,o.normalizeAppPath)(w),I=!!S.routes[_]&&(f.isDev||(0,m.isRouteCacheOwner)(_,f.cacheOwner,S.routes[_])),M=!!(S.dynamicRoutes[H]||I),U=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,T,!1):t.end("This page could not be found"),null);if(M&&!q){let e=S.dynamicRoutes[H];if(e&&!1===e.fallback&&!I){if(A.adapterPath)return await U();throw new R.NoFallbackError}}let D=null;!M||f.isDev||q||(D="/index"===(D=_)?"/":D);let F=!0===f.isDev||!M,K=M&&!F;k&&j&&(0,i.setManifestsSingleton)({page:w,clientReferenceManifest:j,serverActionsManifest:k});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 f.getIncrementalCache(e,A,S,V);null==X||X.resetRequestCache(),globalThis.__incrementalCache=X;let W={params:b,previewProps:S.preview,renderOpts:{experimental:{authInterrupts:!!A.experimental.authInterrupts,useCacheTimeout:A.experimental.useCacheTimeout},cacheComponents:!!A.cacheComponents,validationLevel:A.experimental.instantInsights.validationLevel,isDraftMode:q,supportsDynamicResponse:F,incrementalCache:X,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:A.cacheLife,staticPageGenerationTimeout:A.staticPageGenerationTimeout,waitUntil:a.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,a,n)=>f.onRequestError(e,t,a,n,P)},sharedContext:{buildId:C,deploymentId:y}},z=new l.NodeNextRequest(e),Z=new l.NodeNextResponse(t),J=d.NextRequestAdapter.fromNodeNextRequest(z,(0,d.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:r})=>{try{if(!V&&N&&O&&!r)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,W);e.fetchMetrics=W.renderOpts.fetchMetrics;let s=W.renderOpts.pendingWaitUntil;s&&a.waitUntil&&(a.waitUntil(s),s=void 0);let i=W.renderOpts.collectedTags;if(!M)return await (0,c.sendResponse)(z,Z,n,s),null;{let e=await n.blob(),t=(0,x.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[v.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==W.renderOpts.collectedRevalidate&&!(W.renderOpts.collectedRevalidate>=v.INFINITE_CACHE)&&W.renderOpts.collectedRevalidate,a=void 0===W.renderOpts.collectedExpire||W.renderOpts.collectedExpire>=v.INFINITE_CACHE?!1!==r&&r>0?A.expireTime:void 0:W.renderOpts.collectedExpire;return{value:{kind:g.CachedRouteKind.APP_ROUTE,status:n.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:a}}}}catch(t){throw(null==r?void 0:r.isStale)&&await f.onRequestError(e,t,{routerKind:"App Router",routePath:w,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:N})},!1,P),t}},Y=async(n,i)=>{try{var o,l;let n=await f.handleResponse({req:e,nextConfig:A,cacheKey:D,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:S,isRoutePPREnabled:!1,isOnDemandRevalidate:N,revalidateOnlyGenerated:O,responseGenerator:Q,waitUntil:a.waitUntil,isMinimalMode:V});if(!M)return;if((null==n||null==(o=n.value)?void 0:o.kind)!==g.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",N?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),q&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let s=(0,x.fromNodeOutgoingHttpHeaders)(n.value.headers);V&&M||s.delete(v.NEXT_CACHE_TAGS_HEADER),!n.cacheControl||t.getHeader("Cache-Control")||s.get("Cache-Control")||s.set("Cache-Control",(0,h.getCacheControlHeader)(n.cacheControl)),await (0,c.sendResponse)(z,Z,new Response(n.value.body,{headers:s,status:n.value.status||200}));return}catch(t){if(t instanceof R.NoFallbackError||await f.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,u.getRevalidateReason)({isStaticGeneration:K,isOnDemandRevalidate:N})},!1,P),M)throw t;await (0,c.sendResponse)(z,Z,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:s.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let r=$.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==p.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let a=r.get("next.route")||H,o=`${L} ${a}`;n.setAttributes({"next.route":a,"http.route":a,"next.span_name":o}),n.updateName(o),i&&i!==n&&(i.setAttribute("http.route",a),i.updateName(o))})()}};if(G&&B)await Y(B,void 0);else{let t=$.getActiveScopeSpan();await $.withPropagatedContext(e.headers,()=>$.trace(p.BaseServerSpan.handleRequest,{spanName:`${L} ${w}`,kind:s.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,y,"patchFetch",0,function(){return(0,a.patchFetch)({workAsyncStorage:w,workUnitAsyncStorage:E})},"routeModule",0,f,"serverHooks",0,C,"workAsyncStorage",0,w,"workUnitAsyncStorage",0,E])}];
2
2
 
3
- //# sourceMappingURL=%5Broot-of-the-server%5D__1khwkvb._.js.map
3
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1c3e2ds._.js.map
@@ -1,7 +1,7 @@
1
- module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},39229,51749,29370,e=>{"use strict";var t=e.i(33405),r=e.i(62349),n=e.i(22734),i=e.i(14747),o=e.i(52036);let s="/v1/chat/completions";class a extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function l(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let i=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",o=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",s=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:i.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:o,model:s}}function d(e,t){return new a("aborted","Hermes request aborted")}async function c(e){var t;let r,n,{config:i,profilePath:o,sessionId:s,messages:l,signal:c}=e,u=e.fetchImpl||((e,t)=>fetch(e,t)),f=(t=i.baseUrl,r=t.replace(/\/+$/,""),n=o.startsWith("/")?o:`/${o}`,`${r}${n}`),p=new AbortController,g=!1,m=setTimeout(()=>{g=!0,p.abort()},i.timeoutMs);m.unref&&m.unref();let h=()=>p.abort();if(c){if(c.aborted)throw clearTimeout(m),d(c,i.timeoutMs);c.addEventListener("abort",h,{once:!0})}try{let e,t;try{e=await u(f,{method:"POST",headers:{Authorization:`Bearer ${i.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":s},body:JSON.stringify({model:i.model,stream:!1,messages:l}),signal:p.signal})}catch(e){if(g)throw new a("timeout",`Hermes request timed out after ${i.timeoutMs} ms`);if(p.signal.aborted)throw d(c??p.signal,i.timeoutMs);throw new a("network",`Hermes request failed: ${String(e)}`)}let r="";try{r=await e.text()}catch{r=""}if(!e.ok){let t=`Hermes turn failed with status ${e.status}`;try{let e=JSON.parse(r);e?.error?.message&&(t=e.error.message)}catch{let e=r.trim().slice(0,120);e&&(t=`${t}: ${e}`)}throw new a("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new a("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(m),c&&c.removeEventListener("abort",h)}}function u(e,t,r=null){return{category:e,code:r,message:t.slice(0,500)}}function f(e){let t=null,r=null;return{promise:new Promise(n=>{if(e.signal&&(r=()=>n(u("cancelled","The attempt was cancelled.")),e.signal.aborted?r():e.signal.addEventListener("abort",r,{once:!0})),"number"==typeof e.deadlineAt){let r=e.deadlineAt,i=()=>{let e=r-Date.now();e<=0?n(u("timed_out","The attempt passed its deadline.")):(t=setTimeout(i,Math.min(e,0x7fffffff))).unref&&t.unref()};i()}}),dispose:()=>{t&&clearTimeout(t),r&&e.signal&&e.signal.removeEventListener("abort",r)}}}function p(e){return e.signal?.aborted?u("cancelled","The attempt was cancelled before launch."):"number"==typeof e.deadlineAt&&Date.now()>=e.deadlineAt?u("timed_out","The attempt passed its deadline before launch."):null}e.s(["HERMES_DEFAULT_CHAT_PATH",0,s,"HermesError",0,a,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,o.waitLogPath)(e)}();n.default.mkdirSync(i.default.dirname(t),{recursive:!0}),n.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,c,"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return s;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${s}`:s},"hermesSessionIdForBot",0,function(e,t){return`${t.sessionPrefix}${e}`},"loadHermesConfig",0,l],51749),e.s(["attemptFailure",0,u,"freezeAttemptInput",0,function(e){return Object.freeze({...e,target:Object.freeze({...e.target}),prompt:Object.freeze("text"===e.prompt.kind?{...e.prompt}:{...e.prompt,history:Object.freeze(e.prompt.history.map(e=>Object.freeze({...e})))}),sessionBinding:e.sessionBinding?Object.freeze({...e.sessionBinding}):null,correlation:Object.freeze({...e.correlation})})},"interruption",0,f,"preLaunchInterruption",0,p],29370);let g=["codex","claude","cursor","muse"];class m extends Error{code="invalid-runtime";constructor(e){super(`Invalid agent-deck runtime: ${JSON.stringify(String(e))}. Expected one of ${g.join("|")}.`)}}function h(e){if("string"==typeof e&&g.includes(e))return e;throw new m(e)}let y=["running","ended","error","died"],w=function(e){let[r,...n]=e;return new Promise(e=>{(0,t.execFile)(r,n,{maxBuffer:4194304},(t,n,i)=>{t&&"ENOENT"===t.code?e({stdout:"",stderr:`Command not found: ${r}`,exitCode:127}):e({stdout:String(n??""),stderr:String(i??""),exitCode:t&&"number"==typeof t.code?t.code:+!!t})})})};async function _(e){let t=function(e){let t=h(e.client);if(!e.deck)throw Error("agent-deck run requires a deck.");if(!e.cwd)throw Error("agent-deck run requires --cwd.");let r="string"==typeof e.prompt&&e.prompt.length>0,n="string"==typeof e.promptFile&&e.promptFile.length>0;if(r===n)throw Error("agent-deck run requires exactly one of --prompt/--prompt-file.");let i=["agent-deck","run",e.deck,"--client",t,"--cwd",e.cwd];return r&&i.push("--prompt",e.prompt),n&&i.push("--prompt-file",e.promptFile),i.push("--tools",e.tools??"readonly"),e.logPath&&i.push("--log",e.logPath),e.resume&&i.push("--resume",e.resume),e.detach&&i.push("--detach"),i}(e),r=await w(t);if(0!==r.exitCode)throw Error(`agent-deck run failed to start (exit ${r.exitCode}): ${r.stderr.slice(0,300)||r.stdout.slice(0,300)}`);return{...function(e){let t=e.match(/run\s+(\S+)\s+detached:\s+pid\s+(\S+)\s+log\s+(\S+)/);if(!t)throw Error(`Unrecognized agent-deck detach output: ${JSON.stringify(e.slice(0,200))}.`);return{runId:t[1],pid:t[2],logPath:t[3]}}(r.stdout),argv:t}}async function k(e){let t=await w(function(e){if(!e)throw Error("agent-deck run status requires a runId.");return["agent-deck","run","status",e,"--json"]}(e));if(0!==t.exitCode)throw Error(`agent-deck run status failed for ${e} (exit ${t.exitCode}): ${t.stderr.slice(0,300)}`);return function(e){let t;try{t=JSON.parse(e)}catch{throw Error("agent-deck run status did not return JSON.")}let r=String(t.state??"");if(!y.includes(r))throw Error(`Unknown agent-deck run state: ${JSON.stringify(r)}.`);let n=t.sessionId;return{runId:String(t.runId??""),deck:String(t.deck??""),client:String(t.client??""),state:r,sessionId:"string"==typeof n&&n.length>0?n:null,logPath:"string"==typeof t.logPath?t.logPath:null}}(t.stdout)}async function x(e,t){let r=await w(function(e,t){if(!e)throw Error("agent-deck run log requires a runId.");let r=["agent-deck","run","log",e,"--json"];return t?.tail!==void 0&&r.push("--tail",String(t.tail)),t?.follow&&r.push("--follow"),r}(e,t));if(0!==r.exitCode)throw Error(`agent-deck run log failed for ${e} (exit ${r.exitCode}): ${r.stderr.slice(0,300)}`);let n=function(e){let t=null,r=null,n=!1,i=null;for(let o of e.split("\n")){let e,s=o.trim();if(s){try{e=JSON.parse(s)}catch{continue}if("result"===e.t){let n=e.sessionId??e.session_id;"string"==typeof e.result&&e.result.length>0?(t={result:e.result,sessionId:"string"==typeof n&&n.length>0?n:null},r=null):(t=null,r=function(e){if(!Object.prototype.hasOwnProperty.call(e,"result"))return"missing";let t=e.result;return null===t?"null":Array.isArray(t)?"array":""===t?"empty string":typeof t}(e))}else if("end"===e.t)n=!0;else if("error"===e.t){let t=e.message??e.error;i="string"==typeof t&&t.length>0?t:"unknown log error"}}}return{result:t,resultMismatch:r,ended:n,errorMessage:i}}(r.stdout);return{raw:r.stdout,...n}}class v extends Error{category;constructor(e,t){super(t),this.category=e}}async function S(e){let t=await x(e,{follow:!0});if(t.errorMessage)throw new v("runtime_failed",`agent-deck run ${e} failed: ${t.errorMessage.slice(0,300)}`);if(!t.ended)throw new v("runtime_failed",`agent-deck run ${e} ended without a terminal log event; failing closed.`);let r=await k(e);if("error"===r.state||"died"===r.state)throw new v("runtime_failed",`agent-deck run ${e} ${r.state}`);if(!t.result)throw new v("result_contract",`agent-deck run ${e} result contract mismatch: expected a non-empty string result, got ${t.resultMismatch??"no result event"}.`);return{status:r,result:t.result.result,sessionId:r.sessionId??t.result.sessionId}}let b={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},E=["agent-deck","--version"];async function I(e){let t=b[h(e)];try{let e=await w(t);if(0!==e.exitCode)return!1;let r=await w(E);return 0===r.exitCode}catch{return!1}}async function $(e){if("hermes-gateway"===(0,r.agentTransport)(e))try{return null!==l()}catch{return!1}return I(e)}async function A(){let e=[];for(let t of r.AGENTS)await $(t)&&e.push(t);return e}function O(e){if("text"===e.kind)return e.text;let t=e.history.map(e=>`[${e.fromAgent?"you":e.speakerLabel}] ${e.content}`).join("\n\n");return`${e.system}
1
+ module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},54799,(e,t,r)=>{t.exports=e.x("crypto",()=>require("crypto"))},22734,(e,t,r)=>{t.exports=e.x("fs",()=>require("fs"))},70406,(e,t,r)=>{t.exports=e.x("next/dist/compiled/@opentelemetry/api",()=>require("next/dist/compiled/@opentelemetry/api"))},18622,(e,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.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,t,r)=>{t.exports=e.x("next/dist/server/runtime-reacts.external.js",()=>require("next/dist/server/runtime-reacts.external.js"))},93695,(e,t,r)=>{t.exports=e.x("next/dist/shared/lib/no-fallback-error.external.js",()=>require("next/dist/shared/lib/no-fallback-error.external.js"))},81111,(e,t,r)=>{t.exports=e.x("node:stream",()=>require("node:stream"))},14747,(e,t,r)=>{t.exports=e.x("path",()=>require("path"))},39229,51749,29370,e=>{"use strict";var t=e.i(33405),r=e.i(62349),n=e.i(54799),i=e.i(22734),o=e.i(14747),s=e.i(52036);let a="/v1/chat/completions";class l extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function d(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let i=(e.HERMES_BASE_URL||"").trim()||"http://127.0.0.1:8642",o=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",s=(e.HERMES_MODEL||"").trim()||"hermes";return{baseUrl:i.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:o,model:s}}function c(e,t){return`${t.sessionPrefix}${e}`}function u(e,t){return new l("aborted","Hermes request aborted")}async function f(e){var t;let r,n,{config:i,profilePath:o,sessionId:s,messages:a,signal:d}=e,c=e.fetchImpl||((e,t)=>fetch(e,t)),f=(t=i.baseUrl,r=t.replace(/\/+$/,""),n=o.startsWith("/")?o:`/${o}`,`${r}${n}`),p=new AbortController,g=!1,m=setTimeout(()=>{g=!0,p.abort()},i.timeoutMs);m.unref&&m.unref();let h=()=>p.abort();if(d){if(d.aborted)throw clearTimeout(m),u(d,i.timeoutMs);d.addEventListener("abort",h,{once:!0})}try{let e,t;try{e=await c(f,{method:"POST",headers:{Authorization:`Bearer ${i.apiKey}`,"Content-Type":"application/json","X-Hermes-Session-Id":s},body:JSON.stringify({model:i.model,stream:!1,messages:a}),signal:p.signal})}catch(e){if(g)throw new l("timeout",`Hermes request timed out after ${i.timeoutMs} ms`);if(p.signal.aborted)throw u(d??p.signal,i.timeoutMs);throw new l("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 l("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new l("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(m),d&&d.removeEventListener("abort",h)}}function p(e,t,r=null){return{category:e,code:r,message:t.slice(0,500)}}function g(e){let t=null,r=null;return{promise:new Promise(n=>{if(e.signal&&(r=()=>n(p("cancelled","The attempt was cancelled.")),e.signal.aborted?r():e.signal.addEventListener("abort",r,{once:!0})),"number"==typeof e.deadlineAt){let r=e.deadlineAt,i=()=>{let e=r-Date.now();e<=0?n(p("timed_out","The attempt passed its deadline.")):(t=setTimeout(i,Math.min(e,0x7fffffff))).unref&&t.unref()};i()}}),dispose:()=>{t&&clearTimeout(t),r&&e.signal&&e.signal.removeEventListener("abort",r)}}}function m(e){return e.signal?.aborted?p("cancelled","The attempt was cancelled before launch."):"number"==typeof e.deadlineAt&&Date.now()>=e.deadlineAt?p("timed_out","The attempt passed its deadline before launch."):null}e.s(["HERMES_DEFAULT_CHAT_PATH",0,a,"HermesError",0,l,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,s.waitLogPath)(e)}();i.default.mkdirSync(o.default.dirname(t),{recursive:!0}),i.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,f,"hermesFreshSessionIdForBot",0,function(e,t){return`${c(e,t)}-x-${(0,n.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,c,"loadHermesConfig",0,d],51749),e.s(["attemptFailure",0,p,"freezeAttemptInput",0,function(e){return Object.freeze({...e,target:Object.freeze({...e.target}),prompt:Object.freeze("text"===e.prompt.kind?{...e.prompt}:{...e.prompt,history:Object.freeze(e.prompt.history.map(e=>Object.freeze({...e})))}),sessionBinding:e.sessionBinding?Object.freeze({...e.sessionBinding}):null,correlation:Object.freeze({...e.correlation})})},"interruption",0,g,"preLaunchInterruption",0,m],29370);let h=["codex","claude","cursor","muse"];class y extends Error{code="invalid-runtime";constructor(e){super(`Invalid agent-deck runtime: ${JSON.stringify(String(e))}. Expected one of ${h.join("|")}.`)}}function w(e){if("string"==typeof e&&h.includes(e))return e;throw new y(e)}let _=["running","ended","error","died"],k=function(e){let[r,...n]=e;return new Promise(e=>{(0,t.execFile)(r,n,{maxBuffer:4194304},(t,n,i)=>{t&&"ENOENT"===t.code?e({stdout:"",stderr:`Command not found: ${r}`,exitCode:127}):e({stdout:String(n??""),stderr:String(i??""),exitCode:t&&"number"==typeof t.code?t.code:+!!t})})})};async function x(e){let t=function(e){let t=w(e.client);if(!e.deck)throw Error("agent-deck run requires a deck.");if(!e.cwd)throw Error("agent-deck run requires --cwd.");let r="string"==typeof e.prompt&&e.prompt.length>0,n="string"==typeof e.promptFile&&e.promptFile.length>0;if(r===n)throw Error("agent-deck run requires exactly one of --prompt/--prompt-file.");let i=["agent-deck","run",e.deck,"--client",t,"--cwd",e.cwd];return r&&i.push("--prompt",e.prompt),n&&i.push("--prompt-file",e.promptFile),i.push("--tools",e.tools??"readonly"),e.logPath&&i.push("--log",e.logPath),e.resume&&i.push("--resume",e.resume),e.detach&&i.push("--detach"),i}(e),r=await k(t);if(0!==r.exitCode)throw Error(`agent-deck run failed to start (exit ${r.exitCode}): ${r.stderr.slice(0,300)||r.stdout.slice(0,300)}`);return{...function(e){let t=e.match(/run\s+(\S+)\s+detached:\s+pid\s+(\S+)\s+log\s+(\S+)/);if(!t)throw Error(`Unrecognized agent-deck detach output: ${JSON.stringify(e.slice(0,200))}.`);return{runId:t[1],pid:t[2],logPath:t[3]}}(r.stdout),argv:t}}async function v(e){let t=await k(function(e){if(!e)throw Error("agent-deck run status requires a runId.");return["agent-deck","run","status",e,"--json"]}(e));if(0!==t.exitCode)throw Error(`agent-deck run status failed for ${e} (exit ${t.exitCode}): ${t.stderr.slice(0,300)}`);return function(e){let t;try{t=JSON.parse(e)}catch{throw Error("agent-deck run status did not return JSON.")}let r=String(t.state??"");if(!_.includes(r))throw Error(`Unknown agent-deck run state: ${JSON.stringify(r)}.`);let n=t.sessionId;return{runId:String(t.runId??""),deck:String(t.deck??""),client:String(t.client??""),state:r,sessionId:"string"==typeof n&&n.length>0?n:null,logPath:"string"==typeof t.logPath?t.logPath:null}}(t.stdout)}async function S(e,t){let r=await k(function(e,t){if(!e)throw Error("agent-deck run log requires a runId.");let r=["agent-deck","run","log",e,"--json"];return t?.tail!==void 0&&r.push("--tail",String(t.tail)),t?.follow&&r.push("--follow"),r}(e,t));if(0!==r.exitCode)throw Error(`agent-deck run log failed for ${e} (exit ${r.exitCode}): ${r.stderr.slice(0,300)}`);let n=function(e){let t=null,r=null,n=!1,i=null;for(let o of e.split("\n")){let e,s=o.trim();if(s){try{e=JSON.parse(s)}catch{continue}if("result"===e.t){let n=e.sessionId??e.session_id;"string"==typeof e.result&&e.result.length>0?(t={result:e.result,sessionId:"string"==typeof n&&n.length>0?n:null},r=null):(t=null,r=function(e){if(!Object.prototype.hasOwnProperty.call(e,"result"))return"missing";let t=e.result;return null===t?"null":Array.isArray(t)?"array":""===t?"empty string":typeof t}(e))}else if("end"===e.t)n=!0;else if("error"===e.t){let t=e.message??e.error;i="string"==typeof t&&t.length>0?t:"unknown log error"}}}return{result:t,resultMismatch:r,ended:n,errorMessage:i}}(r.stdout);return{raw:r.stdout,...n}}class b extends Error{category;constructor(e,t){super(t),this.category=e}}async function E(e){let t=await S(e,{follow:!0});if(t.errorMessage)throw new b("runtime_failed",`agent-deck run ${e} failed: ${t.errorMessage.slice(0,300)}`);if(!t.ended)throw new b("runtime_failed",`agent-deck run ${e} ended without a terminal log event; failing closed.`);let r=await v(e);if("error"===r.state||"died"===r.state)throw new b("runtime_failed",`agent-deck run ${e} ${r.state}`);if(!t.result)throw new b("result_contract",`agent-deck run ${e} result contract mismatch: expected a non-empty string result, got ${t.resultMismatch??"no result event"}.`);return{status:r,result:t.result.result,sessionId:r.sessionId??t.result.sessionId}}let I={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},$=["agent-deck","--version"];async function A(e){let t=I[w(e)];try{let e=await k(t);if(0!==e.exitCode)return!1;let r=await k($);return 0===r.exitCode}catch{return!1}}async function O(e){if("hermes-gateway"===(0,r.agentTransport)(e))try{return null!==d()}catch{return!1}return A(e)}async function j(){let e=[];for(let t of r.AGENTS)await O(t)&&e.push(t);return e}function P(e){if("text"===e.kind)return e.text;let t=e.history.map(e=>`[${e.fromAgent?"you":e.speakerLabel}] ${e.content}`).join("\n\n");return`${e.system}
2
2
 
3
3
  Conversation so far (reply to the last message):
4
4
 
5
- ${t}`}function j(e){return e instanceof Error?e.message:String(e)}e.s(["createAgentDeckAttemptAdapter",0,function(){let e="agent-deck-run";return{name:e,async run(t,r){let n,i,o=Date.now(),s=(t,r={})=>({status:"failed",adapter:e,externalRunId:r.runId??null,externalSessionId:r.sessionId??null,output:null,artifacts:r.logPath?[{kind:"run_log",ref:r.logPath}]:[],startedAt:o,finishedAt:Date.now(),failure:t});if("readonly"!==t.toolProfile&&"edit"!==t.toolProfile)return s(u("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(t.toolProfile))}.`));if(!t.deck)return s(u("unavailable","agent-deck run requires a deck."));if(!t.cwd)return s(u("unavailable","agent-deck run requires --cwd."));try{n=h(t.target.agent)}catch(e){return s(u("unavailable",j(e)))}let a=p(t);if(a)return s(a);let l=t.sessionBinding?.externalSessionId??null;try{i=await _({deck:t.deck,client:n,cwd:t.cwd,prompt:O(t.prompt),tools:t.toolProfile,...l?{resume:l}:{},detach:!0})}catch(e){return s(u("launch_failed",j(e)))}r?.({type:"started",adapter:e,at:Date.now(),externalRunId:i.runId,externalSessionId:null});let d=f(t),c=S(i.runId);c.catch(()=>{});let g={runId:i.runId,logPath:i.logPath};try{let t=await Promise.race([c.then(e=>({awaited:e}),e=>({error:e})),d.promise.then(e=>({interrupted:e}))]);if("interrupted"in t)return s(t.interrupted,g);if("error"in t){let e=t.error instanceof v?t.error.category:"runtime_failed";return s(u(e,j(t.error)),g)}let{awaited:r}=t,n=r.status.logPath??i.logPath;if(l&&null!==r.sessionId&&r.sessionId!==l)return s(u("session_mismatch",`resume run ${i.runId} forked the session (expected ${l}, got ${r.sessionId}); failing closed.`),{...g,sessionId:r.sessionId,logPath:n});return{status:"completed",adapter:e,externalRunId:i.runId,externalSessionId:r.sessionId??l,output:r.result,artifacts:n?[{kind:"run_log",ref:n}]:[],startedAt:o,finishedAt:Date.now(),failure:null}}finally{d.dispose()}}}},"deckPromptForAttempt",0,O,"listAvailableAgents",0,A,"parseDeckRuntime",0,h],39229)},62349,16979,e=>{"use strict";let t=[{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"}],r=[{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"}],o={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},s={...o,accessory:"crown"};function a(e){return"chief-of-staff"===String(e??"").trim().toLowerCase()}function l(e,t){return"string"==typeof t&&e.some(e=>e.id===t)}function d(e){let d=l(t,e.avatar_color)?e.avatar_color:o.color,c=l(r,e.avatar_eyes)?e.avatar_eyes:o.eyes;return{color:d,eyes:c,hands:l(n,e.avatar_hands)?e.avatar_hands:o.hands,accessory:l(i,e.avatar_accessory)?e.avatar_accessory:a(e.name)?s.accessory:o.accessory}}e.s(["isChiefOfStaffName",0,a,"resolveAvatar",0,d,"validateAvatarInput",0,function(e){let o=[],s={};if(null==e)return{errors:o,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(t,e))return e;throw Error(`Invalid avatar color: ${JSON.stringify(String(e))}. Expected one of ${t.map(e=>e.id).join("|")}.`)}(e.color)}catch(e){o.push(e instanceof Error?e.message:String(e))}if(void 0!==e.eyes)try{s.avatar_eyes=function(e){if(l(r,e))return e;throw Error(`Invalid avatar eyes: ${JSON.stringify(String(e))}. Expected one of ${r.map(e=>e.id).join("|")}.`)}(e.eyes)}catch(e){o.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){o.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){o.push(e instanceof Error?e.message:String(e))}return{errors:o,fields:s}}],16979);let c=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},f="hermes",p={hermes:"hermes-gateway",cursor:"agent-deck-run",claude:"agent-deck-run",codex:"agent-deck-run",muse:"agent-deck-run"};class g extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${c.join("|")}.`)}}class m 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 h="Deck ID is required. Select an Agent Deck before saving this agent.",y=`Agent is required. Expected one of ${c.join("|")}.`;function w(e){if(null==e)return null;let t=String(e).trim();if(!t)return null;if(c.includes(t))return t;throw new g(e)}function _(e){return null==e?null:String(e).trim()||null}function k(e){if(null==e)return null;if("string"!=typeof e)throw new m(e);let t=e.trim();if(!t)return null;if(!function(e){if(e.length>200||/\s/.test(e))return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<32||127===r)return!1}return!0}(t))throw new m(e);return t}function x(e){if(!0===e||1===e)return!0;if("string"==typeof e){let t=e.trim().toLowerCase();return"1"===t||"true"===t}return!1}function v(e){let t=f,r=!0;try{t=w(e.agent)??f}catch{r=!1}let n=_(e.deck_id),i=_(e.deck_name),o=_(e.working_directory),s=null===n||x(e.needs_deck_selection),a=r&&!s;return{agent:t,deck_id:n,deck_name:i,working_directory:o,needs_deck_selection:s,launchable:a}}let S=["codex","claude","cursor","muse"];function b(e){let t=_(e);return t&&S.includes(t)?t:null}let E=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection"];function I(e,t){(void 0!==e.runtime||void 0!==e.agent_client)&&t.push("Fields runtime/agent_client are no longer accepted. Send agent (hermes|cursor|claude|codex|muse) and deck_id instead."),void 0!==e.deck_name&&t.push("deck_name is a read-only legacy reference. Select a deck_id from the configured Agent Deck server instead.")}e.s(["AGENTS",0,c,"DEFAULT_AGENT",0,f,"agentTransport",0,function(e){return p[e]},"applyAgentUpdate",0,function(e,t){let r=v(e),n=t.agent??r.agent,i=void 0!==t.working_directory?t.working_directory:r.working_directory;return void 0!==t.deck_id?{agent:n,deck_id:t.deck_id,deck_name:null,working_directory:i,needs_deck_selection:!1}:{agent:n,deck_id:r.deck_id,deck_name:r.deck_name,working_directory:i,needs_deck_selection:r.needs_deck_selection}},"buildAvailabilityPayload",0,function(e){let t=[];for(let r of c)e.includes(r)&&t.push({agent:r,label:u[r],launchable:!0});return{agents:t}},"hasAgentUpdate",0,function(e){return["agent","deck_id","working_directory","runtime","agent_client","deck_name"].some(t=>void 0!==e[t])},"migrateLegacyAgentFields",0,function(e){let t=_(e.deck_id),r=_(e.deck_name),n=_(e.working_directory);try{let o=w(e.agent);if(o){var i;return{agent:o,deck_id:t,deck_name:r,working_directory:n,needs_deck_selection:null===t||(i=e.needs_deck_selection,x(i)),migrated:!1}}}catch{}let o=_(e.runtime),s=f,a=x(e.needs_deck_reselection);if("agent-deck"===o){let t=b(e.agent_client);t?s=t:a=!0}else if("hermes"!==o){let t=b(e.coding_runtime);t&&r&&n&&(s=t,a=!0)}return{agent:s,deck_id:t,deck_name:r,working_directory:n,needs_deck_selection:null===t||a,migrated:!0}},"resolveAgent",0,v,"serializeBot",0,function(e){let t=v(e),r={...e};for(let e of E)delete r[e];return{...r,agent:t.agent,deck_id:t.deck_id,deck_name:t.deck_name,working_directory:t.working_directory,needs_deck_selection:t.needs_deck_selection,launchable:t.launchable,avatar_config:d(e)}},"validateCreateAgent",0,function(e){let t=[];I(e,t);let r=f;try{r=w(e.agent)??f}catch(e){t.push(e instanceof Error?e.message:String(e))}let n=null;try{(n=k(e.deck_id))||t.push(h)}catch(e){t.push(e instanceof Error?e.message:String(e))}return{errors:t,normalized:{agent:r,deck_id:n??"",working_directory:_(e.working_directory)}}},"validateUpdateAgent",0,function(e){let t=[],r={};if(I(e,t),void 0!==e.agent)try{let n=w(e.agent);n?r.agent=n:t.push(y)}catch(e){t.push(e instanceof Error?e.message:String(e))}if(void 0!==e.deck_id)try{let n=k(e.deck_id);n?r.deck_id=n:t.push(h)}catch(e){t.push(e instanceof Error?e.message:String(e))}return void 0!==e.working_directory&&(r.working_directory=_(e.working_directory)),{errors:t,fields:r}}],62349)},52036,e=>{"use strict";var t=e.i(14747);function r(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?t.default.resolve(n):null}function n(e,t){return(e[t]||"").trim()||null}e.s(["botmancersHome",0,r,"dbPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_DB_PATH");if(i)return i;let o=r(e);return o?t.default.join(o,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_FILES_ROOT");if(i)return t.default.resolve(i);let o=r(e);return o?t.default.join(o,"files"):t.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_SKILLS_ROOT");if(i)return t.default.resolve(i);let o=r(e);return o?t.default.join(o,"skills"):t.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let i=n(e,"HERMES_WAIT_LOG_PATH");if(i)return i;let o=r(e);return o?t.default.join(o,"logs/specialist-waits.jsonl"):t.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
5
+ ${t}`}function C(e){return e instanceof Error?e.message:String(e)}e.s(["createAgentDeckAttemptAdapter",0,function(){let e="agent-deck-run";return{name:e,async run(t,r){let n,i,o=Date.now(),s=(t,r={})=>({status:"failed",adapter:e,externalRunId:r.runId??null,externalSessionId:r.sessionId??null,output:null,artifacts:r.logPath?[{kind:"run_log",ref:r.logPath}]:[],startedAt:o,finishedAt:Date.now(),failure:t});if("readonly"!==t.toolProfile&&"edit"!==t.toolProfile)return s(p("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(t.toolProfile))}.`));if(!t.deck)return s(p("unavailable","agent-deck run requires a deck."));if(!t.cwd)return s(p("unavailable","agent-deck run requires --cwd."));try{n=w(t.target.agent)}catch(e){return s(p("unavailable",C(e)))}let a=m(t);if(a)return s(a);let l=t.sessionBinding?.externalSessionId??null;try{i=await x({deck:t.deck,client:n,cwd:t.cwd,prompt:P(t.prompt),tools:t.toolProfile,...l?{resume:l}:{},detach:!0})}catch(e){return s(p("launch_failed",C(e)))}r?.({type:"started",adapter:e,at:Date.now(),externalRunId:i.runId,externalSessionId:null});let d=g(t),c=E(i.runId);c.catch(()=>{});let u={runId:i.runId,logPath:i.logPath};try{let t=await Promise.race([c.then(e=>({awaited:e}),e=>({error:e})),d.promise.then(e=>({interrupted:e}))]);if("interrupted"in t)return s(t.interrupted,u);if("error"in t){let e=t.error instanceof b?t.error.category:"runtime_failed";return s(p(e,C(t.error)),u)}let{awaited:r}=t,n=r.status.logPath??i.logPath;if(l&&null!==r.sessionId&&r.sessionId!==l)return s(p("session_mismatch",`resume run ${i.runId} forked the session (expected ${l}, got ${r.sessionId}); failing closed.`),{...u,sessionId:r.sessionId,logPath:n});return{status:"completed",adapter:e,externalRunId:i.runId,externalSessionId:r.sessionId??l,output:r.result,artifacts:n?[{kind:"run_log",ref:n}]:[],startedAt:o,finishedAt:Date.now(),failure:null}}finally{d.dispose()}}}},"deckPromptForAttempt",0,P,"listAvailableAgents",0,j,"parseDeckRuntime",0,w],39229)},62349,16979,e=>{"use strict";let t=[{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"}],r=[{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"}],o={color:"purple",eyes:"dots",hands:"folded",accessory:"none"},s={...o,accessory:"crown"};function a(e){return"chief-of-staff"===String(e??"").trim().toLowerCase()}function l(e,t){return"string"==typeof t&&e.some(e=>e.id===t)}function d(e){let d=l(t,e.avatar_color)?e.avatar_color:o.color,c=l(r,e.avatar_eyes)?e.avatar_eyes:o.eyes;return{color:d,eyes:c,hands:l(n,e.avatar_hands)?e.avatar_hands:o.hands,accessory:l(i,e.avatar_accessory)?e.avatar_accessory:a(e.name)?s.accessory:o.accessory}}e.s(["isChiefOfStaffName",0,a,"resolveAvatar",0,d,"validateAvatarInput",0,function(e){let o=[],s={};if(null==e)return{errors:o,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(t,e))return e;throw Error(`Invalid avatar color: ${JSON.stringify(String(e))}. Expected one of ${t.map(e=>e.id).join("|")}.`)}(e.color)}catch(e){o.push(e instanceof Error?e.message:String(e))}if(void 0!==e.eyes)try{s.avatar_eyes=function(e){if(l(r,e))return e;throw Error(`Invalid avatar eyes: ${JSON.stringify(String(e))}. Expected one of ${r.map(e=>e.id).join("|")}.`)}(e.eyes)}catch(e){o.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){o.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){o.push(e instanceof Error?e.message:String(e))}return{errors:o,fields:s}}],16979);let c=["hermes","cursor","claude","codex","muse"],u={hermes:"Hermes",cursor:"Cursor",claude:"Claude",codex:"Codex",muse:"Muse Code"},f="hermes",p={hermes:"hermes-gateway",cursor:"agent-deck-run",claude:"agent-deck-run",codex:"agent-deck-run",muse:"agent-deck-run"};class g extends Error{code="invalid-agent";constructor(e){super(`Invalid agent: ${JSON.stringify(String(e))}. Expected one of ${c.join("|")}.`)}}class m 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 h="Deck ID is required. Select an Agent Deck before saving this agent.",y=`Agent is required. Expected one of ${c.join("|")}.`;function w(e){if(null==e)return null;let t=String(e).trim();if(!t)return null;if(c.includes(t))return t;throw new g(e)}function _(e){return null==e?null:String(e).trim()||null}function k(e){if(null==e)return null;if("string"!=typeof e)throw new m(e);let t=e.trim();if(!t)return null;if(!function(e){if(e.length>200||/\s/.test(e))return!1;for(let t=0;t<e.length;t++){let r=e.charCodeAt(t);if(r<32||127===r)return!1}return!0}(t))throw new m(e);return t}function x(e){if(!0===e||1===e)return!0;if("string"==typeof e){let t=e.trim().toLowerCase();return"1"===t||"true"===t}return!1}function v(e){let t=f,r=!0;try{t=w(e.agent)??f}catch{r=!1}let n=_(e.deck_id),i=_(e.deck_name),o=_(e.working_directory),s=null===n||x(e.needs_deck_selection),a=r&&!s;return{agent:t,deck_id:n,deck_name:i,working_directory:o,needs_deck_selection:s,launchable:a}}let S=["codex","claude","cursor","muse"];function b(e){let t=_(e);return t&&S.includes(t)?t:null}let E=["runtime","agent_client","persistent_runtime","coding_runtime","needs_deck_reselection"];function I(e,t){(void 0!==e.runtime||void 0!==e.agent_client)&&t.push("Fields runtime/agent_client are no longer accepted. Send agent (hermes|cursor|claude|codex|muse) and deck_id instead."),void 0!==e.deck_name&&t.push("deck_name is a read-only legacy reference. Select a deck_id from the configured Agent Deck server instead.")}e.s(["AGENTS",0,c,"DEFAULT_AGENT",0,f,"agentTransport",0,function(e){return p[e]},"applyAgentUpdate",0,function(e,t){let r=v(e),n=t.agent??r.agent,i=void 0!==t.working_directory?t.working_directory:r.working_directory;return void 0!==t.deck_id?{agent:n,deck_id:t.deck_id,deck_name:null,working_directory:i,needs_deck_selection:!1}:{agent:n,deck_id:r.deck_id,deck_name:r.deck_name,working_directory:i,needs_deck_selection:r.needs_deck_selection}},"buildAvailabilityPayload",0,function(e){let t=[];for(let r of c)e.includes(r)&&t.push({agent:r,label:u[r],launchable:!0});return{agents:t}},"hasAgentUpdate",0,function(e){return["agent","deck_id","working_directory","runtime","agent_client","deck_name"].some(t=>void 0!==e[t])},"migrateLegacyAgentFields",0,function(e){let t=_(e.deck_id),r=_(e.deck_name),n=_(e.working_directory);try{let o=w(e.agent);if(o){var i;return{agent:o,deck_id:t,deck_name:r,working_directory:n,needs_deck_selection:null===t||(i=e.needs_deck_selection,x(i)),migrated:!1}}}catch{}let o=_(e.runtime),s=f,a=x(e.needs_deck_reselection);if("agent-deck"===o){let t=b(e.agent_client);t?s=t:a=!0}else if("hermes"!==o){let t=b(e.coding_runtime);t&&r&&n&&(s=t,a=!0)}return{agent:s,deck_id:t,deck_name:r,working_directory:n,needs_deck_selection:null===t||a,migrated:!0}},"resolveAgent",0,v,"serializeBot",0,function(e){let t=v(e),r={...e};for(let e of E)delete r[e];return{...r,agent:t.agent,deck_id:t.deck_id,deck_name:t.deck_name,working_directory:t.working_directory,needs_deck_selection:t.needs_deck_selection,launchable:t.launchable,avatar_config:d(e)}},"validateCreateAgent",0,function(e){let t=[];I(e,t);let r=f;try{r=w(e.agent)??f}catch(e){t.push(e instanceof Error?e.message:String(e))}let n=null;try{(n=k(e.deck_id))||t.push(h)}catch(e){t.push(e instanceof Error?e.message:String(e))}return{errors:t,normalized:{agent:r,deck_id:n??"",working_directory:_(e.working_directory)}}},"validateUpdateAgent",0,function(e){let t=[],r={};if(I(e,t),void 0!==e.agent)try{let n=w(e.agent);n?r.agent=n:t.push(y)}catch(e){t.push(e instanceof Error?e.message:String(e))}if(void 0!==e.deck_id)try{let n=k(e.deck_id);n?r.deck_id=n:t.push(h)}catch(e){t.push(e instanceof Error?e.message:String(e))}return void 0!==e.working_directory&&(r.working_directory=_(e.working_directory)),{errors:t,fields:r}}],62349)},52036,e=>{"use strict";var t=e.i(14747);function r(e=process.env){let n=(e.BOTMANCERS_HOME||"").trim();return n?t.default.resolve(n):null}function n(e,t){return(e[t]||"").trim()||null}e.s(["botmancersHome",0,r,"dbPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_DB_PATH");if(i)return i;let o=r(e);return o?t.default.join(o,"data/botmancers.db"):"botmancers.db"},"filesRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_FILES_ROOT");if(i)return t.default.resolve(i);let o=r(e);return o?t.default.join(o,"files"):t.default.resolve(process.cwd(),"files")},"skillsRootPath",0,function(e=process.env){let i=n(e,"BOTMANCERS_SKILLS_ROOT");if(i)return t.default.resolve(i);let o=r(e);return o?t.default.join(o,"skills"):t.default.resolve(process.cwd(),"skills")},"waitLogPath",0,function(e=process.env){let i=n(e,"HERMES_WAIT_LOG_PATH");if(i)return i;let o=r(e);return o?t.default.join(o,"logs/specialist-waits.jsonl"):t.default.join(process.cwd(),".temporal","specialist-waits.jsonl")}])}];
6
6
 
7
7
  //# sourceMappingURL=%5Broot-of-the-server%5D__1kvvdpx._.js.map
@@ -1,7 +1,7 @@
1
- module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},49091,e=>{"use strict";var t=e.i(89171),r=e.i(39229),n=e.i(62349);async function o(){try{let e=await (0,r.listAvailableAgents)();return t.NextResponse.json((0,n.buildAvailabilityPayload)(e))}catch(e){return console.error("Error probing agents:",e),t.NextResponse.json({error:"Failed to probe agents"},{status:500})}}e.s(["GET",0,o])},26784,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),a=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),g=e.i(10372),m=e.i(93695),w=e.i(9580);e.i(52474);var y=e.i(220);let v=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/availability/route",pathname:"/api/bots/availability",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/availability/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(49091),...{}}),{workAsyncStorage:E,workUnitAsyncStorage:R,serverHooks:x}=v;async function S(e,t,n){n.requestMeta&&(0,o.setRequestMeta)(e,n.requestMeta),v.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/bots/availability/route";E=E.replace(/\/index$/,"")||"/";let R=await v.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:x,deploymentId:S,params:b,nextConfig:I,parsedUrl:k,isDraftMode:A,prerenderManifest:C,routerServerContext:P,isOnDemandRevalidate:$,revalidateOnlyGenerated:_,resolvedPathname:O,clientReferenceManifest:T,serverActionsManifest:N}=R,H=(0,s.normalizeAppPath)(E),M=!!C.routes[O]&&(v.isDev||(0,w.isRouteCacheOwner)(O,v.cacheOwner,C.routes[O])),q=!!(C.dynamicRoutes[H]||M),D=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,k,!1):t.end("This page could not be found"),null);if(q&&!A){let e=C.dynamicRoutes[H];if(e&&!1===e.fallback&&!M){if(I.adapterPath)return await D();throw new m.NoFallbackError}}let U=null;!q||v.isDev||A||(U="/index"===(U=O)?"/":U);let j=!0===v.isDev||!q,F=q&&!j;N&&T&&(0,i.setManifestsSingleton)({page:E,clientReferenceManifest:T,serverActionsManifest:N});let L=e.method||"GET",B=(0,a.getTracer)(),z=B.getActiveScopeSpan(),J=!!(null==P?void 0:P.isWrappedByNextServer),K=!!(0,o.getRequestMeta)(e,"minimalMode"),G=(0,o.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,I,C,K);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let X={params:b,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!I.experimental.authInterrupts,useCacheTimeout:I.experimental.useCacheTimeout},cacheComponents:!!I.cacheComponents,validationLevel:I.experimental.instantInsights.validationLevel,isDraftMode:A,supportsDynamicResponse:j,incrementalCache:G,hmrRefreshHash:(0,o.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:I.cacheLife,staticPageGenerationTimeout:I.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>v.onRequestError(e,t,n,o,P)},sharedContext:{buildId:x,deploymentId:S}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),Y=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:r})=>{try{if(!K&&$&&_&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await v.handle(Y,X);e.fetchMetrics=X.renderOpts.fetchMetrics;let a=X.renderOpts.pendingWaitUntil;a&&n.waitUntil&&(n.waitUntil(a),a=void 0);let i=X.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(V,W,o,a),null;{let e=await o.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(o.headers);i&&(t[g.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,n=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=g.INFINITE_CACHE?!1!==r&&r>0?I.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:$})},!1,P),t}},Q=async(o,i)=>{try{var s,l;let o=await v.handleResponse({req:e,nextConfig:I,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:$,revalidateOnlyGenerated:_,responseGenerator:Z,waitUntil:n.waitUntil,isMinimalMode:K});if(!q)return;if((null==o||null==(s=o.value)?void 0:s.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==o||null==(l=o.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",$?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let a=(0,f.fromNodeOutgoingHttpHeaders)(o.value.headers);K&&q||a.delete(g.NEXT_CACHE_TAGS_HEADER),!o.cacheControl||t.getHeader("Cache-Control")||a.get("Cache-Control")||a.set("Cache-Control",(0,h.getCacheControlHeader)(o.cacheControl)),await (0,p.sendResponse)(V,W,new Response(o.value.body,{headers:a,status:o.value.status||200}));return}catch(t){if(t instanceof m.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:$})},!1,P),q)throw t;await (0,p.sendResponse)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!o)return;let e=t.statusCode;o.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(o.setStatus({code:a.SpanStatusCode.ERROR}),o.setAttribute("error.type",e.toString()));let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||H,s=`${L} ${n}`;o.setAttributes({"next.route":n,"http.route":n,"next.span_name":s}),o.updateName(s),i&&i!==o&&(i.setAttribute("http.route",n),i.updateName(s))})()}};if(J&&z)await Q(z,void 0);else{let t=B.getActiveScopeSpan();await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${E}`,kind:a.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Q(e,t)),void 0,!J)}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:R})},"routeModule",0,v,"serverHooks",0,x,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,R])},39229,51749,29370,e=>{"use strict";var t=e.i(33405),r=e.i(62349),n=e.i(22734),o=e.i(14747),a=e.i(52036);let i="/v1/chat/completions";class s extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function l(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let o=(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:o.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}}function u(e,t){return new s("aborted","Hermes request aborted")}async function d(e){var t;let r,n,{config:o,profilePath:a,sessionId:i,messages:l,signal:d}=e,c=e.fetchImpl||((e,t)=>fetch(e,t)),p=(t=o.baseUrl,r=t.replace(/\/+$/,""),n=a.startsWith("/")?a:`/${a}`,`${r}${n}`),f=new AbortController,h=!1,g=setTimeout(()=>{h=!0,f.abort()},o.timeoutMs);g.unref&&g.unref();let m=()=>f.abort();if(d){if(d.aborted)throw clearTimeout(g),u(d,o.timeoutMs);d.addEventListener("abort",m,{once:!0})}try{let e,t;try{e=await c(p,{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:l}),signal:f.signal})}catch(e){if(h)throw new s("timeout",`Hermes request timed out after ${o.timeoutMs} ms`);if(f.signal.aborted)throw u(d??f.signal,o.timeoutMs);throw new s("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 s("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new s("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(g),d&&d.removeEventListener("abort",m)}}function c(e,t,r=null){return{category:e,code:r,message:t.slice(0,500)}}function p(e){let t=null,r=null;return{promise:new Promise(n=>{if(e.signal&&(r=()=>n(c("cancelled","The attempt was cancelled.")),e.signal.aborted?r():e.signal.addEventListener("abort",r,{once:!0})),"number"==typeof e.deadlineAt){let r=e.deadlineAt,o=()=>{let e=r-Date.now();e<=0?n(c("timed_out","The attempt passed its deadline.")):(t=setTimeout(o,Math.min(e,0x7fffffff))).unref&&t.unref()};o()}}),dispose:()=>{t&&clearTimeout(t),r&&e.signal&&e.signal.removeEventListener("abort",r)}}}function f(e){return e.signal?.aborted?c("cancelled","The attempt was cancelled before launch."):"number"==typeof e.deadlineAt&&Date.now()>=e.deadlineAt?c("timed_out","The attempt passed its deadline before launch."):null}e.s(["HERMES_DEFAULT_CHAT_PATH",0,i,"HermesError",0,s,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,a.waitLogPath)(e)}();n.default.mkdirSync(o.default.dirname(t),{recursive:!0}),n.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,d,"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return i;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${i}`:i},"hermesSessionIdForBot",0,function(e,t){return`${t.sessionPrefix}${e}`},"loadHermesConfig",0,l],51749),e.s(["attemptFailure",0,c,"freezeAttemptInput",0,function(e){return Object.freeze({...e,target:Object.freeze({...e.target}),prompt:Object.freeze("text"===e.prompt.kind?{...e.prompt}:{...e.prompt,history:Object.freeze(e.prompt.history.map(e=>Object.freeze({...e})))}),sessionBinding:e.sessionBinding?Object.freeze({...e.sessionBinding}):null,correlation:Object.freeze({...e.correlation})})},"interruption",0,p,"preLaunchInterruption",0,f],29370);let h=["codex","claude","cursor","muse"];class g extends Error{code="invalid-runtime";constructor(e){super(`Invalid agent-deck runtime: ${JSON.stringify(String(e))}. Expected one of ${h.join("|")}.`)}}function m(e){if("string"==typeof e&&h.includes(e))return e;throw new g(e)}let w=["running","ended","error","died"],y=function(e){let[r,...n]=e;return new Promise(e=>{(0,t.execFile)(r,n,{maxBuffer:4194304},(t,n,o)=>{t&&"ENOENT"===t.code?e({stdout:"",stderr:`Command not found: ${r}`,exitCode:127}):e({stdout:String(n??""),stderr:String(o??""),exitCode:t&&"number"==typeof t.code?t.code:+!!t})})})};async function v(e){let t=function(e){let t=m(e.client);if(!e.deck)throw Error("agent-deck run requires a deck.");if(!e.cwd)throw Error("agent-deck run requires --cwd.");let r="string"==typeof e.prompt&&e.prompt.length>0,n="string"==typeof e.promptFile&&e.promptFile.length>0;if(r===n)throw Error("agent-deck run requires exactly one of --prompt/--prompt-file.");let o=["agent-deck","run",e.deck,"--client",t,"--cwd",e.cwd];return r&&o.push("--prompt",e.prompt),n&&o.push("--prompt-file",e.promptFile),o.push("--tools",e.tools??"readonly"),e.logPath&&o.push("--log",e.logPath),e.resume&&o.push("--resume",e.resume),e.detach&&o.push("--detach"),o}(e),r=await y(t);if(0!==r.exitCode)throw Error(`agent-deck run failed to start (exit ${r.exitCode}): ${r.stderr.slice(0,300)||r.stdout.slice(0,300)}`);return{...function(e){let t=e.match(/run\s+(\S+)\s+detached:\s+pid\s+(\S+)\s+log\s+(\S+)/);if(!t)throw Error(`Unrecognized agent-deck detach output: ${JSON.stringify(e.slice(0,200))}.`);return{runId:t[1],pid:t[2],logPath:t[3]}}(r.stdout),argv:t}}async function E(e){let t=await y(function(e){if(!e)throw Error("agent-deck run status requires a runId.");return["agent-deck","run","status",e,"--json"]}(e));if(0!==t.exitCode)throw Error(`agent-deck run status failed for ${e} (exit ${t.exitCode}): ${t.stderr.slice(0,300)}`);return function(e){let t;try{t=JSON.parse(e)}catch{throw Error("agent-deck run status did not return JSON.")}let r=String(t.state??"");if(!w.includes(r))throw Error(`Unknown agent-deck run state: ${JSON.stringify(r)}.`);let n=t.sessionId;return{runId:String(t.runId??""),deck:String(t.deck??""),client:String(t.client??""),state:r,sessionId:"string"==typeof n&&n.length>0?n:null,logPath:"string"==typeof t.logPath?t.logPath:null}}(t.stdout)}async function R(e,t){let r=await y(function(e,t){if(!e)throw Error("agent-deck run log requires a runId.");let r=["agent-deck","run","log",e,"--json"];return t?.tail!==void 0&&r.push("--tail",String(t.tail)),t?.follow&&r.push("--follow"),r}(e,t));if(0!==r.exitCode)throw Error(`agent-deck run log failed for ${e} (exit ${r.exitCode}): ${r.stderr.slice(0,300)}`);let n=function(e){let t=null,r=null,n=!1,o=null;for(let a of e.split("\n")){let e,i=a.trim();if(i){try{e=JSON.parse(i)}catch{continue}if("result"===e.t){let n=e.sessionId??e.session_id;"string"==typeof e.result&&e.result.length>0?(t={result:e.result,sessionId:"string"==typeof n&&n.length>0?n:null},r=null):(t=null,r=function(e){if(!Object.prototype.hasOwnProperty.call(e,"result"))return"missing";let t=e.result;return null===t?"null":Array.isArray(t)?"array":""===t?"empty string":typeof t}(e))}else if("end"===e.t)n=!0;else if("error"===e.t){let t=e.message??e.error;o="string"==typeof t&&t.length>0?t:"unknown log error"}}}return{result:t,resultMismatch:r,ended:n,errorMessage:o}}(r.stdout);return{raw:r.stdout,...n}}class x extends Error{category;constructor(e,t){super(t),this.category=e}}async function S(e){let t=await R(e,{follow:!0});if(t.errorMessage)throw new x("runtime_failed",`agent-deck run ${e} failed: ${t.errorMessage.slice(0,300)}`);if(!t.ended)throw new x("runtime_failed",`agent-deck run ${e} ended without a terminal log event; failing closed.`);let r=await E(e);if("error"===r.state||"died"===r.state)throw new x("runtime_failed",`agent-deck run ${e} ${r.state}`);if(!t.result)throw new x("result_contract",`agent-deck run ${e} result contract mismatch: expected a non-empty string result, got ${t.resultMismatch??"no result event"}.`);return{status:r,result:t.result.result,sessionId:r.sessionId??t.result.sessionId}}let b={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},I=["agent-deck","--version"];async function k(e){let t=b[m(e)];try{let e=await y(t);if(0!==e.exitCode)return!1;let r=await y(I);return 0===r.exitCode}catch{return!1}}async function A(e){if("hermes-gateway"===(0,r.agentTransport)(e))try{return null!==l()}catch{return!1}return k(e)}async function C(){let e=[];for(let t of r.AGENTS)await A(t)&&e.push(t);return e}function P(e){if("text"===e.kind)return e.text;let t=e.history.map(e=>`[${e.fromAgent?"you":e.speakerLabel}] ${e.content}`).join("\n\n");return`${e.system}
1
+ module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},49091,e=>{"use strict";var t=e.i(89171),r=e.i(39229),n=e.i(62349);async function o(){try{let e=await (0,r.listAvailableAgents)();return t.NextResponse.json((0,n.buildAvailabilityPayload)(e))}catch(e){return console.error("Error probing agents:",e),t.NextResponse.json({error:"Failed to probe agents"},{status:500})}}e.s(["GET",0,o])},26784,e=>{"use strict";var t=e.i(47909),r=e.i(74017),n=e.i(96250),o=e.i(59756),a=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),d=e.i(95169),c=e.i(47587),p=e.i(66012),f=e.i(70101),h=e.i(26937),g=e.i(10372),m=e.i(93695),w=e.i(9580);e.i(52474);var y=e.i(220);let v=new t.AppRouteRouteModule({definition:{kind:r.RouteKind.APP_ROUTE,page:"/api/bots/availability/route",pathname:"/api/bots/availability",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/bots/availability/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(49091),...{}}),{workAsyncStorage:E,workUnitAsyncStorage:R,serverHooks:x}=v;async function S(e,t,n){n.requestMeta&&(0,o.setRequestMeta)(e,n.requestMeta),v.isDev&&(0,o.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let E="/api/bots/availability/route";E=E.replace(/\/index$/,"")||"/";let R=await v.prepare(e,t,{srcPage:E,multiZoneDraftMode:!1});if(!R)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:x,deploymentId:S,params:b,nextConfig:I,parsedUrl:k,isDraftMode:A,prerenderManifest:C,routerServerContext:P,isOnDemandRevalidate:$,revalidateOnlyGenerated:_,resolvedPathname:O,clientReferenceManifest:T,serverActionsManifest:N}=R,H=(0,s.normalizeAppPath)(E),M=!!C.routes[O]&&(v.isDev||(0,w.isRouteCacheOwner)(O,v.cacheOwner,C.routes[O])),q=!!(C.dynamicRoutes[H]||M),D=async()=>((null==P?void 0:P.render404)?await P.render404(e,t,k,!1):t.end("This page could not be found"),null);if(q&&!A){let e=C.dynamicRoutes[H];if(e&&!1===e.fallback&&!M){if(I.adapterPath)return await D();throw new m.NoFallbackError}}let U=null;!q||v.isDev||A||(U="/index"===(U=O)?"/":U);let F=!0===v.isDev||!q,j=q&&!F;N&&T&&(0,i.setManifestsSingleton)({page:E,clientReferenceManifest:T,serverActionsManifest:N});let L=e.method||"GET",B=(0,a.getTracer)(),z=B.getActiveScopeSpan(),J=!!(null==P?void 0:P.isWrappedByNextServer),K=!!(0,o.getRequestMeta)(e,"minimalMode"),G=(0,o.getRequestMeta)(e,"incrementalCache")||await v.getIncrementalCache(e,I,C,K);null==G||G.resetRequestCache(),globalThis.__incrementalCache=G;let X={params:b,previewProps:C.preview,renderOpts:{experimental:{authInterrupts:!!I.experimental.authInterrupts,useCacheTimeout:I.experimental.useCacheTimeout},cacheComponents:!!I.cacheComponents,validationLevel:I.experimental.instantInsights.validationLevel,isDraftMode:A,supportsDynamicResponse:F,incrementalCache:G,hmrRefreshHash:(0,o.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:I.cacheLife,staticPageGenerationTimeout:I.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,r,n,o)=>v.onRequestError(e,t,n,o,P)},sharedContext:{buildId:x,deploymentId:S}},V=new l.NodeNextRequest(e),W=new l.NodeNextResponse(t),Y=u.NextRequestAdapter.fromNodeNextRequest(V,(0,u.signalFromNodeResponse)(t)),Z=async({previousCacheEntry:r})=>{try{if(!K&&$&&_&&!r)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let o=await v.handle(Y,X);e.fetchMetrics=X.renderOpts.fetchMetrics;let a=X.renderOpts.pendingWaitUntil;a&&n.waitUntil&&(n.waitUntil(a),a=void 0);let i=X.renderOpts.collectedTags;if(!q)return await (0,p.sendResponse)(V,W,o,a),null;{let e=await o.blob(),t=(0,f.toNodeOutgoingHttpHeaders)(o.headers);i&&(t[g.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let r=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,n=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=g.INFINITE_CACHE?!1!==r&&r>0?I.expireTime:void 0:X.renderOpts.collectedExpire;return{value:{kind:y.CachedRouteKind.APP_ROUTE,status:o.status,body:Buffer.from(await e.arrayBuffer()),headers:t},cacheControl:{revalidate:r,expire:n}}}}catch(t){throw(null==r?void 0:r.isStale)&&await v.onRequestError(e,t,{routerKind:"App Router",routePath:E,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:$})},!1,P),t}},Q=async(o,i)=>{try{var s,l;let o=await v.handleResponse({req:e,nextConfig:I,cacheKey:U,routeKind:r.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:C,isRoutePPREnabled:!1,isOnDemandRevalidate:$,revalidateOnlyGenerated:_,responseGenerator:Z,waitUntil:n.waitUntil,isMinimalMode:K});if(!q)return;if((null==o||null==(s=o.value)?void 0:s.kind)!==y.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==o||null==(l=o.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});K||t.setHeader("x-nextjs-cache",$?"REVALIDATED":o.isMiss?"MISS":o.isStale?"STALE":"HIT"),A&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let a=(0,f.fromNodeOutgoingHttpHeaders)(o.value.headers);K&&q||a.delete(g.NEXT_CACHE_TAGS_HEADER),!o.cacheControl||t.getHeader("Cache-Control")||a.get("Cache-Control")||a.set("Cache-Control",(0,h.getCacheControlHeader)(o.cacheControl)),await (0,p.sendResponse)(V,W,new Response(o.value.body,{headers:a,status:o.value.status||200}));return}catch(t){if(t instanceof m.NoFallbackError||await v.onRequestError(e,t,{routerKind:"App Router",routePath:H,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:j,isOnDemandRevalidate:$})},!1,P),q)throw t;await (0,p.sendResponse)(V,W,new Response(null,{status:500}));return}finally{(()=>{if(!o)return;let e=t.statusCode;o.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(o.setStatus({code:a.SpanStatusCode.ERROR}),o.setAttribute("error.type",e.toString()));let r=B.getRootSpanAttributes();if(!r)return;if(r.get("next.span_type")!==d.BaseServerSpan.handleRequest)return console.warn(`Unexpected root span type '${r.get("next.span_type")}'. Please report this Next.js issue https://github.com/vercel/next.js`);let n=r.get("next.route")||H,s=`${L} ${n}`;o.setAttributes({"next.route":n,"http.route":n,"next.span_name":s}),o.updateName(s),i&&i!==o&&(i.setAttribute("http.route",n),i.updateName(s))})()}};if(J&&z)await Q(z,void 0);else{let t=B.getActiveScopeSpan();await B.withPropagatedContext(e.headers,()=>B.trace(d.BaseServerSpan.handleRequest,{spanName:`${L} ${E}`,kind:a.SpanKind.SERVER,attributes:{"http.method":L,"http.target":e.url}},e=>Q(e,t)),void 0,!J)}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:E,workUnitAsyncStorage:R})},"routeModule",0,v,"serverHooks",0,x,"workAsyncStorage",0,E,"workUnitAsyncStorage",0,R])},39229,51749,29370,e=>{"use strict";var t=e.i(33405),r=e.i(62349),n=e.i(54799),o=e.i(22734),a=e.i(14747),i=e.i(52036);let s="/v1/chat/completions";class l extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function u(e=process.env){var t;let r,n=(e.HERMES_API_SERVER_KEY||"").trim();if(!n)return null;let o=(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:o.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}}function d(e,t){return`${t.sessionPrefix}${e}`}function c(e,t){return new l("aborted","Hermes request aborted")}async function p(e){var t;let r,n,{config:o,profilePath:a,sessionId:i,messages:s,signal:u}=e,d=e.fetchImpl||((e,t)=>fetch(e,t)),p=(t=o.baseUrl,r=t.replace(/\/+$/,""),n=a.startsWith("/")?a:`/${a}`,`${r}${n}`),f=new AbortController,h=!1,g=setTimeout(()=>{h=!0,f.abort()},o.timeoutMs);g.unref&&g.unref();let m=()=>f.abort();if(u){if(u.aborted)throw clearTimeout(g),c(u,o.timeoutMs);u.addEventListener("abort",m,{once:!0})}try{let e,t;try{e=await d(p,{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:s}),signal:f.signal})}catch(e){if(h)throw new l("timeout",`Hermes request timed out after ${o.timeoutMs} ms`);if(f.signal.aborted)throw c(u??f.signal,o.timeoutMs);throw new l("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 l("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new l("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(g),u&&u.removeEventListener("abort",m)}}function f(e,t,r=null){return{category:e,code:r,message:t.slice(0,500)}}function h(e){let t=null,r=null;return{promise:new Promise(n=>{if(e.signal&&(r=()=>n(f("cancelled","The attempt was cancelled.")),e.signal.aborted?r():e.signal.addEventListener("abort",r,{once:!0})),"number"==typeof e.deadlineAt){let r=e.deadlineAt,o=()=>{let e=r-Date.now();e<=0?n(f("timed_out","The attempt passed its deadline.")):(t=setTimeout(o,Math.min(e,0x7fffffff))).unref&&t.unref()};o()}}),dispose:()=>{t&&clearTimeout(t),r&&e.signal&&e.signal.removeEventListener("abort",r)}}}function g(e){return e.signal?.aborted?f("cancelled","The attempt was cancelled before launch."):"number"==typeof e.deadlineAt&&Date.now()>=e.deadlineAt?f("timed_out","The attempt passed its deadline before launch."):null}e.s(["HERMES_DEFAULT_CHAT_PATH",0,s,"HermesError",0,l,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,i.waitLogPath)(e)}();o.default.mkdirSync(a.default.dirname(t),{recursive:!0}),o.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,p,"hermesFreshSessionIdForBot",0,function(e,t){return`${d(e,t)}-x-${(0,n.randomUUID)()}`},"hermesProfilePathForBot",0,function(e){let t=(e.hermes_profile||"").trim();if(!t)return s;let r=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"");return r?`/p/${r}${s}`:s},"hermesSessionIdForBot",0,d,"loadHermesConfig",0,u],51749),e.s(["attemptFailure",0,f,"freezeAttemptInput",0,function(e){return Object.freeze({...e,target:Object.freeze({...e.target}),prompt:Object.freeze("text"===e.prompt.kind?{...e.prompt}:{...e.prompt,history:Object.freeze(e.prompt.history.map(e=>Object.freeze({...e})))}),sessionBinding:e.sessionBinding?Object.freeze({...e.sessionBinding}):null,correlation:Object.freeze({...e.correlation})})},"interruption",0,h,"preLaunchInterruption",0,g],29370);let m=["codex","claude","cursor","muse"];class w extends Error{code="invalid-runtime";constructor(e){super(`Invalid agent-deck runtime: ${JSON.stringify(String(e))}. Expected one of ${m.join("|")}.`)}}function y(e){if("string"==typeof e&&m.includes(e))return e;throw new w(e)}let v=["running","ended","error","died"],E=function(e){let[r,...n]=e;return new Promise(e=>{(0,t.execFile)(r,n,{maxBuffer:4194304},(t,n,o)=>{t&&"ENOENT"===t.code?e({stdout:"",stderr:`Command not found: ${r}`,exitCode:127}):e({stdout:String(n??""),stderr:String(o??""),exitCode:t&&"number"==typeof t.code?t.code:+!!t})})})};async function R(e){let t=function(e){let t=y(e.client);if(!e.deck)throw Error("agent-deck run requires a deck.");if(!e.cwd)throw Error("agent-deck run requires --cwd.");let r="string"==typeof e.prompt&&e.prompt.length>0,n="string"==typeof e.promptFile&&e.promptFile.length>0;if(r===n)throw Error("agent-deck run requires exactly one of --prompt/--prompt-file.");let o=["agent-deck","run",e.deck,"--client",t,"--cwd",e.cwd];return r&&o.push("--prompt",e.prompt),n&&o.push("--prompt-file",e.promptFile),o.push("--tools",e.tools??"readonly"),e.logPath&&o.push("--log",e.logPath),e.resume&&o.push("--resume",e.resume),e.detach&&o.push("--detach"),o}(e),r=await E(t);if(0!==r.exitCode)throw Error(`agent-deck run failed to start (exit ${r.exitCode}): ${r.stderr.slice(0,300)||r.stdout.slice(0,300)}`);return{...function(e){let t=e.match(/run\s+(\S+)\s+detached:\s+pid\s+(\S+)\s+log\s+(\S+)/);if(!t)throw Error(`Unrecognized agent-deck detach output: ${JSON.stringify(e.slice(0,200))}.`);return{runId:t[1],pid:t[2],logPath:t[3]}}(r.stdout),argv:t}}async function x(e){let t=await E(function(e){if(!e)throw Error("agent-deck run status requires a runId.");return["agent-deck","run","status",e,"--json"]}(e));if(0!==t.exitCode)throw Error(`agent-deck run status failed for ${e} (exit ${t.exitCode}): ${t.stderr.slice(0,300)}`);return function(e){let t;try{t=JSON.parse(e)}catch{throw Error("agent-deck run status did not return JSON.")}let r=String(t.state??"");if(!v.includes(r))throw Error(`Unknown agent-deck run state: ${JSON.stringify(r)}.`);let n=t.sessionId;return{runId:String(t.runId??""),deck:String(t.deck??""),client:String(t.client??""),state:r,sessionId:"string"==typeof n&&n.length>0?n:null,logPath:"string"==typeof t.logPath?t.logPath:null}}(t.stdout)}async function S(e,t){let r=await E(function(e,t){if(!e)throw Error("agent-deck run log requires a runId.");let r=["agent-deck","run","log",e,"--json"];return t?.tail!==void 0&&r.push("--tail",String(t.tail)),t?.follow&&r.push("--follow"),r}(e,t));if(0!==r.exitCode)throw Error(`agent-deck run log failed for ${e} (exit ${r.exitCode}): ${r.stderr.slice(0,300)}`);let n=function(e){let t=null,r=null,n=!1,o=null;for(let a of e.split("\n")){let e,i=a.trim();if(i){try{e=JSON.parse(i)}catch{continue}if("result"===e.t){let n=e.sessionId??e.session_id;"string"==typeof e.result&&e.result.length>0?(t={result:e.result,sessionId:"string"==typeof n&&n.length>0?n:null},r=null):(t=null,r=function(e){if(!Object.prototype.hasOwnProperty.call(e,"result"))return"missing";let t=e.result;return null===t?"null":Array.isArray(t)?"array":""===t?"empty string":typeof t}(e))}else if("end"===e.t)n=!0;else if("error"===e.t){let t=e.message??e.error;o="string"==typeof t&&t.length>0?t:"unknown log error"}}}return{result:t,resultMismatch:r,ended:n,errorMessage:o}}(r.stdout);return{raw:r.stdout,...n}}class b extends Error{category;constructor(e,t){super(t),this.category=e}}async function I(e){let t=await S(e,{follow:!0});if(t.errorMessage)throw new b("runtime_failed",`agent-deck run ${e} failed: ${t.errorMessage.slice(0,300)}`);if(!t.ended)throw new b("runtime_failed",`agent-deck run ${e} ended without a terminal log event; failing closed.`);let r=await x(e);if("error"===r.state||"died"===r.state)throw new b("runtime_failed",`agent-deck run ${e} ${r.state}`);if(!t.result)throw new b("result_contract",`agent-deck run ${e} result contract mismatch: expected a non-empty string result, got ${t.resultMismatch??"no result event"}.`);return{status:r,result:t.result.result,sessionId:r.sessionId??t.result.sessionId}}let k={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},A=["agent-deck","--version"];async function C(e){let t=k[y(e)];try{let e=await E(t);if(0!==e.exitCode)return!1;let r=await E(A);return 0===r.exitCode}catch{return!1}}async function P(e){if("hermes-gateway"===(0,r.agentTransport)(e))try{return null!==u()}catch{return!1}return C(e)}async function $(){let e=[];for(let t of r.AGENTS)await P(t)&&e.push(t);return e}function _(e){if("text"===e.kind)return e.text;let t=e.history.map(e=>`[${e.fromAgent?"you":e.speakerLabel}] ${e.content}`).join("\n\n");return`${e.system}
2
2
 
3
3
  Conversation so far (reply to the last message):
4
4
 
5
- ${t}`}function $(e){return e instanceof Error?e.message:String(e)}e.s(["createAgentDeckAttemptAdapter",0,function(){let e="agent-deck-run";return{name:e,async run(t,r){let n,o,a=Date.now(),i=(t,r={})=>({status:"failed",adapter:e,externalRunId:r.runId??null,externalSessionId:r.sessionId??null,output:null,artifacts:r.logPath?[{kind:"run_log",ref:r.logPath}]:[],startedAt:a,finishedAt:Date.now(),failure:t});if("readonly"!==t.toolProfile&&"edit"!==t.toolProfile)return i(c("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(t.toolProfile))}.`));if(!t.deck)return i(c("unavailable","agent-deck run requires a deck."));if(!t.cwd)return i(c("unavailable","agent-deck run requires --cwd."));try{n=m(t.target.agent)}catch(e){return i(c("unavailable",$(e)))}let s=f(t);if(s)return i(s);let l=t.sessionBinding?.externalSessionId??null;try{o=await v({deck:t.deck,client:n,cwd:t.cwd,prompt:P(t.prompt),tools:t.toolProfile,...l?{resume:l}:{},detach:!0})}catch(e){return i(c("launch_failed",$(e)))}r?.({type:"started",adapter:e,at:Date.now(),externalRunId:o.runId,externalSessionId:null});let u=p(t),d=S(o.runId);d.catch(()=>{});let h={runId:o.runId,logPath:o.logPath};try{let t=await Promise.race([d.then(e=>({awaited:e}),e=>({error:e})),u.promise.then(e=>({interrupted:e}))]);if("interrupted"in t)return i(t.interrupted,h);if("error"in t){let e=t.error instanceof x?t.error.category:"runtime_failed";return i(c(e,$(t.error)),h)}let{awaited:r}=t,n=r.status.logPath??o.logPath;if(l&&null!==r.sessionId&&r.sessionId!==l)return i(c("session_mismatch",`resume run ${o.runId} forked the session (expected ${l}, got ${r.sessionId}); failing closed.`),{...h,sessionId:r.sessionId,logPath:n});return{status:"completed",adapter:e,externalRunId:o.runId,externalSessionId:r.sessionId??l,output:r.result,artifacts:n?[{kind:"run_log",ref:n}]:[],startedAt:a,finishedAt:Date.now(),failure:null}}finally{u.dispose()}}}},"deckPromptForAttempt",0,P,"listAvailableAgents",0,C,"parseDeckRuntime",0,m],39229)}];
5
+ ${t}`}function O(e){return e instanceof Error?e.message:String(e)}e.s(["createAgentDeckAttemptAdapter",0,function(){let e="agent-deck-run";return{name:e,async run(t,r){let n,o,a=Date.now(),i=(t,r={})=>({status:"failed",adapter:e,externalRunId:r.runId??null,externalSessionId:r.sessionId??null,output:null,artifacts:r.logPath?[{kind:"run_log",ref:r.logPath}]:[],startedAt:a,finishedAt:Date.now(),failure:t});if("readonly"!==t.toolProfile&&"edit"!==t.toolProfile)return i(f("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(t.toolProfile))}.`));if(!t.deck)return i(f("unavailable","agent-deck run requires a deck."));if(!t.cwd)return i(f("unavailable","agent-deck run requires --cwd."));try{n=y(t.target.agent)}catch(e){return i(f("unavailable",O(e)))}let s=g(t);if(s)return i(s);let l=t.sessionBinding?.externalSessionId??null;try{o=await R({deck:t.deck,client:n,cwd:t.cwd,prompt:_(t.prompt),tools:t.toolProfile,...l?{resume:l}:{},detach:!0})}catch(e){return i(f("launch_failed",O(e)))}r?.({type:"started",adapter:e,at:Date.now(),externalRunId:o.runId,externalSessionId:null});let u=h(t),d=I(o.runId);d.catch(()=>{});let c={runId:o.runId,logPath:o.logPath};try{let t=await Promise.race([d.then(e=>({awaited:e}),e=>({error:e})),u.promise.then(e=>({interrupted:e}))]);if("interrupted"in t)return i(t.interrupted,c);if("error"in t){let e=t.error instanceof b?t.error.category:"runtime_failed";return i(f(e,O(t.error)),c)}let{awaited:r}=t,n=r.status.logPath??o.logPath;if(l&&null!==r.sessionId&&r.sessionId!==l)return i(f("session_mismatch",`resume run ${o.runId} forked the session (expected ${l}, got ${r.sessionId}); failing closed.`),{...c,sessionId:r.sessionId,logPath:n});return{status:"completed",adapter:e,externalRunId:o.runId,externalSessionId:r.sessionId??l,output:r.result,artifacts:n?[{kind:"run_log",ref:n}]:[],startedAt:a,finishedAt:Date.now(),failure:null}}finally{u.dispose()}}}},"deckPromptForAttempt",0,_,"listAvailableAgents",0,$,"parseDeckRuntime",0,y],39229)}];
6
6
 
7
7
  //# sourceMappingURL=%5Broot-of-the-server%5D__1qoa704._.js.map
@@ -0,0 +1,7 @@
1
+ module.exports=[33405,(e,t,r)=>{t.exports=e.x("child_process",()=>require("child_process"))},46786,(e,t,r)=>{t.exports=e.x("os",()=>require("os"))},39229,51749,29370,e=>{"use strict";var t=e.i(33405),r=e.i(62349),n=e.i(54799),s=e.i(22734),i=e.i(14747),o=e.i(52036);let a="/v1/chat/completions";class l extends Error{code;status;constructor(e,t,r){super(t),this.name="HermesError",this.code=e,this.status=r}}function c(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",i=(e.HERMES_SESSION_PREFIX||"").trim()||"botmancer-specialist-",o=(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:i,model:o}}function u(e,t){return`${t.sessionPrefix}${e}`}function d(e,t){return new l("aborted","Hermes request aborted")}async function f(e){var t;let r,n,{config:s,profilePath:i,sessionId:o,messages:a,signal:c}=e,u=e.fetchImpl||((e,t)=>fetch(e,t)),f=(t=s.baseUrl,r=t.replace(/\/+$/,""),n=i.startsWith("/")?i:`/${i}`,`${r}${n}`),h=new AbortController,p=!1,g=setTimeout(()=>{p=!0,h.abort()},s.timeoutMs);g.unref&&g.unref();let m=()=>h.abort();if(c){if(c.aborted)throw clearTimeout(g),d(c,s.timeoutMs);c.addEventListener("abort",m,{once:!0})}try{let e,t;try{e=await u(f,{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:a}),signal:h.signal})}catch(e){if(p)throw new l("timeout",`Hermes request timed out after ${s.timeoutMs} ms`);if(h.signal.aborted)throw d(c??h.signal,s.timeoutMs);throw new l("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 l("http",t,e.status)}try{t=JSON.parse(r)}catch{throw new l("protocol","Hermes reply was not JSON",e.status)}return t.choices?.[0]?.message?.content?.trim()||"No response"}finally{clearTimeout(g),c&&c.removeEventListener("abort",m)}}function h(e,t,r=null){return{category:e,code:r,message:t.slice(0,500)}}function p(e){let t=null,r=null;return{promise:new Promise(n=>{if(e.signal&&(r=()=>n(h("cancelled","The attempt was cancelled.")),e.signal.aborted?r():e.signal.addEventListener("abort",r,{once:!0})),"number"==typeof e.deadlineAt){let r=e.deadlineAt,s=()=>{let e=r-Date.now();e<=0?n(h("timed_out","The attempt passed its deadline.")):(t=setTimeout(s,Math.min(e,0x7fffffff))).unref&&t.unref()};s()}}),dispose:()=>{t&&clearTimeout(t),r&&e.signal&&e.signal.removeEventListener("abort",r)}}}function g(e){return e.signal?.aborted?h("cancelled","The attempt was cancelled before launch."):"number"==typeof e.deadlineAt&&Date.now()>=e.deadlineAt?h("timed_out","The attempt passed its deadline before launch."):null}e.s(["HERMES_DEFAULT_CHAT_PATH",0,a,"HermesError",0,l,"appendHermesWaitLog",0,function(e){try{let t=function(e=process.env){return(0,o.waitLogPath)(e)}();s.default.mkdirSync(i.default.dirname(t),{recursive:!0}),s.default.appendFileSync(t,JSON.stringify({at:new Date().toISOString(),...e})+"\n")}catch(e){console.error("wait log failed",e)}},"hermesChat",0,f,"hermesFreshSessionIdForBot",0,function(e,t){return`${u(e,t)}-x-${(0,n.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,u,"loadHermesConfig",0,c],51749),e.s(["attemptFailure",0,h,"freezeAttemptInput",0,function(e){return Object.freeze({...e,target:Object.freeze({...e.target}),prompt:Object.freeze("text"===e.prompt.kind?{...e.prompt}:{...e.prompt,history:Object.freeze(e.prompt.history.map(e=>Object.freeze({...e})))}),sessionBinding:e.sessionBinding?Object.freeze({...e.sessionBinding}):null,correlation:Object.freeze({...e.correlation})})},"interruption",0,p,"preLaunchInterruption",0,g],29370);let m=["codex","claude","cursor","muse"];class w extends Error{code="invalid-runtime";constructor(e){super(`Invalid agent-deck runtime: ${JSON.stringify(String(e))}. Expected one of ${m.join("|")}.`)}}function y(e){if("string"==typeof e&&m.includes(e))return e;throw new w(e)}let E=["running","ended","error","died"],v=function(e){let[r,...n]=e;return new Promise(e=>{(0,t.execFile)(r,n,{maxBuffer:4194304},(t,n,s)=>{t&&"ENOENT"===t.code?e({stdout:"",stderr:`Command not found: ${r}`,exitCode:127}):e({stdout:String(n??""),stderr:String(s??""),exitCode:t&&"number"==typeof t.code?t.code:+!!t})})})};async function k(e){let t=function(e){let t=y(e.client);if(!e.deck)throw Error("agent-deck run requires a deck.");if(!e.cwd)throw Error("agent-deck run requires --cwd.");let r="string"==typeof e.prompt&&e.prompt.length>0,n="string"==typeof e.promptFile&&e.promptFile.length>0;if(r===n)throw Error("agent-deck run requires exactly one of --prompt/--prompt-file.");let s=["agent-deck","run",e.deck,"--client",t,"--cwd",e.cwd];return r&&s.push("--prompt",e.prompt),n&&s.push("--prompt-file",e.promptFile),s.push("--tools",e.tools??"readonly"),e.logPath&&s.push("--log",e.logPath),e.resume&&s.push("--resume",e.resume),e.detach&&s.push("--detach"),s}(e),r=await v(t);if(0!==r.exitCode)throw Error(`agent-deck run failed to start (exit ${r.exitCode}): ${r.stderr.slice(0,300)||r.stdout.slice(0,300)}`);return{...function(e){let t=e.match(/run\s+(\S+)\s+detached:\s+pid\s+(\S+)\s+log\s+(\S+)/);if(!t)throw Error(`Unrecognized agent-deck detach output: ${JSON.stringify(e.slice(0,200))}.`);return{runId:t[1],pid:t[2],logPath:t[3]}}(r.stdout),argv:t}}async function S(e){let t=await v(function(e){if(!e)throw Error("agent-deck run status requires a runId.");return["agent-deck","run","status",e,"--json"]}(e));if(0!==t.exitCode)throw Error(`agent-deck run status failed for ${e} (exit ${t.exitCode}): ${t.stderr.slice(0,300)}`);return function(e){let t;try{t=JSON.parse(e)}catch{throw Error("agent-deck run status did not return JSON.")}let r=String(t.state??"");if(!E.includes(r))throw Error(`Unknown agent-deck run state: ${JSON.stringify(r)}.`);let n=t.sessionId;return{runId:String(t.runId??""),deck:String(t.deck??""),client:String(t.client??""),state:r,sessionId:"string"==typeof n&&n.length>0?n:null,logPath:"string"==typeof t.logPath?t.logPath:null}}(t.stdout)}async function $(e,t){let r=await v(function(e,t){if(!e)throw Error("agent-deck run log requires a runId.");let r=["agent-deck","run","log",e,"--json"];return t?.tail!==void 0&&r.push("--tail",String(t.tail)),t?.follow&&r.push("--follow"),r}(e,t));if(0!==r.exitCode)throw Error(`agent-deck run log failed for ${e} (exit ${r.exitCode}): ${r.stderr.slice(0,300)}`);let n=function(e){let t=null,r=null,n=!1,s=null;for(let i of e.split("\n")){let e,o=i.trim();if(o){try{e=JSON.parse(o)}catch{continue}if("result"===e.t){let n=e.sessionId??e.session_id;"string"==typeof e.result&&e.result.length>0?(t={result:e.result,sessionId:"string"==typeof n&&n.length>0?n:null},r=null):(t=null,r=function(e){if(!Object.prototype.hasOwnProperty.call(e,"result"))return"missing";let t=e.result;return null===t?"null":Array.isArray(t)?"array":""===t?"empty string":typeof t}(e))}else if("end"===e.t)n=!0;else if("error"===e.t){let t=e.message??e.error;s="string"==typeof t&&t.length>0?t:"unknown log error"}}}return{result:t,resultMismatch:r,ended:n,errorMessage:s}}(r.stdout);return{raw:r.stdout,...n}}class b extends Error{category;constructor(e,t){super(t),this.category=e}}async function A(e){let t=await $(e,{follow:!0});if(t.errorMessage)throw new b("runtime_failed",`agent-deck run ${e} failed: ${t.errorMessage.slice(0,300)}`);if(!t.ended)throw new b("runtime_failed",`agent-deck run ${e} ended without a terminal log event; failing closed.`);let r=await S(e);if("error"===r.state||"died"===r.state)throw new b("runtime_failed",`agent-deck run ${e} ${r.state}`);if(!t.result)throw new b("result_contract",`agent-deck run ${e} result contract mismatch: expected a non-empty string result, got ${t.resultMismatch??"no result event"}.`);return{status:r,result:t.result.result,sessionId:r.sessionId??t.result.sessionId}}let x={codex:["codex","--version"],claude:["claude","--version"],cursor:["cursor","--version"],muse:["muse","--version"]},I=["agent-deck","--version"];async function _(e){let t=x[y(e)];try{let e=await v(t);if(0!==e.exitCode)return!1;let r=await v(I);return 0===r.exitCode}catch{return!1}}async function T(e){if("hermes-gateway"===(0,r.agentTransport)(e))try{return null!==c()}catch{return!1}return _(e)}async function O(){let e=[];for(let t of r.AGENTS)await T(t)&&e.push(t);return e}function R(e){if("text"===e.kind)return e.text;let t=e.history.map(e=>`[${e.fromAgent?"you":e.speakerLabel}] ${e.content}`).join("\n\n");return`${e.system}
2
+
3
+ Conversation so far (reply to the last message):
4
+
5
+ ${t}`}function N(e){return e instanceof Error?e.message:String(e)}e.s(["createAgentDeckAttemptAdapter",0,function(){let e="agent-deck-run";return{name:e,async run(t,r){let n,s,i=Date.now(),o=(t,r={})=>({status:"failed",adapter:e,externalRunId:r.runId??null,externalSessionId:r.sessionId??null,output:null,artifacts:r.logPath?[{kind:"run_log",ref:r.logPath}]:[],startedAt:i,finishedAt:Date.now(),failure:t});if("readonly"!==t.toolProfile&&"edit"!==t.toolProfile)return o(h("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(t.toolProfile))}.`));if(!t.deck)return o(h("unavailable","agent-deck run requires a deck."));if(!t.cwd)return o(h("unavailable","agent-deck run requires --cwd."));try{n=y(t.target.agent)}catch(e){return o(h("unavailable",N(e)))}let a=g(t);if(a)return o(a);let l=t.sessionBinding?.externalSessionId??null;try{s=await k({deck:t.deck,client:n,cwd:t.cwd,prompt:R(t.prompt),tools:t.toolProfile,...l?{resume:l}:{},detach:!0})}catch(e){return o(h("launch_failed",N(e)))}r?.({type:"started",adapter:e,at:Date.now(),externalRunId:s.runId,externalSessionId:null});let c=p(t),u=A(s.runId);u.catch(()=>{});let d={runId:s.runId,logPath:s.logPath};try{let t=await Promise.race([u.then(e=>({awaited:e}),e=>({error:e})),c.promise.then(e=>({interrupted:e}))]);if("interrupted"in t)return o(t.interrupted,d);if("error"in t){let e=t.error instanceof b?t.error.category:"runtime_failed";return o(h(e,N(t.error)),d)}let{awaited:r}=t,n=r.status.logPath??s.logPath;if(l&&null!==r.sessionId&&r.sessionId!==l)return o(h("session_mismatch",`resume run ${s.runId} forked the session (expected ${l}, got ${r.sessionId}); failing closed.`),{...d,sessionId:r.sessionId,logPath:n});return{status:"completed",adapter:e,externalRunId:s.runId,externalSessionId:r.sessionId??l,output:r.result,artifacts:n?[{kind:"run_log",ref:n}]:[],startedAt:i,finishedAt:Date.now(),failure:null}}finally{c.dispose()}}}},"deckPromptForAttempt",0,R,"listAvailableAgents",0,O,"parseDeckRuntime",0,y],39229)},67505,e=>{"use strict";var t=e.i(22734),r=e.i(46786),n=e.i(14747),s=e.i(62294);let i="http://127.0.0.1:1111",o="agent_deck_server_url";class a extends Error{code="invalid-agent-deck-server-url";constructor(e){super(`Invalid Agent Deck server URL: ${JSON.stringify(String(e??""))}. Expected an http(s) URL such as ${i}.`)}}function l(e){let t;if("string"!=typeof e)throw new a(e);let r=e.trim();if(!r)throw new a(e);try{t=new URL(r)}catch{throw new a(e)}if("http:"!==t.protocol&&"https:"!==t.protocol||!t.hostname)throw new a(e);return t.toString().replace(/\/+$/,"")}function c(){try{let e=s.workspaceSettings.get(o);if(null===e)return i;return l(e)}catch{return i}}function u(e){return`${l(e)}/api/launch/decks`}class d extends Error{code;attemptedUrls;constructor(e,t,r="agent-deck-discovery-failed"){super(e),this.code=r,this.attemptedUrls=t}}function f(e,t){let r=globalThis.fetch;if("function"!=typeof r)throw Error("fetch is not available in this runtime.");return r(e,t).then(e=>({json:()=>e.json()}))}function h(e){try{return JSON.stringify(e??"").includes("GRANT_REQUIRED")}catch{return!1}}async function p(e){let t,r=u(e?.serverUrl!==void 0?l(e.serverUrl):c()),n=e?.fetchImpl??f;try{let e=await n(r,{method:"GET"});t=await e.json()}catch(e){if(e instanceof d){if(0===e.attemptedUrls.length)throw new d(e.message,[r],e.code);throw e}throw new d(`Cannot reach the Agent Deck server at ${r}: ${e instanceof Error?e.message:String(e)}. Check the workspace Agent Deck URL and that the server is running.`,[r],"connection-failed")}if(h(t))throw new d("Agent Deck server refused deck discovery with GRANT_REQUIRED. Only GET /api/launch/decks is supported; GET /api/decks must not be used.",[r],"grant-required");try{var s=t;if("object"!=typeof s||null===s)throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');if(h(s))throw new d("Agent Deck server refused deck discovery with GRANT_REQUIRED. Only GET /api/launch/decks is supported; GET /api/decks must not be used.",[],"grant-required");if(!0!==s.success)throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');let e=s.data,r=e?.decks;if(!Array.isArray(r))throw Error('Expected {"success":true,"data":{"decks":[{"id","name"}]}}.');let n=r.map(e=>{if("object"!=typeof e||null===e)throw Error("Expected every deck to carry a string id and name.");let t="string"==typeof e.id?e.id.trim():"",r="string"==typeof e.name?e.name.trim():"";if(!t||!r)throw Error("Expected every deck to carry a string id and name.");return{id:t,name:r}});return n.sort((e,t)=>e.id<t.id?-1:+(e.id>t.id)),n}catch(e){if(e instanceof d)throw e;throw new d(`Agent Deck server at ${r} returned an unexpected deck payload: ${e instanceof Error?e.message:String(e)}`,[r],"invalid-payload")}}function g(e){if(e&&e.trim())return e;let t=(process.env.HOME??"").trim();return t||r.default.homedir()}e.s(["AgentDeckDiscoveryError",0,d,"DEFAULT_AGENT_DECK_SERVER_URL",0,i,"InvalidAgentDeckServerUrlError",0,a,"agentDeckDecksUrl",0,u,"getAgentDeckServerUrl",0,c,"isLocalAgentDeckUrl",0,function(e){let t;try{t=new URL("string"==typeof e?e.trim():"")}catch{return!1}let r=t.hostname.trim().toLowerCase().replace(/^\[|\]$/g,"");return!!("localhost"===r||"::1"===r||"::ffff:127.0.0.1"===r||/^127\.\d+\.\d+\.\d+$/.test(r))},"listAgentDecks",0,p,"remoteLaunchUnsupportedMessage",0,function(e){return`[Deck failed] Remote Agent Deck launch is not supported: the workspace Agent Deck server is non-local and remote \`agent-deck run\` targeting is unconfirmed. Point the workspace server URL at the local Agent Deck server to launch. (server_url=${e})`},"resolveAndEnsureBotWorkdir",0,function(e,r,s){let i=function(e,t,r){let s="string"==typeof t?t.trim():"";if(s)return"~"===s?g(r):s.startsWith("~/")||s.startsWith("~\\")?n.default.join(g(r),s.slice(2)):s;let i=String(e??"").trim();if(!i)throw Error("defaultBotWorkdir requires a bot id.");let o=g(r);return n.default.resolve(o,".botmancers",i)}(e,r,s);return t.default.mkdirSync(i,{recursive:!0}),i},"setAgentDeckServerUrl",0,function(e){let t=l(e);return s.workspaceSettings.set(o,t),t}])},35631,26571,e=>{"use strict";var t=e.i(22734),r=e.i(14747),n=e.i(54799),s=e.i(62294),i=e.i(52036);let o="BOTMANCERS_SERVICE_TOKENS",a=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,l=/^sha256:([0-9a-f]{64})$/;class c extends Error{constructor(e){super(e),this.name="ServiceTokenConfigError"}}function u(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):"",i=l.exec(e>0?n.slice(e+1).toLowerCase():"");if(!a.test(s)||!i)throw new c(`${o} entries must be <service-id>=sha256:<64 hex digits>.`);if(r.has(s))throw new c(`${o} lists service ${s} twice.`);r.add(s),t.push({serviceId:s,digest:Buffer.from(i[1],"hex")})}return t}e.s(["SERVICE_TOKENS_ENV",0,o,"ServiceTokenConfigError",0,c,"parseServiceTokens",0,u,"serviceTokenAuthenticatorFromEnv",0,function(e=process.env){let t=u(e[o]);return t.length?e=>{let r,s,i=(s=(r=e.headers.get("authorization"))?/^Bearer[ \t]+(\S+)[ \t]*$/i.exec(r):null)?s[1]:null;if(!i||i.length>4096)return null;let o=(0,n.createHash)("sha256").update(i,"utf8").digest(),a=null;for(let e of t)(0,n.timingSafeEqual)(o,e.digest)&&null===a&&(a=e.serviceId);return a?{kind:"service",id:a}:null}:null}],26571);let d=["agents:read","sessions:read","conversations:read","sessions:message","exchanges:read","exchanges:create"],f=["botmancers-exchanges","botmancers-engine"],h=/^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$/,p=/^[A-Za-z0-9][A-Za-z0-9._:-]{0,127}$/;class g extends Error{constructor(e){super(e),this.name="ServiceGrantsError"}}function m(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function w(e,t,r){let n=Object.keys(e).find(e=>!t.includes(e));if(void 0!==n)throw new g(`${r} has an unknown field "${n}".`)}let y=null;e.s(["EXCHANGE_KEY_PREFIX",0,"exchange:","MESSAGE_KEY_PREFIX",0,"message:","SERVICE_CAPABILITIES",0,d,"loadServiceGrants",0,function(e=process.env){let a,l=function(e=process.env){let t=(e.BOTMANCERS_SERVICE_GRANTS_PATH||"").trim();if(t)return r.default.resolve(t);let n=(0,i.botmancersHome)(e);return n?r.default.join(n,"config/service-grants.json"):null}(e);if(!l)return{state:"absent",path:null};try{a=t.default.statSync(l)}catch(e){if("ENOENT"===e.code)return{state:"absent",path:l};return{state:"invalid",path:l,reason:"The document cannot be read."}}let E=(0,n.createHash)("sha256").update(e[o]??"","utf8").digest("hex"),v=new Set(s.default.prepare("SELECT id FROM bots").all().map(e=>e.id)),k=(0,n.createHash)("sha256").update([...v].sort().join("\n"),"utf8").digest("hex"),S=[l,a.ino,a.size,a.mode,a.uid,a.mtimeMs,E,k].join(":");if(y&&y.key===S)return y.state;let $=function(e,r,n,s){let i;if(!r.isFile())return{state:"invalid",path:e,reason:"The document is not a regular file."};if("function"==typeof process.getuid&&r.uid!==process.getuid())return{state:"invalid",path:e,reason:"The document must be owned by the user running Botmancers."};if((63&r.mode)!=0)return{state:"invalid",path:e,reason:"The document must not be readable or writable by group or others (chmod 600)."};if("string"==typeof n)return{state:"invalid",path:e,reason:n};if(r.size>65536)return{state:"invalid",path:e,reason:"The document exceeds 65536 bytes."};try{i=t.default.readFileSync(e,"utf8")}catch{return{state:"invalid",path:e,reason:"The document cannot be read."}}try{return{state:"loaded",path:e,grants:function(e,t,r){let n;try{n=JSON.parse(e)}catch{throw new g("The document is not valid JSON.")}if(!m(n))throw new g("The document must be a JSON object.");if(w(n,["version","grants"],"The document"),1!==n.version)throw new g("version must be 1.");if(!Array.isArray(n.grants))throw new g("grants must be a list.");if(n.grants.length>512)throw new g("grants has more than 512 entries.");let s=new Map;return n.grants.forEach((e,n)=>{let i=`grants[${n}]`;if(!m(e))throw new g(`${i} must be an object.`);w(e,["service","agent","capabilities"],i);let{service:a,agent:l,capabilities:c}=e;if("string"!=typeof a||!h.test(a))throw new g(`${i}.service must be a configured service id (letters, digits, ".", "_", "-").`);if(f.includes(a))throw new g(`${i}.service names a reserved engine principal.`);if(t&&!t.has(a))throw new g(`${i}.service is not a configured service principal (${o}).`);if("string"!=typeof l||!p.test(l))throw new g(`${i}.agent must be one Agent id; wildcards are not allowed.`);if(r&&!r.has(l))throw new g(`${i}.agent is not a registered Agent.`);if(!Array.isArray(c)||0===c.length)throw new g(`${i}.capabilities must list at least one capability.`);let u=new Set;for(let e of c){if(!("string"==typeof e&&d.includes(e)))throw new g(`${i}.capabilities has an unknown capability.`);if(u.has(e))throw new g(`${i}.capabilities lists ${e} twice.`);u.add(e)}let y=s.get(a)??new Map;if(y.has(l))throw new g(`${i} repeats the grant of service ${a} for that Agent.`);y.set(l,u),s.set(a,y)}),s}(i,n,s)}}catch(t){if(t instanceof g)return{state:"invalid",path:e,reason:t.message};throw t}}(l,a,function(e){try{return new Set(u(e[o]).map(e=>e.serviceId))}catch(e){if(e instanceof c)return`${o} is malformed, so no grant can name a configured service.`;throw e}}(e),v);return y={key:S,state:$},$}],35631)}];
6
+
7
+ //# sourceMappingURL=%5Broot-of-the-server%5D__1slu7d7._.js.map
@@ -0,0 +1,30 @@
1
+ module.exports=[30323,e=>{"use strict";var t=e.i(69936);async function a(e,{params:n}){let{id:r}=await n;return(0,t.handleGetExchange)(e,r)}e.s(["GET",0,a])},80033,e=>{"use strict";var t=e.i(47909),a=e.i(74017),n=e.i(96250),r=e.i(59756),i=e.i(61916),s=e.i(74677),o=e.i(69741),d=e.i(16795),l=e.i(87718),u=e.i(95169),c=e.i(47587),_=e.i(66012),p=e.i(70101),g=e.i(26937),h=e.i(10372),v=e.i(93695),E=e.i(9580);e.i(52474);var m=e.i(220);let R=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/v0/exchanges/[id]/route",pathname:"/api/v0/exchanges/[id]",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/v0/exchanges/[id]/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(30323),...{}}),{workAsyncStorage:b,workUnitAsyncStorage:f,serverHooks:A}=R;async function S(e,t,n){n.requestMeta&&(0,r.setRequestMeta)(e,n.requestMeta),R.isDev&&(0,r.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let b="/api/v0/exchanges/[id]/route";b=b.replace(/\/index$/,"")||"/";let f=await R.prepare(e,t,{srcPage:b,multiZoneDraftMode:!1});if(!f)return t.statusCode=400,t.end("Bad Request"),null==n.waitUntil||n.waitUntil.call(n,Promise.resolve()),null;let{buildId:A,deploymentId:S,params:C,nextConfig:O,parsedUrl:w,isDraftMode:N,prerenderManifest:T,routerServerContext:x,isOnDemandRevalidate:q,revalidateOnlyGenerated:y,resolvedPathname:k,clientReferenceManifest:I,serverActionsManifest:H}=f,L=(0,o.normalizeAppPath)(b),P=!!T.routes[k]&&(R.isDev||(0,E.isRouteCacheOwner)(k,R.cacheOwner,T.routes[k])),M=!!(T.dynamicRoutes[L]||P),D=async()=>((null==x?void 0:x.render404)?await x.render404(e,t,w,!1):t.end("This page could not be found"),null);if(M&&!N){let e=T.dynamicRoutes[L];if(e&&!1===e.fallback&&!P){if(O.adapterPath)return await D();throw new v.NoFallbackError}}let F=null;!M||R.isDev||N||(F="/index"===(F=k)?"/":F);let U=!0===R.isDev||!M,$=M&&!U;H&&I&&(0,s.setManifestsSingleton)({page:b,clientReferenceManifest:I,serverActionsManifest:H});let G=e.method||"GET",J=(0,i.getTracer)(),W=J.getActiveScopeSpan(),K=!!(null==x?void 0:x.isWrappedByNextServer),j=!!(0,r.getRequestMeta)(e,"minimalMode"),B=(0,r.getRequestMeta)(e,"incrementalCache")||await R.getIncrementalCache(e,O,T,j);null==B||B.resetRequestCache(),globalThis.__incrementalCache=B;let X={params:C,previewProps:T.preview,renderOpts:{experimental:{authInterrupts:!!O.experimental.authInterrupts,useCacheTimeout:O.experimental.useCacheTimeout},cacheComponents:!!O.cacheComponents,validationLevel:O.experimental.instantInsights.validationLevel,isDraftMode:N,supportsDynamicResponse:U,incrementalCache:B,hmrRefreshHash:(0,r.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:O.cacheLife,staticPageGenerationTimeout:O.staticPageGenerationTimeout,waitUntil:n.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,n,r)=>R.onRequestError(e,t,n,r,x)},sharedContext:{buildId:A,deploymentId:S}},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(!j&&q&&y&&!a)return t.statusCode=404,t.setHeader("x-nextjs-cache","REVALIDATED"),t.end("This page could not be found"),null;let r=await R.handle(Y,X);e.fetchMetrics=X.renderOpts.fetchMetrics;let i=X.renderOpts.pendingWaitUntil;i&&n.waitUntil&&(n.waitUntil(i),i=void 0);let s=X.renderOpts.collectedTags;if(!M)return await (0,_.sendResponse)(V,z,r,i),null;{let e=await r.blob(),t=(0,p.toNodeOutgoingHttpHeaders)(r.headers);s&&(t[h.NEXT_CACHE_TAGS_HEADER]=s),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=h.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,n=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=h.INFINITE_CACHE?!1!==a&&a>0?O.expireTime:void 0:X.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 R.onRequestError(e,t,{routerKind:"App Router",routePath:b,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:q})},!1,x),t}},Q=async(r,s)=>{try{var o,d;let r=await R.handleResponse({req:e,nextConfig:O,cacheKey:F,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:T,isRoutePPREnabled:!1,isOnDemandRevalidate:q,revalidateOnlyGenerated:y,responseGenerator:Z,waitUntil:n.waitUntil,isMinimalMode:j});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});j||t.setHeader("x-nextjs-cache",q?"REVALIDATED":r.isMiss?"MISS":r.isStale?"STALE":"HIT"),N&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let i=(0,p.fromNodeOutgoingHttpHeaders)(r.value.headers);j&&M||i.delete(h.NEXT_CACHE_TAGS_HEADER),!r.cacheControl||t.getHeader("Cache-Control")||i.get("Cache-Control")||i.set("Cache-Control",(0,g.getCacheControlHeader)(r.cacheControl)),await (0,_.sendResponse)(V,z,new Response(r.value.body,{headers:i,status:r.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await R.onRequestError(e,t,{routerKind:"App Router",routePath:L,routeType:"route",revalidateReason:(0,c.getRevalidateReason)({isStaticGeneration:$,isOnDemandRevalidate:q})},!1,x),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:i.SpanStatusCode.ERROR}),r.setAttribute("error.type",e.toString()));let a=J.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")||L,o=`${G} ${n}`;r.setAttributes({"next.route":n,"http.route":n,"next.span_name":o}),r.updateName(o),s&&s!==r&&(s.setAttribute("http.route",n),s.updateName(o))})()}};if(K&&W)await Q(W,void 0);else{let t=J.getActiveScopeSpan();await J.withPropagatedContext(e.headers,()=>J.trace(u.BaseServerSpan.handleRequest,{spanName:`${G} ${b}`,kind:i.SpanKind.SERVER,attributes:{"http.method":G,"http.target":e.url}},e=>Q(e,t)),void 0,!K)}}e.s(["handler",0,S,"patchFetch",0,function(){return(0,n.patchFetch)({workAsyncStorage:b,workUnitAsyncStorage:f})},"routeModule",0,R,"serverHooks",0,A,"workAsyncStorage",0,b,"workUnitAsyncStorage",0,f])},90027,e=>{"use strict";var t=e.i(62349);let a=["active","ended","all"],n=["implementation","revision"],r=`
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
+ FROM session_bindings b
9
+ JOIN bots bot ON bot.id = b.agent_id
10
+ LEFT JOIN work_attempts sa ON sa.id = b.source_attempt_id
11
+ LEFT JOIN work_requests r ON r.id = COALESCE(b.request_id, sa.request_id)
12
+ LEFT JOIN conversations c ON c.id = COALESCE(b.conversation_id, r.source_conversation_id)
13
+ LEFT JOIN bots tb ON tb.id = c.bot_id
14
+ LEFT JOIN groups g ON g.id = c.group_id
15
+ `;function i(e,t){let a=e?.[t];return"string"==typeof a&&a.trim().length>0?a:null}function s(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 o(e){var a;let r,o=null;try{o=e.source_snapshot?JSON.parse(e.source_snapshot):null}catch{}let d=s(e),l=null===e.released_at?"active":"ended",u=((r=(e.request_intent??"").split("\n").map(e=>e.trim()).find(e=>e.length>0))?r.length>80?`${r.slice(0,79).trimEnd()}…`:r:null)??(d?.kind==="group"?d.label:null)??`${e.agent_name} \xb7 ${a=e.created_at,`${new Date(a).toISOString().slice(0,16).replace("T"," ")} UTC`}`;return{ref:e.id,agent:{id:e.agent_id,name:e.agent_name,adapter:e.adapter,transport:i(o,"transport")},title:u,status:l,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,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:d,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:i(o,"cwd"),deck:i(o,"deck")}}}function d(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 l(e,t,a){return e.prepare(`${r} 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(`
16
+ SELECT c.id AS origin_conversation_id, c.type AS conversation_type, c.bot_id AS conversation_bot_id,
17
+ tb.name AS thread_agent_name, g.name AS group_name
18
+ FROM conversations c
19
+ LEFT JOIN bots tb ON tb.id = c.bot_id
20
+ LEFT JOIN groups g ON g.id = c.group_id
21
+ WHERE c.id = ?
22
+ `).get(t);return a?s(a):null},"getAgentSession",0,function(e,t,a){let n=l(e,t,a);if(!n)return;let r=e.prepare(`
23
+ SELECT a.attempt_number, a.kind, a.request_id, a.outcome, a.started_at, a.finished_at,
24
+ CASE WHEN a.id = ? THEN 'source' ELSE 'resume' END AS role
25
+ FROM work_attempts a
26
+ WHERE a.id = ? OR a.resumed_session_binding_id = ?
27
+ ORDER BY a.started_at ASC, a.id ASC
28
+ `).all(n.source_attempt_id,n.source_attempt_id,n.id);return{...o(n),attempts:r}},"isSessionFilter",0,function(e){return"string"==typeof e&&a.includes(e)},"listAgentSessions",0,function(e,t,a="all"){return e.prepare(`${r} WHERE b.agent_id = ? ${"active"===a?"AND b.released_at IS NULL":"ended"===a?"AND b.released_at IS NOT NULL":""}`).all(t).map(o).sort(d)},"sessionDebugExternalId",0,function(e,t,a){return l(e,t,a)?.external_session_id},"sessionTitle",0,function(e,t,a){let n=l(e,t,a);return n?o(n).title:null}])}];
29
+
30
+ //# sourceMappingURL=_06rti77._.js.map
@@ -0,0 +1,3 @@
1
+ module.exports=[38277,e=>{"use strict";var t=e.i(89171),a=e.i(62294),r=e.i(45383),n=e.i(63020);async function o(e,{params:i}){try{let{id:o}=await i,s=(0,r.getExchangeView)(o);if(s.requester.kind!==a.UI_OWNER_PRINCIPAL.kind||s.requester.id!==a.UI_OWNER_PRINCIPAL.id)throw new n.ExchangeError("exchange_not_found",`No exchange ${o}.`);let l=(0,n.cancelReasonFromBody)(await e.text()),{exchange:u,replayed:c}=await (0,r.cancelExchangeCommand)(o,a.UI_OWNER_PRINCIPAL,l);return t.NextResponse.json({exchange:u,replayed:c})}catch(e){if(e instanceof n.ExchangeError)return t.NextResponse.json((0,n.exchangeErrorBody)(e),{status:e.status});return console.error("Error cancelling exchange:",e instanceof Error?e.message:"unknown error"),t.NextResponse.json({error:{code:"internal_error",message:"The exchange could not be cancelled."}},{status:500})}}e.s(["POST",0,o])},32142,e=>{"use strict";var t=e.i(47909),a=e.i(74017),r=e.i(96250),n=e.i(59756),o=e.i(61916),i=e.i(74677),s=e.i(69741),l=e.i(16795),u=e.i(87718),c=e.i(95169),d=e.i(47587),p=e.i(66012),h=e.i(70101),R=e.i(26937),g=e.i(10372),v=e.i(93695),E=e.i(9580);e.i(52474);var x=e.i(220);let f=new t.AppRouteRouteModule({definition:{kind:a.RouteKind.APP_ROUTE,page:"/api/exchanges/[id]/cancel/route",pathname:"/api/exchanges/[id]/cancel",filename:"route",bundlePath:""},distDir:".next",relativeProjectDir:"",resolvedPagePath:"[project]/app/api/exchanges/[id]/cancel/route.ts",nextConfigOutput:"standalone",userland:()=>e.r(38277),...{}}),{workAsyncStorage:m,workUnitAsyncStorage:w,serverHooks:C}=f;async function A(e,t,r){r.requestMeta&&(0,n.setRequestMeta)(e,r.requestMeta),f.isDev&&(0,n.addRequestMeta)(e,"devRequestTimingInternalsEnd",process.hrtime.bigint());let m="/api/exchanges/[id]/cancel/route";m=m.replace(/\/index$/,"")||"/";let w=await f.prepare(e,t,{srcPage:m,multiZoneDraftMode:!1});if(!w)return t.statusCode=400,t.end("Bad Request"),null==r.waitUntil||r.waitUntil.call(r,Promise.resolve()),null;let{buildId:C,deploymentId:A,params:N,nextConfig:P,parsedUrl:T,isDraftMode:y,prerenderManifest:_,routerServerContext:O,isOnDemandRevalidate:S,revalidateOnlyGenerated:I,resolvedPathname:b,clientReferenceManifest:q,serverActionsManifest:H}=w,U=(0,s.normalizeAppPath)(m),k=!!_.routes[b]&&(f.isDev||(0,E.isRouteCacheOwner)(b,f.cacheOwner,_.routes[b])),M=!!(_.dynamicRoutes[U]||k),D=async()=>((null==O?void 0:O.render404)?await O.render404(e,t,T,!1):t.end("This page could not be found"),null);if(M&&!y){let e=_.dynamicRoutes[U];if(e&&!1===e.fallback&&!k){if(P.adapterPath)return await D();throw new v.NoFallbackError}}let j=null;!M||f.isDev||y||(j="/index"===(j=b)?"/":j);let L=!0===f.isDev||!M,F=M&&!L;H&&q&&(0,i.setManifestsSingleton)({page:m,clientReferenceManifest:q,serverActionsManifest:H});let B=e.method||"GET",K=(0,o.getTracer)(),$=K.getActiveScopeSpan(),G=!!(null==O?void 0:O.isWrappedByNextServer),W=!!(0,n.getRequestMeta)(e,"minimalMode"),V=(0,n.getRequestMeta)(e,"incrementalCache")||await f.getIncrementalCache(e,P,_,W);null==V||V.resetRequestCache(),globalThis.__incrementalCache=V;let X={params:N,previewProps:_.preview,renderOpts:{experimental:{authInterrupts:!!P.experimental.authInterrupts,useCacheTimeout:P.experimental.useCacheTimeout},cacheComponents:!!P.cacheComponents,validationLevel:P.experimental.instantInsights.validationLevel,isDraftMode:y,supportsDynamicResponse:L,incrementalCache:V,hmrRefreshHash:(0,n.getRequestMeta)(e,"hmrRefreshHash"),cacheLifeProfiles:P.cacheLife,staticPageGenerationTimeout:P.staticPageGenerationTimeout,waitUntil:r.waitUntil,onClose:e=>{t.on("close",e)},onAfterTaskError:void 0,onInstrumentationRequestError:(t,a,r,n)=>f.onRequestError(e,t,r,n,O)},sharedContext:{buildId:C,deploymentId:A}},z=new l.NodeNextRequest(e),Z=new l.NodeNextResponse(t),J=u.NextRequestAdapter.fromNodeNextRequest(z,(0,u.signalFromNodeResponse)(t)),Q=async({previousCacheEntry:a})=>{try{if(!W&&S&&I&&!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,X);e.fetchMetrics=X.renderOpts.fetchMetrics;let o=X.renderOpts.pendingWaitUntil;o&&r.waitUntil&&(r.waitUntil(o),o=void 0);let i=X.renderOpts.collectedTags;if(!M)return await (0,p.sendResponse)(z,Z,n,o),null;{let e=await n.blob(),t=(0,h.toNodeOutgoingHttpHeaders)(n.headers);i&&(t[g.NEXT_CACHE_TAGS_HEADER]=i),!t["content-type"]&&e.type&&(t["content-type"]=e.type);let a=void 0!==X.renderOpts.collectedRevalidate&&!(X.renderOpts.collectedRevalidate>=g.INFINITE_CACHE)&&X.renderOpts.collectedRevalidate,r=void 0===X.renderOpts.collectedExpire||X.renderOpts.collectedExpire>=g.INFINITE_CACHE?!1!==a&&a>0?P.expireTime:void 0:X.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:m,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:S})},!1,O),t}},Y=async(n,i)=>{try{var s,l;let n=await f.handleResponse({req:e,nextConfig:P,cacheKey:j,routeKind:a.RouteKind.APP_ROUTE,isFallback:!1,prerenderManifest:_,isRoutePPREnabled:!1,isOnDemandRevalidate:S,revalidateOnlyGenerated:I,responseGenerator:Q,waitUntil:r.waitUntil,isMinimalMode:W});if(!M)return;if((null==n||null==(s=n.value)?void 0:s.kind)!==x.CachedRouteKind.APP_ROUTE)throw Object.defineProperty(Error(`Invariant: app-route received invalid cache entry ${null==n||null==(l=n.value)?void 0:l.kind}`),"__NEXT_ERROR_CODE",{value:"E701",enumerable:!1,configurable:!0});W||t.setHeader("x-nextjs-cache",S?"REVALIDATED":n.isMiss?"MISS":n.isStale?"STALE":"HIT"),y&&t.setHeader("Cache-Control","private, no-cache, no-store, max-age=0, must-revalidate");let o=(0,h.fromNodeOutgoingHttpHeaders)(n.value.headers);W&&M||o.delete(g.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)(z,Z,new Response(n.value.body,{headers:o,status:n.value.status||200}));return}catch(t){if(t instanceof v.NoFallbackError||await f.onRequestError(e,t,{routerKind:"App Router",routePath:U,routeType:"route",revalidateReason:(0,d.getRevalidateReason)({isStaticGeneration:F,isOnDemandRevalidate:S})},!1,O),M)throw t;await (0,p.sendResponse)(z,Z,new Response(null,{status:500}));return}finally{(()=>{if(!n)return;let e=t.statusCode;n.setAttributes({"http.status_code":e,"next.rsc":!1}),e&&e>=500&&(n.setStatus({code:o.SpanStatusCode.ERROR}),n.setAttribute("error.type",e.toString()));let a=K.getRootSpanAttributes();if(!a)return;if(a.get("next.span_type")!==c.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")||U,s=`${B} ${r}`;n.setAttributes({"next.route":r,"http.route":r,"next.span_name":s}),n.updateName(s),i&&i!==n&&(i.setAttribute("http.route",r),i.updateName(s))})()}};if(G&&$)await Y($,void 0);else{let t=K.getActiveScopeSpan();await K.withPropagatedContext(e.headers,()=>K.trace(c.BaseServerSpan.handleRequest,{spanName:`${B} ${m}`,kind:o.SpanKind.SERVER,attributes:{"http.method":B,"http.target":e.url}},e=>Y(e,t)),void 0,!G)}}e.s(["handler",0,A,"patchFetch",0,function(){return(0,r.patchFetch)({workAsyncStorage:m,workUnitAsyncStorage:w})},"routeModule",0,f,"serverHooks",0,C,"workAsyncStorage",0,m,"workUnitAsyncStorage",0,w])}];
2
+
3
+ //# sourceMappingURL=_09k38l1._.js.map