@cursor/bdk 0.2.6 → 0.2.8

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 (333) hide show
  1. package/dist/bin/agent-serve.js +52 -57
  2. package/dist/channels/github/github-channel.d.ts.map +1 -1
  3. package/dist/channels/github/github-channel.js +32 -8
  4. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  5. package/dist/channels/slack/dispatch.js +37 -29
  6. package/dist/channels/slack/external-policy.d.ts.map +1 -1
  7. package/dist/channels/slack/external-policy.js +6 -6
  8. package/dist/channels/slack/inbound.d.ts +5 -0
  9. package/dist/channels/slack/inbound.d.ts.map +1 -1
  10. package/dist/channels/slack/inbound.js +13 -0
  11. package/dist/channels/slack/index.d.ts +3 -0
  12. package/dist/channels/slack/index.d.ts.map +1 -1
  13. package/dist/channels/slack/index.js +3 -0
  14. package/dist/channels/slack/log.d.ts +1 -1
  15. package/dist/channels/slack/log.js +1 -1
  16. package/dist/channels/slack/self-identity.d.ts +15 -0
  17. package/dist/channels/slack/self-identity.d.ts.map +1 -0
  18. package/dist/channels/slack/self-identity.js +48 -0
  19. package/dist/channels/slack/sender-name.d.ts +17 -0
  20. package/dist/channels/slack/sender-name.d.ts.map +1 -0
  21. package/dist/channels/slack/sender-name.js +87 -0
  22. package/dist/channels/slack/setup.js +1 -1
  23. package/dist/channels/slack/user-info.d.ts +15 -0
  24. package/dist/channels/slack/user-info.d.ts.map +1 -0
  25. package/dist/channels/slack/user-info.js +57 -0
  26. package/dist/docs/404.html +2 -2
  27. package/dist/docs/assets/{app.CJLKDVza.js → app.oyjtOr3W.js} +4 -4
  28. package/dist/docs/assets/chunks/@localSearchIndexroot.C25zYVuc.js +1 -0
  29. package/dist/docs/assets/chunks/{VPLocalSearchBox.BW9mrQmq.js → VPLocalSearchBox.D0P6J_UJ.js} +1 -1
  30. package/dist/docs/assets/chunks/{arc.D8ZOvM1m.js → arc.B0LY1J1h.js} +1 -1
  31. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CXEKhLW-.js → architectureDiagram-Q4EWVU46.dPduLUxY.js} +1 -1
  32. package/dist/docs/assets/chunks/{baseUniq.BJkVKblr.js → baseUniq.B_Ohm21h.js} +1 -1
  33. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.DQDbHxor.js → blockDiagram-DXYQGD6D.B4zcanaJ.js} +1 -1
  34. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.ByMD6LYM.js → c4Diagram-AHTNJAMY.D9Iw21nx.js} +1 -1
  35. package/dist/docs/assets/chunks/channel.CRUyWDV-.js +1 -0
  36. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.Dtq1aVI9.js → chunk-4BX2VUAB.DDVwRShI.js} +1 -1
  37. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.BL_XrkoQ.js → chunk-4TB4RGXK.DsYcdn1i.js} +1 -1
  38. package/dist/docs/assets/chunks/{chunk-55IACEB6.BDPXu94_.js → chunk-55IACEB6.BzzQvcYp.js} +1 -1
  39. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.DhGOQj4k.js → chunk-EDXVE4YY.BMiXZ7FX.js} +1 -1
  40. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DSF5nr8v.js → chunk-FMBD7UC4.D_mBcLoc.js} +1 -1
  41. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.Day7wayw.js → chunk-OYMX7WX6.CMVjWVMx.js} +1 -1
  42. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.CpBEC0zA.js → chunk-QZHKN3VN.BG-FrPv9.js} +1 -1
  43. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.X_7rY1rx.js → chunk-YZCP3GAM.CkFE1ap3.js} +1 -1
  44. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CG_UObcQ.js +1 -0
  45. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CG_UObcQ.js +1 -0
  46. package/dist/docs/assets/chunks/clone.NYSZ9qZN.js +1 -0
  47. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BVRmi2ko.js → cose-bilkent-S5V4N54A.BVNnCTvY.js} +1 -1
  48. package/dist/docs/assets/chunks/{dagre-KV5264BT.Dei9oslB.js → dagre-KV5264BT.CDN5PR9l.js} +1 -1
  49. package/dist/docs/assets/chunks/{diagram-5BDNPKRD._M-efGt7.js → diagram-5BDNPKRD.DQRUlT-i.js} +1 -1
  50. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.D1Vmhfsj.js → diagram-G4DWMVQ6.CoeblYQT.js} +1 -1
  51. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.cE1bmvAC.js → diagram-MMDJMWI5.DW3ymjl0.js} +1 -1
  52. package/dist/docs/assets/chunks/{diagram-TYMM5635.DkXAfznP.js → diagram-TYMM5635.BP0uN4Jw.js} +1 -1
  53. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DH_pSwPg.js → erDiagram-SMLLAGMA.DVFUWEn4.js} +1 -1
  54. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.kAWVN9j1.js → flowDiagram-DWJPFMVM.HU-eHspv.js} +1 -1
  55. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.8r0w49-p.js → ganttDiagram-T4ZO3ILL.DHNhXijY.js} +1 -1
  56. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.BDa7Bi1i.js → gitGraphDiagram-UUTBAWPF.DkISXcO3.js} +1 -1
  57. package/dist/docs/assets/chunks/{graph.BMPXHz_B.js → graph.CCV0fuRR.js} +1 -1
  58. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.BmlcqewS.js → infoDiagram-42DDH7IO.bgILzOoc.js} +1 -1
  59. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.CVSEQSul.js → ishikawaDiagram-UXIWVN3A.CuryXC0F.js} +1 -1
  60. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.BpeWJ5n-.js → journeyDiagram-VCZTEJTY.BL1Pr-wu.js} +1 -1
  61. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.DHbDXuxB.js → kanban-definition-6JOO6SKY.BbGjvk4l.js} +1 -1
  62. package/dist/docs/assets/chunks/{layout.CzrCDgkP.js → layout.C4PfdldS.js} +1 -1
  63. package/dist/docs/assets/chunks/{linear.HwBsflwN.js → linear.C3xD1T6X.js} +1 -1
  64. package/dist/docs/assets/chunks/{min.DqGHolT3.js → min.CzgRAQ9c.js} +1 -1
  65. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.ZYGlOawh.js → mindmap-definition-QFDTVHPH.CA9rSWum.js} +1 -1
  66. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.C2KRXlNR.js → pieDiagram-DEJITSTG.B8MprgJu.js} +1 -1
  67. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CHj3Qefp.js → quadrantDiagram-34T5L4WZ.DndDwbKT.js} +1 -1
  68. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.B1L4Tf7k.js → requirementDiagram-MS252O5E.Zhfgwlnn.js} +1 -1
  69. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.dNR2yi1B.js → sankeyDiagram-XADWPNL6.B6RRm6N5.js} +1 -1
  70. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BrvQ3C6m.js → sequenceDiagram-FGHM5R23.Bfmz-1PN.js} +1 -1
  71. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.BtehEykA.js → stateDiagram-FHFEXIEX.gbrdNqgj.js} +1 -1
  72. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DOOmulfQ.js +1 -0
  73. package/dist/docs/assets/chunks/{theme.BDHBZUkP.js → theme.gpWjytMh.js} +2 -2
  74. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.Bn7nhqEN.js → timeline-definition-GMOUNBTQ.Bl1l7M1f.js} +1 -1
  75. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.DKhc38sz.js → vennDiagram-DHZGUBPP.Dfle4U0d.js} +1 -1
  76. package/dist/docs/assets/chunks/{wardley-RL74JXVD.DOXQ0w8J.js → wardley-RL74JXVD.BJrCW6xc.js} +1 -1
  77. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.Bbq5B2Ic.js → wardleyDiagram-NUSXRM2D.CM_4lmvZ.js} +1 -1
  78. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.B77HE1K8.js → xychartDiagram-5P7HB3ND.CHT5X28R.js} +1 -1
  79. package/dist/docs/assets/{reference_cli.md.BsgDqYPh.js → reference_cli.md.GwugN3n-.js} +5 -5
  80. package/dist/docs/assets/reference_cli.md.GwugN3n-.lean.js +1 -0
  81. package/dist/docs/building-with-agents.html +35 -35
  82. package/dist/docs/deployment.html +35 -35
  83. package/dist/docs/evals.html +35 -35
  84. package/dist/docs/guides/agent-to-agent.html +35 -35
  85. package/dist/docs/guides/bitbucket.html +35 -35
  86. package/dist/docs/guides/cloud-agents.html +35 -35
  87. package/dist/docs/guides/convert-automation.html +35 -35
  88. package/dist/docs/guides/github.html +35 -35
  89. package/dist/docs/guides/gitlab.html +35 -35
  90. package/dist/docs/guides/grokbot-agents.html +35 -35
  91. package/dist/docs/guides/hooks.html +35 -35
  92. package/dist/docs/guides/improve.html +35 -35
  93. package/dist/docs/guides/jev.html +35 -35
  94. package/dist/docs/guides/mcp-oauth.html +35 -35
  95. package/dist/docs/guides/opentelemetry.html +35 -35
  96. package/dist/docs/guides/slack.html +35 -35
  97. package/dist/docs/guides/webhooks.html +35 -35
  98. package/dist/docs/hashmap.json +1 -1
  99. package/dist/docs/hillclimbing.html +35 -35
  100. package/dist/docs/index.html +35 -35
  101. package/dist/docs/llms-full.txt +20 -9
  102. package/dist/docs/quickstart.html +35 -35
  103. package/dist/docs/reference/agent-config.html +35 -35
  104. package/dist/docs/reference/artifacts.html +35 -35
  105. package/dist/docs/reference/channels.html +35 -35
  106. package/dist/docs/reference/cli.html +39 -39
  107. package/dist/docs/reference/cli.md +20 -9
  108. package/dist/docs/reference/connections.html +35 -35
  109. package/dist/docs/reference/evals.html +35 -35
  110. package/dist/docs/reference/extensions.html +35 -35
  111. package/dist/docs/reference/hooks.html +35 -35
  112. package/dist/docs/reference/http-api.html +35 -35
  113. package/dist/docs/reference/instructions.html +35 -35
  114. package/dist/docs/reference/playground.html +35 -35
  115. package/dist/docs/reference/project-layout.html +35 -35
  116. package/dist/docs/reference/prompt.html +35 -35
  117. package/dist/docs/reference/schedules.html +35 -35
  118. package/dist/docs/reference/sessions.html +35 -35
  119. package/dist/docs/reference/skills.html +35 -35
  120. package/dist/docs/reference/subagents.html +35 -35
  121. package/dist/docs/reference/tools.html +35 -35
  122. package/dist/docs/templates/agentic-owners.html +35 -35
  123. package/dist/docs/templates/grokbot-agents.html +35 -35
  124. package/dist/docs/templates/security-reviewer.html +35 -35
  125. package/dist/docs/templates/thermo-quality-review.html +35 -35
  126. package/dist/docs/templates/thermo-review.html +35 -35
  127. package/dist/docs/templates/triage.html +35 -35
  128. package/dist/docs/troubleshooting.html +35 -35
  129. package/dist/extensions/cursor-cloud-agents/extension.d.ts +14 -0
  130. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  131. package/dist/extensions/cursor-cloud-agents/extension.js +5 -0
  132. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts +17 -0
  133. package/dist/extensions/cursor-cloud-agents/lib/watch.d.ts.map +1 -0
  134. package/dist/extensions/cursor-cloud-agents/lib/watch.js +99 -0
  135. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts +19 -0
  136. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.d.ts.map +1 -0
  137. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +71 -0
  138. package/dist/extensions/cursor-cloud-agents/skills/handoff.md +9 -5
  139. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -1
  140. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +3 -1
  141. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -1
  142. package/dist/extensions/cursor-cloud-agents/tools/launch.js +3 -2
  143. package/dist/extensions.d.ts +1 -1
  144. package/dist/extensions.js +1 -1
  145. package/dist/files-backends/cursor-hosted.d.ts +22 -83
  146. package/dist/files-backends/cursor-hosted.d.ts.map +1 -1
  147. package/dist/files-backends/cursor-hosted.js +46 -160
  148. package/dist/files.d.ts +9 -32
  149. package/dist/files.d.ts.map +1 -1
  150. package/dist/files.js +7 -32
  151. package/dist/internal/artifacts-store.d.ts +13 -25
  152. package/dist/internal/artifacts-store.d.ts.map +1 -1
  153. package/dist/internal/artifacts-store.js +25 -46
  154. package/dist/internal/cli-ax.d.ts +10 -17
  155. package/dist/internal/cli-ax.d.ts.map +1 -1
  156. package/dist/internal/cli-ax.js +87 -155
  157. package/dist/internal/cli-bitbucket.js +5 -5
  158. package/dist/internal/cli-deploy.d.ts +4 -1
  159. package/dist/internal/cli-deploy.d.ts.map +1 -1
  160. package/dist/internal/cli-deploy.js +117 -20
  161. package/dist/internal/cli-github.js +13 -13
  162. package/dist/internal/cli-gitlab.js +5 -5
  163. package/dist/internal/continuation-identity.d.ts +2 -0
  164. package/dist/internal/continuation-identity.d.ts.map +1 -1
  165. package/dist/internal/continuation-identity.js +4 -0
  166. package/dist/internal/conversation-mirror.d.ts +9 -38
  167. package/dist/internal/conversation-mirror.d.ts.map +1 -1
  168. package/dist/internal/conversation-mirror.js +62 -68
  169. package/dist/internal/cursor/account-mcp.d.ts +1 -1
  170. package/dist/internal/cursor/account-mcp.js +1 -1
  171. package/dist/internal/cursor/backend-client.js +1 -1
  172. package/dist/internal/cursor/github-credentials.js +3 -3
  173. package/dist/internal/cursor/hosted-bound-secrets.d.ts +6 -2
  174. package/dist/internal/cursor/hosted-bound-secrets.d.ts.map +1 -1
  175. package/dist/internal/cursor/hosted-bound-secrets.js +13 -2
  176. package/dist/internal/cursor/hosted-store-secrets.d.ts +13 -37
  177. package/dist/internal/cursor/hosted-store-secrets.d.ts.map +1 -1
  178. package/dist/internal/cursor/hosted-store-secrets.js +13 -37
  179. package/dist/internal/cursor/store-api-client.d.ts +17 -39
  180. package/dist/internal/cursor/store-api-client.d.ts.map +1 -1
  181. package/dist/internal/cursor/store-api-client.js +15 -37
  182. package/dist/internal/cursor-deployment-relay.js +3 -3
  183. package/dist/internal/cursor-event-relay.js +1 -1
  184. package/dist/internal/cursor-relay-core.d.ts +1 -1
  185. package/dist/internal/cursor-relay-core.d.ts.map +1 -1
  186. package/dist/internal/deploy-client.d.ts +55 -63
  187. package/dist/internal/deploy-client.d.ts.map +1 -1
  188. package/dist/internal/deploy-client.js +48 -28
  189. package/dist/internal/discovery/agent.d.ts +1 -1
  190. package/dist/internal/discovery/agent.d.ts.map +1 -1
  191. package/dist/internal/discovery/agent.js +4 -0
  192. package/dist/internal/discovery/extensions.d.ts +2 -1
  193. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  194. package/dist/internal/discovery/extensions.js +11 -1
  195. package/dist/internal/discovery/project.d.ts.map +1 -1
  196. package/dist/internal/discovery/project.js +1 -0
  197. package/dist/internal/distribution.d.ts +2 -2
  198. package/dist/internal/distribution.d.ts.map +1 -1
  199. package/dist/internal/distribution.js +2 -2
  200. package/dist/internal/docs-site.js +3 -3
  201. package/dist/internal/eval-run-store.js +8 -8
  202. package/dist/internal/framework-file-storage.d.ts +10 -34
  203. package/dist/internal/framework-file-storage.d.ts.map +1 -1
  204. package/dist/internal/framework-file-storage.js +12 -39
  205. package/dist/internal/framework-storage-selection.d.ts +10 -46
  206. package/dist/internal/framework-storage-selection.d.ts.map +1 -1
  207. package/dist/internal/framework-storage-selection.js +15 -64
  208. package/dist/internal/github-fanout.js +2 -2
  209. package/dist/internal/handleAgentServeTrigger.d.ts +5 -8
  210. package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
  211. package/dist/internal/handleAgentServeTrigger.js +5 -8
  212. package/dist/internal/host-files.js +6 -9
  213. package/dist/internal/host-platforms.js +5 -5
  214. package/dist/internal/hosted-catch.d.ts +3 -2
  215. package/dist/internal/hosted-catch.d.ts.map +1 -1
  216. package/dist/internal/hosted-catch.js +27 -9
  217. package/dist/internal/hosted-delivery-protocol.d.ts +31 -8
  218. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  219. package/dist/internal/hosted-delivery-protocol.js +102 -1
  220. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  221. package/dist/internal/hosted-delivery.js +32 -12
  222. package/dist/internal/hosted-execution-diag.d.ts +13 -24
  223. package/dist/internal/hosted-execution-diag.d.ts.map +1 -1
  224. package/dist/internal/hosted-execution-diag.js +11 -20
  225. package/dist/internal/hosted-execution-flush.d.ts +22 -10
  226. package/dist/internal/hosted-execution-flush.d.ts.map +1 -1
  227. package/dist/internal/hosted-execution-flush.js +45 -9
  228. package/dist/internal/hosted-managed-automation.js +5 -5
  229. package/dist/internal/hosting.d.ts +5 -10
  230. package/dist/internal/hosting.d.ts.map +1 -1
  231. package/dist/internal/hosting.js +5 -10
  232. package/dist/internal/legacy-command-guard.d.ts +1 -4
  233. package/dist/internal/legacy-command-guard.d.ts.map +1 -1
  234. package/dist/internal/legacy-command-guard.js +2 -11
  235. package/dist/internal/listen-port.js +1 -1
  236. package/dist/internal/local-control-plane.js +6 -6
  237. package/dist/internal/logs-client.d.ts +20 -1
  238. package/dist/internal/logs-client.d.ts.map +1 -1
  239. package/dist/internal/logs-client.js +89 -1
  240. package/dist/internal/mcp-endpoint.js +1 -1
  241. package/dist/internal/otel/collector.js +1 -1
  242. package/dist/internal/otel/runtime.js +13 -13
  243. package/dist/internal/platform-schedule-sync.js +2 -2
  244. package/dist/internal/playground/toolchain.js +6 -6
  245. package/dist/internal/process-memory-telemetry.js +2 -2
  246. package/dist/internal/reminder-runner.d.ts +8 -3
  247. package/dist/internal/reminder-runner.d.ts.map +1 -1
  248. package/dist/internal/reminder-runner.js +51 -52
  249. package/dist/internal/resolve-prod-target.d.ts +1 -12
  250. package/dist/internal/resolve-prod-target.d.ts.map +1 -1
  251. package/dist/internal/resolve-prod-target.js +2 -32
  252. package/dist/internal/resolved-connections.js +8 -8
  253. package/dist/internal/run-client.d.ts +4 -3
  254. package/dist/internal/run-client.d.ts.map +1 -1
  255. package/dist/internal/run-client.js +98 -61
  256. package/dist/internal/runtime-dispatch-runner.d.ts +1 -0
  257. package/dist/internal/runtime-dispatch-runner.d.ts.map +1 -1
  258. package/dist/internal/runtime-dispatch-runner.js +7 -1
  259. package/dist/internal/schedule-runner.js +1 -1
  260. package/dist/internal/sdk-runner.d.ts +4 -0
  261. package/dist/internal/sdk-runner.d.ts.map +1 -1
  262. package/dist/internal/sdk-runner.js +37 -22
  263. package/dist/internal/server.d.ts +2 -0
  264. package/dist/internal/server.d.ts.map +1 -1
  265. package/dist/internal/server.js +39 -38
  266. package/dist/internal/session-engine.d.ts +40 -44
  267. package/dist/internal/session-engine.d.ts.map +1 -1
  268. package/dist/internal/session-engine.js +108 -97
  269. package/dist/internal/session-run-log.d.ts +10 -24
  270. package/dist/internal/session-run-log.d.ts.map +1 -1
  271. package/dist/internal/session-run-log.js +13 -27
  272. package/dist/internal/sessions-client.d.ts.map +1 -1
  273. package/dist/internal/sessions-client.js +6 -3
  274. package/dist/internal/skills-sync.d.ts +3 -5
  275. package/dist/internal/skills-sync.d.ts.map +1 -1
  276. package/dist/internal/skills-sync.js +3 -5
  277. package/dist/internal/start-log-store.d.ts +7 -18
  278. package/dist/internal/start-log-store.d.ts.map +1 -1
  279. package/dist/internal/start-log-store.js +47 -24
  280. package/dist/internal/storage-coordinator.d.ts +7 -10
  281. package/dist/internal/storage-coordinator.d.ts.map +1 -1
  282. package/dist/internal/storage-coordinator.js +18 -20
  283. package/dist/internal/storage-roles.d.ts +5 -0
  284. package/dist/internal/storage-roles.d.ts.map +1 -1
  285. package/dist/internal/store-api-protocol.d.ts +12 -33
  286. package/dist/internal/store-api-protocol.d.ts.map +1 -1
  287. package/dist/internal/store-api-protocol.js +6 -22
  288. package/dist/internal/store-mirror.d.ts +4 -5
  289. package/dist/internal/store-mirror.d.ts.map +1 -1
  290. package/dist/internal/store-mirror.js +6 -8
  291. package/dist/internal/turn-cost.d.ts.map +1 -1
  292. package/dist/internal/turn-cost.js +31 -18
  293. package/dist/internal/turn-lease-store.d.ts +12 -5
  294. package/dist/internal/turn-lease-store.d.ts.map +1 -1
  295. package/dist/internal/turn-lease-store.js +61 -8
  296. package/dist/internal/v2-hosting.d.ts +4 -7
  297. package/dist/internal/v2-hosting.d.ts.map +1 -1
  298. package/dist/internal/v2-hosting.js +4 -7
  299. package/dist/internal/workspace-sync.d.ts +3 -6
  300. package/dist/internal/workspace-sync.d.ts.map +1 -1
  301. package/dist/internal/workspace-sync.js +3 -6
  302. package/dist/internal/workspace.d.ts +10 -16
  303. package/dist/internal/workspace.d.ts.map +1 -1
  304. package/dist/internal/workspace.js +9 -14
  305. package/dist/memory.d.ts +17 -43
  306. package/dist/memory.d.ts.map +1 -1
  307. package/dist/memory.js +34 -80
  308. package/dist/playground/assets/index-DPKLl4C_.css +1 -0
  309. package/dist/playground/assets/index-MijLHTbB.js +71 -0
  310. package/dist/playground/index.html +2 -2
  311. package/dist/storage-backends/cursor-hosted-v2.d.ts +8 -36
  312. package/dist/storage-backends/cursor-hosted-v2.d.ts.map +1 -1
  313. package/dist/storage-backends/cursor-hosted-v2.js +9 -37
  314. package/dist/storage-backends/cursor-hosted.d.ts +17 -30
  315. package/dist/storage-backends/cursor-hosted.d.ts.map +1 -1
  316. package/dist/storage-backends/cursor-hosted.js +14 -27
  317. package/dist/storage-protocol.d.ts +13 -38
  318. package/dist/storage-protocol.d.ts.map +1 -1
  319. package/dist/storage-protocol.js +14 -39
  320. package/dist/types.d.ts +29 -30
  321. package/dist/types.d.ts.map +1 -1
  322. package/docs/reference/cli.md +20 -9
  323. package/package.json +1 -1
  324. package/templates/pr-autofixer/bot/instructions.md +3 -3
  325. package/dist/docs/assets/chunks/@localSearchIndexroot.Bq-pxRXm.js +0 -1
  326. package/dist/docs/assets/chunks/channel.DCU8W1RP.js +0 -1
  327. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.DwpXsM06.js +0 -1
  328. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.DwpXsM06.js +0 -1
  329. package/dist/docs/assets/chunks/clone.DH6Mx2zB.js +0 -1
  330. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.kzD0-U89.js +0 -1
  331. package/dist/docs/assets/reference_cli.md.BsgDqYPh.lean.js +0 -1
  332. package/dist/playground/assets/index-6BbTPnaT.css +0 -1
  333. package/dist/playground/assets/index-CI7FAmOP.js +0 -71
@@ -19,9 +19,8 @@ import { Agent, Cursor, createAgentPlatform, } from "@cursor/sdk";
19
19
  import { SqliteLocalAgentStore } from "@cursor/sdk/sqlite";
20
20
  import { DEFAULT_MODEL, } from "../types.js";
21
21
  import { mapSdkTokenUsage, usageTokenSum } from "./cloud-turn-cost.js";
22
- import { resolveApiKeySync } from "./cursor/credentials.js";
22
+ import { resolveApiKeySync, SIGN_IN_HINT } from "./cursor/credentials.js";
23
23
  import { describeError } from "./describe-error.js";
24
- import { CLI_COMMAND_NAME as CLI } from "./distribution.js";
25
24
  import { sleep } from "./sleep.js";
26
25
  /**
27
26
  * How long a non-`--dev` serve holds workspace scans (rules, skills,
@@ -190,11 +189,12 @@ export class CursorSdkRunner {
190
189
  this.activeRuns = new Map();
191
190
  this.stores = new Map();
192
191
  this.prewarmReleases = [];
192
+ this.pendingPersists = new Map();
193
193
  if (options.workspaceScanCacheTtlMs !== undefined) {
194
194
  Cursor.configure({
195
195
  local: { workspaceScanCacheTtlMs: options.workspaceScanCacheTtlMs },
196
196
  });
197
- this.log(`[agent-sdk] workspace scan cache ttl=${options.workspaceScanCacheTtlMs}ms`);
197
+ this.log(`[bdk] workspace scan cache ttl=${options.workspaceScanCacheTtlMs}ms`);
198
198
  }
199
199
  }
200
200
  runTurn(request) {
@@ -205,7 +205,7 @@ export class CursorSdkRunner {
205
205
  // the Grok Bot runner — running it on the local harness would silently
206
206
  // swap the box (and the SendToUser contract) out from under the agent.
207
207
  if (request.runtime === "grokbot") {
208
- throw new Error(`Session ${request.sessionId} is a grokbot turn, which the Cursor SDK runner cannot execute. Serve must route grokbot turns to the Grok Bot runner.`);
208
+ throw new Error(`Session ${request.sessionId} is a grokbot turn, which the local and cloud turn runner cannot execute. Serve must route grokbot turns to the Grok Bot runner.`);
209
209
  }
210
210
  const models = modelAttemptChain(request);
211
211
  let lastError;
@@ -266,7 +266,7 @@ export class CursorSdkRunner {
266
266
  }
267
267
  // Log the original error even when the retry succeeds so the expiry
268
268
  // still shows up in Datadog.
269
- this.log(`[agent-sdk] session ${request.sessionId}: ${reason}: ${outcome.errorMessage}; retrying the turn`);
269
+ this.log(`[bdk] session ${request.sessionId}: ${reason}: ${outcome.errorMessage}; retrying the turn`);
270
270
  try {
271
271
  return yield this.runTurnAttempt(tracked);
272
272
  }
@@ -276,7 +276,7 @@ export class CursorSdkRunner {
276
276
  });
277
277
  }
278
278
  logModelFallback(sessionId, from, to, message) {
279
- this.log(`[agent-sdk] session ${sessionId}: cannot use model ${modelSettingLabel(from)}; retrying on ${modelSettingLabel(to)}: ${message !== null && message !== void 0 ? message : "model unavailable"}`);
279
+ this.log(`[bdk] session ${sessionId}: cannot use model ${modelSettingLabel(from)}; retrying on ${modelSettingLabel(to)}: ${message !== null && message !== void 0 ? message : "model unavailable"}`);
280
280
  }
281
281
  runTurnAttempt(request) {
282
282
  return __awaiter(this, void 0, void 0, function* () {
@@ -363,17 +363,18 @@ export class CursorSdkRunner {
363
363
  this.activeRuns.delete(request.sessionId);
364
364
  }
365
365
  signal === null || signal === void 0 ? void 0 : signal.removeEventListener("abort", onAbort);
366
- // Mirror the conversation before replying: on hosted v2 the pod can
367
- // be parked as soon as the execution reply lands, so a
368
- // fire-and-forget write would race VM teardown. In the `finally` so
369
- // a `wait()` that THROWS (transport death mid-turn, an abort with
370
- // no follow-up) still persists the checkpoints the turn already
371
- // wrote — the store is local SQLite, safe to read on the throw
372
- // path, and persistConversation swallows its own errors. Guarded
373
- // here (not just inside the helper) so unmirrored turns keep their
374
- // exact post-wait sequencing.
366
+ // Mirror the conversation without holding the turn outcome: on
367
+ // hosted v2 the pod can be parked as soon as the execution reply
368
+ // lands, so the engine's durability drain awaits this write through
369
+ // drainConversation before that reply, not before turn.completed.
370
+ // In the `finally` so a `wait()` that THROWS (transport death
371
+ // mid-turn, an abort with no follow-up) still persists the
372
+ // checkpoints the turn already wrote — the store is local SQLite,
373
+ // safe to read on the throw path, and persistConversation swallows
374
+ // its own errors. Guarded here (not just inside the helper) so
375
+ // unmirrored turns keep their exact post-wait sequencing.
375
376
  if (request.runtime === "local" && this.options.conversationMirror !== undefined) {
376
- yield this.persistConversation(request, agent.agentId);
377
+ this.trackPersist(request.sessionId, this.persistConversation(request, agent.agentId));
377
378
  }
378
379
  }
379
380
  }
@@ -395,7 +396,7 @@ export class CursorSdkRunner {
395
396
  return yield run.steer(request.text);
396
397
  }
397
398
  catch (error) {
398
- this.log(`[agent-sdk] session ${request.sessionId}: steer failed: ${describeError(error)}`);
399
+ this.log(`[bdk] session ${request.sessionId}: steer failed: ${describeError(error)}`);
399
400
  return "revert_to_followup";
400
401
  }
401
402
  });
@@ -431,8 +432,22 @@ export class CursorSdkRunner {
431
432
  }
432
433
  this.evictAgent(sessionId, cached.agent);
433
434
  }
435
+ drainConversation(sessionId) {
436
+ return __awaiter(this, void 0, void 0, function* () {
437
+ yield this.pendingPersists.get(sessionId);
438
+ });
439
+ }
440
+ trackPersist(sessionId, persist) {
441
+ const tracked = Promise.all([this.pendingPersists.get(sessionId), persist]).then(() => {
442
+ if (this.pendingPersists.get(sessionId) === tracked) {
443
+ this.pendingPersists.delete(sessionId);
444
+ }
445
+ });
446
+ this.pendingPersists.set(sessionId, tracked);
447
+ }
434
448
  dispose() {
435
449
  return __awaiter(this, void 0, void 0, function* () {
450
+ yield Promise.allSettled([...this.pendingPersists.values()]);
436
451
  const releases = this.prewarmReleases.splice(0);
437
452
  yield Promise.allSettled(releases.map(release => release()));
438
453
  const agents = yield Promise.allSettled([...this.agents.values()].map(handle => handle.agent));
@@ -453,7 +468,7 @@ export class CursorSdkRunner {
453
468
  }
454
469
  // Past this age the handle's exchanged access token could expire
455
470
  // mid-turn. Retire it and reopen below on a fresh transport.
456
- this.log(`[agent-sdk] session ${request.sessionId}: recycling the SDK agent handle after ${Math.round(ageMs / 60000)} min so the turn runs on a fresh access token`);
471
+ this.log(`[bdk] session ${request.sessionId}: recycling the SDK agent handle after ${Math.round(ageMs / 60000)} min so the turn runs on a fresh access token`);
457
472
  this.evictAgent(request.sessionId, cached.agent);
458
473
  }
459
474
  const agentPromise = this.openAgent(request).catch(error => {
@@ -492,7 +507,7 @@ export class CursorSdkRunner {
492
507
  requireApiKey() {
493
508
  const resolved = resolveApiKeySync({ apiKey: this.options.apiKey });
494
509
  if (resolved === undefined) {
495
- throw new Error(`The Cursor SDK runner requires a Cursor credential: run \`${CLI} login\`, set CURSOR_API_KEY, CURSOR_SERVICE_ACCOUNT_KEY, or CURSOR_API_KEY_FILE, or pass serve({ apiKey }).`);
510
+ throw new Error(`BDK needs a Cursor credential to run turns. ${SIGN_IN_HINT}`);
496
511
  }
497
512
  return resolved.apiKey;
498
513
  }
@@ -562,7 +577,7 @@ export class CursorSdkRunner {
562
577
  // conversation under the same id beats failing this thread's turns
563
578
  // forever ("Agent … not found" on every follow-up). The channel's
564
579
  // warm-turn prompt context re-hydrates the thread history.
565
- this.log(`[agent-sdk] no stored conversation for ${agentId} on this host; starting a fresh one`);
580
+ this.log(`[bdk] no stored conversation for ${agentId} on this host; starting a fresh one`);
566
581
  return Agent.create(Object.assign(Object.assign({}, options), { agentId }));
567
582
  }
568
583
  });
@@ -599,7 +614,7 @@ export class CursorSdkRunner {
599
614
  // session would otherwise fail every future turn. Mirror the local
600
615
  // host-replacement path above: a fresh conversation beats failing this
601
616
  // thread forever, and the new id binds to the session for later resumes.
602
- this.log(`[agent-sdk] cloud session ${request.sessionId} has no bound cloud agent; creating a fresh one`);
617
+ this.log(`[bdk] cloud session ${request.sessionId} has no bound cloud agent; creating a fresh one`);
603
618
  return Agent.create(options);
604
619
  });
605
620
  }
@@ -623,7 +638,7 @@ export class CursorSdkRunner {
623
638
  yield mirror.persist(store, sdkAgentId);
624
639
  }
625
640
  catch (error) {
626
- this.log(`[agent-sdk] conversation mirror: persist for ${sdkAgentId} failed: ${error instanceof Error ? error.message : String(error)}`);
641
+ this.log(`[bdk] conversation mirror: persist for ${sdkAgentId} failed: ${error instanceof Error ? error.message : String(error)}`);
627
642
  }
628
643
  });
629
644
  }
@@ -4,6 +4,7 @@
4
4
  * routes, custom channel routes (under `/v1/channels/<id>`), and the
5
5
  * server-level health / info / dev-dispatch routes.
6
6
  */
7
+ import { type ServerResponse } from "node:http";
7
8
  import type { AgentProject, AgentServeHandle, ServeOptions } from "../types.js";
8
9
  import type { McpOauthSecretsTarget } from "./mcp-oauth-persist.js";
9
10
  import { type AgentRunner } from "./sdk-runner.js";
@@ -37,4 +38,5 @@ export interface StartServerInternalOptions {
37
38
  * under `/<slug>/v1/*` and `/<slug>/playground`, with an index at `/`.
38
39
  */
39
40
  export declare function startServer(mounts: AgentMount[], options?: ServeOptions & StartServerInternalOptions): Promise<AgentServeHandle>;
41
+ export declare function writeFetchResponse(response: Response, res: ServerResponse, method?: string): Promise<void>;
40
42
  //# sourceMappingURL=server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiDH,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAQhB,YAAY,EACb,MAAM,aAAa,CAAC;AA2FrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAgDpE,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAUpE,OAAO,EAEL,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAsB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAW/E,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAuCD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,yEAAyE;IACzE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAC5D,wEAAwE;IACxE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IACvD;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAwmC3B"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/internal/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAsC,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AA6CpF,OAAO,KAAK,EACV,YAAY,EACZ,gBAAgB,EAQhB,YAAY,EACb,MAAM,aAAa,CAAC;AA2FrB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAgDpE,OAAO,EAAE,KAAK,WAAW,EAAmB,MAAM,iBAAiB,CAAC;AAUpE,OAAO,EAEL,wBAAwB,EAEzB,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAsB,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAW/E,8EAA8E;AAC9E,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAuCD,6EAA6E;AAC7E,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,4EAA4E;IAC5E,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,yEAAyE;IACzE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,wBAAwB,CAAC,CAAC;IAC5D,wEAAwE;IACxE,aAAa,CAAC,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC;IACvD;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAAE,EACpB,OAAO,GAAE,YAAY,GAAG,0BAA+B,GACtD,OAAO,CAAC,gBAAgB,CAAC,CAwmC3B;AAilDD,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,QAAQ,EAClB,GAAG,EAAE,cAAc,EACnB,MAAM,SAAQ,GACb,OAAO,CAAC,IAAI,CAAC,CAkDf"}
@@ -239,13 +239,13 @@ export function startServer(mounts_1) {
239
239
  if (options.allowAnonymousCursorGithub !== true) {
240
240
  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.");
241
241
  }
242
- logger("[agent-sdk] 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)");
242
+ 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)");
243
243
  if (githubApiKeyNow === undefined) {
244
- logger("[agent-sdk] GitHub auth: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
244
+ logger("[bdk] GitHub auth: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
245
245
  }
246
246
  }
247
247
  if (cursorGithubConfig.permissions === "contents-write") {
248
- logger('[agent-sdk] 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');
248
+ 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');
249
249
  }
250
250
  const githubAuthBaseUrl = cursorExternalApiUrl();
251
251
  const requireGithubApiKey = () => __awaiter(this, void 0, void 0, function* () {
@@ -286,7 +286,7 @@ export function startServer(mounts_1) {
286
286
  target.accountRuntime.credentials.bind(requireGithubApiKey);
287
287
  target.accountRuntime.credentials.bindProxyTransport(proxyTransport);
288
288
  }
289
- logger(`[agent-sdk] GitHub auth: channel API calls route through ${githubProxyUrl}`);
289
+ logger(`[bdk] GitHub auth: channel API calls route through ${githubProxyUrl}`);
290
290
  }
291
291
  else {
292
292
  for (const target of cursorGithubTargets) {
@@ -316,7 +316,7 @@ export function startServer(mounts_1) {
316
316
  getApiKey: requireGithubApiKey,
317
317
  transport: proxyTransport,
318
318
  });
319
- logger(`[agent-sdk] GitHub auth: channel and host API calls route through ${githubProxyUrl} (repo scope per request)`);
319
+ logger(`[bdk] GitHub auth: channel and host API calls route through ${githubProxyUrl} (repo scope per request)`);
320
320
  }
321
321
  }
322
322
  }
@@ -351,7 +351,7 @@ export function startServer(mounts_1) {
351
351
  }
352
352
  }
353
353
  if (gitlabTargets > 0) {
354
- logger(`[agent-sdk] GitLab auth: channel API calls route through ${gitlabProxyUrl}`);
354
+ logger(`[bdk] GitLab auth: channel API calls route through ${gitlabProxyUrl}`);
355
355
  }
356
356
  // Bitbucket `cursorAccount` channels: same shape, `/v0/bitbucket-proxy`
357
357
  // with `x-cursor-bitbucket-repos` scope. The proxy picks Cloud 2.0 or
@@ -384,7 +384,7 @@ export function startServer(mounts_1) {
384
384
  }
385
385
  }
386
386
  if (bitbucketTargets > 0) {
387
- logger(`[agent-sdk] Bitbucket auth: channel API calls route through ${bitbucketProxyUrl}`);
387
+ logger(`[bdk] Bitbucket auth: channel API calls route through ${bitbucketProxyUrl}`);
388
388
  }
389
389
  }
390
390
  const resolvedCursorGithubCredentials = cursorGithubCredentials;
@@ -403,7 +403,7 @@ export function startServer(mounts_1) {
403
403
  yield ensureDocsSiteBundle(logger);
404
404
  }
405
405
  if (options.allowAnonymous === true) {
406
- logger("[agent-sdk] 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");
406
+ 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");
407
407
  }
408
408
  // v2 hosted engines mirror the SDK conversation store to the deployment's
409
409
  // shared file storage so a fresh pod resumes threads instead of forking
@@ -461,7 +461,7 @@ export function startServer(mounts_1) {
461
461
  if (options.allowAnonymousGrokbot !== true) {
462
462
  throw new Error('runtime: "grokbot" cannot be served with --allow-anonymous because admitted callers could drive the signed-in account\'s hosted Grok Bot computer. If every admitted caller is trusted (e.g. behind an SSO proxy), opt in with --allow-anonymous-grokbot.');
463
463
  }
464
- logger("[agent-sdk] warning: --allow-anonymous-grokbot — every admitted HTTP caller can drive turns on the signed-in account's hosted Grok Bot computer; serve this only behind a trusted boundary (e.g. an SSO proxy)");
464
+ logger("[bdk] warning: --allow-anonymous-grokbot — every admitted HTTP caller can drive turns on the signed-in account's hosted Grok Bot computer; serve this only behind a trusted boundary (e.g. an SSO proxy)");
465
465
  }
466
466
  let runner = sdkRunner;
467
467
  if (hasGrokBotMounts && options.runner === undefined) {
@@ -482,7 +482,7 @@ export function startServer(mounts_1) {
482
482
  backendUrl: cursorExternalApiUrl(),
483
483
  }),
484
484
  });
485
- logger("[agent-sdk] grokbot runtime: remote client (turns run on the hosted Grok Bot harness)");
485
+ logger("[bdk] grokbot runtime: remote client (turns run on the hosted Grok Bot harness)");
486
486
  }
487
487
  const router = new Router();
488
488
  const runtimes = [];
@@ -505,7 +505,7 @@ export function startServer(mounts_1) {
505
505
  if (options.allowAnonymous === true &&
506
506
  options.allowAnonymousCursorAccountMcp === true &&
507
507
  accountRefsBySlug.size > 0) {
508
- logger("[agent-sdk] 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)");
508
+ 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)");
509
509
  }
510
510
  let accountBridge;
511
511
  if (accountRefsBySlug.size > 0) {
@@ -513,7 +513,7 @@ export function startServer(mounts_1) {
513
513
  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}`);
514
514
  }
515
515
  if (accountKey === undefined) {
516
- logger("[agent-sdk] Cursor account MCP: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
516
+ logger("[bdk] Cursor account MCP: listening unsigned; credentials bind at task via CURSOR_API_KEY or CURSOR_API_KEY_FILE");
517
517
  }
518
518
  accountBridge = new CursorAccountMcpBridge({
519
519
  client: new CursorBackendClient({
@@ -676,7 +676,7 @@ export function startServer(mounts_1) {
676
676
  yield definition.onStart(startArgs);
677
677
  }
678
678
  catch (error) {
679
- logger(`[agent-sdk] channel "${channel.id}" onStart failed: ${error instanceof Error ? ((_0 = error.stack) !== null && _0 !== void 0 ? _0 : error.message) : String(error)}`);
679
+ logger(`[bdk] channel "${channel.id}" onStart failed: ${error instanceof Error ? ((_0 = error.stack) !== null && _0 !== void 0 ? _0 : error.message) : String(error)}`);
680
680
  }
681
681
  }
682
682
  }
@@ -797,7 +797,7 @@ export function startServer(mounts_1) {
797
797
  if (options.evals !== true) {
798
798
  throw error;
799
799
  }
800
- logger(`[agent-sdk] GitHub auth: no Cursor account credential (${error instanceof Error ? error.message : String(error)}); GitHub calls from eval sessions will fail`);
800
+ logger(`[bdk] GitHub auth: no Cursor account credential (${error instanceof Error ? error.message : String(error)}); GitHub calls from eval sessions will fail`);
801
801
  }
802
802
  // Cursor SCM events: v1 stays on the engine poll. v2 ingest is local-CP
803
803
  // only — hosted `--no-control-plane` skips the July poll (hosted CP wakes).
@@ -820,13 +820,13 @@ export function startServer(mounts_1) {
820
820
  localCp.attachScmEvents(controlPlaneScmRelay);
821
821
  }
822
822
  else {
823
- logger("[agent-sdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
823
+ logger("[bdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
824
824
  }
825
825
  }
826
826
  else if (hostedControlPlaneOwnsIngest && effectiveCursorEvents !== undefined) {
827
827
  // No credential was required above, so no relay object was built; the
828
828
  // outcome is the same skip.
829
- logger("[agent-sdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
829
+ logger("[bdk] cursor-events: skipping v2 scm-events poll (--no-control-plane); hosted CP owns ingest");
830
830
  }
831
831
  // Cursor deployment-events relay: automatic when a mounted agent authored
832
832
  // `deploymentsChannel({ ... })`.
@@ -903,7 +903,7 @@ export function startServer(mounts_1) {
903
903
  : `${options.publicUrl.replace(/\/$/, "")}${basePath}${TOOL_MCP_ENDPOINT_PATH}`);
904
904
  if (publicToolsUrl === undefined) {
905
905
  if (hasServerTools) {
906
- logger(`[agent-sdk] warning: agent "${runtime.project.name}" has server tools but no --public-url or --cloud-tools-url; cloud turns omit those tools.`);
906
+ logger(`[bdk] warning: agent "${runtime.project.name}" has server tools but no --public-url or --cloud-tools-url; cloud turns omit those tools.`);
907
907
  }
908
908
  }
909
909
  else {
@@ -922,7 +922,7 @@ export function startServer(mounts_1) {
922
922
  if (options.allowAnonymous !== true) {
923
923
  throw new Error(`Agent "${runtime.project.name}" needs a Cursor API key to authenticate --cloud-tools-url. ${SIGN_IN_HINT}`);
924
924
  }
925
- logger(`[agent-sdk] --cloud-tools-url: listening unsigned; Bearer resolves after task-time credential binding`);
925
+ logger(`[bdk] --cloud-tools-url: listening unsigned; Bearer resolves after task-time credential binding`);
926
926
  }
927
927
  runtime.engine.setCloudServerToolsConnection(Object.assign({ type: "http", url: publicToolsUrl }, (headers === undefined ? {} : { headers })), resolveCloudToolsHeaders);
928
928
  }
@@ -1045,7 +1045,7 @@ export function startServer(mounts_1) {
1045
1045
  yield stop();
1046
1046
  }
1047
1047
  catch (error) {
1048
- logger(`[agent-sdk] channel onStop failed: ${error instanceof Error ? ((_b = error.stack) !== null && _b !== void 0 ? _b : error.message) : String(error)}`);
1048
+ logger(`[bdk] channel onStop failed: ${error instanceof Error ? ((_b = error.stack) !== null && _b !== void 0 ? _b : error.message) : String(error)}`);
1049
1049
  }
1050
1050
  }
1051
1051
  server.close();
@@ -1264,9 +1264,8 @@ function mountAgentRoutes(router, runtime, args) {
1264
1264
  const includeAll = relaxSessionReadAuth &&
1265
1265
  (relaxSessionReadAuthBeyondLoopback ||
1266
1266
  (typeof ctx.requestIp === "string" && isLoopbackAddress(ctx.requestIp)));
1267
- // `?latest=1` — only the newest visible session. Clients binding a
1268
- // default session (agsh) do not need the whole list, and on hosted
1269
- // storage the whole list is a database scan.
1267
+ // `?latest=1` returns only the newest visible session. Clients
1268
+ // binding a default session do not need the cost of a full listing.
1270
1269
  const latest = new URL(request.url).searchParams.get("latest");
1271
1270
  const listed = latest === "1" || latest === "true"
1272
1271
  ? yield engine.latestSessionWithSource(ctx.auth, { includeAll })
@@ -1877,7 +1876,7 @@ function requireCursorEventsAuth(config, accountKey) {
1877
1876
  var _a, _b, _c;
1878
1877
  const apiKey = ((_b = (_a = config.apiKey) !== null && _a !== void 0 ? _a : accountKey === null || accountKey === void 0 ? void 0 : accountKey.apiKey) !== null && _b !== void 0 ? _b : "").trim();
1879
1878
  if (apiKey === "") {
1880
- throw new Error(`[agent-sdk] --cursor-events (serve({ cursorEvents })) requires a signed-in Cursor account: the SCM event stream is read as the host's user. ${SIGN_IN_HINT}`);
1879
+ 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}`);
1881
1880
  }
1882
1881
  return {
1883
1882
  apiKey,
@@ -1942,7 +1941,7 @@ function assertSingleCursorEventsLane(input) {
1942
1941
  collectCursorEventSubscriptions(Object.assign({ mounts: input.v2Mounts }, shared)).length === 0) {
1943
1942
  return;
1944
1943
  }
1945
- throw new Error("[agent-sdk] 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.");
1944
+ 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.");
1946
1945
  }
1947
1946
  function startCursorEventRelay(input) {
1948
1947
  var _a;
@@ -1958,17 +1957,17 @@ function startCursorEventRelay(input) {
1958
1957
  });
1959
1958
  if (subscriptions.length === 0) {
1960
1959
  if (input.lane === "engine" && input.skippedV2 === true) {
1961
- logger("[agent-sdk] cursor-events: no v1 github/origin targets; v2 ingest is control-plane only");
1960
+ logger("[bdk] cursor-events: no v1 github/origin targets; v2 ingest is control-plane only");
1962
1961
  }
1963
1962
  else if (input.lane === "control-plane") {
1964
1963
  return undefined;
1965
1964
  }
1966
1965
  else if (input.githubRepos.every(repo => repo.trim() === "") &&
1967
1966
  input.originRepos.every(repo => repo.trim() === "")) {
1968
- logger("[agent-sdk] cursor-events: no repos configured (pass --repo owner/name); relay disabled");
1967
+ logger("[bdk] cursor-events: no repos configured (pass --repo owner/name); relay disabled");
1969
1968
  }
1970
1969
  else {
1971
- logger("[agent-sdk] cursor-events: no mounted agent declares a github or origin channel; relay disabled");
1970
+ logger("[bdk] cursor-events: no mounted agent declares a github or origin channel; relay disabled");
1972
1971
  }
1973
1972
  return undefined;
1974
1973
  }
@@ -2021,16 +2020,16 @@ function startCursorEventRelay(input) {
2021
2020
  return relay;
2022
2021
  }
2023
2022
  relay.start();
2024
- logger(`[agent-sdk] cursor-events: relaying ${subscriptions.length} subscription(s) from ${auth.baseUrl}`);
2023
+ logger(`[bdk] cursor-events: relaying ${subscriptions.length} subscription(s) from ${auth.baseUrl}`);
2025
2024
  return relay;
2026
2025
  }
2027
2026
  function logCursorScmDispatch(logger, event, result) {
2028
2027
  const outcomes = result.targets.map(target => formatCursorScmDispatchOutcome(target)).join(", ");
2029
2028
  const rejected = result.targets.filter(target => target.status >= 400);
2030
2029
  if (rejected.length > 0) {
2031
- logger(`[agent-sdk] cursor-events: dropped ${formatCursorScmEventLog(event)} before hook: ${rejected.map(formatCursorScmDispatchOutcome).join(", ")}`);
2030
+ logger(`[bdk] cursor-events: dropped ${formatCursorScmEventLog(event)} before hook: ${rejected.map(formatCursorScmDispatchOutcome).join(", ")}`);
2032
2031
  }
2033
- logger(`[agent-sdk] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`);
2032
+ logger(`[bdk] cursor-events: dispatched ${formatCursorScmEventLog(event)}${outcomes === "" ? "" : ` → ${outcomes}`}`);
2034
2033
  }
2035
2034
  function collectCursorGithubTargets(mounts) {
2036
2035
  const targets = [];
@@ -2173,7 +2172,7 @@ function startCursorDeploymentRelay(input) {
2173
2172
  }
2174
2173
  if (accountKey === undefined) {
2175
2174
  if (input.options.allowAnonymous === true) {
2176
- logger("[agent-sdk] deployment-events: skipped while unsigned; long-poll relays need a key at start");
2175
+ logger("[bdk] deployment-events: skipped while unsigned; long-poll relays need a key at start");
2177
2176
  return undefined;
2178
2177
  }
2179
2178
  throw new Error(`This project has channels subscribed to deployment events (deploymentsChannel({ ... })) but the host is not signed in to Cursor. ${SIGN_IN_HINT}`);
@@ -2183,7 +2182,7 @@ function startCursorDeploymentRelay(input) {
2183
2182
  // names every source, so a channel that omits the option registers nothing.
2184
2183
  const initial = liveDeploymentSubscriptionUnion(targets);
2185
2184
  if (initial.length === 0) {
2186
- logger(`[agent-sdk] deployment-events: no deploy sources yet on ${targets
2185
+ logger(`[bdk] deployment-events: no deploy sources yet on ${targets
2187
2186
  .map(target => `${target.runtime.slug || target.runtime.project.name}/${target.channelId}`)
2188
2187
  .join(", ")}; the relay will register when a channel lists some`);
2189
2188
  }
@@ -2216,7 +2215,7 @@ function startCursorDeploymentRelay(input) {
2216
2215
  }),
2217
2216
  });
2218
2217
  relay.start();
2219
- logger(`[agent-sdk] deployment-events: relaying ${initial.length} deploy-source subscription(s) to ${targets.length} channel(s)`);
2218
+ logger(`[bdk] deployment-events: relaying ${initial.length} deploy-source subscription(s) to ${targets.length} channel(s)`);
2220
2219
  return relay;
2221
2220
  }
2222
2221
  function buildChannelHandlerArgs(input) {
@@ -2301,7 +2300,7 @@ function handleRequest(router, req, res, logger, browserOriginGuard) {
2301
2300
  : errorResponse(mapped.status, mapped.code, mapped.message);
2302
2301
  }
2303
2302
  else {
2304
- logger(`[agent-sdk] request failed: ${error instanceof Error ? ((_c = error.stack) !== null && _c !== void 0 ? _c : error.message) : String(error)}`);
2303
+ logger(`[bdk] request failed: ${error instanceof Error ? ((_c = error.stack) !== null && _c !== void 0 ? _c : error.message) : String(error)}`);
2305
2304
  const snippet = hostedErrorStackSnippet(error);
2306
2305
  const message = hostedDeliveryRequest
2307
2306
  ? hostedErrorMessageOnly(error)
@@ -2322,7 +2321,7 @@ function handleRequest(router, req, res, logger, browserOriginGuard) {
2322
2321
  yield writeFetchResponse(response, res, method);
2323
2322
  }
2324
2323
  catch (error) {
2325
- logger(`[agent-sdk] response write failed: ${error instanceof Error ? error.message : String(error)}`);
2324
+ logger(`[bdk] response write failed: ${error instanceof Error ? error.message : String(error)}`);
2326
2325
  res.destroy();
2327
2326
  }
2328
2327
  });
@@ -2388,7 +2387,7 @@ function readBody(req) {
2388
2387
  return Buffer.concat(chunks);
2389
2388
  });
2390
2389
  }
2391
- function writeFetchResponse(response_1, res_1) {
2390
+ export function writeFetchResponse(response_1, res_1) {
2392
2391
  return __awaiter(this, arguments, void 0, function* (response, res, method = "GET") {
2393
2392
  const headers = {};
2394
2393
  response.headers.forEach((value, key) => {
@@ -2397,8 +2396,10 @@ function writeFetchResponse(response_1, res_1) {
2397
2396
  res.writeHead(response.status, headers);
2398
2397
  // HEAD responses must not include a body (RFC 9110 §9.3.2). Cancel any
2399
2398
  // handler-produced stream so long-lived GET handlers (e.g. session SSE)
2400
- // still unsubscribe when served via the HEAD→GET fallback.
2401
- if (method === "HEAD" || response.body === null) {
2399
+ // still unsubscribe when served via the HEAD→GET fallback. A client that
2400
+ // left while the handler ran gets no body either: its `close` has already
2401
+ // fired, so the loop below would wait on a drain that never comes.
2402
+ if (method === "HEAD" || response.body === null || res.destroyed) {
2402
2403
  if (response.body !== null) {
2403
2404
  void response.body.cancel().catch(() => { });
2404
2405
  }