@cursor/bdk 0.2.1 → 0.2.3

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 (336) hide show
  1. package/AGENTS.md +1 -1
  2. package/README.md +1 -6
  3. package/dist/artifacts.d.ts +5 -2
  4. package/dist/artifacts.d.ts.map +1 -1
  5. package/dist/artifacts.js +5 -2
  6. package/dist/bin/agent-serve.js +23 -7
  7. package/dist/channels/github/auth.d.ts.map +1 -1
  8. package/dist/channels/github/auth.js +36 -5
  9. package/dist/channels/slack/manifest.d.ts.map +1 -1
  10. package/dist/channels/slack/manifest.js +3 -2
  11. package/dist/channels/slack/types.d.ts +6 -1
  12. package/dist/channels/slack/types.d.ts.map +1 -1
  13. package/dist/connections.d.ts +1 -1
  14. package/dist/connections.js +1 -1
  15. package/dist/docs/404.html +2 -2
  16. package/dist/docs/assets/{app.JVQvbRO-.js → app.BOIHhrKi.js} +4 -4
  17. package/dist/docs/assets/chunks/@localSearchIndexroot.D5L-b34G.js +1 -0
  18. package/dist/docs/assets/chunks/{VPLocalSearchBox.BkhY63uW.js → VPLocalSearchBox.D49zVZqM.js} +1 -1
  19. package/dist/docs/assets/chunks/{arc.Cc1unYd3.js → arc.hmjb-sc4.js} +1 -1
  20. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CAY_TPVz.js → architectureDiagram-Q4EWVU46.CxEI1KqM.js} +1 -1
  21. package/dist/docs/assets/chunks/{baseUniq.my2VD3Xm.js → baseUniq.DHHvBWoV.js} +1 -1
  22. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.CQXAOmqd.js → blockDiagram-DXYQGD6D.DnXW-3bu.js} +1 -1
  23. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.D0AsQFSX.js → c4Diagram-AHTNJAMY.e-47O2jM.js} +1 -1
  24. package/dist/docs/assets/chunks/channel.BbOGaJQP.js +1 -0
  25. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.DZjhgNls.js → chunk-4BX2VUAB.3ry4pYXB.js} +1 -1
  26. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.qdcp_qbo.js → chunk-4TB4RGXK.DGIZFRx6.js} +1 -1
  27. package/dist/docs/assets/chunks/{chunk-55IACEB6.BHXoZhJ-.js → chunk-55IACEB6.DKBnqg9U.js} +1 -1
  28. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.Cds_Vwj3.js → chunk-EDXVE4YY.BIU8Ue5k.js} +1 -1
  29. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.CSl0HknT.js → chunk-FMBD7UC4.DP-TFhjI.js} +1 -1
  30. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.DJMvAt5N.js → chunk-OYMX7WX6.Ux0OYj5v.js} +1 -1
  31. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BYQzBK9D.js → chunk-QZHKN3VN.BzHMwYox.js} +1 -1
  32. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.BAvw7N4o.js → chunk-YZCP3GAM.D4OGAsSP.js} +1 -1
  33. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.Db58HCb1.js +1 -0
  34. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.Db58HCb1.js +1 -0
  35. package/dist/docs/assets/chunks/clone.Co4MBflG.js +1 -0
  36. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.Buf3seya.js → cose-bilkent-S5V4N54A.Jq_7BUNx.js} +1 -1
  37. package/dist/docs/assets/chunks/{dagre-KV5264BT.DMGGa3uA.js → dagre-KV5264BT.Di-skR2x.js} +1 -1
  38. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DDjnwRmY.js → diagram-5BDNPKRD.DeREHIdH.js} +1 -1
  39. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.RwyrIr8Q.js → diagram-G4DWMVQ6.C7Kcqxro.js} +1 -1
  40. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.DRvQV16Z.js → diagram-MMDJMWI5.BK3eohyo.js} +1 -1
  41. package/dist/docs/assets/chunks/{diagram-TYMM5635.Dw8W9BTk.js → diagram-TYMM5635.C6TyymXT.js} +1 -1
  42. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DQT1Hnwf.js → erDiagram-SMLLAGMA.DYGG-gGx.js} +1 -1
  43. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.6_Aky-ut.js → flowDiagram-DWJPFMVM.C9nBcSV4.js} +1 -1
  44. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DHIwqnqN.js → ganttDiagram-T4ZO3ILL.wAg_ymsp.js} +1 -1
  45. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.CGd_eJbn.js → gitGraphDiagram-UUTBAWPF.B87j9Oeg.js} +1 -1
  46. package/dist/docs/assets/chunks/{graph.ChMEylkh.js → graph.CuFMj31w.js} +1 -1
  47. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.Cd4gMyAz.js → infoDiagram-42DDH7IO.P_mLGumP.js} +1 -1
  48. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.D1uw7MXq.js → ishikawaDiagram-UXIWVN3A.DyuL_MsT.js} +1 -1
  49. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.AWLXtelc.js → journeyDiagram-VCZTEJTY.CtP09IoJ.js} +1 -1
  50. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.CagPhAn5.js → kanban-definition-6JOO6SKY.BoeSYPZo.js} +1 -1
  51. package/dist/docs/assets/chunks/{layout.ClTBBkE_.js → layout.B0lMMtNo.js} +1 -1
  52. package/dist/docs/assets/chunks/{linear.SwS2rOLA.js → linear.HxRBiAFX.js} +1 -1
  53. package/dist/docs/assets/chunks/{min.By_x-Btb.js → min.BGlFFHwS.js} +1 -1
  54. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.By_RAMaP.js → mindmap-definition-QFDTVHPH.JyLBD9M8.js} +1 -1
  55. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.DfAl9sy4.js → pieDiagram-DEJITSTG.DnSmNZF8.js} +1 -1
  56. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CNuqFRBj.js → quadrantDiagram-34T5L4WZ.CUCnbfCa.js} +1 -1
  57. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DJ5CmTCl.js → requirementDiagram-MS252O5E.py0IVUn5.js} +1 -1
  58. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.D-T_AKJj.js → sankeyDiagram-XADWPNL6.Bkc-HWYp.js} +1 -1
  59. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.BRn9WcrR.js → sequenceDiagram-FGHM5R23.Dqn8Mlv2.js} +1 -1
  60. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.F12urmm7.js → stateDiagram-FHFEXIEX.JikkoQUU.js} +1 -1
  61. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CMsKhrW0.js +1 -0
  62. package/dist/docs/assets/chunks/{theme.zK3OJa_C.js → theme.b6HQ6zG_.js} +2 -2
  63. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.B7GiQBeC.js → timeline-definition-GMOUNBTQ.BvpSXiBj.js} +1 -1
  64. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.D0niwuY_.js → vennDiagram-DHZGUBPP.CU7MVnZx.js} +1 -1
  65. package/dist/docs/assets/chunks/{wardley-RL74JXVD.1zhHNRsx.js → wardley-RL74JXVD.BKwC4ctG.js} +1 -1
  66. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.DKaqpT7K.js → wardleyDiagram-NUSXRM2D.BfaF6Uhe.js} +1 -1
  67. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.e8BPicch.js → xychartDiagram-5P7HB3ND.Bg5dcpj4.js} +1 -1
  68. package/dist/docs/assets/{deployment.md.nGo1yIsa.js → deployment.md.BJ8i7Q6p.js} +5 -8
  69. package/dist/docs/assets/{deployment.md.nGo1yIsa.lean.js → deployment.md.BJ8i7Q6p.lean.js} +1 -1
  70. package/dist/docs/assets/{guides_github.md.C2_DSWlE.js → guides_github.md.Bq9kQU9B.js} +9 -3
  71. package/dist/docs/assets/{guides_github.md.C2_DSWlE.lean.js → guides_github.md.Bq9kQU9B.lean.js} +1 -1
  72. package/dist/docs/assets/{guides_slack.md.ZbHQETOT.js → guides_slack.md.diqqXTTm.js} +2 -2
  73. package/dist/docs/assets/{guides_slack.md.ZbHQETOT.lean.js → guides_slack.md.diqqXTTm.lean.js} +1 -1
  74. package/dist/docs/assets/{quickstart.md.wG4shE1f.js → quickstart.md.CHpHPBUN.js} +5 -3
  75. package/dist/docs/assets/{quickstart.md.wG4shE1f.lean.js → quickstart.md.CHpHPBUN.lean.js} +1 -1
  76. package/dist/docs/assets/{reference_artifacts.md.IFFC5Zln.js → reference_artifacts.md.CQfKq8F2.js} +1 -1
  77. package/dist/docs/assets/reference_cli.md.DgeLTO18.js +91 -0
  78. package/dist/docs/assets/reference_cli.md.DgeLTO18.lean.js +1 -0
  79. package/dist/docs/assets/{reference_connections.md._XpKiOaF.js → reference_connections.md.COq--gAm.js} +7 -3
  80. package/dist/docs/assets/{reference_connections.md._XpKiOaF.lean.js → reference_connections.md.COq--gAm.lean.js} +1 -1
  81. package/dist/docs/assets/{reference_evals.md.DqNyHMA6.js → reference_evals.md.CJm3uCUm.js} +4 -4
  82. package/dist/docs/assets/{reference_evals.md.DqNyHMA6.lean.js → reference_evals.md.CJm3uCUm.lean.js} +1 -1
  83. package/dist/docs/assets/{reference_hooks.md.Dg3dEugd.js → reference_hooks.md.DbthhtIR.js} +1 -1
  84. package/dist/docs/assets/{reference_sessions.md.BtpTjZmh.js → reference_sessions.md.DeRUItHD.js} +1 -1
  85. package/dist/docs/assets/troubleshooting.md.Cw5PKa3t.js +1 -0
  86. package/dist/docs/assets/{troubleshooting.md.BzZSu1Gz.lean.js → troubleshooting.md.Cw5PKa3t.lean.js} +1 -1
  87. package/dist/docs/building-with-agents.html +35 -35
  88. package/dist/docs/deployment.html +40 -43
  89. package/dist/docs/deployment.md +45 -15
  90. package/dist/docs/evals.html +35 -35
  91. package/dist/docs/guides/agent-to-agent.html +35 -35
  92. package/dist/docs/guides/bitbucket.html +35 -35
  93. package/dist/docs/guides/cloud-agents.html +35 -35
  94. package/dist/docs/guides/convert-automation.html +35 -35
  95. package/dist/docs/guides/github.html +43 -37
  96. package/dist/docs/guides/github.md +34 -0
  97. package/dist/docs/guides/gitlab.html +35 -35
  98. package/dist/docs/guides/grokbot-agents.html +35 -35
  99. package/dist/docs/guides/hooks.html +35 -35
  100. package/dist/docs/guides/improve.html +35 -35
  101. package/dist/docs/guides/jev.html +35 -35
  102. package/dist/docs/guides/mcp-oauth.html +35 -35
  103. package/dist/docs/guides/opentelemetry.html +35 -35
  104. package/dist/docs/guides/slack.html +37 -37
  105. package/dist/docs/guides/slack.md +5 -0
  106. package/dist/docs/guides/webhooks.html +35 -35
  107. package/dist/docs/hashmap.json +1 -1
  108. package/dist/docs/hillclimbing.html +35 -35
  109. package/dist/docs/index.html +35 -35
  110. package/dist/docs/llms-full.txt +205 -97
  111. package/dist/docs/quickstart.html +40 -38
  112. package/dist/docs/quickstart.md +7 -1
  113. package/dist/docs/reference/agent-config.html +35 -35
  114. package/dist/docs/reference/artifacts.html +37 -37
  115. package/dist/docs/reference/artifacts.md +1 -1
  116. package/dist/docs/reference/channels.html +35 -35
  117. package/dist/docs/reference/cli.html +55 -61
  118. package/dist/docs/reference/cli.md +65 -63
  119. package/dist/docs/reference/connections.html +42 -38
  120. package/dist/docs/reference/connections.md +28 -2
  121. package/dist/docs/reference/evals.html +39 -39
  122. package/dist/docs/reference/evals.md +6 -7
  123. package/dist/docs/reference/extensions.html +35 -35
  124. package/dist/docs/reference/hooks.html +37 -37
  125. package/dist/docs/reference/hooks.md +3 -2
  126. package/dist/docs/reference/http-api.html +35 -35
  127. package/dist/docs/reference/instructions.html +35 -35
  128. package/dist/docs/reference/playground.html +35 -35
  129. package/dist/docs/reference/project-layout.html +35 -35
  130. package/dist/docs/reference/prompt.html +35 -35
  131. package/dist/docs/reference/schedules.html +35 -35
  132. package/dist/docs/reference/sessions.html +36 -36
  133. package/dist/docs/reference/sessions.md +4 -3
  134. package/dist/docs/reference/skills.html +35 -35
  135. package/dist/docs/reference/subagents.html +35 -35
  136. package/dist/docs/reference/tools.html +35 -35
  137. package/dist/docs/templates/agentic-owners.html +35 -35
  138. package/dist/docs/templates/security-reviewer.html +35 -35
  139. package/dist/docs/templates/thermo-quality-review.html +35 -35
  140. package/dist/docs/templates/thermo-review.html +35 -35
  141. package/dist/docs/templates/triage.html +35 -35
  142. package/dist/docs/troubleshooting.html +36 -36
  143. package/dist/docs/troubleshooting.md +7 -3
  144. package/dist/extensions/cursor-cloud-agents/extension.d.ts +16 -4
  145. package/dist/extensions/cursor-cloud-agents/extension.d.ts.map +1 -1
  146. package/dist/extensions/cursor-cloud-agents/extension.js +7 -3
  147. package/dist/extensions/cursor-cloud-agents/lib/channels.d.ts +3 -0
  148. package/dist/extensions/cursor-cloud-agents/lib/channels.d.ts.map +1 -0
  149. package/dist/extensions/cursor-cloud-agents/lib/channels.js +7 -0
  150. package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts +4 -2
  151. package/dist/extensions/cursor-cloud-agents/lib/repos.d.ts.map +1 -1
  152. package/dist/extensions/cursor-cloud-agents/lib/repos.js +21 -12
  153. package/dist/extensions/cursor-cloud-agents/tools/cancel.d.ts.map +1 -1
  154. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +2 -0
  155. package/dist/extensions/cursor-cloud-agents/tools/launch.d.ts.map +1 -1
  156. package/dist/extensions/cursor-cloud-agents/tools/launch.js +3 -1
  157. package/dist/extensions/cursor-cloud-agents/tools/reply.d.ts.map +1 -1
  158. package/dist/extensions/cursor-cloud-agents/tools/reply.js +2 -0
  159. package/dist/extensions/cursor-grokbot-agents/extension.d.ts +77 -0
  160. package/dist/extensions/cursor-grokbot-agents/extension.d.ts.map +1 -0
  161. package/dist/extensions/cursor-grokbot-agents/extension.js +63 -0
  162. package/dist/extensions/cursor-grokbot-agents/lib/agents.d.ts +11 -0
  163. package/dist/extensions/cursor-grokbot-agents/lib/agents.d.ts.map +1 -0
  164. package/dist/extensions/cursor-grokbot-agents/lib/agents.js +31 -0
  165. package/dist/extensions/cursor-grokbot-agents/lib/backend.d.ts +56 -0
  166. package/dist/extensions/cursor-grokbot-agents/lib/backend.d.ts.map +1 -0
  167. package/dist/extensions/cursor-grokbot-agents/lib/backend.js +158 -0
  168. package/dist/extensions/cursor-grokbot-agents/lib/contacts.d.ts +28 -0
  169. package/dist/extensions/cursor-grokbot-agents/lib/contacts.d.ts.map +1 -0
  170. package/dist/extensions/cursor-grokbot-agents/lib/contacts.js +59 -0
  171. package/dist/extensions/cursor-grokbot-agents/lib/conversation.d.ts +53 -0
  172. package/dist/extensions/cursor-grokbot-agents/lib/conversation.d.ts.map +1 -0
  173. package/dist/extensions/cursor-grokbot-agents/lib/conversation.js +206 -0
  174. package/dist/extensions/cursor-grokbot-agents/lib/inputs.d.ts +4 -0
  175. package/dist/extensions/cursor-grokbot-agents/lib/inputs.d.ts.map +1 -0
  176. package/dist/extensions/cursor-grokbot-agents/lib/inputs.js +15 -0
  177. package/dist/extensions/cursor-grokbot-agents/lib/lock.d.ts +12 -0
  178. package/dist/extensions/cursor-grokbot-agents/lib/lock.d.ts.map +1 -0
  179. package/dist/extensions/cursor-grokbot-agents/lib/lock.js +25 -0
  180. package/dist/extensions/cursor-grokbot-agents/skills/consult.md +40 -0
  181. package/dist/extensions/cursor-grokbot-agents/tools/ask.d.ts +4 -0
  182. package/dist/extensions/cursor-grokbot-agents/tools/ask.d.ts.map +1 -0
  183. package/dist/extensions/cursor-grokbot-agents/tools/ask.js +37 -0
  184. package/dist/extensions/cursor-grokbot-agents/tools/check.d.ts +4 -0
  185. package/dist/extensions/cursor-grokbot-agents/tools/check.d.ts.map +1 -0
  186. package/dist/extensions/cursor-grokbot-agents/tools/check.js +32 -0
  187. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.d.ts +4 -0
  188. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.d.ts.map +1 -0
  189. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.js +24 -0
  190. package/dist/extensions/cursor-grokbot-agents/tools/list.d.ts +4 -0
  191. package/dist/extensions/cursor-grokbot-agents/tools/list.d.ts.map +1 -0
  192. package/dist/extensions/cursor-grokbot-agents/tools/list.js +34 -0
  193. package/dist/files-backends/cursor-hosted.js +4 -4
  194. package/dist/internal/artifacts-store.d.ts +12 -2
  195. package/dist/internal/artifacts-store.d.ts.map +1 -1
  196. package/dist/internal/artifacts-store.js +8 -4
  197. package/dist/internal/cli-ax.d.ts +1 -0
  198. package/dist/internal/cli-ax.d.ts.map +1 -1
  199. package/dist/internal/cli-ax.js +43 -10
  200. package/dist/internal/cli-deploy.d.ts +5 -1
  201. package/dist/internal/cli-deploy.d.ts.map +1 -1
  202. package/dist/internal/cli-deploy.js +22 -4
  203. package/dist/internal/cli-mcp-oauth.d.ts.map +1 -1
  204. package/dist/internal/cli-mcp-oauth.js +2 -1
  205. package/dist/internal/cli-skills.d.ts +1 -1
  206. package/dist/internal/cli-skills.d.ts.map +1 -1
  207. package/dist/internal/cli-skills.js +5 -5
  208. package/dist/internal/connection-env.d.ts +31 -0
  209. package/dist/internal/connection-env.d.ts.map +1 -0
  210. package/dist/internal/connection-env.js +84 -0
  211. package/dist/internal/cursor/backend-client.js +5 -0
  212. package/dist/internal/deploy-client.d.ts +30 -6
  213. package/dist/internal/deploy-client.d.ts.map +1 -1
  214. package/dist/internal/deploy-client.js +45 -9
  215. package/dist/internal/discovery/connections.d.ts.map +1 -1
  216. package/dist/internal/discovery/connections.js +11 -0
  217. package/dist/internal/event-mapper.d.ts +46 -4
  218. package/dist/internal/event-mapper.d.ts.map +1 -1
  219. package/dist/internal/event-mapper.js +316 -25
  220. package/dist/internal/hosted-delivery-protocol.d.ts +36 -11
  221. package/dist/internal/hosted-delivery-protocol.d.ts.map +1 -1
  222. package/dist/internal/hosted-delivery-protocol.js +31 -8
  223. package/dist/internal/hosted-delivery.d.ts +2 -2
  224. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  225. package/dist/internal/hosted-delivery.js +229 -49
  226. package/dist/internal/hosting.d.ts +2 -2
  227. package/dist/internal/hosting.d.ts.map +1 -1
  228. package/dist/internal/hosting.js +9 -3
  229. package/dist/internal/install-cursor-skills.d.ts +20 -24
  230. package/dist/internal/install-cursor-skills.d.ts.map +1 -1
  231. package/dist/internal/install-cursor-skills.js +50 -48
  232. package/dist/internal/legacy-command-guard.d.ts +2 -0
  233. package/dist/internal/legacy-command-guard.d.ts.map +1 -1
  234. package/dist/internal/legacy-command-guard.js +10 -1
  235. package/dist/internal/mcp-host.d.ts +6 -0
  236. package/dist/internal/mcp-host.d.ts.map +1 -1
  237. package/dist/internal/mcp-host.js +35 -16
  238. package/dist/internal/sdk-runner.d.ts +2 -0
  239. package/dist/internal/sdk-runner.d.ts.map +1 -1
  240. package/dist/internal/sdk-runner.js +10 -0
  241. package/dist/internal/server.d.ts.map +1 -1
  242. package/dist/internal/server.js +11 -1
  243. package/dist/internal/session-engine.d.ts +1 -1
  244. package/dist/internal/session-engine.d.ts.map +1 -1
  245. package/dist/internal/session-engine.js +33 -8
  246. package/dist/playground/assets/index-6BbTPnaT.css +1 -0
  247. package/dist/playground/assets/{index-FFdUqTt_.js → index-CI7FAmOP.js} +43 -43
  248. package/dist/playground/index.html +2 -2
  249. package/dist/types.d.ts +50 -4
  250. package/dist/types.d.ts.map +1 -1
  251. package/docs/deployment.md +45 -15
  252. package/docs/guides/github.md +34 -0
  253. package/docs/guides/slack.md +5 -0
  254. package/docs/quickstart.md +7 -1
  255. package/docs/reference/artifacts.md +1 -1
  256. package/docs/reference/cli.md +65 -63
  257. package/docs/reference/connections.md +28 -2
  258. package/docs/reference/evals.md +6 -7
  259. package/docs/reference/hooks.md +3 -2
  260. package/docs/reference/sessions.md +4 -3
  261. package/docs/troubleshooting.md +7 -3
  262. package/package.json +2 -4
  263. package/scripts/install-cursor-skills.mjs +1 -1
  264. package/skills/create-agent/SKILL.md +1 -1
  265. package/skills/debug/SKILL.md +1 -1
  266. package/skills/deploy/SKILL.md +1 -1
  267. package/skills/evals/SKILL.md +1 -1
  268. package/skills/framework-map/SKILL.md +1 -1
  269. package/skills/github/SKILL.md +1 -1
  270. package/skills/hillclimb/SKILL.md +1 -1
  271. package/skills/mcp-auth/SKILL.md +1 -1
  272. package/skills/otel/SKILL.md +1 -1
  273. package/skills/setup-slack/SKILL.md +1 -1
  274. package/src/artifacts.ts +5 -2
  275. package/src/bin/agent-serve.ts +27 -6
  276. package/src/channels/github/auth.ts +44 -5
  277. package/src/channels/slack/manifest.ts +2 -1
  278. package/src/channels/slack/types.ts +6 -1
  279. package/src/connections.ts +1 -1
  280. package/src/extensions/cursor-cloud-agents/extension.ts +23 -6
  281. package/src/extensions/cursor-cloud-agents/lib/channels.ts +11 -0
  282. package/src/extensions/cursor-cloud-agents/lib/repos.ts +19 -7
  283. package/src/extensions/cursor-cloud-agents/tools/cancel.ts +2 -0
  284. package/src/extensions/cursor-cloud-agents/tools/launch.ts +3 -1
  285. package/src/extensions/cursor-cloud-agents/tools/reply.ts +2 -0
  286. package/src/extensions/cursor-grokbot-agents/extension.ts +132 -0
  287. package/src/extensions/cursor-grokbot-agents/lib/agents.ts +42 -0
  288. package/src/extensions/cursor-grokbot-agents/lib/backend.ts +208 -0
  289. package/src/extensions/cursor-grokbot-agents/lib/contacts.ts +74 -0
  290. package/src/extensions/cursor-grokbot-agents/lib/conversation.ts +260 -0
  291. package/src/extensions/cursor-grokbot-agents/lib/inputs.ts +21 -0
  292. package/src/extensions/cursor-grokbot-agents/lib/lock.ts +26 -0
  293. package/src/extensions/cursor-grokbot-agents/skills/consult.md +40 -0
  294. package/src/extensions/cursor-grokbot-agents/tools/ask.ts +32 -0
  295. package/src/extensions/cursor-grokbot-agents/tools/check.ts +25 -0
  296. package/src/extensions/cursor-grokbot-agents/tools/interrupt.ts +17 -0
  297. package/src/extensions/cursor-grokbot-agents/tools/list.ts +26 -0
  298. package/src/files-backends/cursor-hosted.ts +4 -4
  299. package/src/internal/artifacts-store.ts +14 -3
  300. package/src/internal/cli-ax.ts +52 -7
  301. package/src/internal/cli-deploy.ts +39 -6
  302. package/src/internal/cli-mcp-oauth.ts +2 -1
  303. package/src/internal/cli-skills.ts +4 -5
  304. package/src/internal/connection-env.ts +106 -0
  305. package/src/internal/cursor/backend-client.ts +6 -0
  306. package/src/internal/deploy-client.ts +79 -9
  307. package/src/internal/discovery/connections.ts +11 -0
  308. package/src/internal/event-mapper.ts +367 -36
  309. package/src/internal/hosted-delivery-protocol.ts +57 -20
  310. package/src/internal/hosted-delivery.ts +487 -229
  311. package/src/internal/hosting.ts +10 -3
  312. package/src/internal/install-cursor-skills.ts +56 -53
  313. package/src/internal/legacy-command-guard.ts +13 -1
  314. package/src/internal/mcp-host.ts +45 -17
  315. package/src/internal/sdk-runner.ts +11 -0
  316. package/src/internal/server.ts +13 -1
  317. package/src/internal/session-engine.ts +33 -13
  318. package/src/types.ts +56 -5
  319. package/templates/agents-md/bot/lib/collect.ts +1 -4
  320. package/templates/code-wiki/bot/channels/github.ts +2 -2
  321. package/templates/demo/bot/channels/github.ts +5 -1
  322. package/templates/pr-autofixer/bot/lib/start-drive.ts +4 -4
  323. package/templates/triage/bot/lib/types.ts +6 -6
  324. package/dist/docs/assets/chunks/@localSearchIndexroot.Caw9W1pM.js +0 -1
  325. package/dist/docs/assets/chunks/channel.Sapo9HJZ.js +0 -1
  326. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.NPiy3Hz7.js +0 -1
  327. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.NPiy3Hz7.js +0 -1
  328. package/dist/docs/assets/chunks/clone.zl2qolPE.js +0 -1
  329. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2._auCa3fR.js +0 -1
  330. package/dist/docs/assets/reference_cli.md.BK2QUH67.js +0 -97
  331. package/dist/docs/assets/reference_cli.md.BK2QUH67.lean.js +0 -1
  332. package/dist/docs/assets/troubleshooting.md.BzZSu1Gz.js +0 -1
  333. package/dist/playground/assets/index-BMV_IcEE.css +0 -1
  334. /package/dist/docs/assets/{reference_artifacts.md.IFFC5Zln.lean.js → reference_artifacts.md.CQfKq8F2.lean.js} +0 -0
  335. /package/dist/docs/assets/{reference_hooks.md.Dg3dEugd.lean.js → reference_hooks.md.DbthhtIR.lean.js} +0 -0
  336. /package/dist/docs/assets/{reference_sessions.md.BtpTjZmh.lean.js → reference_sessions.md.DeRUItHD.lean.js} +0 -0
@@ -3,14 +3,23 @@
3
3
  * `prUrl` per call, but the author's `cloud.repos` are the allowlist.
4
4
  * Model-chosen targets always require that allowlist: an unbound mount
5
5
  * (no `cloud.repos`) must not accept an arbitrary URL under the host API
6
- * key, with or without `envVars`.
6
+ * key, with or without `envVars`. A function allowlist is resolved on every
7
+ * call and always narrows the launch to one of its repositories.
7
8
  */
8
9
  import { parsePrUrl } from "../../../internal/scm/pr-url.js";
9
10
  export function launchRepos(target, cloud) {
10
- var _a, _b;
11
- var _c, _d, _e, _f, _g, _h;
12
- if (target.repo === undefined && target.ref === undefined && target.prUrl === undefined) {
13
- return cloud.repos;
11
+ var _a;
12
+ var _b, _c, _d, _e, _f;
13
+ const resolved = typeof cloud.repos === "function";
14
+ const allowlist = typeof cloud.repos === "function" ? cloud.repos() : cloud.repos;
15
+ if (resolved && (allowlist === null || allowlist === void 0 ? void 0 : allowlist.length) === 0) {
16
+ throw new Error("No repositories are available to cloud agents for this deployment.");
17
+ }
18
+ if (!resolved &&
19
+ target.repo === undefined &&
20
+ target.ref === undefined &&
21
+ target.prUrl === undefined) {
22
+ return allowlist;
14
23
  }
15
24
  const pr = target.prUrl === undefined ? undefined : parsePrUrl(target.prUrl);
16
25
  if (target.prUrl !== undefined && (pr === null || pr === void 0 ? void 0 : pr.provider) !== "github") {
@@ -18,8 +27,8 @@ export function launchRepos(target, cloud) {
18
27
  }
19
28
  const prRepo = pr === undefined ? undefined : `https://github.com/${pr.owner}/${pr.repo}`;
20
29
  // A lone `ref` needs exactly one configured repository to apply to.
21
- const configured = (_c = cloud.repos) !== null && _c !== void 0 ? _c : [];
22
- const url = (_e = (_d = target.repo) !== null && _d !== void 0 ? _d : prRepo) !== null && _e !== void 0 ? _e : (configured.length === 1 ? (_a = configured[0]) === null || _a === void 0 ? void 0 : _a.url : undefined);
30
+ const configured = allowlist !== null && allowlist !== void 0 ? allowlist : [];
31
+ const url = (_c = (_b = target.repo) !== null && _b !== void 0 ? _b : prRepo) !== null && _c !== void 0 ? _c : (configured.length === 1 ? (_a = configured[0]) === null || _a === void 0 ? void 0 : _a.url : undefined);
23
32
  if (url === undefined) {
24
33
  throw new Error(configured.length > 1
25
34
  ? "`repo` is required: this extension configures several repositories."
@@ -28,9 +37,9 @@ export function launchRepos(target, cloud) {
28
37
  if (prRepo !== undefined && repoKey(prRepo) !== repoKey(url)) {
29
38
  throw new Error(`prUrl ${target.prUrl} is not a pull request of ${url}.`);
30
39
  }
31
- const allowlisted = (_b = cloud.repos) === null || _b === void 0 ? void 0 : _b.some(configured => repoKey(configured.url) === repoKey(url));
40
+ const allowlisted = allowlist === null || allowlist === void 0 ? void 0 : allowlist.some(configured => repoKey(configured.url) === repoKey(url));
32
41
  if (allowlisted !== true) {
33
- throw new Error(cloud.repos === undefined
42
+ throw new Error(allowlist === undefined
34
43
  ? `Configure cloud.repos before launching against a model-chosen repository (${url}).`
35
44
  : `${url} is not one of this extension's configured repositories.`);
36
45
  }
@@ -40,9 +49,9 @@ export function launchRepos(target, cloud) {
40
49
  const match = configured.find(configuredRepo => repoKey(configuredRepo.url) === repoKey(url));
41
50
  return [
42
51
  {
43
- url: (_f = match === null || match === void 0 ? void 0 : match.url) !== null && _f !== void 0 ? _f : url,
44
- startingRef: (_g = target.ref) !== null && _g !== void 0 ? _g : match === null || match === void 0 ? void 0 : match.startingRef,
45
- prUrl: (_h = target.prUrl) !== null && _h !== void 0 ? _h : (target.ref !== undefined ? undefined : match === null || match === void 0 ? void 0 : match.prUrl),
52
+ url: (_d = match === null || match === void 0 ? void 0 : match.url) !== null && _d !== void 0 ? _d : url,
53
+ startingRef: (_e = target.ref) !== null && _e !== void 0 ? _e : match === null || match === void 0 ? void 0 : match.startingRef,
54
+ prUrl: (_f = target.prUrl) !== null && _f !== void 0 ? _f : (target.ref !== undefined ? undefined : match === null || match === void 0 ? void 0 : match.prUrl),
46
55
  },
47
56
  ];
48
57
  }
@@ -1 +1 @@
1
- {"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-cloud-agents/tools/cancel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAKxD,QAAA,MAAM,MAAM,EAAE,cAUZ,CAAC;eAEY,MAAM"}
1
+ {"version":3,"file":"cancel.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-cloud-agents/tools/cancel.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,QAAA,MAAM,MAAM,EAAE,cAWZ,CAAC;eAEY,MAAM"}
@@ -9,6 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  };
10
10
  import { defineTool } from "../../../tools.js";
11
11
  import { cloudAgentsBackend } from "../lib/backend.js";
12
+ import { assertWriteChannel } from "../lib/channels.js";
12
13
  import { assertOwned } from "../lib/fleet.js";
13
14
  import { agentRef } from "../lib/inputs.js";
14
15
  const cancel = defineTool({
@@ -17,6 +18,7 @@ const cancel = defineTool({
17
18
  inputSchema: agentRef,
18
19
  execute(input, ctx) {
19
20
  return __awaiter(this, void 0, void 0, function* () {
21
+ assertWriteChannel(ctx);
20
22
  yield assertOwned(ctx, input.agent_id);
21
23
  yield cloudAgentsBackend().pause(input.agent_id);
22
24
  return { agentId: input.agent_id, cancelled: true };
@@ -1 +1 @@
1
- {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-cloud-agents/tools/launch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,QAAA,MAAM,MAAM,EAAE,cAiDZ,CAAC;eAEY,MAAM"}
1
+ {"version":3,"file":"launch.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-cloud-agents/tools/launch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,QAAA,MAAM,MAAM,EAAE,cAkDZ,CAAC;eAEY,MAAM"}
@@ -11,6 +11,7 @@ import { z } from "zod";
11
11
  import { defineTool } from "../../../tools.js";
12
12
  import extension from "../extension.js";
13
13
  import { cloudAgentsBackend } from "../lib/backend.js";
14
+ import { assertWriteChannel } from "../lib/channels.js";
14
15
  import { recordLaunch } from "../lib/fleet.js";
15
16
  import { launchRepos } from "../lib/repos.js";
16
17
  const launch = defineTool({
@@ -26,7 +27,7 @@ const launch = defineTool({
26
27
  .string()
27
28
  .url()
28
29
  .optional()
29
- .describe("GitHub repository URL, one of the configured repositories. Defaults to the configured repository."),
30
+ .describe("Repository clone URL (GitHub or Origin), one of the configured repositories. Defaults to the configured repository when there is exactly one."),
30
31
  starting_ref: z
31
32
  .string()
32
33
  .optional()
@@ -44,6 +45,7 @@ const launch = defineTool({
44
45
  }),
45
46
  execute(input, ctx) {
46
47
  return __awaiter(this, void 0, void 0, function* () {
48
+ assertWriteChannel(ctx);
47
49
  const { cloud, model } = extension.config;
48
50
  const launched = yield cloudAgentsBackend().launch({
49
51
  prompt: input.prompt,
@@ -1 +1 @@
1
- {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-cloud-agents/tools/reply.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAMxD,QAAA,MAAM,KAAK,EAAE,cAuBX,CAAC;eAEY,KAAK"}
1
+ {"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-cloud-agents/tools/reply.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAOxD,QAAA,MAAM,KAAK,EAAE,cAwBX,CAAC;eAEY,KAAK"}
@@ -11,6 +11,7 @@ import { z } from "zod";
11
11
  import { defineTool } from "../../../tools.js";
12
12
  import extension from "../extension.js";
13
13
  import { cloudAgentsBackend } from "../lib/backend.js";
14
+ import { assertWriteChannel } from "../lib/channels.js";
14
15
  import { assertOwned } from "../lib/fleet.js";
15
16
  import { agentRef } from "../lib/inputs.js";
16
17
  const reply = defineTool({
@@ -26,6 +27,7 @@ const reply = defineTool({
26
27
  }),
27
28
  execute(input, ctx) {
28
29
  return __awaiter(this, void 0, void 0, function* () {
30
+ assertWriteChannel(ctx);
29
31
  yield assertOwned(ctx, input.agent_id);
30
32
  const { runId } = yield cloudAgentsBackend().followUp(input.agent_id, input.prompt, input.interrupt);
31
33
  return { agentId: input.agent_id, runId, queued: !input.interrupt };
@@ -0,0 +1,77 @@
1
+ /**
2
+ * Your Grok Bot agents as an extension. Mount it and the agent can talk to
3
+ * the Grok Bot agents of the host's account: send a message, read the
4
+ * reply, keep waiting on a long turn, interrupt one.
5
+ *
6
+ * ```ts
7
+ * // agent/extensions/grokbot.ts
8
+ * import cursorGrokBotAgents from "@cursor/bdk/extensions/cursor-grokbot-agents";
9
+ *
10
+ * export default cursorGrokBotAgents({
11
+ * agents: [
12
+ * { name: "Plan Keeper", description: "Keeps or moves outdoor plans." },
13
+ * ],
14
+ * });
15
+ * ```
16
+ *
17
+ * Contributes `grokbot__ask`, `grokbot__check`, `grokbot__interrupt`,
18
+ * `grokbot__list` and the `grokbot__consult` skill (the namespace is the
19
+ * mount filename), over the same public `/v0/grokbot` session API the
20
+ * grokbot runtime uses, under the serve host's Cursor API key
21
+ * (`CURSOR_API_KEY`, key file, or `login`). Agents are addressed by name and
22
+ * resolved on the account the key belongs to; a message lands in that
23
+ * account's own conversation with the agent, and the reply is what the agent
24
+ * sends back during that turn. The tools run on the serve host, so they
25
+ * need the local runtime.
26
+ *
27
+ * This is the other direction from `defineAgent({ runtime: "grokbot" })`:
28
+ * the runtime runs *this* agent's turns on the hosted Grok Bot harness; the
29
+ * extension keeps the agent where it is and lets it talk to *other* Grok
30
+ * Bot agents.
31
+ */
32
+ import type { Extension } from "../../types.js";
33
+ /**
34
+ * A Grok Bot agent the model may address, by the name shown in the app.
35
+ * Type alias, not an interface: `list` returns these.
36
+ */
37
+ export type ConfiguredGrokBotAgent = {
38
+ name: string;
39
+ /** What the agent is for; shown to the model by `list`. */
40
+ description?: string;
41
+ };
42
+ /** Mount options; every field is optional. */
43
+ export interface CursorGrokBotAgentsOptions {
44
+ /**
45
+ * The Grok Bot agents the model may talk to, by name. This is the
46
+ * allowlist for a call's own `agent`: names outside it are refused, and a
47
+ * lone configured agent is the default when a call names none. Without
48
+ * it, any name goes through and `needsApproval` defaults to true, since
49
+ * an unknown name creates an agent of that name on the account.
50
+ */
51
+ agents?: Array<string | ConfiguredGrokBotAgent>;
52
+ /**
53
+ * Park messages for a human approval. Defaults to `true` when no `agents`
54
+ * are configured; `false` once they are. Pass an explicit boolean to
55
+ * override. Configured names still bound the model's choice regardless.
56
+ */
57
+ needsApproval?: boolean;
58
+ /** Cursor API key. Defaults to the serve host's own key. */
59
+ apiKey?: string;
60
+ /**
61
+ * How often to read the agent's transcript while waiting for a reply, in
62
+ * milliseconds. Defaults to 750.
63
+ */
64
+ pollIntervalMs?: number;
65
+ }
66
+ /** {@link CursorGrokBotAgentsOptions} with defaults applied. */
67
+ export interface CursorGrokBotAgentsConfig {
68
+ agents?: ConfiguredGrokBotAgent[];
69
+ needsApproval: boolean;
70
+ apiKey?: string;
71
+ pollIntervalMs: number;
72
+ }
73
+ /** The backend's session name limit. */
74
+ export declare const AGENT_NAME_MAX_LENGTH = 255;
75
+ declare const cursorGrokBotAgents: Extension<CursorGrokBotAgentsConfig, CursorGrokBotAgentsOptions | undefined>;
76
+ export default cursorGrokBotAgents;
77
+ //# sourceMappingURL=extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../src/extensions/cursor-grokbot-agents/extension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAIH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;GAGG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,8CAA8C;AAC9C,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,sBAAsB,CAAC,CAAC;IAChD;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,gEAAgE;AAChE,MAAM,WAAW,yBAAyB;IACxC,MAAM,CAAC,EAAE,sBAAsB,EAAE,CAAC;IAClC,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,wCAAwC;AACxC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AA0CzC,QAAA,MAAM,mBAAmB,EAAE,SAAS,CAClC,yBAAyB,EACzB,0BAA0B,GAAG,SAAS,CAKtC,CAAC;eAEY,mBAAmB"}
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Your Grok Bot agents as an extension. Mount it and the agent can talk to
3
+ * the Grok Bot agents of the host's account: send a message, read the
4
+ * reply, keep waiting on a long turn, interrupt one.
5
+ *
6
+ * ```ts
7
+ * // agent/extensions/grokbot.ts
8
+ * import cursorGrokBotAgents from "@cursor/bdk/extensions/cursor-grokbot-agents";
9
+ *
10
+ * export default cursorGrokBotAgents({
11
+ * agents: [
12
+ * { name: "Plan Keeper", description: "Keeps or moves outdoor plans." },
13
+ * ],
14
+ * });
15
+ * ```
16
+ *
17
+ * Contributes `grokbot__ask`, `grokbot__check`, `grokbot__interrupt`,
18
+ * `grokbot__list` and the `grokbot__consult` skill (the namespace is the
19
+ * mount filename), over the same public `/v0/grokbot` session API the
20
+ * grokbot runtime uses, under the serve host's Cursor API key
21
+ * (`CURSOR_API_KEY`, key file, or `login`). Agents are addressed by name and
22
+ * resolved on the account the key belongs to; a message lands in that
23
+ * account's own conversation with the agent, and the reply is what the agent
24
+ * sends back during that turn. The tools run on the serve host, so they
25
+ * need the local runtime.
26
+ *
27
+ * This is the other direction from `defineAgent({ runtime: "grokbot" })`:
28
+ * the runtime runs *this* agent's turns on the hosted Grok Bot harness; the
29
+ * extension keeps the agent where it is and lets it talk to *other* Grok
30
+ * Bot agents.
31
+ */
32
+ import { z } from "zod";
33
+ import { defineExtension } from "../../extensions.js";
34
+ /** The backend's session name limit. */
35
+ export const AGENT_NAME_MAX_LENGTH = 255;
36
+ const DEFAULT_POLL_INTERVAL_MS = 750;
37
+ const agentName = z
38
+ .string()
39
+ .trim()
40
+ .min(1, "Grok Bot agent names must not be empty.")
41
+ .max(AGENT_NAME_MAX_LENGTH);
42
+ const configuredAgent = z
43
+ .union([agentName, z.object({ name: agentName, description: z.string().optional() })])
44
+ .transform(agent => (typeof agent === "string" ? { name: agent } : agent));
45
+ const agents = z
46
+ .array(configuredAgent)
47
+ .min(1, "agents must name at least one Grok Bot agent; omit it to allow any.")
48
+ .refine(list => new Set(list.map(agent => agent.name.toLowerCase())).size === list.length, "agents must not repeat a name (names match case-insensitively).");
49
+ const config = z
50
+ .object({
51
+ agents: agents.optional(),
52
+ needsApproval: z.boolean().optional(),
53
+ apiKey: z.string().optional(),
54
+ pollIntervalMs: z.number().int().min(1).default(DEFAULT_POLL_INTERVAL_MS),
55
+ })
56
+ .default({})
57
+ .transform(options => { var _a; return (Object.assign(Object.assign({}, options), { needsApproval: (_a = options.needsApproval) !== null && _a !== void 0 ? _a : options.agents === undefined })); });
58
+ const cursorGrokBotAgents = defineExtension({
59
+ root: import.meta.dirname,
60
+ description: "Talk to your Grok Bot agents and read their replies.",
61
+ config,
62
+ });
63
+ export default cursorGrokBotAgents;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Which Grok Bot agent a call addresses. The model names one per call, but
3
+ * the author's `agents` are the allowlist: with them configured, a name
4
+ * outside the list is refused (the backend would create an agent of that
5
+ * name), and a lone configured agent stands in when the call names none.
6
+ * Matching is case-insensitive and resolves to the configured spelling,
7
+ * since the backend looks names up exactly.
8
+ */
9
+ import type { ConfiguredGrokBotAgent } from "../extension.js";
10
+ export declare function resolveAgentName(requested: string | undefined, configured: ConfiguredGrokBotAgent[] | undefined): string;
11
+ //# sourceMappingURL=agents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-grokbot-agents/lib/agents.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE9D,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,UAAU,EAAE,sBAAsB,EAAE,GAAG,SAAS,GAC/C,MAAM,CA2BR"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Which Grok Bot agent a call addresses. The model names one per call, but
3
+ * the author's `agents` are the allowlist: with them configured, a name
4
+ * outside the list is refused (the backend would create an agent of that
5
+ * name), and a lone configured agent stands in when the call names none.
6
+ * Matching is case-insensitive and resolves to the configured spelling,
7
+ * since the backend looks names up exactly.
8
+ */
9
+ export function resolveAgentName(requested, configured) {
10
+ var _a;
11
+ const name = requested === null || requested === void 0 ? void 0 : requested.trim();
12
+ if (configured === undefined) {
13
+ if (name === undefined || name === "") {
14
+ throw new Error("`agent` is required: this extension has no configured Grok Bot agents.");
15
+ }
16
+ return name;
17
+ }
18
+ const names = configured.map(agent => `"${agent.name}"`).join(", ");
19
+ if (name === undefined || name === "") {
20
+ const only = configured.length === 1 ? configured[0] : undefined;
21
+ if (only === undefined) {
22
+ throw new Error(`\`agent\` is required: this extension configures several Grok Bot agents (${names}).`);
23
+ }
24
+ return only.name;
25
+ }
26
+ const match = (_a = configured.find(agent => agent.name === name)) !== null && _a !== void 0 ? _a : configured.find(agent => agent.name.toLowerCase() === name.toLowerCase());
27
+ if (match === undefined) {
28
+ throw new Error(`"${name}" is not one of this extension's configured Grok Bot agents (${names}).`);
29
+ }
30
+ return match.name;
31
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * The `/v0/grokbot` session API as the tools use it: the same four routes
3
+ * the grokbot runtime drives, on the external API host (`api.cursor.com`;
4
+ * they 404 on api2), under the host's Cursor API key. A session is a hosted
5
+ * Grok Bot agent of the key's account, get-or-created by name; messages go
6
+ * into its one conversation, and the transcript is read back as entries
7
+ * after a cursor, with the turn's status alongside.
8
+ */
9
+ export declare class GrokBotApiError extends Error {
10
+ readonly status?: number | undefined;
11
+ constructor(message: string, status?: number | undefined);
12
+ }
13
+ export type GrokBotSession = {
14
+ /** The hosted agent's durable id; every other route addresses it. */
15
+ sessionId: string;
16
+ /** The name as the backend stores it (trimmed). */
17
+ name: string;
18
+ createdAtMs: number;
19
+ /** Transcript tail: reading after it skips the conversation's history. */
20
+ latestUpdatedSeq: string;
21
+ };
22
+ export type GrokBotEntry = {
23
+ seq: string;
24
+ updatedSeq: string;
25
+ kind: string;
26
+ role?: string;
27
+ text?: string;
28
+ createdAtMs: number;
29
+ };
30
+ export type GrokBotTurnStatus = {
31
+ idle: boolean;
32
+ inFlight: boolean;
33
+ queued: number;
34
+ };
35
+ export type GrokBotEntriesPage = {
36
+ entries: GrokBotEntry[];
37
+ latestUpdatedSeq: string;
38
+ turn: GrokBotTurnStatus;
39
+ };
40
+ export declare class GrokBotAgentsBackend {
41
+ private readonly apiKey;
42
+ private readonly fetchImpl;
43
+ constructor(apiKey: () => string, fetchImpl?: typeof fetch);
44
+ /** `POST /v0/grokbot/sessions`: the account's agent of that name, created when missing. */
45
+ session(name: string): Promise<GrokBotSession>;
46
+ /** Deliver one user message to the agent's conversation. */
47
+ send(sessionId: string, text: string): Promise<void>;
48
+ /** Transcript entries after `afterUpdatedSeq`, oldest first, with the turn's status. */
49
+ entries(sessionId: string, afterUpdatedSeq: string): Promise<GrokBotEntriesPage>;
50
+ interrupt(sessionId: string, reason: string): Promise<void>;
51
+ private request;
52
+ }
53
+ /** The process-wide backend for this mount, built on first use. */
54
+ export declare function grokBotAgentsBackend(): GrokBotAgentsBackend;
55
+ export declare function apiKey(): string;
56
+ //# sourceMappingURL=backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backend.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-grokbot-agents/lib/backend.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAaH,qBAAa,eAAgB,SAAQ,KAAK;IAGtC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;IAF1B,YACE,OAAO,EAAE,MAAM,EACN,MAAM,CAAC,EAAE,MAAM,YAAA,EAIzB;CACF;AAGD,MAAM,MAAM,cAAc,GAAG;IAC3B,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,0EAA0E;IAC1E,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,YAAY,EAAE,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,iBAAiB,CAAC;CACzB,CAAC;AAiCF,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAF5B,YACmB,MAAM,EAAE,MAAM,MAAM,EACpB,SAAS,GAAE,OAAO,KAAa,EAC9C;IAEJ,2FAA2F;IACrF,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAYnD;IAED,4DAA4D;IACtD,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAYzD;IAED,wFAAwF;IAClF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAOrF;IAEK,SAAS,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhE;YAEa,OAAO;CA+BtB;AAID,mEAAmE;AACnE,wBAAgB,oBAAoB,IAAI,oBAAoB,CAG3D;AAED,wBAAgB,MAAM,IAAI,MAAM,CAO/B"}
@@ -0,0 +1,158 @@
1
+ /**
2
+ * The `/v0/grokbot` session API as the tools use it: the same four routes
3
+ * the grokbot runtime drives, on the external API host (`api.cursor.com`;
4
+ * they 404 on api2), under the host's Cursor API key. A session is a hosted
5
+ * Grok Bot agent of the key's account, get-or-created by name; messages go
6
+ * into its one conversation, and the transcript is read back as entries
7
+ * after a cursor, with the turn's status alongside.
8
+ */
9
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11
+ return new (P || (P = Promise))(function (resolve, reject) {
12
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
16
+ });
17
+ };
18
+ import { randomUUID } from "node:crypto";
19
+ import { z } from "zod";
20
+ import { cursorExternalApiUrl, resolveApiKeySync, SIGN_IN_HINT, } from "../../../internal/cursor/credentials.js";
21
+ import extension from "../extension.js";
22
+ const REQUEST_TIMEOUT_MS = 60000;
23
+ export class GrokBotApiError extends Error {
24
+ constructor(message, status) {
25
+ super(message);
26
+ this.status = status;
27
+ this.name = "GrokBotApiError";
28
+ }
29
+ }
30
+ const sessionSchema = z.object({
31
+ id: z.string(),
32
+ name: z.string(),
33
+ createdAtMs: z.number(),
34
+ latestUpdatedSeq: z.string(),
35
+ });
36
+ const sendSchema = z.object({
37
+ messageId: z.string(),
38
+ delivery: z.string(),
39
+ });
40
+ const entriesSchema = z.object({
41
+ entries: z.array(z.object({
42
+ seq: z.string(),
43
+ updatedSeq: z.string(),
44
+ kind: z.string(),
45
+ role: z.string().optional(),
46
+ text: z.string().optional(),
47
+ createdAtMs: z.number(),
48
+ })),
49
+ latestUpdatedSeq: z.string(),
50
+ turn: z.object({
51
+ idle: z.boolean(),
52
+ inFlight: z.boolean(),
53
+ queued: z.number(),
54
+ }),
55
+ });
56
+ export class GrokBotAgentsBackend {
57
+ constructor(apiKey, fetchImpl = fetch) {
58
+ this.apiKey = apiKey;
59
+ this.fetchImpl = fetchImpl;
60
+ }
61
+ /** `POST /v0/grokbot/sessions`: the account's agent of that name, created when missing. */
62
+ session(name) {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ // No `instructions`: the agent is somebody's, configured in the app, and
65
+ // an omitted field never touches its stored profile.
66
+ const parsed = sessionSchema.parse(yield this.request("POST", "/v0/grokbot/sessions", { name }));
67
+ return {
68
+ sessionId: parsed.id,
69
+ name: parsed.name,
70
+ createdAtMs: parsed.createdAtMs,
71
+ latestUpdatedSeq: parsed.latestUpdatedSeq,
72
+ };
73
+ });
74
+ }
75
+ /** Deliver one user message to the agent's conversation. */
76
+ send(sessionId, text) {
77
+ return __awaiter(this, void 0, void 0, function* () {
78
+ const { delivery } = sendSchema.parse(yield this.request("POST", `/v0/grokbot/sessions/${sessionId}/messages`, {
79
+ text,
80
+ messageId: randomUUID(),
81
+ }));
82
+ if (delivery !== "accepted_temporal" && delivery !== "duplicate") {
83
+ throw new GrokBotApiError(`The Grok Bot agent's harness did not accept the message (delivery: ${delivery}).`);
84
+ }
85
+ });
86
+ }
87
+ /** Transcript entries after `afterUpdatedSeq`, oldest first, with the turn's status. */
88
+ entries(sessionId, afterUpdatedSeq) {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ return entriesSchema.parse(yield this.request("GET", `/v0/grokbot/sessions/${sessionId}/entries?afterUpdatedSeq=${encodeURIComponent(afterUpdatedSeq)}`));
91
+ });
92
+ }
93
+ interrupt(sessionId, reason) {
94
+ return __awaiter(this, void 0, void 0, function* () {
95
+ yield this.request("POST", `/v0/grokbot/sessions/${sessionId}/interrupt`, {
96
+ reason,
97
+ });
98
+ });
99
+ }
100
+ request(method, path, body) {
101
+ return __awaiter(this, void 0, void 0, function* () {
102
+ const headers = {
103
+ authorization: `Bearer ${this.apiKey()}`,
104
+ "x-cursor-client-type": "agent-serve",
105
+ "x-request-id": randomUUID(),
106
+ };
107
+ if (body !== undefined) {
108
+ headers["content-type"] = "application/json";
109
+ }
110
+ let response;
111
+ try {
112
+ response = yield this.fetchImpl(`${cursorExternalApiUrl()}${path}`, {
113
+ method,
114
+ headers,
115
+ body: body === undefined ? undefined : JSON.stringify(body),
116
+ signal: AbortSignal.timeout(REQUEST_TIMEOUT_MS),
117
+ });
118
+ }
119
+ catch (error) {
120
+ throw new GrokBotApiError(`Grok Bot API ${method} ${path} failed: ${error instanceof Error ? error.message : String(error)}`);
121
+ }
122
+ const text = yield response.text();
123
+ if (!response.ok) {
124
+ throw new GrokBotApiError(`Grok Bot API ${method} ${path} failed (${response.status}): ${apiErrorMessage(text)}`, response.status);
125
+ }
126
+ return JSON.parse(text);
127
+ });
128
+ }
129
+ }
130
+ let backend;
131
+ /** The process-wide backend for this mount, built on first use. */
132
+ export function grokBotAgentsBackend() {
133
+ backend !== null && backend !== void 0 ? backend : (backend = new GrokBotAgentsBackend(apiKey));
134
+ return backend;
135
+ }
136
+ export function apiKey() {
137
+ // Read per call: the host can sign in after the mount.
138
+ const key = resolveApiKeySync({ apiKey: extension.config.apiKey });
139
+ if (key === undefined) {
140
+ throw new Error(`Grok Bot agents need a Cursor API key. ${SIGN_IN_HINT}`);
141
+ }
142
+ return key.apiKey;
143
+ }
144
+ /** The route's `{ error }` envelope when it is one, the raw body otherwise. */
145
+ function apiErrorMessage(text) {
146
+ var _a;
147
+ try {
148
+ const parsed = JSON.parse(text);
149
+ const message = (_a = parsed.error) !== null && _a !== void 0 ? _a : parsed.message;
150
+ if (typeof message === "string" && message !== "") {
151
+ return message;
152
+ }
153
+ }
154
+ catch (_b) {
155
+ // Not JSON; fall through to the raw body.
156
+ }
157
+ return text.slice(0, 300);
158
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Who has talked to which Grok Bot agent, and how far into its transcript
3
+ * they have read. The tools authenticate with the serve host's one Cursor
4
+ * API key, so every agent is that account's; what the host keeps per
5
+ * principal is the read cursor, so `check` returns what the agent said
6
+ * since that caller last read, and a lookup by name for `check` and
7
+ * `interrupt`, which never create an agent the caller has not spoken to.
8
+ */
9
+ import type { ToolContext } from "../../../types.js";
10
+ export type Contact = {
11
+ /** The agent's name as the backend stores it. */
12
+ name: string;
13
+ /** The hosted agent's `/v0/grokbot` session id. */
14
+ sessionId: string;
15
+ /** Newest transcript `updatedSeq` this principal has read. */
16
+ cursor: string;
17
+ firstContactAt: string;
18
+ lastContactAt: string;
19
+ };
20
+ /** Unauthenticated sessions (local dev, direct calls) share one principal. */
21
+ export declare function principalOf(ctx: ToolContext): string;
22
+ /** The caller's contacts, most recently spoken to first. */
23
+ export declare function listContacts(ctx: ToolContext): Promise<Contact[]>;
24
+ /** The contact of that name, exact spelling first, then case-insensitively. */
25
+ export declare function findContact(contacts: Contact[], name: string): Contact | undefined;
26
+ /** Insert or replace the caller's record of one agent, newest first. */
27
+ export declare function saveContact(ctx: ToolContext, contact: Contact): Promise<void>;
28
+ //# sourceMappingURL=contacts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contacts.d.ts","sourceRoot":"","sources":["../../../../src/extensions/cursor-grokbot-agents/lib/contacts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD,MAAM,MAAM,OAAO,GAAG;IACpB,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAcF,8EAA8E;AAC9E,wBAAgB,WAAW,CAAC,GAAG,EAAE,WAAW,GAAG,MAAM,CAGpD;AAED,4DAA4D;AAC5D,wBAAsB,YAAY,CAAC,GAAG,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAGvE;AAED,+EAA+E;AAC/E,wBAAgB,WAAW,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAMlF;AAED,wEAAwE;AACxE,wBAAsB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQnF"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Who has talked to which Grok Bot agent, and how far into its transcript
3
+ * they have read. The tools authenticate with the serve host's one Cursor
4
+ * API key, so every agent is that account's; what the host keeps per
5
+ * principal is the read cursor, so `check` returns what the agent said
6
+ * since that caller last read, and a lookup by name for `check` and
7
+ * `interrupt`, which never create an agent the caller has not spoken to.
8
+ */
9
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11
+ return new (P || (P = Promise))(function (resolve, reject) {
12
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
16
+ });
17
+ };
18
+ import { z } from "zod";
19
+ import { KeyedLock } from "./lock.js";
20
+ const PREFIX = "grokbot-agents";
21
+ const contactsSchema = z.array(z.object({
22
+ name: z.string(),
23
+ sessionId: z.string(),
24
+ cursor: z.string(),
25
+ firstContactAt: z.string(),
26
+ lastContactAt: z.string(),
27
+ }));
28
+ const locks = new KeyedLock();
29
+ /** Unauthenticated sessions (local dev, direct calls) share one principal. */
30
+ export function principalOf(ctx) {
31
+ const auth = ctx.session.auth;
32
+ return auth === null ? "anonymous" : `${auth.principalType}:${auth.principalId}`;
33
+ }
34
+ /** The caller's contacts, most recently spoken to first. */
35
+ export function listContacts(ctx) {
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const contacts = contactsSchema.safeParse(yield ctx.host.kv.get(contactsKey(principalOf(ctx))));
38
+ return contacts.success ? contacts.data : [];
39
+ });
40
+ }
41
+ /** The contact of that name, exact spelling first, then case-insensitively. */
42
+ export function findContact(contacts, name) {
43
+ var _a;
44
+ const wanted = name.trim();
45
+ return ((_a = contacts.find(contact => contact.name === wanted)) !== null && _a !== void 0 ? _a : contacts.find(contact => contact.name.toLowerCase() === wanted.toLowerCase()));
46
+ }
47
+ /** Insert or replace the caller's record of one agent, newest first. */
48
+ export function saveContact(ctx, contact) {
49
+ return __awaiter(this, void 0, void 0, function* () {
50
+ const key = contactsKey(principalOf(ctx));
51
+ yield locks.run(key, () => __awaiter(this, void 0, void 0, function* () {
52
+ const others = (yield listContacts(ctx)).filter(existing => existing.sessionId !== contact.sessionId);
53
+ yield ctx.host.kv.put(key, [contact, ...others]);
54
+ }));
55
+ });
56
+ }
57
+ function contactsKey(principal) {
58
+ return `${PREFIX}/principals/${encodeURIComponent(principal)}`;
59
+ }