botmancers 0.4.2 → 0.6.1

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 (1045) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +26 -17
  3. package/app/.next/BUILD_ID +1 -1
  4. package/app/.next/app-path-routes-manifest.json +16 -0
  5. package/app/.next/build-manifest.json +3 -3
  6. package/app/.next/node_modules/@slack/socket-mode-77e8cba3b9ba4738/index.js +1 -0
  7. package/app/.next/node_modules/@slack/socket-mode-77e8cba3b9ba4738/package.json +1 -0
  8. package/app/.next/node_modules/@slack/web-api-d6dbe405b6902642/index.js +1 -0
  9. package/app/.next/node_modules/@slack/web-api-d6dbe405b6902642/package.json +1 -0
  10. package/app/.next/prerender-manifest.json +5 -5
  11. package/app/.next/required-server-files.json +8 -3
  12. package/app/.next/routes-manifest.json +122 -0
  13. package/app/.next/server/app/_global-error/page.js +1 -1
  14. package/app/.next/server/app/_global-error/page.js.nft.json +1 -1
  15. package/app/.next/server/app/_global-error.html +1 -1
  16. package/app/.next/server/app/_global-error.rsc +1 -1
  17. package/app/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  18. package/app/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  19. package/app/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  20. package/app/.next/server/app/_not-found/page.js +1 -1
  21. package/app/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/app/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/app/.next/server/app/_not-found.html +1 -1
  24. package/app/.next/server/app/_not-found.rsc +2 -2
  25. package/app/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  26. package/app/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  27. package/app/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  28. package/app/.next/server/app/api/agent-deck/decks/route.js +3 -3
  29. package/app/.next/server/app/api/agent-deck/decks/route.js.nft.json +1 -1
  30. package/app/.next/server/app/api/agent-deck/settings/route.js +3 -3
  31. package/app/.next/server/app/api/agent-deck/settings/route.js.nft.json +1 -1
  32. package/app/.next/server/app/api/bots/[id]/config/route.js +3 -3
  33. package/app/.next/server/app/api/bots/[id]/config/route.js.nft.json +1 -1
  34. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route/app-paths-manifest.json +3 -0
  35. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route/build-manifest.json +12 -0
  36. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route/server-reference-manifest.json +4 -0
  37. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js +11 -0
  38. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route.js.nft.json +1 -0
  39. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/pins/route_client-reference-manifest.js +3 -0
  40. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js +3 -3
  41. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/route.js.nft.json +1 -1
  42. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route/app-paths-manifest.json +3 -0
  43. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route/build-manifest.json +12 -0
  44. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route/server-reference-manifest.json +4 -0
  45. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js +11 -0
  46. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route.js.nft.json +1 -0
  47. package/app/.next/server/app/api/bots/[id]/sessions/[ref]/shares/route_client-reference-manifest.js +3 -0
  48. package/app/.next/server/app/api/bots/[id]/sessions/route.js +6 -4
  49. package/app/.next/server/app/api/bots/[id]/sessions/route.js.nft.json +1 -1
  50. package/app/.next/server/app/api/bots/[id]/share-policy/route/app-paths-manifest.json +3 -0
  51. package/app/.next/server/app/api/bots/[id]/share-policy/route/build-manifest.json +12 -0
  52. package/app/.next/server/app/api/bots/[id]/share-policy/route/server-reference-manifest.json +4 -0
  53. package/app/.next/server/app/api/bots/[id]/share-policy/route.js +11 -0
  54. package/app/.next/server/app/api/bots/[id]/share-policy/route.js.nft.json +1 -0
  55. package/app/.next/server/app/api/bots/[id]/share-policy/route_client-reference-manifest.js +3 -0
  56. package/app/.next/server/app/api/bots/[id]/skill/route.js +3 -3
  57. package/app/.next/server/app/api/bots/[id]/skill/route.js.nft.json +1 -1
  58. package/app/.next/server/app/api/bots/availability/route.js +2 -2
  59. package/app/.next/server/app/api/bots/availability/route.js.nft.json +1 -1
  60. package/app/.next/server/app/api/bots/delete-preview/route.js +3 -3
  61. package/app/.next/server/app/api/bots/delete-preview/route.js.nft.json +1 -1
  62. package/app/.next/server/app/api/bots/import/route.js +3 -3
  63. package/app/.next/server/app/api/bots/import/route.js.nft.json +1 -1
  64. package/app/.next/server/app/api/bots/manage/route.js +3 -3
  65. package/app/.next/server/app/api/bots/manage/route.js.nft.json +1 -1
  66. package/app/.next/server/app/api/bots/name-migrations/route.js +3 -3
  67. package/app/.next/server/app/api/bots/name-migrations/route.js.nft.json +1 -1
  68. package/app/.next/server/app/api/bots/route.js +6 -6
  69. package/app/.next/server/app/api/bots/route.js.nft.json +1 -1
  70. package/app/.next/server/app/api/conversations/[id]/approve/route.js +3 -3
  71. package/app/.next/server/app/api/conversations/[id]/approve/route.js.nft.json +1 -1
  72. package/app/.next/server/app/api/conversations/[id]/deny/route.js +3 -3
  73. package/app/.next/server/app/api/conversations/[id]/deny/route.js.nft.json +1 -1
  74. package/app/.next/server/app/api/conversations/[id]/draft/route.js +3 -3
  75. package/app/.next/server/app/api/conversations/[id]/draft/route.js.nft.json +1 -1
  76. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js +3 -3
  77. package/app/.next/server/app/api/conversations/[id]/messages/[messageId]/stop/route.js.nft.json +1 -1
  78. package/app/.next/server/app/api/conversations/[id]/messages/route.js +6 -6
  79. package/app/.next/server/app/api/conversations/[id]/messages/route.js.nft.json +1 -1
  80. package/app/.next/server/app/api/conversations/[id]/route.js +3 -3
  81. package/app/.next/server/app/api/conversations/[id]/route.js.nft.json +1 -1
  82. package/app/.next/server/app/api/conversations/[id]/stop/route.js +6 -6
  83. package/app/.next/server/app/api/conversations/[id]/stop/route.js.nft.json +1 -1
  84. package/app/.next/server/app/api/conversations/route.js +3 -3
  85. package/app/.next/server/app/api/conversations/route.js.nft.json +1 -1
  86. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js +5 -5
  87. package/app/.next/server/app/api/exchanges/[id]/cancel/route.js.nft.json +1 -1
  88. package/app/.next/server/app/api/exchanges/[id]/route.js +5 -5
  89. package/app/.next/server/app/api/exchanges/[id]/route.js.nft.json +1 -1
  90. package/app/.next/server/app/api/exchanges/route.js +5 -5
  91. package/app/.next/server/app/api/exchanges/route.js.nft.json +1 -1
  92. package/app/.next/server/app/api/files/[name]/route.js +3 -2
  93. package/app/.next/server/app/api/files/[name]/route.js.nft.json +1 -1
  94. package/app/.next/server/app/api/groups/route.js +3 -3
  95. package/app/.next/server/app/api/groups/route.js.nft.json +1 -1
  96. package/app/.next/server/app/api/health/route.js +6 -2
  97. package/app/.next/server/app/api/health/route.js.nft.json +1 -1
  98. package/app/.next/server/app/api/import-capabilities/route.js +1 -1
  99. package/app/.next/server/app/api/import-capabilities/route.js.nft.json +1 -1
  100. package/app/.next/server/app/api/marketplace-handoff/route.js +1 -1
  101. package/app/.next/server/app/api/marketplace-handoff/route.js.nft.json +1 -1
  102. package/app/.next/server/app/api/marketplace-handoff/status/route.js +1 -1
  103. package/app/.next/server/app/api/marketplace-handoff/status/route.js.nft.json +1 -1
  104. package/app/.next/server/app/api/mcp/route.js +3 -3
  105. package/app/.next/server/app/api/mcp/route.js.nft.json +1 -1
  106. package/app/.next/server/app/api/messages/[id]/between/route.js +3 -3
  107. package/app/.next/server/app/api/messages/[id]/between/route.js.nft.json +1 -1
  108. package/app/.next/server/app/api/runtime-connections/route/app-paths-manifest.json +3 -0
  109. package/app/.next/server/app/api/runtime-connections/route/build-manifest.json +12 -0
  110. package/app/.next/server/app/api/runtime-connections/route/server-reference-manifest.json +4 -0
  111. package/app/.next/server/app/api/runtime-connections/route.js +9 -0
  112. package/app/.next/server/app/api/runtime-connections/route.js.nft.json +1 -0
  113. package/app/.next/server/app/api/runtime-connections/route_client-reference-manifest.js +3 -0
  114. package/app/.next/server/app/api/service-grants/route.js +3 -3
  115. package/app/.next/server/app/api/service-grants/route.js.nft.json +1 -1
  116. package/app/.next/server/app/api/shares/[shareRef]/revoke/route/app-paths-manifest.json +3 -0
  117. package/app/.next/server/app/api/shares/[shareRef]/revoke/route/build-manifest.json +12 -0
  118. package/app/.next/server/app/api/shares/[shareRef]/revoke/route/server-reference-manifest.json +4 -0
  119. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js +11 -0
  120. package/app/.next/server/app/api/shares/[shareRef]/revoke/route.js.nft.json +1 -0
  121. package/app/.next/server/app/api/shares/[shareRef]/revoke/route_client-reference-manifest.js +3 -0
  122. package/app/.next/server/app/api/shares/route/app-paths-manifest.json +3 -0
  123. package/app/.next/server/app/api/shares/route/build-manifest.json +12 -0
  124. package/app/.next/server/app/api/shares/route/server-reference-manifest.json +4 -0
  125. package/app/.next/server/app/api/shares/route.js +11 -0
  126. package/app/.next/server/app/api/shares/route.js.nft.json +1 -0
  127. package/app/.next/server/app/api/shares/route_client-reference-manifest.js +3 -0
  128. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js +6 -6
  129. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/[conversationId]/route.js.nft.json +1 -1
  130. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js +6 -6
  131. package/app/.next/server/app/api/v0/agents/[agentId]/conversations/route.js.nft.json +1 -1
  132. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js +5 -5
  133. package/app/.next/server/app/api/v0/agents/[agentId]/messages/route.js.nft.json +1 -1
  134. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route/app-paths-manifest.json +3 -0
  135. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route/build-manifest.json +12 -0
  136. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route/server-reference-manifest.json +4 -0
  137. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js +11 -0
  138. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route.js.nft.json +1 -0
  139. package/app/.next/server/app/api/v0/agents/[agentId]/pins/route_client-reference-manifest.js +3 -0
  140. package/app/.next/server/app/api/v0/agents/[agentId]/route.js +6 -6
  141. package/app/.next/server/app/api/v0/agents/[agentId]/route.js.nft.json +1 -1
  142. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js +6 -6
  143. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/[ref]/route.js.nft.json +1 -1
  144. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js +6 -6
  145. package/app/.next/server/app/api/v0/agents/[agentId]/sessions/route.js.nft.json +1 -1
  146. package/app/.next/server/app/api/v0/agents/route.js +6 -6
  147. package/app/.next/server/app/api/v0/agents/route.js.nft.json +1 -1
  148. package/app/.next/server/app/api/v0/capabilities/route.js +6 -6
  149. package/app/.next/server/app/api/v0/capabilities/route.js.nft.json +1 -1
  150. package/app/.next/server/app/api/v0/conversations/[id]/route.js +5 -5
  151. package/app/.next/server/app/api/v0/conversations/[id]/route.js.nft.json +1 -1
  152. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js +6 -6
  153. package/app/.next/server/app/api/v0/exchanges/[id]/cancel/route.js.nft.json +1 -1
  154. package/app/.next/server/app/api/v0/exchanges/[id]/route.js +6 -6
  155. package/app/.next/server/app/api/v0/exchanges/[id]/route.js.nft.json +1 -1
  156. package/app/.next/server/app/api/v0/exchanges/route.js +6 -6
  157. package/app/.next/server/app/api/v0/exchanges/route.js.nft.json +1 -1
  158. package/app/.next/server/app/api/v0/mcp/route.js +6 -6
  159. package/app/.next/server/app/api/v0/mcp/route.js.nft.json +1 -1
  160. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route/app-paths-manifest.json +3 -0
  161. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route/build-manifest.json +12 -0
  162. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route/server-reference-manifest.json +4 -0
  163. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js +11 -0
  164. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route.js.nft.json +1 -0
  165. package/app/.next/server/app/api/v0/pins/[pinRef]/detach/route_client-reference-manifest.js +3 -0
  166. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route/app-paths-manifest.json +3 -0
  167. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route/build-manifest.json +12 -0
  168. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route/server-reference-manifest.json +4 -0
  169. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js +11 -0
  170. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route.js.nft.json +1 -0
  171. package/app/.next/server/app/api/v0/pins/[pinRef]/messages/route_client-reference-manifest.js +3 -0
  172. package/app/.next/server/app/api/v0/pins/[pinRef]/route/app-paths-manifest.json +3 -0
  173. package/app/.next/server/app/api/v0/pins/[pinRef]/route/build-manifest.json +12 -0
  174. package/app/.next/server/app/api/v0/pins/[pinRef]/route/server-reference-manifest.json +4 -0
  175. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js +11 -0
  176. package/app/.next/server/app/api/v0/pins/[pinRef]/route.js.nft.json +1 -0
  177. package/app/.next/server/app/api/v0/pins/[pinRef]/route_client-reference-manifest.js +3 -0
  178. package/app/.next/server/app/api/v0/requests/[id]/route.js +5 -5
  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.js +6 -6
  181. package/app/.next/server/app/api/v0/sessions/[ref]/messages/route.js.nft.json +1 -1
  182. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route/app-paths-manifest.json +3 -0
  183. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route/build-manifest.json +12 -0
  184. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route/server-reference-manifest.json +4 -0
  185. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js +11 -0
  186. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route.js.nft.json +1 -0
  187. package/app/.next/server/app/api/v0/sessions/[ref]/pins/route_client-reference-manifest.js +3 -0
  188. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route/app-paths-manifest.json +3 -0
  189. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route/build-manifest.json +12 -0
  190. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route/server-reference-manifest.json +4 -0
  191. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js +11 -0
  192. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route.js.nft.json +1 -0
  193. package/app/.next/server/app/api/v0/sessions/[ref]/shares/route_client-reference-manifest.js +3 -0
  194. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route/app-paths-manifest.json +3 -0
  195. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route/build-manifest.json +12 -0
  196. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route/server-reference-manifest.json +4 -0
  197. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js +11 -0
  198. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route.js.nft.json +1 -0
  199. package/app/.next/server/app/api/v0/shares/[shareRef]/revoke/route_client-reference-manifest.js +3 -0
  200. package/app/.next/server/app/api/v0/shares/[shareRef]/route/app-paths-manifest.json +3 -0
  201. package/app/.next/server/app/api/v0/shares/[shareRef]/route/build-manifest.json +12 -0
  202. package/app/.next/server/app/api/v0/shares/[shareRef]/route/server-reference-manifest.json +4 -0
  203. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js +11 -0
  204. package/app/.next/server/app/api/v0/shares/[shareRef]/route.js.nft.json +1 -0
  205. package/app/.next/server/app/api/v0/shares/[shareRef]/route_client-reference-manifest.js +3 -0
  206. package/app/.next/server/app/api/v0/shares/current/route/app-paths-manifest.json +3 -0
  207. package/app/.next/server/app/api/v0/shares/current/route/build-manifest.json +12 -0
  208. package/app/.next/server/app/api/v0/shares/current/route/server-reference-manifest.json +4 -0
  209. package/app/.next/server/app/api/v0/shares/current/route.js +11 -0
  210. package/app/.next/server/app/api/v0/shares/current/route.js.nft.json +1 -0
  211. package/app/.next/server/app/api/v0/shares/current/route_client-reference-manifest.js +3 -0
  212. package/app/.next/server/app/api/v0/shares/route/app-paths-manifest.json +3 -0
  213. package/app/.next/server/app/api/v0/shares/route/build-manifest.json +12 -0
  214. package/app/.next/server/app/api/v0/shares/route/server-reference-manifest.json +4 -0
  215. package/app/.next/server/app/api/v0/shares/route.js +11 -0
  216. package/app/.next/server/app/api/v0/shares/route.js.nft.json +1 -0
  217. package/app/.next/server/app/api/v0/shares/route_client-reference-manifest.js +3 -0
  218. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js +5 -5
  219. package/app/.next/server/app/api/wake-grants/[id]/revoke/route.js.nft.json +1 -1
  220. package/app/.next/server/app/api/wakes/[id]/decision/route.js +5 -5
  221. package/app/.next/server/app/api/wakes/[id]/decision/route.js.nft.json +1 -1
  222. package/app/.next/server/app/api/wakes/[id]/retry/route.js +5 -5
  223. package/app/.next/server/app/api/wakes/[id]/retry/route.js.nft.json +1 -1
  224. package/app/.next/server/app/bots/[id]/config/page.js +1 -1
  225. package/app/.next/server/app/bots/[id]/config/page.js.nft.json +1 -1
  226. package/app/.next/server/app/bots/[id]/config/page_client-reference-manifest.js +1 -1
  227. package/app/.next/server/app/exchanges/page.js +1 -1
  228. package/app/.next/server/app/exchanges/page.js.nft.json +1 -1
  229. package/app/.next/server/app/exchanges/page_client-reference-manifest.js +1 -1
  230. package/app/.next/server/app/exchanges.html +1 -1
  231. package/app/.next/server/app/exchanges.rsc +3 -3
  232. package/app/.next/server/app/exchanges.segments/_full.segment.rsc +3 -3
  233. package/app/.next/server/app/exchanges.segments/_tree.segment.rsc +2 -2
  234. package/app/.next/server/app/exchanges.segments/exchanges/__PAGE__.segment.rsc +3 -3
  235. package/app/.next/server/app/index.html +1 -1
  236. package/app/.next/server/app/index.rsc +3 -3
  237. package/app/.next/server/app/index.segments/__PAGE__.segment.rsc +3 -3
  238. package/app/.next/server/app/index.segments/_full.segment.rsc +3 -3
  239. package/app/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  240. package/app/.next/server/app/page.js +1 -1
  241. package/app/.next/server/app/page.js.nft.json +1 -1
  242. package/app/.next/server/app/page_client-reference-manifest.js +1 -1
  243. package/app/.next/server/app/settings/page.js +1 -1
  244. package/app/.next/server/app/settings/page.js.nft.json +1 -1
  245. package/app/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  246. package/app/.next/server/app/settings.html +1 -1
  247. package/app/.next/server/app/settings.rsc +3 -3
  248. package/app/.next/server/app/settings.segments/_full.segment.rsc +3 -3
  249. package/app/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  250. package/app/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +3 -3
  251. package/app/.next/server/app/threads/[id]/page.js +1 -1
  252. package/app/.next/server/app/threads/[id]/page.js.nft.json +1 -1
  253. package/app/.next/server/app/threads/[id]/page_client-reference-manifest.js +1 -1
  254. package/app/.next/server/app-paths-manifest.json +16 -0
  255. package/app/.next/server/chunks/1oeh_server_app_api_bots_[id]_sessions_[ref]_pins_route_actions_0e1st6o.js +3 -0
  256. package/app/.next/server/chunks/1oeh_server_app_api_bots_[id]_sessions_[ref]_shares_route_actions_1jr6f0v.js +3 -0
  257. package/app/.next/server/chunks/[externals]_@slack_0owayck._.js +3 -0
  258. package/app/.next/server/chunks/[externals]__17bolvp._.js +3 -0
  259. package/app/.next/server/chunks/{[externals]__06lqs5i._.js → [externals]__1eaoma8._.js} +1 -1
  260. package/app/.next/server/chunks/[root-of-the-server]__0-vcyi-._.js +3 -0
  261. package/app/.next/server/chunks/[root-of-the-server]__0-w_t2y._.js +3 -0
  262. package/app/.next/server/chunks/{[root-of-the-server]__17oz13o._.js → [root-of-the-server]__029-_9t._.js} +3 -3
  263. package/app/.next/server/chunks/[root-of-the-server]__02kssr-._.js +3 -0
  264. package/app/.next/server/chunks/[root-of-the-server]__02vrtib._.js +4 -0
  265. package/app/.next/server/chunks/[root-of-the-server]__04b3ml2._.js +3 -0
  266. package/app/.next/server/chunks/[root-of-the-server]__06w5xhe._.js +3 -0
  267. package/app/.next/server/chunks/[root-of-the-server]__07q5mnr._.js +3 -0
  268. package/app/.next/server/chunks/[root-of-the-server]__0888o0_._.js +3 -0
  269. package/app/.next/server/chunks/[root-of-the-server]__0aincj4._.js +3 -0
  270. package/app/.next/server/chunks/[root-of-the-server]__0e_agq4._.js +3 -0
  271. package/app/.next/server/chunks/[root-of-the-server]__0ey3_2x._.js +3 -0
  272. package/app/.next/server/chunks/[root-of-the-server]__0fku-bw._.js +3 -0
  273. package/app/.next/server/chunks/[root-of-the-server]__0iqh5ta._.js +3 -0
  274. package/app/.next/server/chunks/[root-of-the-server]__0ivjcgs._.js +4 -0
  275. package/app/.next/server/chunks/[root-of-the-server]__0j4pjyg._.js +3 -0
  276. package/app/.next/server/chunks/[root-of-the-server]__0kgnysc._.js +3 -0
  277. package/app/.next/server/chunks/[root-of-the-server]__0lwsto-._.js +5 -0
  278. package/app/.next/server/chunks/[root-of-the-server]__0mo_kn3._.js +48 -0
  279. package/app/.next/server/chunks/[root-of-the-server]__0mp8bap._.js +3 -0
  280. package/app/.next/server/chunks/[root-of-the-server]__0o9ijih._.js +3 -0
  281. package/app/.next/server/chunks/[root-of-the-server]__0qaiqut._.js +44 -0
  282. package/app/.next/server/chunks/[root-of-the-server]__0s1enbp._.js +3 -0
  283. package/app/.next/server/chunks/[root-of-the-server]__0wg992i._.js +3 -0
  284. package/app/.next/server/chunks/[root-of-the-server]__0zrx1iz._.js +3 -0
  285. package/app/.next/server/chunks/[root-of-the-server]__10b5-i-._.js +3 -0
  286. package/app/.next/server/chunks/[root-of-the-server]__17mum5-._.js +3 -0
  287. package/app/.next/server/chunks/[root-of-the-server]__17xl_55._.js +3 -0
  288. package/app/.next/server/chunks/[root-of-the-server]__1bhzfu_._.js +7 -0
  289. package/app/.next/server/chunks/[root-of-the-server]__1dxr858._.js +3 -0
  290. package/app/.next/server/chunks/[root-of-the-server]__1eps2a4._.js +3 -0
  291. package/app/.next/server/chunks/[root-of-the-server]__1g_n99l._.js +3 -0
  292. package/app/.next/server/chunks/[root-of-the-server]__1ggmit0._.js +4 -0
  293. package/app/.next/server/chunks/[root-of-the-server]__1hwy3jx._.js +3 -0
  294. package/app/.next/server/chunks/[root-of-the-server]__1i388e2._.js +3 -0
  295. package/app/.next/server/chunks/[root-of-the-server]__1i8glt4._.js +4 -0
  296. package/app/.next/server/chunks/{[root-of-the-server]__0j0i8xz._.js → [root-of-the-server]__1igzl05._.js} +1 -1
  297. package/app/.next/server/chunks/[root-of-the-server]__1kczttr._.js +3 -0
  298. package/app/.next/server/chunks/{[root-of-the-server]__1c3e2ds._.js → [root-of-the-server]__1kik2zt._.js} +1 -1
  299. package/app/.next/server/chunks/[root-of-the-server]__1t4ybp2._.js +48 -0
  300. package/app/.next/server/chunks/[root-of-the-server]__1v3ikuo._.js +3 -0
  301. package/app/.next/server/chunks/{[root-of-the-server]__0-45blq._.js → [root-of-the-server]__1z5l5cg._.js} +2 -2
  302. package/app/.next/server/chunks/[root-of-the-server]__200ep0k._.js +3 -0
  303. package/app/.next/server/chunks/_0061c2q._.js +50 -0
  304. package/app/.next/server/chunks/_04e2bgj._.js +3 -0
  305. package/app/.next/server/chunks/_05po7b4._.js +3 -0
  306. package/app/.next/server/chunks/_06sxx0e._.js +3 -0
  307. package/app/.next/server/chunks/_0a2do3x._.js +1 -1
  308. package/app/.next/server/chunks/_0ar2ooe._.js +3 -0
  309. package/app/.next/server/chunks/_0fmotaz._.js +3 -0
  310. package/app/.next/server/chunks/_0i8_xso._.js +3 -0
  311. package/app/.next/server/chunks/_0kpfto_._.js +3 -0
  312. package/app/.next/server/chunks/_0lm6uis._.js +3 -0
  313. package/app/.next/server/chunks/_0mpu5tl._.js +3 -0
  314. package/app/.next/server/chunks/_0qv-4by._.js +3 -0
  315. package/app/.next/server/chunks/_0u9cfq9._.js +3 -0
  316. package/app/.next/server/chunks/_0ul8k7g._.js +3 -0
  317. package/app/.next/server/chunks/_1-5mthb._.js +1 -1
  318. package/app/.next/server/chunks/_1-60d3o._.js +3 -0
  319. package/app/.next/server/chunks/_11-q8k1._.js +3 -0
  320. package/app/.next/server/chunks/_133y3b0._.js +3 -0
  321. package/app/.next/server/chunks/_167960a._.js +3 -0
  322. package/app/.next/server/chunks/_17vgjlt._.js +3 -0
  323. package/app/.next/server/chunks/_1amx9_4._.js +3 -0
  324. package/app/.next/server/chunks/_1b01v-_._.js +3 -0
  325. package/app/.next/server/chunks/_1c-g4gq._.js +3 -0
  326. package/app/.next/server/chunks/_1ess5if._.js +3 -0
  327. package/app/.next/server/chunks/_1ey6l4p._.js +3 -0
  328. package/app/.next/server/chunks/_1i0zod4._.js +3 -0
  329. package/app/.next/server/chunks/_1nlg4x_._.js +3 -0
  330. package/app/.next/server/chunks/_1x4dqzv._.js +3 -0
  331. package/app/.next/server/chunks/_1z0qbzc._.js +3 -0
  332. package/app/.next/server/chunks/_next-internal_server_app_api_bots_[id]_share-policy_route_actions_0x-p250.js +3 -0
  333. package/app/.next/server/chunks/_next-internal_server_app_api_runtime-connections_route_actions_06rulng.js +3 -0
  334. package/app/.next/server/chunks/_next-internal_server_app_api_shares_[shareRef]_revoke_route_actions_1cu5kah.js +3 -0
  335. package/app/.next/server/chunks/_next-internal_server_app_api_shares_route_actions_0wk7x1r.js +3 -0
  336. package/app/.next/server/chunks/_next-internal_server_app_api_v0_agents_[agentId]_pins_route_actions_08uftk9.js +3 -0
  337. package/app/.next/server/chunks/_next-internal_server_app_api_v0_pins_[pinRef]_detach_route_actions_0nk3268.js +3 -0
  338. package/app/.next/server/chunks/_next-internal_server_app_api_v0_pins_[pinRef]_messages_route_actions_1wenu96.js +3 -0
  339. package/app/.next/server/chunks/_next-internal_server_app_api_v0_pins_[pinRef]_route_actions_0z7fu_c.js +3 -0
  340. package/app/.next/server/chunks/_next-internal_server_app_api_v0_sessions_[ref]_pins_route_actions_0y3ere3.js +3 -0
  341. package/app/.next/server/chunks/_next-internal_server_app_api_v0_sessions_[ref]_shares_route_actions_11fh--7.js +3 -0
  342. package/app/.next/server/chunks/_next-internal_server_app_api_v0_shares_[shareRef]_revoke_route_actions_00rzyj9.js +3 -0
  343. package/app/.next/server/chunks/_next-internal_server_app_api_v0_shares_[shareRef]_route_actions_0i1t5qb.js +3 -0
  344. package/app/.next/server/chunks/_next-internal_server_app_api_v0_shares_current_route_actions_1w_bpas.js +3 -0
  345. package/app/.next/server/chunks/_next-internal_server_app_api_v0_shares_route_actions_1b38was.js +3 -0
  346. package/app/.next/server/chunks/lib_0kik6bx._.js +1 -1
  347. package/app/.next/server/chunks/lib_0pe3tiv._.js +1 -1
  348. package/app/.next/server/chunks/lib_0v4d9w0._.js +339 -0
  349. package/app/.next/server/chunks/lib_0zzo6zb._.js +339 -0
  350. package/app/.next/server/chunks/lib_15adnlz._.js +2189 -0
  351. package/app/.next/server/chunks/lib_1_u7n-u._.js +339 -0
  352. package/app/.next/server/chunks/lib_1muhwn7._.js +339 -0
  353. package/app/.next/server/chunks/lib_1xnxg-q._.js +339 -0
  354. package/app/.next/server/chunks/lib_1zc7-gl._.js +2189 -0
  355. package/app/.next/server/chunks/lib_agent-api_ts_0iv52-o._.js +3 -0
  356. package/app/.next/server/chunks/lib_db_ts_1ttuckb._.js +1951 -0
  357. package/app/.next/server/chunks/lib_service-api-http_ts_0xzqhny._.js +5 -5
  358. package/app/.next/server/chunks/lib_slack-runtime_ts_0fgsejy._.js +63 -0
  359. package/app/.next/server/chunks/ssr/{[root-of-the-server]__03186rx._.js → [root-of-the-server]__1smmfpx._.js} +1 -1
  360. package/app/.next/server/chunks/ssr/_0_fa0na._.js +3 -0
  361. package/app/.next/server/chunks/ssr/_0epgorw._.js +3 -0
  362. package/app/.next/server/chunks/ssr/_1cvuhjt._.js +3 -0
  363. package/app/.next/server/chunks/ssr/_1i02yyi._.js +3 -0
  364. package/app/.next/server/chunks/ssr/_1n5mvo5._.js +3 -0
  365. package/app/.next/server/chunks/ssr/_1o94bnv._.js +1 -1
  366. package/app/.next/server/chunks/ssr/app_bots_[id]_config_page_tsx_1e0uue9._.js +1 -1
  367. package/app/.next/server/chunks/ssr/app_components_AgentDeckRuntime_tsx_024janf._.js +1 -1
  368. package/app/.next/server/chunks/ssr/app_exchanges_page_tsx_0j-n2a1._.js +3 -0
  369. package/app/.next/server/chunks/ssr/node_modules_@swc_helpers_cjs__interop_require_default_cjs_1ztp13a._.js +3 -0
  370. package/app/.next/server/instrumentation.js +4 -0
  371. package/app/.next/server/middleware-build-manifest.js +3 -3
  372. package/app/.next/server/middleware.js +1 -1
  373. package/app/.next/server/pages/404.html +1 -1
  374. package/app/.next/server/pages/500.html +1 -1
  375. package/app/.next/server/server-reference-manifest.js +1 -1
  376. package/app/.next/server/server-reference-manifest.json +1 -1
  377. package/app/.next/static/chunks/0jon21u-9j2aw.css +3 -0
  378. package/app/.next/static/chunks/14k6cvywgknx2.js +3 -0
  379. package/app/.next/static/chunks/1ku9himlsx-hn.js +1 -0
  380. package/app/.next/static/chunks/1r5tqd-7h1xjn.js +1 -0
  381. package/app/.next/static/chunks/21aqekm5z0j47.js +1 -0
  382. package/app/.next/static/chunks/22xbkclbkct3s.js +1 -0
  383. package/app/.next/static/chunks/2c953okoei6ip.js +1 -0
  384. package/app/.next/static/chunks/2t_2gf3xoxz_m.js +1 -0
  385. package/app/.next/static/chunks/34vnvo1qssbaj.js +1 -0
  386. package/app/BUILD_INFO.json +2 -2
  387. package/app/node_modules/@slack/logger/dist/index.js +94 -0
  388. package/app/node_modules/@slack/logger/package.json +43 -0
  389. package/app/node_modules/@slack/socket-mode/dist/package.json +67 -0
  390. package/app/node_modules/@slack/socket-mode/dist/src/SlackWebSocket.js +242 -0
  391. package/app/node_modules/@slack/socket-mode/dist/src/SocketModeClient.js +363 -0
  392. package/app/node_modules/@slack/socket-mode/dist/src/UnrecoverableSocketModeStartError.js +14 -0
  393. package/app/node_modules/@slack/socket-mode/dist/src/errors.js +68 -0
  394. package/app/node_modules/@slack/socket-mode/dist/src/index.js +13 -0
  395. package/app/node_modules/@slack/socket-mode/dist/src/logger.js +26 -0
  396. package/app/node_modules/@slack/socket-mode/package.json +67 -0
  397. package/app/node_modules/@slack/types/dist/block-kit/block-elements.js +4 -0
  398. package/app/node_modules/@slack/types/dist/block-kit/blocks.js +3 -0
  399. package/app/node_modules/@slack/types/dist/block-kit/composition-objects.js +4 -0
  400. package/app/node_modules/@slack/types/dist/block-kit/extensions.js +3 -0
  401. package/app/node_modules/@slack/types/dist/calls.js +6 -0
  402. package/app/node_modules/@slack/types/dist/chunk.js +3 -0
  403. package/app/node_modules/@slack/types/dist/dialog.js +3 -0
  404. package/app/node_modules/@slack/types/dist/events/app.js +3 -0
  405. package/app/node_modules/@slack/types/dist/events/assistant.js +3 -0
  406. package/app/node_modules/@slack/types/dist/events/call.js +3 -0
  407. package/app/node_modules/@slack/types/dist/events/channel.js +3 -0
  408. package/app/node_modules/@slack/types/dist/events/dnd.js +3 -0
  409. package/app/node_modules/@slack/types/dist/events/email.js +3 -0
  410. package/app/node_modules/@slack/types/dist/events/emoji.js +3 -0
  411. package/app/node_modules/@slack/types/dist/events/file.js +4 -0
  412. package/app/node_modules/@slack/types/dist/events/function.js +3 -0
  413. package/app/node_modules/@slack/types/dist/events/grid-migration.js +3 -0
  414. package/app/node_modules/@slack/types/dist/events/group.js +3 -0
  415. package/app/node_modules/@slack/types/dist/events/im.js +3 -0
  416. package/app/node_modules/@slack/types/dist/events/index.js +43 -0
  417. package/app/node_modules/@slack/types/dist/events/invite.js +3 -0
  418. package/app/node_modules/@slack/types/dist/events/link-shared.js +3 -0
  419. package/app/node_modules/@slack/types/dist/events/member.js +3 -0
  420. package/app/node_modules/@slack/types/dist/events/message-metadata.js +3 -0
  421. package/app/node_modules/@slack/types/dist/events/message.js +3 -0
  422. package/app/node_modules/@slack/types/dist/events/pin.js +3 -0
  423. package/app/node_modules/@slack/types/dist/events/reaction.js +3 -0
  424. package/app/node_modules/@slack/types/dist/events/shared-channel.js +3 -0
  425. package/app/node_modules/@slack/types/dist/events/star.js +3 -0
  426. package/app/node_modules/@slack/types/dist/events/steps-from-apps.js +3 -0
  427. package/app/node_modules/@slack/types/dist/events/subteam.js +3 -0
  428. package/app/node_modules/@slack/types/dist/events/team.js +3 -0
  429. package/app/node_modules/@slack/types/dist/events/token.js +3 -0
  430. package/app/node_modules/@slack/types/dist/events/user.js +3 -0
  431. package/app/node_modules/@slack/types/dist/index.js +28 -0
  432. package/app/node_modules/@slack/types/dist/message-attachments.js +3 -0
  433. package/app/node_modules/@slack/types/dist/message-metadata.js +27 -0
  434. package/app/node_modules/@slack/types/dist/views.js +3 -0
  435. package/app/node_modules/@slack/types/package.json +47 -0
  436. package/app/node_modules/@slack/web-api/dist/WebClient.js +818 -0
  437. package/app/node_modules/@slack/web-api/dist/chat-stream.js +178 -0
  438. package/app/node_modules/@slack/web-api/dist/errors.js +80 -0
  439. package/app/node_modules/@slack/web-api/dist/file-upload.js +360 -0
  440. package/app/node_modules/@slack/web-api/dist/helpers.js +14 -0
  441. package/app/node_modules/@slack/web-api/dist/index.js +39 -0
  442. package/app/node_modules/@slack/web-api/dist/instrument.js +87 -0
  443. package/app/node_modules/@slack/web-api/dist/logger.js +29 -0
  444. package/app/node_modules/@slack/web-api/dist/methods.js +1647 -0
  445. package/app/node_modules/@slack/web-api/dist/retry-policies.js +34 -0
  446. package/app/node_modules/@slack/web-api/dist/types/helpers.js +3 -0
  447. package/app/node_modules/@slack/web-api/dist/types/request/admin/analytics.js +3 -0
  448. package/app/node_modules/@slack/web-api/dist/types/request/admin/apps.js +3 -0
  449. package/app/node_modules/@slack/web-api/dist/types/request/admin/auth.js +3 -0
  450. package/app/node_modules/@slack/web-api/dist/types/request/admin/barriers.js +3 -0
  451. package/app/node_modules/@slack/web-api/dist/types/request/admin/conversations.js +3 -0
  452. package/app/node_modules/@slack/web-api/dist/types/request/admin/emoji.js +3 -0
  453. package/app/node_modules/@slack/web-api/dist/types/request/admin/functions.js +3 -0
  454. package/app/node_modules/@slack/web-api/dist/types/request/admin/inviteRequests.js +3 -0
  455. package/app/node_modules/@slack/web-api/dist/types/request/admin/roles.js +3 -0
  456. package/app/node_modules/@slack/web-api/dist/types/request/admin/teams.js +3 -0
  457. package/app/node_modules/@slack/web-api/dist/types/request/admin/usergroups.js +3 -0
  458. package/app/node_modules/@slack/web-api/dist/types/request/admin/users.js +3 -0
  459. package/app/node_modules/@slack/web-api/dist/types/request/admin/workflows.js +3 -0
  460. package/app/node_modules/@slack/web-api/dist/types/request/api.js +3 -0
  461. package/app/node_modules/@slack/web-api/dist/types/request/apps.js +3 -0
  462. package/app/node_modules/@slack/web-api/dist/types/request/assistant.js +3 -0
  463. package/app/node_modules/@slack/web-api/dist/types/request/auth.js +3 -0
  464. package/app/node_modules/@slack/web-api/dist/types/request/bookmarks.js +3 -0
  465. package/app/node_modules/@slack/web-api/dist/types/request/bots.js +3 -0
  466. package/app/node_modules/@slack/web-api/dist/types/request/calls.js +3 -0
  467. package/app/node_modules/@slack/web-api/dist/types/request/canvas.js +3 -0
  468. package/app/node_modules/@slack/web-api/dist/types/request/chat.js +3 -0
  469. package/app/node_modules/@slack/web-api/dist/types/request/common.js +4 -0
  470. package/app/node_modules/@slack/web-api/dist/types/request/conversations.js +3 -0
  471. package/app/node_modules/@slack/web-api/dist/types/request/dialog.js +3 -0
  472. package/app/node_modules/@slack/web-api/dist/types/request/dnd.js +3 -0
  473. package/app/node_modules/@slack/web-api/dist/types/request/emoji.js +3 -0
  474. package/app/node_modules/@slack/web-api/dist/types/request/entity.js +3 -0
  475. package/app/node_modules/@slack/web-api/dist/types/request/files.js +3 -0
  476. package/app/node_modules/@slack/web-api/dist/types/request/functions.js +3 -0
  477. package/app/node_modules/@slack/web-api/dist/types/request/index.js +3 -0
  478. package/app/node_modules/@slack/web-api/dist/types/request/manifest.js +3 -0
  479. package/app/node_modules/@slack/web-api/dist/types/request/migration.js +3 -0
  480. package/app/node_modules/@slack/web-api/dist/types/request/oauth.js +3 -0
  481. package/app/node_modules/@slack/web-api/dist/types/request/openid.js +3 -0
  482. package/app/node_modules/@slack/web-api/dist/types/request/pins.js +3 -0
  483. package/app/node_modules/@slack/web-api/dist/types/request/reactions.js +3 -0
  484. package/app/node_modules/@slack/web-api/dist/types/request/reminders.js +3 -0
  485. package/app/node_modules/@slack/web-api/dist/types/request/rtm.js +3 -0
  486. package/app/node_modules/@slack/web-api/dist/types/request/search.js +3 -0
  487. package/app/node_modules/@slack/web-api/dist/types/request/slackLists.js +3 -0
  488. package/app/node_modules/@slack/web-api/dist/types/request/stars.js +3 -0
  489. package/app/node_modules/@slack/web-api/dist/types/request/team.js +3 -0
  490. package/app/node_modules/@slack/web-api/dist/types/request/tooling.js +3 -0
  491. package/app/node_modules/@slack/web-api/dist/types/request/usergroups.js +3 -0
  492. package/app/node_modules/@slack/web-api/dist/types/request/users.js +3 -0
  493. package/app/node_modules/@slack/web-api/dist/types/request/views.js +3 -0
  494. package/app/node_modules/@slack/web-api/dist/types/request/workflows.js +3 -0
  495. package/app/node_modules/@slack/web-api/dist/types/response/AdminAnalyticsGetFileResponse.js +3 -0
  496. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsActivitiesListResponse.js +11 -0
  497. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsApproveResponse.js +11 -0
  498. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsApprovedListResponse.js +11 -0
  499. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsClearResolutionResponse.js +11 -0
  500. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsConfigLookupResponse.js +11 -0
  501. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsConfigSetResponse.js +11 -0
  502. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsRequestsCancelResponse.js +11 -0
  503. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsRequestsListResponse.js +11 -0
  504. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsRestrictResponse.js +11 -0
  505. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsRestrictedListResponse.js +11 -0
  506. package/app/node_modules/@slack/web-api/dist/types/response/AdminAppsUninstallResponse.js +11 -0
  507. package/app/node_modules/@slack/web-api/dist/types/response/AdminAuthPolicyAssignEntitiesResponse.js +11 -0
  508. package/app/node_modules/@slack/web-api/dist/types/response/AdminAuthPolicyGetEntitiesResponse.js +11 -0
  509. package/app/node_modules/@slack/web-api/dist/types/response/AdminAuthPolicyRemoveEntitiesResponse.js +11 -0
  510. package/app/node_modules/@slack/web-api/dist/types/response/AdminBarriersCreateResponse.js +11 -0
  511. package/app/node_modules/@slack/web-api/dist/types/response/AdminBarriersDeleteResponse.js +11 -0
  512. package/app/node_modules/@slack/web-api/dist/types/response/AdminBarriersListResponse.js +11 -0
  513. package/app/node_modules/@slack/web-api/dist/types/response/AdminBarriersUpdateResponse.js +11 -0
  514. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsArchiveResponse.js +11 -0
  515. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsBulkArchiveResponse.js +11 -0
  516. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsBulkDeleteResponse.js +11 -0
  517. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsBulkMoveResponse.js +11 -0
  518. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsConvertToPrivateResponse.js +11 -0
  519. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsConvertToPublicResponse.js +11 -0
  520. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsCreateResponse.js +11 -0
  521. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsDeleteResponse.js +11 -0
  522. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsDisconnectSharedResponse.js +11 -0
  523. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsEkmListOriginalConnectedChannelInfoResponse.js +11 -0
  524. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsGetConversationPrefsResponse.js +11 -0
  525. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsGetCustomRetentionResponse.js +11 -0
  526. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsGetTeamsResponse.js +11 -0
  527. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsInviteResponse.js +11 -0
  528. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsLookupResponse.js +11 -0
  529. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsRemoveCustomRetentionResponse.js +11 -0
  530. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsRenameResponse.js +11 -0
  531. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsRestrictAccessAddGroupResponse.js +11 -0
  532. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsRestrictAccessListGroupsResponse.js +11 -0
  533. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsRestrictAccessRemoveGroupResponse.js +11 -0
  534. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsSearchResponse.js +11 -0
  535. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsSetConversationPrefsResponse.js +11 -0
  536. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsSetCustomRetentionResponse.js +11 -0
  537. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsSetTeamsResponse.js +11 -0
  538. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsUnarchiveResponse.js +11 -0
  539. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsWhitelistAddResponse.js +11 -0
  540. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsWhitelistListGroupsLinkedToChannelResponse.js +11 -0
  541. package/app/node_modules/@slack/web-api/dist/types/response/AdminConversationsWhitelistRemoveResponse.js +11 -0
  542. package/app/node_modules/@slack/web-api/dist/types/response/AdminEmojiAddAliasResponse.js +11 -0
  543. package/app/node_modules/@slack/web-api/dist/types/response/AdminEmojiAddResponse.js +11 -0
  544. package/app/node_modules/@slack/web-api/dist/types/response/AdminEmojiListResponse.js +11 -0
  545. package/app/node_modules/@slack/web-api/dist/types/response/AdminEmojiRemoveResponse.js +11 -0
  546. package/app/node_modules/@slack/web-api/dist/types/response/AdminEmojiRenameResponse.js +11 -0
  547. package/app/node_modules/@slack/web-api/dist/types/response/AdminFunctionsListResponse.js +11 -0
  548. package/app/node_modules/@slack/web-api/dist/types/response/AdminFunctionsPermissionsLookupResponse.js +11 -0
  549. package/app/node_modules/@slack/web-api/dist/types/response/AdminFunctionsPermissionsSetResponse.js +11 -0
  550. package/app/node_modules/@slack/web-api/dist/types/response/AdminInviteRequestsApproveResponse.js +11 -0
  551. package/app/node_modules/@slack/web-api/dist/types/response/AdminInviteRequestsApprovedListResponse.js +11 -0
  552. package/app/node_modules/@slack/web-api/dist/types/response/AdminInviteRequestsDeniedListResponse.js +11 -0
  553. package/app/node_modules/@slack/web-api/dist/types/response/AdminInviteRequestsDenyResponse.js +11 -0
  554. package/app/node_modules/@slack/web-api/dist/types/response/AdminInviteRequestsListResponse.js +11 -0
  555. package/app/node_modules/@slack/web-api/dist/types/response/AdminRolesAddAssignmentsResponse.js +11 -0
  556. package/app/node_modules/@slack/web-api/dist/types/response/AdminRolesListAssignmentsResponse.js +11 -0
  557. package/app/node_modules/@slack/web-api/dist/types/response/AdminRolesRemoveAssignmentsResponse.js +11 -0
  558. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsAdminsListResponse.js +11 -0
  559. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsCreateResponse.js +11 -0
  560. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsListResponse.js +11 -0
  561. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsOwnersListResponse.js +11 -0
  562. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsSettingsInfoResponse.js +11 -0
  563. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsSettingsSetDefaultChannelsResponse.js +11 -0
  564. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsSettingsSetDescriptionResponse.js +11 -0
  565. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsSettingsSetDiscoverabilityResponse.js +11 -0
  566. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsSettingsSetIconResponse.js +11 -0
  567. package/app/node_modules/@slack/web-api/dist/types/response/AdminTeamsSettingsSetNameResponse.js +11 -0
  568. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsergroupsAddChannelsResponse.js +11 -0
  569. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsergroupsAddTeamsResponse.js +11 -0
  570. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsergroupsListChannelsResponse.js +11 -0
  571. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsergroupsRemoveChannelsResponse.js +11 -0
  572. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersAssignResponse.js +11 -0
  573. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersInviteResponse.js +11 -0
  574. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersListResponse.js +11 -0
  575. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersRemoveResponse.js +11 -0
  576. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionClearSettingsResponse.js +11 -0
  577. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionGetSettingsResponse.js +11 -0
  578. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionInvalidateResponse.js +11 -0
  579. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionListResponse.js +11 -0
  580. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionResetBulkResponse.js +11 -0
  581. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionResetResponse.js +11 -0
  582. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSessionSetSettingsResponse.js +11 -0
  583. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSetAdminResponse.js +11 -0
  584. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSetExpirationResponse.js +11 -0
  585. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSetOwnerResponse.js +11 -0
  586. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersSetRegularResponse.js +11 -0
  587. package/app/node_modules/@slack/web-api/dist/types/response/AdminUsersUnsupportedVersionsExportResponse.js +11 -0
  588. package/app/node_modules/@slack/web-api/dist/types/response/AdminWorkflowsCollaboratorsAddResponse.js +11 -0
  589. package/app/node_modules/@slack/web-api/dist/types/response/AdminWorkflowsCollaboratorsRemoveResponse.js +11 -0
  590. package/app/node_modules/@slack/web-api/dist/types/response/AdminWorkflowsPermissionsLookupResponse.js +11 -0
  591. package/app/node_modules/@slack/web-api/dist/types/response/AdminWorkflowsSearchResponse.js +11 -0
  592. package/app/node_modules/@slack/web-api/dist/types/response/AdminWorkflowsUnpublishResponse.js +11 -0
  593. package/app/node_modules/@slack/web-api/dist/types/response/ApiTestResponse.js +11 -0
  594. package/app/node_modules/@slack/web-api/dist/types/response/AppsConnectionsOpenResponse.js +11 -0
  595. package/app/node_modules/@slack/web-api/dist/types/response/AppsEventAuthorizationsListResponse.js +11 -0
  596. package/app/node_modules/@slack/web-api/dist/types/response/AppsManifestCreateResponse.js +11 -0
  597. package/app/node_modules/@slack/web-api/dist/types/response/AppsManifestDeleteResponse.js +11 -0
  598. package/app/node_modules/@slack/web-api/dist/types/response/AppsManifestExportResponse.js +11 -0
  599. package/app/node_modules/@slack/web-api/dist/types/response/AppsManifestUpdateResponse.js +11 -0
  600. package/app/node_modules/@slack/web-api/dist/types/response/AppsManifestValidateResponse.js +11 -0
  601. package/app/node_modules/@slack/web-api/dist/types/response/AppsPermissionsInfoResponse.js +11 -0
  602. package/app/node_modules/@slack/web-api/dist/types/response/AppsPermissionsRequestResponse.js +11 -0
  603. package/app/node_modules/@slack/web-api/dist/types/response/AppsPermissionsResourcesListResponse.js +11 -0
  604. package/app/node_modules/@slack/web-api/dist/types/response/AppsPermissionsScopesListResponse.js +11 -0
  605. package/app/node_modules/@slack/web-api/dist/types/response/AppsPermissionsUsersListResponse.js +11 -0
  606. package/app/node_modules/@slack/web-api/dist/types/response/AppsPermissionsUsersRequestResponse.js +11 -0
  607. package/app/node_modules/@slack/web-api/dist/types/response/AppsUninstallResponse.js +11 -0
  608. package/app/node_modules/@slack/web-api/dist/types/response/AppsUserConnectionUpdateResponse.js +11 -0
  609. package/app/node_modules/@slack/web-api/dist/types/response/AssistantThreadsSetStatusResponse.js +11 -0
  610. package/app/node_modules/@slack/web-api/dist/types/response/AssistantThreadsSetSuggestedPromptsResponse.js +11 -0
  611. package/app/node_modules/@slack/web-api/dist/types/response/AssistantThreadsSetTitleResponse.js +11 -0
  612. package/app/node_modules/@slack/web-api/dist/types/response/AuthRevokeResponse.js +11 -0
  613. package/app/node_modules/@slack/web-api/dist/types/response/AuthTeamsListResponse.js +11 -0
  614. package/app/node_modules/@slack/web-api/dist/types/response/AuthTestResponse.js +11 -0
  615. package/app/node_modules/@slack/web-api/dist/types/response/BookmarksAddResponse.js +11 -0
  616. package/app/node_modules/@slack/web-api/dist/types/response/BookmarksEditResponse.js +11 -0
  617. package/app/node_modules/@slack/web-api/dist/types/response/BookmarksListResponse.js +11 -0
  618. package/app/node_modules/@slack/web-api/dist/types/response/BookmarksRemoveResponse.js +11 -0
  619. package/app/node_modules/@slack/web-api/dist/types/response/BotsInfoResponse.js +11 -0
  620. package/app/node_modules/@slack/web-api/dist/types/response/CallsAddResponse.js +11 -0
  621. package/app/node_modules/@slack/web-api/dist/types/response/CallsEndResponse.js +11 -0
  622. package/app/node_modules/@slack/web-api/dist/types/response/CallsInfoResponse.js +11 -0
  623. package/app/node_modules/@slack/web-api/dist/types/response/CallsParticipantsAddResponse.js +11 -0
  624. package/app/node_modules/@slack/web-api/dist/types/response/CallsParticipantsRemoveResponse.js +11 -0
  625. package/app/node_modules/@slack/web-api/dist/types/response/CallsUpdateResponse.js +11 -0
  626. package/app/node_modules/@slack/web-api/dist/types/response/CanvasesAccessDeleteResponse.js +11 -0
  627. package/app/node_modules/@slack/web-api/dist/types/response/CanvasesAccessSetResponse.js +11 -0
  628. package/app/node_modules/@slack/web-api/dist/types/response/CanvasesCreateResponse.js +11 -0
  629. package/app/node_modules/@slack/web-api/dist/types/response/CanvasesDeleteResponse.js +11 -0
  630. package/app/node_modules/@slack/web-api/dist/types/response/CanvasesEditResponse.js +11 -0
  631. package/app/node_modules/@slack/web-api/dist/types/response/CanvasesSectionsLookupResponse.js +11 -0
  632. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsArchiveResponse.js +11 -0
  633. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsCreateResponse.js +11 -0
  634. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsHistoryResponse.js +11 -0
  635. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsInfoResponse.js +11 -0
  636. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsInviteResponse.js +11 -0
  637. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsJoinResponse.js +11 -0
  638. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsKickResponse.js +11 -0
  639. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsLeaveResponse.js +11 -0
  640. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsListResponse.js +11 -0
  641. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsMarkResponse.js +11 -0
  642. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsRenameResponse.js +11 -0
  643. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsRepliesResponse.js +11 -0
  644. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsSetPurposeResponse.js +11 -0
  645. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsSetTopicResponse.js +11 -0
  646. package/app/node_modules/@slack/web-api/dist/types/response/ChannelsUnarchiveResponse.js +11 -0
  647. package/app/node_modules/@slack/web-api/dist/types/response/ChatAppendStreamResponse.js +3 -0
  648. package/app/node_modules/@slack/web-api/dist/types/response/ChatDeleteResponse.js +11 -0
  649. package/app/node_modules/@slack/web-api/dist/types/response/ChatDeleteScheduledMessageResponse.js +11 -0
  650. package/app/node_modules/@slack/web-api/dist/types/response/ChatGetPermalinkResponse.js +11 -0
  651. package/app/node_modules/@slack/web-api/dist/types/response/ChatMeMessageResponse.js +11 -0
  652. package/app/node_modules/@slack/web-api/dist/types/response/ChatPostEphemeralResponse.js +11 -0
  653. package/app/node_modules/@slack/web-api/dist/types/response/ChatPostMessageResponse.js +67 -0
  654. package/app/node_modules/@slack/web-api/dist/types/response/ChatScheduleMessageResponse.js +48 -0
  655. package/app/node_modules/@slack/web-api/dist/types/response/ChatScheduledMessagesListResponse.js +11 -0
  656. package/app/node_modules/@slack/web-api/dist/types/response/ChatStartStreamResponse.js +3 -0
  657. package/app/node_modules/@slack/web-api/dist/types/response/ChatStopStreamResponse.js +3 -0
  658. package/app/node_modules/@slack/web-api/dist/types/response/ChatUnfurlResponse.js +11 -0
  659. package/app/node_modules/@slack/web-api/dist/types/response/ChatUpdateResponse.js +48 -0
  660. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsAcceptSharedInviteResponse.js +11 -0
  661. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsApproveSharedInviteResponse.js +11 -0
  662. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsArchiveResponse.js +11 -0
  663. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsCanvasesCreateResponse.js +11 -0
  664. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsCloseResponse.js +11 -0
  665. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsCreateResponse.js +11 -0
  666. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsDeclineSharedInviteResponse.js +11 -0
  667. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsExternalInvitePermissionsSetResponse.js +11 -0
  668. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsHistoryResponse.js +67 -0
  669. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsInfoResponse.js +11 -0
  670. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsInviteResponse.js +11 -0
  671. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsInviteSharedResponse.js +11 -0
  672. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsJoinResponse.js +11 -0
  673. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsKickResponse.js +11 -0
  674. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsLeaveResponse.js +11 -0
  675. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsListConnectInvitesResponse.js +11 -0
  676. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsListResponse.js +11 -0
  677. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsMarkResponse.js +11 -0
  678. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsMembersResponse.js +11 -0
  679. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsOpenResponse.js +48 -0
  680. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsRenameResponse.js +11 -0
  681. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsRepliesResponse.js +67 -0
  682. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsRequestSharedInviteApproveResponse.js +11 -0
  683. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsRequestSharedInviteDenyResponse.js +11 -0
  684. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsRequestSharedInviteListResponse.js +11 -0
  685. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsSetPurposeResponse.js +11 -0
  686. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsSetTopicResponse.js +11 -0
  687. package/app/node_modules/@slack/web-api/dist/types/response/ConversationsUnarchiveResponse.js +11 -0
  688. package/app/node_modules/@slack/web-api/dist/types/response/DialogOpenResponse.js +11 -0
  689. package/app/node_modules/@slack/web-api/dist/types/response/DndEndDndResponse.js +11 -0
  690. package/app/node_modules/@slack/web-api/dist/types/response/DndEndSnoozeResponse.js +11 -0
  691. package/app/node_modules/@slack/web-api/dist/types/response/DndInfoResponse.js +11 -0
  692. package/app/node_modules/@slack/web-api/dist/types/response/DndSetSnoozeResponse.js +11 -0
  693. package/app/node_modules/@slack/web-api/dist/types/response/DndTeamInfoResponse.js +11 -0
  694. package/app/node_modules/@slack/web-api/dist/types/response/EmojiListResponse.js +11 -0
  695. package/app/node_modules/@slack/web-api/dist/types/response/EntityPresentDetailsResponse.js +11 -0
  696. package/app/node_modules/@slack/web-api/dist/types/response/FilesCommentsAddResponse.js +11 -0
  697. package/app/node_modules/@slack/web-api/dist/types/response/FilesCommentsDeleteResponse.js +11 -0
  698. package/app/node_modules/@slack/web-api/dist/types/response/FilesCommentsEditResponse.js +11 -0
  699. package/app/node_modules/@slack/web-api/dist/types/response/FilesCompleteUploadExternalResponse.js +11 -0
  700. package/app/node_modules/@slack/web-api/dist/types/response/FilesDeleteResponse.js +11 -0
  701. package/app/node_modules/@slack/web-api/dist/types/response/FilesGetUploadURLExternalResponse.js +11 -0
  702. package/app/node_modules/@slack/web-api/dist/types/response/FilesInfoResponse.js +37 -0
  703. package/app/node_modules/@slack/web-api/dist/types/response/FilesListResponse.js +37 -0
  704. package/app/node_modules/@slack/web-api/dist/types/response/FilesRemoteAddResponse.js +37 -0
  705. package/app/node_modules/@slack/web-api/dist/types/response/FilesRemoteInfoResponse.js +37 -0
  706. package/app/node_modules/@slack/web-api/dist/types/response/FilesRemoteListResponse.js +37 -0
  707. package/app/node_modules/@slack/web-api/dist/types/response/FilesRemoteRemoveResponse.js +11 -0
  708. package/app/node_modules/@slack/web-api/dist/types/response/FilesRemoteShareResponse.js +37 -0
  709. package/app/node_modules/@slack/web-api/dist/types/response/FilesRemoteUpdateResponse.js +37 -0
  710. package/app/node_modules/@slack/web-api/dist/types/response/FilesRevokePublicURLResponse.js +37 -0
  711. package/app/node_modules/@slack/web-api/dist/types/response/FilesSharedPublicURLResponse.js +37 -0
  712. package/app/node_modules/@slack/web-api/dist/types/response/FilesUploadResponse.js +37 -0
  713. package/app/node_modules/@slack/web-api/dist/types/response/FunctionsCompleteErrorResponse.js +11 -0
  714. package/app/node_modules/@slack/web-api/dist/types/response/FunctionsCompleteSuccessResponse.js +11 -0
  715. package/app/node_modules/@slack/web-api/dist/types/response/GroupsArchiveResponse.js +11 -0
  716. package/app/node_modules/@slack/web-api/dist/types/response/GroupsCloseResponse.js +11 -0
  717. package/app/node_modules/@slack/web-api/dist/types/response/GroupsCreateChildResponse.js +11 -0
  718. package/app/node_modules/@slack/web-api/dist/types/response/GroupsCreateResponse.js +11 -0
  719. package/app/node_modules/@slack/web-api/dist/types/response/GroupsHistoryResponse.js +11 -0
  720. package/app/node_modules/@slack/web-api/dist/types/response/GroupsInfoResponse.js +11 -0
  721. package/app/node_modules/@slack/web-api/dist/types/response/GroupsInviteResponse.js +11 -0
  722. package/app/node_modules/@slack/web-api/dist/types/response/GroupsKickResponse.js +11 -0
  723. package/app/node_modules/@slack/web-api/dist/types/response/GroupsLeaveResponse.js +11 -0
  724. package/app/node_modules/@slack/web-api/dist/types/response/GroupsListResponse.js +11 -0
  725. package/app/node_modules/@slack/web-api/dist/types/response/GroupsMarkResponse.js +11 -0
  726. package/app/node_modules/@slack/web-api/dist/types/response/GroupsOpenResponse.js +11 -0
  727. package/app/node_modules/@slack/web-api/dist/types/response/GroupsRenameResponse.js +11 -0
  728. package/app/node_modules/@slack/web-api/dist/types/response/GroupsRepliesResponse.js +11 -0
  729. package/app/node_modules/@slack/web-api/dist/types/response/GroupsSetPurposeResponse.js +11 -0
  730. package/app/node_modules/@slack/web-api/dist/types/response/GroupsSetTopicResponse.js +11 -0
  731. package/app/node_modules/@slack/web-api/dist/types/response/GroupsUnarchiveResponse.js +11 -0
  732. package/app/node_modules/@slack/web-api/dist/types/response/ImCloseResponse.js +11 -0
  733. package/app/node_modules/@slack/web-api/dist/types/response/ImHistoryResponse.js +11 -0
  734. package/app/node_modules/@slack/web-api/dist/types/response/ImListResponse.js +11 -0
  735. package/app/node_modules/@slack/web-api/dist/types/response/ImMarkResponse.js +11 -0
  736. package/app/node_modules/@slack/web-api/dist/types/response/ImOpenResponse.js +11 -0
  737. package/app/node_modules/@slack/web-api/dist/types/response/ImRepliesResponse.js +11 -0
  738. package/app/node_modules/@slack/web-api/dist/types/response/MigrationExchangeResponse.js +11 -0
  739. package/app/node_modules/@slack/web-api/dist/types/response/MpimCloseResponse.js +11 -0
  740. package/app/node_modules/@slack/web-api/dist/types/response/MpimHistoryResponse.js +11 -0
  741. package/app/node_modules/@slack/web-api/dist/types/response/MpimListResponse.js +11 -0
  742. package/app/node_modules/@slack/web-api/dist/types/response/MpimMarkResponse.js +11 -0
  743. package/app/node_modules/@slack/web-api/dist/types/response/MpimOpenResponse.js +11 -0
  744. package/app/node_modules/@slack/web-api/dist/types/response/MpimRepliesResponse.js +11 -0
  745. package/app/node_modules/@slack/web-api/dist/types/response/OauthAccessResponse.js +11 -0
  746. package/app/node_modules/@slack/web-api/dist/types/response/OauthTokenResponse.js +11 -0
  747. package/app/node_modules/@slack/web-api/dist/types/response/OauthV2AccessResponse.js +11 -0
  748. package/app/node_modules/@slack/web-api/dist/types/response/OauthV2ExchangeResponse.js +11 -0
  749. package/app/node_modules/@slack/web-api/dist/types/response/OpenIDConnectTokenResponse.js +11 -0
  750. package/app/node_modules/@slack/web-api/dist/types/response/OpenIDConnectUserInfoResponse.js +11 -0
  751. package/app/node_modules/@slack/web-api/dist/types/response/PinsAddResponse.js +11 -0
  752. package/app/node_modules/@slack/web-api/dist/types/response/PinsListResponse.js +37 -0
  753. package/app/node_modules/@slack/web-api/dist/types/response/PinsRemoveResponse.js +11 -0
  754. package/app/node_modules/@slack/web-api/dist/types/response/ReactionsAddResponse.js +11 -0
  755. package/app/node_modules/@slack/web-api/dist/types/response/ReactionsGetResponse.js +48 -0
  756. package/app/node_modules/@slack/web-api/dist/types/response/ReactionsListResponse.js +67 -0
  757. package/app/node_modules/@slack/web-api/dist/types/response/ReactionsRemoveResponse.js +11 -0
  758. package/app/node_modules/@slack/web-api/dist/types/response/RemindersAddResponse.js +11 -0
  759. package/app/node_modules/@slack/web-api/dist/types/response/RemindersCompleteResponse.js +11 -0
  760. package/app/node_modules/@slack/web-api/dist/types/response/RemindersDeleteResponse.js +11 -0
  761. package/app/node_modules/@slack/web-api/dist/types/response/RemindersInfoResponse.js +11 -0
  762. package/app/node_modules/@slack/web-api/dist/types/response/RemindersListResponse.js +11 -0
  763. package/app/node_modules/@slack/web-api/dist/types/response/RtmConnectResponse.js +11 -0
  764. package/app/node_modules/@slack/web-api/dist/types/response/RtmStartResponse.js +77 -0
  765. package/app/node_modules/@slack/web-api/dist/types/response/SearchAllResponse.js +82 -0
  766. package/app/node_modules/@slack/web-api/dist/types/response/SearchFilesResponse.js +63 -0
  767. package/app/node_modules/@slack/web-api/dist/types/response/SearchMessagesResponse.js +67 -0
  768. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsAccessDeleteResponse.js +3 -0
  769. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsAccessSetResponse.js +3 -0
  770. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsCreateResponse.js +3 -0
  771. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsDownloadGetResponse.js +3 -0
  772. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsDownloadStartResponse.js +3 -0
  773. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsItemsCreateResponse.js +3 -0
  774. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsItemsDeleteMultipleResponse.js +3 -0
  775. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsItemsDeleteResponse.js +3 -0
  776. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsItemsInfoResponse.js +3 -0
  777. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsItemsListResponse.js +3 -0
  778. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsItemsUpdateResponse.js +3 -0
  779. package/app/node_modules/@slack/web-api/dist/types/response/SlackListsUpdateResponse.js +3 -0
  780. package/app/node_modules/@slack/web-api/dist/types/response/StarsAddResponse.js +11 -0
  781. package/app/node_modules/@slack/web-api/dist/types/response/StarsListResponse.js +11 -0
  782. package/app/node_modules/@slack/web-api/dist/types/response/StarsRemoveResponse.js +11 -0
  783. package/app/node_modules/@slack/web-api/dist/types/response/TeamAccessLogsResponse.js +11 -0
  784. package/app/node_modules/@slack/web-api/dist/types/response/TeamBillableInfoResponse.js +11 -0
  785. package/app/node_modules/@slack/web-api/dist/types/response/TeamBillingInfoResponse.js +11 -0
  786. package/app/node_modules/@slack/web-api/dist/types/response/TeamExternalTeamsDisconnectResponse.js +11 -0
  787. package/app/node_modules/@slack/web-api/dist/types/response/TeamExternalTeamsListResponse.js +11 -0
  788. package/app/node_modules/@slack/web-api/dist/types/response/TeamInfoResponse.js +11 -0
  789. package/app/node_modules/@slack/web-api/dist/types/response/TeamIntegrationLogsResponse.js +11 -0
  790. package/app/node_modules/@slack/web-api/dist/types/response/TeamPreferencesListResponse.js +11 -0
  791. package/app/node_modules/@slack/web-api/dist/types/response/TeamProfileGetResponse.js +11 -0
  792. package/app/node_modules/@slack/web-api/dist/types/response/ToolingTokensRotateResponse.js +11 -0
  793. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsCreateResponse.js +11 -0
  794. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsDisableResponse.js +11 -0
  795. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsEnableResponse.js +11 -0
  796. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsListResponse.js +11 -0
  797. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsUpdateResponse.js +11 -0
  798. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsUsersListResponse.js +11 -0
  799. package/app/node_modules/@slack/web-api/dist/types/response/UsergroupsUsersUpdateResponse.js +11 -0
  800. package/app/node_modules/@slack/web-api/dist/types/response/UsersConversationsResponse.js +11 -0
  801. package/app/node_modules/@slack/web-api/dist/types/response/UsersDeletePhotoResponse.js +11 -0
  802. package/app/node_modules/@slack/web-api/dist/types/response/UsersDiscoverableContactsLookupResponse.js +11 -0
  803. package/app/node_modules/@slack/web-api/dist/types/response/UsersGetPresenceResponse.js +11 -0
  804. package/app/node_modules/@slack/web-api/dist/types/response/UsersIdentityResponse.js +11 -0
  805. package/app/node_modules/@slack/web-api/dist/types/response/UsersInfoResponse.js +11 -0
  806. package/app/node_modules/@slack/web-api/dist/types/response/UsersListResponse.js +11 -0
  807. package/app/node_modules/@slack/web-api/dist/types/response/UsersLookupByEmailResponse.js +11 -0
  808. package/app/node_modules/@slack/web-api/dist/types/response/UsersProfileGetResponse.js +11 -0
  809. package/app/node_modules/@slack/web-api/dist/types/response/UsersProfileSetResponse.js +11 -0
  810. package/app/node_modules/@slack/web-api/dist/types/response/UsersSetActiveResponse.js +11 -0
  811. package/app/node_modules/@slack/web-api/dist/types/response/UsersSetPhotoResponse.js +11 -0
  812. package/app/node_modules/@slack/web-api/dist/types/response/UsersSetPresenceResponse.js +11 -0
  813. package/app/node_modules/@slack/web-api/dist/types/response/ViewsOpenResponse.js +31 -0
  814. package/app/node_modules/@slack/web-api/dist/types/response/ViewsPublishResponse.js +31 -0
  815. package/app/node_modules/@slack/web-api/dist/types/response/ViewsPushResponse.js +31 -0
  816. package/app/node_modules/@slack/web-api/dist/types/response/ViewsUpdateResponse.js +31 -0
  817. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedAddResponse.js +3 -0
  818. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedListResponse.js +3 -0
  819. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedRemoveResponse.js +3 -0
  820. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsFeaturedSetResponse.js +3 -0
  821. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsStepCompletedResponse.js +11 -0
  822. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsStepFailedResponse.js +11 -0
  823. package/app/node_modules/@slack/web-api/dist/types/response/WorkflowsUpdateStepResponse.js +11 -0
  824. package/app/node_modules/@slack/web-api/dist/types/response/index.js +3 -0
  825. package/app/node_modules/@slack/web-api/package.json +75 -0
  826. package/app/node_modules/agent-base/dist/src/index.js +203 -0
  827. package/app/node_modules/agent-base/dist/src/promisify.js +18 -0
  828. package/app/node_modules/agent-base/package.json +64 -0
  829. package/app/node_modules/asynckit/index.js +6 -0
  830. package/app/node_modules/asynckit/lib/abort.js +29 -0
  831. package/app/node_modules/asynckit/lib/async.js +34 -0
  832. package/app/node_modules/asynckit/lib/defer.js +26 -0
  833. package/app/node_modules/asynckit/lib/iterate.js +75 -0
  834. package/app/node_modules/asynckit/lib/state.js +37 -0
  835. package/app/node_modules/asynckit/lib/terminator.js +29 -0
  836. package/app/node_modules/asynckit/package.json +63 -0
  837. package/app/node_modules/asynckit/parallel.js +43 -0
  838. package/app/node_modules/asynckit/serial.js +17 -0
  839. package/app/node_modules/asynckit/serialOrdered.js +75 -0
  840. package/app/node_modules/axios/dist/node/axios.cjs +6808 -0
  841. package/app/node_modules/axios/package.json +203 -0
  842. package/app/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  843. package/app/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  844. package/app/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  845. package/app/node_modules/call-bind-apply-helpers/index.js +15 -0
  846. package/app/node_modules/call-bind-apply-helpers/package.json +85 -0
  847. package/app/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  848. package/app/node_modules/combined-stream/lib/combined_stream.js +208 -0
  849. package/app/node_modules/combined-stream/package.json +25 -0
  850. package/app/node_modules/debug/package.json +64 -0
  851. package/app/node_modules/debug/src/browser.js +272 -0
  852. package/app/node_modules/debug/src/common.js +292 -0
  853. package/app/node_modules/debug/src/index.js +10 -0
  854. package/app/node_modules/debug/src/node.js +263 -0
  855. package/app/node_modules/delayed-stream/lib/delayed_stream.js +107 -0
  856. package/app/node_modules/delayed-stream/package.json +27 -0
  857. package/app/node_modules/dunder-proto/get.js +30 -0
  858. package/app/node_modules/dunder-proto/package.json +76 -0
  859. package/app/node_modules/es-define-property/index.js +14 -0
  860. package/app/node_modules/es-define-property/package.json +81 -0
  861. package/app/node_modules/es-errors/eval.js +4 -0
  862. package/app/node_modules/es-errors/index.js +4 -0
  863. package/app/node_modules/es-errors/package.json +80 -0
  864. package/app/node_modules/es-errors/range.js +4 -0
  865. package/app/node_modules/es-errors/ref.js +4 -0
  866. package/app/node_modules/es-errors/syntax.js +4 -0
  867. package/app/node_modules/es-errors/type.js +4 -0
  868. package/app/node_modules/es-errors/uri.js +4 -0
  869. package/app/node_modules/es-object-atoms/index.js +4 -0
  870. package/app/node_modules/es-object-atoms/package.json +79 -0
  871. package/app/node_modules/es-set-tostringtag/index.js +35 -0
  872. package/app/node_modules/es-set-tostringtag/package.json +78 -0
  873. package/app/node_modules/eventemitter3/index.js +336 -0
  874. package/app/node_modules/eventemitter3/package.json +62 -0
  875. package/app/node_modules/follow-redirects/debug.js +15 -0
  876. package/app/node_modules/follow-redirects/index.js +709 -0
  877. package/app/node_modules/follow-redirects/package.json +58 -0
  878. package/app/node_modules/form-data/lib/browser.js +4 -0
  879. package/app/node_modules/form-data/lib/form_data.js +506 -0
  880. package/app/node_modules/form-data/lib/populate.js +10 -0
  881. package/app/node_modules/form-data/package.json +82 -0
  882. package/app/node_modules/function-bind/implementation.js +84 -0
  883. package/app/node_modules/function-bind/index.js +5 -0
  884. package/app/node_modules/function-bind/package.json +87 -0
  885. package/app/node_modules/get-intrinsic/index.js +378 -0
  886. package/app/node_modules/get-intrinsic/package.json +97 -0
  887. package/app/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  888. package/app/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  889. package/app/node_modules/get-proto/index.js +27 -0
  890. package/app/node_modules/get-proto/package.json +81 -0
  891. package/app/node_modules/gopd/gOPD.js +4 -0
  892. package/app/node_modules/gopd/index.js +15 -0
  893. package/app/node_modules/gopd/package.json +77 -0
  894. package/app/node_modules/has-flag/index.js +8 -0
  895. package/app/node_modules/has-flag/package.json +46 -0
  896. package/app/node_modules/has-symbols/index.js +14 -0
  897. package/app/node_modules/has-symbols/package.json +111 -0
  898. package/app/node_modules/has-symbols/shams.js +45 -0
  899. package/app/node_modules/has-tostringtag/package.json +108 -0
  900. package/app/node_modules/has-tostringtag/shams.js +8 -0
  901. package/app/node_modules/hasown/index.js +8 -0
  902. package/app/node_modules/hasown/package.json +91 -0
  903. package/app/node_modules/https-proxy-agent/dist/agent.js +177 -0
  904. package/app/node_modules/https-proxy-agent/dist/index.js +14 -0
  905. package/app/node_modules/https-proxy-agent/dist/parse-proxy-response.js +66 -0
  906. package/app/node_modules/https-proxy-agent/package.json +56 -0
  907. package/app/node_modules/is-electron/index.js +21 -0
  908. package/app/node_modules/is-electron/package.json +34 -0
  909. package/app/node_modules/is-stream/index.js +28 -0
  910. package/app/node_modules/is-stream/package.json +42 -0
  911. package/app/node_modules/math-intrinsics/abs.js +4 -0
  912. package/app/node_modules/math-intrinsics/floor.js +4 -0
  913. package/app/node_modules/math-intrinsics/isNaN.js +6 -0
  914. package/app/node_modules/math-intrinsics/max.js +4 -0
  915. package/app/node_modules/math-intrinsics/min.js +4 -0
  916. package/app/node_modules/math-intrinsics/package.json +86 -0
  917. package/app/node_modules/math-intrinsics/pow.js +4 -0
  918. package/app/node_modules/math-intrinsics/round.js +4 -0
  919. package/app/node_modules/math-intrinsics/sign.js +11 -0
  920. package/app/node_modules/mime-db/db.json +8519 -0
  921. package/app/node_modules/mime-db/index.js +12 -0
  922. package/app/node_modules/mime-db/package.json +60 -0
  923. package/app/node_modules/mime-types/index.js +188 -0
  924. package/app/node_modules/mime-types/package.json +44 -0
  925. package/app/node_modules/ms/index.js +162 -0
  926. package/app/node_modules/ms/package.json +38 -0
  927. package/app/node_modules/p-finally/index.js +15 -0
  928. package/app/node_modules/p-finally/package.json +42 -0
  929. package/app/node_modules/p-queue/dist/index.js +279 -0
  930. package/app/node_modules/p-queue/dist/lower-bound.js +21 -0
  931. package/app/node_modules/p-queue/dist/priority-queue.js +32 -0
  932. package/app/node_modules/p-queue/node_modules/eventemitter3/index.js +336 -0
  933. package/app/node_modules/p-queue/node_modules/eventemitter3/package.json +56 -0
  934. package/app/node_modules/p-queue/package.json +92 -0
  935. package/app/node_modules/p-retry/index.js +85 -0
  936. package/app/node_modules/p-retry/package.json +51 -0
  937. package/app/node_modules/p-timeout/index.js +57 -0
  938. package/app/node_modules/p-timeout/package.json +45 -0
  939. package/app/node_modules/retry/index.js +1 -0
  940. package/app/node_modules/retry/lib/retry.js +100 -0
  941. package/app/node_modules/retry/lib/retry_operation.js +162 -0
  942. package/app/node_modules/retry/package.json +36 -0
  943. package/app/node_modules/supports-color/index.js +135 -0
  944. package/app/node_modules/supports-color/package.json +53 -0
  945. package/app/node_modules/ws/index.js +22 -0
  946. package/app/node_modules/ws/lib/buffer-util.js +131 -0
  947. package/app/node_modules/ws/lib/constants.js +19 -0
  948. package/app/node_modules/ws/lib/event-target.js +292 -0
  949. package/app/node_modules/ws/lib/extension.js +203 -0
  950. package/app/node_modules/ws/lib/limiter.js +55 -0
  951. package/app/node_modules/ws/lib/permessage-deflate.js +530 -0
  952. package/app/node_modules/ws/lib/receiver.js +743 -0
  953. package/app/node_modules/ws/lib/sender.js +607 -0
  954. package/app/node_modules/ws/lib/stream.js +161 -0
  955. package/app/node_modules/ws/lib/subprotocol.js +62 -0
  956. package/app/node_modules/ws/lib/validation.js +152 -0
  957. package/app/node_modules/ws/lib/websocket-server.js +562 -0
  958. package/app/node_modules/ws/lib/websocket.js +1421 -0
  959. package/app/node_modules/ws/package.json +74 -0
  960. package/app/package.json +1 -1
  961. package/app/server.js +1 -1
  962. package/dist/cli.d.ts +1 -1
  963. package/dist/cli.js +7 -4
  964. package/dist/clients.js +7 -3
  965. package/dist/config.d.ts +2 -1
  966. package/dist/config.js +5 -4
  967. package/dist/contract.d.ts +1 -0
  968. package/dist/contract.js +5 -0
  969. package/dist/home.d.ts +1 -1
  970. package/dist/home.js +1 -1
  971. package/dist/index.d.ts +1 -1
  972. package/dist/index.js +1 -1
  973. package/dist/product.d.ts +8 -0
  974. package/dist/product.js +70 -4
  975. package/dist/upstream.js +2 -2
  976. package/package.json +2 -2
  977. package/schemas/botmancers.mcp.v2.tools.json +2353 -4
  978. package/skills/botmancers-collaboration/SKILL.md +25 -6
  979. package/skills/botmancers-collaboration/references/workflows.md +93 -0
  980. package/app/.next/server/chunks/[root-of-the-server]__0ab4e_k._.js +0 -3
  981. package/app/.next/server/chunks/[root-of-the-server]__0izjfmr._.js +0 -1656
  982. package/app/.next/server/chunks/[root-of-the-server]__0qozubc._.js +0 -3
  983. package/app/.next/server/chunks/[root-of-the-server]__0wtzcge._.js +0 -3
  984. package/app/.next/server/chunks/[root-of-the-server]__10m3szc._.js +0 -3
  985. package/app/.next/server/chunks/[root-of-the-server]__15hknun._.js +0 -3
  986. package/app/.next/server/chunks/[root-of-the-server]__16ikszu._.js +0 -3
  987. package/app/.next/server/chunks/[root-of-the-server]__1afl75n._.js +0 -3
  988. package/app/.next/server/chunks/[root-of-the-server]__1kvvdpx._.js +0 -7
  989. package/app/.next/server/chunks/[root-of-the-server]__1qoa704._.js +0 -7
  990. package/app/.next/server/chunks/[root-of-the-server]__1slu7d7._.js +0 -7
  991. package/app/.next/server/chunks/_06rti77._.js +0 -30
  992. package/app/.next/server/chunks/_09k38l1._.js +0 -3
  993. package/app/.next/server/chunks/_0dlg5kj._.js +0 -30
  994. package/app/.next/server/chunks/_0dyculb._.js +0 -30
  995. package/app/.next/server/chunks/_0eig2jc._.js +0 -30
  996. package/app/.next/server/chunks/_0ggf7vy._.js +0 -3
  997. package/app/.next/server/chunks/_0gtqbub._.js +0 -3
  998. package/app/.next/server/chunks/_0i7ga8c._.js +0 -3
  999. package/app/.next/server/chunks/_0kghtb6._.js +0 -3
  1000. package/app/.next/server/chunks/_0orubev._.js +0 -3
  1001. package/app/.next/server/chunks/_0sfpe9z._.js +0 -3
  1002. package/app/.next/server/chunks/_0th2j4w._.js +0 -3
  1003. package/app/.next/server/chunks/_0uz7r06._.js +0 -30
  1004. package/app/.next/server/chunks/_0x05ts4._.js +0 -3
  1005. package/app/.next/server/chunks/_0y3geoj._.js +0 -30
  1006. package/app/.next/server/chunks/_12tq5uv._.js +0 -30
  1007. package/app/.next/server/chunks/_147-4gl._.js +0 -3
  1008. package/app/.next/server/chunks/_14ky6a2._.js +0 -30
  1009. package/app/.next/server/chunks/_16kbxdt._.js +0 -30
  1010. package/app/.next/server/chunks/_1963m2f._.js +0 -30
  1011. package/app/.next/server/chunks/_1_34_h3._.js +0 -30
  1012. package/app/.next/server/chunks/_1cc-2mx._.js +0 -3
  1013. package/app/.next/server/chunks/_1ee4ej2._.js +0 -3
  1014. package/app/.next/server/chunks/_1esxu1s._.js +0 -3
  1015. package/app/.next/server/chunks/_1gn7eh7._.js +0 -3
  1016. package/app/.next/server/chunks/_1gw7qwf._.js +0 -3
  1017. package/app/.next/server/chunks/_1inyx08._.js +0 -3
  1018. package/app/.next/server/chunks/_1kjsnlr._.js +0 -3
  1019. package/app/.next/server/chunks/_1nurj3f._.js +0 -30
  1020. package/app/.next/server/chunks/_1p2rf_n._.js +0 -30
  1021. package/app/.next/server/chunks/_1p8rola._.js +0 -3
  1022. package/app/.next/server/chunks/_1u6tw78._.js +0 -30
  1023. package/app/.next/server/chunks/app_api_import-capabilities_route_ts_013w1kt._.js +0 -3
  1024. package/app/.next/server/chunks/lib_0t3s3rj._.js +0 -30
  1025. package/app/.next/server/chunks/lib_0zxi6rx._.js +0 -148
  1026. package/app/.next/server/chunks/lib_12udr7g._.js +0 -148
  1027. package/app/.next/server/chunks/lib_draft_ts_1atoius._.js +0 -3
  1028. package/app/.next/server/chunks/lib_session-catalog_ts_1i7f38f._.js +0 -30
  1029. package/app/.next/server/chunks/ssr/_00ysoah._.js +0 -3
  1030. package/app/.next/server/chunks/ssr/_157wnb_._.js +0 -3
  1031. package/app/.next/server/chunks/ssr/app_1-nwnha._.js +0 -3
  1032. package/app/.next/server/chunks/ssr/app_components_0bhuhd-._.js +0 -3
  1033. package/app/.next/server/chunks/ssr/app_components_0w2_b3t._.js +0 -3
  1034. package/app/.next/server/chunks/ssr/node_modules_next_dist_client_components_server-async-storage_0t1dato.js +0 -3
  1035. package/app/.next/static/chunks/0774d7ob6aze_.js +0 -1
  1036. package/app/.next/static/chunks/0d3ein53nlgja.js +0 -1
  1037. package/app/.next/static/chunks/1i5xroz391zkb.js +0 -1
  1038. package/app/.next/static/chunks/1vz50l951sr9e.css +0 -3
  1039. package/app/.next/static/chunks/24ggj819yt3y6.js +0 -1
  1040. package/app/.next/static/chunks/2_8lcalraul5s.js +0 -3
  1041. package/app/.next/static/chunks/30i0-l04mmdvk.js +0 -1
  1042. package/app/.next/static/chunks/3wdlh25l1vww9.js +0 -1
  1043. /package/app/.next/static/{ewp56HqU5-d9bpFog3bli → _yrIZIFsIbXA0Gaxkytjd}/_buildManifest.js +0 -0
  1044. /package/app/.next/static/{ewp56HqU5-d9bpFog3bli → _yrIZIFsIbXA0Gaxkytjd}/_clientMiddlewareManifest.js +0 -0
  1045. /package/app/.next/static/{ewp56HqU5-d9bpFog3bli → _yrIZIFsIbXA0Gaxkytjd}/_ssgManifest.js +0 -0
@@ -1,148 +0,0 @@
1
- module.exports=[45383,17834,63020,93399,e=>{"use strict";var t=e.i(54799),n=e.i(62294),r=e.i(27510),i=e.i(53059),a=e.i(35613),o=e.i(57281),s=e.i(54226),d=e.i(64974),l=e.i(76459),u=e.i(62349),c=e.i(51749);let _=new Set(["version","target","executionKind","objective","contextWorkRequests","resumeWorkRequest","limits"]),p=new Set(["maxAttempts","deadlineSeconds"]),f=new Set(["conversation","implementation","review","revision"]);function g(e,t){return"string"==typeof e&&e.trim().length>0&&e.length<=t}function m(e,t,n){return Number.isInteger(e)&&e>=t&&e<=n}function h(e){if(!e||"object"!=typeof e||Array.isArray(e))return{ok:!1,reason:"envelope must be a JSON object"};let t=Object.keys(e).filter(e=>!_.has(e));if(t.length>0)return{ok:!1,reason:`unknown field ${t.join(", ")}`};if(1!==e.version)return{ok:!1,reason:"version must be 1"};if(!g(e.target,120))return{ok:!1,reason:"target must be a non-empty Agent name (max 120 characters)"};if("string"!=typeof e.executionKind||!f.has(e.executionKind))return{ok:!1,reason:"unknown executionKind"};if(!g(e.objective,2e4))return{ok:!1,reason:"objective must be non-empty (max 20000 characters)"};let n={version:1,target:e.target.trim(),executionKind:e.executionKind,objective:e.objective.trim()};if(void 0!==e.contextWorkRequests){let t=e.contextWorkRequests;if(!Array.isArray(t)||t.length>8||t.some(e=>!g(e,160)))return{ok:!1,reason:"contextWorkRequests must be at most 8 Work Request references"};if(new Set(t).size!==t.length)return{ok:!1,reason:"contextWorkRequests must be unique"};n.contextWorkRequests=[...t]}let r=Object.prototype.hasOwnProperty.call(e,"resumeWorkRequest");if("revision"===n.executionKind){if(!r||!g(e.resumeWorkRequest,160))return{ok:!1,reason:"revision requires resumeWorkRequest"};n.resumeWorkRequest=e.resumeWorkRequest}else if(r)return{ok:!1,reason:"resumeWorkRequest is revision-only"};if(void 0!==e.limits){let t=e.limits;if(!t||"object"!=typeof t||Array.isArray(t))return{ok:!1,reason:"limits must be an object"};if(Object.keys(t).some(e=>!p.has(e)))return{ok:!1,reason:"unknown limits field"};if(void 0!==t.maxAttempts&&!m(t.maxAttempts,1,10))return{ok:!1,reason:"limits.maxAttempts must be 1-10"};if(void 0!==t.deadlineSeconds&&!m(t.deadlineSeconds,1,86400))return{ok:!1,reason:"limits.deadlineSeconds must be 1-86400"};n.limits={},void 0!==t.maxAttempts&&(n.limits.maxAttempts=t.maxAttempts),void 0!==t.deadlineSeconds&&(n.limits.deadlineSeconds=t.deadlineSeconds)}return{ok:!0,envelope:n}}let k=/```botmancers-wake[^\S\r\n]*\r?\n([\s\S]*?)```/g,w=/WAKE\s+([A-Za-z0-9_-]+)\s*:/gi;function E(e){return JSON.stringify(function e(t){return Array.isArray(t)?t.map(e):t&&"object"==typeof t?Object.fromEntries(Object.keys(t).sort().map(n=>[n,e(t[n])])):t}(e.validation.ok?{syntax:e.syntax,envelope:e.validation.envelope}:{syntax:e.syntax,raw:e.raw}))}var y=e.i(142);(0,y.wakeSafetyLimits)().maxWakeDepth,(0,y.wakeSafetyLimits)().rootBudget;class v extends Error{code;constructor(e,t){super(t),this.name="WakeRouterError",this.code=e}}let I=n.default.prepare("SELECT * FROM wakes WHERE id = ?"),q=n.default.prepare("SELECT * FROM wakes WHERE idempotency_key = ?"),A=n.default.prepare("SELECT * FROM wakes WHERE source_event_id = ? AND position = ?");function R(e){return I.get(e)}function b(e,t){return{wake:e,request:e.work_request_id?n.engine.getWorkRequest(e.work_request_id)??null:null,created:t}}function S(e){return"accepted"===e.status||"blocked"===e.status}function x(e){return n.default.prepare("SELECT COUNT(*) AS n FROM work_requests WHERE root_request_id = ? AND wake_event_id IS NOT NULL").get(e).n}function T(e){let{rootBudget:t}=(0,y.wakeSafetyLimits)(),n=x(e);return n<t?null:{status:"rejected",code:"root_budget_exhausted",limit:t,observed:n,reason:`This work already used ${n} Wakes (limit ${t}).`}}function C(e,t,r){let i=(0,n.resolveWakeTarget)(e.target);if(!i.ok){var a;return"ambiguous"===i.reason?{status:"unavailable",code:"target_ambiguous",reason:`More than one Agent is named ${e.target}; rename one to restore routing.`}:(a=e.target,n.default.prepare("SELECT 1 FROM groups WHERE lower(trim(name)) = lower(trim(?))").get(a))?{status:"rejected",code:"target_is_group",reason:`${e.target} is a Group; wake one Agent by name.`}:{status:"unavailable",code:"target_not_found",reason:`No Agent is named ${e.target}.`}}return N(e,t,{id:i.agentId,name:i.displayName},r)}function N(e,t,r,i){let a=i.parent?.root_request_id??null,o=(0,d.selectExecutionPolicy)({entryPoint:"wake",executionKind:e.executionKind,wakeSyntax:t,resumesWorkRequest:!!e.resumeWorkRequest});if(!o.ok)return{status:"rejected",code:"unsupported_policy",reason:o.reason,target:r};let s=o.policy;if(e.resumeWorkRequest){let t=n.engine.getWorkRequest(e.resumeWorkRequest);if(!t||t.target_agent_id!==r.id||!["implementation","revision"].includes(t.execution_kind))return{status:"rejected",code:"invalid_reference",reason:"A revision resumes an implementation Work Request of the same Agent.",target:r}}if("review"===e.executionKind&&((e.contextWorkRequests??[]).some(e=>{let t=n.engine.getWorkRequest(e);return t&&["implementation","revision"].includes(t.execution_kind)&&t.target_agent_id===r.id})||null!==a&&n.default.prepare("SELECT 1 FROM work_requests WHERE root_request_id = ? AND target_agent_id = ? AND execution_kind IN ('implementation', 'revision') LIMIT 1").get(a,r.id)))return{status:"rejected",code:"reviewer_not_independent",reason:`${r.name} did the work under review; wake a different reviewer or ask the person.`,target:r};let l=function(e,t,r){if(!(0,y.needsEditGrant)(e.executionKind))return{rule:"readonly_default",id:null};if(function(e,t,r){let i=r.parent;if("implementation"!==e.executionKind||t.id!==r.agentId||!i||null!==i.wake_event_id||0!==i.wake_depth||null!==i.parent_request_id||i.target_agent_id!==r.agentId||!(0,y.isOwnerPrincipal)({kind:i.root_principal_kind??"",id:i.root_principal_id??""}))return!1;let a=n.engine.listSafetyDecisions(i.id)[0];return a?.principal_type==="human_owner"}(e,t,r))return{rule:"owner_direct_self_wake",id:null};let i=(0,y.activeEditGrant)(r.agentId,t.id);return i?{rule:"edit_grant",id:i.id}:null}(e,r,i);return l?function(e,t,r){var i;let a=n.bots.getById(e.id),o=(0,u.resolveAgent)(a);if(!o.launchable)return{status:"blocked",code:"target_unconfigured",reason:o.needs_deck_selection?`${e.name} has no Agent Deck selected.`:`${e.name} has an unsupported Agent type.`,target:e,policy:t,grant:r};let s=(i=a,"hermes-gateway"===(0,u.agentTransport)((0,u.resolveAgent)(i).agent)?(0,c.loadHermesConfig)()?{available:!0}:{available:!1,reason:"The Hermes gateway is not configured (HERMES_API_SERVER_KEY is unset)."}:{available:!0});return s.available?{status:"accepted",code:null,reason:null,target:e,policy:t,grant:r}:{status:"blocked",code:"target_unavailable",reason:s.reason,target:e,policy:t,grant:r}}(r,s,l):{status:"blocked",code:"grant_required",reason:`${r.name} needs your approval for edit work.`,target:r,policy:s,grant:null}}function D(e){let t=(0,y.wakeSafetyLimits)(),n=e.rootRequestId?x(e.rootRequestId):0;return{safety_version:y.WAKE_SAFETY_VERSION,root_principal:e.rootPrincipal,wake_depth:e.wakeDepth,grant_rule:e.grant?.rule??null,grant_id:e.grant?.id??null,root_budget:{used:n+ +!!e.counting,limit:t.rootBudget},safety_limits:{max_wake_depth:t.maxWakeDepth,root_budget:t.rootBudget}}}function O(e,t,n,r,i){return{principalType:"agent_principal",principal:{kind:"bot",id:n},decision:"accepted"===e.status?"allowed":"blocked",reasonCode:e.code,grantRule:e.grant?.rule??null,grantId:e.grant?.id??null,wakeId:t,snapshot:r,now:i}}function L(e,t,r,i){let a=e.parent_request_id?n.engine.getWorkRequest(e.parent_request_id)??null:null;if(!a)throw new v("invalid_input","A Wake creates work only in a tracked lineage.");let o=D({rootPrincipal:{kind:a.root_principal_kind??"unknown",id:a.root_principal_id??"unknown"},wakeDepth:a.wake_depth+1,grant:r.grant,rootRequestId:a.root_request_id,counting:!0}),{request:s}=n.engine.createOrGetWorkRequest({sourceConversationId:e.source_conversation_id,sourceEventId:e.source_event_id,requester:{kind:"bot",id:e.requester_agent_id},targetAgentId:r.target.id,intent:t.objective,executionKind:r.policy.execution_kind,toolProfile:r.policy.tool_profile,idempotencyKey:e.idempotency_key,parentRequestId:e.parent_request_id,wakeEventId:e.id,policy:{source:"wake",wake_version:1,wake_syntax:e.syntax,root_wake_id:e.root_wake_id,requested_target:t.target,target_name_snapshot:r.target.name,context_work_requests:t.contextWorkRequests??[],resume_work_request:t.resumeWorkRequest??null,limits:t.limits??{},return_to:{agent_id:e.requester_agent_id,conversation_id:e.source_conversation_id}},executionPolicy:r.policy,initialState:"blocked"===r.status?"blocked":"queued",stateReason:"blocked"===r.status?`${r.code}: ${r.reason}`:null,safetySnapshot:o,safety:O(r,e.id,e.requester_agent_id,o,i),now:i});return"grant_required"===r.code&&$(s,e.id,i),s}function $(e,t,r){n.engine.appendEvent(e.id,{type:"grant_requested",data:{wake_id:t,caller_agent_id:e.requester_id,target_agent_id:e.target_agent_id,authority:"edit",execution_kind:e.execution_kind},now:r})}function W(e){if("string"!=typeof e.sourceEventId||!e.sourceEventId.trim())throw new v("invalid_input","sourceEventId is required.");return n.default.transaction(()=>{let r=n.default.prepare("SELECT * FROM messages WHERE id = ?").get(e.sourceEventId);if(!r)throw new v("source_not_found",`No conversation event ${e.sourceEventId}.`);if("bot"!==r.sender_type||!r.sender_id||!n.bots.getById(r.sender_id))throw new v("invalid_input","Wakes are routed only from an Agent message.");let i=null;if(e.parentRequestId){if(!(i=n.engine.getWorkRequest(e.parentRequestId)??null))throw new v("not_found",`No parent Work Request ${e.parentRequestId}.`);if(i.target_agent_id!==r.sender_id||i.source_conversation_id!==r.conversation_id)throw new v("parent_mismatch","The parent Work Request was not run by this Agent in this conversation.")}let a=e.now??Date.now();return(function(e){let t=[],n=0,r=(n,r)=>{var i;let a;for(let o of(i=e.slice(n,r),(a=[...i.matchAll(w)]).map((e,t)=>{let r=t+1<a.length?a[t+1].index:i.length,o=i.slice(e.index,r);return{at:n+e.index,raw:o.trim(),target:e[1],message:o.slice(e[0].length).trim()}}))){let e="GROUP"===o.target.toUpperCase()?{ok:!1,reason:"group wakes are not supported; wake one Agent by name"}:0===o.message.length?{ok:!1,reason:"objective must be non-empty (max 20000 characters)"}:h({version:1,target:o.target,executionKind:"conversation",objective:o.message});t.push({at:o.at,syntax:"legacy",raw:o.raw,validation:e})}};for(let i of e.matchAll(k)){let e,a=i.index;r(n,a);try{e=h(JSON.parse(i[1]))}catch{e={ok:!1,reason:"block is not valid JSON"}}t.push({at:a,syntax:"structured",raw:i[0],validation:e}),n=a+i[0].length}return r(n,e.length),t.sort((e,t)=>e.at-t.at).map((e,t)=>({position:t,syntax:e.syntax,raw:e.raw,validation:e.validation}))})(r.content).map(e=>(function(e,r,i,a,o){var s;let d,l,u=(s=r.id,l=(0,t.createHash)("sha256").update(E(e)).digest("hex").slice(0,32),`wake:v1:${s}:${e.position}:${l}`),c=q.get(u);if(c)return b(c,!1);if(A.get(r.id,e.position))throw new v("idempotency_conflict",`Wake ${e.position} of event ${r.id} was already recorded with a different payload.`);let _=(0,t.randomUUID)(),p=a?.wake_event_id?R(a.wake_event_id):void 0,f={id:_,idempotency_key:u,source_conversation_id:r.conversation_id,source_event_id:r.id,requester_agent_id:i,parent_request_id:a?.id??null,root_wake_id:p?.root_wake_id??_,syntax:e.syntax},g=null;if(e.validation.ok)if(a){let t=function(e,t,r){for(let i of[...e.contextWorkRequests??[],...e.resumeWorkRequest?[e.resumeWorkRequest]:[]]){let e=n.engine.getWorkRequest(i);if(!(e&&(r?e.root_request_id===r.root_request_id:e.source_conversation_id===t)))return`Work Request ${i} is not in this conversation lineage.`}return null}(g=e.validation.envelope,r.conversation_id,a);d=t?{status:"rejected",code:"invalid_reference",reason:t}:function(e){let{maxWakeDepth:t}=(0,y.wakeSafetyLimits)(),n=e.wake_depth+1;return n>t?{status:"rejected",code:"depth_exceeded",limit:t,observed:n,reason:`This work is already ${e.wake_depth} Wakes deep (limit ${t}).`}:T(e.root_request_id)}(a)??C(g,e.syntax,{agentId:i,parent:a})}else g=e.validation.envelope,d={status:"rejected",code:"untracked_lineage",reason:"Its source turn is not tracked work, so the Wake cannot start a lineage."};else d={status:"rejected",code:"invalid_envelope",reason:e.validation.reason};let m=g&&S(d)?L(f,g,d,o):null;return n.default.prepare(`
2
- INSERT INTO wakes (
3
- id, idempotency_key, source_conversation_id, source_event_id, position, syntax, payload,
4
- requester_agent_id, requested_target, target_agent_id, target_name_snapshot, execution_kind,
5
- parent_request_id, root_request_id, root_wake_id, depth, status, reason_code, reason,
6
- work_request_id, limit_value, observed_value, created_at, updated_at
7
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
8
- `).run(_,u,r.conversation_id,r.id,e.position,e.syntax,E(e),i,g?.target??null,d.target?.id??null,d.target?.name??null,g?.executionKind??null,a?.id??null,m?.root_request_id??a?.root_request_id??null,f.root_wake_id,m?.wake_depth??(a?a.wake_depth+1:0),d.status,d.code,d.reason,m?.id??null,S(d)?null:d.limit??null,S(d)?null:d.observed??null,o,o),b(R(_),!0)})(e,r,r.sender_id,i,a))}).immediate()}function M(e,t=Date.now()){return n.default.transaction(()=>{let r=R(e);if(!r)throw new v("not_found",`No Wake ${e}.`);if("unavailable"!==r.status&&"blocked"!==r.status||"grant_denied"===r.reason_code)return b(r,!1);let i=JSON.parse(r.payload).envelope,a=n.default.prepare(`
9
- UPDATE wakes SET status = ?, reason_code = ?, reason = ?, target_agent_id = ?, target_name_snapshot = ?,
10
- work_request_id = ?, root_request_id = ?, limit_value = ?, observed_value = ?, updated_at = ?
11
- WHERE id = ?
12
- `),o=r.parent_request_id?n.engine.getWorkRequest(r.parent_request_id)??null:null,s={agentId:r.requester_agent_id,parent:o};if("unavailable"===r.status){let e=o?T(o.root_request_id)??C(i,r.syntax,s):{status:"rejected",code:"untracked_lineage",reason:"Its source turn is not tracked work, so the Wake cannot start a lineage."};if(!S(e))return(e.status!==r.status||e.code!==r.reason_code||e.reason!==r.reason)&&a.run(e.status,e.code,e.reason,null,null,null,r.root_request_id,e.limit??null,e.observed??null,t,r.id),b(R(r.id),!1);let n=L(r,i,e,t);return a.run(e.status,e.code,e.reason,e.target.id,e.target.name,n.id,n.root_request_id,null,null,t,r.id),b(R(r.id),!0)}let d=n.engine.getWorkRequest(r.work_request_id),l=n.bots.getById(d.target_agent_id);if(!l||"blocked"!==d.state)return b(r,!1);let u=N(i,r.syntax,{id:l.id,name:l.name},s);return F(r,d,u,"target_available",t)}).immediate()}function F(e,t,r,i,a){let o=n.default.prepare("UPDATE wakes SET status = ?, reason_code = ?, reason = ?, updated_at = ? WHERE id = ?");if("blocked"===r.status){var s,d;if(r.code===e.reason_code&&r.reason===e.reason)return b(e,!1);o.run("blocked",r.code,r.reason,a,e.id);let i=D({rootPrincipal:{kind:t.root_principal_kind??"unknown",id:t.root_principal_id??"unknown"},wakeDepth:t.wake_depth,grant:r.grant,rootRequestId:null,counting:!1});return n.engine.recordSafetyDecision(t.id,O(r,e.id,e.requester_agent_id,i,a)),"grant_required"===r.code&&$(t,e.id,a),s=r.code,d=r.reason,n.engine.reblockWorkRequest(t.id,{reason:`${s}: ${d}`,type:"wake_reblocked",data:{reason_code:s,reason:d},now:a}),b(R(e.id),!1)}if("accepted"!==r.status)return b(e,!1);let l=D({rootPrincipal:{kind:t.root_principal_kind??"unknown",id:t.root_principal_id??"unknown"},wakeDepth:t.wake_depth,grant:r.grant,rootRequestId:null,counting:!1});return n.engine.recordSafetyDecision(t.id,O(r,e.id,e.requester_agent_id,l,a)),n.engine.transitionWorkRequest(t.id,{from:"blocked",to:"queued",reason:i,data:{grant_rule:r.grant?.rule??null,grant_id:r.grant?.id??null},now:a}),o.run("accepted",null,null,a,e.id),b(R(e.id),!0)}function H(e){if((0,y.assertOwner)(e.caller.category),"allow"!==e.decision&&"deny"!==e.decision)throw new v("invalid_input","decision must be allow or deny.");let t=e.now??Date.now();return n.default.transaction(()=>{let r=R(e.wakeId);if(!r)throw new y.WakeSafetyError("not_found",`No Wake ${e.wakeId}.`);let i=r.work_request_id?n.engine.getWorkRequest(r.work_request_id):void 0,a=(t,n)=>({...t,decision:e.decision,grant:n,runnable:t.request?.state==="queued",ended:t.request?.terminal_at!==null&&t.request?.terminal_at!==void 0});if("blocked"!==r.status||"grant_required"!==r.reason_code||!i||"blocked"!==i.state){let t=i?(0,y.activeEditGrant)(r.requester_agent_id,i.target_agent_id)??null:null;if("deny"===e.decision&&"grant_denied"===r.reason_code)return{...a(b(r,!1),null),runnable:!1};if("allow"===e.decision&&t&&"grant_denied"!==r.reason_code)return{...a(b(r,!1),t),runnable:!1};throw new y.WakeSafetyError("not_pending","This Wake is not waiting for an owner grant decision.")}let o={kind:e.caller.principal.kind,id:e.caller.principal.id};if("deny"===e.decision)return n.default.prepare("UPDATE wakes SET reason_code = 'grant_denied', reason = ?, updated_at = ? WHERE id = ?").run("The owner denied this edit Wake.",t,r.id),n.engine.appendEvent(i.id,{type:"grant_denied",data:{wake_id:r.id,caller_agent_id:r.requester_agent_id,target_agent_id:i.target_agent_id,authority:"edit",decided_by:o},now:t}),n.engine.recordSafetyDecision(i.id,{principalType:"human_owner",principal:o,decision:"denied",reasonCode:"grant_denied",wakeId:r.id,snapshot:{safety_version:y.WAKE_SAFETY_VERSION,decision:"deny",decided_by:o},now:t}),n.engine.transitionWorkRequest(i.id,{from:"blocked",to:"cancelled",reason:"grant_denied",expectedVersion:i.version,errorCode:"grant_denied",errorMessage:"The owner denied this edit Wake; no work ran.",now:t}),a(b(R(r.id),!1),null);let{grant:s}=(0,y.ensureEditGrant)({callerAgentId:r.requester_agent_id,targetAgentId:i.target_agent_id,grantedBy:o,sourceWakeId:r.id,now:t});n.engine.appendEvent(i.id,{type:"grant_approved",data:{wake_id:r.id,grant_id:s.id,caller_agent_id:s.caller_agent_id,target_agent_id:s.target_agent_id,authority:"edit",decided_by:o},now:t});let d=JSON.parse(r.payload).envelope,l=n.bots.getById(i.target_agent_id),u=r.parent_request_id?n.engine.getWorkRequest(r.parent_request_id)??null:null,c=N(d,r.syntax,{id:l.id,name:l.name},{agentId:r.requester_agent_id,parent:u});return a(F(r,i,c,"grant_approved",t),s)}).immediate()}e.s(["WakeRouterError",0,v,"decideWakeGrant",0,H,"retryWake",0,M,"routeAgentWakes",0,W],17834);var U=e.i(9346);let j=new Set(["version","decision","implementationAttemptId","reviewAttemptId","commitMessage"]);function P(e){return"string"==typeof e&&e.trim().length>0&&e.length<=160}let z=/```botmancers-finalize[^\S\r\n]*\r?\n([\s\S]*?)```/g;function B(e){return(0,t.createHash)("sha256").update(e).digest("hex")}function G(e){try{let t=JSON.parse(e.policy_snapshot);return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}catch{return{}}}let K=["implementation","revision"];function J(e){return n.default.prepare("SELECT * FROM work_attempts WHERE request_id = ? ORDER BY attempt_number DESC LIMIT 1").get(e)}function V(e){return n.default.prepare("SELECT * FROM candidate_manifests WHERE attempt_id = ?").get(e)}function X(e){return n.default.prepare("SELECT * FROM finalizations WHERE id = ?").get(e)}function Y(e){return JSON.parse(e.files)}function Z(e,t,r=Date.now()){let i=n.engine.getAttempt(e);if(!i?.external_run_id)return!1;let a=n.default.prepare("SELECT baseline_ref, baseline_digest FROM attempt_finalization_baselines WHERE attempt_id = ?").get(e);return a?a.baseline_ref===t.baselineRef&&a.baseline_digest===t.baselineDigest:(n.default.prepare(`
13
- INSERT OR IGNORE INTO attempt_finalization_baselines (attempt_id, request_id, external_run_id, baseline_ref, baseline_digest, created_at)
14
- VALUES (?, ?, ?, ?, ?, ?)
15
- `).run(e,i.request_id,i.external_run_id,t.baselineRef,t.baselineDigest,r),!0)}function Q(e,r,i,a=Date.now()){let o=i.finalization;if(!o||!r.external_run_id||!K.includes(e.execution_kind)||"edit"!==e.tool_profile)return;if(o.baselineRef&&o.baselineDigest&&!Z(r.id,{baselineRef:o.baselineRef,baselineDigest:o.baselineDigest},a))return void n.engine.appendEvent(e.id,{type:"candidate_manifest_unavailable",attemptId:r.id,data:{external_run_id:r.external_run_id,reason_code:"BASELINE_MISMATCH",reason:"The terminal baseline did not match the baseline captured at launch."},now:a});let s=o.candidate;if(!s)return;if(!s.ok)return void n.engine.appendEvent(e.id,{type:"candidate_manifest_unavailable",attemptId:r.id,data:{external_run_id:r.external_run_id,reason_code:s.code,reason:s.message.slice(0,300)},now:a});let d=s.manifest;if(V(r.id))return;let l=(0,t.randomUUID)();n.default.prepare(`
16
- INSERT INTO candidate_manifests (
17
- id, attempt_id, request_id, conversation_id, external_run_id, baseline_ref, baseline_digest,
18
- base_commit, manifest_digest, files, file_count, created_at
19
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
20
- `).run(l,r.id,e.id,e.source_conversation_id,r.external_run_id,d.baselineRef,d.baselineDigest,d.baseCommit,d.manifestDigest,JSON.stringify(d.files),d.files.length,a),n.engine.appendEvent(e.id,{type:"candidate_manifest_recorded",attemptId:r.id,data:{manifest_id:l,external_run_id:r.external_run_id,baseline_ref:d.baselineRef,baseline_digest:d.baselineDigest,base_commit:d.baseCommit,manifest_digest:d.manifestDigest,file_count:d.files.length},now:a})}function ee(e,t,n,r){return`botmancers-finalize-v1-${B([e,t,n,r].join(":")).slice(0,48)}`}function et(e,t){return{finalization_id:e.id,decision_event_id:e.decision_event_id,coordinator_agent_id:e.coordinator_agent_id,implementation_request_id:e.implementation_request_id,implementation_attempt_id:e.implementation_attempt_id,review_request_id:e.review_request_id,review_attempt_id:e.review_attempt_id,external_run_id:e.external_run_id,manifest_id:e.manifest_id,manifest_digest:t?.manifest_digest??null,baseline_digest:t?.baseline_digest??null,base_commit:t?.base_commit??null,file_count:t?.file_count??null}}let en=new Set(["BASE_MISMATCH","INDEX_DIRTY","BASELINE_MISMATCH","PATH_INVALID","PATH_UNEXPECTED","DIGEST_MISMATCH","IDEMPOTENCY_CONFLICT","GIT_LOCK_CONFLICT","REF_RACE","FINALIZATION_NOT_PREPARED","RUN_NOT_TERMINAL","FINALIZATION_INVALID","RUN_NOT_FOUND"]);function er(e,t,r,i){return n.engine.transaction(()=>{let a=n.default.prepare(`
21
- UPDATE finalizations SET state = ?, reason_code = ?, reason = ?, commit_id = ?, tree_id = ?, parent_commit = ?,
22
- result_manifest_digest = ?, file_count = ?, updated_at = ?, finished_at = ?
23
- WHERE id = ? AND finished_at IS NULL
24
- `).run(t,r.reasonCode??null,r.reason?.slice(0,300)??null,r.commit??null,r.tree??null,r.parent??null,r.manifestDigest??null,r.fileCount??null,i,i,e.id),o=X(e.id);if(1!==a.changes)return o;let s=n.default.prepare("SELECT * FROM candidate_manifests WHERE id = ?").get(e.manifest_id);return n.engine.appendEvent(e.implementation_request_id,{type:`finalization_${t}`,attemptId:e.implementation_attempt_id,data:{...et(o,s),reason_code:o.reason_code,reason:o.reason,commit:o.commit_id,tree:o.tree_id,parent:o.parent_commit,result_manifest_digest:o.result_manifest_digest},now:i}),o})}function ei(e,t=!1){if(!(e instanceof U.AgentDeckApiError))return{state:t?null:"failed",reasonCode:"finalization_failed",reason:"The finalization outcome is unknown; retrying with the same idempotency key is safe."};if("agent_deck_unreachable"===e.code||t&&"agent_deck_invalid_response"===e.code)return{state:null,reasonCode:e.code,reason:e.message};if("agent_deck_rejected"!==e.code)return{state:"failed",reasonCode:e.code,reason:e.message};let n=e.deckCode??"";return"FINALIZATION_CANCELED"===n?{state:"canceled",reasonCode:n.toLowerCase(),reason:e.message}:en.has(n)?{state:"blocked",reasonCode:n.toLowerCase(),reason:e.message}:t&&(!n||null!==e.status&&e.status>=500)?{state:null,reasonCode:n?n.toLowerCase():"finalization_failed",reason:"The finalization outcome is unknown; retrying with the same idempotency key is safe."}:{state:"failed",reasonCode:n?n.toLowerCase():"finalization_failed",reason:e.message}}function ea(e,t,r,i){return n.engine.appendEvent(e.implementation_request_id,{type:"finalization_retry_pending",attemptId:e.implementation_attempt_id,data:{finalization_id:e.id,external_run_id:e.external_run_id,reason_code:t,reason:r},now:i}),X(e.id)}async function eo(e){let t=X(e);if(!t||"preparing"!==t.state)return t;if(!(0,U.hasAgentDeckRunToken)())return er(t,"failed",{reasonCode:"agent_deck_token_missing",reason:U.AGENT_DECK_API_MESSAGES.agent_deck_token_missing},Date.now());let r=JSON.parse(t.request_body),i=n.default.prepare("SELECT * FROM candidate_manifests WHERE id = ?").get(t.manifest_id);if(null===t.submitted_at){try{var a,o;let e=await (0,U.getAgentDeckRunChanges)(t.external_run_id);if(e.manifestDigest!==i.manifest_digest||e.baselineDigest!==i.baseline_digest||e.baseCommit!==i.base_commit||(a=e.files,o=r.files,JSON.stringify(a)!==JSON.stringify(o)))return er(t,"blocked",{reasonCode:"manifest_changed",reason:`The workspace changed after review (candidate manifest ${e.manifestDigest}, reviewed ${i.manifest_digest}); nothing was committed.`},Date.now())}catch(n){let e=ei(n);if(!e.state)return ea(t,e.reasonCode,e.reason,Date.now());return er(t,e.state,{reasonCode:e.reasonCode,reason:e.reason},Date.now())}n.default.prepare("UPDATE finalizations SET submitted_at = ?, updated_at = ? WHERE id = ? AND submitted_at IS NULL AND finished_at IS NULL").run(Date.now(),Date.now(),t.id),t=X(e)}try{let e=await (0,U.finalizeAgentDeckRun)(t.external_run_id,r,t.idempotency_key);if(e.manifestDigest!==i.manifest_digest||void 0!==e.fileCount&&e.fileCount!==i.file_count||void 0!==e.reviewId&&e.reviewId!==t.review_request_id||void 0!==e.parent&&e.parent!==i.base_commit)return er(t,"failed",{reasonCode:"agent_deck_invalid_response",reason:"Agent Deck returned commit evidence that does not match the persisted finalization request."},Date.now());return er(t,"committed",{commit:e.commit,tree:e.tree,parent:e.parent??i.base_commit,manifestDigest:e.manifestDigest,fileCount:e.fileCount??i.file_count},Date.now())}catch(n){let e=ei(n,!0);if(!e.state)return ea(t,e.reasonCode,e.reason,Date.now());return er(t,e.state,{reasonCode:e.reasonCode,reason:e.reason},Date.now())}}function es(){return n.default.prepare("SELECT id FROM finalizations WHERE state = 'preparing' ORDER BY created_at ASC, id ASC").all().map(e=>e.id)}(0,y.wakeSafetyLimits)().maxContinuations;let ed={kind:"service",id:"botmancers-engine"},el="Botmancers";function eu(e){try{let t=JSON.parse(e.policy_snapshot);return t&&"object"==typeof t&&!Array.isArray(t)?t:{}}catch{return{}}}function ec(e){return n.bots.getById(e)?.name??`agent:${e}`}function e_(e){let t;if("completed"!==e.state||!e.result)return null;try{t=JSON.parse(e.result).reply_message_id}catch{return null}if("string"!=typeof t)return null;let r=n.default.prepare("SELECT * FROM messages WHERE id = ?").get(t);return r&&"bot"===r.sender_type&&r.sender_id===e.target_agent_id?r:null}function ep(e,t=!1){let r=n.engine.listAttempts(e.id),i=r.length>0?r[r.length-1]:null,a=[`Work Request: ${e.id}`,...i?[`Attempt: ${i.id}`]:[],`Agent: ${ec(e.target_agent_id)}`,`Execution kind: ${e.execution_kind}`,`State: ${e.state}`],o=e_(e);if(o){var s;a.push(t?`Result: the ${ec(e.target_agent_id)} reply above.`:`Result:
25
- ${(s=o.content).length>8e3?`${s.slice(0,8e3)}
26
- [truncated]`:s}`)}else"failed"===e.state||"cancelled"===e.state?a.push(`Failure: ${e.error_code??e.state}${e.error_message?` - ${e.error_message}`:""}`):null===e.terminal_at&&a.push("Result: not finished yet.");let d=function(e){if(!K.includes(e.execution_kind))return null;let t=J(e.id);if(!t)return null;let r=V(t.id);if(r){let e=Y(r),t=e.slice(0,50).map(e=>`- ${e.path} ${e.sha256?`sha256=${e.sha256} mode=${e.mode}`:"deleted"}`);return e.length>50&&t.push(`- ... ${e.length-50} more`),[`Candidate manifest: ${r.manifest_digest} (${e.length} ${1===e.length?"file":"files"}, base commit ${r.base_commit}, baseline ${r.baseline_digest})`,...t].join("\n")}let i=n.default.prepare("SELECT data FROM engine_events WHERE request_id = ? AND attempt_id = ? AND type = 'candidate_manifest_unavailable' ORDER BY sequence DESC LIMIT 1").get(e.id,t.id);if(i){let e=JSON.parse(i.data);return`Candidate manifest: unavailable (${e.reason_code??"unknown"}); this work cannot be finalized.`}return null}(e);return d&&a.push(d),a.join("\n")}let ef='You coordinate this work. Decide the next step yourself: reply to the person, ask a question, or emit a botmancers-wake block (one per Agent). Reference earlier work with "contextWorkRequests"; a revision names the implementation it resumes in "resumeWorkRequest". Never report a review that did not run.',eg=n.default.prepare("SELECT * FROM work_requests WHERE requester_kind = ? AND requester_id = ? AND idempotency_key = ?");function em(e){let t=eg.get(ed.kind,ed.id,e.key);if(t)return t;if(!n.bots.getById(e.coordinatorId)||!n.default.prepare("SELECT 1 FROM conversations WHERE id = ?").get(e.conversationId))return null;let r=n.default.prepare("SELECT COUNT(*) AS n FROM work_requests WHERE root_request_id = ? AND requester_kind = ? AND requester_id = ?").get(e.parent.root_request_id,ed.kind,ed.id),i=(0,y.wakeSafetyLimits)().maxContinuations;if(r.n>=i)return n.default.prepare("SELECT 1 FROM engine_events WHERE request_id = ? AND type = 'lineage_stopped'").get(e.parent.id)||n.engine.appendEvent(e.parent.id,{type:"lineage_stopped",data:{reason:"continuation_budget_exhausted",limit:i,observed:r.n,continues:e.continues,coordinator_agent_id:e.coordinatorId},now:e.now}),null;let a=(0,d.selectExecutionPolicy)({entryPoint:"continuation",executionKind:"conversation"});if(!a.ok)return null;let o="result"===e.continues?Math.max(e.parent.wake_depth-1,0):e.parent.wake_depth,s={safety_version:y.WAKE_SAFETY_VERSION,root_principal:{kind:e.parent.root_principal_kind??"unknown",id:e.parent.root_principal_id??"unknown"},wake_depth:o,grant_rule:"readonly_default",grant_id:null,continuations:{used:r.n+1,limit:i}};return n.engine.createOrGetWorkRequest({sourceConversationId:e.conversationId,sourceEventId:e.sourceEventId,requester:ed,targetAgentId:e.coordinatorId,intent:e.intent,executionKind:a.policy.execution_kind,toolProfile:a.policy.tool_profile,idempotencyKey:e.key,parentRequestId:e.parent.id,policy:{source:"coordinator_continuation",continues:e.continues,work_requests:e.subjects},executionPolicy:a.policy,wakeDepth:o,safetySnapshot:s,safety:{principalType:"engine",principal:ed,decision:"allowed",grantRule:"readonly_default",snapshot:s,now:e.now},now:e.now}).request}let eh=n.default.prepare("SELECT 1 FROM terminal_followups WHERE request_id = ? AND done_at IS NULL"),ek=n.default.prepare("UPDATE terminal_followups SET done_at = ? WHERE request_id = ? AND done_at IS NULL");function ew(e,r=Date.now()){return n.engine.transaction(()=>{var i;if(!eh.get(e))return[];let a=n.engine.getWorkRequest(e);if(!a||null===a.terminal_at||null!==a.legacy_agent_request_id)return[];ek.run(r,e);let o=[],s=e=>{e&&"queued"===e.state&&o.push(e.id)},d=e_(a);if(d){let e,i,o=[],l=null;try{o=W({sourceEventId:d.id,parentRequestId:a.id,now:r})}catch(e){if(!(e instanceof v))throw e;console.error(`Wakes of ${d.id} could not be routed:`,e.message),l=e}for(let e of o)s(e.request);let u=(function(e,r,i=Date.now()){let a=[...e.content.matchAll(z)].map((e,t)=>{let n;try{n=function(e){if(!e||"object"!=typeof e||Array.isArray(e))return{ok:!1,reason:"decision must be a JSON object"};let t=Object.keys(e).filter(e=>!j.has(e));if(t.length>0)return{ok:!1,reason:`unknown field ${t.join(", ")} (the manifest is never supplied in a decision)`};if(1!==e.version)return{ok:!1,reason:"version must be 1"};if("accept"!==e.decision&&"reject"!==e.decision)return{ok:!1,reason:'decision must be "accept" or "reject"'};if(!P(e.implementationAttemptId))return{ok:!1,reason:"implementationAttemptId must name an Attempt"};if(!P(e.reviewAttemptId))return{ok:!1,reason:"reviewAttemptId must name an Attempt"};let n={version:1,decision:e.decision,implementationAttemptId:e.implementationAttemptId.trim(),reviewAttemptId:e.reviewAttemptId.trim()};if(void 0!==e.commitMessage){if("string"!=typeof e.commitMessage||0===e.commitMessage.trim().length||e.commitMessage.length>2e3||e.commitMessage.includes("\0"))return{ok:!1,reason:"commitMessage must be non-empty text (max 2000 characters)"};n.commitMessage=e.commitMessage.trim()}return{ok:!0,decision:n}}(JSON.parse(e[1]))}catch{n={ok:!1,reason:"block is not valid JSON"}}return{position:t,validation:n}});return 0===a.length?[]:n.engine.transaction(()=>a.map(a=>{let o={position:a.position,finalizationId:null,reasonCode:null,reason:null,implementationRequestId:null,reviewRequestId:null},s=(t,s)=>(n.engine.appendEvent(r.id,{type:"finalization_rejected",data:{decision_event_id:e.id,position:a.position,reason_code:t,reason:s,implementation_request_id:o.implementationRequestId,review_request_id:o.reviewRequestId},now:i}),{...o,reasonCode:t,reason:s});if(!a.validation.ok)return s("invalid_decision",a.validation.reason);let d=a.validation.decision,l=n.engine.getAttempt(d.implementationAttemptId),u=n.engine.getAttempt(d.reviewAttemptId);if(o.implementationRequestId=l?.request_id??null,o.reviewRequestId=u?.request_id??null,"reject"===d.decision)return s("review_rejected","The coordinator rejected the review; nothing was finalized.");let c=function(e,t,r){let i=t.target_agent_id,a=(e,t)=>({ok:!1,code:e,reason:t}),o=n.engine.getAttempt(e.implementationAttemptId),s=o?n.engine.getWorkRequest(o.request_id):void 0;if(!s||!K.includes(s.execution_kind))return a("invalid_implementation",`Attempt ${e.implementationAttemptId} is not an implementation or revision Attempt.`);let d=n.engine.getAttempt(e.reviewAttemptId),l=d?n.engine.getWorkRequest(d.request_id):void 0;if(!l||"review"!==l.execution_kind||"readonly"!==l.tool_profile)return a("invalid_review",`Attempt ${e.reviewAttemptId} is not a readonly review Attempt.`);if(s.source_conversation_id!==r||l.source_conversation_id!==r)return a("cross_conversation","The implementation and review must belong to this conversation.");for(let e of[s,l])if(e.root_request_id!==t.root_request_id||function(e){if(!e.wake_event_id)return null;let t=G(e).return_to;return t&&"string"==typeof t.agent_id?t.agent_id:null}(e)!==i)return a("lineage_mismatch",`Work Request ${e.id} was not woken by this coordinator in this lineage.`);if("completed"!==s.state)return a("implementation_not_completed",`Implementation ${s.id} is ${s.state}, not completed.`);let u=J(s.id);if(!u||u.id!==o?.id||"succeeded"!==u.outcome)return a("implementation_not_completed",`Implementation ${s.id} has no successful Attempt.`);let c=V(u.id);if(!c)return a("not_finalizable",`Implementation ${s.id} has no candidate manifest to finalize.`);let _=G(l).context_work_requests;if(!Array.isArray(_)||!_.includes(s.id))return a("review_not_linked",`Review ${l.id} does not reference implementation ${s.id}.`);if(l.target_agent_id===s.target_agent_id)return a("reviewer_not_independent","The reviewer did the work under review.");let p=J(l.id);if("completed"!==l.state||!p||p.id!==d?.id||"succeeded"!==p.outcome)return a("review_not_completed",`Review ${l.id} did not complete.`);if(l.created_at<=c.created_at)return a("stale_manifest",`Review ${l.id} was requested before the candidate manifest was recorded.`);let f=n.default.prepare(`
27
- SELECT candidate.id FROM work_requests candidate
28
- WHERE root_request_id = ? AND target_agent_id = ? AND execution_kind IN ('implementation', 'revision')
29
- AND id <> ? AND (
30
- created_at > ? OR (created_at = ? AND candidate.rowid > (SELECT rowid FROM work_requests WHERE id = ?))
31
- ) LIMIT 1
32
- `).get(s.root_request_id,s.target_agent_id,s.id,s.created_at,s.created_at,s.id);if(f)return a("stale_manifest",`A later edit (${f.id}) replaced the manifest of ${s.id}.`);let g=n.default.prepare("SELECT id FROM finalizations WHERE implementation_attempt_id = ? AND state IN ('preparing', 'committed') LIMIT 1").get(u.id);return{ok:!0,chain:{implementation:s,implementationAttempt:u,review:l,reviewAttempt:p,manifest:c},existing:g?.id??null}}(d,r,e.conversation_id);if(!c.ok)return s(c.code,c.reason);let _=ee(e.id,c.chain.implementationAttempt.id,c.chain.reviewAttempt.id,c.chain.manifest.manifest_digest),p=n.default.prepare("SELECT id FROM finalizations WHERE idempotency_key = ?").get(_);if(c.existing&&!p)return s("already_finalized",`Implementation ${c.chain.implementation.id} already has a finalization (${c.existing}).`);let{row:f}=function(e,r,i,a,o){var s,d;let l,u,c=ee(a.id,e.implementationAttempt.id,e.reviewAttempt.id,e.manifest.manifest_digest),_=n.default.prepare("SELECT * FROM finalizations WHERE idempotency_key = ?").get(c);if(_)return{row:_,created:!1};let p=JSON.stringify({baselineDigest:e.manifest.baseline_digest,expectedBaseCommit:e.manifest.base_commit,reviewId:e.review.id,commitMessage:(s=e.implementation,d=e.review,l=r.commitMessage??`Botmancers: ${(s.intent.split("\n").find(e=>e.trim())??"reviewed change").trim().slice(0,60)}`,u=`
33
-
34
- Botmancers-Work-Request: ${s.id}
35
- Botmancers-Review: ${d.id}`,`${l.slice(0,4e3-u.length)}${u}`),files:Y(e.manifest)}),f=(0,t.randomUUID)();n.default.prepare(`
36
- INSERT INTO finalizations (
37
- id, idempotency_key, conversation_id, decision_event_id, decision_request_id, coordinator_agent_id,
38
- implementation_request_id, implementation_attempt_id, review_request_id, review_attempt_id,
39
- manifest_id, external_run_id, request_body, request_hash, state, created_at, updated_at
40
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'preparing', ?, ?)
41
- `).run(f,c,a.conversation_id,a.id,i.id,i.target_agent_id,e.implementation.id,e.implementationAttempt.id,e.review.id,e.reviewAttempt.id,e.manifest.id,e.manifest.external_run_id,p,B(p),o,o);let g=X(f);return n.engine.appendEvent(e.implementation.id,{type:"finalization_preparing",attemptId:e.implementationAttempt.id,data:et(g,e.manifest),now:o}),{row:g,created:!0}}(c.chain,d,r,e,i);return{...o,finalizationId:f.id}}))})(d,a,r).filter(e=>null!==e.reasonCode&&"review_rejected"!==e.reasonCode);u.length>0&&s(em({key:`continuation:v1:finalize-decision:${d.id}`,coordinatorId:a.target_agent_id,conversationId:d.conversation_id,sourceEventId:d.id,parent:a,intent:(e=u.map(e=>`- Decision ${e.position+1}: ${e.reasonCode} - ${e.reason}`),[`[Finalization not started] ${1===u.length?"One finalization decision":`${u.length} finalization decisions`} from your last message committed nothing:`,e.join("\n"),ef].join("\n\n")),continues:"finalize_decision",subjects:u.flatMap(e=>e.implementationRequestId?[e.implementationRequestId]:[]),now:r}));let c=o.filter(e=>"rejected"===e.wake.status||"unavailable"===e.wake.status);(l||c.length>0)&&s(em({key:`continuation:v1:wakes:${d.id}`,coordinatorId:a.target_agent_id,conversationId:d.conversation_id,sourceEventId:d.id,parent:a,intent:l?["[Wake not started] The Wakes in your last message could not be routed, so no work started:",l.message,ef].join("\n\n"):(i=c.map(({wake:e})=>{let t=e.target_name_snapshot??e.requested_target??"an unnamed target",n=e.execution_kind??"unknown",r="blocked"===e.status?"is waiting (blocked)":`was ${e.status}`;return`- Wake ${e.position+1} (${n}) to ${t} ${r}: ${e.reason??e.reason_code??"no reason recorded"}`+(e.work_request_id?` Work Request: ${e.work_request_id}.`:" No Work Request was created.")}),[`[Wake not started] ${1===c.length?"One Wake":`${c.length} Wakes`} from your last message did not start any work:`,i.join("\n"),ef].join("\n\n")),continues:"wake_outcome",subjects:c.flatMap(e=>e.wake.work_request_id?[e.wake.work_request_id]:[]),now:r}))}let l=function(e){if(!e.wake_event_id)return null;let t=eu(e).return_to;return t&&"string"==typeof t.agent_id&&"string"==typeof t.conversation_id?{agentId:t.agent_id,conversationId:t.conversation_id}:null}(a);return l&&s(em({key:`continuation:v1:result:${a.id}`,coordinatorId:l.agentId,conversationId:l.conversationId,sourceEventId:d?.id??a.source_event_id,parent:a,intent:(i=d?.conversation_id===l.conversationId,[`[Work Request result] ${ec(a.target_agent_id)} finished the ${a.execution_kind} you requested.`,ep(a,i),..."review"===a.execution_kind&&"completed"===a.state?['If this review satisfies you and the implementation has a candidate manifest, you may commit it by emitting a botmancers-finalize block: {"version": 1, "decision": "accept", "implementationAttemptId": "<id>", "reviewAttemptId": "<id>", "commitMessage": "<optional>"}, or "decision": "reject". Botmancers commits exactly the reviewed manifest; never list files or digests.']:[],ef].join("\n\n")),continues:"result",subjects:[a.id],now:r})),o})}var eE=e.i(11626);let ey=Object.freeze({kind:"service",id:"botmancers-exchanges"}),ev=["ask","continue"],eI={invalid_request:400,authority_not_allowed:403,recursive_exchange:403,conversation_not_found:404,agent_not_found:404,session_not_found:404,session_ended:409,session_not_resumable:409,source_session_busy:409,agent_unavailable:409,destination_invalid:400,idempotency_conflict:409,exchange_not_found:404,exchange_terminal:409,invalid_transition:409};class eq extends Error{code;constructor(e,t){super(t),this.name="ExchangeError",this.code=e}get status(){return eI[this.code]}}let eA=["decisions","constraints","artifacts","open_questions"];function eR(e){return"string"==typeof e&&e.trim().length>0}function eb(e,...t){return t.reduce((e,t)=>t?e.split(t).join("[redacted session id]"):e,e)}let eS="\n[truncated]";function ex(e,t){return e.length<=t?{content:e,truncated:!1}:t<=eS.length?{content:e.slice(0,t),truncated:!0}:{content:`${e.slice(0,t-eS.length)}${eS}`,truncated:!0}}let eT="This is a read-only turn: do not edit files, change state, start other work, or emit Wakes.";function eC(e,t){return`${e}:
42
- ${t.length>0?t.map(e=>`- ${e}`).join("\n"):"(none)"}`}function eN(e){let t;if(e.requester_kind!==ey.kind||e.requester_id!==ey.id)return null;try{t=JSON.parse(e.policy_snapshot)}catch{return null}return t&&"session_exchange"===t.source&&"string"==typeof t.exchange_id&&("ask"===t.hop||"extract"===t.hop||"deliver"===t.hop)?{exchangeId:t.exchange_id,hop:t.hop,resumeBindingId:"string"==typeof t.resume_session_binding?t.resume_session_binding:null}:null}function eD(e,n){let r=e.prepare("SELECT * FROM session_exchanges WHERE id = ?"),i=e.prepare("SELECT * FROM session_exchanges WHERE requester_kind = ? AND requester_id = ? AND idempotency_key = ?"),o=e.prepare("SELECT * FROM session_exchanges WHERE source_request_id = ? OR destination_request_id = ?"),s=e.prepare("SELECT * FROM session_bindings WHERE id = ?"),l=e.prepare("SELECT * FROM bots WHERE id = ?"),c=e.prepare(`
43
- INSERT INTO session_exchange_events (id, exchange_id, sequence, type, data, created_at)
44
- SELECT ?, ?, COALESCE(MAX(sequence), 0) + 1, ?, ?, ? FROM session_exchange_events WHERE exchange_id = ?
45
- `);function _(e){let t=r.get(e);if(!t)throw new eq("exchange_not_found",`No exchange ${e}.`);return t}function p(e,n,r,i){c.run((0,t.randomUUID)(),e,n,null==r?null:JSON.stringify(r),i,e)}function f(e){return e?l.get(e)?.name??null:null}function g(e){return a.EXCHANGE_TERMINAL_STATES.includes(e)}function m(t,n,r,i={}){if(!a.EXCHANGE_TRANSITIONS[t.state].includes(n))throw new eq("invalid_transition",`Cannot move an exchange from ${t.state} to ${n}.`);let o=g(n);if(1!==e.prepare(`
46
- UPDATE session_exchanges SET state = ?, version = version + 1, updated_at = ?, terminal_at = ?,
47
- failure_code = ?, failure_message = ?
48
- WHERE id = ? AND state = ? AND version = ?
49
- `).run(n,r,o?r:null,"failed"===n?i.failureCode??"failed":t.failure_code,"failed"===n?i.failureMessage??"The exchange failed.":t.failure_message,t.id,t.state,t.version).changes)throw new eq("invalid_transition",`Exchange ${t.id} changed concurrently.`);return p(t.id,"state_changed",{from:t.state,to:n,reason:i.reason??null,..."failed"===n?{failure_code:i.failureCode??"failed"}:{}},r),_(t.id)}function h(t,n,r){let i=Object.keys(n);if(0===i.length)return t;if(1!==e.prepare(`UPDATE session_exchanges SET ${i.map(e=>`${e} = ?`).join(", ")}, version = version + 1, updated_at = ? WHERE id = ? AND version = ?`).run(...i.map(e=>n[e]??null),r,t.id,t.version).changes)throw new eq("invalid_transition",`Exchange ${t.id} changed concurrently.`);return _(t.id)}function k(e,t,r){let i,o={kind:e.requester_kind,id:e.requester_id},s=`exchange:${e.id}:${t}`;if(r.intent.length>a.EXCHANGE_LIMITS.promptChars)throw new eq("invalid_request",`The ${t} prompt exceeds ${a.EXCHANGE_LIMITS.promptChars} characters.`);return n.createOrGetWorkRequest({sourceConversationId:r.conversationId,sourceEventId:s,requester:ey,targetAgentId:r.targetAgentId,intent:r.intent,executionKind:"conversation",toolProfile:"readonly",idempotencyKey:s,parentRequestId:r.parentRequestId,policy:{source:"session_exchange",exchange_id:e.id,hop:t,...r.resumeBindingId?{resume_session_binding:r.resumeBindingId}:{}},executionPolicy:function(){let e=(0,d.selectExecutionPolicy)({entryPoint:"exchange",executionKind:"conversation"});if(!e.ok)throw Error(e.reason);return e.policy}(),rootPrincipal:o,retryPolicy:{...eE.DEFAULT_RETRY_POLICY},...{safetySnapshot:i={safety_version:y.WAKE_SAFETY_VERSION,root_principal:{kind:o.kind,id:o.id},grant_rule:"readonly_default",grant_id:null,exchange:!0},safety:{principalType:"service"===o.kind?"api_principal":"human_owner",principal:o,decision:"allowed",grantRule:"readonly_default",snapshot:i}},now:r.now}).request}function w(e,t){let n=l.get(e);if(!n)throw new eq("agent_not_found",`No ${t} Agent ${e}.`);let r=(0,u.resolveAgent)(n);if(!r.launchable)throw new eq("agent_unavailable",`The ${t} Agent ${n.name} has no Agent Deck selected.`);return{id:n.id,name:n.name,agent:r.agent}}function E(t,n,r){if(!e.prepare("SELECT 1 FROM conversations WHERE id = ?").get(t)||!e.prepare("SELECT 1 FROM conversation_participants WHERE conversation_id = ? AND participant_kind = ? AND participant_id = ?").get(t,n.kind,n.id))throw new eq("conversation_not_found",`No ${r} conversation ${t} is visible to the owner.`)}let v={create(r){var o;if(!r.requester||!eR(r.requester.id)||!["person","bot","service"].includes(r.requester.kind))throw new eq("invalid_request","A requester principal is required.");let u="service"===r.requester.kind&&!0===r.serviceGrant&&r.requester.id!==ey.id;if("person"!==r.requester.kind&&!u)throw new eq("recursive_exchange","Exchanges are started by the owner; an Agent or exchange hop cannot start another exchange.");if(!eR(r.idempotencyKey)||r.idempotencyKey.length>200)throw new eq("invalid_request","An idempotency key (1-200 characters) is required.");if(!ev.includes(r.mode))throw new eq("invalid_request",'mode must be "ask" or "continue".');if(!eR(r.originConversationId))throw new eq("invalid_request","origin_conversation_id is required.");if(!eR(r.sourceAgentId))throw new eq("invalid_request","source.agent_id is required.");if(!eR(r.sessionRef))throw new eq("invalid_request","source.session_ref is required.");if(!eR(r.instruction))throw new eq("invalid_request","instruction is required.");if(r.instruction.length>a.EXCHANGE_LIMITS.instructionChars)throw new eq("invalid_request",`instruction exceeds ${a.EXCHANGE_LIMITS.instructionChars} characters.`);if(void 0!==r.executionKind){let e=(0,d.selectExecutionPolicy)({entryPoint:"exchange",executionKind:r.executionKind});if(!e.ok)throw new eq("authority_not_allowed",`${e.reason} An exchange never requests edit authority.`)}if("ask"===r.mode&&(null!=r.destinationAgentId||null!=r.destinationConversationId))throw new eq("destination_invalid","An Ask returns to the origin conversation and takes no destination.");if("continue"===r.mode){if(!eR(r.destinationAgentId))throw new eq("destination_invalid","A Continue names destination.agent_id.");if(r.destinationAgentId===r.sourceAgentId)throw new eq("destination_invalid","A Continue hands off to another Agent; the destination cannot be the source Agent.");if(null!=r.destinationConversationId&&!eR(r.destinationConversationId))throw new eq("destination_invalid","destination.conversation_id must be a non-empty string when present.")}let c=(o=JSON.stringify([r.mode,r.originConversationId,r.sourceAgentId,r.sessionRef,r.destinationAgentId??null,r.destinationConversationId??null,r.instruction]),(0,t.createHash)("sha256").update(o).digest("hex"));return e.transaction(()=>{var o,d;let u=i.get(r.requester.kind,r.requester.id,r.idempotencyKey);if(u){if(u.request_hash!==c)throw new eq("idempotency_conflict","The idempotency key was already used with a different exchange.");return{exchange:u,created:!1}}let f=r.now??Date.now();if(E(r.originConversationId,r.requester,"origin"),!l.get(r.sourceAgentId))throw new eq("agent_not_found",`No source Agent ${r.sourceAgentId}.`);let g=s.get(r.sessionRef);if(!g||g.agent_id!==r.sourceAgentId)throw new eq("session_not_found",`Session ${r.sessionRef} is not a session of Agent ${r.sourceAgentId}.`);if(null!==g.released_at)throw new eq("session_ended",`Session ${g.id} has ended and cannot be resumed.`);let m=w(r.sourceAgentId,"source");if(g.adapter!==m.agent)throw new eq("session_not_resumable",`Session ${g.id} was bound under ${g.adapter}; ${m.name} now runs ${m.agent}.`);let y=g.conversation_id?g.conversation_id:g.request_id?n.getWorkRequest(g.request_id)?.source_conversation_id??null:null;if(!y)throw new eq("session_not_resumable",`Session ${g.id} has no conversation to resume in.`);if(e.prepare("SELECT 1 FROM session_exchanges WHERE source_binding_id = ? AND terminal_at IS NULL").get(g.id))throw new eq("source_session_busy",`Session ${g.id} already has an exchange in progress; wait for it or cancel it.`);let v=null,I=null;if("continue"===r.mode)if(v=w(r.destinationAgentId,"destination"),r.destinationConversationId)E(r.destinationConversationId,r.requester,"destination"),I=r.destinationConversationId;else if("service"===r.requester.kind)throw new eq("destination_invalid","A service-started Continue names destination.conversation_id.");else{let t=e.prepare("SELECT id FROM conversations WHERE bot_id = ?").get(v.id);if(!t)throw new eq("destination_invalid",`${v.name} has no direct thread; name destination.conversation_id.`);I=t.id}let q=(0,t.randomUUID)();e.prepare(`
50
- INSERT INTO session_exchanges (
51
- id, requester_kind, requester_id, idempotency_key, request_hash, mode, origin_conversation_id,
52
- source_agent_id, source_binding_id, destination_agent_id, destination_conversation_id, instruction,
53
- state, created_at, updated_at
54
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'queued', ?, ?)
55
- `).run(q,r.requester.kind,r.requester.id,r.idempotencyKey,c,r.mode,r.originConversationId,r.sourceAgentId,g.id,v?.id??null,I,r.instruction,f,f),p(q,"created",{mode:r.mode,source_agent_id:r.sourceAgentId,source_binding_id:g.id,destination_agent_id:v?.id??null,destination_conversation_id:I},f);let A=_(q),R="ask"===r.mode?"ask":"extract",b=k(A,R,{conversationId:y,targetAgentId:r.sourceAgentId,intent:"ask"===R?function(e,t,n="the owner"){return`[Session Ask from ${n}] Exchange: ${e}
56
-
57
- Answer one question from the context of this session. ${eT} Reply with the answer only.
58
-
59
- Question:
60
- ${t}`}(q,r.instruction,"service"===A.requester_kind?`service ${A.requester_id}`:"the owner"):(o=v?.name??"another Agent",d=r.instruction,`[Session Continue handoff from the owner] Exchange: ${q}
61
-
62
- The owner is handing this session's work to ${o}, who starts a fresh session and cannot see this one. ${eT}
63
-
64
- Reply with exactly one JSON object and nothing else:
65
-
66
- {"objective": string, "decisions": [string], "constraints": [string], "artifacts": [string], "open_questions": [string]}
67
-
68
- objective: what ${o} should achieve. decisions: what was decided and why. constraints: requirements and limits to respect. artifacts: files, branches, Work Requests, and other references. open_questions: what is still unresolved.
69
-
70
- Limits: objective at most ${a.EXCHANGE_LIMITS.packetObjectiveChars} characters; each list at most ${a.EXCHANGE_LIMITS.packetListItems} entries of at most ${a.EXCHANGE_LIMITS.packetItemChars} characters.
71
-
72
- Owner instruction:
73
- ${d}`),parentRequestId:g.request_id,resumeBindingId:g.id,now:f}),S=h(A,{source_request_id:b.id},f);return p(q,"hop_queued",{hop:R,request_id:b.id},f),{exchange:S,created:!0}}).immediate()},get:e=>r.get(e),require:_,listEvents:t=>e.prepare("SELECT * FROM session_exchange_events WHERE exchange_id = ? ORDER BY sequence ASC").all(t),forHopRequest:e=>o.get(e,e),resumeFor(e,t){let n=eN(e);if(!n)return null;if("deliver"===n.hop)return{ok:!0,binding:null,freshSession:!0};let r=v.get(n.exchangeId),i=n.resumeBindingId?s.get(n.resumeBindingId):void 0;return r&&i&&r.source_binding_id===i.id&&r.source_request_id===e.id?null!==i.released_at?{ok:!1,reason:"The selected session has ended."}:i.agent_id!==e.target_agent_id||i.adapter!==t?{ok:!1,reason:"The selected session belongs to another Agent or runtime."}:{ok:!0,binding:i}:{ok:!1,reason:"The exchange does not name this session."}},turnContext:e=>eN(e)?[{speakerLabel:"Botmancers",fromAgent:!1,content:e.intent}]:null,hopClaimed(e,t,n){let r=v.forHopRequest(e);if(!(!r||g(r.state))){if(r.source_request_id===e){let i=r.source_attempt_id?r:h(r,{source_attempt_id:t},n);"queued"===i.state&&m(i,"extracting",n,{reason:"hop_started"}),p(r.id,"hop_started",{hop:"ask"===r.mode?"ask":"extract",request_id:e,attempt_id:t},n);return}r.destination_attempt_id||h(r,{destination_attempt_id:t},n),p(r.id,"hop_started",{hop:"deliver",request_id:e,attempt_id:t},n)}},sanitizeHopResult(e,t){let n=eN(e),r=n?v.get(n.exchangeId):void 0;if(!n||!r)return t;let i=s.get(r.source_binding_id)?.external_session_id??null,o="ask"===n.hop?a.EXCHANGE_LIMITS.answerChars:"extract"===n.hop?a.EXCHANGE_LIMITS.extractionOutputChars:a.EXCHANGE_LIMITS.replyChars,d=t.externalSessionId??null,l=null===t.output?null:ex(eb(t.output,i,d),o);return{...t,output:l?l.content:null,outputTruncated:!0===t.outputTruncated||l?.truncated===!0,failure:t.failure?{...t.failure,message:eb(t.failure.message,i,d)}:null}},commitHop(r,i,o,d){let l=eN(r),u=l?v.get(l.exchangeId):void 0;if(!l||!u)return{exchange_id:l?.exchangeId??null,discarded:"exchange_missing"};if(g(u.state)||null!==u.cancel_requested_at)return p(u.id,"hop_result_discarded",{hop:l.hop,request_id:r.id,reason:g(u.state)?u.state:"cancel_requested"},d),{exchange_id:u.id,discarded:"cancel_requested"};let c=o.output??"",_=s.get(u.source_binding_id)?.external_session_id??null;if("ask"===l.hop){let n=ex(eb(c,_),a.EXCHANGE_LIMITS.answerChars),{content:s}=n,l=n.truncated||!0===o.outputTruncated,f=(0,t.randomUUID)();return e.prepare("INSERT INTO messages (id, conversation_id, sender_type, sender_id, sender_kind, request_id, content, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(f,u.origin_conversation_id,"bot",u.source_agent_id,"bot",r.id,s,d),h(u,{answer_message_id:f},d),p(u.id,"answer_returned",{request_id:r.id,attempt_id:i.id,message_id:f,conversation_id:u.origin_conversation_id,truncated:l},d),{exchange_id:u.id,answer_message_id:f}}if("extract"===l.hop){var f;let e=o.outputTruncated?{ok:!1,reason:`The extraction output exceeds ${a.EXCHANGE_LIMITS.extractionOutputChars} characters.`}:function(e){let t;if(e.length>a.EXCHANGE_LIMITS.extractionOutputChars)return{ok:!1,reason:`The extraction output exceeds ${a.EXCHANGE_LIMITS.extractionOutputChars} characters.`};let n=/```(?:json)?\s*([\s\S]*?)```/.exec(e),r=(n?n[1]:e).trim(),i=r.indexOf("{"),o=r.lastIndexOf("}");if(i<0||o<i)return{ok:!1,reason:"The handoff packet is not a JSON object."};try{t=JSON.parse(r.slice(i,o+1))}catch{return{ok:!1,reason:"The handoff packet is not valid JSON."}}if(!t||"object"!=typeof t||Array.isArray(t))return{ok:!1,reason:"The handoff packet is not a JSON object."};let s=t;if(!eR(s.objective))return{ok:!1,reason:"The handoff packet has no objective."};if(s.objective.length>a.EXCHANGE_LIMITS.packetObjectiveChars)return{ok:!1,reason:`The handoff packet objective exceeds ${a.EXCHANGE_LIMITS.packetObjectiveChars} characters.`};let d={objective:s.objective.trim(),decisions:[],constraints:[],artifacts:[],open_questions:[]};for(let e of eA){let t=s[e]??[];if(!Array.isArray(t)||t.some(e=>"string"!=typeof e))return{ok:!1,reason:`The handoff packet field ${e} must be a list of strings.`};if(t.length>a.EXCHANGE_LIMITS.packetListItems)return{ok:!1,reason:`The handoff packet field ${e} has ${t.length} entries (limit ${a.EXCHANGE_LIMITS.packetListItems}).`};if(t.some(e=>e.length>a.EXCHANGE_LIMITS.packetItemChars))return{ok:!1,reason:`An entry of the handoff packet field ${e} exceeds ${a.EXCHANGE_LIMITS.packetItemChars} characters.`};d[e]=t.map(e=>e.trim()).filter(e=>e.length>0)}return JSON.stringify(d).length>a.EXCHANGE_LIMITS.packetChars?{ok:!1,reason:`The handoff packet exceeds ${a.EXCHANGE_LIMITS.packetChars} characters.`}:{ok:!0,packet:d}}(c);if(!e.ok)return p(u.id,"packet_rejected",{request_id:r.id,attempt_id:i.id,reason:e.reason},d),m(u,"failed",d,{reason:"packet_invalid",failureCode:"packet_invalid",failureMessage:e.reason}),{exchange_id:u.id,packet:"rejected"};let t=(f=e.packet,{objective:eb(f.objective,_),decisions:f.decisions.map(e=>eb(e,_)),constraints:f.constraints.map(e=>eb(e,_)),artifacts:f.artifacts.map(e=>eb(e,_)),open_questions:f.open_questions.map(e=>eb(e,_))});return h(u,{packet:JSON.stringify(t)},d),p(u.id,"packet_extracted",{request_id:r.id,attempt_id:i.id,size:JSON.stringify(t).length,counts:Object.fromEntries(eA.map(e=>[e,t[e].length]))},d),{exchange_id:u.id,packet:"stored"}}let k=o.externalSessionId??null,w=!1;try{w=!0===JSON.parse(i.launch_snapshot).fresh_session}catch{w=!1}if(!(w&&k&&k!==_&&!e.prepare("SELECT 1 FROM session_bindings WHERE external_session_id = ?").get(k)&&!e.prepare("SELECT 1 FROM work_attempts WHERE external_session_id = ? AND id != ?").get(k,i.id))){let e=w?k?"reused":"not_reported":"not_fresh_launch";return p(u.id,"destination_session_rejected",{request_id:r.id,attempt_id:i.id,reason:e},d),m(u,"failed",d,{reason:"destination_session_invalid",failureCode:"destination_session_invalid",failureMessage:k?"The destination Agent reported a session that is not new; the hand-off needs a fresh destination-owned session.":"The destination Agent reported no session; the hand-off needs a fresh destination-owned session."}),{exchange_id:u.id,destination_session:"rejected"}}let E=(0,t.randomUUID)(),y=u.destination_conversation_id,I=ex(eb(c,_,k),a.EXCHANGE_LIMITS.replyChars),{content:q}=I,A=I.truncated||!0===o.outputTruncated;e.prepare("INSERT INTO messages (id, conversation_id, sender_type, sender_id, sender_kind, request_id, content, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(E,y,"bot",r.target_agent_id,"bot",r.id,q,d);let R=n.bindSession({agentId:r.target_agent_id,adapter:i.adapter,externalSessionId:k,conversationId:y,requestId:r.id,sourceAttemptId:i.id,now:d}).id;return h(u,{destination_binding_id:R},d),p(u.id,"destination_replied",{request_id:r.id,attempt_id:i.id,message_id:E,conversation_id:y,session_ref:R,truncated:A},d),{exchange_id:u.id,destination_message_id:E}},advance:(t,r=Date.now())=>e.transaction(()=>{let i=v.get(t);if(!i||g(i.state))return[];if("queued"===i.state||"extracting"===i.state){var o,s,d,l;let t=i.source_request_id?n.getWorkRequest(i.source_request_id):void 0;if(!t)return m(i,"failed",r,{reason:"hop_missing",failureCode:"hop_missing",failureMessage:"The source session turn is missing."}),[];if(!a.TERMINAL_STATES.includes(t.state))return"queued"!==t.state&&"queued"===i.state&&m(i,"extracting",r,{reason:"hop_started"}),"queued"===t.state&&null===i.cancel_requested_at?[t.id]:[];if(null!==i.cancel_requested_at||"cancelled"===t.state)return m(i,"cancelled",r,{reason:null!==i.cancel_requested_at?"cancel_requested":"hop_cancelled"}),[];if("failed"===t.state)return m(i,"failed",r,{reason:"hop_failed",failureCode:"source_turn_failed",failureMessage:`The source session turn failed (${t.error_code??"failed"}): ${t.error_message??"no detail"}`}),[];if("queued"===i.state&&(i=m(i,"extracting",r,{reason:"hop_started"})),"ask"===i.mode)return i.answer_message_id?m(i,"completed",r,{reason:"answered"}):m(i,"failed",r,{reason:"answer_missing",failureCode:"answer_missing",failureMessage:"The source session turn returned no answer."}),[];if(!i.packet)return m(i,"failed",r,{reason:"packet_missing",failureCode:"packet_missing",failureMessage:"The source session turn returned no handoff packet."}),[];let u=JSON.parse(i.packet),c=i.destination_conversation_id,_=i.destination_agent_id;o={kind:"bot",id:_},e.prepare("INSERT OR IGNORE INTO conversation_participants (conversation_id, participant_kind, participant_id, joined_at) VALUES (?, ?, ?, ?)").run(c,o.kind,o.id,r);let g=k(i,"deliver",{conversationId:c,targetAgentId:_,intent:(s=i.id,d=f(i.source_agent_id)??"the source Agent",l=i.instruction,[`Continue from ${d}: ${function(e,t=80){let n=e.split("\n").map(e=>e.trim()).find(e=>e.length>0)??"";return n.length>t?`${n.slice(0,t-1).trimEnd()}…`:n}(u.objective)}`,`[Session Continue] Exchange: ${s}`,`The owner handed you this work from ${d}'s session. You start a fresh session of your own: ${d}'s session is not available to you, and this handoff packet is everything carried over.`,`Objective:
74
- ${u.objective}`,eC("Decisions",u.decisions),eC("Constraints",u.constraints),eC("Artifacts and references",u.artifacts),eC("Open questions",u.open_questions),`Owner instruction:
75
- ${l}`].join("\n\n")),parentRequestId:null,resumeBindingId:null,now:r});return p((i=h(i,{destination_request_id:g.id},r)).id,"hop_queued",{hop:"deliver",request_id:g.id},r),m(i,"delivering",r,{reason:"packet_extracted"}),[g.id]}let u=i.destination_request_id?n.getWorkRequest(i.destination_request_id):void 0;return u?a.TERMINAL_STATES.includes(u.state)?(null!==i.cancel_requested_at||"cancelled"===u.state?m(i,"cancelled",r,{reason:null!==i.cancel_requested_at?"cancel_requested":"hop_cancelled"}):"failed"===u.state?m(i,"failed",r,{reason:"hop_failed",failureCode:"destination_turn_failed",failureMessage:`The destination turn failed (${u.error_code??"failed"}): ${u.error_message??"no detail"}`}):i.destination_binding_id?m(i,"completed",r,{reason:"delivered"}):m(i,"failed",r,{reason:"destination_session_missing",failureCode:"destination_session_invalid",failureMessage:"The destination turn bound no fresh destination-owned session."}),[]):"queued"===u.state&&null===i.cancel_requested_at?[u.id]:[]:(m(i,"failed",r,{reason:"hop_missing",failureCode:"hop_missing",failureMessage:"The destination turn is missing."}),[])}).immediate(),requestCancel:(t,n,r,i=Date.now())=>e.transaction(()=>{let a=_(t);if(g(a.state))throw new eq("exchange_terminal",`Exchange ${t} is already ${a.state}; it cannot be cancelled.`);let o="delivering"===a.state?a.destination_request_id:a.source_request_id;return null!==a.cancel_requested_at?{exchange:a,hopRequestId:o,replayed:!0}:(e.prepare("UPDATE session_exchanges SET cancel_requested_at = ?, cancel_requested_by = ?, cancel_reason = ?, version = version + 1, updated_at = ? WHERE id = ? AND cancel_requested_at IS NULL").run(i,`${n.kind}:${n.id}`,r,i,t),p(t,"cancel_requested",{by:`${n.kind}:${n.id}`,reason:r,state:a.state,request_id:o},i),{exchange:_(t),hopRequestId:o,replayed:!1})}).immediate(),openIds:()=>e.prepare("SELECT id FROM session_exchanges WHERE terminal_at IS NULL ORDER BY created_at ASC, id ASC").all().map(e=>e.id),view(t){let r=_(t),i=(e,t)=>{let r=e?n.getWorkRequest(e):void 0;return r?{request_id:r.id,attempt_id:t,state:r.state,execution_kind:r.execution_kind,tool_profile:r.tool_profile}:null},o=r.answer_message_id?e.prepare("SELECT id, conversation_id, content FROM messages WHERE id = ?").get(r.answer_message_id):void 0;return{id:r.id,mode:r.mode,state:r.state,requester:{kind:r.requester_kind,id:r.requester_id},origin_conversation_id:r.origin_conversation_id,instruction:r.instruction,source:{agent_id:r.source_agent_id,agent_name:f(r.source_agent_id),session_ref:r.source_binding_id},destination:r.destination_agent_id&&r.destination_conversation_id?{agent_id:r.destination_agent_id,agent_name:f(r.destination_agent_id),conversation_id:r.destination_conversation_id,session_ref:r.destination_binding_id}:null,hops:{source:i(r.source_request_id,r.source_attempt_id),destination:i(r.destination_request_id,r.destination_attempt_id)},answer:o?{message_id:o.id,conversation_id:o.conversation_id,content:o.content}:null,packet:r.packet?JSON.parse(r.packet):null,failure:"failed"===r.state?{code:r.failure_code??"failed",message:r.failure_message??""}:null,cancel:null!==r.cancel_requested_at?{requested_at:r.cancel_requested_at,reason:r.cancel_reason}:null,events:v.listEvents(r.id).map(e=>({sequence:e.sequence,type:e.type,at:e.created_at,data:e.data?JSON.parse(e.data):null})),limits:a.EXCHANGE_LIMITS,created_at:r.created_at,updated_at:r.updated_at,terminal_at:r.terminal_at}}};return v}let eO=new Set(["mode","idempotency_key","origin_conversation_id","source","destination","instruction","execution_kind","tool_profile"]),eL=["exchange_id","parent_exchange_id"];function e$(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}e.s(["ExchangeError",0,eq,"cancelReasonFromBody",0,function(e){let t;if(0===e.trim().length)return null;try{t=JSON.parse(e)}catch{throw new eq("invalid_request","The body must be a JSON object.")}if(!e$(t))throw new eq("invalid_request","The body must be a JSON object.");let n=Object.keys(t).filter(e=>"reason"!==e);if(n.length>0)throw new eq("invalid_request",`Unknown field ${n[0]}.`);let r=t.reason;if(null!=r&&("string"!=typeof r||r.length>500))throw new eq("invalid_request","reason must be a string of at most 500 characters.");return"string"==typeof r?r:null},"createExchangeStore",0,eD,"exchangeErrorBody",0,function(e){return{error:{code:e.code,message:e.message}}},"exchangeInputFromBody",0,function(e,t){if(!e$(e))throw new eq("invalid_request","The body must be a JSON object.");for(let t of eL)if(t in e)throw new eq("recursive_exchange","An exchange cannot be started from another exchange.");let n=Object.keys(e).filter(e=>!eO.has(e));if(n.length>0)throw new eq("invalid_request",`Unknown field ${n[0]}.`);if(void 0!==e.tool_profile&&"readonly"!==e.tool_profile)throw new eq("authority_not_allowed","An exchange runs read-only; it never requests edit authority.");if(!e$(e.source))throw new eq("invalid_request","source must be one object { agent_id, session_ref }.");if(void 0!==e.destination&&null!==e.destination&&!e$(e.destination))throw new eq("destination_invalid","destination must be one object { agent_id, conversation_id? }.");let r=e$(e.destination)?e.destination:null,i=(e,t)=>{if("string"!=typeof e)throw new eq("invalid_request",`${t} must be a string.`);return e},a=(e,t)=>null==e?null:i(e,t);return{requester:t,mode:i(e.mode,"mode"),idempotencyKey:i(e.idempotency_key,"idempotency_key"),originConversationId:i(e.origin_conversation_id,"origin_conversation_id"),sourceAgentId:i(e.source.agent_id,"source.agent_id"),sessionRef:i(e.source.session_ref,"source.session_ref"),destinationAgentId:r?a(r.agent_id,"destination.agent_id"):null,destinationConversationId:r?a(r.conversation_id,"destination.conversation_id"):null,instruction:i(e.instruction,"instruction"),...void 0!==e.execution_kind?{executionKind:e.execution_kind}:{}}},"hopOf",0,eN],63020);let eW=/^(cwd|working_directory|workspace|deck|deck_id|deck_name|hermes_profile|hermes_profile_path)$/,eM=/(KEY|TOKEN|SECRET|PASSWORD|CREDENTIAL)/i,eF=/^(id|ref|session_ref|sessionRef|kind)$|(request|conversation|agent|message|attempt|exchange|event|wake|grant|binding|finalization|bot|participant|sender|requester|origin|group)_?id$/i;function eH(e){return!!e&&"object"==typeof e&&!Array.isArray(e)}function eU(e,t,n=!1){if("string"==typeof e)n&&t.add(e);else if(Array.isArray(e))for(let r of e)eU(r,t,n);else if(eH(e))for(let[r,i]of Object.entries(e))eU(i,t,n||eW.test(r))}function ej(e,t,n){return t.reduce((e,t)=>t.length>=6?e.includes(t)?e.split(t).join(n):e:e.includes(t)?e.replace(RegExp(`(?<![A-Za-z0-9])${t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![A-Za-z0-9])`,"g"),n):e,e)}function eP(){let e=function(){let e=new Set;for(let t of n.default.prepare("SELECT external_session_id AS id FROM session_bindings").all())e.add(t.id);for(let t of n.default.prepare("SELECT external_session_id, external_run_id FROM work_attempts WHERE external_session_id IS NOT NULL OR external_run_id IS NOT NULL").all())t.external_session_id&&e.add(t.external_session_id),t.external_run_id&&e.add(t.external_run_id);return[...e].filter(e=>e.length>0).sort((e,t)=>t.length-e.length)}(),t=function(){let e=new Set;for(let t of n.bots.getAll())eU(t,e);for(let t of n.default.prepare(`
76
- SELECT launch_snapshot AS snapshot FROM work_attempts WHERE launch_snapshot IS NOT NULL
77
- UNION ALL SELECT snapshot FROM launch_snapshots
78
- `).all())eU(function(e){try{return JSON.parse(e)}catch{return null}}(t.snapshot),e);return[...new Set([...[...e].filter(e=>e.trim().length>=4),...Object.entries(process.env).filter(([e,t])=>eM.test(e)&&"string"==typeof t).flatMap(([,e])=>[e,...e.split(/[\s,=]+/)]).filter(e=>e.length>=8)])].sort((e,t)=>t.length-e.length)}(),r=n=>ej(ej(n,e,"[redacted runtime id]"),t,"[redacted]"),i=(e,t)=>"string"==typeof e?null!==t&&eF.test(t)?e:r(e):Array.isArray(e)?e.map(e=>i(e,null)):eH(e)?Object.fromEntries(Object.entries(e).map(([e,t])=>[e,i(t,e)])):e;return{text:r,deep:e=>i(e,null)}}e.s(["serviceRedactor",0,eP],93399);var ez=e.i(35631);let eB=["person","bot","service"],eG={authentication_unavailable:503,unauthenticated:401,principal_mismatch:403,invalid_request:400,agent_not_found:404,conversation_not_found:404,conversation_not_writable:409,request_not_found:404,idempotency_conflict:409,internal_error:500};class eK extends Error{code;constructor(e,t){super(t),this.name="AgentApiError",this.code=e}get status(){return eG[this.code]}}function eJ(e){return"string"==typeof e&&eB.includes(e)}function eV(e){return"string"==typeof e&&e.trim().length>0}function eX(e,t){return!!n.default.prepare("SELECT 1 FROM conversation_participants WHERE conversation_id = ? AND participant_kind = ? AND participant_id = ?").get(e,t.kind,t.id)}function eY(e){switch(e){case"running":case"waiting":return"dispatched";case"completed":return"completed";case"failed":case"cancelled":return"failed";default:return"accepted"}}function eZ(e){if(!eJ(e.kind)||!eV(e.id)||"bot"===e.kind&&!n.bots.getById(e.id))throw new eK("unauthenticated","Authentication failed.")}let eQ={invalid_request:"invalid_request",conversation_not_found:"conversation_not_found",conversation_not_writable:"conversation_not_writable",target_not_found:"agent_not_found",idempotency_conflict:"idempotency_conflict",unknown_principal:"unauthenticated",intake_failed:"internal_error"};function e0(e){return Promise.all(e.requestIds.map(tc)).then(()=>void 0)}function e1(e,t,r,i){n.engine.transaction(()=>{t&&n.engine.finishAttempt(t,{outcome:"failed",errorCategory:r,errorMessage:i});let a=n.engine.getWorkRequest(e);a&&("queued"===a.state||"running"===a.state)&&n.engine.transitionWorkRequest(e,{from:a.state,to:"failed",errorCode:r,errorMessage:i})})}let e4=(0,s.createDispatcher)(n.default,n.engine);class e2 extends Error{reason;constructor(e){super(`Commit deferred: ${e}`),this.reason=e}}async function e5(e){let t=await e9(e);e6(e,t||n.engine.getWorkRequest(e)?.state!=="queued")}function e6(e,t){for(let t of ew(e))tc(t);for(let t of(function(e){let t=tf.forHopRequest(e);if(t)try{for(let e of tf.advance(t.id))tc(e)}catch(e){console.error("Exchange advance failed:",e instanceof Error?e.message:"unknown error")}}(e),es()))t_.has(t)||tp(t);t&&e3()}function e3(){for(let e of e4.deferredRequestIds())tu.has(e)||tc(e)}async function e9(e){let t,o,l=n.engine.getWorkRequest(e);if(!l||"queued"!==l.state||null!==l.next_eligible_at&&e4.now()<l.next_eligible_at)return!1;let u=n.bots.getById(l.target_agent_id);if(!u)return e1(e,null,"agent_unavailable","The agent is no longer registered."),!1;let c=(0,d.authorizeWorkRequest)(l);if(!c.ok){try{n.engine.transitionWorkRequest(e,{from:"queued",to:"failed",expectedVersion:l.version,reason:"policy_rejected",errorCode:c.code,errorMessage:c.reason})}catch(e){if(!(e instanceof a.EngineStoreError&&"stale_state"===e.code))throw e}return!1}let _=c.policy,p=(0,r.agentForDispatch)(u),f=tf.resumeFor(l,p)??function(e,t){if("revision"!==e.execution_kind)return{ok:!0,binding:null};let r=eu(e).resume_work_request,i="string"==typeof r?n.engine.getWorkRequest(r):void 0;if(!i||i.root_request_id!==e.root_request_id||i.target_agent_id!==e.target_agent_id||!["implementation","revision"].includes(i.execution_kind))return{ok:!1,reason:"The revision does not reference an implementation of this Agent in this lineage."};let a=n.engine.getActiveSessionBinding({agentId:e.target_agent_id,adapter:t,conversationId:i.source_conversation_id,requestId:i.id});return a?{ok:!0,binding:a}:{ok:!1,reason:"The session of the referenced implementation is not available to resume."}}(l,p);if(!f.ok){try{n.engine.transitionWorkRequest(e,{from:"queued",to:"failed",expectedVersion:l.version,reason:"session_unavailable",errorCode:"session_unavailable",errorMessage:f.reason})}catch(e){if(!(e instanceof a.EngineStoreError&&"stale_state"===e.code))throw e}return!1}let g=null,m=null;try{g=(0,r.prepareDispatch)({bot:u,history:[...n.default.prepare(`SELECT * FROM messages WHERE conversation_id = ?
79
- AND rowid <= (SELECT rowid FROM messages WHERE id = ?)
80
- ORDER BY rowid ASC`).all(l.source_conversation_id,l.source_event_id).map(e=>({speakerLabel:function(e){if("bot"===e.sender_kind&&e.sender_id){let t=n.bots.getById(e.sender_id);return t?t.name:`bot:${e.sender_id}`}return`${e.sender_kind??"person"}:${e.sender_id??"unknown"}`}(e),fromAgent:"bot"===e.sender_kind&&e.sender_id===u.id,content:e.content})),...function(e){if(e.requester_kind===ed.kind&&e.requester_id===ed.id&&"coordinator_continuation"===eu(e).source)return[{speakerLabel:el,fromAgent:!1,content:e.intent}];if(!e.wake_event_id)return[];let t=eu(e),r=Array.isArray(t.context_work_requests)?t.context_work_requests.filter(e=>"string"==typeof e):[],i=[`[${e.execution_kind} Wake from ${ec(e.requester_id)}] Work Request: ${e.id}`,`Objective:
81
- ${e.intent}`];for(let a of("string"==typeof t.resume_work_request&&i.push(`This revision continues your session from Work Request ${t.resume_work_request}.`),r)){let t=n.engine.getWorkRequest(a);t&&t.root_request_id===e.root_request_id&&i.push(`Context:
82
- ${ep(t)}`)}return[{speakerLabel:el,fromAgent:!1,content:i.join("\n\n")}]}(l),...tf.turnContext(l)??[]],toolProfile:_.tool_profile,sessionBinding:f.binding?{bindingId:f.binding.id,externalSessionId:f.binding.external_session_id}:null,..."freshSession"in f&&f.freshSession?{freshSession:!0}:{},prepareFinalization:"implementation"===_.execution_kind||"revision"===_.execution_kind})}catch(e){m=e instanceof r.DispatchFailure?e:new r.DispatchFailure("runtime_failed","The agent runtime did not complete the turn.")}let h={agent:p,agent_id:u.id,execution_kind:_.execution_kind,tool_profile:_.tool_profile,policy_rule:_.rule},k=new AbortController;try{t=n.engine.transaction(()=>{let t=e4.claim(e,{expectedVersion:l.version,data:{agent:p}});if(!t.ok)return o=t.blockedBy,null;if(g){let r=e4.now(),a=e4.control.attemptDeadlineFor(t.request,r),o={...g.input,deadlineAt:a,signal:k.signal},s=(0,i.beginAttempt)(n.engine,e,{agent:p,adapter:g.adapter,input:o,snapshot:h,now:r});return e4.recordLaunchIntent(t.lease,s.attempt.id,g.adapter.name,g.adapter.launchIntent?.(s.input)??null),tf.hopClaimed(e,s.attempt.id,r),{lease:t.lease,attempt:s}}let r=n.engine.createAttempt(e,{kind:"launch",adapter:p,toolProfile:_.tool_profile,launchSnapshot:h});return tf.hopClaimed(e,r.id,r.started_at),{lease:t.lease,attempt:r.id}})}catch(e){if(e instanceof a.EngineStoreError&&"stale_state"===e.code)return!1;throw e}if(!t)return o&&tc(o),!1;let{lease:w}=t;if(!g||"string"==typeof t.attempt){let i=m??new r.DispatchFailure("runtime_failed","The agent runtime did not complete the turn."),a="string"==typeof t.attempt?t.attempt:t.attempt.attempt.id;return n.engine.transaction(()=>{e4.assertHeld(w),e1(e,a,i.code,i.message),e4.release(w,"failed")}),!0}let E=t.attempt.attempt.id;return e7.set(e,{attemptId:E,controller:k}),await tr(w,async()=>{(0,s.dispatchFault)("before_launch",e);try{let r=await (0,i.runAttempt)(n.engine,t.attempt,g.adapter,{fence:()=>e4.holds(w),onEvent:t=>{"started"===t.type&&(0,s.dispatchFault)("after_run_id_persisted",e),tn(w,E,t)},sanitize:e=>tf.sanitizeHopResult(l,e),project:(e,t)=>ta(w,l,t,e)});r.abandoned&&await tt(r.abandoned,{localSignalled:!0,launched:!0}),r.projected?.retryAt!=null&&e8(e,r.projected.retryAt)}catch(e){ti(w,E,e)}},k),e7.get(e)?.attemptId===E&&e7.delete(e),!0}let e7=new Map;function e8(e,t){let n=setTimeout(()=>{tc(e)},Math.max(0,t-e4.now()));n.unref&&n.unref()}async function te(e){let t=e7.get(e.requestId);if(t&&t.attemptId===e.attemptId){t.controller.abort();let n=tu.get(e.requestId);if(n){let t=`abandoned:${e.attemptId}`;tu.delete(e.requestId),tu.set(t,n),n.finally(()=>{tu.get(t)===n&&tu.delete(t)})}}await tt(e,{localSignalled:!!t&&t.attemptId===e.attemptId,launched:e.launched})}async function tt(e,t){let i,a=e.transport?(0,r.adapterForTransport)(e.transport)?.reconciler??null:null;i="failed"===e.externalCancel?"failed":e.externalRunId?a?.cancel?await a.cancel(e.externalRunId):"unsupported":t.launched?"unsupported":"not_launched",n.engine.appendEvent(e.requestId,{type:"external_cancel",attemptId:e.attemptId,data:{status:i,reason:e.reason,external_run_id:e.externalRunId,transport:e.transport,local_signalled:t.localSignalled},now:e4.now()})}function tn(e,t,r){if("progress"===r.type&&"finalization_prepared"===r.detail.phase&&"string"==typeof r.detail.baseline_ref&&"string"==typeof r.detail.baseline_digest){let i={baselineRef:r.detail.baseline_ref,baselineDigest:r.detail.baseline_digest};n.engine.transaction(()=>{e4.holds(e)&&Z(t,i,r.at)})}}async function tr(e,t,r){let i=setInterval(()=>{try{e4.heartbeat(e);let t=n.engine.getWorkRequest(e.requestId);r&&t&&(null!==t.cancel_requested_at||a.TERMINAL_STATES.includes(t.state))&&r.abort()}catch(e){console.error("Dispatch heartbeat failed:",e)}},e4.config.heartbeatMs);i.unref&&i.unref();try{return await t()}finally{clearInterval(i)}}function ti(e,t,n){if(!(n instanceof s.LeaseLostError)){if(n instanceof e2){try{e4.defer(e,n.reason,t)}catch(e){if(!(e instanceof s.LeaseLostError))throw e}return}throw n}}function ta(e,a,o,d){if((0,s.dispatchFault)("before_terminal_commit",a.id),e4.assertHeld(e),"failed"===d.status&&d.failure?.code==="agent_deck_unreachable"&&o.external_run_id)throw new e2("unreachable");if("failed"===d.status&&d.launchUnconfirmed&&!o.external_run_id)throw new e2("launch_unconfirmed");let l=a.id,u=e4.now();Q(a,o,d,u);let c=n.engine.getWorkRequest(l)??a,_=null!==c.cancel_requested_at;if(_||null!==c.deadline_at&&u>=c.deadline_at)return _?n.engine.transitionWorkRequest(l,{from:"running",to:"cancelled",reason:"cancel_requested",errorCode:"cancelled",errorMessage:c.cancel_reason??"The request was cancelled.",data:{attempt_outcome:o.outcome},now:u}):n.engine.transitionWorkRequest(l,{from:"running",to:"failed",reason:"timed_out",errorCode:"timed_out",errorMessage:"The request passed its deadline.",data:{deadline_at:c.deadline_at,attempt_outcome:o.outcome},now:u}),"completed"===d.status&&(0,i.recordLateResult)(n.engine,o,d,u),e4.release(e,_?"cancelled":"timed_out"),{retryAt:null};if("completed"!==d.status||null===d.output){let t=(0,r.dispatchFailureFor)(d),n=e4.control.settleFailure(l,{category:"completed"===d.status?"result_contract":d.failure?.category??"runtime_failed",code:d.failure?.code??null,errorCode:t.code,errorMessage:t.message,..."failed"===d.externalCancel?{attention:"external_cancel_failed"}:{}},u);return e4.release(e,n.outcome),{retryAt:"retry"===n.decision.action?n.decision.nextEligibleAt:null}}let p=eN(a);if(p){let t=tf.commitHop(a,o,d,u);return n.engine.transitionWorkRequest(l,{from:"running",to:"completed",result:t,now:u}),e4.release(e,"completed"),tf.advance(p.exchangeId,u),{retryAt:null}}let f=(0,t.randomUUID)();return n.default.prepare("INSERT INTO messages (id, conversation_id, sender_type, sender_id, sender_kind, request_id, content, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(f,a.source_conversation_id,"bot",a.target_agent_id,"bot",l,d.output,u),"edit"===a.tool_profile&&d.externalSessionId&&n.engine.bindSession({agentId:a.target_agent_id,adapter:o.adapter,externalSessionId:d.externalSessionId,conversationId:a.source_conversation_id,requestId:l,sourceAttemptId:o.id,now:u}),n.engine.transitionWorkRequest(l,{from:"running",to:"completed",result:{reply_message_id:f},now:u}),e4.release(e,"completed"),{retryAt:null}}function to(e){return e?{kind:e.kind,..."run"===e.kind?{state:e.state}:{},..."accepted"===e.kind?{run_id:e.runId}:{},..."rejected"===e.kind?{status:e.status,code:e.code}:{}}:null}async function ts(e){let t=n.engine.getWorkRequest(e.requestId);if(!t||"running"!==t.state)return void e4.release(e,"stale");let a=async(r,i)=>{let a=n.engine.transaction(()=>{e4.assertHeld(e);let n=e4.control.enforceRequest(t.id,e4.now(),{force:!0});return n?(i?.(),{enforced:n}):{value:r()}});return"enforced"in a?(a.enforced.abandoned&&await te(a.enforced.abandoned),{won:!0}):{won:!1,value:a.value}},o=null;try{let p;if((await a(()=>void 0)).won)return;let f=n.engine.listAttempts(t.id).find(e=>null===e.finished_at);if(!f)return void n.engine.transaction(()=>{e4.assertHeld(e),n.engine.transitionWorkRequest(t.id,{from:"running",to:"failed",reason:"retryable",errorCode:"interrupted",errorMessage:"The request was interrupted before its Attempt was recorded."}),e4.release(e,"interrupted")});o=f.id;let g={};try{g=JSON.parse(f.launch_snapshot)}catch{}let m="string"==typeof g.transport?(0,r.adapterForTransport)(g.transport):null,h=m?.reconciler??null,k=async(e,r,i,o)=>!(await a(()=>{n.engine.appendEvent(t.id,{type:"reconcile_decided",attemptId:f.id,data:{phase:e,...r,external_run_id:o,observation:to(i)}})})).won,w=f.external_run_id,E=null;if(w){if(h){if(E=await h.inspect(w),p=(0,s.decideWithRunId)(E),!await k("run",p,E,w))return}else if(p={action:"interrupted",reason:"runtime_unobservable"},!await k("run",p,null,w))return}else{let r=e4.launchIntent(f.id);if(p=(0,s.decideWithoutRunId)({reconcilable:!!h,intent:r,currentGrantFingerprint:h?.currentGrantFingerprint()??null}),"repost"===p.action&&h&&r?.body&&r.idempotency_key){if(!await k("launch",p,null,null))return;if(E=await h.repost({idempotencyKey:r.idempotency_key,body:r.body}),p=(0,s.decideRepostResult)(E),"accepted"===E.kind){var d,l,u,c,_;let r=E.runId,i=(d=e,l=t.id,u=f.id,c=r,_=m?.name??null,n.engine.transaction(()=>{let e=n.engine.getAttempt(u);if(!e)return null;if(null===e.finished_at)return e4.assertHeld(d),n.engine.recordAttemptExternalIds(u,{externalRunId:c}),n.engine.appendEvent(l,{type:"runtime_started",attemptId:u,data:{adapter:_,external_run_id:c,recovered:!0}}),null;n.default.prepare("UPDATE work_attempts SET external_run_id = ? WHERE id = ? AND external_run_id IS NULL").run(c,u),n.engine.appendEvent(l,{type:"runtime_started",attemptId:u,data:{adapter:_,external_run_id:c,recovered:!0,after_abandon:!0}});let t="timed_out"===e.outcome?"timed_out":"cancelled"===e.outcome?"cancelled":"retried",r=null;try{let t=JSON.parse(e.launch_snapshot);r="string"==typeof t.transport?t.transport:null}catch{}return{requestId:l,attemptId:u,externalRunId:c,transport:r,reason:t,launched:!0}}));if(i)return void await tt(i,{localSignalled:!1,launched:!0});w=r}}if(!await k("launch",p,E,w))return}let y=!0===g.prepare_finalization;switch(p.action){case"defer":await a(()=>e4.defer(e,p.reason,f.id));return;case"attention":await a(()=>e4.setAttention(e,{attemptId:f.id,reason:p.reason,detail:E?JSON.stringify(to(E)):null}));return;case"interrupted_attention":{let r=y&&h&&w?await h.evidence(w):null,i=e=>{r&&e&&Q(t,e,{finalization:r})};await a(()=>{i(n.engine.finishAttempt(f.id,{outcome:"interrupted",errorCategory:"interrupted",errorMessage:`Agent Deck run ${w} died.`})),e4.setAttention(e,{attemptId:f.id,reason:p.reason})},()=>i(n.engine.getAttempt(f.id)));return}case"fail":await a(()=>{n.engine.finishAttempt(f.id,{outcome:"failed",errorCategory:p.category,errorMessage:`Agent Deck refused the launch (${p.code}).`}),n.engine.transitionWorkRequest(t.id,{from:"running",to:"failed",reason:"retryable",errorCode:"runtime_failed",errorMessage:"The agent runtime did not start the turn."}),e4.release(e,"failed")});return;case"interrupted":await a(()=>{n.engine.finishAttempt(f.id,{outcome:"interrupted",errorCategory:"interrupted",errorMessage:"The runtime cannot be observed after a restart; the outcome is unknown."}),n.engine.transitionWorkRequest(t.id,{from:"running",to:"failed",reason:"retryable",errorCode:"interrupted",errorMessage:"The agent turn was interrupted by a restart. It was not relaunched."}),e4.release(e,"interrupted")});return}if(!h||!w)return;let v=w,I="string"==typeof g.session_binding_id?g.session_binding_id:null,q=I?n.default.prepare("SELECT external_session_id FROM session_bindings WHERE id = ?").get(I):void 0,A=new AbortController;if((await a(()=>e7.set(t.id,{attemptId:f.id,controller:A}))).won)return;await tr(e,async()=>{let r=await h.follow(v,{resumeSessionId:q?.external_session_id??null,prepareFinalization:y,deadlineAt:"number"==typeof g.deadline_at?g.deadline_at:null,signal:A.signal},t=>tn(e,f.id,t)),a=tf.sanitizeHopResult(t,r),o=null,s=n.engine.transaction(()=>{let r=n.engine.getAttempt(f.id);if(r&&null!==r.finished_at)return(0,i.recordLateResult)(n.engine,r,a,e4.now()),{retryAt:null};if(e4.assertHeld(e),"failed"===a.status&&a.failure?.code==="agent_deck_unreachable")throw new e2("unreachable");let s=(o=m?(0,i.abandonedLocally)(f,m,A.signal,a):null)?(0,i.recordAbandonedResult)(n.engine,o,a):(0,i.recordAttemptResult)(n.engine,f.id,a);return ta(e,t,s,a)});o&&await tt(o,{localSignalled:!0,launched:!0}),null!==s.retryAt&&e8(t.id,s.retryAt)},A).finally(()=>{e7.get(t.id)?.attemptId===f.id&&e7.delete(t.id)})}catch(t){ti(e,o,t)}}function td(){let e=[];for(let t of e4.control.enforceDue())e.push((t.abandoned?te(t.abandoned):Promise.resolve()).then(()=>e6(t.requestId,!0)).catch(e=>{console.error("Request enforcement follow-up failed:",e)}));for(let t of e4.recoverable()){let n=`reconcile:${t.requestId}`;if(tu.has(n)||tu.has(t.requestId))continue;let r=e4.takeOver(t);if(!r)continue;let i=ts(r).then(()=>e6(t.requestId,!e4.holds(r))).catch(e=>{console.error("Dispatch reconciliation failed unexpectedly:",e)}).finally(()=>{tu.delete(n)});tu.set(n,i),e.push(i)}for(let e of(e3(),n.default.prepare(`
83
- SELECT id FROM work_requests
84
- WHERE state = 'queued' AND legacy_agent_request_id IS NULL AND executor = 'dispatcher' AND next_eligible_at IS NOT NULL AND next_eligible_at <= ?
85
- ORDER BY next_eligible_at ASC, id ASC
86
- `).all(e4.now()).map(e=>e.id)))tu.has(e)||tc(e);return Promise.all(e).then(()=>void 0)}async function tl(e,t={}){let n=e4.control.cancel(e,t);return"cancel_requested"!==n.outcome||n.replayed||e7.get(e)?.controller.abort(),n.abandoned&&await te(n.abandoned),"cancelled"!==n.outcome||n.replayed||e6(e,!0),n}let tu=new Map;function tc(e){let t=tu.get(e);if(t)return t;let n=e5(e).catch(e=>{console.error("Agent dispatch failed unexpectedly:",e)}).finally(()=>{tu.get(e)===n&&tu.delete(e)});return tu.set(e,n),n}let t_=new Set;function tp(e){let t=`finalization:${e}`,r=tu.get(t);if(r)return r;t_.add(e);let i=eo(e).then(e=>{if(e&&"preparing"!==e.state)for(let t of function(e,t=Date.now()){return n.engine.transaction(()=>{let r,i=X(e);if(!i||"preparing"===i.state)return[];let a=n.engine.getWorkRequest(i.decision_request_id);if(!a)return[];let o=em({key:`continuation:v1:finalization:${i.id}`,coordinatorId:i.coordinator_agent_id,conversationId:i.conversation_id,sourceEventId:i.decision_event_id,parent:a,intent:["committed"===i.state?"[Finalization committed] The reviewed manifest was committed.":`[Finalization ${i.state}] The reviewed manifest was not committed.`,(r=[`Finalization: ${i.id}`,`Implementation: ${i.implementation_request_id}`,`Review: ${i.review_request_id}`,`State: ${i.state}`],"committed"===i.state?r.push(`Commit: ${i.commit_id}`,`Tree: ${i.tree_id}`,`Manifest: ${i.result_manifest_digest}`,`Files: ${i.file_count}`):i.reason_code&&r.push(`Reason: ${i.reason_code}${i.reason?` - ${i.reason}`:""}`),r.join("\n")),ef].join("\n\n"),continues:"finalization",subjects:[i.implementation_request_id,i.review_request_id],now:t});return o&&"queued"===o.state?[o.id]:[]})}(e.id))tc(t)}).catch(e=>{console.error("Finalization failed unexpectedly:",e instanceof Error?e.message:"unknown error")}).finally(()=>{tu.delete(t)});return tu.set(t,i),i}let tf=eD(n.default,n.engine);function tg(e){return Promise.all(tf.advance(e).map(tc)).then(()=>void 0)}async function tm(e,t,r=null,i){let{hopRequestId:s,replayed:d}=n.default.transaction(()=>{let n=tf.requestCancel(e,t,r);return i?.(n.exchange),n}).immediate();if(s){let e=n.engine.getWorkRequest(s);if(e&&!a.TERMINAL_STATES.includes(e.state))try{await tl(s,{actor:t,reason:r??"The exchange was cancelled."})}catch(e){if(!(e instanceof o.ControlError))throw e}}return tf.advance(e),{exchange:tf.view(e),replayed:d}}let th=["attempt_started","attempt_finished","session_bound","backfilled","runtime_progress","policy_selected","dispatch_claimed","dispatch_released","dispatch_deferred","dispatch_lease_taken_over","launch_intent_recorded","reconcile_decided","reconcile_deferred","attention_set","attempt_abandoned","external_cancel","late_result_recorded"];function tk(e){return e.legacy_agent_request_id??e.id}function tw(e,t){eZ(e);let r=n.default.prepare("SELECT id FROM work_requests WHERE legacy_agent_request_id = ?").get(t),i=n.engine.getWorkRequest(r?r.id:t),a=!!i&&"service"===e.kind&&!!eN(i);if(!i||!(a?tE(e,i):eX(i.source_conversation_id,e)||tE(e,i)))throw new eK("request_not_found","No request with that id is visible to this principal.");return i}function tE(e,t){if(!eN(t))return!1;let n=tf.forHopRequest(t.id);return!!n&&n.requester_kind===e.kind&&n.requester_id===e.id&&("service"!==e.kind||ty(e,n))}function ty(e,t){let r=(0,ez.loadServiceGrants)();if("absent"===r.state||"invalid"===r.state)return!1;let i=r.grants.get(e.id),a=t.idempotency_key.startsWith(ez.MESSAGE_KEY_PREFIX)?"sessions:message":"exchanges:read",o=e=>!!i?.get(e)?.has(a)&&!!n.bots.getById(e);return o(t.source_agent_id)&&(null===t.destination_agent_id||o(t.destination_agent_id))}let tv={agent:"agent",bot:"direct",group:"group"};e.s(["AgentApiError",0,eK,"MCP_IDEMPOTENCY_PREFIX",0,"mcp:","acceptAgentMessage",0,function(e,t,n){let r;if(eZ(e),!eV(t.agentId))throw new eK("invalid_request","agentId is required.");if(!eV(t.content))throw new eK("invalid_request","content is required.");if(!eV(t.idempotencyKey)||t.idempotencyKey.length>200)throw new eK("invalid_request","An idempotency key (1-200 characters) is required.");if(void 0!==t.conversationId&&null!==t.conversationId&&!eV(t.conversationId))throw new eK("invalid_request","conversationId must be a non-empty string when present.");try{r=(0,l.acceptConversationMessage)({surface:"api",requester:e,idempotencyKey:t.idempotencyKey,conversation:t.conversationId?{id:t.conversationId}:{create:!0},content:t.content,fingerprint:[t.agentId,t.conversationId??null,t.content],route:()=>({deliveries:[{agentId:t.agentId}]}),beforeCommit:n,dispatch:e0})}catch(e){if(e instanceof l.IntakeError)throw new eK(eQ[e.code],"intake_failed"===e.code?"The request could not be processed.":e.message);throw e}let i=r.requests[0];return{accepted:{requestId:i?tk(i):r.requestIds[0],conversationId:r.conversationId,acceptedMessageId:r.acceptedMessageId,state:i?eY(i.state):"accepted",replayed:r.replayed},dispatched:r.dispatched}},"apiStateOf",0,eY,"cancelExchangeCommand",0,tm,"createExchangeCommand",0,function(e){let{exchange:t,created:n}=tf.create(e),r=tg(t.id);return{exchange:tf.view(t.id),created:n,dispatched:r}},"decideWakeGrantCommand",0,function(e,t,n){let r=H({wakeId:e,decision:t,caller:n});if(r.request&&r.runnable&&tc(r.request.id),r.request&&r.ended)for(let e of ew(r.request.id))tc(e);return r},"dispatchExchange",0,tg,"exchanges",0,tf,"getAgentRequest",0,function(e,t){var r;let i,a,o,s,d,l,u=(i=(r=tw(e,t)).result?JSON.parse(r.result):null,s=(o=(a=eN(r)?.hop==="ask"?tf.forHopRequest(r.id):void 0)?i?.answer_message_id:i?.reply_message_id)?n.default.prepare("SELECT id, content FROM messages WHERE id = ?").get(o):void 0,d=a?n.default.prepare("SELECT id FROM messages WHERE conversation_id = ? AND request_id = ? AND sender_kind = ? ORDER BY rowid ASC LIMIT 1").get(a.origin_conversation_id,r.id,a.requester_kind):void 0,l="failed"===r.state||"cancelled"===r.state,{requestId:tk(r),conversationId:a?a.origin_conversation_id:r.source_conversation_id,agentId:r.target_agent_id,acceptedMessageId:d?d.id:r.source_event_id,state:eY(r.state),reply:s?{messageId:s.id,content:s.content}:null,failure:l?{code:r.error_code??r.state,message:r.error_message??""}:null,events:n.engine.listEvents(r.id).flatMap(e=>{let t=function(e){if("state_changed"===e.type){let t=e.data?JSON.parse(e.data).to:void 0;return"running"===t?"dispatched":"completed"===t?"completed":"failed"===t||"cancelled"===t?"failed":t??null}return th.includes(e.type)?null:e.type}(e);return t?[{type:t,at:e.created_at}]:[]}),createdAt:r.created_at,updatedAt:r.updated_at});return"service"!==e.kind?u:eP().deep(u)},"getAuthorizedWorkRequest",0,tw,"getConversation",0,function(e,t){eZ(e);let r=n.default.prepare("SELECT * FROM conversations WHERE id = ?").get(t);if(!r||!eX(r.id,e))throw new eK("conversation_not_found","No conversation with that id is visible to this principal.");let i=n.default.prepare("SELECT participant_kind, participant_id, joined_at FROM conversation_participants WHERE conversation_id = ? ORDER BY joined_at ASC, rowid ASC").all(r.id),a=function(e){if("service"!==e.kind)return()=>!1;let t=new Map;return n=>{if(!n)return!1;let r=t.get(n);if(void 0===r){let i=tf.forHopRequest(n);r=!!i&&!(i.requester_kind===e.kind&&i.requester_id===e.id&&ty(e,i)),t.set(n,r)}return r}}(e),o=n.default.prepare("SELECT * FROM messages WHERE conversation_id = ? ORDER BY rowid ASC").all(r.id).filter(e=>!a(e.request_id)),s={conversationId:r.id,type:tv[r.type]??"agent",origin:r.origin_kind&&r.origin_id?{kind:r.origin_kind,id:r.origin_id}:null,participants:i.map(e=>({kind:e.participant_kind,id:e.participant_id,joinedAt:e.joined_at})),messages:o.map((e,t)=>{var n,i;let a;return{messageId:e.id,seq:t+1,sender:(n=e,i=r,a=n.sender_kind??("bot"===n.sender_type?"bot":"person"),n.sender_id?{kind:a,id:n.sender_id}:"bot"!==a&&i.origin_kind===a&&i.origin_id?{kind:a,id:i.origin_id}:{kind:a,id:"unknown"}),content:e.content,requestId:e.request_id,createdAt:e.created_at}}),events:n.projector.listConversationEvents(r.id).filter(e=>!a(e.requestId)).map((e,t)=>({...e,seq:t+1}))};return"service"!==e.kind?s:eP().deep(s)},"getExchangeView",0,function(e){return tf.view(e)},"isPrincipalKind",0,eJ,"recoverCoordinatorLoops",0,function(){return Promise.all([td(),...(function(e=Date.now()){let t=n.default.prepare("SELECT request_id AS id FROM terminal_followups WHERE done_at IS NULL ORDER BY created_at ASC, request_id ASC").all(),r=new Set;for(let n of t)for(let t of ew(n.id,e))r.add(t);for(let e of n.default.prepare(`
87
- SELECT w.id FROM work_requests w JOIN terminal_followups f ON f.request_id = w.parent_request_id
88
- WHERE w.state = 'queued' AND (w.wake_event_id IS NOT NULL OR (w.requester_kind = ? AND w.requester_id = ?))
89
- ORDER BY w.created_at ASC, w.id ASC
90
- `).all(ed.kind,ed.id))r.add(e.id);return[...r]})().map(tc),...es().map(tp),...(function(){let e=[];for(let t of tf.openIds())try{e.push(...tf.advance(t))}catch(e){console.error("Exchange recovery failed:",e instanceof Error?e.message:"unknown error")}return e})().map(tc)]).then(()=>void 0)},"retryWakeCommand",0,function(e){let t=M(e);return t.request?.state==="queued"&&tc(t.request.id),t},"revokeWakeGrantCommand",0,function(e,t){return(0,y.revokeWakeGrant)(e,t)},"samePrincipal",0,function(e,t){return e.kind===t.kind&&e.id===t.id},"startAgentDispatch",0,tc,"sweepDispatch",0,td],45383)},27510,9346,57281,54226,53059,e=>{"use strict";var t=e.i(22734),n=e.i(14747),r=e.i(62349),i=e.i(51749),a=e.i(29370),o=e.i(54799),s=e.i(67505);let d="AGENT_DECK_RUN_TOKEN",l=["ended","error","died","canceled"],u=["starting","running","ended","error","died","canceled"];class c extends Error{code;status;deckCode;constructor(e,t,n=null,r=null){super(t.slice(0,300)),this.name="AgentDeckApiError",this.code=e,this.status=n,this.deckCode=r}}let _={agent_deck_token_missing:`Agent Deck API token is not configured on the Botmancers server (set ${d}).`,agent_deck_unauthorized:`Agent Deck rejected the Botmancers run token (check ${d} and that its grant is not revoked or expired).`,agent_deck_forbidden:"Agent Deck refused this run for the Botmancers grant (enable runs and finalization on the grant and allow this deck).",agent_deck_unreachable:"The Agent Deck server is unreachable at the workspace Agent Deck URL (start it or correct the URL).",agent_deck_rejected:"Agent Deck rejected the request.",agent_deck_invalid_response:"Agent Deck returned an unexpected response."};function p(){let e=process.env[d];return"string"==typeof e&&e.trim().length>0?e.trim():null}function f(){let e=p();return e?(0,o.createHash)("sha256").update(`botmancers-grant-v1:${e}`).digest("hex").slice(0,16):null}function g(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:null}function m(e){return"string"==typeof e&&e.length>0?e:null}async function h(e,t,n={}){var r,i,a;let o,d=p();if(!d)throw new c("agent_deck_token_missing",_.agent_deck_token_missing);let l={authorization:`Bearer ${d}`,accept:"application/json"};n.idempotencyKey&&(l["idempotency-key"]=n.idempotencyKey),void 0!==n.body&&(l["content-type"]="application/json");let u=`${(0,s.getAgentDeckServerUrl)()}${t}`;try{o=await (r={method:e,headers:l,...void 0!==n.body?{body:JSON.stringify(n.body)}:{},...n.signal?{signal:n.signal}:{}},fetch(u,r).then(e=>({status:e.status,json:()=>e.json()})))}catch{throw new c("agent_deck_unreachable",_.agent_deck_unreachable)}let f=null;try{f=g(await o.json())}catch{f=null}if(o.status<200||o.status>=300||f?.success!==!0){let e,t;if(o.status>=200&&o.status<300)throw new c("agent_deck_invalid_response",_.agent_deck_invalid_response,o.status);throw i=o.status,a=f,t=(e=m(a?.error_code))&&/^[A-Z][A-Z0-9_]{0,63}$/.test(e)?e:null,401===i?new c("agent_deck_unauthorized",_.agent_deck_unauthorized,i,t):403===i?new c("agent_deck_forbidden",`${_.agent_deck_forbidden}${t?` (${t})`:""}`,i,t):new c("agent_deck_rejected",`Agent Deck rejected the request (${i}${t?` ${t}`:""}).`,i,t)}let k=g(f.data);if(!k)throw new c("agent_deck_invalid_response",_.agent_deck_invalid_response,o.status);return k}function k(e){return new c("agent_deck_invalid_response",`${_.agent_deck_invalid_response} (${e})`)}function w(e){if("string"!=typeof e||!u.includes(e))throw k("run state");return e}let E=/^[0-9a-f]{64}$/,y=/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/,v=/^bl_[0-9a-f]{24}$/;function I(e){var t;let n=g(e);if(!n||Object.keys(n).some(e=>!["path","sha256","mode"].includes(e)))throw k("manifest entry");if(!(!("string"!=typeof(t=n.path)||0===t.length||t.length>1024||t.startsWith("/")||t.includes("\\")||/^[A-Za-z]:/.test(t)||t.includes("\0"))&&t.split("/").every(e=>e.length>0&&"."!==e&&".."!==e&&".git"!==e)))throw k("manifest path");let r=null===n.sha256&&null===n.mode,i="string"==typeof n.sha256&&E.test(n.sha256)&&("100644"===n.mode||"100755"===n.mode);if(!r&&!i)throw k("manifest digest or mode");return{path:n.path,sha256:n.sha256,mode:n.mode}}async function q(e,t){let n=await h("POST","/api/agent-runs",{body:e,idempotencyKey:t}),r=m(n.runId);if(!r)throw k("runId");return{runId:r,state:w(n.state)}}async function A(e){let t=await h("GET",`/api/agent-runs/${encodeURIComponent(e)}`);if(!m(t.runId)||!m(t.deckId)||!m(t.client)||"edit"!==t.tools&&"readonly"!==t.tools)throw k("run status");return{runId:m(t.runId),deckId:m(t.deckId),client:m(t.client),tools:t.tools,state:w(t.state),sessionId:m(t.sessionId),finalization:function(e){if(null==e)return null;let t=g(e);if(!t||"string"!=typeof t.baselineRef||!v.test(t.baselineRef)||"string"!=typeof t.baselineDigest||!E.test(t.baselineDigest)||!["prepared","finalizing","finalized"].includes(String(t.state)))throw k("finalization status");let n="string"==typeof t.commit&&y.test(t.commit)?t.commit:null;return{baselineRef:t.baselineRef,baselineDigest:t.baselineDigest,state:t.state,commit:n}}(t.finalization)}}async function R(e,t){let n=t?`?after=${encodeURIComponent(t)}`:"",r=await h("GET",`/api/agent-runs/${encodeURIComponent(e)}/events${n}`);if(!Array.isArray(r.events))throw k("events");return{runId:m(r.runId)??e,state:w(r.state),events:r.events.filter(e=>!!g(e)&&"string"==typeof e.type),nextCursor:"string"==typeof r.nextCursor?r.nextCursor:t??"0"}}async function b(e){return w((await h("POST",`/api/agent-runs/${encodeURIComponent(e)}/cancel`)).state)}async function S(e){let t=await h("GET",`/api/agent-runs/${encodeURIComponent(e)}/changes`);if("string"!=typeof t.baselineRef||!v.test(t.baselineRef))throw k("baselineRef");if("string"!=typeof t.baselineDigest||!E.test(t.baselineDigest))throw k("baselineDigest");if("string"!=typeof t.baseCommit||!y.test(t.baseCommit))throw k("baseCommit");if("string"!=typeof t.manifestDigest||!E.test(t.manifestDigest))throw k("manifestDigest");if(!Array.isArray(t.files))throw k("files");return{runId:m(t.runId)??e,baselineRef:t.baselineRef,baselineDigest:t.baselineDigest,baseCommit:t.baseCommit,files:t.files.map(I),manifestDigest:t.manifestDigest}}async function x(e,t,n){let r=await h("POST",`/api/agent-runs/${encodeURIComponent(e)}/finalize`,{body:t,idempotencyKey:n});if("finalized"!==r.finalizationState||"string"!=typeof r.commit||!y.test(r.commit)||"string"!=typeof r.tree||!y.test(r.tree)||"string"!=typeof r.manifestDigest||!E.test(r.manifestDigest))throw k("finalize result");return{runId:m(r.runId)??e,finalizationState:"finalized",commit:r.commit,tree:r.tree,..."string"==typeof r.parent&&y.test(r.parent)?{parent:r.parent}:{},manifestDigest:r.manifestDigest,..."number"==typeof r.fileCount?{fileCount:r.fileCount}:{},..."string"==typeof r.reviewId?{reviewId:r.reviewId}:{}}}e.s(["AGENT_DECK_API_MESSAGES",0,_,"AGENT_DECK_TERMINAL_STATES",0,l,"AgentDeckApiError",0,c,"agentDeckGrantFingerprint",0,f,"cancelAgentDeckRun",0,b,"finalizeAgentDeckRun",0,x,"getAgentDeckRun",0,A,"getAgentDeckRunChanges",0,S,"getAgentDeckRunEvents",0,R,"hasAgentDeckRunToken",0,function(){return null!==p()},"startAgentDeckRun",0,q],9346);var T=e.i(39229),C=e.i(46786),N=e.i(11626),D=e.i(35613);class O extends Error{code;constructor(e,t){super(t),this.name="ControlError",this.code=e}}let L=["queued","blocked","running","waiting"];function $(e){try{let t=JSON.parse(e.launch_snapshot);return t&&"object"==typeof t?t:{}}catch{return{}}}function W(e,t,n={}){let r=n.now??Date.now,i=n.cancelGraceMs??3e4,a=e.prepare("SELECT * FROM work_attempts WHERE request_id = ? AND finished_at IS NULL"),s=e.prepare("SELECT COUNT(*) AS n FROM work_attempts WHERE request_id = ?"),d=e.prepare("SELECT owner, token, expires_at FROM dispatch_leases WHERE request_id = ?"),l=e.prepare("SELECT 1 FROM engine_events WHERE attempt_id = ? AND type = 'runtime_started' LIMIT 1");function u(e){let n=t.getWorkRequest(e);if(!n)throw new O("not_found",`No work request ${e}.`);return n}function c(e,t,n,r){if(r&&(!e||!r(e,t,n)))throw new O("forbidden",`Not allowed to ${n} this request.`)}function _(e){return Math.max(e.attempt_count,s.get(e.id).n)}function p(t,n){e.prepare("UPDATE dispatch_attention SET cleared_at = ? WHERE request_id = ? AND cleared_at IS NULL").run(n,t)}function f(n,r,i){let a=d.get(n);a&&(e.prepare("DELETE FROM dispatch_leases WHERE request_id = ?").run(n),t.appendEvent(n,{type:"dispatch_released",data:{owner:a.owner,outcome:r,forced:!0},now:i}))}function g(e,n,r){let i=a.get(e.id);if(!i)return null;let o=$(i).transport;return t.finishAttempt(i.id,{outcome:"timed_out"===n?"timed_out":"cancelled"===n?"cancelled":"interrupted",errorCategory:"abandoned",errorMessage:{cancelled:"The request was cancelled while this Attempt was open; its result is no longer awaited.",timed_out:"The Attempt passed its deadline; its result is no longer awaited.",retried:"An operator retried the request; this Attempt is superseded."}[n],now:r}),t.appendEvent(e.id,{type:"attempt_abandoned",attemptId:i.id,data:{reason:n,attempt_number:i.attempt_number,external_run_id:i.external_run_id,transport:"string"==typeof o?o:null},now:r}),{requestId:e.id,attemptId:i.id,externalRunId:i.external_run_id,transport:"string"==typeof o?o:null,reason:n,launched:!!i.external_run_id||!!i.external_session_id||!!l.get(i.id)}}function m(n,r,i,a){let o=r?`${r.kind}:${r.id}`:null;e.prepare("UPDATE work_requests SET cancel_requested_at = ?, cancel_requested_by = ?, cancel_reason = ?, updated_at = ? WHERE id = ? AND cancel_requested_at IS NULL").run(a,o,i,a,n.id),t.appendEvent(n.id,{type:"cancel_requested",data:{by:o,reason:i,state:n.state},now:a})}function h(e,n,r={}){return t.transitionWorkRequest(e.id,{from:e.state,to:"cancelled",reason:"cancel_requested",errorCode:"cancelled",errorMessage:e.cancel_reason??"The request was cancelled.",data:r,now:n})}function k(e,n,r={}){return t.transitionWorkRequest(e.id,{from:e.state,to:"failed",reason:"timed_out",errorCode:"timed_out",errorMessage:"The request passed its deadline.",data:{...r,deadline_at:e.deadline_at},now:n})}function w(n,r,i){let a=(0,N.storedRetryPolicy)(n.retry_policy),s=(0,N.classifyFailure)(r.category,r.code),d=_(n),l=(0,N.decideRetry)({policy:a,attemptCount:d,disposition:s,deadlineAt:n.deadline_at,now:i}),u=r.attention&&"retry"===l.action?{action:"attention"}:l,c={category:r.category,disposition:s,attempt_count:d,max_attempts:a.max_attempts};switch(u.action){case"retry":{e.prepare("UPDATE work_requests SET next_eligible_at = ? WHERE id = ?").run(u.nextEligibleAt,n.id);let a=t.transitionWorkRequest(n.id,{from:"running",to:"queued",reason:"retry_scheduled",data:{...c,retry:u.retry,delay_ms:u.delayMs,next_eligible_at:u.nextEligibleAt,error_code:r.errorCode},now:i});return{outcome:"retry_scheduled",decision:u,request:a}}case"deadline":return{outcome:"timed_out",decision:u,request:k(n,i,c)};case"attention":{let a=r.attention??`failure:${r.category??"unknown"}`;return e.prepare("INSERT INTO dispatch_attention (id, request_id, attempt_id, reason, detail, created_at) VALUES (?, ?, NULL, ?, ?, ?)").run((0,o.randomUUID)(),n.id,a,r.code,i),t.appendEvent(n.id,{type:"attention_set",data:{reason:a,detail:r.code},now:i}),{outcome:"attention",decision:u,request:t.transitionWorkRequest(n.id,{from:"running",to:"waiting",reason:`manual_attention:${r.attention??r.category??"unknown"}`,data:c,now:i})}}case"exhausted":if(a.max_attempts>1)return{outcome:"retries_exhausted",decision:u,request:t.transitionWorkRequest(n.id,{from:"running",to:"failed",reason:"retries_exhausted",errorCode:r.errorCode,errorMessage:r.errorMessage,data:c,now:i})};case"fail":return{outcome:"failed",decision:u,request:t.transitionWorkRequest(n.id,{from:"running",to:"failed",errorCode:r.errorCode,errorMessage:r.errorMessage,data:"fail"===u.action?c:{},now:i})}}}let E={now:r,cancelGraceMs:i,cancel:(e,n={})=>t.transaction(()=>{let t=u(e);if(c(n.actor,t,"cancel",n.authorize),D.TERMINAL_STATES.includes(t.state))return{outcome:"already_terminal",state:t.state,replayed:!0,abandoned:null};let i=n.now??r();if("running"===t.state)return null!==t.cancel_requested_at?{outcome:"cancel_requested",state:"running",replayed:!0,abandoned:null}:(m(t,n.actor,n.reason??null,i),{outcome:"cancel_requested",state:"running",replayed:!1,abandoned:null});null===t.cancel_requested_at&&m(t,n.actor,n.reason??null,i);let a=u(e),o=g(a,"cancelled",i);return p(e,i),f(e,"cancelled",i),{outcome:"cancelled",state:h(a,i,{from_state:t.state}).state,replayed:!1,abandoned:o}}),retry:(n,i={})=>t.transaction(()=>{let a=u(n);if(c(i.actor,a,"retry",i.authorize),D.TERMINAL_STATES.includes(a.state))return{outcome:"already_terminal",state:a.state,abandoned:null};if("queued"===a.state)return{outcome:"already_queued",state:"queued",abandoned:null};if("waiting"!==a.state||null!==a.cancel_requested_at)return{outcome:"not_retryable",state:a.state,abandoned:null};let o=(0,N.storedRetryPolicy)(a.retry_policy),s=_(a);if(s>=o.max_attempts)return{outcome:"retries_exhausted",state:a.state,abandoned:null};let d=i.now??r();if(null!==a.deadline_at&&d>=a.deadline_at)return{outcome:"not_retryable",state:a.state,abandoned:null};let l=g(a,"retried",d);return p(n,d),e.prepare("UPDATE work_requests SET next_eligible_at = ? WHERE id = ?").run(d,n),{outcome:"retry_scheduled",state:t.transitionWorkRequest(n,{from:"waiting",to:"queued",reason:"retry_scheduled",data:{manual:!0,by:i.actor?`${i.actor.kind}:${i.actor.id}`:null,attempt_count:s,max_attempts:o.max_attempts,retry:s,delay_ms:0,next_eligible_at:d},now:d}).state,abandoned:l}}),timeOut:(e,n)=>t.transaction(()=>{let i=t.getWorkRequest(e),a=n??r();if(!i||!L.includes(i.state)||null===i.deadline_at||a<i.deadline_at)return null;let o=g(i,"timed_out",a);return p(e,a),f(e,"timed_out",a),k(i,a,{from_state:i.state}),{requestId:e,outcome:"timed_out",abandoned:o}}),settleFailure:(e,n,i)=>t.transaction(()=>{let t=u(e);if("running"!==t.state)throw new D.EngineStoreError("stale_state",`Work request ${e} is ${t.state}, not running.`);return w(t,n,i??r())}),enforceRequest:(e,n,o={})=>t.transaction(()=>{let s,l=t.getWorkRequest(e),c=n??r();if(!l||!L.includes(l.state)||null!==l.legacy_agent_request_id)return null;if(null!==l.deadline_at&&c>=l.deadline_at)return E.timeOut(e,c);if("running"!==l.state)return null;if(null!==l.cancel_requested_at){let t=d.get(e);if(!(!0===o.force||!t||t.expires_at<=c)&&c-l.cancel_requested_at<i)return null;let n=g(l,"cancelled",c);return f(e,"cancelled",c),h(l,c,{abandoned:null!==n}),{requestId:e,outcome:"cancelled",abandoned:n}}let _=a.get(e),p=_&&"number"==typeof(s=$(_).deadline_at)?s:null;if(!_||null===p||c<p)return null;let m=g(l,"timed_out",c);f(e,"attempt_timed_out",c);let k=w(u(e),{category:"timed_out",code:null,errorCode:"timed_out",errorMessage:"The Attempt passed its deadline."},c);return{requestId:e,outcome:k.outcome,abandoned:m}}),dueRequests(t){let n=t??r();return e.prepare(`
91
- SELECT id FROM work_requests
92
- WHERE state IN ('queued', 'blocked', 'running', 'waiting') AND legacy_agent_request_id IS NULL AND executor = 'dispatcher'
93
- AND ((deadline_at IS NOT NULL AND deadline_at <= ?) OR state = 'running')
94
- ORDER BY created_at ASC, id ASC
95
- `).all(n).map(e=>e.id)},enforceDue(e){let t=e??r(),n=[];for(let e of E.dueRequests(t)){let r=E.enforceRequest(e,t);r&&n.push(r)}return n},attemptDeadlineFor:(e,t)=>(0,N.attemptDeadline)((0,N.storedRetryPolicy)(e.retry_policy),e.deadline_at,t),attemptsUsed:_};return E}e.s(["ControlError",0,O,"createRequestControl",0,W],57281);let M="'grant_requested', 'grant_approved', 'grant_denied', 'grant_revoked'",F=Object.freeze({maxGlobal:4,maxPerTarget:1,leaseMs:6e4,heartbeatMs:15e3,deferMs:5e3,cancelGraceMs:3e4}),H={maxGlobal:"BOTMANCERS_DISPATCH_MAX_GLOBAL",maxPerTarget:"BOTMANCERS_DISPATCH_MAX_PER_TARGET",leaseMs:"BOTMANCERS_DISPATCH_LEASE_MS",heartbeatMs:"BOTMANCERS_DISPATCH_HEARTBEAT_MS",deferMs:"BOTMANCERS_DISPATCH_DEFER_MS",cancelGraceMs:"BOTMANCERS_DISPATCH_CANCEL_GRACE_MS"},U=Object.freeze({maxGlobal:F.maxGlobal,maxPerTarget:F.maxPerTarget});class j extends Error{requestId;constructor(e){super(`The dispatch lease for ${e} is no longer held.`),this.name="LeaseLostError",this.requestId=e}}let P=[{status:400,code:/.*/},{status:404,code:/^DECK_NOT_FOUND$/},{status:422,code:/^(WORKSPACE_[A-Z0-9_]+|PROFILE_UNSUPPORTED|RESUME_UNVERIFIED|FINALIZATION_INVALID)$/},{status:409,code:/^INDEX_DIRTY$/},{status:503,code:/^CLIENT_UNAVAILABLE$/}];function z(e){return P.some(t=>t.status===e.status&&t.code.test(e.code??""))}function B(e){switch(e.kind){case"no_grant":case"unauthorized":case"forbidden":return!0;case"rejected":return z(e);default:return!1}}function G(e){let t=e.correlation.attemptId;return t?`botmancers-attempt-${t}`:`botmancers-direct-${(0,o.randomUUID)()}`}function K(e,t){if(e instanceof c)return(0,a.attemptFailure)(e instanceof c?"agent_deck_token_missing"===e.code||"agent_deck_unauthorized"===e.code||"agent_deck_forbidden"===e.code||"agent_deck_unreachable"===e.code?"unavailable":"agent_deck_invalid_response"===e.code?"result_contract":t:t,`[${e.code}${e.deckCode?` ${e.deckCode}`:""}] ${e.message}`,e.code);return(0,a.attemptFailure)(t,e instanceof Error?e.message:String(e))}e.s(["LeaseLostError",0,j,"createDispatcher",0,function(e,t,n={}){let r=n.owner??`${C.default.hostname()}:${process.pid}:${(0,o.randomUUID)().slice(0,8)}`,i={...function(e=process.env){let t={...F};for(let n of Object.keys(H)){let r=e[H[n]];if(void 0===r||!/^\d+$/.test(r.trim()))continue;let i=Number(r.trim());Number.isSafeInteger(i)&&i>0&&(t[n]=i)}return t.maxGlobal=Math.min(t.maxGlobal,U.maxGlobal),t.maxPerTarget=Math.min(t.maxPerTarget,U.maxPerTarget),t}(),...n.config??{}},a=n.now??Date.now,s=W(e,t,{now:a,cancelGraceMs:i.cancelGraceMs}),d=e.prepare("SELECT COUNT(*) AS n FROM dispatch_leases"),l=e.prepare("SELECT COUNT(*) AS n FROM dispatch_leases WHERE target_agent_id = ?"),u=e.prepare("SELECT * FROM dispatch_attention WHERE request_id = ? AND cleared_at IS NULL"),c=e.prepare(`SELECT type, data FROM engine_events WHERE request_id = ? AND type NOT IN (${M}) ORDER BY sequence DESC LIMIT 1`),_=e.prepare(`
96
- SELECT w.id FROM work_requests w
97
- WHERE w.state = 'queued' AND w.executor = 'dispatcher'
98
- AND (SELECT e.type FROM engine_events e WHERE e.request_id = w.id AND e.type NOT IN (${M}) ORDER BY e.sequence DESC LIMIT 1) = 'dispatch_deferred'
99
- ORDER BY w.created_at ASC, w.id ASC
100
- `),p=e.prepare("SELECT 1 FROM dispatch_leases WHERE request_id = ? AND token = ?"),f=e.prepare("SELECT decision FROM wake_safety_decisions WHERE request_id = ? ORDER BY sequence DESC LIMIT 1"),g=e.prepare("SELECT status FROM wakes WHERE id = ?"),m=e.prepare(`
101
- SELECT w.id FROM work_requests w
102
- WHERE w.state = 'queued' AND w.legacy_agent_request_id IS NULL AND w.executor = 'dispatcher' AND w.id <> ?
103
- AND (w.created_at < ? OR (w.created_at = ? AND w.rowid < (SELECT rowid FROM work_requests WHERE id = ?)))
104
- AND (w.next_eligible_at IS NULL OR w.next_eligible_at <= ?)
105
- AND (w.deadline_at IS NULL OR w.deadline_at > ?)
106
- AND NOT EXISTS (SELECT 1 FROM dispatch_attention a WHERE a.request_id = w.id AND a.cleared_at IS NULL)
107
- AND (SELECT d.decision FROM wake_safety_decisions d WHERE d.request_id = w.id ORDER BY d.sequence DESC LIMIT 1) = 'allowed'
108
- AND (w.wake_event_id IS NULL OR EXISTS (SELECT 1 FROM wakes k WHERE k.id = w.wake_event_id AND k.status = 'accepted'))
109
- AND (SELECT COUNT(*) FROM dispatch_leases l WHERE l.target_agent_id = w.target_agent_id) < ?
110
- ORDER BY w.created_at ASC, w.rowid ASC
111
- LIMIT 1
112
- `);function h(e,n,r,o){let s=c.get(e.id);return(s?.type==="dispatch_deferred"&&s.data?JSON.parse(s.data).reason:null)!==n&&t.appendEvent(e.id,{type:"dispatch_deferred",data:{reason:n,active_global:r.global,active_target:r.target,max_global:i.maxGlobal,max_per_target:i.maxPerTarget,...o?{waiting_behind:o}:{}},now:a()}),o?{ok:!1,reason:n,blockedBy:o}:{ok:!1,reason:n}}function k(e){if(!p.get(e.requestId,e.token))throw new j(e.requestId)}let w={owner:r,config:i,now:a,control:s,claim:(n,c={})=>t.transaction(()=>{let _=t.getWorkRequest(n);if(!_||"queued"!==_.state||void 0!==c.expectedVersion&&_.version!==c.expectedVersion)return{ok:!1,reason:"not_queued"};let p=a();if(null!==_.deadline_at&&p>=_.deadline_at)return s.timeOut(n,p),{ok:!1,reason:"timed_out"};if(null!==_.next_eligible_at&&p<_.next_eligible_at)return{ok:!1,reason:"not_eligible"};if(u.get(n))return{ok:!1,reason:"attention"};let k=function(e){let t=f.get(e.id);if(t?.decision!=="allowed")return"The request has no allowed safety decision.";if(null!==e.wake_event_id){let t=g.get(e.wake_event_id);if(t?.status!=="accepted")return"The Wake that created this request was not accepted."}return null}(_);if(k)return t.transitionWorkRequest(n,{from:"queued",to:"failed",reason:"not_authorized",expectedVersion:_.version,errorCode:"not_authorized",errorMessage:k,now:p}),{ok:!1,reason:"not_authorized"};let w=(0,N.storedRetryPolicy)(_.retry_policy),E=s.attemptsUsed(_);if(E>=w.max_attempts)return t.transitionWorkRequest(n,{from:"queued",to:"failed",reason:"retries_exhausted",expectedVersion:_.version,errorCode:"retries_exhausted",errorMessage:"No Attempt is left in the retry budget.",data:{attempt_count:E,max_attempts:w.max_attempts},now:p}),{ok:!1,reason:"exhausted"};let y=d.get().n,v=l.get(_.target_agent_id).n;if(y>=i.maxGlobal)return h(_,"global_limit",{global:y,target:v});if(v>=i.maxPerTarget)return h(_,"target_limit",{global:y,target:v});let I=m.get(n,_.created_at,_.created_at,n,p,p,i.maxPerTarget);if(I)return h(_,"older_waiting",{global:y,target:v},I.id);let q={requestId:n,owner:r,token:(0,o.randomUUID)(),expiresAt:p+i.leaseMs};return e.prepare(`
113
- INSERT INTO dispatch_leases (request_id, target_agent_id, owner, token, acquired_at, heartbeat_at, expires_at)
114
- VALUES (?, ?, ?, ?, ?, ?, ?)
115
- `).run(n,_.target_agent_id,r,q.token,p,p,q.expiresAt),t.appendEvent(n,{type:"dispatch_claimed",data:{owner:r,lease_expires_at:q.expiresAt,active_global:y+1,active_target:v+1,attempt_number:E+1,max_attempts:w.max_attempts},now:p}),e.prepare("UPDATE work_requests SET attempt_count = ?, next_eligible_at = NULL WHERE id = ?").run(E+1,n),{ok:!0,lease:q,request:t.transitionWorkRequest(n,{from:"queued",to:"running",expectedVersion:_.version,data:c.data,now:p})}}),claimNext(t){let n=t??e.prepare(`
116
- SELECT id FROM work_requests WHERE state = 'queued' AND legacy_agent_request_id IS NULL AND executor = 'dispatcher'
117
- AND (next_eligible_at IS NULL OR next_eligible_at <= ?)
118
- ORDER BY created_at ASC, rowid ASC
119
- `).all(a()).map(e=>e.id),r="not_queued";for(let e of n){let t=w.claim(e);if(t.ok||"global_limit"===t.reason)return t;("target_limit"===t.reason||"older_waiting"===t.reason)&&(r=t.reason)}return{ok:!1,reason:r}},recordLaunchIntent:(n,i,s,d)=>t.transaction(()=>{k(n);let l=a(),u=d?(0,o.createHash)("sha256").update(d.body).digest("hex"):null;return e.prepare(`
120
- INSERT INTO attempt_launch_intents (attempt_id, request_id, transport, idempotency_key, body, body_hash, grant_fingerprint, owner, created_at)
121
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
122
- `).run(i,n.requestId,s,d?.idempotencyKey??null,d?.body??null,u,d?.grantFingerprint??null,r,l),t.appendEvent(n.requestId,{type:"launch_intent_recorded",attemptId:i,data:{transport:s,idempotency_key:d?.idempotencyKey??null,body_hash:u,grant_fingerprint:d?.grantFingerprint??null},now:l}),w.launchIntent(i)}),launchIntent:t=>e.prepare("SELECT * FROM attempt_launch_intents WHERE attempt_id = ?").get(t),heartbeat(t){let n=a(),r=n+i.leaseMs,o=1===e.prepare("UPDATE dispatch_leases SET heartbeat_at = ?, expires_at = ? WHERE request_id = ? AND token = ?").run(n,r,t.requestId,t.token).changes;return o&&(t.expiresAt=r),o},holds:e=>!!p.get(e.requestId,e.token),assertHeld(e){k(e)},release(n,i){t.transaction(()=>{k(n),e.prepare("DELETE FROM dispatch_leases WHERE request_id = ? AND token = ?").run(n.requestId,n.token),t.appendEvent(n.requestId,{type:"dispatch_released",data:{owner:r,outcome:i},now:a()})})},defer(n,o,s=null){t.transaction(()=>{k(n);let d=a();n.expiresAt=d+i.deferMs,e.prepare("UPDATE dispatch_leases SET heartbeat_at = ?, expires_at = ? WHERE request_id = ? AND token = ?").run(d,n.expiresAt,n.requestId,n.token),t.appendEvent(n.requestId,{type:"reconcile_deferred",attemptId:s,data:{owner:r,reason:o,retry_at:n.expiresAt},now:d})})},setAttention:(n,i)=>t.transaction(()=>{k(n);let s=a(),d=(0,o.randomUUID)();e.prepare("INSERT INTO dispatch_attention (id, request_id, attempt_id, reason, detail, created_at) VALUES (?, ?, ?, ?, ?, ?)").run(d,n.requestId,i.attemptId,i.reason,i.detail??null,s),t.appendEvent(n.requestId,{type:"attention_set",attemptId:i.attemptId,data:{reason:i.reason,detail:i.detail??null},now:s});let l=t.getWorkRequest(n.requestId);return l?.state==="running"&&t.transitionWorkRequest(n.requestId,{from:"running",to:"waiting",reason:`manual_attention:${i.reason}`,now:s}),e.prepare("DELETE FROM dispatch_leases WHERE request_id = ? AND token = ?").run(n.requestId,n.token),t.appendEvent(n.requestId,{type:"dispatch_released",data:{owner:r,outcome:"attention"},now:s}),u.get(n.requestId)}),attention:e=>u.get(e),recoverable(){let t=a(),n=[];for(let i of e.prepare("SELECT request_id, owner, token, expires_at FROM dispatch_leases ORDER BY acquired_at ASC, request_id ASC").all()){if(i.owner===r&&i.expires_at>t)continue;let e=i.expires_at<=t?"lease_expired":!function(e){let t=/^(.*):(\d+):[^:]+$/.exec(e);if(!t||t[1]!==C.default.hostname())return!1;let n=Number(t[2]);if(n===process.pid)return!1;try{return process.kill(n,0),!1}catch(e){return"ESRCH"===e.code}}(i.owner)?null:"owner_exited";e&&n.push({requestId:i.request_id,reason:e,priorToken:i.token,priorOwner:i.owner})}for(let t of e.prepare(`
123
- SELECT w.id FROM work_requests w
124
- WHERE w.state = 'running' AND w.legacy_agent_request_id IS NULL AND w.executor = 'dispatcher'
125
- AND NOT EXISTS (SELECT 1 FROM dispatch_leases l WHERE l.request_id = w.id)
126
- AND NOT EXISTS (SELECT 1 FROM dispatch_attention a WHERE a.request_id = w.id AND a.cleared_at IS NULL)
127
- ORDER BY w.updated_at ASC, w.id ASC
128
- `).all())n.push({requestId:t.id,reason:"unleased_running",priorToken:null,priorOwner:null});return n},takeOver:n=>t.transaction(()=>{let s=a(),d={requestId:n.requestId,owner:r,token:(0,o.randomUUID)(),expiresAt:s+i.leaseMs};if(n.priorToken){let t="lease_expired"===n.reason?"AND expires_at <= ?":"",i=[r,d.token,s,s,d.expiresAt,n.requestId,n.priorToken];if(t&&i.push(s),1!==e.prepare(`
129
- UPDATE dispatch_leases SET owner = ?, token = ?, acquired_at = ?, heartbeat_at = ?, expires_at = ?
130
- WHERE request_id = ? AND token = ? ${t}
131
- `).run(...i).changes)return null}else{let i=t.getWorkRequest(n.requestId);if(!i||"running"!==i.state||e.prepare("SELECT 1 FROM dispatch_leases WHERE request_id = ?").get(n.requestId)||u.get(n.requestId))return null;e.prepare(`
132
- INSERT INTO dispatch_leases (request_id, target_agent_id, owner, token, acquired_at, heartbeat_at, expires_at)
133
- VALUES (?, ?, ?, ?, ?, ?, ?)
134
- `).run(n.requestId,i.target_agent_id,r,d.token,s,s,d.expiresAt)}return t.appendEvent(n.requestId,{type:"dispatch_lease_taken_over",data:{owner:r,previous_owner:n.priorOwner,reason:n.reason},now:s}),d}),deferredRequestIds:()=>_.all().map(e=>e.id),leaseOf:t=>e.prepare("SELECT owner, token, expires_at FROM dispatch_leases WHERE request_id = ?").get(t)};return w},"decideRepostResult",0,function(e){switch(e.kind){case"accepted":return{action:"reattach"};case"unreachable":return{action:"defer",reason:"unreachable"};case"unauthorized":case"forbidden":case"no_grant":return{action:"attention",reason:"grant"};case"rejected":if(409===e.status&&"IDEMPOTENCY_CONFLICT"===e.code)return{action:"attention",reason:"idempotency_conflict"};if(z(e))return{action:"fail",category:"launch_failed",code:e.code??String(e.status)};if(null!==e.status&&e.status>=500)return{action:"defer",reason:"server_error"};return{action:"attention",reason:"unrecognized_response"};default:return{action:"attention",reason:"unrecognized_response"}}},"decideWithRunId",0,function(e){switch(e.kind){case"run":if("died"===e.state)return{action:"interrupted_attention",reason:"run_died"};return{action:"reattach"};case"not_found":return{action:"attention",reason:"run_not_found"};case"unauthorized":return{action:"attention",reason:"grant_expired"};case"forbidden":return{action:"attention",reason:"grant_scope"};case"no_grant":return{action:"attention",reason:"grant_unavailable"};case"unreachable":return{action:"defer",reason:"unreachable"};case"rejected":if(null!==e.status&&e.status>=500)return{action:"defer",reason:"server_error"};return{action:"attention",reason:"unrecognized_response"};default:return{action:"attention",reason:"unrecognized_response"}}},"decideWithoutRunId",0,function(e){return e.reconcilable?e.intent?.body&&e.intent.idempotency_key?e.currentGrantFingerprint?e.intent.grant_fingerprint!==e.currentGrantFingerprint?{action:"attention",reason:"grant_mismatch"}:{action:"repost"}:{action:"attention",reason:"grant_unavailable"}:{action:"attention",reason:"launch_intent_missing"}:{action:"interrupted",reason:"runtime_unobservable"}},"dispatchFault",0,function(e,t){},"launchRejectedBeforeWork",0,B],54226);let J=e=>l.includes(e);async function V(e){let t={state:"starting",result:null,resultMismatch:null,sessionId:null},n=null;for(;;){let r=await R(e,n);for(let e of r.events)"sessionId"in e&&"string"==typeof e.sessionId&&e.sessionId&&(t.sessionId=e.sessionId),"result"===e.type&&("string"==typeof e.result&&e.result.length>0?(t.result=e.result,t.resultMismatch=null):(t.result=null,t.resultMismatch=null===e.result?"null":Array.isArray(e.result)?"array":""===e.result?"empty string":typeof e.result));t.state=r.state;let i=r.nextCursor!==(n??"0")&&r.events.length>0;if(n=r.nextCursor,J(r.state)&&!i)return t;i||await new Promise(e=>setTimeout(e,1e3))}}async function X(e,t){if(!t?.finalization)return{baselineRef:null,baselineDigest:null,candidate:{ok:!1,code:"FINALIZATION_NOT_PREPARED",message:"The run reported no finalization baseline."}};let n={baselineRef:t.finalization.baselineRef,baselineDigest:t.finalization.baselineDigest};try{let r=await S(e);if(r.baselineRef!==t.finalization.baselineRef||r.baselineDigest!==t.finalization.baselineDigest)return{...n,candidate:{ok:!1,code:"BASELINE_MISMATCH",message:"Agent Deck returned candidate evidence for a different baseline."}};return{...n,candidate:{ok:!0,manifest:{baselineRef:r.baselineRef,baselineDigest:r.baselineDigest,baseCommit:r.baseCommit,manifestDigest:r.manifestDigest,files:r.files}}}}catch(r){let e=r instanceof c?r.deckCode??r.code:"agent_deck_invalid_response",t=r instanceof c?r.message:"The candidate manifest could not be read.";return{...n,candidate:{ok:!1,code:e,message:t}}}}function Y(e){let t;if("readonly"!==e.toolProfile&&"edit"!==e.toolProfile)return{ok:!1,failure:(0,a.attemptFailure)("unsupported_authority",`Unsupported tool profile: ${JSON.stringify(String(e.toolProfile))}.`)};if(e.prepareFinalization&&"edit"!==e.toolProfile)return{ok:!1,failure:(0,a.attemptFailure)("unsupported_authority","Only an edit Attempt can prepare Git finalization.")};if(!e.deck)return{ok:!1,failure:(0,a.attemptFailure)("unavailable","An Agent Deck run requires a deck.")};if(!e.cwd)return{ok:!1,failure:(0,a.attemptFailure)("unavailable","An Agent Deck run requires a working directory.")};try{t=(0,T.parseDeckRuntime)(e.target.agent)}catch(e){return{ok:!1,failure:(0,a.attemptFailure)("unavailable",e instanceof Error?e.message:String(e))}}let n=e.sessionBinding?.externalSessionId??null;return{ok:!0,body:{deckId:e.deck,client:t,cwd:e.cwd,prompt:(0,T.deckPromptForAttempt)(e.prompt),tools:e.toolProfile,...n?{resumeSessionId:n}:{},...!0===e.prepareFinalization?{prepareFinalization:!0}:{}}}}function Z(e){if(!(e instanceof c))return{kind:"rejected",status:null,code:null};switch(e.code){case"agent_deck_token_missing":return{kind:"no_grant"};case"agent_deck_unauthorized":return{kind:"unauthorized"};case"agent_deck_forbidden":return{kind:"forbidden"};case"agent_deck_unreachable":return{kind:"unreachable"};default:if(404===e.status&&("RUN_NOT_FOUND"===e.deckCode||null===e.deckCode))return{kind:"not_found"};return{kind:"rejected",status:e.status,code:e.deckCode}}}let Q="agent-deck-api";function ee(e){let t=t=>({adapter:Q,externalRunId:null,externalSessionId:null,output:null,artifacts:[],startedAt:e,finishedAt:Date.now(),failure:null,...t});return{result:t,failed:(e,n={})=>t({status:"failed",failure:e,...n})}}async function et(e,t,n,r){let{result:i,failed:o}=ee(r),s=t.resumeSessionId,d=t.prepareFinalization,l=(0,a.interruption)({signal:t.signal??null,deadlineAt:t.deadlineAt}),u={externalRunId:e};try{if(d)try{let t=await A(e);t.finalization&&n?.({type:"progress",adapter:Q,at:Date.now(),detail:{phase:"finalization_prepared",baseline_ref:t.finalization.baselineRef,baseline_digest:t.finalization.baselineDigest}})}catch{}let t=V(e);t.catch(()=>{});let r=await Promise.race([t.then(e=>({observed:e}),e=>({error:e})),l.promise.then(e=>({interrupted:e}))]);if("interrupted"in r){let t="requested";try{await b(e)}catch{t="failed"}return o(r.interrupted,{...u,externalCancel:t})}if("error"in r){let t="requested";try{await b(e)}catch{t="failed"}return o(K(r.error,"runtime_failed"),{...u,externalCancel:t})}let{observed:c}=r,_=null;try{_=await A(e)}catch(e){if(!d)return o(K(e,"runtime_failed"),u)}let p=_?.sessionId??c.sessionId,f=d?await X(e,_):void 0,g={...u,externalSessionId:p,...f?{finalization:f}:{}};if("canceled"===c.state)return o((0,a.attemptFailure)("cancelled",`Agent Deck run ${e} was canceled.`),g);if("ended"!==c.state)return o((0,a.attemptFailure)("runtime_failed",`Agent Deck run ${e} ended in state ${c.state}.`),g);if(null===c.result)return o((0,a.attemptFailure)("result_contract",`Agent Deck run ${e} result contract mismatch: expected a non-empty string result, got ${c.resultMismatch??"no result event"}.`),g);if(s&&null!==p&&p!==s)return o((0,a.attemptFailure)("session_mismatch",`resume run ${e} forked the session (expected ${s}, got ${p}); failing closed.`),g);let m=f?.candidate?.ok?f.candidate.manifest:null;return i({status:"completed",...g,externalSessionId:p??s,output:c.result,artifacts:m?[{kind:"candidate_manifest",ref:m.manifestDigest}]:[]})}finally{l.dispose()}}let en={currentGrantFingerprint:f,async inspect(e){try{let t=await A(e);return{kind:"run",state:t.state}}catch(e){return Z(e)}},async repost(e){let t;try{t=JSON.parse(e.body)}catch{return{kind:"rejected",status:null,code:"INTENT_UNREADABLE"}}try{let n=await q(t,e.idempotencyKey);return{kind:"accepted",runId:n.runId}}catch(e){return Z(e)}},follow:(e,t,n)=>et(e,t,n,Date.now()),async evidence(e){let t=null;try{t=await A(e)}catch{}return X(e,t)},async cancel(e){try{return await b(e),"requested"}catch{return"failed"}}};var er=e.i(64974);class ei extends Error{code;constructor(e,t){super(t),this.name="DispatchFailure",this.code=e}}let ea={"hermes-gateway":()=>(function(e={}){let t="hermes-gateway";return{name:t,async run(n,r){let o=Date.now(),s=(e,n=null)=>({status:"failed",adapter:t,externalRunId:null,externalSessionId:n,output:null,artifacts:[],startedAt:o,finishedAt:Date.now(),failure:e});if("readonly"!==n.toolProfile)return s((0,a.attemptFailure)("unsupported_authority",`The Hermes gateway does not support the ${n.toolProfile} tool profile.`));let d=(e.loadConfig??i.loadHermesConfig)();if(!d)return s((0,a.attemptFailure)("unavailable","The Hermes gateway is not configured."));let l=(0,a.preLaunchInterruption)(n);if(l)return s(l);if(n.freshSession&&n.sessionBinding)return s((0,a.attemptFailure)("session_mismatch","A fresh-session turn cannot resume a session."));let u=n.sessionBinding?.externalSessionId??(n.freshSession?(0,i.hermesFreshSessionIdForBot)(n.target.agentId,d):(0,i.hermesSessionIdForBot)(n.target.agentId,d)),c=new AbortController,_=(0,a.interruption)(n),p=null;_.promise.then(e=>{p=e,c.abort()}),r?.({type:"started",adapter:t,at:Date.now(),externalRunId:null,externalSessionId:u});try{var f;let r=await (0,i.hermesChat)({config:d,profilePath:n.target.hermesProfilePath||i.HERMES_DEFAULT_CHAT_PATH,sessionId:u,messages:(f=n.prompt,"text"===f.kind?[{role:"user",content:f.text}]:[{role:"system",content:f.system},...f.history.map(e=>e.fromAgent?{role:"assistant",content:e.content}:{role:"user",content:`[From ${e.speakerLabel}] ${e.content}`})]),signal:c.signal,...e.fetchImpl?{fetchImpl:e.fetchImpl}:{}});return{status:"completed",adapter:t,externalRunId:null,externalSessionId:u,output:r,artifacts:[],startedAt:o,finishedAt:Date.now(),failure:null}}catch(r){let e=r instanceof i.HermesError?r.code:"unknown";if(p)return s({...p,code:e},u);let t="timeout"===e?"timed_out":"runtime_failed",n=r instanceof i.HermesError&&void 0!==r.status?` ${r.status}`:"";return s((0,a.attemptFailure)(t,`The Hermes gateway did not complete the turn (${e}${n}).`,e),u)}finally{_.dispose()}}}})({fetchImpl:null}),"agent-deck-run":()=>({name:Q,reconciler:en,externalCancel:!0,launchIntent(e){let t=Y(e);return t.ok?{idempotencyKey:G(e),body:JSON.stringify(t.body),grantFingerprint:f()}:null},async run(e,t){let n,r=Date.now(),{failed:i}=ee(r),o=Y(e);if(!o.ok)return i(o.failure);let s=(0,a.preLaunchInterruption)(e);if(s)return i(s);try{n=(await q(o.body,G(e))).runId}catch(t){let e=B(Z(t));return i(K(t,"launch_failed"),e?{}:{launchUnconfirmed:!0})}return t?.({type:"started",adapter:Q,at:Date.now(),externalRunId:n,externalSessionId:null}),et(n,{resumeSessionId:e.sessionBinding?.externalSessionId??null,prepareFinalization:!0===e.prepareFinalization,deadlineAt:e.deadlineAt??null,signal:e.signal??null},t,r)}})},eo=["agent_deck_token_missing","agent_deck_unauthorized","agent_deck_forbidden","agent_deck_unreachable"];function es(e){return"completed"===e.status?"succeeded":e.failure?.category==="cancelled"?"cancelled":e.failure?.category==="timed_out"?"timed_out":"failed"}function ed(e,t,n){return e.finishAttempt(t,{outcome:es(n),output:n.output,errorCategory:n.failure?.category??null,errorMessage:n.failure?.message??null,artifacts:n.artifacts,...n.externalRunId?{externalRunId:n.externalRunId}:{},...n.externalSessionId?{externalSessionId:n.externalSessionId}:{},now:n.finishedAt})}function el(e,t,n,r=Date.now()){let i=e.getWorkRequest(t.request_id);e.appendEvent(t.request_id,{type:"late_result_recorded",attemptId:t.id,data:{attempt_number:t.attempt_number,attempt_outcome:t.outcome,result_status:n.status,result_outcome:es(n),error_category:n.failure?.category??null,external_run_id:n.externalRunId,output:n.output,request_state:i?.state??null},now:r})}async function eu(e,t,n,r={}){let i,o=!1,s=!1;try{i=await n.run(t.input,n=>{var i,a;if("started"===n.type&&(s=!0),o||(i=t.attempt,a=r.fence,!e.transaction(()=>(!a||!!a())&&("started"===n.type?((n.externalRunId||n.externalSessionId)&&e.recordAttemptExternalIds(i.id,{...n.externalRunId?{externalRunId:n.externalRunId}:{},...n.externalSessionId?{externalSessionId:n.externalSessionId}:{}}),e.appendEvent(i.request_id,{type:"runtime_started",attemptId:i.id,data:{adapter:n.adapter,external_run_id:n.externalRunId},now:n.at})):e.appendEvent(i.request_id,{type:"runtime_progress",attemptId:i.id,data:{adapter:n.adapter,...n.detail},now:n.at}),!0)))){o=!0;return}r.onEvent?.(n)})}catch(r){let e=Date.now();i={status:"failed",adapter:n.name,externalRunId:null,externalSessionId:null,output:null,artifacts:[],startedAt:t.attempt.started_at,finishedAt:e,failure:(0,a.attemptFailure)("runtime_failed",r instanceof Error?r.message:String(r))}}return r.sanitize&&(i=r.sanitize(i)),e.transaction(()=>{let a=e.getAttempt(t.attempt.id);if(a&&null!==a.finished_at)return el(e,a,i),{attempt:a,result:i,projected:void 0,late:!0,abandoned:null};let o=s?ec(t.attempt,n,t.input.signal??null,i):null,d=o?e_(e,o,i):ed(e,t.attempt.id,i),l=r.project?r.project(i,d):void 0;return{attempt:d,result:i,projected:l,late:!1,abandoned:o}})}function ec(e,t,n,r){if("failed"!==r.status)return null;let i=r.failure?.category,a="failed"===r.externalCancel,o={requestId:e.request_id,attemptId:e.id,externalRunId:r.externalRunId,transport:t.name};return"cancelled"!==i&&"timed_out"!==i?a?{...o,reason:"observation_lost",externalCancel:"failed"}:null:("cancelled"!==i||n?.aborted)&&(!t.externalCancel||a)?{...o,reason:i,externalCancel:a?"failed":null}:null}function e_(e,t,n){let r="failed"===t.externalCancel?"The runtime did not accept the cancel request":"The runtime cannot stop the run",i=e.finishAttempt(t.attemptId,{outcome:es(n),errorCategory:"abandoned",errorMessage:`${n.failure?.message??"The attempt was interrupted."} ${r}; it may continue and a later result is not awaited.`.slice(0,500),artifacts:n.artifacts,...n.externalRunId?{externalRunId:n.externalRunId}:{},...n.externalSessionId?{externalSessionId:n.externalSessionId}:{},now:n.finishedAt});return t.externalRunId=i.external_run_id,e.appendEvent(t.requestId,{type:"attempt_abandoned",attemptId:t.attemptId,data:{reason:t.reason,attempt_number:i.attempt_number,external_run_id:i.external_run_id,transport:t.transport,local_only:!0,error_code:n.failure?.code??null,external_cancel:t.externalCancel},now:n.finishedAt}),i}e.s(["DispatchFailure",0,ei,"adapterForTransport",0,function(e){return"hermes-gateway"===e?ea["hermes-gateway"]():"agent-deck-api"===e?ea["agent-deck-run"]():null},"agentForDispatch",0,function(e){return(0,r.resolveAgent)(e).agent},"dispatchFailureFor",0,function(e){var t;let n,r=e.failure?.category??"runtime_failed";if("hermes-gateway"===e.adapter)return"unavailable"===r?new ei("agent_unavailable","The agent runtime is not configured."):new ei("runtime_failed",`The agent runtime did not complete the turn (${e.failure?.code??"unknown"}).`);let i="agent-deck-api"===e.adapter?(t=e,(n=t.failure?.code)&&eo.includes(n)?n:null):null;return i?new ei("agent_unavailable",`${_[i]} [${i}]`):"unavailable"===r?new ei("agent_unavailable","The agent runtime is not available."):"cancelled"===r?new ei("runtime_failed","The agent run was cancelled."):"launch_failed"===r?new ei("runtime_failed","The agent runtime did not start the turn."):new ei("runtime_failed","The agent runtime did not complete the turn.")},"prepareDispatch",0,function(e){var a;let o,d,l=(0,r.resolveAgent)(e.bot);if(!l.launchable||!l.deck_id)throw new ei("agent_unavailable","The agent has no Agent Deck selected.");let u={prompt:{kind:"conversation",system:(d=(a=e.bot).title?`${a.name} (${a.title})`:a.name,`You are ${d}.
135
- ${a.description}`),history:e.history},deck:l.deck_id,toolProfile:e.toolProfile??er.TOOL_PROFILE_FOR_KIND.conversation,sessionBinding:e.sessionBinding??null,correlation:{},...e.freshSession?{freshSession:!0}:{}};if("hermes-gateway"===(0,r.agentTransport)(l.agent))return{agent:l.agent,adapter:ea["hermes-gateway"](),input:{...u,target:{agentId:e.bot.id,agent:l.agent,hermesProfilePath:(0,i.hermesProfilePathForBot)(e.bot)},cwd:null}};try{o=(0,s.resolveAndEnsureBotWorkdir)(e.bot.id,l.working_directory)}catch{throw new ei("agent_unavailable","The agent working directory is unavailable.")}return{agent:l.agent,adapter:ea["agent-deck-run"](),input:{...u,target:{agentId:e.bot.id,agent:l.agent},cwd:o,...e.prepareFinalization&&"edit"===u.toolProfile&&function(e){let r=n.default.resolve(e);for(;;){if(t.default.existsSync(n.default.join(r,".git")))return!0;let e=n.default.dirname(r);if(e===r)return!1;r=e}}(o)?{prepareFinalization:!0}:{}}}}],27510),e.s(["abandonedLocally",0,ec,"beginAttempt",0,function(e,t,n){let r=n.input.sessionBinding;if(r&&!r.bindingId)throw new D.EngineStoreError("invalid_input","A persisted resume attempt names its Session Binding.");if(r&&n.input.freshSession)throw new D.EngineStoreError("invalid_input","A fresh-session attempt cannot resume a Session Binding.");let i=e.createAttempt(t,{kind:r?"resume":"launch",adapter:n.agent,toolProfile:n.input.toolProfile,launchSnapshot:function(e){let{input:t}=e;return{...e.snapshot??{},agent:e.agent,agent_id:t.target.agentId,transport:e.adapter.name,deck:t.deck,cwd:t.cwd,tool_profile:t.toolProfile,hermes_profile_path:t.target.hermesProfilePath??null,prompt_kind:t.prompt.kind,prompt_hash:(0,o.createHash)("sha256").update(JSON.stringify(t.prompt)).digest("hex"),session_binding_id:t.sessionBinding?.bindingId??null,prepare_finalization:!0===t.prepareFinalization,fresh_session:!0===t.freshSession,deadline_at:t.deadlineAt??null}}(n),resumedSessionBindingId:r?.bindingId??null,now:n.now});return{attempt:i,input:(0,a.freezeAttemptInput)({...n.input,correlation:{...n.input.correlation,requestId:t,attemptId:i.id}})}},"recordAbandonedResult",0,e_,"recordAttemptResult",0,ed,"recordLateResult",0,el,"runAttempt",0,eu],53059)},76459,142,e=>{"use strict";var t=e.i(54799),n=e.i(62294),r=e.i(35613),i=e.i(64974);let a=Object.freeze({maxWakeDepth:3,rootBudget:12,maxContinuations:24,globalConcurrency:4,perTargetConcurrency:1}),o={maxWakeDepth:"BOTMANCERS_WAKE_MAX_DEPTH",rootBudget:"BOTMANCERS_WAKE_ROOT_BUDGET"},s=Object.freeze({kind:"person",id:"local-owner"});function d(e){return!!e&&e.kind===s.kind&&e.id===s.id}function l(e,t){return t&&["person","bot","service"].includes(t.kind)&&"string"==typeof t.id&&t.id.trim()?"ui"===e?d(t)?"human_owner":"unknown":"api"===e?"api_principal":"unknown":"unknown"}let u={owner_required:403,not_found:404,not_pending:409};class c extends Error{code;constructor(e,t){super(t),this.name="WakeSafetyError",this.code=e}get status(){return u[this.code]}}function _(e){if("human_owner"!==e)throw new c("owner_required","Only the owner can allow, deny, or revoke Wake grants.")}function p(e,t){return n.default.prepare("SELECT * FROM wake_grants WHERE caller_agent_id = ? AND target_agent_id = ? AND authority = 'edit' AND revoked_at IS NULL").get(e,t)}function f(e){return n.default.prepare("SELECT * FROM wake_grants WHERE id = ?").get(e)}e.s(["WAKE_SAFETY_VERSION",0,1,"WakeSafetyError",0,c,"activeEditGrant",0,p,"assertOwner",0,_,"categorizeIntakeCaller",0,l,"ensureEditGrant",0,function(e){let r=p(e.callerAgentId,e.targetAgentId);if(r)return{grant:r,created:!1};let i=(0,t.randomUUID)();return n.default.prepare(`
136
- INSERT INTO wake_grants (id, caller_agent_id, target_agent_id, authority, granted_by_kind, granted_by_id, source_wake_id, created_at)
137
- VALUES (?, ?, ?, 'edit', ?, ?, ?, ?)
138
- `).run(i,e.callerAgentId,e.targetAgentId,e.grantedBy.kind,e.grantedBy.id,e.sourceWakeId,e.now),{grant:f(i),created:!0}},"isOwnerPrincipal",0,d,"needsEditGrant",0,function(e){return"implementation"===e||"revision"===e},"revokeWakeGrant",0,function(e,r,i=Date.now()){return _(r.category),n.default.transaction(()=>{let a=f(e);if(!a)throw new c("not_found",`No Wake grant ${e}.`);if(null!==a.revoked_at)return{grant:a,revoked:!1};n.default.prepare("UPDATE wake_grants SET revoked_at = ?, revoked_by_kind = ?, revoked_by_id = ? WHERE id = ? AND revoked_at IS NULL").run(i,r.principal.kind,r.principal.id,e);let o=a.source_wake_id?n.default.prepare("SELECT work_request_id FROM wakes WHERE id = ?").get(a.source_wake_id):void 0;return o?.work_request_id&&n.default.prepare(`
139
- INSERT INTO engine_events (id, request_id, sequence, attempt_id, type, data, created_at)
140
- SELECT ?, ?, COALESCE(MAX(sequence), 0) + 1, NULL, 'grant_revoked', ?, ? FROM engine_events WHERE request_id = ?
141
- `).run((0,t.randomUUID)(),o.work_request_id,JSON.stringify({grant_id:a.id,wake_id:a.source_wake_id,caller_agent_id:a.caller_agent_id,target_agent_id:a.target_agent_id,decided_by:{kind:r.principal.kind,id:r.principal.id}}),i,o.work_request_id),{grant:f(e),revoked:!0}}).immediate()},"wakeSafetyLimits",0,function(e=process.env){let t=(t,n)=>{let r=e[o[t]]?.trim(),i=r&&/^\d+$/.test(r)?Number(r):NaN;return Number.isSafeInteger(i)&&i>=n&&i<a[t]?i:a[t]},n=t("rootBudget",1);return{...a,maxWakeDepth:t("maxWakeDepth",0),rootBudget:n,maxContinuations:2*n}}],142);let g={invalid_request:400,conversation_not_found:404,conversation_not_writable:409,target_not_found:404,idempotency_conflict:409,unknown_principal:403,intake_failed:500};class m extends Error{code;constructor(e,t){super(t),this.name="IntakeError",this.code=e}get status(){return g[this.code]}}let h={ui:["bot","group"],api:["agent"]};function k(e){return"string"==typeof e&&e.trim().length>0}function w(e,t,r){n.default.prepare("INSERT OR IGNORE INTO conversation_participants (conversation_id, participant_kind, participant_id, joined_at) VALUES (?, ?, ?, ?)").run(e,t.kind,t.id,r)}function E(e,r,i,a,o,s){let d=(0,t.randomUUID)();return n.default.prepare("INSERT INTO messages (id, conversation_id, sender_type, sender_id, sender_kind, content, handoff_targets, created_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)").run(d,r,"bot"===i.kind?"bot":"user","ui"===e?null:i.id,i.kind,a,o&&o.length>0?JSON.stringify(o):null,s),d}function y(e){return e.map(e=>n.engine.getWorkRequest(e)).filter(e=>!!e)}e.s(["IntakeError",0,m,"acceptConversationMessage",0,function(e){var a,o;let s,d;if(!e.requester||!["person","bot","service"].includes(e.requester.kind)||!k(e.requester.id))throw new m("invalid_request","A requester principal is required.");if("unknown"===l(e.surface,e.requester))throw new m("unknown_principal","The caller is not a recognized principal.");if(!k(e.content))throw new m("invalid_request","content is required.");if(!k(e.idempotencyKey)||e.idempotencyKey.length>200)throw new m("invalid_request","An idempotency key (1-200 characters) is required.");let u=(a=e.surface,o=e.fingerprint,(0,t.createHash)("sha256").update(JSON.stringify([a,o??null])).digest("hex"));try{s=function(e,r){let{surface:a,requester:o}=e;return n.default.transaction(()=>{let s,d=n.default.prepare("SELECT * FROM conversation_intakes WHERE requester_kind = ? AND requester_id = ? AND idempotency_key = ?").get(o.kind,o.id,e.idempotencyKey);if(d){var u;if(d.request_hash!==r)throw new m("idempotency_conflict","The idempotency key was already used with a different payload.");let e=JSON.parse(d.work_request_ids);return{surface:d.surface,conversationId:d.conversation_id,acceptedMessageId:d.source_event_id,requestIds:e,requests:y(e),replayed:!0}}let c=Date.now();if("id"in e.conversation){let t=n.default.prepare("SELECT * FROM conversations WHERE id = ?").get(e.conversation.id);if(!t||(u=t.id,!n.default.prepare("SELECT 1 FROM conversation_participants WHERE conversation_id = ? AND participant_kind = ? AND participant_id = ?").get(u,o.kind,o.id)))throw new m("conversation_not_found","No conversation with that id is visible to this requester.");if(!h[a].includes(t.type))throw new m("conversation_not_writable","api"===a?"UI conversations are written through the UI compatibility routes.":"Agent conversations are written through the agent conversation API.");s=t}else{if("api"!==a)throw new m("invalid_request","Only the agent conversation API opens new conversations.");s={id:(0,t.randomUUID)(),type:"agent",origin_kind:o.kind,origin_id:o.id,created_at:c},n.default.prepare("INSERT INTO conversations (id, type, origin_kind, origin_id, created_at) VALUES (?, ?, ?, ?, ?)").run(s.id,s.type,o.kind,o.id,c),w(s.id,o,c)}let _=e.route(s),p=new Set,f=[];for(let e of _.deliveries){let t=e.conversationId??s.id,r=`${t}:${e.agentId}`;if(!p.has(r)){if(p.add(r),!k(e.agentId)||!n.bots.getById(e.agentId))throw new m("target_not_found","No registered agent has that id.");if("bot"===o.kind&&o.id===e.agentId)throw new m("invalid_request","An agent cannot address itself.");if(t!==s.id&&!n.default.prepare("SELECT 1 FROM conversations WHERE id = ?").get(t))throw new m("target_not_found","The target conversation does not exist.");f.push({agentId:e.agentId,conversationId:t})}}let g=new Map;for(let t of(g.set(s.id,E(a,s.id,o,e.content,_.handoffTargets,c)),f))g.has(t.conversationId)||g.set(t.conversationId,E(a,t.conversationId,o,e.content,_.handoffTargets,c));let v=(0,i.selectExecutionPolicy)({entryPoint:a,executionKind:"conversation"});if(!v.ok)throw new m("invalid_request",v.reason);let I=v.policy,q=l(a,o);if("unknown"===q)throw new m("unknown_principal","The caller is not a recognized principal.");let A={safety_version:1,root_principal:{kind:o.kind,id:o.id},wake_depth:0,grant_rule:"readonly_default",grant_id:null},R=[];for(let t of f){w(t.conversationId,{kind:"bot",id:t.agentId},c);let r=1===f.length?e.idempotencyKey:`${e.idempotencyKey}#${t.conversationId}:${t.agentId}`,{request:i}=n.engine.createOrGetWorkRequest({sourceConversationId:t.conversationId,sourceEventId:g.get(t.conversationId),requester:o,targetAgentId:t.agentId,intent:e.content,executionKind:I.execution_kind,toolProfile:I.tool_profile,idempotencyKey:r,policy:{source:"conversation_intake",surface:a},executionPolicy:I,rootPrincipal:o,wakeDepth:0,safetySnapshot:A,safety:{principalType:q,principal:o,decision:"allowed",grantRule:"readonly_default",snapshot:A,now:c},executor:e.executor,now:c});R.push(i.id)}for(let[e,t]of g){let r=f.flatMap((t,n)=>t.conversationId===e?[R[n]]:[]);1===r.length&&n.default.prepare("UPDATE messages SET request_id = ? WHERE id = ?").run(r[0],t)}return n.default.prepare(`
142
- INSERT INTO conversation_intakes (
143
- requester_kind, requester_id, idempotency_key, request_hash, surface,
144
- conversation_id, source_event_id, work_request_ids, created_at
145
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
146
- `).run(o.kind,o.id,e.idempotencyKey,r,a,s.id,g.get(s.id),JSON.stringify(R),c),e.beforeCommit?.(),{surface:a,conversationId:s.id,acceptedMessageId:g.get(s.id),requestIds:R,requests:y(R),replayed:!1}}).immediate()}(e,u)}catch(e){if(e instanceof m)throw e;if(e instanceof r.EngineStoreError&&"idempotency_conflict"===e.code)throw new m("idempotency_conflict","The idempotency key was already used with a different payload.");throw console.error("Conversation intake failed:",e),new m("intake_failed","The message could not be accepted.")}let c=e.dispatch;try{d=c(s)}catch(e){d=Promise.reject(e)}let _=Promise.resolve(d).catch(e=>{console.error("Intake dispatch failed:",e)});return{...s,dispatched:_}},"getAcceptedMessage",0,function(e){return n.default.prepare("SELECT * FROM messages WHERE id = ?").get(e)}],76459)}];
147
-
148
- //# sourceMappingURL=lib_0zxi6rx._.js.map