@grok/agent-sdk 0.0.0-stage → 0.2.27

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 (1966) hide show
  1. package/AGENTS.md +336 -0
  2. package/CHANGELOG.md +3 -0
  3. package/LICENSE.md +3 -0
  4. package/README.md +106 -2
  5. package/dist/artifacts.d.ts +37 -0
  6. package/dist/artifacts.d.ts.map +1 -0
  7. package/dist/artifacts.js +52 -0
  8. package/dist/bin/agent-sdk.js +2 -0
  9. package/dist/bin/agent-serve.d.ts +20 -0
  10. package/dist/bin/agent-serve.d.ts.map +1 -0
  11. package/dist/bin/agent-serve.js +1703 -0
  12. package/dist/channels/bitbucket/api.d.ts +217 -0
  13. package/dist/channels/bitbucket/api.d.ts.map +1 -0
  14. package/dist/channels/bitbucket/api.js +648 -0
  15. package/dist/channels/bitbucket/binding.d.ts +75 -0
  16. package/dist/channels/bitbucket/binding.d.ts.map +1 -0
  17. package/dist/channels/bitbucket/binding.js +313 -0
  18. package/dist/channels/bitbucket/bitbucket-channel.d.ts +47 -0
  19. package/dist/channels/bitbucket/bitbucket-channel.d.ts.map +1 -0
  20. package/dist/channels/bitbucket/bitbucket-channel.js +173 -0
  21. package/dist/channels/bitbucket/bitbucket-webhook.d.ts +73 -0
  22. package/dist/channels/bitbucket/bitbucket-webhook.d.ts.map +1 -0
  23. package/dist/channels/bitbucket/bitbucket-webhook.js +399 -0
  24. package/dist/channels/bitbucket/checks.d.ts +67 -0
  25. package/dist/channels/bitbucket/checks.d.ts.map +1 -0
  26. package/dist/channels/bitbucket/checks.js +90 -0
  27. package/dist/channels/bitbucket/cursor-account.d.ts +37 -0
  28. package/dist/channels/bitbucket/cursor-account.d.ts.map +1 -0
  29. package/dist/channels/bitbucket/cursor-account.js +65 -0
  30. package/dist/channels/bitbucket/defaults.d.ts +26 -0
  31. package/dist/channels/bitbucket/defaults.d.ts.map +1 -0
  32. package/dist/channels/bitbucket/defaults.js +77 -0
  33. package/dist/channels/bitbucket/events.d.ts +22 -0
  34. package/dist/channels/bitbucket/events.d.ts.map +1 -0
  35. package/dist/channels/bitbucket/events.js +59 -0
  36. package/dist/channels/bitbucket/index.d.ts +38 -0
  37. package/dist/channels/bitbucket/index.d.ts.map +1 -0
  38. package/dist/channels/bitbucket/index.js +37 -0
  39. package/dist/channels/bitbucket/replay.d.ts +63 -0
  40. package/dist/channels/bitbucket/replay.d.ts.map +1 -0
  41. package/dist/channels/bitbucket/replay.js +326 -0
  42. package/dist/channels/bitbucket/state.d.ts +35 -0
  43. package/dist/channels/bitbucket/state.d.ts.map +1 -0
  44. package/dist/channels/bitbucket/state.js +30 -0
  45. package/dist/channels/bitbucket/types.d.ts +236 -0
  46. package/dist/channels/bitbucket/types.d.ts.map +1 -0
  47. package/dist/channels/bitbucket/types.js +1 -0
  48. package/dist/channels/change-monitors/change-monitors-channel.d.ts +5 -0
  49. package/dist/channels/change-monitors/change-monitors-channel.d.ts.map +1 -0
  50. package/dist/channels/change-monitors/change-monitors-channel.js +45 -0
  51. package/dist/channels/change-monitors/index.d.ts +4 -0
  52. package/dist/channels/change-monitors/index.d.ts.map +1 -0
  53. package/dist/channels/change-monitors/index.js +2 -0
  54. package/dist/channels/change-monitors/types.d.ts +42 -0
  55. package/dist/channels/change-monitors/types.d.ts.map +1 -0
  56. package/dist/channels/change-monitors/types.js +1 -0
  57. package/dist/channels/checks.d.ts +121 -0
  58. package/dist/channels/checks.d.ts.map +1 -0
  59. package/dist/channels/checks.js +76 -0
  60. package/dist/channels/deployments/deployments-channel.d.ts +95 -0
  61. package/dist/channels/deployments/deployments-channel.d.ts.map +1 -0
  62. package/dist/channels/deployments/deployments-channel.js +188 -0
  63. package/dist/channels/deployments/index.d.ts +25 -0
  64. package/dist/channels/deployments/index.d.ts.map +1 -0
  65. package/dist/channels/deployments/index.js +24 -0
  66. package/dist/channels/deployments/types.d.ts +83 -0
  67. package/dist/channels/deployments/types.d.ts.map +1 -0
  68. package/dist/channels/deployments/types.js +7 -0
  69. package/dist/channels/github/api.d.ts +133 -0
  70. package/dist/channels/github/api.d.ts.map +1 -0
  71. package/dist/channels/github/api.js +373 -0
  72. package/dist/channels/github/auth.d.ts +71 -0
  73. package/dist/channels/github/auth.d.ts.map +1 -0
  74. package/dist/channels/github/auth.js +247 -0
  75. package/dist/channels/github/binding.d.ts +86 -0
  76. package/dist/channels/github/binding.d.ts.map +1 -0
  77. package/dist/channels/github/binding.js +123 -0
  78. package/dist/channels/github/checks.d.ts +64 -0
  79. package/dist/channels/github/checks.d.ts.map +1 -0
  80. package/dist/channels/github/checks.js +93 -0
  81. package/dist/channels/github/cursor-account.d.ts +109 -0
  82. package/dist/channels/github/cursor-account.d.ts.map +1 -0
  83. package/dist/channels/github/cursor-account.js +206 -0
  84. package/dist/channels/github/defaults.d.ts +23 -0
  85. package/dist/channels/github/defaults.d.ts.map +1 -0
  86. package/dist/channels/github/defaults.js +132 -0
  87. package/dist/channels/github/events.d.ts +18 -0
  88. package/dist/channels/github/events.d.ts.map +1 -0
  89. package/dist/channels/github/events.js +56 -0
  90. package/dist/channels/github/forward.d.ts +139 -0
  91. package/dist/channels/github/forward.d.ts.map +1 -0
  92. package/dist/channels/github/forward.js +263 -0
  93. package/dist/channels/github/github-channel.d.ts +187 -0
  94. package/dist/channels/github/github-channel.d.ts.map +1 -0
  95. package/dist/channels/github/github-channel.js +2089 -0
  96. package/dist/channels/github/index.d.ts +64 -0
  97. package/dist/channels/github/index.d.ts.map +1 -0
  98. package/dist/channels/github/index.js +52 -0
  99. package/dist/channels/github/progress.d.ts +84 -0
  100. package/dist/channels/github/progress.d.ts.map +1 -0
  101. package/dist/channels/github/progress.js +235 -0
  102. package/dist/channels/github/replay.d.ts +115 -0
  103. package/dist/channels/github/replay.d.ts.map +1 -0
  104. package/dist/channels/github/replay.js +269 -0
  105. package/dist/channels/github/state.d.ts +47 -0
  106. package/dist/channels/github/state.d.ts.map +1 -0
  107. package/dist/channels/github/state.js +77 -0
  108. package/dist/channels/github/types.d.ts +515 -0
  109. package/dist/channels/github/types.d.ts.map +1 -0
  110. package/dist/channels/github/types.js +1 -0
  111. package/dist/channels/gitlab/api.d.ts +118 -0
  112. package/dist/channels/gitlab/api.d.ts.map +1 -0
  113. package/dist/channels/gitlab/api.js +220 -0
  114. package/dist/channels/gitlab/binding.d.ts +63 -0
  115. package/dist/channels/gitlab/binding.d.ts.map +1 -0
  116. package/dist/channels/gitlab/binding.js +166 -0
  117. package/dist/channels/gitlab/checks.d.ts +110 -0
  118. package/dist/channels/gitlab/checks.d.ts.map +1 -0
  119. package/dist/channels/gitlab/checks.js +121 -0
  120. package/dist/channels/gitlab/cursor-account.d.ts +36 -0
  121. package/dist/channels/gitlab/cursor-account.d.ts.map +1 -0
  122. package/dist/channels/gitlab/cursor-account.js +64 -0
  123. package/dist/channels/gitlab/defaults.d.ts +25 -0
  124. package/dist/channels/gitlab/defaults.d.ts.map +1 -0
  125. package/dist/channels/gitlab/defaults.js +61 -0
  126. package/dist/channels/gitlab/events.d.ts +12 -0
  127. package/dist/channels/gitlab/events.d.ts.map +1 -0
  128. package/dist/channels/gitlab/events.js +26 -0
  129. package/dist/channels/gitlab/gitlab-channel.d.ts +48 -0
  130. package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -0
  131. package/dist/channels/gitlab/gitlab-channel.js +173 -0
  132. package/dist/channels/gitlab/gitlab-webhook.d.ts +54 -0
  133. package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -0
  134. package/dist/channels/gitlab/gitlab-webhook.js +421 -0
  135. package/dist/channels/gitlab/index.d.ts +35 -0
  136. package/dist/channels/gitlab/index.d.ts.map +1 -0
  137. package/dist/channels/gitlab/index.js +34 -0
  138. package/dist/channels/gitlab/replay.d.ts +105 -0
  139. package/dist/channels/gitlab/replay.d.ts.map +1 -0
  140. package/dist/channels/gitlab/replay.js +222 -0
  141. package/dist/channels/gitlab/state.d.ts +33 -0
  142. package/dist/channels/gitlab/state.d.ts.map +1 -0
  143. package/dist/channels/gitlab/state.js +31 -0
  144. package/dist/channels/gitlab/types.d.ts +222 -0
  145. package/dist/channels/gitlab/types.d.ts.map +1 -0
  146. package/dist/channels/gitlab/types.js +1 -0
  147. package/dist/channels/issues/index.d.ts +4 -0
  148. package/dist/channels/issues/index.d.ts.map +1 -0
  149. package/dist/channels/issues/index.js +2 -0
  150. package/dist/channels/issues/issues-channel.d.ts +5 -0
  151. package/dist/channels/issues/issues-channel.d.ts.map +1 -0
  152. package/dist/channels/issues/issues-channel.js +35 -0
  153. package/dist/channels/issues/types.d.ts +33 -0
  154. package/dist/channels/issues/types.d.ts.map +1 -0
  155. package/dist/channels/issues/types.js +1 -0
  156. package/dist/channels/origin/api.d.ts +157 -0
  157. package/dist/channels/origin/api.d.ts.map +1 -0
  158. package/dist/channels/origin/api.js +363 -0
  159. package/dist/channels/origin/binding.d.ts +57 -0
  160. package/dist/channels/origin/binding.d.ts.map +1 -0
  161. package/dist/channels/origin/binding.js +56 -0
  162. package/dist/channels/origin/checks.d.ts +119 -0
  163. package/dist/channels/origin/checks.d.ts.map +1 -0
  164. package/dist/channels/origin/checks.js +147 -0
  165. package/dist/channels/origin/cursor-account.d.ts +24 -0
  166. package/dist/channels/origin/cursor-account.d.ts.map +1 -0
  167. package/dist/channels/origin/cursor-account.js +35 -0
  168. package/dist/channels/origin/defaults.d.ts +43 -0
  169. package/dist/channels/origin/defaults.d.ts.map +1 -0
  170. package/dist/channels/origin/defaults.js +94 -0
  171. package/dist/channels/origin/events.d.ts +10 -0
  172. package/dist/channels/origin/events.d.ts.map +1 -0
  173. package/dist/channels/origin/events.js +25 -0
  174. package/dist/channels/origin/index.d.ts +45 -0
  175. package/dist/channels/origin/index.d.ts.map +1 -0
  176. package/dist/channels/origin/index.js +33 -0
  177. package/dist/channels/origin/origin-channel.d.ts +72 -0
  178. package/dist/channels/origin/origin-channel.d.ts.map +1 -0
  179. package/dist/channels/origin/origin-channel.js +628 -0
  180. package/dist/channels/origin/origin-webhook.d.ts +69 -0
  181. package/dist/channels/origin/origin-webhook.d.ts.map +1 -0
  182. package/dist/channels/origin/origin-webhook.js +213 -0
  183. package/dist/channels/origin/reactions.d.ts +56 -0
  184. package/dist/channels/origin/reactions.d.ts.map +1 -0
  185. package/dist/channels/origin/reactions.js +46 -0
  186. package/dist/channels/origin/state.d.ts +32 -0
  187. package/dist/channels/origin/state.d.ts.map +1 -0
  188. package/dist/channels/origin/state.js +31 -0
  189. package/dist/channels/origin/types.d.ts +257 -0
  190. package/dist/channels/origin/types.d.ts.map +1 -0
  191. package/dist/channels/origin/types.js +1 -0
  192. package/dist/channels/pagerduty/api.d.ts +74 -0
  193. package/dist/channels/pagerduty/api.d.ts.map +1 -0
  194. package/dist/channels/pagerduty/api.js +101 -0
  195. package/dist/channels/pagerduty/defaults.d.ts +42 -0
  196. package/dist/channels/pagerduty/defaults.d.ts.map +1 -0
  197. package/dist/channels/pagerduty/defaults.js +132 -0
  198. package/dist/channels/pagerduty/events.d.ts +24 -0
  199. package/dist/channels/pagerduty/events.d.ts.map +1 -0
  200. package/dist/channels/pagerduty/events.js +38 -0
  201. package/dist/channels/pagerduty/index.d.ts +31 -0
  202. package/dist/channels/pagerduty/index.d.ts.map +1 -0
  203. package/dist/channels/pagerduty/index.js +30 -0
  204. package/dist/channels/pagerduty/pagerduty-channel.d.ts +64 -0
  205. package/dist/channels/pagerduty/pagerduty-channel.d.ts.map +1 -0
  206. package/dist/channels/pagerduty/pagerduty-channel.js +195 -0
  207. package/dist/channels/pagerduty/pagerduty-webhook.d.ts +70 -0
  208. package/dist/channels/pagerduty/pagerduty-webhook.d.ts.map +1 -0
  209. package/dist/channels/pagerduty/pagerduty-webhook.js +280 -0
  210. package/dist/channels/pagerduty/payload.d.ts +33 -0
  211. package/dist/channels/pagerduty/payload.d.ts.map +1 -0
  212. package/dist/channels/pagerduty/payload.js +150 -0
  213. package/dist/channels/pagerduty/replay.d.ts +35 -0
  214. package/dist/channels/pagerduty/replay.d.ts.map +1 -0
  215. package/dist/channels/pagerduty/replay.js +115 -0
  216. package/dist/channels/pagerduty/secrets.d.ts +16 -0
  217. package/dist/channels/pagerduty/secrets.d.ts.map +1 -0
  218. package/dist/channels/pagerduty/secrets.js +23 -0
  219. package/dist/channels/pagerduty/self-user.d.ts +51 -0
  220. package/dist/channels/pagerduty/self-user.d.ts.map +1 -0
  221. package/dist/channels/pagerduty/self-user.js +157 -0
  222. package/dist/channels/pagerduty/state.d.ts +31 -0
  223. package/dist/channels/pagerduty/state.d.ts.map +1 -0
  224. package/dist/channels/pagerduty/state.js +30 -0
  225. package/dist/channels/pagerduty/types.d.ts +217 -0
  226. package/dist/channels/pagerduty/types.d.ts.map +1 -0
  227. package/dist/channels/pagerduty/types.js +1 -0
  228. package/dist/channels/runs/index.d.ts +4 -0
  229. package/dist/channels/runs/index.d.ts.map +1 -0
  230. package/dist/channels/runs/index.js +2 -0
  231. package/dist/channels/runs/runs-channel.d.ts +5 -0
  232. package/dist/channels/runs/runs-channel.d.ts.map +1 -0
  233. package/dist/channels/runs/runs-channel.js +34 -0
  234. package/dist/channels/runs/types.d.ts +34 -0
  235. package/dist/channels/runs/types.d.ts.map +1 -0
  236. package/dist/channels/runs/types.js +1 -0
  237. package/dist/channels/slack/agentic-delivery.d.ts +24 -0
  238. package/dist/channels/slack/agentic-delivery.d.ts.map +1 -0
  239. package/dist/channels/slack/agentic-delivery.js +510 -0
  240. package/dist/channels/slack/agentic-posted.d.ts +30 -0
  241. package/dist/channels/slack/agentic-posted.d.ts.map +1 -0
  242. package/dist/channels/slack/agentic-posted.js +101 -0
  243. package/dist/channels/slack/agentic-signals.d.ts +43 -0
  244. package/dist/channels/slack/agentic-signals.d.ts.map +1 -0
  245. package/dist/channels/slack/agentic-signals.js +199 -0
  246. package/dist/channels/slack/api.d.ts +172 -0
  247. package/dist/channels/slack/api.d.ts.map +1 -0
  248. package/dist/channels/slack/api.js +642 -0
  249. package/dist/channels/slack/approvals.d.ts +48 -0
  250. package/dist/channels/slack/approvals.d.ts.map +1 -0
  251. package/dist/channels/slack/approvals.js +233 -0
  252. package/dist/channels/slack/assistant.d.ts +23 -0
  253. package/dist/channels/slack/assistant.d.ts.map +1 -0
  254. package/dist/channels/slack/assistant.js +57 -0
  255. package/dist/channels/slack/attachments.d.ts +85 -0
  256. package/dist/channels/slack/attachments.d.ts.map +1 -0
  257. package/dist/channels/slack/attachments.js +507 -0
  258. package/dist/channels/slack/auth.d.ts +46 -0
  259. package/dist/channels/slack/auth.d.ts.map +1 -0
  260. package/dist/channels/slack/auth.js +97 -0
  261. package/dist/channels/slack/blocks.d.ts +61 -0
  262. package/dist/channels/slack/blocks.d.ts.map +1 -0
  263. package/dist/channels/slack/blocks.js +90 -0
  264. package/dist/channels/slack/bot-mentions.d.ts +108 -0
  265. package/dist/channels/slack/bot-mentions.d.ts.map +1 -0
  266. package/dist/channels/slack/bot-mentions.js +243 -0
  267. package/dist/channels/slack/channel-watch.d.ts +80 -0
  268. package/dist/channels/slack/channel-watch.d.ts.map +1 -0
  269. package/dist/channels/slack/channel-watch.js +264 -0
  270. package/dist/channels/slack/cli-project.d.ts +19 -0
  271. package/dist/channels/slack/cli-project.d.ts.map +1 -0
  272. package/dist/channels/slack/cli-project.js +203 -0
  273. package/dist/channels/slack/code-fences.d.ts +17 -0
  274. package/dist/channels/slack/code-fences.d.ts.map +1 -0
  275. package/dist/channels/slack/code-fences.js +164 -0
  276. package/dist/channels/slack/constants.d.ts +27 -0
  277. package/dist/channels/slack/constants.d.ts.map +1 -0
  278. package/dist/channels/slack/constants.js +37 -0
  279. package/dist/channels/slack/credentials.d.ts +35 -0
  280. package/dist/channels/slack/credentials.d.ts.map +1 -0
  281. package/dist/channels/slack/credentials.js +73 -0
  282. package/dist/channels/slack/defaults.d.ts +50 -0
  283. package/dist/channels/slack/defaults.d.ts.map +1 -0
  284. package/dist/channels/slack/defaults.js +592 -0
  285. package/dist/channels/slack/dispatch.d.ts +153 -0
  286. package/dist/channels/slack/dispatch.d.ts.map +1 -0
  287. package/dist/channels/slack/dispatch.js +820 -0
  288. package/dist/channels/slack/doctor.d.ts +40 -0
  289. package/dist/channels/slack/doctor.d.ts.map +1 -0
  290. package/dist/channels/slack/doctor.js +277 -0
  291. package/dist/channels/slack/eval-directive.d.ts +59 -0
  292. package/dist/channels/slack/eval-directive.d.ts.map +1 -0
  293. package/dist/channels/slack/eval-directive.js +252 -0
  294. package/dist/channels/slack/event-id-dedupe.d.ts +10 -0
  295. package/dist/channels/slack/event-id-dedupe.d.ts.map +1 -0
  296. package/dist/channels/slack/event-id-dedupe.js +23 -0
  297. package/dist/channels/slack/external-policy.d.ts +28 -0
  298. package/dist/channels/slack/external-policy.d.ts.map +1 -0
  299. package/dist/channels/slack/external-policy.js +51 -0
  300. package/dist/channels/slack/footer.d.ts +33 -0
  301. package/dist/channels/slack/footer.d.ts.map +1 -0
  302. package/dist/channels/slack/footer.js +72 -0
  303. package/dist/channels/slack/inbound.d.ts +104 -0
  304. package/dist/channels/slack/inbound.d.ts.map +1 -0
  305. package/dist/channels/slack/inbound.js +350 -0
  306. package/dist/channels/slack/index.d.ts +56 -0
  307. package/dist/channels/slack/index.d.ts.map +1 -0
  308. package/dist/channels/slack/index.js +55 -0
  309. package/dist/channels/slack/init.d.ts +41 -0
  310. package/dist/channels/slack/init.d.ts.map +1 -0
  311. package/dist/channels/slack/init.js +109 -0
  312. package/dist/channels/slack/interactive.d.ts +73 -0
  313. package/dist/channels/slack/interactive.d.ts.map +1 -0
  314. package/dist/channels/slack/interactive.js +309 -0
  315. package/dist/channels/slack/links.d.ts +10 -0
  316. package/dist/channels/slack/links.d.ts.map +1 -0
  317. package/dist/channels/slack/links.js +18 -0
  318. package/dist/channels/slack/live-delivery.d.ts +80 -0
  319. package/dist/channels/slack/live-delivery.d.ts.map +1 -0
  320. package/dist/channels/slack/live-delivery.js +386 -0
  321. package/dist/channels/slack/log.d.ts +25 -0
  322. package/dist/channels/slack/log.d.ts.map +1 -0
  323. package/dist/channels/slack/log.js +44 -0
  324. package/dist/channels/slack/manifest.d.ts +80 -0
  325. package/dist/channels/slack/manifest.d.ts.map +1 -0
  326. package/dist/channels/slack/manifest.js +186 -0
  327. package/dist/channels/slack/message-body.d.ts +13 -0
  328. package/dist/channels/slack/message-body.d.ts.map +1 -0
  329. package/dist/channels/slack/message-body.js +74 -0
  330. package/dist/channels/slack/nudge-carrier.d.ts +21 -0
  331. package/dist/channels/slack/nudge-carrier.d.ts.map +1 -0
  332. package/dist/channels/slack/nudge-carrier.js +201 -0
  333. package/dist/channels/slack/nudge-store.d.ts +77 -0
  334. package/dist/channels/slack/nudge-store.d.ts.map +1 -0
  335. package/dist/channels/slack/nudge-store.js +288 -0
  336. package/dist/channels/slack/paint-start.d.ts +22 -0
  337. package/dist/channels/slack/paint-start.d.ts.map +1 -0
  338. package/dist/channels/slack/paint-start.js +76 -0
  339. package/dist/channels/slack/placeholder.d.ts +62 -0
  340. package/dist/channels/slack/placeholder.d.ts.map +1 -0
  341. package/dist/channels/slack/placeholder.js +237 -0
  342. package/dist/channels/slack/pr-ref.d.ts +24 -0
  343. package/dist/channels/slack/pr-ref.d.ts.map +1 -0
  344. package/dist/channels/slack/pr-ref.js +55 -0
  345. package/dist/channels/slack/progress-delivery.d.ts +28 -0
  346. package/dist/channels/slack/progress-delivery.d.ts.map +1 -0
  347. package/dist/channels/slack/progress-delivery.js +109 -0
  348. package/dist/channels/slack/reasoning-card.d.ts +38 -0
  349. package/dist/channels/slack/reasoning-card.d.ts.map +1 -0
  350. package/dist/channels/slack/reasoning-card.js +90 -0
  351. package/dist/channels/slack/reasoning-chip.d.ts +8 -0
  352. package/dist/channels/slack/reasoning-chip.d.ts.map +1 -0
  353. package/dist/channels/slack/reasoning-chip.js +30 -0
  354. package/dist/channels/slack/recording-sink.d.ts +29 -0
  355. package/dist/channels/slack/recording-sink.d.ts.map +1 -0
  356. package/dist/channels/slack/recording-sink.js +128 -0
  357. package/dist/channels/slack/redact.d.ts +2 -0
  358. package/dist/channels/slack/redact.d.ts.map +1 -0
  359. package/dist/channels/slack/redact.js +5 -0
  360. package/dist/channels/slack/reply-options.d.ts +56 -0
  361. package/dist/channels/slack/reply-options.d.ts.map +1 -0
  362. package/dist/channels/slack/reply-options.js +218 -0
  363. package/dist/channels/slack/self-identity.d.ts +18 -0
  364. package/dist/channels/slack/self-identity.d.ts.map +1 -0
  365. package/dist/channels/slack/self-identity.js +49 -0
  366. package/dist/channels/slack/sender-name.d.ts +26 -0
  367. package/dist/channels/slack/sender-name.d.ts.map +1 -0
  368. package/dist/channels/slack/sender-name.js +79 -0
  369. package/dist/channels/slack/setup.d.ts +33 -0
  370. package/dist/channels/slack/setup.d.ts.map +1 -0
  371. package/dist/channels/slack/setup.js +99 -0
  372. package/dist/channels/slack/slack-channel.d.ts +46 -0
  373. package/dist/channels/slack/slack-channel.d.ts.map +1 -0
  374. package/dist/channels/slack/slack-channel.js +683 -0
  375. package/dist/channels/slack/socket-mode.d.ts +26 -0
  376. package/dist/channels/slack/socket-mode.d.ts.map +1 -0
  377. package/dist/channels/slack/socket-mode.js +100 -0
  378. package/dist/channels/slack/stop.d.ts +14 -0
  379. package/dist/channels/slack/stop.d.ts.map +1 -0
  380. package/dist/channels/slack/stop.js +22 -0
  381. package/dist/channels/slack/stream.d.ts +42 -0
  382. package/dist/channels/slack/stream.d.ts.map +1 -0
  383. package/dist/channels/slack/stream.js +30 -0
  384. package/dist/channels/slack/thread-context.d.ts +89 -0
  385. package/dist/channels/slack/thread-context.d.ts.map +1 -0
  386. package/dist/channels/slack/thread-context.js +459 -0
  387. package/dist/channels/slack/tool-approval-events.d.ts +38 -0
  388. package/dist/channels/slack/tool-approval-events.d.ts.map +1 -0
  389. package/dist/channels/slack/tool-approval-events.js +207 -0
  390. package/dist/channels/slack/tool-cards.d.ts +22 -0
  391. package/dist/channels/slack/tool-cards.d.ts.map +1 -0
  392. package/dist/channels/slack/tool-cards.js +167 -0
  393. package/dist/channels/slack/tool-chip.d.ts +9 -0
  394. package/dist/channels/slack/tool-chip.d.ts.map +1 -0
  395. package/dist/channels/slack/tool-chip.js +22 -0
  396. package/dist/channels/slack/types.d.ts +811 -0
  397. package/dist/channels/slack/types.d.ts.map +1 -0
  398. package/dist/channels/slack/types.js +4 -0
  399. package/dist/channels/slack/upload.d.ts +13 -0
  400. package/dist/channels/slack/upload.d.ts.map +1 -0
  401. package/dist/channels/slack/upload.js +122 -0
  402. package/dist/channels/slack/user-info.d.ts +16 -0
  403. package/dist/channels/slack/user-info.d.ts.map +1 -0
  404. package/dist/channels/slack/user-info.js +58 -0
  405. package/dist/channels.d.ts +188 -0
  406. package/dist/channels.d.ts.map +1 -0
  407. package/dist/channels.js +421 -0
  408. package/dist/connections.d.ts +160 -0
  409. package/dist/connections.d.ts.map +1 -0
  410. package/dist/connections.js +185 -0
  411. package/dist/dashboard-session-url.d.ts +15 -0
  412. package/dist/dashboard-session-url.d.ts.map +1 -0
  413. package/dist/dashboard-session-url.js +24 -0
  414. package/dist/docs/404.html +24 -0
  415. package/dist/docs/architecture.svg +59 -0
  416. package/dist/docs/assets/app.wA5xBBcd.js +309 -0
  417. package/dist/docs/assets/building-with-agents.md.FZXrY8Nk.js +9 -0
  418. package/dist/docs/assets/building-with-agents.md.FZXrY8Nk.lean.js +1 -0
  419. package/dist/docs/assets/changelog.md.BvHRIiMH.js +1 -0
  420. package/dist/docs/assets/changelog.md.BvHRIiMH.lean.js +1 -0
  421. package/dist/docs/assets/chunks/@localSearchIndexroot.BoDEJQWv.js +1 -0
  422. package/dist/docs/assets/chunks/VPLocalSearchBox.C29HLCVL.js +9 -0
  423. package/dist/docs/assets/chunks/arc.BOaoYWmh.js +1 -0
  424. package/dist/docs/assets/chunks/architectureDiagram-Q4EWVU46.MfG0itQh.js +36 -0
  425. package/dist/docs/assets/chunks/baseUniq.CUeJciCF.js +1 -0
  426. package/dist/docs/assets/chunks/blockDiagram-DXYQGD6D.BrXMZRtK.js +132 -0
  427. package/dist/docs/assets/chunks/c4Diagram-AHTNJAMY.DfkDHeB9.js +10 -0
  428. package/dist/docs/assets/chunks/channel.D2BTz0L-.js +1 -0
  429. package/dist/docs/assets/chunks/chunk-4BX2VUAB.xKz8CiXK.js +1 -0
  430. package/dist/docs/assets/chunks/chunk-4TB4RGXK.kkfBh4zk.js +206 -0
  431. package/dist/docs/assets/chunks/chunk-55IACEB6.BClJGb94.js +1 -0
  432. package/dist/docs/assets/chunks/chunk-EDXVE4YY.P9BpQ9L3.js +1 -0
  433. package/dist/docs/assets/chunks/chunk-FMBD7UC4.R4iYi58S.js +15 -0
  434. package/dist/docs/assets/chunks/chunk-OYMX7WX6.Cpn8L1dw.js +231 -0
  435. package/dist/docs/assets/chunks/chunk-QZHKN3VN.BLftECqU.js +1 -0
  436. package/dist/docs/assets/chunks/chunk-YZCP3GAM.BWDV1AYt.js +1 -0
  437. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DqByliAC.js +1 -0
  438. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DqByliAC.js +1 -0
  439. package/dist/docs/assets/chunks/clone.CldT1lbQ.js +1 -0
  440. package/dist/docs/assets/chunks/cose-bilkent-S5V4N54A.DGpAcJ55.js +1 -0
  441. package/dist/docs/assets/chunks/cytoscape.esm.BQk4lpUV.js +331 -0
  442. package/dist/docs/assets/chunks/dagre-KV5264BT.BBXxGEaD.js +4 -0
  443. package/dist/docs/assets/chunks/defaultLocale.C4B-KCzX.js +1 -0
  444. package/dist/docs/assets/chunks/diagram-5BDNPKRD.EKqOwmK2.js +10 -0
  445. package/dist/docs/assets/chunks/diagram-G4DWMVQ6.CB8pdkoZ.js +24 -0
  446. package/dist/docs/assets/chunks/diagram-MMDJMWI5.aHh4WGg9.js +43 -0
  447. package/dist/docs/assets/chunks/diagram-TYMM5635.YIsbRH20.js +24 -0
  448. package/dist/docs/assets/chunks/erDiagram-SMLLAGMA.B3bTCW_e.js +85 -0
  449. package/dist/docs/assets/chunks/flowDiagram-DWJPFMVM.M81hXIXZ.js +162 -0
  450. package/dist/docs/assets/chunks/framework.BNw1pucY.js +19 -0
  451. package/dist/docs/assets/chunks/ganttDiagram-T4ZO3ILL.BKg7WY--.js +292 -0
  452. package/dist/docs/assets/chunks/gitGraphDiagram-UUTBAWPF.CLEMZgO3.js +106 -0
  453. package/dist/docs/assets/chunks/graph.DS38W_Q-.js +1 -0
  454. package/dist/docs/assets/chunks/infoDiagram-42DDH7IO.BTiWTi82.js +2 -0
  455. package/dist/docs/assets/chunks/init.Gi6I4Gst.js +1 -0
  456. package/dist/docs/assets/chunks/ishikawaDiagram-UXIWVN3A.DcqY_KQL.js +70 -0
  457. package/dist/docs/assets/chunks/journeyDiagram-VCZTEJTY.0lQNZ40U.js +139 -0
  458. package/dist/docs/assets/chunks/kanban-definition-6JOO6SKY.L5sKlf7X.js +89 -0
  459. package/dist/docs/assets/chunks/katex.DkKDou_j.js +257 -0
  460. package/dist/docs/assets/chunks/layout.7u4gFhQa.js +1 -0
  461. package/dist/docs/assets/chunks/linear.D5v33SOb.js +1 -0
  462. package/dist/docs/assets/chunks/min.Dc9uCxf9.js +1 -0
  463. package/dist/docs/assets/chunks/mindmap-definition-QFDTVHPH.B56nGoB_.js +96 -0
  464. package/dist/docs/assets/chunks/ordinal.DBvzRdQf.js +1 -0
  465. package/dist/docs/assets/chunks/pieDiagram-DEJITSTG.Cba8e8lS.js +30 -0
  466. package/dist/docs/assets/chunks/quadrantDiagram-34T5L4WZ.2YjBycHF.js +7 -0
  467. package/dist/docs/assets/chunks/requirementDiagram-MS252O5E.D4P5RqVI.js +84 -0
  468. package/dist/docs/assets/chunks/sankeyDiagram-XADWPNL6.C0Hn8NUm.js +10 -0
  469. package/dist/docs/assets/chunks/sequenceDiagram-FGHM5R23.BZm7EaoT.js +157 -0
  470. package/dist/docs/assets/chunks/stateDiagram-FHFEXIEX.DcR4f3X2.js +1 -0
  471. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.Bb4oMe0P.js +1 -0
  472. package/dist/docs/assets/chunks/theme.DvfKzyXq.js +2 -0
  473. package/dist/docs/assets/chunks/timeline-definition-GMOUNBTQ.CgDh96vg.js +120 -0
  474. package/dist/docs/assets/chunks/vennDiagram-DHZGUBPP.B4fagbC8.js +34 -0
  475. package/dist/docs/assets/chunks/virtual_mermaid-config.DDnGl6nM.js +1 -0
  476. package/dist/docs/assets/chunks/wardley-RL74JXVD.Ck68omim.js +162 -0
  477. package/dist/docs/assets/chunks/wardleyDiagram-NUSXRM2D.DBUg0bvz.js +20 -0
  478. package/dist/docs/assets/chunks/xychartDiagram-5P7HB3ND.DnKSGQE1.js +7 -0
  479. package/dist/docs/assets/deployment.md.3MMWuPeV.js +31 -0
  480. package/dist/docs/assets/deployment.md.3MMWuPeV.lean.js +1 -0
  481. package/dist/docs/assets/evals.md.CHR34K1Y.js +68 -0
  482. package/dist/docs/assets/evals.md.CHR34K1Y.lean.js +1 -0
  483. package/dist/docs/assets/guides_agent-to-agent.md.CwL5cwuE.js +42 -0
  484. package/dist/docs/assets/guides_agent-to-agent.md.CwL5cwuE.lean.js +1 -0
  485. package/dist/docs/assets/guides_bitbucket.md.CKUayYtD.js +145 -0
  486. package/dist/docs/assets/guides_bitbucket.md.CKUayYtD.lean.js +1 -0
  487. package/dist/docs/assets/guides_cloud-agents.md.BzbzcOyj.js +9 -0
  488. package/dist/docs/assets/guides_cloud-agents.md.BzbzcOyj.lean.js +1 -0
  489. package/dist/docs/assets/guides_convert-automation.md.DMEX9nF-.js +43 -0
  490. package/dist/docs/assets/guides_convert-automation.md.DMEX9nF-.lean.js +1 -0
  491. package/dist/docs/assets/guides_export-grokbot.md.qo5bxi4h.js +55 -0
  492. package/dist/docs/assets/guides_export-grokbot.md.qo5bxi4h.lean.js +1 -0
  493. package/dist/docs/assets/guides_github.md.TuNiZAOQ.js +162 -0
  494. package/dist/docs/assets/guides_github.md.TuNiZAOQ.lean.js +1 -0
  495. package/dist/docs/assets/guides_gitlab.md.CtNI4fSH.js +153 -0
  496. package/dist/docs/assets/guides_gitlab.md.CtNI4fSH.lean.js +1 -0
  497. package/dist/docs/assets/guides_grokbot-agents.md.BwAykJ7U.js +15 -0
  498. package/dist/docs/assets/guides_grokbot-agents.md.BwAykJ7U.lean.js +1 -0
  499. package/dist/docs/assets/guides_hooks.md.B2XfGX50.js +54 -0
  500. package/dist/docs/assets/guides_hooks.md.B2XfGX50.lean.js +1 -0
  501. package/dist/docs/assets/guides_improve.md.CZKVt1cT.js +21 -0
  502. package/dist/docs/assets/guides_improve.md.CZKVt1cT.lean.js +1 -0
  503. package/dist/docs/assets/guides_jev.md.D7XH4JH3.js +151 -0
  504. package/dist/docs/assets/guides_jev.md.D7XH4JH3.lean.js +1 -0
  505. package/dist/docs/assets/guides_mcp-oauth.md.Cxq2TxBB.js +38 -0
  506. package/dist/docs/assets/guides_mcp-oauth.md.Cxq2TxBB.lean.js +1 -0
  507. package/dist/docs/assets/guides_migrate.md.CQlGaBKX.js +7 -0
  508. package/dist/docs/assets/guides_migrate.md.CQlGaBKX.lean.js +1 -0
  509. package/dist/docs/assets/guides_opentelemetry.md.D4wO7_8v.js +37 -0
  510. package/dist/docs/assets/guides_opentelemetry.md.D4wO7_8v.lean.js +1 -0
  511. package/dist/docs/assets/guides_pagerduty.md.BHXMcMtx.js +60 -0
  512. package/dist/docs/assets/guides_pagerduty.md.BHXMcMtx.lean.js +1 -0
  513. package/dist/docs/assets/guides_slack.md.ClIyi7FI.js +75 -0
  514. package/dist/docs/assets/guides_slack.md.ClIyi7FI.lean.js +1 -0
  515. package/dist/docs/assets/guides_webhooks.md.Cpdc3BDX.js +93 -0
  516. package/dist/docs/assets/guides_webhooks.md.Cpdc3BDX.lean.js +1 -0
  517. package/dist/docs/assets/hillclimbing.md.Dxvd-0gT.js +7 -0
  518. package/dist/docs/assets/hillclimbing.md.Dxvd-0gT.lean.js +1 -0
  519. package/dist/docs/assets/index.md.CAnsLl8D.js +27 -0
  520. package/dist/docs/assets/index.md.CAnsLl8D.lean.js +1 -0
  521. package/dist/docs/assets/inter-italic-cyrillic-ext.r48I6akx.woff2 +0 -0
  522. package/dist/docs/assets/inter-italic-cyrillic.By2_1cv3.woff2 +0 -0
  523. package/dist/docs/assets/inter-italic-greek-ext.1u6EdAuj.woff2 +0 -0
  524. package/dist/docs/assets/inter-italic-greek.DJ8dCoTZ.woff2 +0 -0
  525. package/dist/docs/assets/inter-italic-latin-ext.CN1xVJS-.woff2 +0 -0
  526. package/dist/docs/assets/inter-italic-latin.C2AdPX0b.woff2 +0 -0
  527. package/dist/docs/assets/inter-italic-vietnamese.BSbpV94h.woff2 +0 -0
  528. package/dist/docs/assets/inter-roman-cyrillic-ext.BBPuwvHQ.woff2 +0 -0
  529. package/dist/docs/assets/inter-roman-cyrillic.C5lxZ8CY.woff2 +0 -0
  530. package/dist/docs/assets/inter-roman-greek-ext.CqjqNYQ-.woff2 +0 -0
  531. package/dist/docs/assets/inter-roman-greek.BBVDIX6e.woff2 +0 -0
  532. package/dist/docs/assets/inter-roman-latin-ext.4ZJIpNVo.woff2 +0 -0
  533. package/dist/docs/assets/inter-roman-latin.Di8DUHzh.woff2 +0 -0
  534. package/dist/docs/assets/inter-roman-vietnamese.BjW4sHH5.woff2 +0 -0
  535. package/dist/docs/assets/quickstart.md.D8JDfkKO.js +170 -0
  536. package/dist/docs/assets/quickstart.md.D8JDfkKO.lean.js +1 -0
  537. package/dist/docs/assets/reference_agent-config.md.CZrbHOfT.js +38 -0
  538. package/dist/docs/assets/reference_agent-config.md.CZrbHOfT.lean.js +1 -0
  539. package/dist/docs/assets/reference_artifacts.md.DLV9MZES.js +18 -0
  540. package/dist/docs/assets/reference_artifacts.md.DLV9MZES.lean.js +1 -0
  541. package/dist/docs/assets/reference_channels.md.CNNIS6K7.js +22 -0
  542. package/dist/docs/assets/reference_channels.md.CNNIS6K7.lean.js +1 -0
  543. package/dist/docs/assets/reference_cli.md.1o_TqKdt.js +103 -0
  544. package/dist/docs/assets/reference_cli.md.1o_TqKdt.lean.js +1 -0
  545. package/dist/docs/assets/reference_connections.md.BJE2Zllp.js +66 -0
  546. package/dist/docs/assets/reference_connections.md.BJE2Zllp.lean.js +1 -0
  547. package/dist/docs/assets/reference_evals.md.Ccwp4x3o.js +56 -0
  548. package/dist/docs/assets/reference_evals.md.Ccwp4x3o.lean.js +1 -0
  549. package/dist/docs/assets/reference_extensions.md.DKxTuCIw.js +62 -0
  550. package/dist/docs/assets/reference_extensions.md.DKxTuCIw.lean.js +1 -0
  551. package/dist/docs/assets/reference_hooks.md.CROr0QgC.js +51 -0
  552. package/dist/docs/assets/reference_hooks.md.CROr0QgC.lean.js +1 -0
  553. package/dist/docs/assets/reference_http-api.md.Dji-DD_Z.js +11 -0
  554. package/dist/docs/assets/reference_http-api.md.Dji-DD_Z.lean.js +1 -0
  555. package/dist/docs/assets/reference_instructions.md.BYMVxAkw.js +14 -0
  556. package/dist/docs/assets/reference_instructions.md.BYMVxAkw.lean.js +1 -0
  557. package/dist/docs/assets/reference_memory.md.BwyJXYZe.js +4 -0
  558. package/dist/docs/assets/reference_memory.md.BwyJXYZe.lean.js +1 -0
  559. package/dist/docs/assets/reference_playground.md.q4MI-0td.js +1 -0
  560. package/dist/docs/assets/reference_playground.md.q4MI-0td.lean.js +1 -0
  561. package/dist/docs/assets/reference_project-layout.md.mFcS8yDD.js +25 -0
  562. package/dist/docs/assets/reference_project-layout.md.mFcS8yDD.lean.js +1 -0
  563. package/dist/docs/assets/reference_prompt.md.DqPh71XN.js +9 -0
  564. package/dist/docs/assets/reference_prompt.md.DqPh71XN.lean.js +1 -0
  565. package/dist/docs/assets/reference_schedules.md.BqWnJES4.js +47 -0
  566. package/dist/docs/assets/reference_schedules.md.BqWnJES4.lean.js +1 -0
  567. package/dist/docs/assets/reference_sessions.md.Bi6lHttM.js +22 -0
  568. package/dist/docs/assets/reference_sessions.md.Bi6lHttM.lean.js +1 -0
  569. package/dist/docs/assets/reference_skills.md.Ckddg6KX.js +15 -0
  570. package/dist/docs/assets/reference_skills.md.Ckddg6KX.lean.js +1 -0
  571. package/dist/docs/assets/reference_subagents.md.ChNGh6HK.js +10 -0
  572. package/dist/docs/assets/reference_subagents.md.ChNGh6HK.lean.js +1 -0
  573. package/dist/docs/assets/reference_tools.md.Bo0UfT0a.js +79 -0
  574. package/dist/docs/assets/reference_tools.md.Bo0UfT0a.lean.js +1 -0
  575. package/dist/docs/assets/style.B9o0luvp.css +1 -0
  576. package/dist/docs/assets/templates_agentic-owners.md.CTEnR0jp.js +13 -0
  577. package/dist/docs/assets/templates_agentic-owners.md.CTEnR0jp.lean.js +1 -0
  578. package/dist/docs/assets/templates_grokbot-agents.md.DgpPEs7B.js +5 -0
  579. package/dist/docs/assets/templates_grokbot-agents.md.DgpPEs7B.lean.js +1 -0
  580. package/dist/docs/assets/templates_security-reviewer.md.Gh6EF9Us.js +3 -0
  581. package/dist/docs/assets/templates_security-reviewer.md.Gh6EF9Us.lean.js +1 -0
  582. package/dist/docs/assets/templates_thermo-quality-review.md.B77UyTrX.js +3 -0
  583. package/dist/docs/assets/templates_thermo-quality-review.md.B77UyTrX.lean.js +1 -0
  584. package/dist/docs/assets/templates_thermo-review.md.DRJ7mC5U.js +3 -0
  585. package/dist/docs/assets/templates_thermo-review.md.DRJ7mC5U.lean.js +1 -0
  586. package/dist/docs/assets/templates_triage.md.CNN6b0JZ.js +9 -0
  587. package/dist/docs/assets/templates_triage.md.CNN6b0JZ.lean.js +1 -0
  588. package/dist/docs/assets/troubleshooting.md.DFnoTDlQ.js +1 -0
  589. package/dist/docs/assets/troubleshooting.md.DFnoTDlQ.lean.js +1 -0
  590. package/dist/docs/building-with-agents.html +68 -0
  591. package/dist/docs/building-with-agents.md +134 -0
  592. package/dist/docs/changelog.html +60 -0
  593. package/dist/docs/changelog.md +114 -0
  594. package/dist/docs/deployment.html +90 -0
  595. package/dist/docs/deployment.md +309 -0
  596. package/dist/docs/evals.html +127 -0
  597. package/dist/docs/evals.md +239 -0
  598. package/dist/docs/guides/agent-to-agent.html +101 -0
  599. package/dist/docs/guides/agent-to-agent.md +162 -0
  600. package/dist/docs/guides/bitbucket.html +204 -0
  601. package/dist/docs/guides/bitbucket.md +293 -0
  602. package/dist/docs/guides/cloud-agents.html +68 -0
  603. package/dist/docs/guides/cloud-agents.md +81 -0
  604. package/dist/docs/guides/convert-automation.html +102 -0
  605. package/dist/docs/guides/convert-automation.md +180 -0
  606. package/dist/docs/guides/export-grokbot.html +114 -0
  607. package/dist/docs/guides/export-grokbot.md +239 -0
  608. package/dist/docs/guides/github.html +221 -0
  609. package/dist/docs/guides/github.md +373 -0
  610. package/dist/docs/guides/gitlab.html +212 -0
  611. package/dist/docs/guides/gitlab.md +299 -0
  612. package/dist/docs/guides/grokbot-agents.html +74 -0
  613. package/dist/docs/guides/grokbot-agents.md +135 -0
  614. package/dist/docs/guides/hooks.html +113 -0
  615. package/dist/docs/guides/hooks.md +116 -0
  616. package/dist/docs/guides/improve.html +80 -0
  617. package/dist/docs/guides/improve.md +129 -0
  618. package/dist/docs/guides/jev.html +210 -0
  619. package/dist/docs/guides/jev.md +298 -0
  620. package/dist/docs/guides/mcp-oauth.html +97 -0
  621. package/dist/docs/guides/mcp-oauth.md +148 -0
  622. package/dist/docs/guides/migrate.html +66 -0
  623. package/dist/docs/guides/migrate.md +164 -0
  624. package/dist/docs/guides/opentelemetry.html +96 -0
  625. package/dist/docs/guides/opentelemetry.md +205 -0
  626. package/dist/docs/guides/pagerduty.html +119 -0
  627. package/dist/docs/guides/pagerduty.md +336 -0
  628. package/dist/docs/guides/slack.html +134 -0
  629. package/dist/docs/guides/slack.md +309 -0
  630. package/dist/docs/guides/webhooks.html +152 -0
  631. package/dist/docs/guides/webhooks.md +250 -0
  632. package/dist/docs/hashmap.json +1 -0
  633. package/dist/docs/hillclimbing.html +66 -0
  634. package/dist/docs/hillclimbing.md +134 -0
  635. package/dist/docs/index.html +86 -0
  636. package/dist/docs/index.md +110 -0
  637. package/dist/docs/llms-full.txt +10077 -0
  638. package/dist/docs/llms.txt +68 -0
  639. package/dist/docs/quickstart.html +229 -0
  640. package/dist/docs/quickstart.md +307 -0
  641. package/dist/docs/reference/agent-config.html +97 -0
  642. package/dist/docs/reference/agent-config.md +238 -0
  643. package/dist/docs/reference/artifacts.html +77 -0
  644. package/dist/docs/reference/artifacts.md +113 -0
  645. package/dist/docs/reference/channels.html +81 -0
  646. package/dist/docs/reference/channels.md +214 -0
  647. package/dist/docs/reference/cli.html +162 -0
  648. package/dist/docs/reference/cli.md +1098 -0
  649. package/dist/docs/reference/connections.html +125 -0
  650. package/dist/docs/reference/connections.md +307 -0
  651. package/dist/docs/reference/evals.html +115 -0
  652. package/dist/docs/reference/evals.md +294 -0
  653. package/dist/docs/reference/extensions.html +121 -0
  654. package/dist/docs/reference/extensions.md +209 -0
  655. package/dist/docs/reference/hooks.html +110 -0
  656. package/dist/docs/reference/hooks.md +197 -0
  657. package/dist/docs/reference/http-api.html +70 -0
  658. package/dist/docs/reference/http-api.md +221 -0
  659. package/dist/docs/reference/instructions.html +73 -0
  660. package/dist/docs/reference/instructions.md +64 -0
  661. package/dist/docs/reference/memory.html +63 -0
  662. package/dist/docs/reference/memory.md +114 -0
  663. package/dist/docs/reference/playground.html +60 -0
  664. package/dist/docs/reference/playground.md +36 -0
  665. package/dist/docs/reference/project-layout.html +84 -0
  666. package/dist/docs/reference/project-layout.md +117 -0
  667. package/dist/docs/reference/prompt.html +68 -0
  668. package/dist/docs/reference/prompt.md +47 -0
  669. package/dist/docs/reference/schedules.html +106 -0
  670. package/dist/docs/reference/schedules.md +190 -0
  671. package/dist/docs/reference/sessions.html +81 -0
  672. package/dist/docs/reference/sessions.md +200 -0
  673. package/dist/docs/reference/skills.html +74 -0
  674. package/dist/docs/reference/skills.md +72 -0
  675. package/dist/docs/reference/subagents.html +69 -0
  676. package/dist/docs/reference/subagents.md +61 -0
  677. package/dist/docs/reference/tools.html +138 -0
  678. package/dist/docs/reference/tools.md +306 -0
  679. package/dist/docs/templates/agentic-owners.html +72 -0
  680. package/dist/docs/templates/agentic-owners.md +126 -0
  681. package/dist/docs/templates/grokbot-agents.html +64 -0
  682. package/dist/docs/templates/grokbot-agents.md +55 -0
  683. package/dist/docs/templates/security-reviewer.html +62 -0
  684. package/dist/docs/templates/security-reviewer.md +81 -0
  685. package/dist/docs/templates/thermo-quality-review.html +62 -0
  686. package/dist/docs/templates/thermo-quality-review.md +75 -0
  687. package/dist/docs/templates/thermo-review.html +62 -0
  688. package/dist/docs/templates/thermo-review.md +75 -0
  689. package/dist/docs/templates/triage.html +68 -0
  690. package/dist/docs/templates/triage.md +101 -0
  691. package/dist/docs/troubleshooting.html +60 -0
  692. package/dist/docs/troubleshooting.md +149 -0
  693. package/dist/docs/vp-icons.css +0 -0
  694. package/dist/evals/assertions.d.ts +199 -0
  695. package/dist/evals/assertions.d.ts.map +1 -0
  696. package/dist/evals/assertions.js +447 -0
  697. package/dist/evals/expect.d.ts +95 -0
  698. package/dist/evals/expect.d.ts.map +1 -0
  699. package/dist/evals/expect.js +184 -0
  700. package/dist/evals/judge.d.ts +134 -0
  701. package/dist/evals/judge.d.ts.map +1 -0
  702. package/dist/evals/judge.js +221 -0
  703. package/dist/evals/loaders.d.ts +51 -0
  704. package/dist/evals/loaders.d.ts.map +1 -0
  705. package/dist/evals/loaders.js +107 -0
  706. package/dist/evals/matchers.d.ts +95 -0
  707. package/dist/evals/matchers.d.ts.map +1 -0
  708. package/dist/evals/matchers.js +141 -0
  709. package/dist/evals/reporters.d.ts +70 -0
  710. package/dist/evals/reporters.d.ts.map +1 -0
  711. package/dist/evals/reporters.js +196 -0
  712. package/dist/evals/results.d.ts +103 -0
  713. package/dist/evals/results.d.ts.map +1 -0
  714. package/dist/evals/results.js +27 -0
  715. package/dist/evals/run-facts.d.ts +77 -0
  716. package/dist/evals/run-facts.d.ts.map +1 -0
  717. package/dist/evals/run-facts.js +213 -0
  718. package/dist/evals.d.ts +446 -0
  719. package/dist/evals.d.ts.map +1 -0
  720. package/dist/evals.js +304 -0
  721. package/dist/executors.d.ts +11 -0
  722. package/dist/executors.d.ts.map +1 -0
  723. package/dist/executors.js +21 -0
  724. package/dist/extensions/cursor-cloud-agents/extension.d.ts +94 -0
  725. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -0
  726. package/dist/extensions/cursor-cloud-agents/extension.js +104 -0
  727. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts +118 -0
  728. package/dist/extensions/cursor-cloud-agents/lib/backend.d.ts.map +1 -0
  729. package/dist/extensions/cursor-cloud-agents/lib/backend.js +290 -0
  730. package/dist/extensions/cursor-cloud-agents/lib/channels.d.ts +3 -0
  731. package/dist/extensions/cursor-cloud-agents/lib/channels.d.ts.map +1 -0
  732. package/dist/extensions/cursor-cloud-agents/lib/channels.js +11 -0
  733. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts +25 -0
  734. package/dist/extensions/cursor-cloud-agents/lib/fleet.d.ts.map +1 -0
  735. package/dist/extensions/cursor-cloud-agents/lib/fleet.js +65 -0
  736. package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts +5 -0
  737. package/dist/extensions/cursor-cloud-agents/lib/inputs.d.ts.map +1 -0
  738. package/dist/extensions/cursor-cloud-agents/lib/inputs.js +4 -0
  739. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts +47 -0
  740. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.d.ts.map +1 -0
  741. package/dist/extensions/cursor-cloud-agents/lib/launch-agent.js +62 -0
  742. package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts +17 -0
  743. package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts.map +1 -0
  744. package/dist/extensions/cursor-cloud-agents/lib/repos.js +60 -0
  745. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts +8 -0
  746. package/dist/extensions/cursor-cloud-agents/lib/transcript.d.ts.map +1 -0
  747. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +14 -0
  748. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +17 -0
  749. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -0
  750. package/dist/extensions/cursor-cloud-agents/lib/watch.js +85 -0
  751. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +19 -0
  752. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -0
  753. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +60 -0
  754. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +41 -0
  755. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts +4 -0
  756. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -0
  757. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +19 -0
  758. package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts +4 -0
  759. package/dist/extensions/cursor-cloud-agents/tools/dump.d.ts.map +1 -0
  760. package/dist/extensions/cursor-cloud-agents/tools/dump.js +43 -0
  761. package/dist/extensions/cursor-cloud-agents/tools/get.d.ts +4 -0
  762. package/dist/extensions/cursor-cloud-agents/tools/get.d.ts.map +1 -0
  763. package/dist/extensions/cursor-cloud-agents/tools/get.js +14 -0
  764. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts +4 -0
  765. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -0
  766. package/dist/extensions/cursor-cloud-agents/tools/launch.js +49 -0
  767. package/dist/extensions/cursor-cloud-agents/tools/list.d.ts +4 -0
  768. package/dist/extensions/cursor-cloud-agents/tools/list.d.ts.map +1 -0
  769. package/dist/extensions/cursor-cloud-agents/tools/list.js +25 -0
  770. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts +4 -0
  771. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts.map +1 -0
  772. package/dist/extensions/cursor-cloud-agents/tools/reply.js +26 -0
  773. package/dist/extensions/cursor-grokbot-agents/extension.d.ts +77 -0
  774. package/dist/extensions/cursor-grokbot-agents/extension.d.ts.map +1 -0
  775. package/dist/extensions/cursor-grokbot-agents/extension.js +70 -0
  776. package/dist/extensions/cursor-grokbot-agents/lib/agents.d.ts +11 -0
  777. package/dist/extensions/cursor-grokbot-agents/lib/agents.d.ts.map +1 -0
  778. package/dist/extensions/cursor-grokbot-agents/lib/agents.js +31 -0
  779. package/dist/extensions/cursor-grokbot-agents/lib/backend.d.ts +56 -0
  780. package/dist/extensions/cursor-grokbot-agents/lib/backend.d.ts.map +1 -0
  781. package/dist/extensions/cursor-grokbot-agents/lib/backend.js +138 -0
  782. package/dist/extensions/cursor-grokbot-agents/lib/contacts.d.ts +28 -0
  783. package/dist/extensions/cursor-grokbot-agents/lib/contacts.d.ts.map +1 -0
  784. package/dist/extensions/cursor-grokbot-agents/lib/contacts.js +46 -0
  785. package/dist/extensions/cursor-grokbot-agents/lib/conversation.d.ts +53 -0
  786. package/dist/extensions/cursor-grokbot-agents/lib/conversation.d.ts.map +1 -0
  787. package/dist/extensions/cursor-grokbot-agents/lib/conversation.js +186 -0
  788. package/dist/extensions/cursor-grokbot-agents/lib/inputs.d.ts +4 -0
  789. package/dist/extensions/cursor-grokbot-agents/lib/inputs.d.ts.map +1 -0
  790. package/dist/extensions/cursor-grokbot-agents/lib/inputs.js +15 -0
  791. package/dist/extensions/cursor-grokbot-agents/lib/lock.d.ts +12 -0
  792. package/dist/extensions/cursor-grokbot-agents/lib/lock.d.ts.map +1 -0
  793. package/dist/extensions/cursor-grokbot-agents/lib/lock.js +24 -0
  794. package/dist/extensions/cursor-grokbot-agents/skills/consult.md +40 -0
  795. package/dist/extensions/cursor-grokbot-agents/tools/ask.d.ts +4 -0
  796. package/dist/extensions/cursor-grokbot-agents/tools/ask.d.ts.map +1 -0
  797. package/dist/extensions/cursor-grokbot-agents/tools/ask.js +26 -0
  798. package/dist/extensions/cursor-grokbot-agents/tools/check.d.ts +4 -0
  799. package/dist/extensions/cursor-grokbot-agents/tools/check.d.ts.map +1 -0
  800. package/dist/extensions/cursor-grokbot-agents/tools/check.js +21 -0
  801. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.d.ts +4 -0
  802. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.d.ts.map +1 -0
  803. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.js +13 -0
  804. package/dist/extensions/cursor-grokbot-agents/tools/list.d.ts +4 -0
  805. package/dist/extensions/cursor-grokbot-agents/tools/list.d.ts.map +1 -0
  806. package/dist/extensions/cursor-grokbot-agents/tools/list.js +22 -0
  807. package/dist/extensions/improve/extension.d.ts +48 -0
  808. package/dist/extensions/improve/extension.d.ts.map +1 -0
  809. package/dist/extensions/improve/extension.js +43 -0
  810. package/dist/extensions/improve/skills/yourself.d.ts +4 -0
  811. package/dist/extensions/improve/skills/yourself.d.ts.map +1 -0
  812. package/dist/extensions/improve/skills/yourself.js +43 -0
  813. package/dist/extensions/jev/extension.d.ts +46 -0
  814. package/dist/extensions/jev/extension.d.ts.map +1 -0
  815. package/dist/extensions/jev/extension.js +56 -0
  816. package/dist/extensions/jev/lib/evaluate.d.ts +105 -0
  817. package/dist/extensions/jev/lib/evaluate.d.ts.map +1 -0
  818. package/dist/extensions/jev/lib/evaluate.js +154 -0
  819. package/dist/extensions/jev/skills/gated-write.md +25 -0
  820. package/dist/extensions/jev/skills/questions.md +33 -0
  821. package/dist/extensions/jev/tools/evaluate.d.ts +4 -0
  822. package/dist/extensions/jev/tools/evaluate.d.ts.map +1 -0
  823. package/dist/extensions/jev/tools/evaluate.js +72 -0
  824. package/dist/extensions/slack-communication/extension.d.ts +28 -0
  825. package/dist/extensions/slack-communication/extension.d.ts.map +1 -0
  826. package/dist/extensions/slack-communication/extension.js +32 -0
  827. package/dist/extensions/slack-communication/skills/slack-voice.d.ts +5 -0
  828. package/dist/extensions/slack-communication/skills/slack-voice.d.ts.map +1 -0
  829. package/dist/extensions/slack-communication/skills/slack-voice.js +52 -0
  830. package/dist/extensions/slack-communication/tools/delete-message.d.ts +4 -0
  831. package/dist/extensions/slack-communication/tools/delete-message.d.ts.map +1 -0
  832. package/dist/extensions/slack-communication/tools/delete-message.js +29 -0
  833. package/dist/extensions/slack-communication/tools/edit-message.d.ts +4 -0
  834. package/dist/extensions/slack-communication/tools/edit-message.d.ts.map +1 -0
  835. package/dist/extensions/slack-communication/tools/edit-message.js +34 -0
  836. package/dist/extensions/slack-communication/tools/post-card.d.ts +4 -0
  837. package/dist/extensions/slack-communication/tools/post-card.d.ts.map +1 -0
  838. package/dist/extensions/slack-communication/tools/post-card.js +25 -0
  839. package/dist/extensions/slack-communication/tools/post-file.d.ts +4 -0
  840. package/dist/extensions/slack-communication/tools/post-file.d.ts.map +1 -0
  841. package/dist/extensions/slack-communication/tools/post-file.js +75 -0
  842. package/dist/extensions/slack-communication/tools/post-update.d.ts +4 -0
  843. package/dist/extensions/slack-communication/tools/post-update.d.ts.map +1 -0
  844. package/dist/extensions/slack-communication/tools/post-update.js +33 -0
  845. package/dist/extensions/slack-communication/tools/react.d.ts +4 -0
  846. package/dist/extensions/slack-communication/tools/react.d.ts.map +1 -0
  847. package/dist/extensions/slack-communication/tools/react.js +27 -0
  848. package/dist/extensions/slack-communication/tools/set-status.d.ts +4 -0
  849. package/dist/extensions/slack-communication/tools/set-status.d.ts.map +1 -0
  850. package/dist/extensions/slack-communication/tools/set-status.js +18 -0
  851. package/dist/extensions.d.ts +87 -0
  852. package/dist/extensions.d.ts.map +1 -0
  853. package/dist/extensions.js +141 -0
  854. package/dist/files-backends/agent-store-presigned-url.d.ts +3 -0
  855. package/dist/files-backends/agent-store-presigned-url.d.ts.map +1 -0
  856. package/dist/files-backends/agent-store-presigned-url.js +223 -0
  857. package/dist/files-backends/cursor-hosted.d.ts +65 -0
  858. package/dist/files-backends/cursor-hosted.d.ts.map +1 -0
  859. package/dist/files-backends/cursor-hosted.js +848 -0
  860. package/dist/files-backends/local-fs.d.ts +33 -0
  861. package/dist/files-backends/local-fs.d.ts.map +1 -0
  862. package/dist/files-backends/local-fs.js +133 -0
  863. package/dist/files.d.ts +203 -0
  864. package/dist/files.d.ts.map +1 -0
  865. package/dist/files.js +129 -0
  866. package/dist/filesystem.d.ts +515 -0
  867. package/dist/filesystem.d.ts.map +1 -0
  868. package/dist/filesystem.js +1596 -0
  869. package/dist/hooks.d.ts +25 -0
  870. package/dist/hooks.d.ts.map +1 -0
  871. package/dist/hooks.js +25 -0
  872. package/dist/index.d.ts +87 -0
  873. package/dist/index.d.ts.map +1 -0
  874. package/dist/index.js +94 -0
  875. package/dist/internal/advertise-tools.d.ts +96 -0
  876. package/dist/internal/advertise-tools.d.ts.map +1 -0
  877. package/dist/internal/advertise-tools.js +255 -0
  878. package/dist/internal/approval-gate.d.ts +35 -0
  879. package/dist/internal/approval-gate.d.ts.map +1 -0
  880. package/dist/internal/approval-gate.js +81 -0
  881. package/dist/internal/artifacts-store.d.ts +123 -0
  882. package/dist/internal/artifacts-store.d.ts.map +1 -0
  883. package/dist/internal/artifacts-store.js +657 -0
  884. package/dist/internal/as-of.d.ts +39 -0
  885. package/dist/internal/as-of.d.ts.map +1 -0
  886. package/dist/internal/as-of.js +207 -0
  887. package/dist/internal/auth.d.ts +12 -0
  888. package/dist/internal/auth.d.ts.map +1 -0
  889. package/dist/internal/auth.js +34 -0
  890. package/dist/internal/authored-alias-hooks.d.ts +43 -0
  891. package/dist/internal/authored-alias-hooks.d.ts.map +1 -0
  892. package/dist/internal/authored-alias-hooks.js +104 -0
  893. package/dist/internal/authored-loaders.d.ts +50 -0
  894. package/dist/internal/authored-loaders.d.ts.map +1 -0
  895. package/dist/internal/authored-loaders.js +183 -0
  896. package/dist/internal/bounded-int.d.ts +11 -0
  897. package/dist/internal/bounded-int.d.ts.map +1 -0
  898. package/dist/internal/bounded-int.js +12 -0
  899. package/dist/internal/bounded.d.ts +7 -0
  900. package/dist/internal/bounded.d.ts.map +1 -0
  901. package/dist/internal/bounded.js +21 -0
  902. package/dist/internal/brand.d.ts +6 -0
  903. package/dist/internal/brand.d.ts.map +1 -0
  904. package/dist/internal/brand.js +17 -0
  905. package/dist/internal/browser-origin-guard.d.ts +19 -0
  906. package/dist/internal/browser-origin-guard.d.ts.map +1 -0
  907. package/dist/internal/browser-origin-guard.js +51 -0
  908. package/dist/internal/builtin-tools/artifacts.d.ts +10 -0
  909. package/dist/internal/builtin-tools/artifacts.d.ts.map +1 -0
  910. package/dist/internal/builtin-tools/artifacts.js +87 -0
  911. package/dist/internal/builtin-tools/index.d.ts +17 -0
  912. package/dist/internal/builtin-tools/index.d.ts.map +1 -0
  913. package/dist/internal/builtin-tools/index.js +39 -0
  914. package/dist/internal/builtin-tools/reminders.d.ts +9 -0
  915. package/dist/internal/builtin-tools/reminders.d.ts.map +1 -0
  916. package/dist/internal/builtin-tools/reminders.js +115 -0
  917. package/dist/internal/channel-architecture.d.ts +21 -0
  918. package/dist/internal/channel-architecture.d.ts.map +1 -0
  919. package/dist/internal/channel-architecture.js +43 -0
  920. package/dist/internal/channel-dispatch.d.ts +43 -0
  921. package/dist/internal/channel-dispatch.d.ts.map +1 -0
  922. package/dist/internal/channel-dispatch.js +74 -0
  923. package/dist/internal/channel-route-dispatch.d.ts +13 -0
  924. package/dist/internal/channel-route-dispatch.d.ts.map +1 -0
  925. package/dist/internal/channel-route-dispatch.js +51 -0
  926. package/dist/internal/channel-state.d.ts +17 -0
  927. package/dist/internal/channel-state.d.ts.map +1 -0
  928. package/dist/internal/channel-state.js +69 -0
  929. package/dist/internal/chat-client.d.ts +45 -0
  930. package/dist/internal/chat-client.d.ts.map +1 -0
  931. package/dist/internal/chat-client.js +457 -0
  932. package/dist/internal/cli-ax.d.ts +227 -0
  933. package/dist/internal/cli-ax.d.ts.map +1 -0
  934. package/dist/internal/cli-ax.js +1825 -0
  935. package/dist/internal/cli-bitbucket.d.ts +33 -0
  936. package/dist/internal/cli-bitbucket.d.ts.map +1 -0
  937. package/dist/internal/cli-bitbucket.js +332 -0
  938. package/dist/internal/cli-convert-automation.d.ts +39 -0
  939. package/dist/internal/cli-convert-automation.d.ts.map +1 -0
  940. package/dist/internal/cli-convert-automation.js +257 -0
  941. package/dist/internal/cli-cursor.d.ts +38 -0
  942. package/dist/internal/cli-cursor.d.ts.map +1 -0
  943. package/dist/internal/cli-cursor.js +205 -0
  944. package/dist/internal/cli-deploy.d.ts +171 -0
  945. package/dist/internal/cli-deploy.d.ts.map +1 -0
  946. package/dist/internal/cli-deploy.js +2072 -0
  947. package/dist/internal/cli-docs.d.ts +34 -0
  948. package/dist/internal/cli-docs.d.ts.map +1 -0
  949. package/dist/internal/cli-docs.js +156 -0
  950. package/dist/internal/cli-github.d.ts +47 -0
  951. package/dist/internal/cli-github.d.ts.map +1 -0
  952. package/dist/internal/cli-github.js +600 -0
  953. package/dist/internal/cli-gitlab.d.ts +37 -0
  954. package/dist/internal/cli-gitlab.d.ts.map +1 -0
  955. package/dist/internal/cli-gitlab.js +350 -0
  956. package/dist/internal/cli-images.d.ts +68 -0
  957. package/dist/internal/cli-images.d.ts.map +1 -0
  958. package/dist/internal/cli-images.js +536 -0
  959. package/dist/internal/cli-init-grokbot.d.ts +29 -0
  960. package/dist/internal/cli-init-grokbot.d.ts.map +1 -0
  961. package/dist/internal/cli-init-grokbot.js +181 -0
  962. package/dist/internal/cli-manifest.d.ts +19 -0
  963. package/dist/internal/cli-manifest.d.ts.map +1 -0
  964. package/dist/internal/cli-manifest.js +37 -0
  965. package/dist/internal/cli-mcp-oauth.d.ts +51 -0
  966. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -0
  967. package/dist/internal/cli-mcp-oauth.js +300 -0
  968. package/dist/internal/cli-mcp.d.ts +75 -0
  969. package/dist/internal/cli-mcp.d.ts.map +1 -0
  970. package/dist/internal/cli-mcp.js +659 -0
  971. package/dist/internal/cli-migrate.d.ts +18 -0
  972. package/dist/internal/cli-migrate.d.ts.map +1 -0
  973. package/dist/internal/cli-migrate.js +351 -0
  974. package/dist/internal/cli-pagerduty.d.ts +32 -0
  975. package/dist/internal/cli-pagerduty.d.ts.map +1 -0
  976. package/dist/internal/cli-pagerduty.js +242 -0
  977. package/dist/internal/cli-skills.d.ts +21 -0
  978. package/dist/internal/cli-skills.d.ts.map +1 -0
  979. package/dist/internal/cli-skills.js +65 -0
  980. package/dist/internal/cli-slack-manual.d.ts +41 -0
  981. package/dist/internal/cli-slack-manual.d.ts.map +1 -0
  982. package/dist/internal/cli-slack-manual.js +296 -0
  983. package/dist/internal/cli-slack.d.ts +59 -0
  984. package/dist/internal/cli-slack.d.ts.map +1 -0
  985. package/dist/internal/cli-slack.js +708 -0
  986. package/dist/internal/cloud-merge.d.ts +25 -0
  987. package/dist/internal/cloud-merge.d.ts.map +1 -0
  988. package/dist/internal/cloud-merge.js +40 -0
  989. package/dist/internal/cloud-turn-usage.d.ts +34 -0
  990. package/dist/internal/cloud-turn-usage.d.ts.map +1 -0
  991. package/dist/internal/cloud-turn-usage.js +94 -0
  992. package/dist/internal/comment-safe.d.ts +8 -0
  993. package/dist/internal/comment-safe.d.ts.map +1 -0
  994. package/dist/internal/comment-safe.js +12 -0
  995. package/dist/internal/connection-env.d.ts +31 -0
  996. package/dist/internal/connection-env.d.ts.map +1 -0
  997. package/dist/internal/connection-env.js +83 -0
  998. package/dist/internal/continuation-channel.d.ts +48 -0
  999. package/dist/internal/continuation-channel.d.ts.map +1 -0
  1000. package/dist/internal/continuation-channel.js +170 -0
  1001. package/dist/internal/continuation-identity.d.ts +126 -0
  1002. package/dist/internal/continuation-identity.d.ts.map +1 -0
  1003. package/dist/internal/continuation-identity.js +897 -0
  1004. package/dist/internal/continuation.d.ts +3 -0
  1005. package/dist/internal/continuation.d.ts.map +1 -0
  1006. package/dist/internal/continuation.js +1 -0
  1007. package/dist/internal/conversation-mirror.d.ts +72 -0
  1008. package/dist/internal/conversation-mirror.d.ts.map +1 -0
  1009. package/dist/internal/conversation-mirror.js +401 -0
  1010. package/dist/internal/conversation-pack.d.ts +29 -0
  1011. package/dist/internal/conversation-pack.d.ts.map +1 -0
  1012. package/dist/internal/conversation-pack.js +96 -0
  1013. package/dist/internal/convert-automation/convert-workflow.d.ts +10 -0
  1014. package/dist/internal/convert-automation/convert-workflow.d.ts.map +1 -0
  1015. package/dist/internal/convert-automation/convert-workflow.js +976 -0
  1016. package/dist/internal/convert-automation/types.d.ts +202 -0
  1017. package/dist/internal/convert-automation/types.d.ts.map +1 -0
  1018. package/dist/internal/convert-automation/types.js +13 -0
  1019. package/dist/internal/convert-grokbot/answers.d.ts +127 -0
  1020. package/dist/internal/convert-grokbot/answers.d.ts.map +1 -0
  1021. package/dist/internal/convert-grokbot/answers.js +445 -0
  1022. package/dist/internal/convert-grokbot/bot.d.ts +50 -0
  1023. package/dist/internal/convert-grokbot/bot.d.ts.map +1 -0
  1024. package/dist/internal/convert-grokbot/bot.js +72 -0
  1025. package/dist/internal/convert-grokbot/checks.d.ts +26 -0
  1026. package/dist/internal/convert-grokbot/checks.d.ts.map +1 -0
  1027. package/dist/internal/convert-grokbot/checks.js +170 -0
  1028. package/dist/internal/convert-grokbot/convert.d.ts +60 -0
  1029. package/dist/internal/convert-grokbot/convert.d.ts.map +1 -0
  1030. package/dist/internal/convert-grokbot/convert.js +470 -0
  1031. package/dist/internal/convert-grokbot/handoff.d.ts +44 -0
  1032. package/dist/internal/convert-grokbot/handoff.d.ts.map +1 -0
  1033. package/dist/internal/convert-grokbot/handoff.js +160 -0
  1034. package/dist/internal/convert-grokbot/recipe.d.ts +61 -0
  1035. package/dist/internal/convert-grokbot/recipe.d.ts.map +1 -0
  1036. package/dist/internal/convert-grokbot/recipe.js +94 -0
  1037. package/dist/internal/convert-grokbot/routine.d.ts +51 -0
  1038. package/dist/internal/convert-grokbot/routine.d.ts.map +1 -0
  1039. package/dist/internal/convert-grokbot/routine.js +128 -0
  1040. package/dist/internal/convert-grokbot/slack.d.ts +28 -0
  1041. package/dist/internal/convert-grokbot/slack.d.ts.map +1 -0
  1042. package/dist/internal/convert-grokbot/slack.js +50 -0
  1043. package/dist/internal/cron.d.ts +17 -0
  1044. package/dist/internal/cron.d.ts.map +1 -0
  1045. package/dist/internal/cron.js +60 -0
  1046. package/dist/internal/cursor/account-mcp.d.ts +135 -0
  1047. package/dist/internal/cursor/account-mcp.d.ts.map +1 -0
  1048. package/dist/internal/cursor/account-mcp.js +513 -0
  1049. package/dist/internal/cursor/backend-client.d.ts +229 -0
  1050. package/dist/internal/cursor/backend-client.d.ts.map +1 -0
  1051. package/dist/internal/cursor/backend-client.js +700 -0
  1052. package/dist/internal/cursor/bound-secret-file.d.ts +56 -0
  1053. package/dist/internal/cursor/bound-secret-file.d.ts.map +1 -0
  1054. package/dist/internal/cursor/bound-secret-file.js +88 -0
  1055. package/dist/internal/cursor/credentials.d.ts +196 -0
  1056. package/dist/internal/cursor/credentials.d.ts.map +1 -0
  1057. package/dist/internal/cursor/credentials.js +463 -0
  1058. package/dist/internal/cursor/cursor-api-transport.d.ts +37 -0
  1059. package/dist/internal/cursor/cursor-api-transport.d.ts.map +1 -0
  1060. package/dist/internal/cursor/cursor-api-transport.js +40 -0
  1061. package/dist/internal/cursor/github-credentials.d.ts +44 -0
  1062. package/dist/internal/cursor/github-credentials.d.ts.map +1 -0
  1063. package/dist/internal/cursor/github-credentials.js +174 -0
  1064. package/dist/internal/cursor/hosted-bound-secrets.d.ts +45 -0
  1065. package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -0
  1066. package/dist/internal/cursor/hosted-bound-secrets.js +64 -0
  1067. package/dist/internal/cursor/hosted-deployment-secrets.d.ts +30 -0
  1068. package/dist/internal/cursor/hosted-deployment-secrets.d.ts.map +1 -0
  1069. package/dist/internal/cursor/hosted-deployment-secrets.js +97 -0
  1070. package/dist/internal/cursor/hosted-store-secrets.d.ts +39 -0
  1071. package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -0
  1072. package/dist/internal/cursor/hosted-store-secrets.js +84 -0
  1073. package/dist/internal/cursor/session-token.d.ts +45 -0
  1074. package/dist/internal/cursor/session-token.d.ts.map +1 -0
  1075. package/dist/internal/cursor/session-token.js +85 -0
  1076. package/dist/internal/cursor/store-api-client.d.ts +60 -0
  1077. package/dist/internal/cursor/store-api-client.d.ts.map +1 -0
  1078. package/dist/internal/cursor/store-api-client.js +189 -0
  1079. package/dist/internal/cursor-account-mcp-auth.d.ts +70 -0
  1080. package/dist/internal/cursor-account-mcp-auth.d.ts.map +1 -0
  1081. package/dist/internal/cursor-account-mcp-auth.js +233 -0
  1082. package/dist/internal/cursor-agent-template.d.ts +9 -0
  1083. package/dist/internal/cursor-agent-template.d.ts.map +1 -0
  1084. package/dist/internal/cursor-agent-template.js +43 -0
  1085. package/dist/internal/cursor-deployment-relay.d.ts +95 -0
  1086. package/dist/internal/cursor-deployment-relay.d.ts.map +1 -0
  1087. package/dist/internal/cursor-deployment-relay.js +212 -0
  1088. package/dist/internal/cursor-event-relay.d.ts +243 -0
  1089. package/dist/internal/cursor-event-relay.d.ts.map +1 -0
  1090. package/dist/internal/cursor-event-relay.js +430 -0
  1091. package/dist/internal/cursor-relay-core.d.ts +160 -0
  1092. package/dist/internal/cursor-relay-core.d.ts.map +1 -0
  1093. package/dist/internal/cursor-relay-core.js +442 -0
  1094. package/dist/internal/deferred-channel-session.d.ts +21 -0
  1095. package/dist/internal/deferred-channel-session.d.ts.map +1 -0
  1096. package/dist/internal/deferred-channel-session.js +55 -0
  1097. package/dist/internal/deploy-client.d.ts +604 -0
  1098. package/dist/internal/deploy-client.d.ts.map +1 -0
  1099. package/dist/internal/deploy-client.js +1009 -0
  1100. package/dist/internal/deploy-manifest.d.ts +179 -0
  1101. package/dist/internal/deploy-manifest.d.ts.map +1 -0
  1102. package/dist/internal/deploy-manifest.js +320 -0
  1103. package/dist/internal/deploy-source.d.ts +38 -0
  1104. package/dist/internal/deploy-source.d.ts.map +1 -0
  1105. package/dist/internal/deploy-source.js +124 -0
  1106. package/dist/internal/describe-error.d.ts +6 -0
  1107. package/dist/internal/describe-error.d.ts.map +1 -0
  1108. package/dist/internal/describe-error.js +31 -0
  1109. package/dist/internal/dev-mode.d.ts +13 -0
  1110. package/dist/internal/dev-mode.d.ts.map +1 -0
  1111. package/dist/internal/dev-mode.js +17 -0
  1112. package/dist/internal/discovery/agent-config.d.ts +55 -0
  1113. package/dist/internal/discovery/agent-config.d.ts.map +1 -0
  1114. package/dist/internal/discovery/agent-config.js +230 -0
  1115. package/dist/internal/discovery/agent.d.ts +16 -0
  1116. package/dist/internal/discovery/agent.d.ts.map +1 -0
  1117. package/dist/internal/discovery/agent.js +347 -0
  1118. package/dist/internal/discovery/channels.d.ts +10 -0
  1119. package/dist/internal/discovery/channels.d.ts.map +1 -0
  1120. package/dist/internal/discovery/channels.js +88 -0
  1121. package/dist/internal/discovery/connections.d.ts +13 -0
  1122. package/dist/internal/discovery/connections.d.ts.map +1 -0
  1123. package/dist/internal/discovery/connections.js +430 -0
  1124. package/dist/internal/discovery/context.d.ts +36 -0
  1125. package/dist/internal/discovery/context.d.ts.map +1 -0
  1126. package/dist/internal/discovery/context.js +84 -0
  1127. package/dist/internal/discovery/cursor-plugin.d.ts +25 -0
  1128. package/dist/internal/discovery/cursor-plugin.d.ts.map +1 -0
  1129. package/dist/internal/discovery/cursor-plugin.js +513 -0
  1130. package/dist/internal/discovery/extension-overlay.d.ts +31 -0
  1131. package/dist/internal/discovery/extension-overlay.d.ts.map +1 -0
  1132. package/dist/internal/discovery/extension-overlay.js +142 -0
  1133. package/dist/internal/discovery/extensions.d.ts +28 -0
  1134. package/dist/internal/discovery/extensions.d.ts.map +1 -0
  1135. package/dist/internal/discovery/extensions.js +376 -0
  1136. package/dist/internal/discovery/fs.d.ts +15 -0
  1137. package/dist/internal/discovery/fs.d.ts.map +1 -0
  1138. package/dist/internal/discovery/fs.js +92 -0
  1139. package/dist/internal/discovery/hooks.d.ts +7 -0
  1140. package/dist/internal/discovery/hooks.d.ts.map +1 -0
  1141. package/dist/internal/discovery/hooks.js +50 -0
  1142. package/dist/internal/discovery/info.d.ts +6 -0
  1143. package/dist/internal/discovery/info.d.ts.map +1 -0
  1144. package/dist/internal/discovery/info.js +166 -0
  1145. package/dist/internal/discovery/instructions.d.ts +7 -0
  1146. package/dist/internal/discovery/instructions.d.ts.map +1 -0
  1147. package/dist/internal/discovery/instructions.js +79 -0
  1148. package/dist/internal/discovery/instrumentation.d.ts +10 -0
  1149. package/dist/internal/discovery/instrumentation.d.ts.map +1 -0
  1150. package/dist/internal/discovery/instrumentation.js +29 -0
  1151. package/dist/internal/discovery/modules.d.ts +20 -0
  1152. package/dist/internal/discovery/modules.d.ts.map +1 -0
  1153. package/dist/internal/discovery/modules.js +88 -0
  1154. package/dist/internal/discovery/names.d.ts +14 -0
  1155. package/dist/internal/discovery/names.d.ts.map +1 -0
  1156. package/dist/internal/discovery/names.js +39 -0
  1157. package/dist/internal/discovery/project-public.d.ts +16 -0
  1158. package/dist/internal/discovery/project-public.d.ts.map +1 -0
  1159. package/dist/internal/discovery/project-public.js +54 -0
  1160. package/dist/internal/discovery/project.d.ts +57 -0
  1161. package/dist/internal/discovery/project.d.ts.map +1 -0
  1162. package/dist/internal/discovery/project.js +298 -0
  1163. package/dist/internal/discovery/reminders.d.ts +7 -0
  1164. package/dist/internal/discovery/reminders.d.ts.map +1 -0
  1165. package/dist/internal/discovery/reminders.js +54 -0
  1166. package/dist/internal/discovery/runtime.d.ts +34 -0
  1167. package/dist/internal/discovery/runtime.d.ts.map +1 -0
  1168. package/dist/internal/discovery/runtime.js +97 -0
  1169. package/dist/internal/discovery/schedules.d.ts +7 -0
  1170. package/dist/internal/discovery/schedules.d.ts.map +1 -0
  1171. package/dist/internal/discovery/schedules.js +107 -0
  1172. package/dist/internal/discovery/seed-files.d.ts +7 -0
  1173. package/dist/internal/discovery/seed-files.d.ts.map +1 -0
  1174. package/dist/internal/discovery/seed-files.js +30 -0
  1175. package/dist/internal/discovery/services.d.ts +27 -0
  1176. package/dist/internal/discovery/services.d.ts.map +1 -0
  1177. package/dist/internal/discovery/services.js +122 -0
  1178. package/dist/internal/discovery/skills.d.ts +11 -0
  1179. package/dist/internal/discovery/skills.d.ts.map +1 -0
  1180. package/dist/internal/discovery/skills.js +139 -0
  1181. package/dist/internal/discovery/subagent.d.ts +16 -0
  1182. package/dist/internal/discovery/subagent.d.ts.map +1 -0
  1183. package/dist/internal/discovery/subagent.js +113 -0
  1184. package/dist/internal/discovery/tools.d.ts +18 -0
  1185. package/dist/internal/discovery/tools.d.ts.map +1 -0
  1186. package/dist/internal/discovery/tools.js +144 -0
  1187. package/dist/internal/discovery.d.ts +15 -0
  1188. package/dist/internal/discovery.d.ts.map +1 -0
  1189. package/dist/internal/discovery.js +13 -0
  1190. package/dist/internal/distribution.d.ts +65 -0
  1191. package/dist/internal/distribution.d.ts.map +1 -0
  1192. package/dist/internal/distribution.js +102 -0
  1193. package/dist/internal/docs-site.d.ts +38 -0
  1194. package/dist/internal/docs-site.d.ts.map +1 -0
  1195. package/dist/internal/docs-site.js +216 -0
  1196. package/dist/internal/duration.d.ts +8 -0
  1197. package/dist/internal/duration.d.ts.map +1 -0
  1198. package/dist/internal/duration.js +35 -0
  1199. package/dist/internal/env-file.d.ts +19 -0
  1200. package/dist/internal/env-file.d.ts.map +1 -0
  1201. package/dist/internal/env-file.js +74 -0
  1202. package/dist/internal/estimate-cost.d.ts +55 -0
  1203. package/dist/internal/estimate-cost.d.ts.map +1 -0
  1204. package/dist/internal/estimate-cost.js +118 -0
  1205. package/dist/internal/eval-judge-model.d.ts +64 -0
  1206. package/dist/internal/eval-judge-model.d.ts.map +1 -0
  1207. package/dist/internal/eval-judge-model.js +129 -0
  1208. package/dist/internal/eval-run-store.d.ts +119 -0
  1209. package/dist/internal/eval-run-store.d.ts.map +1 -0
  1210. package/dist/internal/eval-run-store.js +479 -0
  1211. package/dist/internal/eval-runner.d.ts +106 -0
  1212. package/dist/internal/eval-runner.d.ts.map +1 -0
  1213. package/dist/internal/eval-runner.js +616 -0
  1214. package/dist/internal/eval-transport.d.ts +24 -0
  1215. package/dist/internal/eval-transport.d.ts.map +1 -0
  1216. package/dist/internal/eval-transport.js +22 -0
  1217. package/dist/internal/evals-client.d.ts +104 -0
  1218. package/dist/internal/evals-client.d.ts.map +1 -0
  1219. package/dist/internal/evals-client.js +299 -0
  1220. package/dist/internal/event-log.d.ts +94 -0
  1221. package/dist/internal/event-log.d.ts.map +1 -0
  1222. package/dist/internal/event-log.js +302 -0
  1223. package/dist/internal/event-mapper.d.ts +165 -0
  1224. package/dist/internal/event-mapper.d.ts.map +1 -0
  1225. package/dist/internal/event-mapper.js +665 -0
  1226. package/dist/internal/expected-delivery-failure.d.ts +3 -0
  1227. package/dist/internal/expected-delivery-failure.d.ts.map +1 -0
  1228. package/dist/internal/expected-delivery-failure.js +34 -0
  1229. package/dist/internal/factory-resource-channel.d.ts +33 -0
  1230. package/dist/internal/factory-resource-channel.d.ts.map +1 -0
  1231. package/dist/internal/factory-resource-channel.js +63 -0
  1232. package/dist/internal/filesystem/errors.d.ts +64 -0
  1233. package/dist/internal/filesystem/errors.d.ts.map +1 -0
  1234. package/dist/internal/filesystem/errors.js +172 -0
  1235. package/dist/internal/filesystem/format.d.ts +28 -0
  1236. package/dist/internal/filesystem/format.d.ts.map +1 -0
  1237. package/dist/internal/filesystem/format.js +209 -0
  1238. package/dist/internal/filesystem/merge.d.ts +34 -0
  1239. package/dist/internal/filesystem/merge.d.ts.map +1 -0
  1240. package/dist/internal/filesystem/merge.js +154 -0
  1241. package/dist/internal/filesystem/nearest.d.ts +15 -0
  1242. package/dist/internal/filesystem/nearest.d.ts.map +1 -0
  1243. package/dist/internal/filesystem/nearest.js +90 -0
  1244. package/dist/internal/filesystem/scratch.d.ts +60 -0
  1245. package/dist/internal/filesystem/scratch.d.ts.map +1 -0
  1246. package/dist/internal/filesystem/scratch.js +190 -0
  1247. package/dist/internal/filesystem/sdk-schemas.d.ts +29 -0
  1248. package/dist/internal/filesystem/sdk-schemas.d.ts.map +1 -0
  1249. package/dist/internal/filesystem/sdk-schemas.js +154 -0
  1250. package/dist/internal/filesystem/subagent-inherit.d.ts +39 -0
  1251. package/dist/internal/filesystem/subagent-inherit.d.ts.map +1 -0
  1252. package/dist/internal/filesystem/subagent-inherit.js +96 -0
  1253. package/dist/internal/filesystem/tools.d.ts +48 -0
  1254. package/dist/internal/filesystem/tools.d.ts.map +1 -0
  1255. package/dist/internal/filesystem/tools.js +648 -0
  1256. package/dist/internal/filesystem/walk.d.ts +77 -0
  1257. package/dist/internal/filesystem/walk.d.ts.map +1 -0
  1258. package/dist/internal/filesystem/walk.js +283 -0
  1259. package/dist/internal/framework-file-storage.d.ts +51 -0
  1260. package/dist/internal/framework-file-storage.d.ts.map +1 -0
  1261. package/dist/internal/framework-file-storage.js +291 -0
  1262. package/dist/internal/framework-storage-selection.d.ts +30 -0
  1263. package/dist/internal/framework-storage-selection.d.ts.map +1 -0
  1264. package/dist/internal/framework-storage-selection.js +84 -0
  1265. package/dist/internal/frontmatter.d.ts +20 -0
  1266. package/dist/internal/frontmatter.d.ts.map +1 -0
  1267. package/dist/internal/frontmatter.js +85 -0
  1268. package/dist/internal/github-fanout.d.ts +32 -0
  1269. package/dist/internal/github-fanout.d.ts.map +1 -0
  1270. package/dist/internal/github-fanout.js +106 -0
  1271. package/dist/internal/guest-network.d.ts +98 -0
  1272. package/dist/internal/guest-network.d.ts.map +1 -0
  1273. package/dist/internal/guest-network.js +313 -0
  1274. package/dist/internal/handleAgentServeTrigger.d.ts +98 -0
  1275. package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -0
  1276. package/dist/internal/handleAgentServeTrigger.js +194 -0
  1277. package/dist/internal/hmac-secret-values.d.ts +48 -0
  1278. package/dist/internal/hmac-secret-values.d.ts.map +1 -0
  1279. package/dist/internal/hmac-secret-values.js +68 -0
  1280. package/dist/internal/host-files.d.ts +29 -0
  1281. package/dist/internal/host-files.d.ts.map +1 -0
  1282. package/dist/internal/host-files.js +256 -0
  1283. package/dist/internal/host-kv.d.ts +21 -0
  1284. package/dist/internal/host-kv.d.ts.map +1 -0
  1285. package/dist/internal/host-kv.js +62 -0
  1286. package/dist/internal/host-otel.d.ts +26 -0
  1287. package/dist/internal/host-otel.d.ts.map +1 -0
  1288. package/dist/internal/host-otel.js +184 -0
  1289. package/dist/internal/host-platforms.d.ts +58 -0
  1290. package/dist/internal/host-platforms.d.ts.map +1 -0
  1291. package/dist/internal/host-platforms.js +118 -0
  1292. package/dist/internal/hosted-admission-adapter.d.ts +36 -0
  1293. package/dist/internal/hosted-admission-adapter.d.ts.map +1 -0
  1294. package/dist/internal/hosted-admission-adapter.js +7 -0
  1295. package/dist/internal/hosted-admission-context.d.ts +20 -0
  1296. package/dist/internal/hosted-admission-context.d.ts.map +1 -0
  1297. package/dist/internal/hosted-admission-context.js +31 -0
  1298. package/dist/internal/hosted-catch-protocol.d.ts +54 -0
  1299. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -0
  1300. package/dist/internal/hosted-catch-protocol.js +90 -0
  1301. package/dist/internal/hosted-catch.d.ts +42 -0
  1302. package/dist/internal/hosted-catch.d.ts.map +1 -0
  1303. package/dist/internal/hosted-catch.js +154 -0
  1304. package/dist/internal/hosted-delivery-protocol.d.ts +275 -0
  1305. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -0
  1306. package/dist/internal/hosted-delivery-protocol.js +708 -0
  1307. package/dist/internal/hosted-delivery.d.ts +135 -0
  1308. package/dist/internal/hosted-delivery.d.ts.map +1 -0
  1309. package/dist/internal/hosted-delivery.js +1098 -0
  1310. package/dist/internal/hosted-eval-cases.d.ts +21 -0
  1311. package/dist/internal/hosted-eval-cases.d.ts.map +1 -0
  1312. package/dist/internal/hosted-eval-cases.js +162 -0
  1313. package/dist/internal/hosted-execution-diag.d.ts +64 -0
  1314. package/dist/internal/hosted-execution-diag.d.ts.map +1 -0
  1315. package/dist/internal/hosted-execution-diag.js +219 -0
  1316. package/dist/internal/hosted-execution-flush.d.ts +65 -0
  1317. package/dist/internal/hosted-execution-flush.d.ts.map +1 -0
  1318. package/dist/internal/hosted-execution-flush.js +113 -0
  1319. package/dist/internal/hosted-execution-latency.d.ts +80 -0
  1320. package/dist/internal/hosted-execution-latency.d.ts.map +1 -0
  1321. package/dist/internal/hosted-execution-latency.js +226 -0
  1322. package/dist/internal/hosted-managed-automation.d.ts +30 -0
  1323. package/dist/internal/hosted-managed-automation.d.ts.map +1 -0
  1324. package/dist/internal/hosted-managed-automation.js +83 -0
  1325. package/dist/internal/hosting.d.ts +62 -0
  1326. package/dist/internal/hosting.d.ts.map +1 -0
  1327. package/dist/internal/hosting.js +130 -0
  1328. package/dist/internal/http-channel-define.d.ts +11 -0
  1329. package/dist/internal/http-channel-define.d.ts.map +1 -0
  1330. package/dist/internal/http-channel-define.js +21 -0
  1331. package/dist/internal/http-channel.d.ts +54 -0
  1332. package/dist/internal/http-channel.d.ts.map +1 -0
  1333. package/dist/internal/http-channel.js +543 -0
  1334. package/dist/internal/http-control-plane-session.d.ts +54 -0
  1335. package/dist/internal/http-control-plane-session.d.ts.map +1 -0
  1336. package/dist/internal/http-control-plane-session.js +163 -0
  1337. package/dist/internal/ids.d.ts +27 -0
  1338. package/dist/internal/ids.d.ts.map +1 -0
  1339. package/dist/internal/ids.js +54 -0
  1340. package/dist/internal/incoming-headers-to-fetch.d.ts +10 -0
  1341. package/dist/internal/incoming-headers-to-fetch.d.ts.map +1 -0
  1342. package/dist/internal/incoming-headers-to-fetch.js +40 -0
  1343. package/dist/internal/init-interview.d.ts +64 -0
  1344. package/dist/internal/init-interview.d.ts.map +1 -0
  1345. package/dist/internal/init-interview.js +193 -0
  1346. package/dist/internal/init-project.d.ts +188 -0
  1347. package/dist/internal/init-project.d.ts.map +1 -0
  1348. package/dist/internal/init-project.js +492 -0
  1349. package/dist/internal/init-scaffold.d.ts +20 -0
  1350. package/dist/internal/init-scaffold.d.ts.map +1 -0
  1351. package/dist/internal/init-scaffold.js +194 -0
  1352. package/dist/internal/inline-stdio-define-stub.d.ts +3 -0
  1353. package/dist/internal/inline-stdio-define-stub.d.ts.map +1 -0
  1354. package/dist/internal/inline-stdio-define-stub.js +4 -0
  1355. package/dist/internal/inline-stdio-mcp.d.ts +34 -0
  1356. package/dist/internal/inline-stdio-mcp.d.ts.map +1 -0
  1357. package/dist/internal/inline-stdio-mcp.js +170 -0
  1358. package/dist/internal/install-cursor-skills.d.ts +160 -0
  1359. package/dist/internal/install-cursor-skills.d.ts.map +1 -0
  1360. package/dist/internal/install-cursor-skills.js +464 -0
  1361. package/dist/internal/interview/agent-questions.d.ts +19 -0
  1362. package/dist/internal/interview/agent-questions.d.ts.map +1 -0
  1363. package/dist/internal/interview/agent-questions.js +120 -0
  1364. package/dist/internal/interview/question.d.ts +82 -0
  1365. package/dist/internal/interview/question.d.ts.map +1 -0
  1366. package/dist/internal/interview/question.js +198 -0
  1367. package/dist/internal/is-record.d.ts +2 -0
  1368. package/dist/internal/is-record.d.ts.map +1 -0
  1369. package/dist/internal/is-record.js +3 -0
  1370. package/dist/internal/json-schema.d.ts +25 -0
  1371. package/dist/internal/json-schema.d.ts.map +1 -0
  1372. package/dist/internal/json-schema.js +69 -0
  1373. package/dist/internal/legacy-command-guard.d.ts +24 -0
  1374. package/dist/internal/legacy-command-guard.d.ts.map +1 -0
  1375. package/dist/internal/legacy-command-guard.js +47 -0
  1376. package/dist/internal/listen-port.d.ts +22 -0
  1377. package/dist/internal/listen-port.d.ts.map +1 -0
  1378. package/dist/internal/listen-port.js +66 -0
  1379. package/dist/internal/local-control-plane.d.ts +59 -0
  1380. package/dist/internal/local-control-plane.d.ts.map +1 -0
  1381. package/dist/internal/local-control-plane.js +341 -0
  1382. package/dist/internal/local-env.d.ts +10 -0
  1383. package/dist/internal/local-env.d.ts.map +1 -0
  1384. package/dist/internal/local-env.js +55 -0
  1385. package/dist/internal/local-ingress.d.ts +35 -0
  1386. package/dist/internal/local-ingress.d.ts.map +1 -0
  1387. package/dist/internal/local-ingress.js +50 -0
  1388. package/dist/internal/log-ring.d.ts +23 -0
  1389. package/dist/internal/log-ring.d.ts.map +1 -0
  1390. package/dist/internal/log-ring.js +41 -0
  1391. package/dist/internal/logs-client.d.ts +98 -0
  1392. package/dist/internal/logs-client.d.ts.map +1 -0
  1393. package/dist/internal/logs-client.js +418 -0
  1394. package/dist/internal/map-pool.d.ts +11 -0
  1395. package/dist/internal/map-pool.d.ts.map +1 -0
  1396. package/dist/internal/map-pool.js +34 -0
  1397. package/dist/internal/mcp-endpoint.d.ts +84 -0
  1398. package/dist/internal/mcp-endpoint.d.ts.map +1 -0
  1399. package/dist/internal/mcp-endpoint.js +566 -0
  1400. package/dist/internal/mcp-host.d.ts +99 -0
  1401. package/dist/internal/mcp-host.d.ts.map +1 -0
  1402. package/dist/internal/mcp-host.js +422 -0
  1403. package/dist/internal/mcp-oauth-on-demand.d.ts +68 -0
  1404. package/dist/internal/mcp-oauth-on-demand.d.ts.map +1 -0
  1405. package/dist/internal/mcp-oauth-on-demand.js +250 -0
  1406. package/dist/internal/mcp-oauth-persist.d.ts +42 -0
  1407. package/dist/internal/mcp-oauth-persist.d.ts.map +1 -0
  1408. package/dist/internal/mcp-oauth-persist.js +76 -0
  1409. package/dist/internal/mcp-oauth.d.ts +118 -0
  1410. package/dist/internal/mcp-oauth.d.ts.map +1 -0
  1411. package/dist/internal/mcp-oauth.js +393 -0
  1412. package/dist/internal/memory-dir.d.ts +8 -0
  1413. package/dist/internal/memory-dir.d.ts.map +1 -0
  1414. package/dist/internal/memory-dir.js +7 -0
  1415. package/dist/internal/model-config.d.ts +7 -0
  1416. package/dist/internal/model-config.d.ts.map +1 -0
  1417. package/dist/internal/model-config.js +67 -0
  1418. package/dist/internal/named-webhook-secret.d.ts +39 -0
  1419. package/dist/internal/named-webhook-secret.d.ts.map +1 -0
  1420. package/dist/internal/named-webhook-secret.js +47 -0
  1421. package/dist/internal/net.d.ts +5 -0
  1422. package/dist/internal/net.d.ts.map +1 -0
  1423. package/dist/internal/net.js +28 -0
  1424. package/dist/internal/open-browser.d.ts +5 -0
  1425. package/dist/internal/open-browser.d.ts.map +1 -0
  1426. package/dist/internal/open-browser.js +33 -0
  1427. package/dist/internal/otel/attrs.d.ts +7 -0
  1428. package/dist/internal/otel/attrs.d.ts.map +1 -0
  1429. package/dist/internal/otel/attrs.js +13 -0
  1430. package/dist/internal/otel/collector.d.ts +50 -0
  1431. package/dist/internal/otel/collector.d.ts.map +1 -0
  1432. package/dist/internal/otel/collector.js +765 -0
  1433. package/dist/internal/otel/computer-use-attrs.d.ts +18 -0
  1434. package/dist/internal/otel/computer-use-attrs.d.ts.map +1 -0
  1435. package/dist/internal/otel/computer-use-attrs.js +30 -0
  1436. package/dist/internal/otel/config.d.ts +59 -0
  1437. package/dist/internal/otel/config.d.ts.map +1 -0
  1438. package/dist/internal/otel/config.js +236 -0
  1439. package/dist/internal/otel/conversation-span-processor.d.ts +9 -0
  1440. package/dist/internal/otel/conversation-span-processor.d.ts.map +1 -0
  1441. package/dist/internal/otel/conversation-span-processor.js +34 -0
  1442. package/dist/internal/otel/customer.d.ts +52 -0
  1443. package/dist/internal/otel/customer.d.ts.map +1 -0
  1444. package/dist/internal/otel/customer.js +727 -0
  1445. package/dist/internal/otel/http.d.ts +13 -0
  1446. package/dist/internal/otel/http.d.ts.map +1 -0
  1447. package/dist/internal/otel/http.js +93 -0
  1448. package/dist/internal/otel/mcp.d.ts +16 -0
  1449. package/dist/internal/otel/mcp.d.ts.map +1 -0
  1450. package/dist/internal/otel/mcp.js +46 -0
  1451. package/dist/internal/otel/propagation.d.ts +6 -0
  1452. package/dist/internal/otel/propagation.d.ts.map +1 -0
  1453. package/dist/internal/otel/propagation.js +14 -0
  1454. package/dist/internal/otel/runtime.d.ts +41 -0
  1455. package/dist/internal/otel/runtime.d.ts.map +1 -0
  1456. package/dist/internal/otel/runtime.js +92 -0
  1457. package/dist/internal/otel/tool-error-class.d.ts +4 -0
  1458. package/dist/internal/otel/tool-error-class.d.ts.map +1 -0
  1459. package/dist/internal/otel/tool-error-class.js +36 -0
  1460. package/dist/internal/otel-env.d.ts +6 -0
  1461. package/dist/internal/otel-env.d.ts.map +1 -0
  1462. package/dist/internal/otel-env.js +5 -0
  1463. package/dist/internal/package-inline-stdio.d.ts +12 -0
  1464. package/dist/internal/package-inline-stdio.d.ts.map +1 -0
  1465. package/dist/internal/package-inline-stdio.js +107 -0
  1466. package/dist/internal/peer-connections.d.ts +63 -0
  1467. package/dist/internal/peer-connections.d.ts.map +1 -0
  1468. package/dist/internal/peer-connections.js +115 -0
  1469. package/dist/internal/persistent-stage-log-mirror.d.ts +57 -0
  1470. package/dist/internal/persistent-stage-log-mirror.d.ts.map +1 -0
  1471. package/dist/internal/persistent-stage-log-mirror.js +231 -0
  1472. package/dist/internal/platform-schedule-sync.d.ts +17 -0
  1473. package/dist/internal/platform-schedule-sync.d.ts.map +1 -0
  1474. package/dist/internal/platform-schedule-sync.js +55 -0
  1475. package/dist/internal/platform-timers.d.ts +42 -0
  1476. package/dist/internal/platform-timers.d.ts.map +1 -0
  1477. package/dist/internal/platform-timers.js +251 -0
  1478. package/dist/internal/playground/static.d.ts +52 -0
  1479. package/dist/internal/playground/static.d.ts.map +1 -0
  1480. package/dist/internal/playground/static.js +230 -0
  1481. package/dist/internal/playground/toolchain.d.ts +57 -0
  1482. package/dist/internal/playground/toolchain.d.ts.map +1 -0
  1483. package/dist/internal/playground/toolchain.js +213 -0
  1484. package/dist/internal/playground-proxy.d.ts +69 -0
  1485. package/dist/internal/playground-proxy.d.ts.map +1 -0
  1486. package/dist/internal/playground-proxy.js +434 -0
  1487. package/dist/internal/process-memory-telemetry.d.ts +89 -0
  1488. package/dist/internal/process-memory-telemetry.d.ts.map +1 -0
  1489. package/dist/internal/process-memory-telemetry.js +226 -0
  1490. package/dist/internal/project-layout.d.ts +7 -0
  1491. package/dist/internal/project-layout.d.ts.map +1 -0
  1492. package/dist/internal/project-layout.js +24 -0
  1493. package/dist/internal/prompt-context.d.ts +38 -0
  1494. package/dist/internal/prompt-context.d.ts.map +1 -0
  1495. package/dist/internal/prompt-context.js +86 -0
  1496. package/dist/internal/reminder-control-plane-protocol.d.ts +196 -0
  1497. package/dist/internal/reminder-control-plane-protocol.d.ts.map +1 -0
  1498. package/dist/internal/reminder-control-plane-protocol.js +279 -0
  1499. package/dist/internal/reminder-runner.d.ts +223 -0
  1500. package/dist/internal/reminder-runner.d.ts.map +1 -0
  1501. package/dist/internal/reminder-runner.js +1241 -0
  1502. package/dist/internal/reminder-schedule.d.ts +26 -0
  1503. package/dist/internal/reminder-schedule.d.ts.map +1 -0
  1504. package/dist/internal/reminder-schedule.js +83 -0
  1505. package/dist/internal/reminder-store.d.ts +78 -0
  1506. package/dist/internal/reminder-store.d.ts.map +1 -0
  1507. package/dist/internal/reminder-store.js +105 -0
  1508. package/dist/internal/request-error-status.d.ts +14 -0
  1509. package/dist/internal/request-error-status.d.ts.map +1 -0
  1510. package/dist/internal/request-error-status.js +77 -0
  1511. package/dist/internal/request-headers.d.ts +11 -0
  1512. package/dist/internal/request-headers.d.ts.map +1 -0
  1513. package/dist/internal/request-headers.js +14 -0
  1514. package/dist/internal/resolve-prod-target.d.ts +76 -0
  1515. package/dist/internal/resolve-prod-target.d.ts.map +1 -0
  1516. package/dist/internal/resolve-prod-target.js +215 -0
  1517. package/dist/internal/resolved-connections.d.ts +65 -0
  1518. package/dist/internal/resolved-connections.d.ts.map +1 -0
  1519. package/dist/internal/resolved-connections.js +108 -0
  1520. package/dist/internal/router.d.ts +33 -0
  1521. package/dist/internal/router.d.ts.map +1 -0
  1522. package/dist/internal/router.js +93 -0
  1523. package/dist/internal/run-client.d.ts +78 -0
  1524. package/dist/internal/run-client.d.ts.map +1 -0
  1525. package/dist/internal/run-client.js +369 -0
  1526. package/dist/internal/runtime-dispatch-runner.d.ts +25 -0
  1527. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -0
  1528. package/dist/internal/runtime-dispatch-runner.js +35 -0
  1529. package/dist/internal/sanitize-mcp-tool-name.d.ts +20 -0
  1530. package/dist/internal/sanitize-mcp-tool-name.d.ts.map +1 -0
  1531. package/dist/internal/sanitize-mcp-tool-name.js +28 -0
  1532. package/dist/internal/schedule-runner.d.ts +42 -0
  1533. package/dist/internal/schedule-runner.d.ts.map +1 -0
  1534. package/dist/internal/schedule-runner.js +157 -0
  1535. package/dist/internal/scm/pr-url.d.ts +56 -0
  1536. package/dist/internal/scm/pr-url.d.ts.map +1 -0
  1537. package/dist/internal/scm/pr-url.js +153 -0
  1538. package/dist/internal/sdk-runner.d.ts +204 -0
  1539. package/dist/internal/sdk-runner.d.ts.map +1 -0
  1540. package/dist/internal/sdk-runner.js +1006 -0
  1541. package/dist/internal/sdk-subagent-inherit-support.d.ts +9 -0
  1542. package/dist/internal/sdk-subagent-inherit-support.d.ts.map +1 -0
  1543. package/dist/internal/sdk-subagent-inherit-support.js +89 -0
  1544. package/dist/internal/secret-alternatives.d.ts +11 -0
  1545. package/dist/internal/secret-alternatives.d.ts.map +1 -0
  1546. package/dist/internal/secret-alternatives.js +13 -0
  1547. package/dist/internal/serve-restart.d.ts +42 -0
  1548. package/dist/internal/serve-restart.d.ts.map +1 -0
  1549. package/dist/internal/serve-restart.js +72 -0
  1550. package/dist/internal/server.d.ts +45 -0
  1551. package/dist/internal/server.d.ts.map +1 -0
  1552. package/dist/internal/server.js +2566 -0
  1553. package/dist/internal/session-cost.d.ts +49 -0
  1554. package/dist/internal/session-cost.d.ts.map +1 -0
  1555. package/dist/internal/session-cost.js +147 -0
  1556. package/dist/internal/session-engine.d.ts +955 -0
  1557. package/dist/internal/session-engine.d.ts.map +1 -0
  1558. package/dist/internal/session-engine.js +4880 -0
  1559. package/dist/internal/session-links.d.ts +14 -0
  1560. package/dist/internal/session-links.d.ts.map +1 -0
  1561. package/dist/internal/session-links.js +64 -0
  1562. package/dist/internal/session-live-publisher.d.ts +48 -0
  1563. package/dist/internal/session-live-publisher.d.ts.map +1 -0
  1564. package/dist/internal/session-live-publisher.js +415 -0
  1565. package/dist/internal/session-run-log.d.ts +108 -0
  1566. package/dist/internal/session-run-log.d.ts.map +1 -0
  1567. package/dist/internal/session-run-log.js +398 -0
  1568. package/dist/internal/session-store.d.ts +73 -0
  1569. package/dist/internal/session-store.d.ts.map +1 -0
  1570. package/dist/internal/session-store.js +279 -0
  1571. package/dist/internal/session-urls.d.ts +10 -0
  1572. package/dist/internal/session-urls.d.ts.map +1 -0
  1573. package/dist/internal/session-urls.js +25 -0
  1574. package/dist/internal/sessions-client.d.ts +63 -0
  1575. package/dist/internal/sessions-client.d.ts.map +1 -0
  1576. package/dist/internal/sessions-client.js +215 -0
  1577. package/dist/internal/skill-catalog.d.ts +28 -0
  1578. package/dist/internal/skill-catalog.d.ts.map +1 -0
  1579. package/dist/internal/skill-catalog.js +36 -0
  1580. package/dist/internal/skills-sync.d.ts +22 -0
  1581. package/dist/internal/skills-sync.d.ts.map +1 -0
  1582. package/dist/internal/skills-sync.js +40 -0
  1583. package/dist/internal/slack-provision-client.d.ts +199 -0
  1584. package/dist/internal/slack-provision-client.d.ts.map +1 -0
  1585. package/dist/internal/slack-provision-client.js +320 -0
  1586. package/dist/internal/slack-thread-key.d.ts +7 -0
  1587. package/dist/internal/slack-thread-key.d.ts.map +1 -0
  1588. package/dist/internal/slack-thread-key.js +10 -0
  1589. package/dist/internal/sleep.d.ts +2 -0
  1590. package/dist/internal/sleep.d.ts.map +1 -0
  1591. package/dist/internal/sleep.js +3 -0
  1592. package/dist/internal/slug.d.ts +12 -0
  1593. package/dist/internal/slug.d.ts.map +1 -0
  1594. package/dist/internal/slug.js +38 -0
  1595. package/dist/internal/sqlite-experimental-warning.d.ts +2 -0
  1596. package/dist/internal/sqlite-experimental-warning.d.ts.map +1 -0
  1597. package/dist/internal/sqlite-experimental-warning.js +22 -0
  1598. package/dist/internal/start-log-store.d.ts +53 -0
  1599. package/dist/internal/start-log-store.d.ts.map +1 -0
  1600. package/dist/internal/start-log-store.js +155 -0
  1601. package/dist/internal/steering.d.ts +15 -0
  1602. package/dist/internal/steering.d.ts.map +1 -0
  1603. package/dist/internal/steering.js +17 -0
  1604. package/dist/internal/storage-coordinator.d.ts +200 -0
  1605. package/dist/internal/storage-coordinator.d.ts.map +1 -0
  1606. package/dist/internal/storage-coordinator.js +747 -0
  1607. package/dist/internal/storage-roles.d.ts +83 -0
  1608. package/dist/internal/storage-roles.d.ts.map +1 -0
  1609. package/dist/internal/storage-roles.js +24 -0
  1610. package/dist/internal/storage.d.ts +2 -0
  1611. package/dist/internal/storage.d.ts.map +1 -0
  1612. package/dist/internal/storage.js +1 -0
  1613. package/dist/internal/store-api-protocol.d.ts +164 -0
  1614. package/dist/internal/store-api-protocol.d.ts.map +1 -0
  1615. package/dist/internal/store-api-protocol.js +145 -0
  1616. package/dist/internal/store-mirror.d.ts +28 -0
  1617. package/dist/internal/store-mirror.d.ts.map +1 -0
  1618. package/dist/internal/store-mirror.js +54 -0
  1619. package/dist/internal/stream-progress.d.ts +14 -0
  1620. package/dist/internal/stream-progress.d.ts.map +1 -0
  1621. package/dist/internal/stream-progress.js +231 -0
  1622. package/dist/internal/terminal-style.d.ts +40 -0
  1623. package/dist/internal/terminal-style.d.ts.map +1 -0
  1624. package/dist/internal/terminal-style.js +93 -0
  1625. package/dist/internal/testing/conversation-identity-vectors.d.ts +53 -0
  1626. package/dist/internal/testing/conversation-identity-vectors.d.ts.map +1 -0
  1627. package/dist/internal/testing/conversation-identity-vectors.js +170 -0
  1628. package/dist/internal/testing/factory-resource-fixtures.d.ts +64 -0
  1629. package/dist/internal/testing/factory-resource-fixtures.d.ts.map +1 -0
  1630. package/dist/internal/testing/factory-resource-fixtures.js +55 -0
  1631. package/dist/internal/testing/hmac-secret-vectors.d.ts +38 -0
  1632. package/dist/internal/testing/hmac-secret-vectors.d.ts.map +1 -0
  1633. package/dist/internal/testing/hmac-secret-vectors.js +89 -0
  1634. package/dist/internal/testing/pagerduty-continuation-fixtures.d.ts +42 -0
  1635. package/dist/internal/testing/pagerduty-continuation-fixtures.d.ts.map +1 -0
  1636. package/dist/internal/testing/pagerduty-continuation-fixtures.js +175 -0
  1637. package/dist/internal/testing/scm-continuation-fixtures.d.ts +33 -0
  1638. package/dist/internal/testing/scm-continuation-fixtures.d.ts.map +1 -0
  1639. package/dist/internal/testing/scm-continuation-fixtures.js +257 -0
  1640. package/dist/internal/testing/slack-continuation-fixtures.d.ts +26 -0
  1641. package/dist/internal/testing/slack-continuation-fixtures.d.ts.map +1 -0
  1642. package/dist/internal/testing/slack-continuation-fixtures.js +136 -0
  1643. package/dist/internal/tool-call-retry.d.ts +87 -0
  1644. package/dist/internal/tool-call-retry.d.ts.map +1 -0
  1645. package/dist/internal/tool-call-retry.js +387 -0
  1646. package/dist/internal/tool-catalog.d.ts +31 -0
  1647. package/dist/internal/tool-catalog.d.ts.map +1 -0
  1648. package/dist/internal/tool-catalog.js +76 -0
  1649. package/dist/internal/tool-policy.d.ts +110 -0
  1650. package/dist/internal/tool-policy.d.ts.map +1 -0
  1651. package/dist/internal/tool-policy.js +138 -0
  1652. package/dist/internal/tool-result.d.ts +20 -0
  1653. package/dist/internal/tool-result.d.ts.map +1 -0
  1654. package/dist/internal/tool-result.js +50 -0
  1655. package/dist/internal/trajectory.d.ts +68 -0
  1656. package/dist/internal/trajectory.d.ts.map +1 -0
  1657. package/dist/internal/trajectory.js +336 -0
  1658. package/dist/internal/turn-governor.d.ts +54 -0
  1659. package/dist/internal/turn-governor.d.ts.map +1 -0
  1660. package/dist/internal/turn-governor.js +108 -0
  1661. package/dist/internal/turn-lease-store.d.ts +51 -0
  1662. package/dist/internal/turn-lease-store.d.ts.map +1 -0
  1663. package/dist/internal/turn-lease-store.js +172 -0
  1664. package/dist/internal/turn-outbox.d.ts +24 -0
  1665. package/dist/internal/turn-outbox.d.ts.map +1 -0
  1666. package/dist/internal/turn-outbox.js +65 -0
  1667. package/dist/internal/update-check.d.ts +93 -0
  1668. package/dist/internal/update-check.d.ts.map +1 -0
  1669. package/dist/internal/update-check.js +401 -0
  1670. package/dist/internal/v2-hosting.d.ts +34 -0
  1671. package/dist/internal/v2-hosting.d.ts.map +1 -0
  1672. package/dist/internal/v2-hosting.js +35 -0
  1673. package/dist/internal/workspace-sync.d.ts +44 -0
  1674. package/dist/internal/workspace-sync.d.ts.map +1 -0
  1675. package/dist/internal/workspace-sync.js +85 -0
  1676. package/dist/internal/workspace.d.ts +155 -0
  1677. package/dist/internal/workspace.d.ts.map +1 -0
  1678. package/dist/internal/workspace.js +468 -0
  1679. package/dist/internal/zod-schema.d.ts +14 -0
  1680. package/dist/internal/zod-schema.d.ts.map +1 -0
  1681. package/dist/internal/zod-schema.js +22 -0
  1682. package/dist/internal/zod3-datetime.d.ts +12 -0
  1683. package/dist/internal/zod3-datetime.d.ts.map +1 -0
  1684. package/dist/internal/zod3-datetime.js +17 -0
  1685. package/dist/kv/memory-kv.d.ts +24 -0
  1686. package/dist/kv/memory-kv.d.ts.map +1 -0
  1687. package/dist/kv/memory-kv.js +80 -0
  1688. package/dist/kv.d.ts +18 -0
  1689. package/dist/kv.d.ts.map +1 -0
  1690. package/dist/kv.js +16 -0
  1691. package/dist/memory.d.ts +113 -0
  1692. package/dist/memory.d.ts.map +1 -0
  1693. package/dist/memory.js +312 -0
  1694. package/dist/otel-public.d.ts +6 -0
  1695. package/dist/otel-public.d.ts.map +1 -0
  1696. package/dist/otel-public.js +5 -0
  1697. package/dist/otel.d.ts +31 -0
  1698. package/dist/otel.d.ts.map +1 -0
  1699. package/dist/otel.js +146 -0
  1700. package/dist/playground/assets/cursor-icons-16-DfKNljMZ.woff2 +0 -0
  1701. package/dist/playground/assets/index-B3_YohwW.js +62 -0
  1702. package/dist/playground/assets/index-Cn3-adsJ.css +1 -0
  1703. package/dist/playground/index.html +17 -0
  1704. package/dist/prompt.d.ts +39 -0
  1705. package/dist/prompt.d.ts.map +1 -0
  1706. package/dist/prompt.js +68 -0
  1707. package/dist/public-deprecated.d.ts +36 -0
  1708. package/dist/public-deprecated.d.ts.map +1 -0
  1709. package/dist/public-deprecated.js +39 -0
  1710. package/dist/reminders.d.ts +42 -0
  1711. package/dist/reminders.d.ts.map +1 -0
  1712. package/dist/reminders.js +45 -0
  1713. package/dist/schedules.d.ts +23 -0
  1714. package/dist/schedules.d.ts.map +1 -0
  1715. package/dist/schedules.js +26 -0
  1716. package/dist/skills.d.ts +22 -0
  1717. package/dist/skills.d.ts.map +1 -0
  1718. package/dist/skills.js +22 -0
  1719. package/dist/storage-backends/cursor-hosted-v2.d.ts +54 -0
  1720. package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -0
  1721. package/dist/storage-backends/cursor-hosted-v2.js +113 -0
  1722. package/dist/storage-backends/cursor-hosted.d.ts +94 -0
  1723. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -0
  1724. package/dist/storage-backends/cursor-hosted.js +225 -0
  1725. package/dist/storage-backends/file-kv.d.ts +42 -0
  1726. package/dist/storage-backends/file-kv.d.ts.map +1 -0
  1727. package/dist/storage-backends/file-kv.js +226 -0
  1728. package/dist/storage-protocol.d.ts +124 -0
  1729. package/dist/storage-protocol.d.ts.map +1 -0
  1730. package/dist/storage-protocol.js +181 -0
  1731. package/dist/storage.d.ts +254 -0
  1732. package/dist/storage.d.ts.map +1 -0
  1733. package/dist/storage.js +145 -0
  1734. package/dist/tools.d.ts +135 -0
  1735. package/dist/tools.d.ts.map +1 -0
  1736. package/dist/tools.js +78 -0
  1737. package/dist/types.d.ts +3804 -0
  1738. package/dist/types.d.ts.map +1 -0
  1739. package/dist/types.js +191 -0
  1740. package/docs/README.md +115 -0
  1741. package/docs/building-with-agents.md +139 -0
  1742. package/docs/changelog.md +119 -0
  1743. package/docs/deployment.md +314 -0
  1744. package/docs/evals.md +244 -0
  1745. package/docs/guides/agent-to-agent.md +167 -0
  1746. package/docs/guides/bitbucket.md +298 -0
  1747. package/docs/guides/cloud-agents.md +86 -0
  1748. package/docs/guides/convert-automation.md +185 -0
  1749. package/docs/guides/export-grokbot.md +244 -0
  1750. package/docs/guides/github.md +378 -0
  1751. package/docs/guides/gitlab.md +304 -0
  1752. package/docs/guides/grokbot-agents.md +140 -0
  1753. package/docs/guides/hooks.md +121 -0
  1754. package/docs/guides/improve.md +134 -0
  1755. package/docs/guides/jev.md +303 -0
  1756. package/docs/guides/mcp-oauth.md +153 -0
  1757. package/docs/guides/migrate.md +169 -0
  1758. package/docs/guides/opentelemetry.md +205 -0
  1759. package/docs/guides/pagerduty.md +341 -0
  1760. package/docs/guides/slack.md +314 -0
  1761. package/docs/guides/webhooks.md +255 -0
  1762. package/docs/hillclimbing.md +139 -0
  1763. package/docs/quickstart.md +312 -0
  1764. package/docs/reference/agent-config.md +243 -0
  1765. package/docs/reference/artifacts.md +118 -0
  1766. package/docs/reference/channels.md +219 -0
  1767. package/docs/reference/cli.md +1103 -0
  1768. package/docs/reference/connections.md +312 -0
  1769. package/docs/reference/evals.md +299 -0
  1770. package/docs/reference/extensions.md +214 -0
  1771. package/docs/reference/hooks.md +202 -0
  1772. package/docs/reference/http-api.md +226 -0
  1773. package/docs/reference/instructions.md +69 -0
  1774. package/docs/reference/memory.md +119 -0
  1775. package/docs/reference/playground.md +41 -0
  1776. package/docs/reference/project-layout.md +122 -0
  1777. package/docs/reference/prompt.md +52 -0
  1778. package/docs/reference/schedules.md +195 -0
  1779. package/docs/reference/sessions.md +205 -0
  1780. package/docs/reference/skills.md +77 -0
  1781. package/docs/reference/subagents.md +66 -0
  1782. package/docs/reference/tools.md +311 -0
  1783. package/docs/templates/agentic-owners.md +131 -0
  1784. package/docs/templates/grokbot-agents.md +60 -0
  1785. package/docs/templates/security-reviewer.md +86 -0
  1786. package/docs/templates/thermo-quality-review.md +80 -0
  1787. package/docs/templates/thermo-review.md +80 -0
  1788. package/docs/templates/triage.md +106 -0
  1789. package/docs/troubleshooting.md +154 -0
  1790. package/package.json +429 -4
  1791. package/schemas/grokbot-answers.schema.json +354 -0
  1792. package/scripts/install-cursor-skills.mjs +29 -0
  1793. package/skills/create-agent/SKILL.md +175 -0
  1794. package/skills/debug/SKILL.md +43 -0
  1795. package/skills/deploy/SKILL.md +169 -0
  1796. package/skills/evals/SKILL.md +145 -0
  1797. package/skills/framework-map/SKILL.md +128 -0
  1798. package/skills/github/SKILL.md +133 -0
  1799. package/skills/hillclimb/SKILL.md +63 -0
  1800. package/skills/mcp-auth/SKILL.md +60 -0
  1801. package/skills/migrate-v2/SKILL.md +397 -0
  1802. package/skills/otel/SKILL.md +48 -0
  1803. package/skills/setup-slack/SKILL.md +136 -0
  1804. package/templates/agentic-owners/README.md +78 -0
  1805. package/templates/agentic-owners/bot/agent.ts +8 -0
  1806. package/templates/agentic-owners/bot/channels/github.ts +63 -0
  1807. package/templates/agentic-owners/bot/instructions.md +34 -0
  1808. package/templates/agentic-owners/bot/lib/config.ts +5 -0
  1809. package/templates/agentic-owners/bot/lib/github.ts +219 -0
  1810. package/templates/agentic-owners/bot/lib/owners/README.md +50 -0
  1811. package/templates/agentic-owners/bot/lib/owners/constants.ts +22 -0
  1812. package/templates/agentic-owners/bot/lib/owners/decision.ts +480 -0
  1813. package/templates/agentic-owners/bot/lib/owners/globalOverride.ts +60 -0
  1814. package/templates/agentic-owners/bot/lib/owners/handles.ts +54 -0
  1815. package/templates/agentic-owners/bot/lib/owners/match.ts +287 -0
  1816. package/templates/agentic-owners/bot/lib/owners/matching.ts +147 -0
  1817. package/templates/agentic-owners/bot/lib/owners/parse.ts +696 -0
  1818. package/templates/agentic-owners/bot/lib/owners/policyMode.ts +57 -0
  1819. package/templates/agentic-owners/bot/lib/owners/prompt.ts +64 -0
  1820. package/templates/agentic-owners/bot/lib/owners/prompts/base-review.md +105 -0
  1821. package/templates/agentic-owners/bot/lib/owners/types.ts +73 -0
  1822. package/templates/agentic-owners/bot/lib/review.ts +723 -0
  1823. package/templates/agentic-owners/bot/tools/record_review.ts +62 -0
  1824. package/templates/agentic-owners/evals/evals.config.ts +5 -0
  1825. package/templates/agentic-owners/evals/owners.eval.ts +111 -0
  1826. package/templates/agentic-owners/package.json +20 -0
  1827. package/templates/agentic-owners/tsconfig.json +12 -0
  1828. package/templates/agents-md/README.md +43 -0
  1829. package/templates/agents-md/bot/agent.ts +8 -0
  1830. package/templates/agents-md/bot/channels/github.ts +10 -0
  1831. package/templates/agents-md/bot/channels/queue.ts +23 -0
  1832. package/templates/agents-md/bot/channels/slack.ts +9 -0
  1833. package/templates/agents-md/bot/instructions.md +38 -0
  1834. package/templates/agents-md/bot/lib/collect.ts +412 -0
  1835. package/templates/agents-md/bot/lib/config.ts +8 -0
  1836. package/templates/agents-md/bot/lib/paths.ts +49 -0
  1837. package/templates/agents-md/bot/schedules/weekly.ts +17 -0
  1838. package/templates/agents-md/bot/tools/apply_agents.ts +217 -0
  1839. package/templates/agents-md/evals/agents.eval.ts +136 -0
  1840. package/templates/agents-md/evals/evals.config.ts +5 -0
  1841. package/templates/agents-md/init.json +38 -0
  1842. package/templates/agents-md/package.json +18 -0
  1843. package/templates/agents-md/tsconfig.json +12 -0
  1844. package/templates/code-wiki/README.md +34 -0
  1845. package/templates/code-wiki/bot/agent.ts +8 -0
  1846. package/templates/code-wiki/bot/channels/github.ts +125 -0
  1847. package/templates/code-wiki/bot/instructions.md +39 -0
  1848. package/templates/code-wiki/bot/lib/repos.ts +5 -0
  1849. package/templates/code-wiki/bot/lib/wiki.ts +22 -0
  1850. package/templates/code-wiki/bot/tools/apply_wiki.ts +210 -0
  1851. package/templates/code-wiki/evals/evals.config.ts +5 -0
  1852. package/templates/code-wiki/evals/wiki.eval.ts +124 -0
  1853. package/templates/code-wiki/init.json +25 -0
  1854. package/templates/code-wiki/package.json +18 -0
  1855. package/templates/code-wiki/tsconfig.json +12 -0
  1856. package/templates/demo/README.md +37 -0
  1857. package/templates/demo/bot/agent.ts +8 -0
  1858. package/templates/demo/bot/channels/github.ts +52 -0
  1859. package/templates/demo/bot/channels/queue.ts +24 -0
  1860. package/templates/demo/bot/instructions.md +8 -0
  1861. package/templates/demo/bot/lib/collect.ts +66 -0
  1862. package/templates/demo/bot/lib/repos.ts +5 -0
  1863. package/templates/demo/bot/tools/record_demo.ts +37 -0
  1864. package/templates/demo/evals/demo.eval.ts +29 -0
  1865. package/templates/demo/evals/evals.config.ts +5 -0
  1866. package/templates/demo/init.json +25 -0
  1867. package/templates/demo/package.json +18 -0
  1868. package/templates/demo/tsconfig.json +12 -0
  1869. package/templates/grokbot-agents/README.md +27 -0
  1870. package/templates/grokbot-agents/bot/agent.ts +6 -0
  1871. package/templates/grokbot-agents/bot/extensions/grokbot.ts +5 -0
  1872. package/templates/grokbot-agents/bot/instructions.md +7 -0
  1873. package/templates/grokbot-agents/evals/evals.config.ts +5 -0
  1874. package/templates/grokbot-agents/evals/grokbot-agents.eval.ts +18 -0
  1875. package/templates/grokbot-agents/init.json +18 -0
  1876. package/templates/grokbot-agents/package.json +17 -0
  1877. package/templates/grokbot-agents/tsconfig.json +12 -0
  1878. package/templates/pr-autofixer/bot/agent.ts +11 -0
  1879. package/templates/pr-autofixer/bot/channels/drive.ts +24 -0
  1880. package/templates/pr-autofixer/bot/channels/github.ts +155 -0
  1881. package/templates/pr-autofixer/bot/channels/slack.ts +16 -0
  1882. package/templates/pr-autofixer/bot/hooks/bind-agent.ts +19 -0
  1883. package/templates/pr-autofixer/bot/instructions.md +83 -0
  1884. package/templates/pr-autofixer/bot/lib/affinity.ts +24 -0
  1885. package/templates/pr-autofixer/bot/lib/drive-schemas.ts +18 -0
  1886. package/templates/pr-autofixer/bot/lib/drive.ts +73 -0
  1887. package/templates/pr-autofixer/bot/lib/merge-watch.ts +116 -0
  1888. package/templates/pr-autofixer/bot/lib/pr-state.ts +40 -0
  1889. package/templates/pr-autofixer/bot/lib/repos.ts +18 -0
  1890. package/templates/pr-autofixer/bot/lib/start-drive.ts +113 -0
  1891. package/templates/pr-autofixer/bot/lib/webhook-buffer.ts +215 -0
  1892. package/templates/pr-autofixer/bot/lib/webhook-routing.ts +231 -0
  1893. package/templates/pr-autofixer/bot/tools/drive_pr.ts +21 -0
  1894. package/templates/pr-autofixer/evals/coordinator.eval.ts +16 -0
  1895. package/templates/pr-autofixer/evals/evals.config.ts +5 -0
  1896. package/templates/pr-autofixer/init.json +25 -0
  1897. package/templates/pr-autofixer/package.json +18 -0
  1898. package/templates/pr-autofixer/tsconfig.json +12 -0
  1899. package/templates/security-help/README.md +46 -0
  1900. package/templates/security-help/bot/agent.ts +17 -0
  1901. package/templates/security-help/bot/channels/github.ts +13 -0
  1902. package/templates/security-help/bot/channels/slack.ts +84 -0
  1903. package/templates/security-help/bot/instructions.md +19 -0
  1904. package/templates/security-help/bot/lib/pr-first-pass.ts +40 -0
  1905. package/templates/security-help/bot/lib/repos.ts +5 -0
  1906. package/templates/security-help/bot/skills/access-request.md +10 -0
  1907. package/templates/security-help/bot/skills/faq.md +31 -0
  1908. package/templates/security-help/bot/skills/security-playbooks.md +12 -0
  1909. package/templates/security-help/bot/skills/security-pr-first-pass.md +12 -0
  1910. package/templates/security-help/evals/evals.config.ts +5 -0
  1911. package/templates/security-help/evals/security-help.eval.ts +51 -0
  1912. package/templates/security-help/init.json +31 -0
  1913. package/templates/security-help/package.json +17 -0
  1914. package/templates/security-help/tsconfig.json +12 -0
  1915. package/templates/security-reviewer/README.md +33 -0
  1916. package/templates/security-reviewer/bot/agent.ts +8 -0
  1917. package/templates/security-reviewer/bot/channels/github.ts +43 -0
  1918. package/templates/security-reviewer/bot/instructions.md +22 -0
  1919. package/templates/security-reviewer/bot/lib/repos.ts +5 -0
  1920. package/templates/security-reviewer/bot/tools/post_findings.ts +68 -0
  1921. package/templates/security-reviewer/evals/evals.config.ts +5 -0
  1922. package/templates/security-reviewer/evals/review.eval.ts +50 -0
  1923. package/templates/security-reviewer/init.json +25 -0
  1924. package/templates/security-reviewer/package.json +18 -0
  1925. package/templates/security-reviewer/tsconfig.json +12 -0
  1926. package/templates/thermo-quality-review/README.md +35 -0
  1927. package/templates/thermo-quality-review/bot/agent.ts +8 -0
  1928. package/templates/thermo-quality-review/bot/channels/github.ts +39 -0
  1929. package/templates/thermo-quality-review/bot/instructions.md +43 -0
  1930. package/templates/thermo-quality-review/bot/tools/post_findings.ts +67 -0
  1931. package/templates/thermo-quality-review/evals/evals.config.ts +5 -0
  1932. package/templates/thermo-quality-review/evals/review.eval.ts +59 -0
  1933. package/templates/thermo-quality-review/package.json +18 -0
  1934. package/templates/thermo-quality-review/tsconfig.json +12 -0
  1935. package/templates/thermo-review/README.md +35 -0
  1936. package/templates/thermo-review/bot/agent.ts +8 -0
  1937. package/templates/thermo-review/bot/channels/github.ts +39 -0
  1938. package/templates/thermo-review/bot/instructions.md +40 -0
  1939. package/templates/thermo-review/bot/tools/post_findings.ts +67 -0
  1940. package/templates/thermo-review/evals/evals.config.ts +5 -0
  1941. package/templates/thermo-review/evals/review.eval.ts +50 -0
  1942. package/templates/thermo-review/package.json +18 -0
  1943. package/templates/thermo-review/tsconfig.json +12 -0
  1944. package/templates/triage/README.md +47 -0
  1945. package/templates/triage/bot/agent.ts +8 -0
  1946. package/templates/triage/bot/channels/queue.ts +29 -0
  1947. package/templates/triage/bot/channels/webhook.ts +41 -0
  1948. package/templates/triage/bot/hooks/memory.ts +3 -0
  1949. package/templates/triage/bot/instructions.md +38 -0
  1950. package/templates/triage/bot/lib/actuate.ts +703 -0
  1951. package/templates/triage/bot/lib/parse-queue-event.ts +160 -0
  1952. package/templates/triage/bot/lib/tracker.ts +5 -0
  1953. package/templates/triage/bot/lib/types.ts +48 -0
  1954. package/templates/triage/bot/lib/verify-webhook.ts +79 -0
  1955. package/templates/triage/bot/skills/triage-rubric.md +44 -0
  1956. package/templates/triage/bot/tools/record_triage.ts +29 -0
  1957. package/templates/triage/evals/evals.config.ts +5 -0
  1958. package/templates/triage/evals/triage.eval.ts +64 -0
  1959. package/templates/triage/overlays/jira/README.md +21 -0
  1960. package/templates/triage/overlays/jira/bot/lib/tracker.ts +8 -0
  1961. package/templates/triage/overlays/jira/bot/mcp-connections/tracker.ts +6 -0
  1962. package/templates/triage/overlays/linear/README.md +21 -0
  1963. package/templates/triage/overlays/linear/bot/lib/tracker.ts +8 -0
  1964. package/templates/triage/overlays/linear/bot/mcp-connections/tracker.ts +6 -0
  1965. package/templates/triage/package.json +18 -0
  1966. package/templates/triage/tsconfig.json +12 -0
@@ -0,0 +1,2566 @@
1
+ /**
2
+ * The HTTP host: a plain node:http server that adapts requests to the Fetch
3
+ * API, resolves route auth, and dispatches to the built-in HTTP channel
4
+ * routes, custom channel routes (under `/v1/channels/<id>`), and the
5
+ * server-level health / info / dev-dispatch routes.
6
+ */
7
+ import { Buffer } from "node:buffer";
8
+ import { once } from "node:events";
9
+ import { createServer } from "node:http";
10
+ import { join } from "node:path";
11
+ import { CURSOR_BITBUCKET_REPOS_HEADER, } from "../channels/bitbucket/api.js";
12
+ import { getBitbucketCursorAccountRuntime, resolveCursorBitbucketProxyUrl, } from "../channels/bitbucket/cursor-account.js";
13
+ import { dispatchDeploymentEvent, getDeploymentsChannelOptions, } from "../channels/deployments/deployments-channel.js";
14
+ import { createCursorAccountGithubTokenResolver, createCursorGithubProxyHostResolver, cursorGithubPermissionsForChannel, getGithubCursorAccountRuntime, resolveCursorGithubCredentialScope, resolveCursorGithubPermissions, resolveCursorGithubProxyUrl, } from "../channels/github/cursor-account.js";
15
+ import { findGitHubChannelTargets } from "../channels/github/forward.js";
16
+ import { CURSOR_GITLAB_PROJECTS_HEADER, } from "../channels/gitlab/api.js";
17
+ import { getGitLabCursorAccountRuntime, resolveCursorGitLabProxyUrl, } from "../channels/gitlab/cursor-account.js";
18
+ import { getOriginCursorAccountRuntime, parseCursorOriginRepoScope, } from "../channels/origin/cursor-account.js";
19
+ import { findOriginChannelTargets } from "../channels/origin/origin-channel.js";
20
+ import { appendSlackQuietHint } from "../channels/slack/agentic-posted.js";
21
+ import { allowAll, bearerAuth, localDevStrict } from "../channels.js";
22
+ import { createProject } from "./discovery/project-public.js";
23
+ import { ARTIFACTS_PAGE_DEFAULT_LIMIT, ARTIFACTS_PAGE_MAX_LIMIT, InvalidArtifactCursorError, } from "./artifacts-store.js";
24
+ import { browserOriginGuardOptionsForPublicUrl, isTrustedBrowserMutation, } from "./browser-origin-guard.js";
25
+ import { invokeChannelRoute } from "./channel-route-dispatch.js";
26
+ import { selectConversationMirror } from "./conversation-mirror.js";
27
+ import { CursorAccountMcpBridge, collectCursorAccountConnections, cursorAccountMcpPath, } from "./cursor/account-mcp.js";
28
+ import { CursorBackendClient } from "./cursor/backend-client.js";
29
+ import { cursorBackendUrl, cursorExternalApiUrl, resolveApiKey, resolveApiKeySync, SIGN_IN_HINT, } from "./cursor/credentials.js";
30
+ import { CursorGithubCredentialProvider } from "./cursor/github-credentials.js";
31
+ import { DeploymentEventRelay, fanOutDeploymentEvent, mergeResolvedSubscriptions, resolveDeploymentSubscriptions, } from "./cursor-deployment-relay.js";
32
+ import { CursorEventRelay, formatCursorScmDispatchOutcome, formatCursorScmEventLog, scmEventToGitHubPayload, scmMetadataToOriginPayload, } from "./cursor-event-relay.js";
33
+ import { AGENT_SERVE_GENERATION_ENV_VAR } from "./cursor-relay-core.js";
34
+ import { buildAgentDeployManifest } from "./deploy-manifest.js";
35
+ import { describeError } from "./describe-error.js";
36
+ import { formatDiagnostics, hasErrorDiagnostics, projectInfo } from "./discovery.js";
37
+ import { packageVersion } from "./distribution.js";
38
+ import { docsSiteExists, ensureDocsSiteBundle, renderDocsFile } from "./docs-site.js";
39
+ import { EvalRunConflictError, EvalRunEmptyError, EvalRunNotRunningError, EvalRunStore, EvalRunUnknownError, } from "./eval-run-store.js";
40
+ import { GUEST_NETWORK_PATH, guestNetworkReadinessResponse } from "./guest-network.js";
41
+ import { collectGitHubTriggerTargets, collectOriginTriggerTargets, handleAgentServeTrigger, } from "./handleAgentServeTrigger.js";
42
+ import { createHostPlatforms, warmupHostGitHubAuth } from "./host-platforms.js";
43
+ import { registerHostedDeliveryRoute } from "./hosted-delivery.js";
44
+ import { hostedEvalCatalog, hostedSendStart } from "./hosted-eval-cases.js";
45
+ import { HOSTED_DELIVERY_HEADER, HOSTED_GUEST_RETRY_TERMINAL, hostedGuestErrorResponse, } from "./hosted-delivery-protocol.js";
46
+ import { hostedErrorMessageOnly, hostedErrorStackSnippet } from "./hosted-execution-diag.js";
47
+ import { flushHostedExecutionProcessDeath } from "./hosted-execution-flush.js";
48
+ import { buildHttpChannelRoutes, errorResponse, jsonResponse, readJsonObject, requireSessionOwner, } from "./http-channel.js";
49
+ import { incomingHeadersToFetch, incomingRequestHost } from "./incoming-headers-to-fetch.js";
50
+ import { DEFAULT_SERVE_PORT, listenHttpServer } from "./listen-port.js";
51
+ import { createLocalControlPlane } from "./local-control-plane.js";
52
+ import { createLogRing } from "./log-ring.js";
53
+ import { createAgentMcpEndpoint, createToolMcpEndpoint, MCP_ENDPOINT_PATH, TOOL_MCP_ENDPOINT_PATH, } from "./mcp-endpoint.js";
54
+ import { mcpOauthServeCallbackPath, mcpOauthServeCallbackUrl } from "./mcp-oauth-on-demand.js";
55
+ import { isLoopbackAddress } from "./net.js";
56
+ import { createOtelCollector } from "./otel/collector.js";
57
+ import { createCustomerOtelRuntime, installCustomerOtel } from "./otel/customer.js";
58
+ import { instrumentHttp } from "./otel/http.js";
59
+ import { collectPeerConnections } from "./peer-connections.js";
60
+ import { PLATFORM_SCHEDULE_CATALOG_FILENAME, syncHostedPlatformSchedules, } from "./platform-schedule-sync.js";
61
+ import { createCursorHostedPlatformTimers, createCursorHostedReminderControlPlane, } from "./platform-timers.js";
62
+ import { renderAgentsIndexHtml, renderPlaygroundAsset, renderPlaygroundIndexHtml, } from "./playground/static.js";
63
+ import { ensurePlaygroundBundle, playgroundDevBaseFromEnv, playgroundDevBasePath, startPlaygroundDevServer, } from "./playground/toolchain.js";
64
+ import { collectMemoryHealthFields, sumEventLogStats } from "./process-memory-telemetry.js";
65
+ import { claimFromDescriptor, } from "./reminder-control-plane-protocol.js";
66
+ import { ReminderRunner, ReminderValidationError, rejectAnonymousReminderHandlers, UnknownReminderError, } from "./reminder-runner.js";
67
+ import { mapThrownRequestError } from "./request-error-status.js";
68
+ import { assertAccountConnectionsNotAnonymous, resolveMountConnections, validateMountConnectionsConfig, } from "./resolved-connections.js";
69
+ import { Router } from "./router.js";
70
+ import { RuntimeDispatchingRunner } from "./runtime-dispatch-runner.js";
71
+ import { ScheduleRunner, UnknownScheduleError } from "./schedule-runner.js";
72
+ import { CursorSdkRunner } from "./sdk-runner.js";
73
+ import { HTTP_CHANNEL_ID, InvalidContinuationTokenError, SessionEngine, ToolInputError, ToolNotDirectlyCallableError, UnknownToolError, WorkspaceUnavailableError, } from "./session-engine.js";
74
+ import { registerSessionRunFatalFlush, selectSessionRunLogStore, unregisterSessionRunFatalFlush, } from "./session-run-log.js";
75
+ import { sessionUrlsForRequest } from "./session-urls.js";
76
+ import { readSkillDetail, skillListEntry, UnknownSkillError } from "./skill-catalog.js";
77
+ import { selectPersistentStageLogMirror, startPersistentStageLogMirror, } from "./persistent-stage-log-mirror.js";
78
+ import { flushLocalStartLog, selectStartLogStore } from "./start-log-store.js";
79
+ import { catalogDetailEntry, catalogListEntry } from "./tool-catalog.js";
80
+ function memoryHealthFields(engines) {
81
+ return collectMemoryHealthFields({
82
+ eventLog: () => sumEventLogStats(engines.map((engine) => engine.eventLogMemoryStats())),
83
+ });
84
+ }
85
+ const MAX_BODY_BYTES = 32 * 1024 * 1024;
86
+ function localControlPlaneRoute(runtimes) {
87
+ for (const runtime of runtimes) {
88
+ if (runtime.controlPlane !== undefined) {
89
+ return (input) => runtime.controlPlane.routeContinuation(input);
90
+ }
91
+ }
92
+ return undefined;
93
+ }
94
+ function firstLocalControlPlane(runtimes) {
95
+ return runtimes.find((runtime) => runtime.controlPlane !== undefined)?.controlPlane;
96
+ }
97
+ function isV2Project(project) {
98
+ return project.agent.architecture === "v2";
99
+ }
100
+ /**
101
+ * Start an HTTP server hosting one or more agents. A single agent with an
102
+ * empty slug serves at `/v1/*` and `/playground`; multiple agents each serve
103
+ * under `/<slug>/v1/*` and `/<slug>/playground`, with an index at `/`.
104
+ */
105
+ export async function startServer(mounts, options = {}) {
106
+ if (mounts.length === 0) {
107
+ throw new Error("startServer requires at least one agent mount");
108
+ }
109
+ const multi = mounts.length > 1 || mounts[0]?.slug !== "";
110
+ for (const { slug, project } of mounts) {
111
+ if (hasErrorDiagnostics(project)) {
112
+ const label = slug === "" ? project.name : `${slug} (${project.name})`;
113
+ throw new Error(`Refusing to serve agent ${label} — it has errors:\n${formatDiagnostics(project.diagnostics.filter((d) => d.severity === "error"))}`);
114
+ }
115
+ }
116
+ const logRing = createLogRing({ capacity: 2000 });
117
+ const logger = logRing.wrap(options.logger ?? ((line) => console.log(line)));
118
+ const dev = options.dev ?? false;
119
+ const playground = options.playground ?? true;
120
+ const hosted = options;
121
+ const noControlPlane = hosted.noControlPlane === true;
122
+ const scmProxyRequested = hosted.cursorScmProxy === true;
123
+ const runSchedules = options.schedules ?? !dev;
124
+ const runReminders = options.reminders ?? !dev;
125
+ // CURSOR_AGENTKIT_VERSION is the env the SDK reads when building its
126
+ // client-version header (wire prefix remains `agentkit-`). Setting it
127
+ // here makes the Agent SDK product gates apply to every turn.
128
+ process.env.CURSOR_AGENTKIT_VERSION ??= packageVersion();
129
+ // The hosted control plane owns ingest, and deployment secrets arrive
130
+ // with the first request.
131
+ const allMountsHostedV2 = noControlPlane && mounts.every((mount) => isV2Project(mount.project));
132
+ installCustomerOtel();
133
+ const hostedEgressDomains = allMountsHostedV2
134
+ ? mounts.flatMap((mount) => mount.project.agent.hosting?.egressDomains ?? [])
135
+ : undefined;
136
+ const defaultServiceName = mounts.length === 1 ? mounts[0]?.project.name : undefined;
137
+ const otel = createCustomerOtelRuntime(logger, {
138
+ egressDomains: hostedEgressDomains,
139
+ defaultServiceName,
140
+ });
141
+ // Secrets are absent at start only when every mount is a hosted v2 guest.
142
+ // Elsewhere the config is complete now. The runtime uses the global tracer.
143
+ if (!allMountsHostedV2) {
144
+ otel.reload();
145
+ }
146
+ const otelRuntime = otel.runtime;
147
+ const cursorGithubTargets = collectCursorGithubTargets(mounts);
148
+ const cursorOriginTargets = collectCursorOriginTargets(mounts);
149
+ const cursorGithubConfig = resolveCursorGithubEventConfig({
150
+ configured: options.cursorEvents,
151
+ targets: cursorGithubTargets,
152
+ });
153
+ const cursorOriginScope = resolveCursorOriginRepoScope({
154
+ explicitRepos: options.cursorEvents?.repos ?? [],
155
+ targets: cursorOriginTargets,
156
+ });
157
+ const effectiveCursorEvents = options.evals === true
158
+ ? undefined
159
+ : (cursorGithubConfig.cursorEvents ??
160
+ (cursorOriginScope === undefined ? undefined : { repos: [...cursorOriginScope.repos] }));
161
+ // One resolution for every Cursor credential consumer (SDK runner, account
162
+ // MCP bridge, SCM event relay, GitHub credentials): explicit option →
163
+ // CURSOR_API_KEY → CURSOR_API_KEY_FILE (or the hosted default path) →
164
+ // CURSOR_SERVICE_ACCOUNT_KEY → stored `agent-sdk login`. SDK / GitHub /
165
+ // account MCP re-read later; Slack and deployment-event relays capture
166
+ // the key at start.
167
+ const accountKey = await resolveApiKey(options.apiKey === undefined ? {} : { apiKey: options.apiKey });
168
+ // First present source wins (we define the order): option → env → file →
169
+ // service account → stored login. Re-read so bind can drop env or file
170
+ // onto a listening process.
171
+ const liveCursorApiKey = () => resolveApiKeySync(options.apiKey === undefined ? {} : { apiKey: options.apiKey })?.apiKey;
172
+ // The SCM relay reads the event stream as the signed-in user, so
173
+ // `cursorEvents` cannot work signed out. Require the credential before any
174
+ // slow or stateful startup work (playground build, channel onStart, cron).
175
+ // Not on a hosted v2 guest: under `--no-control-plane` with no v1 mount
176
+ // this process never polls `/v0/scm-events` (the hosted control plane
177
+ // owns ingest), and a persistent slot starts before its first credential
178
+ // is bound, so demanding one here would refuse a guest that never needed it.
179
+ const cursorEventsAuth = effectiveCursorEvents === undefined || allMountsHostedV2
180
+ ? undefined
181
+ : requireCursorEventsAuth(effectiveCursorEvents, accountKey);
182
+ // Two architectures + local CP + cursor-events would register two
183
+ // /v0/scm-events consumers (engine offset vs control-plane offset).
184
+ // Fail before engines or relays start. `--no-control-plane` mixed is one
185
+ // July consumer (v1 engine); hosted CP owns v2.
186
+ assertSingleCursorEventsLane({
187
+ noControlPlane,
188
+ config: effectiveCursorEvents,
189
+ auth: cursorEventsAuth,
190
+ v1Mounts: mounts.filter((mount) => !isV2Project(mount.project)),
191
+ v2Mounts: mounts.filter((mount) => isV2Project(mount.project)),
192
+ githubRepos: cursorGithubConfig.cursorEvents?.repos ?? [],
193
+ originRepos: cursorOriginScope?.repos ?? [],
194
+ });
195
+ let cursorGithubCredentials;
196
+ // Proxy-wired GitHub token resolver for `ctx.host.github` when no startup
197
+ // token mint runs (empty repo scope): host Octokit calls must route
198
+ // through github-proxy exactly like channel Octokit calls.
199
+ let hostGithubProxyResolver;
200
+ if (cursorGithubTargets.length > 0) {
201
+ const githubProxyRequested = scmProxyRequested;
202
+ const needsGithubAuth = cursorGithubConfig.scope !== undefined || githubProxyRequested;
203
+ if (needsGithubAuth) {
204
+ const currentGithubApiKey = () => {
205
+ const fromEvents = cursorEventsAuth?.apiKey.trim();
206
+ if (fromEvents !== undefined && fromEvents !== "") {
207
+ return fromEvents;
208
+ }
209
+ return liveCursorApiKey();
210
+ };
211
+ const githubApiKeyNow = currentGithubApiKey();
212
+ if (githubApiKeyNow === undefined && options.allowAnonymous !== true) {
213
+ throw new Error("githubChannel({ cursorAccount: true }) could not resolve Cursor event authentication.");
214
+ }
215
+ if (options.allowAnonymous === true) {
216
+ if (options.allowAnonymousCursorGithub !== true) {
217
+ throw new Error("githubChannel({ cursorAccount: true }) cannot be served with --allow-anonymous because admitted callers could use the signed-in account's GitHub access. If every admitted caller is trusted (e.g. behind an SSO proxy), opt in with --allow-anonymous-cursor-github.");
218
+ }
219
+ logger("[bdk] warning: --allow-anonymous-cursor-github — every admitted HTTP caller can drive sessions holding the signed-in account's repo-scoped GitHub credential; serve this only behind a trusted boundary (e.g. an SSO proxy)");
220
+ if (githubApiKeyNow === undefined) {
221
+ logger("[bdk] GitHub auth: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
222
+ }
223
+ }
224
+ if (cursorGithubConfig.permissions === "contents-write") {
225
+ logger('[bdk] warning: Cursor GitHub credentials include contents:write — the host holds a push-capable token shared with model-driven tools and untrusted webhook content; prefer permissions: "pr-write" unless this agent must push code');
226
+ }
227
+ const githubAuthBaseUrl = cursorExternalApiUrl();
228
+ const requireGithubApiKey = async () => {
229
+ const apiKey = currentGithubApiKey();
230
+ if (apiKey === undefined) {
231
+ throw new Error(`githubChannel({ cursorAccount: true }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
232
+ }
233
+ return apiKey;
234
+ };
235
+ const githubProxyUrl = githubProxyRequested
236
+ ? resolveCursorGithubProxyUrl(githubAuthBaseUrl)
237
+ : undefined;
238
+ if (cursorGithubConfig.scope !== undefined && githubApiKeyNow !== undefined) {
239
+ const provider = new CursorGithubCredentialProvider({
240
+ client: new CursorBackendClient({
241
+ backendUrl: githubAuthBaseUrl,
242
+ apiKey: githubApiKeyNow,
243
+ getApiKey: () => currentGithubApiKey() ?? "",
244
+ logger,
245
+ }),
246
+ scope: cursorGithubConfig.scope,
247
+ logger,
248
+ });
249
+ cursorGithubCredentials = provider;
250
+ if (githubProxyUrl !== undefined) {
251
+ // Proxy mode: channel Octokit calls carry the Cursor API key to the
252
+ // backend forwarder, which swaps in the installation token server-side
253
+ // and logs every call with per-deployment attribution. The provider
254
+ // still runs so child `gh` processes get a `GH_TOKEN` lease (v1).
255
+ const proxyTransport = {
256
+ apiBaseUrl: githubProxyUrl,
257
+ headers: {
258
+ "x-cursor-github-repos": cursorGithubConfig.scope.repos.join(","),
259
+ "x-cursor-github-permissions": cursorGithubConfig.permissions,
260
+ },
261
+ };
262
+ for (const target of cursorGithubTargets) {
263
+ target.accountRuntime.credentials.bind(requireGithubApiKey);
264
+ target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
265
+ }
266
+ logger(`[bdk] GitHub auth: channel API calls route through ${githubProxyUrl}`);
267
+ }
268
+ else {
269
+ for (const target of cursorGithubTargets) {
270
+ target.accountRuntime.credentials.bind(() => provider.getToken());
271
+ }
272
+ }
273
+ }
274
+ else if (githubProxyUrl !== undefined) {
275
+ // `cursorAccount: true` with no `--repo`: skip the startup token mint
276
+ // (it requires a repo list) and let github-proxy take the repo from
277
+ // each Octokit call. Hosted freeze bakes this flag into the template
278
+ // so restore is GitHub-ready once Bind drops the key.
279
+ const proxyTransport = {
280
+ apiBaseUrl: githubProxyUrl,
281
+ headers: {
282
+ "x-cursor-github-permissions": cursorGithubConfig.permissions,
283
+ },
284
+ };
285
+ for (const target of cursorGithubTargets) {
286
+ target.accountRuntime.credentials.bind(requireGithubApiKey);
287
+ target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
288
+ }
289
+ // `ctx.host.github` gets the same proxy transport; without this it
290
+ // would fall back to ambient auth (env token / `gh`) or an
291
+ // unauthenticated Octokit, and every host GitHub call would 404.
292
+ hostGithubProxyResolver = createCursorGithubProxyHostResolver({
293
+ getApiKey: requireGithubApiKey,
294
+ transport: proxyTransport,
295
+ });
296
+ logger(`[bdk] GitHub auth: channel and host API calls route through ${githubProxyUrl} (repo scope per request)`);
297
+ }
298
+ }
299
+ }
300
+ // GitLab `cursorAccount` channels: `ctx.gitlab` routes through the SCM
301
+ // proxy in proxy mode. Without `--cursor-scm-proxy` the runtime stays
302
+ // unbound and the handle falls back to direct `GITLAB_TOKEN` access.
303
+ if (scmProxyRequested) {
304
+ const gitlabProxyUrl = resolveCursorGitLabProxyUrl(cursorExternalApiUrl());
305
+ let gitlabTargets = 0;
306
+ for (const mount of mounts) {
307
+ for (const channel of mount.project.channels) {
308
+ const runtime = getGitLabCursorAccountRuntime(channel.definition);
309
+ if (runtime === undefined) {
310
+ continue;
311
+ }
312
+ gitlabTargets += 1;
313
+ const transport = {
314
+ apiBaseUrl: gitlabProxyUrl,
315
+ ...(runtime.scope === undefined
316
+ ? {}
317
+ : {
318
+ headers: {
319
+ [CURSOR_GITLAB_PROJECTS_HEADER]: runtime.scope.projects.join(","),
320
+ },
321
+ }),
322
+ };
323
+ runtime.credentials.bind(async () => {
324
+ const apiKey = liveCursorApiKey();
325
+ if (apiKey === undefined) {
326
+ throw new Error(`gitlabChannel({ cursorAccount }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
327
+ }
328
+ return apiKey;
329
+ });
330
+ runtime.credentials.bindProxyTransport(transport);
331
+ }
332
+ }
333
+ if (gitlabTargets > 0) {
334
+ logger(`[bdk] GitLab auth: channel API calls route through ${gitlabProxyUrl}`);
335
+ }
336
+ // Bitbucket `cursorAccount` channels: same shape, `/v0/bitbucket-proxy`
337
+ // with `x-cursor-bitbucket-repos` scope. The proxy picks Cloud 2.0 or
338
+ // the DC host's 1.0 upstream per tenant; the pack picks the dialect
339
+ // from the delivery payload.
340
+ const bitbucketProxyUrl = resolveCursorBitbucketProxyUrl(cursorExternalApiUrl());
341
+ let bitbucketTargets = 0;
342
+ for (const mount of mounts) {
343
+ for (const channel of mount.project.channels) {
344
+ const runtime = getBitbucketCursorAccountRuntime(channel.definition);
345
+ if (runtime === undefined) {
346
+ continue;
347
+ }
348
+ bitbucketTargets += 1;
349
+ const transport = {
350
+ apiBaseUrl: bitbucketProxyUrl,
351
+ ...(runtime.scope === undefined
352
+ ? {}
353
+ : {
354
+ headers: {
355
+ [CURSOR_BITBUCKET_REPOS_HEADER]: runtime.scope.repos.join(","),
356
+ },
357
+ }),
358
+ };
359
+ runtime.credentials.bind(async () => {
360
+ const apiKey = liveCursorApiKey();
361
+ if (apiKey === undefined) {
362
+ throw new Error(`bitbucketChannel({ cursorAccount }) has no Cursor credential yet. ${SIGN_IN_HINT}`);
363
+ }
364
+ return apiKey;
365
+ });
366
+ runtime.credentials.bindProxyTransport(transport);
367
+ }
368
+ }
369
+ if (bitbucketTargets > 0) {
370
+ logger(`[bdk] Bitbucket auth: channel API calls route through ${bitbucketProxyUrl}`);
371
+ }
372
+ }
373
+ const resolvedCursorGithubCredentials = cursorGithubCredentials;
374
+ const hostGithubToken = hostGithubProxyResolver ??
375
+ (resolvedCursorGithubCredentials === undefined
376
+ ? undefined
377
+ : createCursorAccountGithubTokenResolver(() => resolvedCursorGithubCredentials.getToken()));
378
+ const hostPlatforms = createHostPlatforms(hostGithubToken === undefined ? {} : { githubCredentials: { token: hostGithubToken } });
379
+ if (playground) {
380
+ // Auto-build dist/playground when missing (monorepo / source checkout).
381
+ // Published installs already ship the bundle; vite may be absent there.
382
+ await ensurePlaygroundBundle(logger);
383
+ }
384
+ const docsSite = options.docs ?? true;
385
+ if (docsSite) {
386
+ // Same pattern for the documentation site at /docs.
387
+ await ensureDocsSiteBundle(logger);
388
+ }
389
+ if (options.allowAnonymous === true) {
390
+ logger("[bdk] warning: --allow-anonymous admits every HTTP caller as the same principal; use only on a trusted network (e.g. Tailscale) and prefer --bearer-token for shared hosts");
391
+ }
392
+ // v2 hosted engines mirror the SDK conversation store to the deployment's
393
+ // shared file storage so a fresh pod resumes threads instead of forking
394
+ // them. Hosted serve is single-agent; a multi-mount serve (dev) has no
395
+ // single agent name to mint keys under and does not mirror.
396
+ const conversationMirror = mounts.length === 1 && mounts[0] !== undefined
397
+ ? selectConversationMirror({ project: mounts[0].project, logger })
398
+ : undefined;
399
+ const sessionRunLog = options.sessionRunLog ??
400
+ (mounts.length === 1 && mounts[0] !== undefined
401
+ ? selectSessionRunLogStore({
402
+ project: mounts[0].project,
403
+ logger,
404
+ snapshotLogs: () => logRing.since(),
405
+ })
406
+ : undefined);
407
+ const startLogStore = options.startLogStore ??
408
+ (mounts.length === 1 && mounts[0] !== undefined
409
+ ? selectStartLogStore({
410
+ project: mounts[0].project,
411
+ logger,
412
+ })
413
+ : undefined);
414
+ // Persistent slots keep writing /state/logs between turns, so this timer
415
+ // belongs to the process. Freeze pods never select a mirror.
416
+ let persistentStageLogMirrors = [];
417
+ // Stamped when the running claim's background store flush starts, which is
418
+ // before the turn; process-death flush reuses it so the tee snapshot lands
419
+ // under the same ses_ key.
420
+ let lastStartLogId;
421
+ const flushStartLog = async (startLogId) => {
422
+ lastStartLogId = startLogId;
423
+ if (startLogStore === undefined) {
424
+ return;
425
+ }
426
+ await flushLocalStartLog({ store: startLogStore, startLogId });
427
+ };
428
+ if (sessionRunLog !== undefined) {
429
+ registerSessionRunFatalFlush(async (error) => {
430
+ await flushHostedExecutionProcessDeath({
431
+ flushProcessDeath: (reason, flushError) => sessionRunLog.flushProcessDeath(reason, flushError),
432
+ flushStartLog,
433
+ startLogId: lastStartLogId,
434
+ reason: "uncaught_exception",
435
+ error,
436
+ });
437
+ });
438
+ }
439
+ const sdkRunner = options.runner ??
440
+ new CursorSdkRunner({
441
+ ...(options.apiKey === undefined || options.apiKey.trim() === ""
442
+ ? {}
443
+ : { apiKey: options.apiKey }),
444
+ ...(conversationMirror === undefined ? {} : { conversationMirror }),
445
+ logger,
446
+ });
447
+ // Grok Bot turns run on Cursor's hosted Grok Bot (Sand) harness through
448
+ // the /v0/grokbot session API; the SDK side is a thin remote client. The
449
+ // dispatching runner is only interposed when a mount needs it. An
450
+ // injected test runner receives every turn, grokbot included.
451
+ const hasGrokBotMounts = mounts.some((mount) => mount.project.agent.runtime === "grokbot");
452
+ // Fail closed like cursor-account GitHub/MCP: grokbot turns execute on the
453
+ // signed-in account's hosted computer, so anonymous admission needs its
454
+ // own opt-in.
455
+ if (hasGrokBotMounts && options.allowAnonymous === true) {
456
+ if (options.allowAnonymousGrokbot !== true) {
457
+ throw new Error('runtime: "grokbot" cannot be served with --allow-anonymous because admitted callers could drive the signed-in account\'s hosted Grok Bot computer. If every admitted caller is trusted (e.g. behind an SSO proxy), opt in with --allow-anonymous-grokbot.');
458
+ }
459
+ logger("[bdk] warning: --allow-anonymous-grokbot — every admitted HTTP caller can drive turns on the signed-in account's hosted Grok Bot computer; serve this only behind a trusted boundary (e.g. an SSO proxy)");
460
+ }
461
+ let runner = sdkRunner;
462
+ if (hasGrokBotMounts && options.runner === undefined) {
463
+ // Cursor-internal client, left out of the npm tarball (`files`); loaded
464
+ // only when a mount needs it, so a published install fails here, before
465
+ // listen, rather than on the first turn.
466
+ const { GrokBotRunner } = await import("./grokbot/runner.js").catch(() => {
467
+ throw new Error('runtime: "grokbot" is not available in the published @cursor/bdk package');
468
+ });
469
+ runner = new RuntimeDispatchingRunner({
470
+ sdkRunner,
471
+ grokbot: new GrokBotRunner({
472
+ apiKey: options.apiKey,
473
+ // `/v0/grokbot` lives on the external API (api.cursor.com), not
474
+ // api2. Prefer that default over the account key's backendUrl.
475
+ // Do not pass stored login as apiKey: that would pin it as an
476
+ // option and beat a later CURSOR_API_KEY_FILE bind.
477
+ backendUrl: cursorExternalApiUrl(),
478
+ }),
479
+ });
480
+ logger("[bdk] grokbot runtime: remote client (turns run on the hosted Grok Bot harness)");
481
+ }
482
+ const router = new Router();
483
+ const runtimes = [];
484
+ const channelStopHooks = [];
485
+ let githubAuthWarmed = false;
486
+ // Validate peer MCP connections (defineConnection({ agent })) against the
487
+ // mount set before anything starts. URLs resolve after listen, once the
488
+ // port is known.
489
+ const peerRefsBySlug = collectPeerConnections(mounts, logger, options.peersUrl);
490
+ // Cursor account MCP connections (defineConnection({ cursorAccount: true }))
491
+ // need a signed-in host: their tools execute on the Cursor backend with
492
+ // the account's stored OAuth credentials. Fail fast at serve start instead
493
+ // of at the first turn.
494
+ const accountRefsBySlug = collectCursorAccountConnections(mounts);
495
+ assertAccountConnectionsNotAnonymous({
496
+ allowAnonymous: options.allowAnonymous,
497
+ allowAnonymousCursorAccountMcp: options.allowAnonymousCursorAccountMcp,
498
+ hasAccountConnections: accountRefsBySlug.size > 0,
499
+ });
500
+ if (options.allowAnonymous === true &&
501
+ options.allowAnonymousCursorAccountMcp === true &&
502
+ accountRefsBySlug.size > 0) {
503
+ logger("[bdk] warning: --allow-anonymous-cursor-account-mcp — every admitted HTTP caller can drive Cursor account MCP connectors; serve this only behind a trusted boundary (e.g. an SSO proxy or hosted alias token)");
504
+ }
505
+ let accountBridge;
506
+ if (accountRefsBySlug.size > 0) {
507
+ if (accountKey === undefined && options.allowAnonymous !== true) {
508
+ throw new Error(`This project has Cursor account MCP connections (defineConnection({ cursorAccount: true })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
509
+ }
510
+ if (accountKey === undefined) {
511
+ logger("[bdk] Cursor account MCP: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
512
+ }
513
+ accountBridge = new CursorAccountMcpBridge({
514
+ client: new CursorBackendClient({
515
+ backendUrl: accountKey?.backendUrl ?? cursorBackendUrl(),
516
+ apiKey: accountKey?.apiKey ?? "",
517
+ getApiKey: () => liveCursorApiKey() ?? "",
518
+ logger,
519
+ }),
520
+ logger,
521
+ // Cloud turns reach the bridge through the serve publicUrl; without
522
+ // one, the bridge admits loopback callers only.
523
+ allowRemoteCallers: options.publicUrl !== undefined,
524
+ });
525
+ }
526
+ for (const { slug, project } of mounts) {
527
+ // Each agent gets an isolated state root so their sessions never mix.
528
+ const baseStateRoot = options.stateRoot ?? join(project.rootDir, ".agent-serve");
529
+ const stateRoot = slug === "" ? baseStateRoot : join(baseStateRoot, slug);
530
+ const otelCollector = createOtelCollector(otelRuntime, project.name, logger);
531
+ const engine = new SessionEngine({
532
+ project,
533
+ stateRoot,
534
+ runner,
535
+ logger,
536
+ platforms: hostPlatforms,
537
+ otel: otelCollector,
538
+ otelMeter: () => otelRuntime.meter,
539
+ });
540
+ engine.oauthCallbackHub.secrets = options.mcpOauthSecrets;
541
+ engine.oauthCallbackHub.secretsBind = {
542
+ slug: slug === "" ? undefined : slug,
543
+ cloudToolsUrl: options.cloudToolsUrl,
544
+ };
545
+ engine.oauthCallbackHub.logger = logger;
546
+ // Rehydrate sessions from the authored storage sink before any
547
+ // channel or route can address them (continuation tokens must resolve).
548
+ await engine.restoreStoredSessions();
549
+ // Resolve a shared harness workspace in the background: on a large repo
550
+ // that takes seconds, and a deployment coming online should absorb it
551
+ // rather than whoever sends the first message. No-op unless the agent
552
+ // pins `local.workspaceDir`.
553
+ void engine.prewarmSharedWorkspace();
554
+ if (!githubAuthWarmed) {
555
+ // Soft GitHub auth check before channel onStart (which may call
556
+ // host.github). Missing auth is a warning only — serve still starts.
557
+ await warmupHostGitHubAuth({
558
+ logger,
559
+ github: engine.host.github,
560
+ authSource: hostGithubToken === undefined ? undefined : "cursor-account",
561
+ });
562
+ githubAuthWarmed = true;
563
+ }
564
+ const scheduleRunner = new ScheduleRunner(engine, project, logger);
565
+ let reminderRunner;
566
+ const architecture = project.agent.architecture;
567
+ const useReminderCpProtocol = architecture === "v2";
568
+ const localControlPlane = noControlPlane
569
+ ? undefined
570
+ : await createLocalControlPlane({
571
+ fireSchedule: (name) => scheduleRunner.dispatch(name),
572
+ ...(useReminderCpProtocol
573
+ ? {
574
+ executeReminder: (descriptor) => reminderRunner.executeFire(descriptor),
575
+ }
576
+ : {
577
+ fireReminder: (id, fireCount) => reminderRunner.dispatch(id, {
578
+ expectedFireCount: fireCount,
579
+ }),
580
+ }),
581
+ stateDir: join(stateRoot, "control-plane"),
582
+ armReminderClocks: runReminders,
583
+ logger,
584
+ });
585
+ const timerClient = noControlPlane ? createCursorHostedPlatformTimers() : localControlPlane;
586
+ const hostedReminderControlPlane = noControlPlane && useReminderCpProtocol
587
+ ? createCursorHostedReminderControlPlane()
588
+ : undefined;
589
+ const reminderControlPlane = useReminderCpProtocol
590
+ ? (localControlPlane ?? hostedReminderControlPlane)
591
+ : undefined;
592
+ reminderRunner = new ReminderRunner(engine, logger, timerClient, {
593
+ namedHandlers: project.reminders ?? [],
594
+ // Architecture v2 rejects anonymous run/until everywhere (local + hosted).
595
+ rejectAnonymousHandlers: rejectAnonymousReminderHandlers({
596
+ noControlPlane,
597
+ architecture,
598
+ }),
599
+ architecture,
600
+ controlPlane: reminderControlPlane,
601
+ // Hosted admissions build their channel args with no request
602
+ // principal (`buildChannelHandlerArgs` → `auth: null`), so a fire that
603
+ // opens a session on a fresh pod uses the same one and a session
604
+ // restored from durable storage still matches.
605
+ hostedGuest: hostedReminderControlPlane === undefined ? undefined : { fireAuth: () => null },
606
+ });
607
+ const evalRuns = new EvalRunStore(project.rootDir, logger,
608
+ // Playground eval history mirrors onto the defineStorage evals table.
609
+ engine.storage?.evalRuns());
610
+ // Eval history restores with the same startup step as sessions (reads
611
+ // also hydrate lazily, but doing it here surfaces store problems at
612
+ // boot and makes /v1/dev/evals complete from the first request).
613
+ await evalRuns.hydrate();
614
+ engine.setReminders({
615
+ create: (input) => reminderRunner.create(input),
616
+ list: (filter) => reminderRunner.list(filter),
617
+ cancel: (id, reason) => reminderRunner.cancel(id, reason),
618
+ cancelForContinuation: (token, reason) => reminderRunner.cancelForContinuation(token, reason),
619
+ rekeyContinuation: (channelId, oldToken, newToken) => reminderRunner.rekeyContinuation(channelId, oldToken, newToken),
620
+ dispatch: (id) => reminderRunner.dispatch(id),
621
+ });
622
+ engine.setEvals({
623
+ list: () => evalRuns.list(),
624
+ get: (runId) => evalRuns.get(runId),
625
+ listRunsWithActive: () => evalRuns.listRunsWithActive(),
626
+ start: (input) => evalRuns.start(input),
627
+ cancel: (runId) => evalRuns.cancel(runId),
628
+ });
629
+ const runtime = {
630
+ slug,
631
+ project,
632
+ engine,
633
+ scheduleRunner,
634
+ reminderRunner,
635
+ evalRuns,
636
+ ...(localControlPlane === undefined ? {} : { controlPlane: localControlPlane }),
637
+ ...(reminderControlPlane === undefined ? {} : { reminderControlPlane }),
638
+ };
639
+ runtimes.push(runtime);
640
+ const accountRefs = accountRefsBySlug.get(slug);
641
+ mountAgentRoutes(router, runtime, {
642
+ dev,
643
+ playground,
644
+ noControlPlane,
645
+ multi,
646
+ logger,
647
+ logRing,
648
+ diagStateRoot: baseStateRoot,
649
+ sessionRunLog,
650
+ flushStartLog,
651
+ flushOtel: () => otelRuntime.forceFlush(),
652
+ onSecretsReady: noControlPlane && isV2Project(project) ? otel.reload : undefined,
653
+ ...(options.authToken === undefined ? {} : { authToken: options.authToken }),
654
+ ...(options.allowAnonymous === true ? { allowAnonymous: true } : {}),
655
+ ...(accountRefs !== undefined && accountBridge !== undefined
656
+ ? { accountBridge, accountRefs }
657
+ : {}),
658
+ ...(sdkRunner instanceof CursorSdkRunner
659
+ ? {
660
+ evictSdkSession: (sessionId) => {
661
+ sdkRunner.evictSession(sessionId);
662
+ },
663
+ }
664
+ : {}),
665
+ });
666
+ for (const channel of project.channels) {
667
+ const definition = channel.definition;
668
+ if (definition.onStop !== undefined) {
669
+ channelStopHooks.push(() => definition.onStop?.());
670
+ }
671
+ if (definition.onStart !== undefined) {
672
+ const startArgs = {
673
+ send: (message, sendOptions) => engine.send(channel.id, message, sendOptions),
674
+ architecture: project.agent.architecture,
675
+ getSession: (sessionId) => engine.getChannelSession(channel.id, sessionId),
676
+ receive: (target, input) => engine.receive(target, input),
677
+ callTool: (toolName, input, callOptions) => engine.callTool(toolName, input, callOptions),
678
+ emitAssistantMessage: (sessionId, text) => engine.emitAssistantMessage(sessionId, text),
679
+ host: engine.host,
680
+ waitUntil: (promise) => {
681
+ engine.trackBackground(promise);
682
+ },
683
+ resolveApproval: (sessionId, callId, decision, auth) => engine.resolveApproval(sessionId, callId, decision, auth),
684
+ resolveAuth: (sessionId, callId, decision, auth) => engine.resolveAuth(sessionId, callId, decision, auth),
685
+ hasContinuationSession: (continuationToken) => engine.hasContinuationSession(channel.id, continuationToken),
686
+ isContinuationBusy: (continuationToken) => engine.isContinuationBusy(channel.id, continuationToken),
687
+ getContinuationLastBotMessageTs: (continuationToken) => engine.getContinuationLastBotMessageTs(channel.id, continuationToken),
688
+ interruptContinuation: (continuationToken) => engine.interruptContinuation(channel.id, continuationToken),
689
+ logger,
690
+ artifacts: engine.artifacts,
691
+ };
692
+ try {
693
+ await definition.onStart(startArgs);
694
+ }
695
+ catch (error) {
696
+ logger(`[bdk] channel "${channel.id}" onStart failed: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}`);
697
+ }
698
+ }
699
+ }
700
+ // A hosted v2 guest boots per delivery; its calendars come from the
701
+ // release manifest at deploy time, so it must not sync them itself.
702
+ const hostedV2Guest = noControlPlane && architecture === "v2";
703
+ if (timerClient !== undefined && runSchedules && !hostedV2Guest) {
704
+ await syncHostedPlatformSchedules({
705
+ timers: timerClient,
706
+ schedules: project.schedules,
707
+ catalogPath: join(stateRoot, PLATFORM_SCHEDULE_CATALOG_FILENAME),
708
+ logger,
709
+ });
710
+ }
711
+ if (timerClient !== undefined) {
712
+ await reminderRunner.hydrate();
713
+ }
714
+ localControlPlane?.startClocks();
715
+ }
716
+ if (docsSite) {
717
+ // The framework documentation site, mounted at /docs in both layouts
718
+ // ("docs" is a reserved slug). Static, no secrets; unauthenticated like
719
+ // the playground assets.
720
+ router.add({
721
+ method: "GET",
722
+ pattern: "/docs",
723
+ auth: "none",
724
+ handler: () => renderDocsFile(""),
725
+ });
726
+ router.add({
727
+ method: "GET",
728
+ pattern: "/docs/*path",
729
+ auth: "none",
730
+ handler: (_request, ctx) => renderDocsFile(ctx.params.path ?? ""),
731
+ });
732
+ }
733
+ if (multi) {
734
+ // Host-level liveness for ALB / ECS health checks. Per-agent health stays
735
+ // at `/<slug>/v1/health`; without this, multi-mode has no `/v1/health`.
736
+ router.add({
737
+ method: "GET",
738
+ pattern: "/v1/health",
739
+ auth: "none",
740
+ handler: () => jsonResponse({
741
+ ok: true,
742
+ agents: runtimes.map(({ slug, project }) => ({
743
+ slug,
744
+ name: project.name,
745
+ })),
746
+ ...memoryHealthFields(runtimes.map((runtime) => runtime.engine)),
747
+ }),
748
+ });
749
+ }
750
+ // Orienting `/` for every layout (single empty-slug and multi).
751
+ // Lists playground links plus live routes (playground, health, docs).
752
+ if (playground) {
753
+ const entries = buildAgentIndexEntries(runtimes);
754
+ const indexHtml = renderAgentsIndexHtml(entries, {
755
+ docs: docsSite,
756
+ multi,
757
+ });
758
+ router.add({
759
+ method: "GET",
760
+ pattern: "/",
761
+ auth: "none",
762
+ handler: () => new Response(indexHtml, {
763
+ headers: { "content-type": "text/html; charset=utf-8" },
764
+ }),
765
+ });
766
+ if (multi) {
767
+ router.add({
768
+ method: "GET",
769
+ pattern: "/v1/agents",
770
+ auth: "none",
771
+ handler: () => jsonResponse({ agents: entries }),
772
+ });
773
+ }
774
+ }
775
+ // Shared GitHub webhook ingress: one URL fans out to every mounted agent
776
+ // that declared a github channel. Signature verification is the caller's
777
+ // job (backend `/github_webhook` already verified); we only admit loopback
778
+ // so this route is not a public unsigned endpoint. Agents decide whether
779
+ // to run via their onPullRequest / onComment / … hooks.
780
+ const collectGitHubTargetsFrom = (selected) => collectGitHubTriggerTargets({
781
+ mounts: selected.map((runtime) => ({
782
+ slug: runtime.slug,
783
+ channels: runtime.project.channels,
784
+ buildHandlerArgs: (channelId) => buildChannelHandlerArgs({ runtime, channelId }),
785
+ })),
786
+ });
787
+ const collectOriginTargetsFrom = (selected) => collectOriginTriggerTargets({
788
+ mounts: selected.map((runtime) => ({
789
+ slug: runtime.slug,
790
+ channels: runtime.project.channels,
791
+ buildHandlerArgs: (channelId) => buildChannelHandlerArgs({ runtime, channelId }),
792
+ })),
793
+ });
794
+ const collectGitHubTargets = () => collectGitHubTargetsFrom(runtimes);
795
+ const v1Runtimes = runtimes.filter((runtime) => !isV2Project(runtime.project));
796
+ const v2Runtimes = runtimes.filter((runtime) => isV2Project(runtime.project));
797
+ const v1Mounts = mounts.filter((mount) => !isV2Project(mount.project));
798
+ const v2Mounts = mounts.filter((mount) => isV2Project(mount.project));
799
+ router.add({
800
+ method: "POST",
801
+ pattern: "/v1/webhooks/github",
802
+ auth: [localDevStrict()],
803
+ handler: async (request) => {
804
+ const bodyText = await request.text();
805
+ const routeContinuation = localControlPlaneRoute(runtimes);
806
+ const result = await handleAgentServeTrigger({
807
+ type: "github",
808
+ bodyText,
809
+ eventName: request.headers.get("x-github-event"),
810
+ deliveryId: request.headers.get("x-github-delivery") ?? undefined,
811
+ targets: collectGitHubTargets(),
812
+ ...(routeContinuation === undefined ? {} : { routeContinuation }),
813
+ });
814
+ const status = result.ok ? 202 : (result.targets[0]?.status ?? 500);
815
+ return jsonResponse(result, { status });
816
+ },
817
+ });
818
+ for (const { slug, project } of mounts) {
819
+ validateMountConnectionsConfig({
820
+ slug,
821
+ project,
822
+ accountRefs: accountRefsBySlug.get(slug),
823
+ ...(options.publicUrl === undefined ? {} : { publicUrl: options.publicUrl }),
824
+ cloudToolsBridge: options.cloudToolsUrl !== undefined,
825
+ });
826
+ }
827
+ try {
828
+ await cursorGithubCredentials?.start();
829
+ }
830
+ catch (error) {
831
+ if (options.evals !== true) {
832
+ throw error;
833
+ }
834
+ logger(`[bdk] GitHub auth: no Cursor account credential (${error instanceof Error ? error.message : String(error)}); GitHub calls from eval sessions will fail`);
835
+ }
836
+ // Cursor SCM events: v1 stays on the engine poll. v2 ingest is local-CP
837
+ // only — hosted `--no-control-plane` skips the July poll (hosted CP wakes).
838
+ const routeContinuation = localControlPlaneRoute(runtimes);
839
+ const cursorEventsCommon = {
840
+ config: effectiveCursorEvents,
841
+ githubRepos: cursorGithubConfig.cursorEvents?.repos ?? [],
842
+ originRepos: cursorOriginScope?.repos ?? [],
843
+ stateRoot: options.stateRoot,
844
+ auth: cursorEventsAuth,
845
+ logger,
846
+ cursorAccountOnly: options.cursorEvents === undefined &&
847
+ (cursorGithubTargets.length > 0 || cursorOriginTargets.length > 0),
848
+ };
849
+ const cursorEventRelay = startCursorEventRelay({
850
+ ...cursorEventsCommon,
851
+ mounts: v1Mounts,
852
+ collectGitHubTargets: () => collectGitHubTargetsFrom(v1Runtimes),
853
+ collectOriginTargets: () => collectOriginTargetsFrom(v1Runtimes),
854
+ lane: "engine",
855
+ skippedV2: v2Mounts.length > 0,
856
+ });
857
+ const controlPlaneScmRelay = startCursorEventRelay({
858
+ ...cursorEventsCommon,
859
+ mounts: v2Mounts,
860
+ collectGitHubTargets: () => collectGitHubTargetsFrom(v2Runtimes),
861
+ collectOriginTargets: () => collectOriginTargetsFrom(v2Runtimes),
862
+ ...(routeContinuation === undefined ? {} : { routeContinuation }),
863
+ lane: "control-plane",
864
+ start: false,
865
+ stateDirName: join("control-plane", "cursor-events"),
866
+ });
867
+ const localCp = firstLocalControlPlane(runtimes);
868
+ if (controlPlaneScmRelay !== undefined) {
869
+ if (localCp !== undefined) {
870
+ localCp.attachScmEvents(controlPlaneScmRelay);
871
+ }
872
+ else {
873
+ logger("[bdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
874
+ }
875
+ }
876
+ else if (allMountsHostedV2 && effectiveCursorEvents !== undefined) {
877
+ // No credential was required above, so no relay object was built; the
878
+ // outcome is the same skip.
879
+ logger("[bdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
880
+ }
881
+ // Cursor deployment-events relay: automatic when a mounted agent authored
882
+ // `deploymentsChannel({ ... })`.
883
+ const cursorDeploymentRelay = options.evals === true
884
+ ? undefined
885
+ : startCursorDeploymentRelay({
886
+ options,
887
+ runtimes,
888
+ accountKey,
889
+ logger,
890
+ });
891
+ // Trust --public-url's host when a reverse proxy rewrites Host.
892
+ const browserOriginGuard = browserOriginGuardOptionsForPublicUrl(options.publicUrl);
893
+ const server = createServer((req, res) => {
894
+ void instrumentHttp(otelRuntime, req, res, () => handleRequest(router, req, res, logger, browserOriginGuard));
895
+ });
896
+ const host = options.host ?? "127.0.0.1";
897
+ const portWasExplicit = options.port !== undefined;
898
+ const requestedPort = options.port ?? DEFAULT_SERVE_PORT;
899
+ let boundPort;
900
+ try {
901
+ boundPort = await listenHttpServer({
902
+ server,
903
+ host,
904
+ port: requestedPort,
905
+ portWasExplicit,
906
+ logger,
907
+ });
908
+ }
909
+ catch (error) {
910
+ await cursorDeploymentRelay?.stop();
911
+ await cursorEventRelay?.stop();
912
+ await controlPlaneScmRelay?.stop();
913
+ cursorGithubCredentials?.stop();
914
+ await otelRuntime.shutdown();
915
+ throw error;
916
+ }
917
+ const address = server.address();
918
+ const displayHost = host === "0.0.0.0" || host === "::" ? "127.0.0.1" : host;
919
+ const url = `http://${displayHost}:${boundPort}`;
920
+ const oauthOrigin = (options.publicUrl ?? url).replace(/\/$/, "");
921
+ // Resolve peer + Cursor account MCP connections now that the listen port is
922
+ // known (see resolved-connections.ts for the URL/runtime rules).
923
+ for (const runtime of runtimes) {
924
+ const peerRefs = peerRefsBySlug.get(runtime.slug);
925
+ const accountRefs = accountRefsBySlug.get(runtime.slug);
926
+ const resolved = resolveMountConnections({
927
+ slug: runtime.slug,
928
+ project: runtime.project,
929
+ serverUrl: url,
930
+ ...(peerRefs === undefined ? {} : { peerRefs }),
931
+ ...(accountRefs !== undefined && accountBridge !== undefined
932
+ ? { accountRefs, accountBridge }
933
+ : {}),
934
+ ...(options.publicUrl === undefined ? {} : { publicUrl: options.publicUrl }),
935
+ ...(options.authToken === undefined ? {} : { authToken: options.authToken }),
936
+ peersUrl: options.peersUrl,
937
+ cloudToolsBridge: options.cloudToolsUrl !== undefined,
938
+ logger,
939
+ });
940
+ if (resolved.length > 0) {
941
+ runtime.engine.setResolvedConnections(resolved);
942
+ }
943
+ const oauthBase = runtime.slug === "" ? "" : `/${runtime.slug}`;
944
+ runtime.engine.setMcpOauthCallbackUrl(mcpOauthServeCallbackUrl(oauthOrigin, oauthBase));
945
+ if (accountBridge !== undefined && accountRefs !== undefined) {
946
+ const bridge = accountBridge;
947
+ runtime.engine.setCursorAccountAuthProbe(async (connection) => {
948
+ const ref = accountRefs.find((entry) => entry.name === connection);
949
+ if (ref === undefined) {
950
+ return undefined;
951
+ }
952
+ return await bridge.probeAuthUrl(ref);
953
+ });
954
+ }
955
+ const hasServerTools = runtime.project.agent.tools.some((tool) => tool.execution === "server");
956
+ // Host-bridged connections ride the same endpoint as server tools, so
957
+ // the cloud tools connection is set whenever either needs it.
958
+ const bridgeableNames = runtime.engine.cloudBridgeableConnectionNames();
959
+ const cloudCapable = runtime.project.agent.runtime === "cloud" || runtime.project.agent.cloud !== undefined;
960
+ if ((hasServerTools || bridgeableNames.length > 0) && cloudCapable) {
961
+ const basePath = runtime.slug === "" ? "" : `/${runtime.slug}`;
962
+ const publicToolsUrl = options.cloudToolsUrl ??
963
+ (options.publicUrl === undefined
964
+ ? undefined
965
+ : `${options.publicUrl.replace(/\/$/, "")}${basePath}${TOOL_MCP_ENDPOINT_PATH}`);
966
+ if (publicToolsUrl === undefined) {
967
+ if (hasServerTools) {
968
+ logger(`[bdk] warning: agent "${runtime.project.name}" has server tools but no --public-url or --cloud-tools-url; cloud turns omit those tools.`);
969
+ }
970
+ }
971
+ else {
972
+ const resolveCloudToolsHeaders = options.cloudToolsUrl === undefined
973
+ ? undefined
974
+ : () => {
975
+ const apiKey = liveCursorApiKey();
976
+ return apiKey === undefined ? undefined : { authorization: `Bearer ${apiKey}` };
977
+ };
978
+ const headers = options.cloudToolsUrl !== undefined
979
+ ? resolveCloudToolsHeaders?.()
980
+ : options.authToken === undefined
981
+ ? undefined
982
+ : { authorization: `Bearer ${options.authToken}` };
983
+ if (options.cloudToolsUrl !== undefined && headers === undefined) {
984
+ if (options.allowAnonymous !== true) {
985
+ throw new Error(`Agent "${runtime.project.name}" needs a Cursor API key to authenticate --cloud-tools-url. ${SIGN_IN_HINT}`);
986
+ }
987
+ logger(`[bdk] --cloud-tools-url: listening unsigned; Bearer resolves after task-time credential binding`);
988
+ }
989
+ runtime.engine.setCloudServerToolsConnection({
990
+ type: "http",
991
+ url: publicToolsUrl,
992
+ ...(headers === undefined ? {} : { headers }),
993
+ }, resolveCloudToolsHeaders);
994
+ }
995
+ }
996
+ }
997
+ const projects = [];
998
+ const agents = [];
999
+ for (const { slug, project } of runtimes) {
1000
+ const wrapped = createProject(project);
1001
+ projects.push(wrapped);
1002
+ agents.push({
1003
+ slug,
1004
+ url: slug === "" ? url : `${url}/${slug}`,
1005
+ info: wrapped.info,
1006
+ });
1007
+ }
1008
+ for (const runtime of runtimes) {
1009
+ runtime.evalRuns.loopbackUrl = runtime.slug === "" ? url : `${url}/${runtime.slug}`;
1010
+ }
1011
+ const runtimeBySlug = new Map(runtimes.map((r) => [r.slug, r]));
1012
+ // --dev: spawn Vite HMR. Single-agent infers the slug base; multi-agent
1013
+ // serves `/<slug>/playground` on the HMR origin (optional AGENT_SERVE_BASE
1014
+ // pins one slug at the HMR root instead).
1015
+ let playgroundDev;
1016
+ if (playground && dev) {
1017
+ const pinnedBase = mounts.length === 1 ? playgroundDevBasePath(mounts) : playgroundDevBaseFromEnv();
1018
+ const multiAgent = mounts.length > 1 && pinnedBase === undefined;
1019
+ playgroundDev = startPlaygroundDevServer({
1020
+ targetUrl: url,
1021
+ basePath: pinnedBase,
1022
+ multiAgent,
1023
+ logger,
1024
+ });
1025
+ }
1026
+ const handle = {
1027
+ url,
1028
+ port: address.port,
1029
+ project: projects[0],
1030
+ agents,
1031
+ dispatchSchedule: (name, slug = runtimes[0]?.slug ?? "") => {
1032
+ const runtime = runtimeBySlug.get(slug);
1033
+ if (runtime === undefined) {
1034
+ throw new Error(`Unknown agent slug "${slug}"`);
1035
+ }
1036
+ return runtime.scheduleRunner.dispatch(name);
1037
+ },
1038
+ createReminder: (input, slug = runtimes[0]?.slug ?? "") => {
1039
+ const runtime = runtimeBySlug.get(slug);
1040
+ if (runtime === undefined) {
1041
+ throw new Error(`Unknown agent slug "${slug}"`);
1042
+ }
1043
+ return runtime.reminderRunner.create(input);
1044
+ },
1045
+ listReminders: (filter, slug = runtimes[0]?.slug ?? "") => {
1046
+ const runtime = runtimeBySlug.get(slug);
1047
+ if (runtime === undefined) {
1048
+ throw new Error(`Unknown agent slug "${slug}"`);
1049
+ }
1050
+ return runtime.reminderRunner.list(filter);
1051
+ },
1052
+ cancelReminder: (id, options) => {
1053
+ const slug = options?.slug ?? runtimes[0]?.slug ?? "";
1054
+ const runtime = runtimeBySlug.get(slug);
1055
+ if (runtime === undefined) {
1056
+ throw new Error(`Unknown agent slug "${slug}"`);
1057
+ }
1058
+ return runtime.reminderRunner.cancel(id, options?.reason);
1059
+ },
1060
+ dispatchReminder: (id, slug = runtimes[0]?.slug ?? "") => {
1061
+ const runtime = runtimeBySlug.get(slug);
1062
+ if (runtime === undefined) {
1063
+ throw new Error(`Unknown agent slug "${slug}"`);
1064
+ }
1065
+ return runtime.reminderRunner.dispatch(id);
1066
+ },
1067
+ callTool: (toolName, input, options) => {
1068
+ const { slug, ...callOptions } = options ?? {};
1069
+ const runtime = runtimeBySlug.get(slug ?? runtimes[0]?.slug ?? "");
1070
+ if (runtime === undefined) {
1071
+ throw new Error(`Unknown agent slug "${slug}"`);
1072
+ }
1073
+ return runtime.engine.callTool(toolName, input, callOptions);
1074
+ },
1075
+ close: async () => {
1076
+ for (const mirror of persistentStageLogMirrors) {
1077
+ await mirror.stop();
1078
+ }
1079
+ if (sessionRunLog !== undefined) {
1080
+ await flushHostedExecutionProcessDeath({
1081
+ flushProcessDeath: (reason) => sessionRunLog.flushProcessDeath(reason),
1082
+ flushStartLog,
1083
+ startLogId: lastStartLogId,
1084
+ reason: "process_exit",
1085
+ });
1086
+ unregisterSessionRunFatalFlush();
1087
+ }
1088
+ playgroundDev?.stop();
1089
+ await cursorDeploymentRelay?.stop();
1090
+ await cursorEventRelay?.stop();
1091
+ await controlPlaneScmRelay?.stop();
1092
+ for (const runtime of runtimes) {
1093
+ runtime.controlPlane?.stop();
1094
+ runtime.scheduleRunner.stop();
1095
+ runtime.reminderRunner.stop();
1096
+ // Before the engines close their storage coordinators, so the
1097
+ // interrupted-batch write can still reach the sink.
1098
+ runtime.evalRuns.close();
1099
+ }
1100
+ for (const stop of channelStopHooks) {
1101
+ try {
1102
+ await stop();
1103
+ }
1104
+ catch (error) {
1105
+ logger(`[bdk] channel onStop failed: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}`);
1106
+ }
1107
+ }
1108
+ server.close();
1109
+ server.closeAllConnections();
1110
+ try {
1111
+ await Promise.all(runtimes.map((runtime) => runtime.engine.close()));
1112
+ }
1113
+ finally {
1114
+ cursorGithubCredentials?.stop();
1115
+ await otelRuntime.shutdown();
1116
+ }
1117
+ },
1118
+ };
1119
+ persistentStageLogMirrors = runtimes.flatMap((runtime) => {
1120
+ const mirror = selectPersistentStageLogMirror({
1121
+ project: runtime.project,
1122
+ logsDir: join(options.stateRoot ?? join(runtime.project.rootDir, ".agent-serve"), "logs"),
1123
+ logger,
1124
+ });
1125
+ return mirror === undefined ? [] : [startPersistentStageLogMirror(mirror)];
1126
+ });
1127
+ if (playgroundDev?.url !== undefined) {
1128
+ handle.playgroundDevUrl = playgroundDev.url;
1129
+ }
1130
+ if (docsSite && docsSiteExists()) {
1131
+ handle.docsUrl = `${handle.url}/docs`;
1132
+ }
1133
+ return handle;
1134
+ }
1135
+ function mountAgentRoutes(router, runtime, args) {
1136
+ const { slug, project, engine, scheduleRunner, reminderRunner, reminderControlPlane } = runtime;
1137
+ const { dev, playground, noControlPlane, multi, logger, logRing, sessionRunLog, flushStartLog } = args;
1138
+ // "" (single) -> "/v1/..."; "my-agent" (multi) -> "/my-agent/v1/...".
1139
+ const base = slug === "" ? "" : `/${slug}`;
1140
+ // The Cursor account MCP bridge for this mount's account MCP connections:
1141
+ // loopback-only + per-boot bearer secret, never on the public auth chain.
1142
+ if (args.accountBridge !== undefined && args.accountRefs !== undefined) {
1143
+ const bridge = args.accountBridge;
1144
+ const refByName = new Map(args.accountRefs.map((ref) => [ref.name, ref]));
1145
+ router.add({
1146
+ method: "POST",
1147
+ pattern: `${base}${cursorAccountMcpPath(":connection")}`,
1148
+ auth: [bridge.authPolicy()],
1149
+ handler: (request, ctx) => {
1150
+ const ref = refByName.get(ctx.params.connection ?? "");
1151
+ if (ref === undefined) {
1152
+ return errorResponse(404, "not_found", `No Cursor account MCP connection named "${ctx.params.connection ?? ""}" on this agent.`);
1153
+ }
1154
+ return bridge.handle(request, ref, appendSlackQuietHint);
1155
+ },
1156
+ });
1157
+ }
1158
+ const defaultAuth = args.authToken !== undefined
1159
+ ? [bearerAuth(args.authToken)]
1160
+ : args.allowAnonymous === true
1161
+ ? [allowAll()]
1162
+ : [localDevStrict()];
1163
+ const httpAuth = project.httpChannel.auth ?? defaultAuth;
1164
+ // Temporal posts this marker on a direct pod port-token fetch. The alias
1165
+ // proxy strips it, so webhook/playground tokens cannot present it.
1166
+ const platformTimerFireAuth = (request) => {
1167
+ if (request.headers.get("x-agent-serve-timed-work") === "1") {
1168
+ return {
1169
+ authenticator: "app",
1170
+ principalId: "agent-serve:timed-work",
1171
+ principalType: "runtime",
1172
+ };
1173
+ }
1174
+ return null;
1175
+ };
1176
+ // A v2 mount served under `--no-control-plane` is a hosted v2 guest: the
1177
+ // hosted control plane drives it through the hosted delivery route below.
1178
+ // Session HTTP is a control-plane surface, so such a guest mounts no
1179
+ // `/v1/session*` or `/v1/sessions` routes — session starts arrive as hosted
1180
+ // admissions (`agentsdk.session` on the built-in http channel) and session
1181
+ // reads come from the control plane's runs surface and durable storage.
1182
+ // Local dev, self-hosted serve, and hosted v1 keep the engine mounts.
1183
+ const hostedV2Guest = noControlPlane === true && isV2Project(project);
1184
+ if (hostedV2Guest) {
1185
+ registerHostedDeliveryRoute({
1186
+ router,
1187
+ base,
1188
+ // The built-in http channel is not in `project.channels`; the control
1189
+ // plane's session start (`agentsdk.session`) is delivered to it.
1190
+ channels: [...project.channels, { id: HTTP_CHANNEL_ID, definition: project.httpChannel }],
1191
+ buildHandlerArgs: (channelId, hostedSessionId) => buildChannelHandlerArgs({
1192
+ runtime,
1193
+ channelId,
1194
+ hostedSessionId,
1195
+ }),
1196
+ fireReminder: (reminderId, fireCount) => reminderRunner.dispatch(reminderId, { expectedFireCount: fireCount }),
1197
+ executeReminderDescriptor: async (descriptor) => {
1198
+ if (reminderControlPlane === undefined) {
1199
+ throw new Error("hosted reminder CP client is not configured");
1200
+ }
1201
+ const fireDescriptor = descriptor;
1202
+ const outcome = await reminderRunner.executeFire(fireDescriptor);
1203
+ // applyReminderOutcome is idempotent and internally retries transient
1204
+ // CP failures. Handler execution is at-least-once across Temporal
1205
+ // re-admission if apply ultimately fails.
1206
+ const apply = await reminderControlPlane.applyReminderOutcome(claimFromDescriptor(fireDescriptor), outcome);
1207
+ // Cancel/rekey winning the race is a successful no-op from the guest's
1208
+ // perspective (fired work may have run; lifecycle authority stayed CP).
1209
+ if (!apply.applied && apply.reason === "missing") {
1210
+ return {
1211
+ reminderId: descriptor.id,
1212
+ outcome: "noop",
1213
+ reason: apply.reason,
1214
+ };
1215
+ }
1216
+ return {
1217
+ reminderId: descriptor.id,
1218
+ outcome: "fired",
1219
+ };
1220
+ },
1221
+ fireSchedule: (scheduleId) => scheduleRunner.dispatch(scheduleId, { awaitCompletion: true }),
1222
+ drainSessionDurability: (sessionId) => engine.drainSessionDurability(sessionId),
1223
+ flushOtel: args.flushOtel,
1224
+ onSecretsReady: args.onSecretsReady,
1225
+ ...(args.diagStateRoot === undefined ? {} : { stateRoot: args.diagStateRoot }),
1226
+ ...(sessionRunLog === undefined
1227
+ ? {}
1228
+ : {
1229
+ persistSessionRun: async (document) => {
1230
+ await sessionRunLog.persist(document);
1231
+ },
1232
+ flushStartLog,
1233
+ }),
1234
+ snapshotLogs: () => logRing.since(),
1235
+ ...(args.evictSdkSession === undefined ? {} : { evictSdkSession: args.evictSdkSession }),
1236
+ startSend: hostedSendStart({ engine, projectRoot: project.rootDir, logger }),
1237
+ takeContinuationRelease: (continuationKey) => engine.takeContinuationRelease(continuationKey),
1238
+ });
1239
+ }
1240
+ // Playground lists/opens Slack (and other channel) sessions across
1241
+ // principals when `--dev` (loopback) or `--allow-anonymous` (trusted
1242
+ // shared host, e.g. corp Okta ALB). Never when bearer / custom channel
1243
+ // auth is set — those keep strict per-principal isolation.
1244
+ const relaxSessionReadAuth = args.authToken === undefined &&
1245
+ project.httpChannel.auth === undefined &&
1246
+ (dev || args.allowAnonymous === true);
1247
+ const relaxSessionReadAuthBeyondLoopback = args.allowAnonymous === true;
1248
+ // Separate from read-relax: playground Approve/Deny on Slack-owned parked
1249
+ // tools (Slack principals never match local/anonymous HTTP auth).
1250
+ const relaxSessionApprovalAuth = relaxSessionReadAuth;
1251
+ router.add({
1252
+ method: "GET",
1253
+ pattern: `${base}${mcpOauthServeCallbackPath()}`,
1254
+ auth: "none",
1255
+ handler: (request) => engine.oauthCallbackHub.handleCallback(request),
1256
+ });
1257
+ router.add({
1258
+ method: "GET",
1259
+ pattern: `${base}/v1/health`,
1260
+ auth: "none",
1261
+ // Temporal consumes this response before promoting a newly deployed pod.
1262
+ // Include the framework build there so deploy observability gets the
1263
+ // version from the process that will serve turns, with no second request.
1264
+ handler: () => jsonResponse({
1265
+ ok: true,
1266
+ name: project.name,
1267
+ version: packageVersion(),
1268
+ ...memoryHealthFields([engine]),
1269
+ }),
1270
+ });
1271
+ // TAS polls this after `/v1/health` and before the hosted POST. Auth none
1272
+ // mirrors health: the engine is reachable only through the anyrun port
1273
+ // proxy (network token) or the alias route.
1274
+ router.add({
1275
+ method: "GET",
1276
+ pattern: `${base}${GUEST_NETWORK_PATH}`,
1277
+ auth: "none",
1278
+ handler: () => guestNetworkReadinessResponse(),
1279
+ });
1280
+ // Bootstrap the SPA can't derive from its own URL (agent name, dev mode, and
1281
+ // — in multi-agent mode — where the agents index lives).
1282
+ router.add({
1283
+ method: "GET",
1284
+ pattern: `${base}/v1/meta`,
1285
+ auth: "none",
1286
+ handler: () => jsonResponse({
1287
+ name: project.name,
1288
+ dev,
1289
+ basePath: base,
1290
+ // Framework version, for SPA/engine skew observability now that the
1291
+ // hosted playground shell is served centrally (backend deploys)
1292
+ // while engines stay on their install-time version.
1293
+ version: packageVersion(),
1294
+ ...(multi ? { indexPath: "/" } : {}),
1295
+ }),
1296
+ });
1297
+ router.add({
1298
+ method: "GET",
1299
+ pattern: `${base}/v1/info`,
1300
+ auth: httpAuth,
1301
+ handler: () => jsonResponse(projectInfo(project)),
1302
+ });
1303
+ // Hosted-only: the control plane's provision flow reads the deploy manifest
1304
+ // from the running engine (same derivation as `july manifest`) right after
1305
+ // the health probe, so every deploy surface — CLI, UI, redeploy — gets its
1306
+ // declarations from the installed code without a client-side extraction
1307
+ // step. `auth: "none"` mirrors `/v1/health`: hosted engines are reachable
1308
+ // only through the anyrun port proxy (network token) or the alias route
1309
+ // (alias token), and the route is not registered outside hosted mode, so
1310
+ // self-hosted `july serve` never exposes the manifest unauthenticated.
1311
+ if (process.env[AGENT_SERVE_GENERATION_ENV_VAR] !== undefined) {
1312
+ router.add({
1313
+ method: "GET",
1314
+ pattern: `${base}/v1/manifest`,
1315
+ auth: "none",
1316
+ handler: async () => {
1317
+ const manifest = buildAgentDeployManifest(project);
1318
+ // A v2 release runs eval cases as its own sessions, so the control
1319
+ // plane lists them from the manifest it freezes.
1320
+ if (isV2Project(project)) {
1321
+ const evals = await hostedEvalCatalog(project.rootDir).catch((error) => {
1322
+ logger(`[bdk] eval discovery failed; release lists no evals: ${describeError(error)}`);
1323
+ return undefined;
1324
+ });
1325
+ manifest.info = { ...manifest.info, evals };
1326
+ }
1327
+ return jsonResponse(manifest);
1328
+ },
1329
+ });
1330
+ }
1331
+ // Playground Logs tab: recent ServeOptions.logger lines (channels, sessions,
1332
+ // webhook capture). `after` is an exclusive index cursor for polling.
1333
+ router.add({
1334
+ method: "GET",
1335
+ pattern: `${base}/v1/logs`,
1336
+ auth: httpAuth,
1337
+ handler: (request) => {
1338
+ const url = new URL(request.url);
1339
+ const afterRaw = url.searchParams.get("after");
1340
+ const after = afterRaw === null || afterRaw === "" ? -1 : Number.parseInt(afterRaw, 10);
1341
+ const cursor = Number.isFinite(after) ? after : -1;
1342
+ const entries = logRing.since(cursor);
1343
+ return jsonResponse({
1344
+ entries,
1345
+ nextAfter: entries.length === 0 ? cursor : (entries[entries.length - 1]?.index ?? cursor),
1346
+ });
1347
+ },
1348
+ });
1349
+ // Session list is session surface: not mounted on a hosted v2 guest (the
1350
+ // control plane owns session reads there; see hostedV2Guest above).
1351
+ if (!hostedV2Guest) {
1352
+ router.add({
1353
+ method: "GET",
1354
+ pattern: `${base}/v1/sessions`,
1355
+ auth: httpAuth,
1356
+ handler: async (request, ctx) => {
1357
+ // Same gate as requireSessionOwner / relaxSessionReadAuth: never with
1358
+ // bearer or custom channel auth (strict per-principal isolation).
1359
+ // `--allow-anonymous` alone is a shared-principal trust boundary (corp
1360
+ // Okta ALB); `--dev` alone stays loopback-only.
1361
+ const includeAll = relaxSessionReadAuth &&
1362
+ (relaxSessionReadAuthBeyondLoopback ||
1363
+ (typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
1364
+ // `?latest=1` returns only the newest visible session. Clients
1365
+ // binding a default session do not need the cost of a full listing.
1366
+ const latest = new URL(request.url).searchParams.get("latest");
1367
+ const listed = latest === "1" || latest === "true"
1368
+ ? await engine.latestSessionWithSource(ctx.auth, { includeAll })
1369
+ : await engine.listSessionsWithSource(ctx.auth, { includeAll });
1370
+ return jsonResponse({
1371
+ sessions: listed.sessions,
1372
+ source: listed.source,
1373
+ });
1374
+ },
1375
+ });
1376
+ }
1377
+ // Durable artifacts (ctx.artifacts / tag_artifact), newest-updated first.
1378
+ // Cursor-paginated: pass `pageToken` from the previous response's
1379
+ // `nextPageToken`. A page can be short (even empty) with a nextPageToken
1380
+ // when a sparse filter exhausted the per-call scan budget.
1381
+ router.add({
1382
+ method: "GET",
1383
+ pattern: `${base}/v1/artifacts`,
1384
+ auth: httpAuth,
1385
+ handler: async (request, ctx) => {
1386
+ const url = new URL(request.url);
1387
+ const limitRaw = url.searchParams.get("limit");
1388
+ let limit = ARTIFACTS_PAGE_DEFAULT_LIMIT;
1389
+ if (limitRaw !== null && limitRaw !== "") {
1390
+ const parsed = Number.parseInt(limitRaw, 10);
1391
+ if (!Number.isInteger(parsed) || parsed < 1) {
1392
+ return errorResponse(400, "invalid_request", "`limit` must be a positive integer.");
1393
+ }
1394
+ limit = Math.min(parsed, ARTIFACTS_PAGE_MAX_LIMIT);
1395
+ }
1396
+ const kind = url.searchParams.get("kind") ?? undefined;
1397
+ const sessionId = url.searchParams.get("sessionId") ?? undefined;
1398
+ const pageToken = url.searchParams.get("pageToken") ?? undefined;
1399
+ // Same includeAll gate as /v1/sessions: never with bearer or custom
1400
+ // channel auth (strict per-principal isolation); otherwise session
1401
+ // ownership applies (see SessionEngine.pageArtifacts).
1402
+ const includeAll = relaxSessionReadAuth &&
1403
+ (relaxSessionReadAuthBeyondLoopback ||
1404
+ (typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
1405
+ let page;
1406
+ try {
1407
+ page = await engine.pageArtifacts(ctx.auth, {
1408
+ includeAll,
1409
+ filter: { kind, sessionId },
1410
+ limit,
1411
+ cursor: pageToken,
1412
+ });
1413
+ }
1414
+ catch (error) {
1415
+ if (error instanceof InvalidArtifactCursorError) {
1416
+ return errorResponse(400, "invalid_request", "`pageToken` is not a valid page token.");
1417
+ }
1418
+ throw error;
1419
+ }
1420
+ return jsonResponse({
1421
+ artifacts: page.records,
1422
+ nextPageToken: page.nextCursor,
1423
+ });
1424
+ },
1425
+ });
1426
+ // File/blob payload of one artifact (`tag({ contents })`).
1427
+ router.add({
1428
+ method: "GET",
1429
+ pattern: `${base}/v1/artifacts/:id/content`,
1430
+ auth: httpAuth,
1431
+ handler: async (_request, ctx) => {
1432
+ const includeAll = relaxSessionReadAuth &&
1433
+ (relaxSessionReadAuthBeyondLoopback ||
1434
+ (typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
1435
+ const found = await engine.getArtifactContent(ctx.auth, ctx.params.id ?? "", { includeAll });
1436
+ if (found === undefined) {
1437
+ return errorResponse(404, "not_found", "No such artifact, or it carries no content.");
1438
+ }
1439
+ // A view over bytes is a valid fetch body; the DOM lib types are
1440
+ // narrower than the runtime.
1441
+ // contentType is author/model-controlled and the playground shares
1442
+ // this origin: force download, never render or sniff.
1443
+ return new Response(found.body, {
1444
+ headers: {
1445
+ "content-type": found.record.content?.contentType ?? "application/octet-stream",
1446
+ "content-disposition": "attachment",
1447
+ "x-content-type-options": "nosniff",
1448
+ },
1449
+ });
1450
+ },
1451
+ });
1452
+ // The agent's MCP surface: peers and external MCP clients delegate to
1453
+ // this agent (ask / check / call_tool) over streamable HTTP. Stateless —
1454
+ // POST only; GET/DELETE get a spec-compliant 405 from the endpoint.
1455
+ const mcpEndpoint = createAgentMcpEndpoint({ engine, logger });
1456
+ for (const method of ["POST", "GET", "DELETE"]) {
1457
+ router.add({
1458
+ method,
1459
+ pattern: `${base}${MCP_ENDPOINT_PATH}`,
1460
+ auth: httpAuth,
1461
+ handler: (request, ctx) => mcpEndpoint.handle(request, ctx.auth),
1462
+ });
1463
+ }
1464
+ const toolMcpEndpoint = createToolMcpEndpoint({ engine, logger });
1465
+ for (const method of ["POST", "GET", "DELETE"]) {
1466
+ router.add({
1467
+ method,
1468
+ pattern: `${base}${TOOL_MCP_ENDPOINT_PATH}`,
1469
+ auth: defaultAuth,
1470
+ handler: (request, ctx) => toolMcpEndpoint.handle(request, ctx.auth),
1471
+ });
1472
+ }
1473
+ // The live tool catalog: the session's tool namespace as a turn would
1474
+ // assemble it — authored server tools plus advertised MCP passthroughs —
1475
+ // under model-facing names. `/v1/info` stays the static authored
1476
+ // manifest; this is the runtime view only the running deployment can
1477
+ // answer. `session` / `continuationToken` query parameters bind the
1478
+ // listing to a session identity (advertised inventories can be
1479
+ // tenant-scoped and resolved per session).
1480
+ const resolveCatalogBinding = async (request, ctx) => {
1481
+ const url = new URL(request.url);
1482
+ const sessionId = url.searchParams.get("session") ?? undefined;
1483
+ const continuationToken = url.searchParams.get("continuationToken") ?? undefined;
1484
+ if (sessionId !== undefined) {
1485
+ const record = await engine.sessions.get(sessionId);
1486
+ if (record === undefined) {
1487
+ return {
1488
+ errorResponse: errorResponse(404, "session_not_found", `Unknown session ${sessionId}.`),
1489
+ };
1490
+ }
1491
+ const ownership = requireSessionOwner(record, ctx.auth, {
1492
+ relax: relaxSessionReadAuth,
1493
+ beyondLoopback: relaxSessionReadAuthBeyondLoopback,
1494
+ requestIp: ctx.requestIp,
1495
+ });
1496
+ if (ownership !== undefined) {
1497
+ return { errorResponse: ownership };
1498
+ }
1499
+ }
1500
+ return { sessionId, continuationToken };
1501
+ };
1502
+ router.add({
1503
+ method: "GET",
1504
+ pattern: `${base}/v1/tools`,
1505
+ auth: httpAuth,
1506
+ handler: async (request, ctx) => {
1507
+ const binding = await resolveCatalogBinding(request, ctx);
1508
+ if ("errorResponse" in binding) {
1509
+ return binding.errorResponse;
1510
+ }
1511
+ try {
1512
+ const catalog = await engine.listCatalogTools({
1513
+ auth: ctx.auth,
1514
+ ...binding,
1515
+ });
1516
+ return jsonResponse({
1517
+ tools: catalog.tools.map(catalogListEntry),
1518
+ // JSON.stringify drops the key when there is nothing to report.
1519
+ connectionErrors: catalog.connectionErrors.length === 0 ? undefined : catalog.connectionErrors,
1520
+ });
1521
+ }
1522
+ catch (error) {
1523
+ if (error instanceof InvalidContinuationTokenError) {
1524
+ return errorResponse(400, "invalid_continuation_token", error.message);
1525
+ }
1526
+ throw error;
1527
+ }
1528
+ },
1529
+ });
1530
+ router.add({
1531
+ method: "GET",
1532
+ pattern: `${base}/v1/tools/:toolName`,
1533
+ auth: httpAuth,
1534
+ handler: async (request, ctx) => {
1535
+ const toolName = ctx.params.toolName ?? "";
1536
+ const binding = await resolveCatalogBinding(request, ctx);
1537
+ if ("errorResponse" in binding) {
1538
+ return binding.errorResponse;
1539
+ }
1540
+ try {
1541
+ const described = await engine.describeCatalogTool(toolName, {
1542
+ auth: ctx.auth,
1543
+ ...binding,
1544
+ });
1545
+ if (described.tool === undefined) {
1546
+ return jsonResponse({
1547
+ ok: false,
1548
+ error: "unknown_tool",
1549
+ message: `Unknown tool "${toolName}".`,
1550
+ availableTools: described.availableTools,
1551
+ }, { status: 404 });
1552
+ }
1553
+ return jsonResponse(catalogDetailEntry(described.tool));
1554
+ }
1555
+ catch (error) {
1556
+ if (error instanceof InvalidContinuationTokenError) {
1557
+ return errorResponse(400, "invalid_continuation_token", error.message);
1558
+ }
1559
+ throw error;
1560
+ }
1561
+ },
1562
+ });
1563
+ // Deterministic tool invocation: run an authored server tool directly,
1564
+ // without a model turn deciding to call it.
1565
+ router.add({
1566
+ method: "POST",
1567
+ pattern: `${base}/v1/tools/:toolName`,
1568
+ auth: httpAuth,
1569
+ handler: async (request, ctx) => {
1570
+ const toolName = ctx.params.toolName ?? "";
1571
+ const body = await readJsonObject(request);
1572
+ if (body === undefined) {
1573
+ return errorResponse(400, "invalid_request", 'Expected a JSON object body, e.g. {"input": {...}}.');
1574
+ }
1575
+ if (body.sessionId !== undefined && typeof body.sessionId !== "string") {
1576
+ return errorResponse(400, "invalid_request", "`sessionId` must be a string when provided.");
1577
+ }
1578
+ if (body.continuationToken !== undefined && typeof body.continuationToken !== "string") {
1579
+ return errorResponse(400, "invalid_request", "`continuationToken` must be a string when provided.");
1580
+ }
1581
+ const continuationToken = body.continuationToken;
1582
+ const sessionId = body.sessionId;
1583
+ if (sessionId !== undefined) {
1584
+ const record = await engine.sessions.get(sessionId);
1585
+ if (record === undefined) {
1586
+ return errorResponse(404, "session_not_found", `Unknown session ${sessionId}.`);
1587
+ }
1588
+ const ownership = requireSessionOwner(record, ctx.auth, {
1589
+ relax: relaxSessionReadAuth,
1590
+ beyondLoopback: relaxSessionReadAuthBeyondLoopback,
1591
+ requestIp: ctx.requestIp,
1592
+ });
1593
+ if (ownership !== undefined) {
1594
+ return ownership;
1595
+ }
1596
+ }
1597
+ try {
1598
+ const outcome = await engine.callTool(toolName, body.input ?? {}, {
1599
+ auth: ctx.auth,
1600
+ sessionId,
1601
+ continuationToken,
1602
+ });
1603
+ return jsonResponse({ ok: !outcome.isError, ...outcome });
1604
+ }
1605
+ catch (error) {
1606
+ if (error instanceof UnknownToolError) {
1607
+ return jsonResponse({
1608
+ ok: false,
1609
+ error: "unknown_tool",
1610
+ message: error.message,
1611
+ availableTools: error.availableToolNames,
1612
+ }, { status: 404 });
1613
+ }
1614
+ if (error instanceof ToolNotDirectlyCallableError) {
1615
+ return errorResponse(400, "tool_not_callable", error.message);
1616
+ }
1617
+ if (error instanceof ToolInputError) {
1618
+ return errorResponse(400, "invalid_tool_input", error.message);
1619
+ }
1620
+ if (error instanceof InvalidContinuationTokenError) {
1621
+ return errorResponse(400, "invalid_continuation_token", error.message);
1622
+ }
1623
+ if (error instanceof WorkspaceUnavailableError) {
1624
+ return errorResponse(500, "workspace_unavailable", error.message);
1625
+ }
1626
+ throw error;
1627
+ }
1628
+ },
1629
+ });
1630
+ // Deterministic skill reads: the body the harness would receive, plus
1631
+ // resolved sibling files. Read-only, so plain GETs with no session binding.
1632
+ router.add({
1633
+ method: "GET",
1634
+ pattern: `${base}/v1/skills`,
1635
+ auth: httpAuth,
1636
+ handler: async () => jsonResponse({
1637
+ skills: project.agent.skills.map(skillListEntry),
1638
+ }),
1639
+ });
1640
+ router.add({
1641
+ method: "GET",
1642
+ pattern: `${base}/v1/skills/:skillName`,
1643
+ auth: httpAuth,
1644
+ handler: async (_request, ctx) => {
1645
+ const skillName = ctx.params.skillName ?? "";
1646
+ try {
1647
+ return jsonResponse(await readSkillDetail(project.agent.skills, skillName));
1648
+ }
1649
+ catch (error) {
1650
+ if (error instanceof UnknownSkillError) {
1651
+ return jsonResponse({
1652
+ ok: false,
1653
+ error: "unknown_skill",
1654
+ message: error.message,
1655
+ availableSkills: error.availableSkillNames,
1656
+ }, { status: 404 });
1657
+ }
1658
+ throw error;
1659
+ }
1660
+ },
1661
+ });
1662
+ if (playground) {
1663
+ // Serve the built Vite SPA. `<base href>` is injected so the SPA's relative
1664
+ // asset URLs resolve under this mount regardless of the trailing slash the
1665
+ // browser lands on. Render per request so a mid-run `build:playground`
1666
+ // is picked up without restarting. In dev, run `pnpm run dev:playground`
1667
+ // (Vite + HMR) instead; it proxies `/v1` here.
1668
+ router.add({
1669
+ method: "GET",
1670
+ pattern: `${base}/playground`,
1671
+ auth: "none",
1672
+ handler: () => new Response(renderPlaygroundIndexHtml(`${base}/playground/`), {
1673
+ headers: { "content-type": "text/html; charset=utf-8" },
1674
+ }),
1675
+ });
1676
+ router.add({
1677
+ method: "GET",
1678
+ pattern: `${base}/playground/assets/:file`,
1679
+ auth: "none",
1680
+ handler: (_request, ctx) => renderPlaygroundAsset(ctx.params.file ?? ""),
1681
+ });
1682
+ }
1683
+ // The built-in HTTP session channel (`/v1/session*`, including the
1684
+ // session-scoped approvals/auths routes) is session surface: not mounted on
1685
+ // a hosted v2 guest (see hostedV2Guest above). The `http` channel itself
1686
+ // stays registered with the hosted delivery route, which is how the control
1687
+ // plane's session starts reach it.
1688
+ if (!hostedV2Guest) {
1689
+ for (const route of buildHttpChannelRoutes({
1690
+ engine,
1691
+ config: project.httpChannel,
1692
+ auth: httpAuth,
1693
+ basePath: base,
1694
+ // Dev playground lists every session (`includeAll`); allow opening them
1695
+ // (see relaxSessionReadAuth above).
1696
+ relaxSessionReadAuth,
1697
+ relaxSessionReadAuthBeyondLoopback,
1698
+ relaxSessionApprovalAuth,
1699
+ })) {
1700
+ router.add(route);
1701
+ }
1702
+ }
1703
+ // Playground eval list/run — available without `--dev` (corp / allow-anonymous).
1704
+ // Schedule/reminder hand-dispatch stays `--dev` only below.
1705
+ router.add({
1706
+ method: "GET",
1707
+ pattern: `${base}/v1/dev/evals`,
1708
+ auth: httpAuth,
1709
+ handler: async () => jsonResponse(await runtime.evalRuns.list()),
1710
+ });
1711
+ router.add({
1712
+ method: "GET",
1713
+ pattern: `${base}/v1/dev/evals/runs`,
1714
+ auth: httpAuth,
1715
+ handler: async () => {
1716
+ return jsonResponse(await runtime.evalRuns.listRunsWithActive());
1717
+ },
1718
+ });
1719
+ router.add({
1720
+ method: "POST",
1721
+ pattern: `${base}/v1/dev/evals/runs`,
1722
+ auth: httpAuth,
1723
+ handler: async (request) => {
1724
+ const body = await readJsonObject(request);
1725
+ const filterIds = asStringArray(body?.filterIds);
1726
+ const tags = asStringArray(body?.tags);
1727
+ const timeoutMs = asPositiveInt(body?.timeoutMs);
1728
+ const verbose = body?.verbose === true;
1729
+ const authHeader = request.headers.get("authorization");
1730
+ const bearerToken = authHeader?.toLowerCase().startsWith("bearer ")
1731
+ ? authHeader.slice("bearer ".length).trim()
1732
+ : undefined;
1733
+ try {
1734
+ const snap = await runtime.evalRuns.start({
1735
+ ...(filterIds === undefined ? {} : { filterIds }),
1736
+ ...(tags === undefined ? {} : { tags }),
1737
+ ...(bearerToken === undefined || bearerToken === "" ? {} : { bearerToken }),
1738
+ ...(timeoutMs === undefined ? {} : { timeoutMs }),
1739
+ ...(verbose ? { verbose: true } : {}),
1740
+ });
1741
+ return jsonResponse(snap, { status: 202 });
1742
+ }
1743
+ catch (error) {
1744
+ if (error instanceof EvalRunConflictError) {
1745
+ return jsonResponse({
1746
+ ok: false,
1747
+ error: "eval_run_in_progress",
1748
+ activeRunId: error.activeRunId,
1749
+ }, { status: 409 });
1750
+ }
1751
+ if (error instanceof EvalRunEmptyError) {
1752
+ return jsonResponse({ ok: false, error: "no_matching_evals" }, { status: 404 });
1753
+ }
1754
+ const message = error instanceof Error ? error.message : String(error);
1755
+ return jsonResponse({ ok: false, error: "eval_start_failed", message }, { status: 400 });
1756
+ }
1757
+ },
1758
+ });
1759
+ router.add({
1760
+ method: "GET",
1761
+ pattern: `${base}/v1/dev/evals/runs/:runId`,
1762
+ auth: httpAuth,
1763
+ handler: async (_request, ctx) => {
1764
+ const runId = ctx.params.runId ?? "";
1765
+ const snap = await runtime.evalRuns.get(runId);
1766
+ if (snap === undefined) {
1767
+ return jsonResponse({ ok: false, error: "unknown_eval_run" }, { status: 404 });
1768
+ }
1769
+ return jsonResponse(snap);
1770
+ },
1771
+ });
1772
+ router.add({
1773
+ method: "POST",
1774
+ pattern: `${base}/v1/dev/evals/runs/:runId/cancel`,
1775
+ auth: httpAuth,
1776
+ handler: async (_request, ctx) => {
1777
+ const runId = ctx.params.runId ?? "";
1778
+ try {
1779
+ const snap = await runtime.evalRuns.cancel(runId);
1780
+ return jsonResponse(snap);
1781
+ }
1782
+ catch (error) {
1783
+ if (error instanceof EvalRunUnknownError) {
1784
+ return jsonResponse({ ok: false, error: "unknown_eval_run" }, { status: 404 });
1785
+ }
1786
+ if (error instanceof EvalRunNotRunningError) {
1787
+ return jsonResponse({
1788
+ ok: false,
1789
+ error: "eval_run_not_running",
1790
+ runId: error.runId,
1791
+ status: error.status,
1792
+ message: error.message,
1793
+ }, { status: 409 });
1794
+ }
1795
+ const message = error instanceof Error ? error.message : String(error);
1796
+ return jsonResponse({ ok: false, error: "eval_cancel_failed", message }, { status: 400 });
1797
+ }
1798
+ },
1799
+ });
1800
+ if (noControlPlane === true) {
1801
+ router.add({
1802
+ method: "POST",
1803
+ pattern: `${base}/v1/internal/schedules/:scheduleId/fire`,
1804
+ auth: [platformTimerFireAuth],
1805
+ handler: async (_request, ctx) => {
1806
+ const scheduleId = ctx.params.scheduleId ?? "";
1807
+ try {
1808
+ const { sessionIds } = await scheduleRunner.dispatch(scheduleId);
1809
+ return jsonResponse({ scheduleId, sessionIds });
1810
+ }
1811
+ catch (error) {
1812
+ if (error instanceof UnknownScheduleError) {
1813
+ return jsonResponse({
1814
+ ok: false,
1815
+ error: "unknown_schedule",
1816
+ availableScheduleIds: error.availableScheduleIds,
1817
+ }, { status: 404 });
1818
+ }
1819
+ throw error;
1820
+ }
1821
+ },
1822
+ });
1823
+ router.add({
1824
+ method: "POST",
1825
+ pattern: `${base}/v1/internal/reminders/:reminderId/fire`,
1826
+ auth: [platformTimerFireAuth],
1827
+ handler: async (request, ctx) => {
1828
+ const reminderId = ctx.params.reminderId ?? "";
1829
+ const fireCountRaw = new URL(request.url).searchParams.get("fireCount");
1830
+ const expectedFireCount = fireCountRaw === null ? undefined : Number(fireCountRaw);
1831
+ try {
1832
+ const result = await reminderRunner.dispatch(reminderId, expectedFireCount !== undefined && Number.isInteger(expectedFireCount)
1833
+ ? { expectedFireCount }
1834
+ : {});
1835
+ return jsonResponse(result);
1836
+ }
1837
+ catch (error) {
1838
+ if (error instanceof UnknownReminderError) {
1839
+ return jsonResponse({
1840
+ ok: false,
1841
+ error: "unknown_reminder",
1842
+ availableReminderIds: error.availableReminderIds,
1843
+ }, { status: 404 });
1844
+ }
1845
+ if (error instanceof ReminderValidationError) {
1846
+ return jsonResponse({ ok: false, error: "invalid_reminder", message: error.message }, { status: 400 });
1847
+ }
1848
+ throw error;
1849
+ }
1850
+ },
1851
+ });
1852
+ }
1853
+ if (dev) {
1854
+ router.add({
1855
+ method: "POST",
1856
+ pattern: `${base}/v1/dev/schedules/:scheduleId`,
1857
+ auth: httpAuth,
1858
+ handler: async (_request, ctx) => {
1859
+ const scheduleId = ctx.params.scheduleId ?? "";
1860
+ try {
1861
+ const { sessionIds } = await scheduleRunner.dispatch(scheduleId);
1862
+ return jsonResponse({ scheduleId, sessionIds });
1863
+ }
1864
+ catch (error) {
1865
+ if (error instanceof UnknownScheduleError) {
1866
+ return jsonResponse({
1867
+ ok: false,
1868
+ error: "unknown_schedule",
1869
+ availableScheduleIds: error.availableScheduleIds,
1870
+ }, { status: 404 });
1871
+ }
1872
+ throw error;
1873
+ }
1874
+ },
1875
+ });
1876
+ router.add({
1877
+ method: "POST",
1878
+ pattern: `${base}/v1/dev/reminders/:reminderId`,
1879
+ auth: httpAuth,
1880
+ handler: async (_request, ctx) => {
1881
+ const reminderId = ctx.params.reminderId ?? "";
1882
+ try {
1883
+ const listed = await reminderRunner.list();
1884
+ const reminder = listed.find((r) => r.id === reminderId);
1885
+ if (reminder === undefined) {
1886
+ const ids = listed.map((r) => r.id);
1887
+ throw new UnknownReminderError(reminderId, ids);
1888
+ }
1889
+ const ownership = await assertReminderReadable({
1890
+ engine,
1891
+ reminder,
1892
+ auth: ctx.auth,
1893
+ requestIp: ctx.requestIp,
1894
+ relax: relaxSessionReadAuth,
1895
+ beyondLoopback: relaxSessionReadAuthBeyondLoopback,
1896
+ });
1897
+ if (ownership !== undefined) {
1898
+ return ownership;
1899
+ }
1900
+ const result = await reminderRunner.dispatch(reminderId);
1901
+ return jsonResponse(result);
1902
+ }
1903
+ catch (error) {
1904
+ if (error instanceof UnknownReminderError) {
1905
+ return jsonResponse({
1906
+ ok: false,
1907
+ error: "unknown_reminder",
1908
+ availableReminderIds: error.availableReminderIds,
1909
+ }, { status: 404 });
1910
+ }
1911
+ if (error instanceof ReminderValidationError) {
1912
+ return jsonResponse({ ok: false, error: "invalid_reminder", message: error.message }, { status: 400 });
1913
+ }
1914
+ throw error;
1915
+ }
1916
+ },
1917
+ });
1918
+ router.add({
1919
+ method: "GET",
1920
+ pattern: `${base}/v1/dev/reminders`,
1921
+ auth: httpAuth,
1922
+ handler: async (_request, ctx) => {
1923
+ const all = await reminderRunner.list();
1924
+ const reminders = [];
1925
+ for (const reminder of all) {
1926
+ const denied = await assertReminderReadable({
1927
+ engine,
1928
+ reminder,
1929
+ auth: ctx.auth,
1930
+ requestIp: ctx.requestIp,
1931
+ relax: relaxSessionReadAuth,
1932
+ beyondLoopback: relaxSessionReadAuthBeyondLoopback,
1933
+ });
1934
+ if (denied === undefined) {
1935
+ reminders.push(reminder);
1936
+ }
1937
+ }
1938
+ return jsonResponse({ reminders });
1939
+ },
1940
+ });
1941
+ }
1942
+ for (const channel of project.channels) {
1943
+ const channelAuth = channel.definition.auth ?? defaultAuth;
1944
+ for (const channelRoute of channel.definition.routes ?? []) {
1945
+ router.add({
1946
+ method: channelRoute.method,
1947
+ pattern: `${base}/v1/channels/${channel.id}${channelRoute.path}`,
1948
+ auth: channelAuth,
1949
+ handler: (request, ctx) => invokeChannelRoute({
1950
+ route: channelRoute,
1951
+ request,
1952
+ handlerArgs: buildChannelHandlerArgs({
1953
+ runtime,
1954
+ channelId: channel.id,
1955
+ params: ctx.params,
1956
+ requestIp: ctx.requestIp,
1957
+ auth: ctx.auth,
1958
+ }),
1959
+ }),
1960
+ });
1961
+ }
1962
+ }
1963
+ }
1964
+ /**
1965
+ * `cursorEvents` (`--cursor-events`) long-polls `/v0/scm-events` as the host's
1966
+ * Cursor user, so a signed-out host has no way to receive deliveries. Fail the
1967
+ * serve instead of starting with a relay that could never run.
1968
+ */
1969
+ function requireCursorEventsAuth(config, accountKey) {
1970
+ const apiKey = (config.apiKey ?? accountKey?.apiKey ?? "").trim();
1971
+ if (apiKey === "") {
1972
+ throw new Error(`[bdk] --cursor-events (serve({ cursorEvents })) requires a signed-in Cursor account: the SCM event stream is read as the host's user. ${SIGN_IN_HINT}`);
1973
+ }
1974
+ return {
1975
+ apiKey,
1976
+ // `/v0/scm-events/*` lives on the external API (api.cursor.com), not
1977
+ // api2. Prefer that default over the account key's backendUrl, which
1978
+ // follows cursorBackendUrl() (api2) when CURSOR_API_KEY is set.
1979
+ baseUrl: config.baseUrl ?? cursorExternalApiUrl(),
1980
+ };
1981
+ }
1982
+ /**
1983
+ * Opt-in Cursor SCM events relay. Credentials are already required by
1984
+ * {@link requireCursorEventsAuth}; the remaining unusable configs (no repos,
1985
+ * no github/origin channel) warn and leave the relay off — serve still starts.
1986
+ *
1987
+ * GitHub and Origin subscriptions are registered independently so mirrored
1988
+ * `owner/name` slugs do not mix. `--cursor-events --repo` feeds GitHub
1989
+ * channels; Origin is subscribed only when an `originChannel({ cursorAccount })`
1990
+ * opted in.
1991
+ */
1992
+ function collectCursorEventSubscriptions(input) {
1993
+ const githubTargets = findGitHubChannelTargets(input.mounts);
1994
+ const originTargets = findOriginChannelTargets(input.mounts);
1995
+ const githubEvents = [...new Set(githubTargets.flatMap((target) => target.events))];
1996
+ const originEvents = [...new Set(originTargets.flatMap((target) => target.events))];
1997
+ const githubRepos = [
1998
+ ...new Set(input.githubRepos.map((repo) => repo.trim().toLowerCase())),
1999
+ ].filter((repo) => repo.length > 0);
2000
+ const originRepos = [
2001
+ ...new Set(input.originRepos.map((repo) => repo.trim().toLowerCase())),
2002
+ ].filter((repo) => repo.length > 0);
2003
+ const subscriptions = [];
2004
+ if (githubEvents.length > 0 && githubRepos.length > 0) {
2005
+ for (const repo of githubRepos) {
2006
+ subscriptions.push({
2007
+ provider: "github",
2008
+ repo,
2009
+ events: githubEvents,
2010
+ });
2011
+ }
2012
+ }
2013
+ if (originEvents.length > 0 && originRepos.length > 0) {
2014
+ for (const repo of originRepos) {
2015
+ subscriptions.push({
2016
+ provider: "origin",
2017
+ repo,
2018
+ events: originEvents,
2019
+ });
2020
+ }
2021
+ }
2022
+ return subscriptions;
2023
+ }
2024
+ /**
2025
+ * Local CP + `--cursor-events` + both architectures would start two
2026
+ * consumers (different offset dirs). Refuse that at serve start.
2027
+ * `--no-control-plane` is one July consumer — hosted CP owns v2.
2028
+ */
2029
+ function assertSingleCursorEventsLane(input) {
2030
+ if (input.noControlPlane || input.config === undefined || input.auth === undefined) {
2031
+ return;
2032
+ }
2033
+ const shared = {
2034
+ githubRepos: input.githubRepos,
2035
+ originRepos: input.originRepos,
2036
+ };
2037
+ if (collectCursorEventSubscriptions({ mounts: input.v1Mounts, ...shared }).length === 0 ||
2038
+ collectCursorEventSubscriptions({ mounts: input.v2Mounts, ...shared }).length === 0) {
2039
+ return;
2040
+ }
2041
+ throw new Error("[bdk] cursor-events: refusing to serve v1 and v2 github/origin agents in one process — they would open two /v0/scm-events consumers. Serve one architecture per process.");
2042
+ }
2043
+ function startCursorEventRelay(input) {
2044
+ const { config, stateRoot, mounts, auth, logger } = input;
2045
+ if (config === undefined || auth === undefined) {
2046
+ return undefined;
2047
+ }
2048
+ const subscriptions = collectCursorEventSubscriptions({
2049
+ mounts,
2050
+ githubRepos: input.githubRepos,
2051
+ originRepos: input.originRepos,
2052
+ });
2053
+ if (subscriptions.length === 0) {
2054
+ if (input.lane === "engine" && input.skippedV2 === true) {
2055
+ logger("[bdk] cursor-events: no v1 github/origin targets; v2 ingest is control-plane only");
2056
+ }
2057
+ else if (input.lane === "control-plane") {
2058
+ return undefined;
2059
+ }
2060
+ else if (input.githubRepos.every((repo) => repo.trim() === "") &&
2061
+ input.originRepos.every((repo) => repo.trim() === "")) {
2062
+ logger("[bdk] cursor-events: no repos configured (pass --repo owner/name); relay disabled");
2063
+ }
2064
+ else {
2065
+ logger("[bdk] cursor-events: no mounted agent declares a github or origin channel; relay disabled");
2066
+ }
2067
+ return undefined;
2068
+ }
2069
+ const baseStateRoot = stateRoot ?? join(mounts[0]?.project.rootDir ?? process.cwd(), ".agent-serve");
2070
+ const relay = new CursorEventRelay({
2071
+ baseUrl: auth.baseUrl,
2072
+ apiKey: auth.apiKey,
2073
+ subscriptions,
2074
+ stateDir: join(baseStateRoot, input.stateDirName ?? "cursor-events"),
2075
+ logger,
2076
+ dispatch: async (event) => {
2077
+ if (event.provider === "origin") {
2078
+ const targets = input.collectOriginTargets().filter((target) => {
2079
+ const cursorAccount = target.options.cursorAccount;
2080
+ if (input.cursorAccountOnly &&
2081
+ cursorAccount !== true &&
2082
+ typeof cursorAccount !== "object") {
2083
+ return false;
2084
+ }
2085
+ return typeof cursorAccount !== "object"
2086
+ ? true
2087
+ : cursorAccount.repos.some((repo) => repo.toLowerCase() === event.repo.toLowerCase());
2088
+ });
2089
+ const result = await handleAgentServeTrigger({
2090
+ type: "origin",
2091
+ bodyText: JSON.stringify(scmMetadataToOriginPayload(event)),
2092
+ targets,
2093
+ ...(input.routeContinuation === undefined
2094
+ ? {}
2095
+ : { routeContinuation: input.routeContinuation }),
2096
+ });
2097
+ logCursorScmDispatch(logger, event, result);
2098
+ return;
2099
+ }
2100
+ if (event.provider !== "github")
2101
+ return;
2102
+ const targets = input.collectGitHubTargets().filter((target) => {
2103
+ const cursorAccount = target.options.cursorAccount;
2104
+ if (input.cursorAccountOnly &&
2105
+ cursorAccount !== true &&
2106
+ typeof cursorAccount !== "object") {
2107
+ return false;
2108
+ }
2109
+ return typeof cursorAccount !== "object"
2110
+ ? true
2111
+ : cursorAccount.repos.some((repo) => repo.toLowerCase() === event.repo.toLowerCase());
2112
+ });
2113
+ const result = await handleAgentServeTrigger({
2114
+ type: "github",
2115
+ bodyText: JSON.stringify(scmEventToGitHubPayload(event)),
2116
+ eventName: event.eventName,
2117
+ deliveryId: event.deliveryId,
2118
+ targets,
2119
+ ...(input.routeContinuation === undefined
2120
+ ? {}
2121
+ : { routeContinuation: input.routeContinuation }),
2122
+ });
2123
+ logCursorScmDispatch(logger, event, result);
2124
+ },
2125
+ });
2126
+ if (input.start === false) {
2127
+ return relay;
2128
+ }
2129
+ relay.start();
2130
+ logger(`[bdk] cursor-events: relaying ${subscriptions.length} subscription(s) from ${auth.baseUrl}`);
2131
+ return relay;
2132
+ }
2133
+ function logCursorScmDispatch(logger, event, result) {
2134
+ const outcomes = result.targets
2135
+ .map((target) => formatCursorScmDispatchOutcome(target))
2136
+ .join(", ");
2137
+ const rejected = result.targets.filter((target) => target.status >= 400);
2138
+ if (rejected.length > 0) {
2139
+ logger(`[bdk] cursor-events: dropped ${formatCursorScmEventLog(event)} before hook: ${rejected.map(formatCursorScmDispatchOutcome).join(", ")}`);
2140
+ }
2141
+ logger(`[bdk] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`);
2142
+ }
2143
+ function collectCursorGithubTargets(mounts) {
2144
+ const targets = [];
2145
+ for (const mount of mounts) {
2146
+ for (const channel of mount.project.channels) {
2147
+ const accountRuntime = getGithubCursorAccountRuntime(channel.definition);
2148
+ if (accountRuntime !== undefined) {
2149
+ targets.push({
2150
+ slug: mount.slug,
2151
+ channelId: channel.id,
2152
+ accountRuntime,
2153
+ });
2154
+ }
2155
+ }
2156
+ }
2157
+ return targets;
2158
+ }
2159
+ function cursorGithubPermissionsForTarget(target) {
2160
+ const authored = typeof target.accountRuntime.options.cursorAccount === "object"
2161
+ ? target.accountRuntime.options.cursorAccount.permissions
2162
+ : undefined;
2163
+ return (target.accountRuntime.scope?.permissions ??
2164
+ cursorGithubPermissionsForChannel(target.accountRuntime.options, authored));
2165
+ }
2166
+ function resolveCursorGithubEventConfig(input) {
2167
+ if (input.targets.length === 0) {
2168
+ return {
2169
+ cursorEvents: input.configured,
2170
+ scope: undefined,
2171
+ permissions: "pr-write",
2172
+ };
2173
+ }
2174
+ const repos = [
2175
+ ...(input.configured?.repos ?? []),
2176
+ ...input.targets.flatMap((target) => [...(target.accountRuntime.scope?.repos ?? [])]),
2177
+ ];
2178
+ const permissions = resolveCursorGithubPermissions(input.targets.map(cursorGithubPermissionsForTarget));
2179
+ const scope = resolveCursorGithubCredentialScope(repos, permissions);
2180
+ if (scope === undefined) {
2181
+ return {
2182
+ cursorEvents: input.configured,
2183
+ scope: undefined,
2184
+ permissions,
2185
+ };
2186
+ }
2187
+ return {
2188
+ cursorEvents: {
2189
+ ...input.configured,
2190
+ repos: [...scope.repos],
2191
+ },
2192
+ scope,
2193
+ permissions,
2194
+ };
2195
+ }
2196
+ function collectCursorOriginTargets(mounts) {
2197
+ const targets = [];
2198
+ for (const mount of mounts) {
2199
+ for (const channel of mount.project.channels) {
2200
+ const accountRuntime = getOriginCursorAccountRuntime(channel.definition);
2201
+ if (accountRuntime !== undefined) {
2202
+ targets.push({
2203
+ slug: mount.slug,
2204
+ channelId: channel.id,
2205
+ accountRuntime,
2206
+ });
2207
+ }
2208
+ }
2209
+ }
2210
+ return targets;
2211
+ }
2212
+ /**
2213
+ * Origin cursorAccount repos. `true` takes the host's explicit `--repo`
2214
+ * list (not GitHub channel-declared repos). `{ repos }` is self-contained.
2215
+ */
2216
+ function resolveCursorOriginRepoScope(input) {
2217
+ if (input.targets.length === 0) {
2218
+ return undefined;
2219
+ }
2220
+ const wantsHostRepos = input.targets.some((target) => target.accountRuntime.options.cursorAccount === true);
2221
+ const repos = [
2222
+ ...(wantsHostRepos ? input.explicitRepos : []),
2223
+ ...input.targets.flatMap((target) => target.accountRuntime.scope?.repos ?? []),
2224
+ ];
2225
+ if (repos.length === 0) {
2226
+ return undefined;
2227
+ }
2228
+ return parseCursorOriginRepoScope(repos);
2229
+ }
2230
+ function buildAgentIndexEntries(runtimes) {
2231
+ return runtimes.map(({ slug, project }) => {
2232
+ const hasSlack = project.channels.some((channel) => channel.definition.meta?.kind === "slack");
2233
+ return {
2234
+ slug,
2235
+ name: project.name,
2236
+ model: typeof project.agent.model === "string"
2237
+ ? project.agent.model
2238
+ : (project.agent.model?.id ?? ""),
2239
+ tools: project.agent.tools.length,
2240
+ channels: project.channels.length + 1,
2241
+ slack: hasSlack ? { kind: "socket" } : undefined,
2242
+ };
2243
+ });
2244
+ }
2245
+ /** Every mounted `deploymentsChannel`. Subscriptions are re-resolved live. */
2246
+ function collectCursorDeploymentTargets(runtimes) {
2247
+ const targets = [];
2248
+ for (const runtime of runtimes) {
2249
+ for (const channel of runtime.project.channels) {
2250
+ const options = getDeploymentsChannelOptions(channel.definition);
2251
+ if (options === undefined) {
2252
+ continue;
2253
+ }
2254
+ targets.push({
2255
+ runtime,
2256
+ channelId: channel.id,
2257
+ options,
2258
+ });
2259
+ }
2260
+ }
2261
+ return targets;
2262
+ }
2263
+ function liveDeploymentSubscriptionUnion(targets) {
2264
+ return mergeResolvedSubscriptions(targets.map((target) => resolveDeploymentSubscriptions(target.options)));
2265
+ }
2266
+ /**
2267
+ * Cursor deployment-events relay: automatic when a mounted agent authored
2268
+ * `deploymentsChannel({ ... })`. One relay per process reads
2269
+ * `/v0/deployment-events` for the union of every channel's deploy sources, and
2270
+ * each event is routed to the channels that asked for it — the same ownership
2271
+ * `startCursorEventRelay` has.
2272
+ */
2273
+ function startCursorDeploymentRelay(input) {
2274
+ const { options, runtimes, accountKey, logger } = input;
2275
+ const targets = collectCursorDeploymentTargets(runtimes);
2276
+ if (targets.length === 0) {
2277
+ return undefined;
2278
+ }
2279
+ if (accountKey === undefined) {
2280
+ if (input.options.allowAnonymous === true) {
2281
+ logger("[bdk] deployment-events: skipped while unsigned; long-poll relays need a key at start");
2282
+ return undefined;
2283
+ }
2284
+ throw new Error(`This project has channels subscribed to deployment events (deploymentsChannel({ ... })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
2285
+ }
2286
+ // Union is re-resolved on each heartbeat and fan-out so a channel that
2287
+ // fills `deploySourceUris` after start registers the new URIs. This wire
2288
+ // names every source, so a channel that omits the option registers nothing.
2289
+ const initial = liveDeploymentSubscriptionUnion(targets);
2290
+ if (initial.length === 0) {
2291
+ logger(`[bdk] deployment-events: no deploy sources yet on ${targets
2292
+ .map((target) => `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`)
2293
+ .join(", ")}; the relay will register when a channel lists some`);
2294
+ }
2295
+ // Same host split as scm-events: `/v0/deployment-events/*` is on
2296
+ // api.cursor.com, not api2.
2297
+ const baseStateRoot = options.stateRoot ?? join(targets[0].runtime.project.rootDir, ".agent-serve");
2298
+ const relay = new DeploymentEventRelay({
2299
+ baseUrl: cursorExternalApiUrl(),
2300
+ apiKey: accountKey.apiKey,
2301
+ stateDir: join(baseStateRoot, "deployment-events"),
2302
+ subscriptions: () => liveDeploymentSubscriptionUnion(targets),
2303
+ logger,
2304
+ dispatch: async (event) => fanOutDeploymentEvent({
2305
+ event,
2306
+ logger,
2307
+ targets: targets.map((target) => ({
2308
+ name: `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`,
2309
+ subscriptions: resolveDeploymentSubscriptions(target.options),
2310
+ deliver: (delivered) => dispatchDeploymentEvent({
2311
+ options: target.options,
2312
+ event: delivered,
2313
+ args: buildChannelHandlerArgs({
2314
+ runtime: target.runtime,
2315
+ channelId: target.channelId,
2316
+ }),
2317
+ }),
2318
+ })),
2319
+ }),
2320
+ });
2321
+ relay.start();
2322
+ logger(`[bdk] deployment-events: relaying ${initial.length} deploy-source subscription(s) to ${targets.length} channel(s)`);
2323
+ return relay;
2324
+ }
2325
+ function buildChannelHandlerArgs(input) {
2326
+ const { runtime, channelId } = input;
2327
+ const base = runtime.slug === "" ? "" : `/${runtime.slug}`;
2328
+ const auth = input.auth ?? null;
2329
+ return {
2330
+ params: input.params ?? {},
2331
+ requestIp: input.requestIp ?? null,
2332
+ auth,
2333
+ host: runtime.engine.host,
2334
+ artifacts: runtime.engine.artifacts,
2335
+ send: (message, sendOptions = {}) => runtime.engine.send(channelId, message, {
2336
+ ...sendOptions,
2337
+ auth: sendOptions.auth !== undefined ? sendOptions.auth : auth,
2338
+ hostedSessionId: input.hostedSessionId,
2339
+ }),
2340
+ getSession: (sessionId) => runtime.engine.getChannelSession(channelId, sessionId),
2341
+ receive: (target, inputReceive) => runtime.engine.receive(target, inputReceive),
2342
+ callTool: (toolName, toolInput, callOptions) => runtime.engine.callTool(toolName, toolInput, callOptions),
2343
+ waitUntil: (promise) => {
2344
+ runtime.engine.trackBackground(promise);
2345
+ },
2346
+ sessionUrls: (req, sessionId) => sessionUrlsForRequest(req, base, sessionId),
2347
+ hasContinuationSession: (continuationToken) => runtime.engine.hasContinuationSession(channelId, continuationToken),
2348
+ isContinuationBusy: (continuationToken) => runtime.engine.isContinuationBusy(channelId, continuationToken),
2349
+ getContinuationLastBotMessageTs: (continuationToken) => runtime.engine.getContinuationLastBotMessageTs(channelId, continuationToken),
2350
+ interruptContinuation: (continuationToken) => runtime.engine.interruptContinuation(channelId, continuationToken),
2351
+ };
2352
+ }
2353
+ async function handleRequest(router, req, res, logger, browserOriginGuard) {
2354
+ let response;
2355
+ let hostedDeliveryRequest = false;
2356
+ const method = req.method ?? "GET";
2357
+ try {
2358
+ const request = await toFetchRequest(req);
2359
+ hostedDeliveryRequest = request.headers.get(HOSTED_DELIVERY_HEADER) === "1";
2360
+ const requestErrorResponse = (status, error, message) => hostedDeliveryRequest
2361
+ ? hostedGuestErrorResponse({
2362
+ status,
2363
+ error,
2364
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
2365
+ message,
2366
+ })
2367
+ : errorResponse(status, error, message);
2368
+ const url = new URL(request.url);
2369
+ const match = router.match(request.method, url.pathname);
2370
+ if (!isTrustedBrowserMutation(request, browserOriginGuard)) {
2371
+ response = requestErrorResponse(403, "forbidden_origin", "Cross-origin browser mutations are not allowed.");
2372
+ }
2373
+ else if (match === undefined) {
2374
+ response = router.hasPath(url.pathname)
2375
+ ? requestErrorResponse(405, "method_not_allowed", `${request.method} is not supported on ${url.pathname}.`)
2376
+ : requestErrorResponse(404, "not_found", `No route for ${request.method} ${url.pathname}.`);
2377
+ }
2378
+ else {
2379
+ const requestIp = req.socket.remoteAddress ?? null;
2380
+ let auth = null;
2381
+ let unauthorized = false;
2382
+ if (match.route.auth !== "none") {
2383
+ auth = await resolveAuth(match.route.auth, request, requestIp);
2384
+ unauthorized = auth === null;
2385
+ }
2386
+ response = unauthorized
2387
+ ? requestErrorResponse(401, "unauthorized", "No auth policy admitted this request. In production, configure channel auth (e.g. bearerAuth) — the default localDevStrict() policy only admits loopback callers with a loopback Host.")
2388
+ : await match.route.handler(request, {
2389
+ params: match.params,
2390
+ requestIp,
2391
+ auth,
2392
+ });
2393
+ }
2394
+ }
2395
+ catch (error) {
2396
+ const mapped = mapThrownRequestError(error);
2397
+ if (mapped !== undefined) {
2398
+ response = hostedDeliveryRequest
2399
+ ? hostedGuestErrorResponse({
2400
+ status: mapped.status,
2401
+ error: mapped.code,
2402
+ retry: mapped.retry,
2403
+ message: mapped.message,
2404
+ })
2405
+ : errorResponse(mapped.status, mapped.code, mapped.message);
2406
+ }
2407
+ else {
2408
+ logger(`[bdk] request failed: ${error instanceof Error ? (error.stack ?? error.message) : String(error)}`);
2409
+ const snippet = hostedErrorStackSnippet(error);
2410
+ const message = hostedDeliveryRequest
2411
+ ? hostedErrorMessageOnly(error)
2412
+ : snippet.length > 0
2413
+ ? `Internal server error: ${snippet}`
2414
+ : "Internal server error.";
2415
+ response = hostedDeliveryRequest
2416
+ ? hostedGuestErrorResponse({
2417
+ status: 500,
2418
+ error: "internal_error",
2419
+ retry: HOSTED_GUEST_RETRY_TERMINAL,
2420
+ message,
2421
+ })
2422
+ : errorResponse(500, "internal_error", message);
2423
+ }
2424
+ }
2425
+ try {
2426
+ await writeFetchResponse(response, res, method);
2427
+ }
2428
+ catch (error) {
2429
+ logger(`[bdk] response write failed: ${error instanceof Error ? error.message : String(error)}`);
2430
+ res.destroy();
2431
+ }
2432
+ }
2433
+ async function resolveAuth(policies, request, requestIp) {
2434
+ for (const policy of policies) {
2435
+ const result = await policy(request, { requestIp });
2436
+ if (result !== null) {
2437
+ return result;
2438
+ }
2439
+ }
2440
+ return null;
2441
+ }
2442
+ async function toFetchRequest(req) {
2443
+ const method = req.method ?? "GET";
2444
+ const hostHeader = incomingRequestHost(req.headers);
2445
+ const url = new URL(req.url ?? "/", `http://${hostHeader}`);
2446
+ // Drop HTTP/2 pseudo-headers (`:method`, …) — Fetch `Headers` rejects them.
2447
+ const headers = incomingHeadersToFetch(req.headers);
2448
+ if (method === "GET" || method === "HEAD") {
2449
+ return new Request(url, { method, headers });
2450
+ }
2451
+ const body = await readBody(req);
2452
+ // Buffer is a Uint8Array at runtime; TS's BodyInit wants ArrayBuffer-backed
2453
+ // typed arrays, so re-view without copying.
2454
+ return new Request(url, {
2455
+ method,
2456
+ headers,
2457
+ body: new Uint8Array(body.buffer, body.byteOffset, body.byteLength),
2458
+ });
2459
+ }
2460
+ async function readBody(req) {
2461
+ const chunks = [];
2462
+ let total = 0;
2463
+ for await (const chunk of req) {
2464
+ const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
2465
+ total += buffer.length;
2466
+ if (total > MAX_BODY_BYTES) {
2467
+ throw new Error("Request body too large");
2468
+ }
2469
+ chunks.push(buffer);
2470
+ }
2471
+ return Buffer.concat(chunks);
2472
+ }
2473
+ export async function writeFetchResponse(response, res, method = "GET") {
2474
+ const headers = {};
2475
+ response.headers.forEach((value, key) => {
2476
+ headers[key] = value;
2477
+ });
2478
+ res.writeHead(response.status, headers);
2479
+ // HEAD responses must not include a body (RFC 9110 §9.3.2). Cancel any
2480
+ // handler-produced stream so long-lived GET handlers (e.g. session SSE)
2481
+ // still unsubscribe when served via the HEAD→GET fallback. A client that
2482
+ // left while the handler ran gets no body either: its `close` has already
2483
+ // fired, so the loop below would wait on a drain that never comes.
2484
+ if (method === "HEAD" || response.body === null || res.destroyed) {
2485
+ if (response.body !== null) {
2486
+ void response.body.cancel().catch(() => { });
2487
+ }
2488
+ res.end();
2489
+ return;
2490
+ }
2491
+ const reader = response.body.getReader();
2492
+ let clientGone = false;
2493
+ const closed = new Promise((resolve) => {
2494
+ res.once("close", () => {
2495
+ if (!res.writableFinished) {
2496
+ clientGone = true;
2497
+ void reader.cancel().catch(() => { });
2498
+ }
2499
+ resolve();
2500
+ });
2501
+ });
2502
+ try {
2503
+ while (!clientGone) {
2504
+ const { done, value } = await reader.read();
2505
+ if (done) {
2506
+ break;
2507
+ }
2508
+ if (value !== undefined && value.length > 0) {
2509
+ if (!res.write(value) && !clientGone) {
2510
+ // Race against close so a vanished client can't wedge the loop
2511
+ // waiting for a drain that will never come.
2512
+ await Promise.race([once(res, "drain"), closed]);
2513
+ }
2514
+ }
2515
+ }
2516
+ }
2517
+ catch {
2518
+ void reader.cancel().catch(() => { });
2519
+ }
2520
+ res.end();
2521
+ }
2522
+ /**
2523
+ * Dev reminder routes may only inspect/fire reminders whose bound session
2524
+ * belongs to the caller (same principal), matching session read routes.
2525
+ * Loopback `--dev` (and `--allow-anonymous`) can relax ownership like
2526
+ * `GET /v1/sessions`.
2527
+ */
2528
+ function asStringArray(value) {
2529
+ if (!Array.isArray(value)) {
2530
+ return undefined;
2531
+ }
2532
+ const out = [];
2533
+ for (const item of value) {
2534
+ if (typeof item === "string" && item.trim() !== "") {
2535
+ out.push(item);
2536
+ }
2537
+ }
2538
+ return out.length === 0 ? undefined : out;
2539
+ }
2540
+ function asPositiveInt(value) {
2541
+ if (typeof value !== "number" || !Number.isFinite(value)) {
2542
+ return undefined;
2543
+ }
2544
+ const n = Math.floor(value);
2545
+ return n > 0 ? n : undefined;
2546
+ }
2547
+ async function assertReminderReadable(input) {
2548
+ const existing = await input.engine.sessions.findByContinuation(input.reminder.channelId, input.reminder.continuationToken);
2549
+ if (existing === undefined) {
2550
+ // No live session — still gate on relax/loopback so a shared-dev caller
2551
+ // cannot enumerate orphan reminder metadata across principals.
2552
+ const relaxOwnership = input.relax === true &&
2553
+ (input.beyondLoopback === true ||
2554
+ (typeof input.requestIp === "string" && isLoopbackAddress(input.requestIp)));
2555
+ if (relaxOwnership) {
2556
+ return undefined;
2557
+ }
2558
+ // Without a session principal to compare, deny non-relaxed callers.
2559
+ return errorResponse(403, "forbidden", "This reminder is bound to a session that is not visible to the caller.");
2560
+ }
2561
+ return requireSessionOwner(existing, input.auth, {
2562
+ relax: input.relax,
2563
+ beyondLoopback: input.beyondLoopback,
2564
+ requestIp: input.requestIp,
2565
+ });
2566
+ }