@grok/agent-sdk 0.0.0-stage → 0.2.28

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