@cursor/bdk 0.2.3 → 0.2.4

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 (577) hide show
  1. package/dist/bin/agent-serve.js +9 -1
  2. package/dist/channels/slack/attachments.d.ts +2 -1
  3. package/dist/channels/slack/attachments.d.ts.map +1 -1
  4. package/dist/channels/slack/attachments.js +19 -9
  5. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  6. package/dist/channels/slack/dispatch.js +26 -24
  7. package/dist/channels/slack/thread-context.d.ts +21 -11
  8. package/dist/channels/slack/thread-context.d.ts.map +1 -1
  9. package/dist/channels/slack/thread-context.js +75 -27
  10. package/dist/docs/404.html +2 -2
  11. package/dist/docs/assets/{app.BOIHhrKi.js → app.4kQ8Db_q.js} +4 -4
  12. package/dist/docs/assets/chunks/@localSearchIndexroot.CvuAJ0My.js +1 -0
  13. package/dist/docs/assets/chunks/{VPLocalSearchBox.D49zVZqM.js → VPLocalSearchBox.DY1RwB8Q.js} +1 -1
  14. package/dist/docs/assets/chunks/{arc.hmjb-sc4.js → arc.CxE_fSPK.js} +1 -1
  15. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.CxEI1KqM.js → architectureDiagram-Q4EWVU46.CPX426ui.js} +1 -1
  16. package/dist/docs/assets/chunks/{baseUniq.DHHvBWoV.js → baseUniq.CB52JrKG.js} +1 -1
  17. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.DnXW-3bu.js → blockDiagram-DXYQGD6D.J0cNaQCL.js} +1 -1
  18. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.e-47O2jM.js → c4Diagram-AHTNJAMY.DJn3vEGT.js} +1 -1
  19. package/dist/docs/assets/chunks/channel.BoNycAoN.js +1 -0
  20. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.3ry4pYXB.js → chunk-4BX2VUAB.Dao618F6.js} +1 -1
  21. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.DGIZFRx6.js → chunk-4TB4RGXK.QW8Rhjai.js} +1 -1
  22. package/dist/docs/assets/chunks/{chunk-55IACEB6.DKBnqg9U.js → chunk-55IACEB6.DfRLLKF_.js} +1 -1
  23. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.BIU8Ue5k.js → chunk-EDXVE4YY.CIV2ApKQ.js} +1 -1
  24. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.DP-TFhjI.js → chunk-FMBD7UC4.BEheSuxp.js} +1 -1
  25. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.Ux0OYj5v.js → chunk-OYMX7WX6.CUN88ENB.js} +1 -1
  26. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BzHMwYox.js → chunk-QZHKN3VN.CgqCs8b_.js} +1 -1
  27. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.D4OGAsSP.js → chunk-YZCP3GAM.iCH0nnTJ.js} +1 -1
  28. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.C4x07Gkj.js +1 -0
  29. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.C4x07Gkj.js +1 -0
  30. package/dist/docs/assets/chunks/clone.Db22cH_-.js +1 -0
  31. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.Jq_7BUNx.js → cose-bilkent-S5V4N54A.BLcUxhWE.js} +1 -1
  32. package/dist/docs/assets/chunks/{dagre-KV5264BT.Di-skR2x.js → dagre-KV5264BT.Ep7LofOm.js} +1 -1
  33. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.DeREHIdH.js → diagram-5BDNPKRD.Bzf4GSQ4.js} +1 -1
  34. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.C7Kcqxro.js → diagram-G4DWMVQ6.DD6Jh-eM.js} +1 -1
  35. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.BK3eohyo.js → diagram-MMDJMWI5.oOIl8bWd.js} +1 -1
  36. package/dist/docs/assets/chunks/{diagram-TYMM5635.C6TyymXT.js → diagram-TYMM5635.DHs85Ade.js} +1 -1
  37. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.DYGG-gGx.js → erDiagram-SMLLAGMA.BIb5ghCk.js} +1 -1
  38. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.C9nBcSV4.js → flowDiagram-DWJPFMVM.DV4paY9k.js} +1 -1
  39. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.wAg_ymsp.js → ganttDiagram-T4ZO3ILL.AyEKA6_v.js} +1 -1
  40. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.B87j9Oeg.js → gitGraphDiagram-UUTBAWPF.BltiCDFo.js} +1 -1
  41. package/dist/docs/assets/chunks/{graph.CuFMj31w.js → graph.DzuEYGdC.js} +1 -1
  42. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.P_mLGumP.js → infoDiagram-42DDH7IO.BV2l981J.js} +1 -1
  43. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.DyuL_MsT.js → ishikawaDiagram-UXIWVN3A.BA4Izf-m.js} +1 -1
  44. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.CtP09IoJ.js → journeyDiagram-VCZTEJTY.DjaFbFS3.js} +1 -1
  45. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.BoeSYPZo.js → kanban-definition-6JOO6SKY.CfTFieDs.js} +1 -1
  46. package/dist/docs/assets/chunks/{layout.B0lMMtNo.js → layout.DzfWqTBV.js} +1 -1
  47. package/dist/docs/assets/chunks/{linear.HxRBiAFX.js → linear.BO6mpulV.js} +1 -1
  48. package/dist/docs/assets/chunks/{min.BGlFFHwS.js → min.BGgTadgT.js} +1 -1
  49. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.JyLBD9M8.js → mindmap-definition-QFDTVHPH.DPuIXVWY.js} +1 -1
  50. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.DnSmNZF8.js → pieDiagram-DEJITSTG.BOnl3bBg.js} +1 -1
  51. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.CUCnbfCa.js → quadrantDiagram-34T5L4WZ.DNB6Ckdc.js} +1 -1
  52. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.py0IVUn5.js → requirementDiagram-MS252O5E.D5-Qo7vb.js} +1 -1
  53. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.Bkc-HWYp.js → sankeyDiagram-XADWPNL6.8t65cesf.js} +1 -1
  54. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.Dqn8Mlv2.js → sequenceDiagram-FGHM5R23.CaG07BdS.js} +1 -1
  55. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.JikkoQUU.js → stateDiagram-FHFEXIEX.TKOweTB6.js} +1 -1
  56. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CuqmyQc4.js +1 -0
  57. package/dist/docs/assets/chunks/{theme.b6HQ6zG_.js → theme.Dx-JhpTB.js} +2 -2
  58. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.BvpSXiBj.js → timeline-definition-GMOUNBTQ.fE53zQ2s.js} +1 -1
  59. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CU7MVnZx.js → vennDiagram-DHZGUBPP.DJsZZaJg.js} +1 -1
  60. package/dist/docs/assets/chunks/{wardley-RL74JXVD.BKwC4ctG.js → wardley-RL74JXVD.844kyrjl.js} +1 -1
  61. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.BfaF6Uhe.js → wardleyDiagram-NUSXRM2D.CMZ-Ru_t.js} +1 -1
  62. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.Bg5dcpj4.js → xychartDiagram-5P7HB3ND.XXrhBc7a.js} +1 -1
  63. package/dist/docs/assets/{deployment.md.BJ8i7Q6p.js → deployment.md.UhnJIMr-.js} +2 -2
  64. package/dist/docs/assets/{deployment.md.BJ8i7Q6p.lean.js → deployment.md.UhnJIMr-.lean.js} +1 -1
  65. package/dist/docs/assets/{guides_jev.md.BNDm14Gy.js → guides_jev.md.CRcgmjDb.js} +2 -2
  66. package/dist/docs/assets/{guides_jev.md.BNDm14Gy.lean.js → guides_jev.md.CRcgmjDb.lean.js} +1 -1
  67. package/dist/docs/assets/{reference_agent-config.md.DzGI777n.js → reference_agent-config.md.Cj5uBKp4.js} +1 -1
  68. package/dist/docs/assets/{reference_extensions.md.CPPrkWlJ.js → reference_extensions.md.pa2tN-e4.js} +4 -3
  69. package/dist/docs/assets/{reference_extensions.md.CPPrkWlJ.lean.js → reference_extensions.md.pa2tN-e4.lean.js} +1 -1
  70. package/dist/docs/building-with-agents.html +35 -35
  71. package/dist/docs/deployment.html +37 -37
  72. package/dist/docs/deployment.md +4 -1
  73. package/dist/docs/evals.html +35 -35
  74. package/dist/docs/guides/agent-to-agent.html +35 -35
  75. package/dist/docs/guides/bitbucket.html +35 -35
  76. package/dist/docs/guides/cloud-agents.html +35 -35
  77. package/dist/docs/guides/convert-automation.html +35 -35
  78. package/dist/docs/guides/github.html +35 -35
  79. package/dist/docs/guides/gitlab.html +35 -35
  80. package/dist/docs/guides/grokbot-agents.html +35 -35
  81. package/dist/docs/guides/hooks.html +35 -35
  82. package/dist/docs/guides/improve.html +35 -35
  83. package/dist/docs/guides/jev.html +37 -37
  84. package/dist/docs/guides/jev.md +7 -0
  85. package/dist/docs/guides/mcp-oauth.html +35 -35
  86. package/dist/docs/guides/opentelemetry.html +35 -35
  87. package/dist/docs/guides/slack.html +35 -35
  88. package/dist/docs/guides/webhooks.html +35 -35
  89. package/dist/docs/hashmap.json +1 -1
  90. package/dist/docs/hillclimbing.html +35 -35
  91. package/dist/docs/index.html +35 -35
  92. package/dist/docs/llms-full.txt +25 -2
  93. package/dist/docs/quickstart.html +35 -35
  94. package/dist/docs/reference/agent-config.html +37 -37
  95. package/dist/docs/reference/agent-config.md +1 -1
  96. package/dist/docs/reference/artifacts.html +35 -35
  97. package/dist/docs/reference/channels.html +35 -35
  98. package/dist/docs/reference/cli.html +35 -35
  99. package/dist/docs/reference/connections.html +35 -35
  100. package/dist/docs/reference/evals.html +35 -35
  101. package/dist/docs/reference/extensions.html +39 -38
  102. package/dist/docs/reference/extensions.md +13 -0
  103. package/dist/docs/reference/hooks.html +35 -35
  104. package/dist/docs/reference/http-api.html +35 -35
  105. package/dist/docs/reference/instructions.html +35 -35
  106. package/dist/docs/reference/playground.html +35 -35
  107. package/dist/docs/reference/project-layout.html +35 -35
  108. package/dist/docs/reference/prompt.html +35 -35
  109. package/dist/docs/reference/schedules.html +35 -35
  110. package/dist/docs/reference/sessions.html +35 -35
  111. package/dist/docs/reference/skills.html +35 -35
  112. package/dist/docs/reference/subagents.html +35 -35
  113. package/dist/docs/reference/tools.html +35 -35
  114. package/dist/docs/templates/agentic-owners.html +35 -35
  115. package/dist/docs/templates/security-reviewer.html +35 -35
  116. package/dist/docs/templates/thermo-quality-review.html +35 -35
  117. package/dist/docs/templates/thermo-review.html +35 -35
  118. package/dist/docs/templates/triage.html +35 -35
  119. package/dist/docs/troubleshooting.html +35 -35
  120. package/dist/extensions/jev/extension.d.ts +3 -0
  121. package/dist/extensions/jev/extension.d.ts.map +1 -1
  122. package/dist/extensions/jev/extension.js +10 -1
  123. package/dist/extensions/jev/lib/evaluate.d.ts +4 -0
  124. package/dist/extensions/jev/lib/evaluate.d.ts.map +1 -1
  125. package/dist/extensions/jev/lib/evaluate.js +6 -2
  126. package/dist/extensions.d.ts +4 -2
  127. package/dist/extensions.d.ts.map +1 -1
  128. package/dist/extensions.js +5 -2
  129. package/dist/internal/cli-deploy.d.ts.map +1 -1
  130. package/dist/internal/cli-deploy.js +19 -5
  131. package/dist/internal/discovery/agent-config.d.ts +6 -5
  132. package/dist/internal/discovery/agent-config.d.ts.map +1 -1
  133. package/dist/internal/discovery/agent-config.js +29 -28
  134. package/dist/internal/discovery/agent.js +1 -1
  135. package/dist/internal/discovery/extensions.d.ts.map +1 -1
  136. package/dist/internal/discovery/extensions.js +12 -0
  137. package/dist/internal/hosting.d.ts +8 -0
  138. package/dist/internal/hosting.d.ts.map +1 -1
  139. package/dist/internal/hosting.js +24 -0
  140. package/dist/types.d.ts +18 -2
  141. package/dist/types.d.ts.map +1 -1
  142. package/docs/deployment.md +4 -1
  143. package/docs/guides/jev.md +7 -0
  144. package/docs/reference/agent-config.md +1 -1
  145. package/docs/reference/extensions.md +13 -0
  146. package/package.json +1 -9
  147. package/dist/docs/assets/chunks/@localSearchIndexroot.D5L-b34G.js +0 -1
  148. package/dist/docs/assets/chunks/channel.BbOGaJQP.js +0 -1
  149. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.Db58HCb1.js +0 -1
  150. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.Db58HCb1.js +0 -1
  151. package/dist/docs/assets/chunks/clone.Co4MBflG.js +0 -1
  152. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.CMsKhrW0.js +0 -1
  153. package/src/artifacts.ts +0 -68
  154. package/src/bin/agent-serve.ts +0 -1854
  155. package/src/channels/bitbucket/api.ts +0 -891
  156. package/src/channels/bitbucket/binding.ts +0 -417
  157. package/src/channels/bitbucket/bitbucket-channel.ts +0 -162
  158. package/src/channels/bitbucket/bitbucket-webhook.ts +0 -519
  159. package/src/channels/bitbucket/checks.ts +0 -146
  160. package/src/channels/bitbucket/cursor-account.ts +0 -106
  161. package/src/channels/bitbucket/defaults.ts +0 -100
  162. package/src/channels/bitbucket/events.ts +0 -74
  163. package/src/channels/bitbucket/index.ts +0 -51
  164. package/src/channels/bitbucket/replay.ts +0 -421
  165. package/src/channels/bitbucket/state.ts +0 -59
  166. package/src/channels/bitbucket/types.ts +0 -261
  167. package/src/channels/change-monitors/change-monitors-channel.ts +0 -63
  168. package/src/channels/change-monitors/index.ts +0 -8
  169. package/src/channels/change-monitors/types.ts +0 -42
  170. package/src/channels/checks.ts +0 -185
  171. package/src/channels/deployments/deployments-channel.ts +0 -224
  172. package/src/channels/deployments/index.ts +0 -25
  173. package/src/channels/deployments/types.ts +0 -92
  174. package/src/channels/github/api.ts +0 -526
  175. package/src/channels/github/auth.ts +0 -293
  176. package/src/channels/github/binding.ts +0 -233
  177. package/src/channels/github/checks.ts +0 -145
  178. package/src/channels/github/cursor-account.ts +0 -303
  179. package/src/channels/github/defaults.ts +0 -168
  180. package/src/channels/github/events.ts +0 -67
  181. package/src/channels/github/forward.ts +0 -359
  182. package/src/channels/github/github-channel.ts +0 -2334
  183. package/src/channels/github/index.ts +0 -54
  184. package/src/channels/github/progress.ts +0 -365
  185. package/src/channels/github/replay.ts +0 -372
  186. package/src/channels/github/state.ts +0 -124
  187. package/src/channels/github/types.ts +0 -590
  188. package/src/channels/gitlab/api.ts +0 -329
  189. package/src/channels/gitlab/binding.ts +0 -231
  190. package/src/channels/gitlab/checks.ts +0 -228
  191. package/src/channels/gitlab/cursor-account.ts +0 -105
  192. package/src/channels/gitlab/defaults.ts +0 -80
  193. package/src/channels/gitlab/events.ts +0 -37
  194. package/src/channels/gitlab/gitlab-channel.ts +0 -160
  195. package/src/channels/gitlab/gitlab-webhook.ts +0 -509
  196. package/src/channels/gitlab/index.ts +0 -44
  197. package/src/channels/gitlab/replay.ts +0 -328
  198. package/src/channels/gitlab/state.ts +0 -55
  199. package/src/channels/gitlab/types.ts +0 -247
  200. package/src/channels/issues/index.ts +0 -9
  201. package/src/channels/issues/issues-channel.ts +0 -45
  202. package/src/channels/issues/types.ts +0 -38
  203. package/src/channels/origin/api.ts +0 -507
  204. package/src/channels/origin/binding.ts +0 -114
  205. package/src/channels/origin/checks.ts +0 -250
  206. package/src/channels/origin/cursor-account.ts +0 -58
  207. package/src/channels/origin/defaults.ts +0 -140
  208. package/src/channels/origin/events.ts +0 -35
  209. package/src/channels/origin/index.ts +0 -35
  210. package/src/channels/origin/origin-channel.ts +0 -815
  211. package/src/channels/origin/origin-webhook.ts +0 -296
  212. package/src/channels/origin/reactions.ts +0 -72
  213. package/src/channels/origin/state.ts +0 -54
  214. package/src/channels/origin/types.ts +0 -295
  215. package/src/channels/slack/agentic-delivery.ts +0 -634
  216. package/src/channels/slack/agentic-posted.ts +0 -135
  217. package/src/channels/slack/agentic-signals.ts +0 -231
  218. package/src/channels/slack/api.ts +0 -761
  219. package/src/channels/slack/approvals.ts +0 -279
  220. package/src/channels/slack/assistant.ts +0 -76
  221. package/src/channels/slack/attachments.ts +0 -596
  222. package/src/channels/slack/auth.ts +0 -127
  223. package/src/channels/slack/blocks.ts +0 -131
  224. package/src/channels/slack/bot-mentions.ts +0 -318
  225. package/src/channels/slack/channel-watch.ts +0 -314
  226. package/src/channels/slack/cli-project.ts +0 -249
  227. package/src/channels/slack/code-fences.ts +0 -171
  228. package/src/channels/slack/constants.ts +0 -38
  229. package/src/channels/slack/credentials.ts +0 -88
  230. package/src/channels/slack/defaults.ts +0 -714
  231. package/src/channels/slack/dispatch.ts +0 -1060
  232. package/src/channels/slack/doctor.ts +0 -338
  233. package/src/channels/slack/eval-directive.ts +0 -306
  234. package/src/channels/slack/event-id-dedupe.ts +0 -30
  235. package/src/channels/slack/external-policy.ts +0 -75
  236. package/src/channels/slack/footer.ts +0 -106
  237. package/src/channels/slack/inbound.ts +0 -416
  238. package/src/channels/slack/index.ts +0 -53
  239. package/src/channels/slack/init.ts +0 -169
  240. package/src/channels/slack/interactive.ts +0 -406
  241. package/src/channels/slack/links.ts +0 -23
  242. package/src/channels/slack/live-delivery.ts +0 -489
  243. package/src/channels/slack/log.ts +0 -70
  244. package/src/channels/slack/manifest.ts +0 -240
  245. package/src/channels/slack/message-body.ts +0 -82
  246. package/src/channels/slack/nudge-carrier.ts +0 -224
  247. package/src/channels/slack/nudge-store.ts +0 -334
  248. package/src/channels/slack/paint-start.ts +0 -93
  249. package/src/channels/slack/placeholder.ts +0 -358
  250. package/src/channels/slack/pr-ref.ts +0 -74
  251. package/src/channels/slack/progress-delivery.ts +0 -138
  252. package/src/channels/slack/reasoning-card.ts +0 -125
  253. package/src/channels/slack/reasoning-chip.ts +0 -41
  254. package/src/channels/slack/recording-sink.ts +0 -167
  255. package/src/channels/slack/redact.ts +0 -6
  256. package/src/channels/slack/reply-options.ts +0 -279
  257. package/src/channels/slack/setup.ts +0 -125
  258. package/src/channels/slack/slack-channel.ts +0 -744
  259. package/src/channels/slack/socket-mode.ts +0 -140
  260. package/src/channels/slack/stop.ts +0 -25
  261. package/src/channels/slack/stream.ts +0 -66
  262. package/src/channels/slack/thread-context.ts +0 -485
  263. package/src/channels/slack/tool-approval-events.ts +0 -233
  264. package/src/channels/slack/tool-cards.ts +0 -198
  265. package/src/channels/slack/tool-chip.ts +0 -34
  266. package/src/channels/slack/types.ts +0 -787
  267. package/src/channels/slack/upload.ts +0 -137
  268. package/src/channels.ts +0 -543
  269. package/src/connections.ts +0 -153
  270. package/src/dashboard-session-url.ts +0 -30
  271. package/src/evals/assertions.ts +0 -688
  272. package/src/evals/expect.ts +0 -250
  273. package/src/evals/judge.ts +0 -329
  274. package/src/evals/loaders.ts +0 -111
  275. package/src/evals/matchers.ts +0 -223
  276. package/src/evals/reporters.ts +0 -257
  277. package/src/evals/results.ts +0 -130
  278. package/src/evals/run-facts.ts +0 -306
  279. package/src/evals.ts +0 -709
  280. package/src/extensions/cursor-cloud-agents/extension.ts +0 -131
  281. package/src/extensions/cursor-cloud-agents/lib/backend.ts +0 -386
  282. package/src/extensions/cursor-cloud-agents/lib/channels.ts +0 -11
  283. package/src/extensions/cursor-cloud-agents/lib/fleet.ts +0 -98
  284. package/src/extensions/cursor-cloud-agents/lib/inputs.ts +0 -5
  285. package/src/extensions/cursor-cloud-agents/lib/repos.ts +0 -80
  286. package/src/extensions/cursor-cloud-agents/lib/transcript.ts +0 -19
  287. package/src/extensions/cursor-cloud-agents/skills/handoff.md +0 -37
  288. package/src/extensions/cursor-cloud-agents/tools/cancel.ts +0 -21
  289. package/src/extensions/cursor-cloud-agents/tools/dump.ts +0 -47
  290. package/src/extensions/cursor-cloud-agents/tools/get.ts +0 -18
  291. package/src/extensions/cursor-cloud-agents/tools/launch.ts +0 -62
  292. package/src/extensions/cursor-cloud-agents/tools/list.ts +0 -31
  293. package/src/extensions/cursor-cloud-agents/tools/reply.ts +0 -36
  294. package/src/extensions/cursor-grokbot-agents/extension.ts +0 -132
  295. package/src/extensions/cursor-grokbot-agents/lib/agents.ts +0 -42
  296. package/src/extensions/cursor-grokbot-agents/lib/backend.ts +0 -208
  297. package/src/extensions/cursor-grokbot-agents/lib/contacts.ts +0 -74
  298. package/src/extensions/cursor-grokbot-agents/lib/conversation.ts +0 -260
  299. package/src/extensions/cursor-grokbot-agents/lib/inputs.ts +0 -21
  300. package/src/extensions/cursor-grokbot-agents/lib/lock.ts +0 -26
  301. package/src/extensions/cursor-grokbot-agents/skills/consult.md +0 -40
  302. package/src/extensions/cursor-grokbot-agents/tools/ask.ts +0 -32
  303. package/src/extensions/cursor-grokbot-agents/tools/check.ts +0 -25
  304. package/src/extensions/cursor-grokbot-agents/tools/interrupt.ts +0 -17
  305. package/src/extensions/cursor-grokbot-agents/tools/list.ts +0 -26
  306. package/src/extensions/improve/extension.ts +0 -69
  307. package/src/extensions/improve/skills/yourself.ts +0 -50
  308. package/src/extensions/jev/extension.ts +0 -95
  309. package/src/extensions/jev/lib/evaluate.ts +0 -266
  310. package/src/extensions/jev/skills/gated-write.md +0 -25
  311. package/src/extensions/jev/skills/questions.md +0 -33
  312. package/src/extensions/jev/tools/evaluate.ts +0 -82
  313. package/src/extensions/slack-communication/evals/harness.ts +0 -705
  314. package/src/extensions/slack-communication/evals/slack-communication.eval.ts +0 -830
  315. package/src/extensions/slack-communication/evals/slack-placeholder.eval.ts +0 -172
  316. package/src/extensions/slack-communication/extension.ts +0 -44
  317. package/src/extensions/slack-communication/skills/slack-voice.ts +0 -56
  318. package/src/extensions/slack-communication/tools/delete-message.ts +0 -33
  319. package/src/extensions/slack-communication/tools/edit-message.ts +0 -42
  320. package/src/extensions/slack-communication/tools/post-card.ts +0 -28
  321. package/src/extensions/slack-communication/tools/post-file.ts +0 -82
  322. package/src/extensions/slack-communication/tools/post-update.ts +0 -40
  323. package/src/extensions/slack-communication/tools/react.ts +0 -30
  324. package/src/extensions/slack-communication/tools/set-status.ts +0 -21
  325. package/src/extensions.ts +0 -179
  326. package/src/files-backends/agent-store-presigned-url.ts +0 -11
  327. package/src/files-backends/cursor-hosted.ts +0 -1212
  328. package/src/files-backends/local-fs.ts +0 -163
  329. package/src/files.ts +0 -293
  330. package/src/filesystem.ts +0 -2005
  331. package/src/hooks.ts +0 -30
  332. package/src/index.ts +0 -259
  333. package/src/internal/advertise-tools.ts +0 -370
  334. package/src/internal/approval-gate.ts +0 -103
  335. package/src/internal/artifacts-store.ts +0 -836
  336. package/src/internal/as-of.ts +0 -257
  337. package/src/internal/auth.ts +0 -46
  338. package/src/internal/authored-alias-hooks.ts +0 -138
  339. package/src/internal/authored-loaders.ts +0 -188
  340. package/src/internal/bounded-int.ts +0 -24
  341. package/src/internal/bounded.ts +0 -25
  342. package/src/internal/brand.ts +0 -28
  343. package/src/internal/browser-origin-guard.ts +0 -67
  344. package/src/internal/builtin-tools/artifacts.ts +0 -62
  345. package/src/internal/builtin-tools/index.ts +0 -53
  346. package/src/internal/builtin-tools/reminders.ts +0 -145
  347. package/src/internal/channel-dispatch.ts +0 -129
  348. package/src/internal/channel-route-dispatch.ts +0 -58
  349. package/src/internal/channel-state.ts +0 -83
  350. package/src/internal/chat-client.ts +0 -594
  351. package/src/internal/cli-ax.ts +0 -2318
  352. package/src/internal/cli-bitbucket.ts +0 -438
  353. package/src/internal/cli-convert-automation.ts +0 -335
  354. package/src/internal/cli-cursor.ts +0 -282
  355. package/src/internal/cli-deploy.ts +0 -2519
  356. package/src/internal/cli-docs.ts +0 -192
  357. package/src/internal/cli-github.ts +0 -806
  358. package/src/internal/cli-gitlab.ts +0 -452
  359. package/src/internal/cli-images.ts +0 -672
  360. package/src/internal/cli-manifest.ts +0 -56
  361. package/src/internal/cli-mcp-oauth.ts +0 -396
  362. package/src/internal/cli-mcp.ts +0 -808
  363. package/src/internal/cli-skills.ts +0 -98
  364. package/src/internal/cli-slack-manual.ts +0 -418
  365. package/src/internal/cli-slack.ts +0 -874
  366. package/src/internal/cloud-merge.ts +0 -51
  367. package/src/internal/cloud-turn-cost.ts +0 -159
  368. package/src/internal/connection-env.ts +0 -106
  369. package/src/internal/continuation-channel.ts +0 -233
  370. package/src/internal/continuation-identity.ts +0 -935
  371. package/src/internal/conversation-mirror.ts +0 -423
  372. package/src/internal/convert-automation/convert-workflow.ts +0 -1377
  373. package/src/internal/convert-automation/slug.ts +0 -29
  374. package/src/internal/convert-automation/types.ts +0 -212
  375. package/src/internal/cron.ts +0 -76
  376. package/src/internal/cursor/account-mcp.ts +0 -692
  377. package/src/internal/cursor/backend-client.ts +0 -984
  378. package/src/internal/cursor/bound-secret-file.ts +0 -101
  379. package/src/internal/cursor/credentials.ts +0 -560
  380. package/src/internal/cursor/cursor-api-transport.ts +0 -65
  381. package/src/internal/cursor/github-credentials.ts +0 -228
  382. package/src/internal/cursor/hosted-bound-secrets.ts +0 -71
  383. package/src/internal/cursor/hosted-deployment-secrets.ts +0 -100
  384. package/src/internal/cursor/hosted-store-secrets.ts +0 -152
  385. package/src/internal/cursor/session-token.ts +0 -111
  386. package/src/internal/cursor/store-api-client.ts +0 -323
  387. package/src/internal/cursor-account-mcp-auth.ts +0 -303
  388. package/src/internal/cursor-agent-template.ts +0 -50
  389. package/src/internal/cursor-deployment-relay.ts +0 -315
  390. package/src/internal/cursor-event-relay.ts +0 -675
  391. package/src/internal/cursor-relay-core.ts +0 -563
  392. package/src/internal/deferred-channel-session.ts +0 -61
  393. package/src/internal/deploy-client.ts +0 -1574
  394. package/src/internal/deploy-manifest.ts +0 -361
  395. package/src/internal/deploy-source.ts +0 -144
  396. package/src/internal/describe-error.ts +0 -32
  397. package/src/internal/dev-mode.ts +0 -20
  398. package/src/internal/discovery/agent-config.ts +0 -288
  399. package/src/internal/discovery/agent.ts +0 -381
  400. package/src/internal/discovery/channels.ts +0 -100
  401. package/src/internal/discovery/connections.ts +0 -516
  402. package/src/internal/discovery/context.ts +0 -38
  403. package/src/internal/discovery/cursor-plugin.ts +0 -628
  404. package/src/internal/discovery/extension-overlay.ts +0 -247
  405. package/src/internal/discovery/extensions.ts +0 -490
  406. package/src/internal/discovery/fs.ts +0 -103
  407. package/src/internal/discovery/hooks.ts +0 -63
  408. package/src/internal/discovery/info.ts +0 -174
  409. package/src/internal/discovery/instructions.ts +0 -98
  410. package/src/internal/discovery/modules.ts +0 -107
  411. package/src/internal/discovery/names.ts +0 -45
  412. package/src/internal/discovery/project.ts +0 -319
  413. package/src/internal/discovery/reminders.ts +0 -65
  414. package/src/internal/discovery/runtime.ts +0 -158
  415. package/src/internal/discovery/schedules.ts +0 -120
  416. package/src/internal/discovery/seed-files.ts +0 -34
  417. package/src/internal/discovery/services.ts +0 -151
  418. package/src/internal/discovery/skills.ts +0 -174
  419. package/src/internal/discovery/subagent.ts +0 -138
  420. package/src/internal/discovery/tools.ts +0 -170
  421. package/src/internal/discovery.ts +0 -27
  422. package/src/internal/distribution.ts +0 -126
  423. package/src/internal/docs-site.ts +0 -248
  424. package/src/internal/duration.ts +0 -37
  425. package/src/internal/env-file.ts +0 -83
  426. package/src/internal/eval-judge-model.ts +0 -142
  427. package/src/internal/eval-run-store.ts +0 -585
  428. package/src/internal/eval-runner.ts +0 -823
  429. package/src/internal/evals-client.ts +0 -475
  430. package/src/internal/event-log.ts +0 -342
  431. package/src/internal/event-mapper.ts +0 -811
  432. package/src/internal/expected-delivery-failure.ts +0 -34
  433. package/src/internal/factory-resource-channel.ts +0 -103
  434. package/src/internal/filesystem/errors.ts +0 -207
  435. package/src/internal/filesystem/format.ts +0 -253
  436. package/src/internal/filesystem/merge.ts +0 -192
  437. package/src/internal/filesystem/nearest.ts +0 -112
  438. package/src/internal/filesystem/scratch.ts +0 -239
  439. package/src/internal/filesystem/sdk-schemas.ts +0 -204
  440. package/src/internal/filesystem/tools.ts +0 -804
  441. package/src/internal/filesystem/walk.ts +0 -366
  442. package/src/internal/fixtures/units-server.ts +0 -52
  443. package/src/internal/framework-file-storage.ts +0 -357
  444. package/src/internal/framework-storage-selection.ts +0 -156
  445. package/src/internal/frontmatter.ts +0 -108
  446. package/src/internal/github-fanout.ts +0 -144
  447. package/src/internal/guest-network.ts +0 -391
  448. package/src/internal/handleAgentServeTrigger.ts +0 -286
  449. package/src/internal/host-files.ts +0 -341
  450. package/src/internal/host-kv.ts +0 -81
  451. package/src/internal/host-otel.ts +0 -231
  452. package/src/internal/host-platforms.ts +0 -170
  453. package/src/internal/hosted-admission-adapter.ts +0 -47
  454. package/src/internal/hosted-admission-context.ts +0 -37
  455. package/src/internal/hosted-catch-protocol.ts +0 -112
  456. package/src/internal/hosted-catch.ts +0 -179
  457. package/src/internal/hosted-delivery-protocol.ts +0 -824
  458. package/src/internal/hosted-delivery.ts +0 -1410
  459. package/src/internal/hosted-execution-diag.ts +0 -291
  460. package/src/internal/hosted-execution-flush.ts +0 -136
  461. package/src/internal/hosted-execution-latency.ts +0 -301
  462. package/src/internal/hosted-managed-automation.ts +0 -116
  463. package/src/internal/hosting.ts +0 -114
  464. package/src/internal/http-channel-define.ts +0 -25
  465. package/src/internal/http-channel.ts +0 -669
  466. package/src/internal/http-control-plane-session.ts +0 -110
  467. package/src/internal/ids.ts +0 -39
  468. package/src/internal/incoming-headers-to-fetch.ts +0 -45
  469. package/src/internal/init-interview.ts +0 -360
  470. package/src/internal/init-project.ts +0 -711
  471. package/src/internal/init-scaffold.ts +0 -182
  472. package/src/internal/inline-stdio-define-stub.ts +0 -4
  473. package/src/internal/inline-stdio-mcp.ts +0 -230
  474. package/src/internal/install-cursor-skills.ts +0 -604
  475. package/src/internal/is-record.ts +0 -3
  476. package/src/internal/json-schema.ts +0 -95
  477. package/src/internal/legacy-command-guard.ts +0 -66
  478. package/src/internal/listen-port.ts +0 -85
  479. package/src/internal/local-control-plane.ts +0 -442
  480. package/src/internal/local-env.ts +0 -59
  481. package/src/internal/local-ingress.ts +0 -90
  482. package/src/internal/log-ring.ts +0 -59
  483. package/src/internal/logs-client.ts +0 -477
  484. package/src/internal/map-pool.ts +0 -39
  485. package/src/internal/mcp-endpoint.ts +0 -747
  486. package/src/internal/mcp-host.ts +0 -509
  487. package/src/internal/mcp-oauth-on-demand.ts +0 -337
  488. package/src/internal/mcp-oauth-persist.ts +0 -118
  489. package/src/internal/mcp-oauth.ts +0 -549
  490. package/src/internal/net.ts +0 -29
  491. package/src/internal/open-browser.ts +0 -41
  492. package/src/internal/otel/attrs.ts +0 -16
  493. package/src/internal/otel/collector.ts +0 -937
  494. package/src/internal/otel/config.ts +0 -287
  495. package/src/internal/otel/http.ts +0 -122
  496. package/src/internal/otel/mcp.ts +0 -56
  497. package/src/internal/otel/propagation.ts +0 -17
  498. package/src/internal/otel/runtime.ts +0 -441
  499. package/src/internal/package-inline-stdio.ts +0 -114
  500. package/src/internal/peer-connections.ts +0 -96
  501. package/src/internal/platform-schedule-sync.ts +0 -75
  502. package/src/internal/platform-timers.ts +0 -365
  503. package/src/internal/playground/static.ts +0 -278
  504. package/src/internal/playground/toolchain.ts +0 -270
  505. package/src/internal/playground-proxy.ts +0 -564
  506. package/src/internal/process-memory-telemetry.ts +0 -334
  507. package/src/internal/project-layout.ts +0 -31
  508. package/src/internal/prompt-context.ts +0 -116
  509. package/src/internal/reminder-control-plane-protocol.ts +0 -482
  510. package/src/internal/reminder-runner.ts +0 -1559
  511. package/src/internal/reminder-schedule.ts +0 -104
  512. package/src/internal/reminder-store.ts +0 -176
  513. package/src/internal/request-error-status.ts +0 -95
  514. package/src/internal/request-headers.ts +0 -21
  515. package/src/internal/resolve-prod-target.ts +0 -334
  516. package/src/internal/resolved-connections.ts +0 -190
  517. package/src/internal/router.ts +0 -143
  518. package/src/internal/run-client.ts +0 -354
  519. package/src/internal/runtime-dispatch-runner.ts +0 -50
  520. package/src/internal/sanitize-mcp-tool-name.ts +0 -31
  521. package/src/internal/schedule-runner.ts +0 -154
  522. package/src/internal/scm/pr-url.ts +0 -245
  523. package/src/internal/sdk-runner.ts +0 -959
  524. package/src/internal/serve-restart.ts +0 -113
  525. package/src/internal/server.ts +0 -3147
  526. package/src/internal/session-cost.ts +0 -208
  527. package/src/internal/session-engine.ts +0 -5622
  528. package/src/internal/session-links.ts +0 -84
  529. package/src/internal/session-run-log.ts +0 -535
  530. package/src/internal/session-store.ts +0 -307
  531. package/src/internal/session-urls.ts +0 -32
  532. package/src/internal/sessions-client.ts +0 -239
  533. package/src/internal/skill-catalog.ts +0 -66
  534. package/src/internal/skills-sync.ts +0 -55
  535. package/src/internal/slack-provision-client.ts +0 -544
  536. package/src/internal/slack-thread-key.ts +0 -11
  537. package/src/internal/sleep.ts +0 -3
  538. package/src/internal/start-log-store.ts +0 -164
  539. package/src/internal/steering.ts +0 -17
  540. package/src/internal/storage-coordinator.ts +0 -800
  541. package/src/internal/storage-roles.ts +0 -86
  542. package/src/internal/storage.ts +0 -1
  543. package/src/internal/store-api-protocol.ts +0 -205
  544. package/src/internal/store-mirror.ts +0 -73
  545. package/src/internal/stream-progress.ts +0 -294
  546. package/src/internal/terminal-style.ts +0 -133
  547. package/src/internal/testing/factory-resource-fixtures.ts +0 -84
  548. package/src/internal/testing/scm-continuation-fixtures.ts +0 -285
  549. package/src/internal/tool-catalog.ts +0 -104
  550. package/src/internal/tool-policy.ts +0 -222
  551. package/src/internal/tool-result.ts +0 -50
  552. package/src/internal/trajectory.ts +0 -418
  553. package/src/internal/turn-cost.ts +0 -136
  554. package/src/internal/turn-governor.ts +0 -145
  555. package/src/internal/turn-lease-store.ts +0 -144
  556. package/src/internal/turn-outbox.ts +0 -77
  557. package/src/internal/update-check.ts +0 -517
  558. package/src/internal/v2-hosting.ts +0 -52
  559. package/src/internal/workspace-sync.ts +0 -114
  560. package/src/internal/workspace.ts +0 -505
  561. package/src/kv/memory-kv.ts +0 -94
  562. package/src/kv.ts +0 -18
  563. package/src/memory.ts +0 -487
  564. package/src/otel-public.ts +0 -24
  565. package/src/otel.ts +0 -320
  566. package/src/prompt.ts +0 -80
  567. package/src/reminders.ts +0 -65
  568. package/src/schedules.ts +0 -31
  569. package/src/skills.ts +0 -27
  570. package/src/storage-backends/cursor-hosted-v2.ts +0 -204
  571. package/src/storage-backends/cursor-hosted.ts +0 -388
  572. package/src/storage-backends/file-kv.ts +0 -276
  573. package/src/storage-protocol.ts +0 -261
  574. package/src/storage.ts +0 -408
  575. package/src/tools.ts +0 -166
  576. package/src/types.ts +0 -3776
  577. /package/dist/docs/assets/{reference_agent-config.md.DzGI777n.lean.js → reference_agent-config.md.Cj5uBKp4.lean.js} +0 -0
@@ -1,1854 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * agent-serve CLI.
4
- *
5
- * agent-sdk serve [--dir .] [--port 3000] [--host 127.0.0.1] [--dev]
6
- * agent-sdk dev [path] [--port 3000] [--host 127.0.0.1]
7
- * agent-sdk docs [--port 0] [--host 127.0.0.1] [--print]
8
- * agent-sdk chat [--url http://127.0.0.1:3000] [--message "..."] [--json]
9
- * agent-sdk resume [sessionId] [--url | --prod] [--message "..."]
10
- * agent-sdk run [--dir .] [--message "..."] [--json|--text]
11
- * agent-sdk trajectory --events <file.ndjson>
12
- * agent-sdk init [dir] [--json]
13
- * agent-sdk convert-automation <url> [--dir <path>] [--json]
14
- * agent-sdk eval [--dir .] [evalId...]
15
- * agent-sdk validate [--dir .]
16
- * agent-sdk slack <subcommand>
17
- */
18
-
19
- import { spawn } from "node:child_process";
20
- import { readFile } from "node:fs/promises";
21
- import { resolve } from "node:path";
22
- import { parseArgs } from "node:util";
23
- import { formatDiagnostics, projectInfo, resolveAgentMounts, serve } from "../index.js";
24
- import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
25
- import {
26
- type AxCliOptions,
27
- cmdCall,
28
- cmdChat,
29
- cmdCost,
30
- cmdEval,
31
- cmdEvalCancel,
32
- cmdEvalStatus,
33
- cmdInit,
34
- cmdLogs,
35
- cmdPlayground,
36
- cmdResume,
37
- cmdRun,
38
- cmdSession,
39
- cmdSessions,
40
- cmdSkill,
41
- cmdTrajectory,
42
- } from "../internal/cli-ax.js";
43
- import {
44
- cmdCancelRuns,
45
- cmdDelete,
46
- cmdDeploy,
47
- cmdDeploymentStatus,
48
- cmdDeployments,
49
- cmdEventRepos,
50
- cmdKill,
51
- cmdRollback,
52
- cmdRotateToken,
53
- cmdSecretsList,
54
- cmdSecretsSet,
55
- cmdSecretsUnset,
56
- cmdStart,
57
- cmdStop,
58
- cmdUnlockDeploys,
59
- cmdUpgrade,
60
- type DeployCliOptions,
61
- } from "../internal/cli-deploy.js";
62
- import { cmdImagesList, cmdImagesPush, cmdImagesRm } from "../internal/cli-images.js";
63
- import { cmdManifest } from "../internal/cli-manifest.js";
64
- import {
65
- CLI_COMMAND_NAME as CLI,
66
- formatCliVersion,
67
- PACKAGE_NAME,
68
- packageVersion,
69
- } from "../internal/distribution.js";
70
- import { v2HostedVerifyHint } from "../internal/legacy-command-guard.js";
71
- import { loadAgentLocalEnv } from "../internal/local-env.js";
72
- import {
73
- ENTER_RESTART_EXIT_CODE,
74
- isServeRestartWorker,
75
- runEnterRestartSupervisor,
76
- } from "../internal/serve-restart.js";
77
- import { flushSessionRunFatal } from "../internal/session-run-log.js";
78
- import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
79
- import { cmdUpdate, warnIfOutdated } from "../internal/update-check.js";
80
- import type { AgentProject, AgentServeHandle } from "../types.js";
81
-
82
- const HELP = `${CLI} — serve a filesystem-defined Cursor agent over channels
83
-
84
- Usage:
85
- ${CLI} serve [--dir <path>] [--port <n>] [--host <host>] [--dev]
86
- [--mode single|multi] [--api-key <key>] [--no-schedules]
87
- [--public-url <url>]
88
- [--cursor-events --repo <owner/name>]...
89
- ${CLI} dev [path] [--port <n>] [--host <host>] …
90
- Same flags as serve; implies --dev. Path defaults to
91
- the current directory (or pass --dir).
92
- ${CLI} chat [--url <baseUrl> | --prod] [--message <text>] [--json] [--text]
93
- [--session <id> | --resume] [--continuation-token <t>]
94
- [--slug <slug>] [--team <id>]
95
- ${CLI} resume [sessionId] [--url <baseUrl> | --prod] [--message <text>]
96
- [--json] [--text] [--continuation-token <t>]
97
- [--slug <slug>] [--team <id>]
98
- ${CLI} logs [--url <baseUrl> | --prod] [--once] [--json]
99
- [--slug <slug>] [--team <id>] [--dir <path>]
100
- ${CLI} sessions [--url <baseUrl> | --prod] [--json]
101
- [--slug <slug>] [--team <id>] [--dir <path>]
102
- v2: unsupported. ${v2HostedVerifyHint()}
103
- ${CLI} session <sessionId> [--url <baseUrl> | --prod]
104
- [--json | --text | --events] [--out <file.ndjson>]
105
- [--slug <slug>] [--team <id>] [--dir <path>]
106
- or: --prod [<sessionId>] --slug <slug> --message "…" [--dry-run] [--as-of <instant>]
107
- ${CLI} cost [sessionId] [--url <baseUrl> | --prod] [--json]
108
- [--slug <slug>] [--team <id>] [--dir <path>]
109
- ${CLI} playground [--url <baseUrl> | --prod] [--session <id>] [--print]
110
- [--slug <slug>] [--team <id>] [--dir <path>]
111
- ${CLI} docs [--port <n>] [--host <host>] [--print]
112
- ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl> | --prod]
113
- [--session <id>] [--continuation-token <t>]
114
- [--events <file.ndjson>] [--no-events] [--text]
115
- [--timeout-ms <n>] [--no-stream] [--slug <slug>] [--team <id>]
116
- [--dry-run] [--as-of <instant>]
117
- ${CLI} trajectory --events <file.ndjson> [--text]
118
- ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
119
- [--session <id>] [--slug <slug>] [--team <id>]
120
- v2: unsupported. ${v2HostedVerifyHint()}
121
- ${CLI} skill <name> [--dir <path> | --url <baseUrl> | --prod]
122
- [--slug <slug>] [--team <id>] [--text]
123
- ${CLI} init [dir] [--template <name>] [--var id=value]... [--json]
124
- ${CLI} convert-automation <url> [--dir <path>] [--json]
125
- ${CLI} install-skills [--print] [--json]
126
- ${CLI} mcp --prod [--slug <slug>] [--team <id>] [--dir <path>]
127
- | --url <baseUrl> [--bearer-token <t>]
128
- ${CLI} mcp install [--name <serverName>] [--print] [--json]
129
- (same target flags as mcp)
130
- ${CLI} mcp oauth <connection> [--dir <path>] [--store] [--slug <slug>]
131
- ${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
132
- [--tag <tag>]... [--verbose] [--timeout-ms <n>]
133
- [--strict] [--max-concurrency <n>]
134
- [--junit <path>] [--artifacts <dir>|--no-artifacts]
135
- [--out <file.json>]
136
- [--skip-report] [--no-stream] [--no-wait]
137
- [--prod | --url <baseUrl>] [--slug <slug>]
138
- [--team <id>]
139
- ${CLI} eval status [runId] --prod|--url <baseUrl> [--dir <path>] [--json]
140
- [--out <file.json>] [--slug <slug>] [--team <id>]
141
- ${CLI} eval cancel <runId> --prod|--url <baseUrl> [--dir <path>] [--json]
142
- [--slug <slug>] [--team <id>]
143
- ${CLI} info [--dir <path>] [--json]
144
- ${CLI} validate [--dir <path>]
145
- ${CLI} login [--api-key <key>] [--key-name <name>]
146
- ${CLI} logout
147
- ${CLI} whoami [--json]
148
- ${CLI} update
149
- ${CLI} version [--json]
150
- ${CLI} deploy [--dir <path>] [--slug <slug> | --all] [--team <id>] [--json]
151
- [--no-wait] [--repo <url>] [--ref <ref>]
152
- [--path <agentPath>] [--cursor-events-repo <owner/name>]...
153
- [--allow-domain <domain>]...
154
- ${CLI} manifest [--dir <path>] [--json]
155
- ${CLI} deployments [--team <id>] [--json]
156
- ${CLI} deployment <slug> [--team <id>] [--json]
157
- ${CLI} stop <slug> [--team <id>] [--json] [--no-wait] [--cancel-runs]
158
- ${CLI} start <slug> [--team <id>] [--json]
159
- ${CLI} kill <slug> [--team <id>] [--json]
160
- ${CLI} unlock-deploys <slug> [--team <id>] [--json]
161
- ${CLI} cancel-runs <slug> [--team <id>] [--json]
162
- ${CLI} event-repos <slug> [--repo <owner/name>]... [--team <id>] [--json]
163
- ${CLI} upgrade <slug> [--release <id|version>] [--team <id>] [--json]
164
- ${CLI} rollback <slug> [--release <id|version>] [--team <id>] [--json]
165
- ${CLI} delete <slug> [--team <id>] [--json] [--no-wait]
166
- ${CLI} rotate-token <slug> [--team <id>]
167
- ${CLI} secrets set <slug> NAME... | list <slug> | unset <slug> NAME
168
- [--team <id>] [--json] [--from-argv]
169
- ${CLI} slack <subcommand> …
170
- ${CLI} github <subcommand> …
171
-
172
- Commands:
173
- serve Serve agents under /<slug>/... (index at /). Runs \`${CLI} login\`
174
- when unsigned. On a TTY, press Enter to restart (re-executes this
175
- process so agent code, evals, and Vite reload).
176
- dev Local development: same as \`${CLI} serve --dev\` (manual
177
- schedule/reminder dispatch, unsigned GitHub loopback, Vite HMR).
178
- Also runs \`${CLI} login\` when unsigned.
179
- chat Interactive REPL against a running server (follow-ups keep the
180
- session + continuation token). Optional --message seeds the first
181
- turn then stays open on a TTY. --session reattaches (looks up the
182
- continuation token via /v1/sessions when omitted) and replays the
183
- transcript. --resume reattaches the most recently updated
184
- followable session (no id needed). --json is one-shot. Pass
185
- --prod to hit the team's hosted deployment (slug from --slug or
186
- the directory name).
187
- resume Reattach chat to a session (same as \`${CLI} chat --session <id>\`
188
- or \`${CLI} chat --resume\` with no id). Omit the session id to
189
- resume the previous followable session from /v1/sessions. Looks
190
- up the continuation token via /v1/sessions when
191
- --continuation-token is omitted, then replays the transcript.
192
- Pass --prod for a hosted deployment.
193
- logs Tail agent logs. Default follows (Ctrl-C to stop); --once dumps
194
- the current buffer. --prod shows deploy progress until the
195
- hosted deployment is running, then tails runtime logs. Without
196
- --prod, tails the local server (or --url).
197
- sessions List sessions on a running agent or a v1 --prod deployment.
198
- Unsupported on architecture v2. ${v2HostedVerifyHint()}
199
- session Show one session. On v2: \`${CLI} session <ses_> --prod --slug <slug>\`.
200
- Default: text trajectory. --json for trajectory
201
- JSON; --events for the raw event list. To continue interactively,
202
- use \`${CLI} resume [id]\`.
203
- cost Pull cost metrics. With a session id: per-turn token usage and
204
- estimated cost for that session. Without one: one row per
205
- session plus a total. Costs are the engine's recorded estimates
206
- from turn.completed events; --json for machine-readable reports.
207
- playground Open the web playground. --prod opens the v1 hosted alias or
208
- v2 portal UI; --session deep-links a session. --print skips
209
- opening a browser. Ctrl-C stops local credential proxies.
210
- docs Serve the shipped documentation site on loopback and open it
211
- (also: npx @cursor/bdk docs). No agent project required.
212
- --print skips opening a browser. Ctrl-C stops the server.
213
- run One-shot create→test loop: ephemeral server + JSON trajectory.
214
- Writes a single events.ndjson trace (summarize with trajectory).
215
- Streams tool calls and reply text to stderr when stderr is a TTY.
216
- Pass --prod to hit the hosted deployment instead of a local server.
217
- On an AgentSDK v2 slug, --prod starts a hosted session through
218
- the control plane (Temporal, no resident engine). ${v2HostedVerifyHint()}
219
- --session ses_… resumes that exact session. A 404 falls back to the v1
220
- engine alias.
221
- trajectory Summarize an events.ndjson file into a trajectory.
222
- call Call an authored server tool deterministically (no model turn)
223
- via POST /v1/tools/:toolName. --session runs it inside an
224
- existing session and records it on that session's event stream.
225
- Unsupported on architecture v2. ${v2HostedVerifyHint()}
226
- skill Read an authored skill deterministically (no model turn)
227
- via GET /v1/skills/:skillName. --text prints SKILL.md.
228
- init Scaffold a project (skipping existing files), npm install,
229
- run login when unsigned, then print next steps. Templates
230
- with init.json interview on a TTY; --var answers without a
231
- prompt. --json is machine-readable and never blocks on
232
- login. No directory: print the setup guide.
233
- convert-automation
234
- Export a Cursor Automation into an agentsdk project. <url> is
235
- the dashboard URL (…/automations/<uuid> or
236
- …/custom-agents/<uuid>) or a bare uuid. Fetches the definition
237
- with your Cursor credentials, writes the converted files into
238
- --dir (default ./<automation-name>), fills in the init scaffold
239
- around them (existing files are kept), and installs npm
240
- dependencies. MCP servers convert to Cursor-account connections
241
- resolved at runtime (manage authorization in Cursor, dashboard
242
- -> MCP). Review the project, then run \`validate\` / \`dev\`.
243
- Warnings never fail the command.
244
- install-skills
245
- Refresh the BDK skills for coding agents in
246
- ~/.cursor/skills/bdk and print where they landed.
247
- Installed copies set alwaysApply so Cursor injects them
248
- into context. \`npm install\` / \`npx\` already copies them
249
- (postinstall); this command overwrites with the package
250
- version without asking. \`init\` also offers a TTY refresh.
251
- --print previews without writing.
252
- mcp Serve this agent's MCP endpoint over stdio for MCP clients
253
- that spawn local servers (e.g. Cursor). Proxies
254
- newline-delimited JSON-RPC to <target>/v1/mcp. --prod resolves
255
- the hosted deployment with the signed-in Cursor account and
256
- re-mints short-lived engine credentials as they expire;
257
- --url targets a running server. stdout is reserved for the
258
- MCP wire. \`mcp install\` writes the matching entry into
259
- ~/.cursor/mcp.json (--print to preview; --name to override
260
- the server name). \`mcp oauth <connection>\` runs host PKCE
261
- for defineConnection({ url, oauth: true }); \`--store\` upserts
262
- MCP_OAUTH_<NAME>_* secrets on the hosted deployment.
263
- eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
264
- Default: ephemeral local harness against evals on disk. Pass
265
- --prod to kick off the batch on the team's hosted deployment
266
- (slug from --slug or the directory name) via /v1/dev/evals/runs
267
- so results appear in the playground and persist when the agent
268
- declares an evals storage table; or --url for a running server
269
- (same server-side path). With --prod/--url, prints an Eval ID as soon as the batch is
270
- accepted (also with --no-wait). Check later with
271
- \`${CLI} eval status <evalId> --prod\` (omit id to list recent
272
- runs; exit 3 while still running) or cancel with
273
- \`${CLI} eval cancel <evalId> --prod\`. The status/cancel
274
- subcommands only bind when --prod/--url is set, so an eval id
275
- named status/cancel still runs locally. Pass evalId args to
276
- select: one datapoint (weather/nyc), a whole file (weather → all
277
- cases in that file), several of either, or omit to run all.
278
- info Print the discovered agent surface (tools, skills, channels, ...).
279
- validate Check the project(s) and exit non-zero on error diagnostics.
280
- login Sign the host in to Cursor: browser sign-in mints a named,
281
- dashboard-revocable API key (only the key is stored). It powers
282
- inference and cursorAccount MCP connections.
283
- logout Remove the stored Cursor credentials.
284
- whoami Show which Cursor account powers this host (and why).
285
- update Upgrade this install to the latest published version (detects
286
- global npm/pnpm/yarn/bun installs and project dependencies).
287
- version Print the ${PACKAGE_NAME} version this CLI will use and exit
288
- (also --version / -V). Text is the version number; --json
289
- prints { name, version, cli }.
290
- deploy Deploy onto Cursor's managed agent-serve hosting, then wait for
291
- the engine to come up. --repo/--ref/--path stay available;
292
- inside an agent git checkout they are inferred when omitted
293
- (flags always win). When --dir is a multi-agent parent,
294
- pick one interactively, or pass --slug / --all. First deploy
295
- of a slug prints the alias token exactly once — save it.
296
- deployments List the team's deployments (slug, status, generation, kind).
297
- deployment Show one deployment in full (status, lastError, engine info).
298
- stop Stop every install of a slug and wait until it reports
299
- stopped. Does not lock deploys or flip tenant enabled.
300
- start Resume every enabled install of a slug. Does not unlock
301
- deploys; run unlock-deploys first after kill.
302
- kill Emergency stop: lock deploys, stop every install, cancel
303
- runs and reminder clocks.
304
- unlock-deploys Allow deploy/upgrade again after kill. Does not resume
305
- traffic; start after unlock.
306
- cancel-runs Request cancellation for active Agent SDK v2 session runs
307
- and reminder clocks, and mark factory creating/active
308
- sessions failed. For a multi-tenant application this
309
- cancels every install, not just the caller's.
310
- Install-local cancel is stop --cancel-runs.
311
- event-repos Set the repositories a multi-tenant install receives events
312
- for. A deploy cannot carry these; pass every repository you
313
- want, since the list is replaced rather than merged.
314
- upgrade Move this team's install onto a release, the newest ready one
315
- by default. Deploying a multi-tenant application publishes a
316
- release without moving any tenant onto it.
317
- rollback Move this team's install onto an earlier ready release, the
318
- nearest one by default. Does not publish a release. Pass
319
- --release to choose an older id or version.
320
- delete Delete a deployment (teardown + purge the record) and wait
321
- until GET 404s. The slug is then free to redeploy.
322
- rotate-token Mint a new alias token for a deployment (shown once); the old
323
- token stops working immediately.
324
- secrets Manage deployment secrets: set (names only by default: hidden
325
- prompt or piped stdin; NAME=VALUE requires --from-argv), list
326
- (names + createdAt; never values), unset.
327
- images Container images for persistent agents: push <local-image>
328
- --name <name> (docker save, upload), list, rm <name>.
329
- slack Slack channel pack: create/destroy/icon (dashboard wizard),
330
- doctor (see slack help).
331
- github GitHub webhook pack: forward live deliveries, events, doctor
332
- (wraps \`gh webhook forward\`; see github help).
333
- gitlab GitLab webhook pack: replay a merge request, events, forward
334
- recipe (see gitlab help).
335
- bitbucket Bitbucket webhook pack (Cloud + Data Center): replay a pull
336
- request, events, forward recipe (see bitbucket help).
337
-
338
- Agent loop:
339
- ${CLI} validate --dir .
340
- ${CLI} info --dir . --json
341
- ${CLI} run --dir . --message "..."
342
- ${CLI} eval --dir .
343
- ${CLI} eval --prod --dir .
344
- ${CLI} dev .
345
-
346
- Options:
347
- --version, -V Print the version number and exit.
348
- --dir Project root (defaults to the current directory).
349
- --port Port to listen on (default 3000). When the default is
350
- taken, serve tries the next free port and prints a notice.
351
- An explicit --port fails with a next-port hint instead.
352
- --host Host to bind (default 127.0.0.1).
353
- --mode serve: "multi" (default, slugged /<dir>/v1/*) or "single"
354
- (unslugged /v1/*). Multi also exposes host /v1/health for
355
- ALB/ECS checks; use single when one agent is the whole host.
356
- --dev Dev mode: mounts POST /v1/dev/schedules/:scheduleId and
357
- disables the cron runner (dispatch schedules by hand).
358
- --api-key Cursor API key (defaults to CURSOR_API_KEY, then
359
- CURSOR_API_KEY_FILE — hosted default
360
- /run/cursor/secrets/CURSOR_API_KEY when unset —
361
- then CURSOR_SERVICE_ACCOUNT_KEY, then the stored
362
- \`${CLI} login\` credential).
363
- --key-name login: label for the minted API key (defaults to
364
- "${CLI} (<hostname>)").
365
- --state-root Durable state directory (default <dir>/.agent-serve). Put it
366
- outside any repository whose rules should not reach the agent.
367
- --bearer-token serve: require this bearer token on API routes. chat/run/eval:
368
- send it as the Authorization bearer.
369
- --allow-anonymous serve: admit all HTTP callers (allowAll). For demos behind a
370
- trusted network only; mutually exclusive with --bearer-token.
371
- --allow-anonymous-cursor-github
372
- serve: allow --allow-anonymous together with
373
- githubChannel({ cursorAccount }). Admitted callers can drive
374
- sessions holding the account's repo-scoped GitHub credential,
375
- so use only behind a trusted boundary (e.g. an SSO proxy).
376
- --allow-anonymous-grokbot
377
- serve: allow --allow-anonymous together with a
378
- runtime: "grokbot" mount. Admitted callers can drive turns
379
- on the signed-in account's hosted Grok Bot computer, so use
380
- only behind a trusted boundary (e.g. an SSO proxy).
381
- --allow-anonymous-cursor-account-mcp
382
- serve: allow --allow-anonymous together with
383
- defineConnection({ cursorAccount: true }). Admitted callers
384
- can drive the account's MCP connectors, so use only behind
385
- a trusted boundary (e.g. an SSO proxy or hosted alias token).
386
- --cursor-scm-proxy serve: route every SCM channel's cursorAccount API calls
387
- (githubChannel, gitlabChannel, bitbucketChannel) through
388
- the Cursor backend's per-forge forwarder instead of
389
- minting raw tokens into this process
390
- (AGENT_SERVE_<FORGE>_PROXY_URL overrides a base URL).
391
- --public-url serve: base URL where this host is reachable from outside
392
- (e.g. https://agent-serve.example.com).
393
- --no-schedules Disable the cron runner outside dev mode.
394
- --no-control-plane serve: do not start the bundled control plane (schedule
395
- and reminder clocks). Cursor hosting passes this so the
396
- kit uses the Cursor backend instead.
397
- --team deploy/deployments/deployment/stop/rotate-token and
398
- chat/resume/run/call/eval/logs/sessions/session/playground
399
- --prod: Cursor team id. Defaults to the account's team when
400
- it has one.
401
- --prod chat/resume/run/call/eval/logs/sessions/session/playground:
402
- use the team's hosted deployment. Slug from --slug or the
403
- --dir basename. Mutually exclusive with --url. Requires
404
- \`${CLI} login\`. For eval, this is how you opt into the
405
- persisted server-side batch (default is local).
406
- v2: ${v2HostedVerifyHint()} call --prod and
407
- sessions --prod stay on v1.
408
- --dry-run run/session --prod: mark the hosted v2 turn non-mutating.
409
- ${v2HostedVerifyHint()}
410
- --component run/session --prod: wake this v2 component key,
411
- not the application default.
412
- --as-of run/session --prod: freeze the session clock at this
413
- timezone-bearing ISO-8601 instant.
414
- --once logs: print current progress / log buffer once and exit
415
- (default is to follow).
416
- --print playground/docs: print the URL only; do not open a
417
- browser. install-skills: list the skills and the install
418
- path without writing them.
419
- --no-wait deploy/stop/eval: return right after the request is
420
- accepted instead of polling until a terminal status.
421
- For eval, prints the runId (deployment / --url only).
422
- --cancel-runs stop: also cancel this install's active Agent SDK v2
423
- session runs and reminder clocks, and mark factory
424
- creating/active sessions failed (not every tenant).
425
- --no-playground Disable the bundled web playground at /playground (also skips
426
- auto-build / HMR).
427
- --no-docs Disable the documentation site at /docs (also skips its
428
- auto-build).
429
- --url chat/resume/run/call/eval/logs/sessions/session/playground:
430
- base URL of a running agent (skip local host). Mutually
431
- exclusive with --prod.
432
- --message chat/resume/run: user message (repeatable for run).
433
- --input call: JSON object of tool arguments (default {}).
434
- --messages-file JSON array of strings (run).
435
- --session Existing session id (run/call follow-up, or chat reattach).
436
- Prefer \`${CLI} resume [sessionId]\` for interactive
437
- reattach.
438
- --resume chat: reattach the previous followable session (most
439
- recently updated in /v1/sessions). Same as
440
- \`${CLI} resume\` with no session id. Ignored when
441
- --session is also set.
442
- --continuation-token Token from a prior run/chat/resume response (optional
443
- for resume / chat --session/--resume; looked up via
444
- /v1/sessions when omitted).
445
- --events run: write NDJSON trace to this path (default
446
- <dir>/.agent-serve/traces/<sessionId>.ndjson).
447
- trajectory: read this file. session: print raw
448
- { sessionId, events } JSON (boolean; no path).
449
- --no-events run: do not write a trace file.
450
- --slug Agent slug when --dir mounts multiple agents.
451
- --timeout-ms Abort a hung turn after N milliseconds.
452
- --tag eval: only run cases with this tag (repeatable).
453
- --list eval: print discovered cases without running.
454
- --verbose eval: stream t.log lines and reply snippets.
455
- --strict eval: a missed soft threshold (SCORED) also exits 1.
456
- --max-concurrency eval: override evals.config.ts maxConcurrency.
457
- --junit eval: write JUnit XML here for CI annotations.
458
- --artifacts eval: run-artifact directory (default a timestamped dir
459
- under <dir>/.agent-serve/evals/).
460
- --no-artifacts eval: do not write run artifacts.
461
- --skip-report eval: ignore reporters from evals.config.ts / eval files.
462
- --no-stream run/eval: silence live progress on stderr (JSON still prints).
463
- --json JSON output (init/convert-automation/install-skills/
464
- info/chat/eval/logs/version/
465
- sessions/session/github; run defaults to JSON). logs:
466
- NDJSON progress/log events. session: trajectory JSON
467
- (not raw events).
468
- --no-color chat: force plain output.
469
- --cursor-events serve: pull SCM webhook events from /v0/scm-events. The
470
- stream is read as your Cursor user, so serve requires
471
- sign-in (\`${CLI} login\` / CURSOR_API_KEY) and --repo.
472
- Offset under <state-root>/cursor-events/.
473
- CURSOR_API_BASE_URL overrides.
474
- --repo serve --cursor-events: repo to subscribe to (repeatable).
475
- github forward: owner/repo to forward from (inferred from
476
- the git remote when omitted; last wins).
477
- deploy: https git repo URL (optional; inferred from
478
- git remote origin when omitted).
479
- --ref deploy: git ref to build (optional; inferred from the
480
- current branch when omitted).
481
- --path deploy: agent dir relative to repo root (optional;
482
- inferred from --dir vs git toplevel when omitted).
483
- --all deploy: every child agent under a multi-agent --dir
484
- (skips the interactive picker; mutually exclusive with
485
- --slug).
486
- --cursor-events-repo deploy: repo (owner/name) the deployed agent
487
- watches (repeatable).
488
- --allow-domain deploy: egress domain the engine pod may reach
489
- (repeatable; unioned with hosting.egressDomains from the
490
- agent manifest). Repo-backed deploys only.
491
- --from-argv secrets set: allow NAME=VALUE on argv (leaks into shell
492
- history and agent-captured terminals). Default is names
493
- only with a hidden prompt or piped stdin.
494
- --org github forward: organization login (org-level hooks).
495
- --channel github: select one channel id when several are declared.
496
- --secret github forward: webhook signing secret (defaults to
497
- GITHUB_WEBHOOK_SECRET). github: --events overrides the
498
- derived webhook event list.
499
- --install github: install the cli/gh-webhook extension if missing.
500
- slack init --manual: require Slack CLI app install.
501
- --no-install slack init --manual: skip Slack CLI app install.
502
- --action github/gitlab replay: event action (e.g. opened, open).
503
- --conclusion github replay: CI conclusion (check_run/suite/status).
504
- gitlab replay: pipeline status (success, failed, …).
505
- --comment github/gitlab/bitbucket replay: comment / note body.
506
- --context github replay: commit-status context.
507
- --dry-run github replay: print synthesized payloads, don't POST.
508
- --out eval / eval status <runId>: also write the full results
509
- JSON to this path. session: write the raw NDJSON trace
510
- there instead of printing (same format as run --events;
511
- playground-openable). github replay: write synthesized
512
- payloads as fixtures.
513
- `;
514
-
515
- function writeStdout(text: string): Promise<void> {
516
- return new Promise((resolve, reject) => {
517
- process.stdout.write(text, error => {
518
- if (error) {
519
- reject(error);
520
- return;
521
- }
522
- resolve();
523
- });
524
- });
525
- }
526
-
527
- async function main(argv: string[]): Promise<number> {
528
- const [command, ...restIn] = argv;
529
- if (command === undefined || command === "help" || command === "--help" || command === "-h") {
530
- // Await the write: HELP is larger than a pipe buffer, and process.exit
531
- // after main() would otherwise truncate --help under execFile / CI.
532
- await writeStdout(HELP);
533
- return command === undefined ? 1 : 0;
534
- }
535
- if (command === "version" || command === "--version" || command === "-V") {
536
- await writeStdout(formatCliVersion({ json: restIn.includes("--json") }));
537
- return 0;
538
- }
539
-
540
- // `session --events` means "dump raw events" (boolean). Rewrite so it does
541
- // not collide with run/trajectory's `--events <file.ndjson>` string flag.
542
- const rest =
543
- command === "session" ? restIn.map(arg => (arg === "--events" ? "--raw-events" : arg)) : restIn;
544
-
545
- const { values, positionals } = parseArgs({
546
- args: rest,
547
- allowPositionals: true,
548
- options: {
549
- dir: { type: "string", default: "." },
550
- template: { type: "string" },
551
- var: { type: "string", multiple: true },
552
- port: { type: "string" },
553
- host: { type: "string" },
554
- mode: { type: "string" },
555
- dev: { type: "boolean", default: false },
556
- "api-key": { type: "string" },
557
- "key-name": { type: "string" },
558
- "state-root": { type: "string" },
559
- "bearer-token": { type: "string" },
560
- "allow-anonymous": { type: "boolean", default: false },
561
- "allow-anonymous-cursor-github": { type: "boolean", default: false },
562
- "allow-anonymous-cursor-account-mcp": { type: "boolean", default: false },
563
- "allow-anonymous-grokbot": { type: "boolean", default: false },
564
- "cursor-scm-proxy": { type: "boolean", default: false },
565
- "no-schedules": { type: "boolean", default: false },
566
- "no-control-plane": { type: "boolean", default: false },
567
- "no-playground": { type: "boolean", default: false },
568
- "no-docs": { type: "boolean", default: false },
569
- url: { type: "string" },
570
- prod: { type: "boolean", default: false },
571
- message: { type: "string", multiple: true },
572
- input: { type: "string" },
573
- "messages-file": { type: "string" },
574
- "session-id": { type: "string" },
575
- session: { type: "string" },
576
- resume: { type: "boolean", default: false },
577
- "continuation-token": { type: "string" },
578
- events: { type: "string" },
579
- "no-events": { type: "boolean", default: false },
580
- slug: { type: "string" },
581
- "timeout-ms": { type: "string" },
582
- tag: { type: "string", multiple: true },
583
- list: { type: "boolean", default: false },
584
- verbose: { type: "boolean", default: false },
585
- text: { type: "boolean", default: false },
586
- "no-color": { type: "boolean", default: false },
587
- "no-stream": { type: "boolean", default: false },
588
- once: { type: "boolean", default: false },
589
- "raw-events": { type: "boolean", default: false },
590
- json: { type: "boolean", default: false },
591
- name: { type: "string" },
592
- env: { type: "string" },
593
- "public-url": { type: "string" },
594
- "cloud-tools-url": { type: "string" },
595
- "mount-path": { type: "string" },
596
- "base-url": { type: "string" },
597
- print: { type: "boolean", default: false },
598
- store: { type: "boolean", default: false },
599
- remote: { type: "boolean", default: false },
600
- transport: { type: "string" },
601
- prefix: { type: "string" },
602
- "no-prefix": { type: "boolean", default: false },
603
- "channel-posts": { type: "boolean", default: false },
604
- "slack-team": { type: "string" },
605
- icon: { type: "string" },
606
- force: { type: "boolean", default: false },
607
- manual: { type: "boolean", default: false },
608
- repo: { type: "string", multiple: true },
609
- org: { type: "string" },
610
- "cursor-events": { type: "boolean", default: false },
611
- secret: { type: "string" },
612
- channel: { type: "string", multiple: true },
613
- install: { type: "boolean", default: false },
614
- "no-install": { type: "boolean", default: false },
615
- action: { type: "string" },
616
- conclusion: { type: "string" },
617
- context: { type: "string" },
618
- comment: { type: "string" },
619
- "dry-run": { type: "boolean", default: false },
620
- "as-of": { type: "string" },
621
- component: { type: "string" },
622
- out: { type: "string" },
623
- team: { type: "string" },
624
- "no-wait": { type: "boolean", default: false },
625
- "cancel-runs": { type: "boolean", default: false },
626
- ref: { type: "string" },
627
- release: { type: "string" },
628
- path: { type: "string" },
629
- all: { type: "boolean", default: false },
630
- "cursor-events-repo": { type: "string", multiple: true },
631
- "allow-domain": { type: "string", multiple: true },
632
- // Hidden Anysphere-only flag; omitted from help.
633
- "multi-tenant": { type: "boolean", default: false },
634
- "from-argv": { type: "boolean", default: false },
635
- strict: { type: "boolean", default: false },
636
- junit: { type: "string" },
637
- artifacts: { type: "string" },
638
- "no-artifacts": { type: "boolean", default: false },
639
- "skip-report": { type: "boolean", default: false },
640
- "max-concurrency": { type: "string" },
641
- version: { type: "boolean", short: "V", default: false },
642
- },
643
- });
644
- const dir = values.dir ?? ".";
645
- if (values.version === true) {
646
- await writeStdout(formatCliVersion({ json: values.json === true }));
647
- return 0;
648
- }
649
-
650
- // Best-effort, cached, and silent on failure. `update` does its own fresh
651
- // lookup, --json runs stay quiet for machine consumers, and `mcp` skips it
652
- // so MCP client spawns stay fast (stdout there is the protocol wire).
653
- if (
654
- command !== "update" &&
655
- command !== "mcp" &&
656
- values.json !== true &&
657
- !isServeRestartWorker()
658
- ) {
659
- await warnIfOutdated();
660
- }
661
-
662
- switch (command) {
663
- case "slack": {
664
- const { cmdSlack } = await import("../internal/cli-slack.js");
665
- const env =
666
- values.env === "dev" || values.env === "prod" || values.env === "both"
667
- ? values.env
668
- : undefined;
669
- return cmdSlack(positionals[0], {
670
- dir,
671
- name: values.name,
672
- env,
673
- json: values.json,
674
- print: values.print,
675
- prefix: values.prefix,
676
- noPrefix: values["no-prefix"],
677
- channelPosts: values["channel-posts"],
678
- channels: values.channel,
679
- slackTeam: values["slack-team"],
680
- prod: values.prod,
681
- team: values.team,
682
- apiKey: values["api-key"],
683
- icon: values.icon,
684
- force: values.force,
685
- manual: values.manual,
686
- install: values.install,
687
- noInstall: values["no-install"],
688
- iconSource: positionals[0] === "icon" ? positionals[1] : undefined,
689
- });
690
- }
691
- case "github": {
692
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
693
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
694
- process.stderr.write(`invalid --port: ${values.port}\n`);
695
- return 1;
696
- }
697
- const { cmdGithub } = await import("../internal/cli-github.js");
698
- return cmdGithub(positionals[0], {
699
- dir,
700
- slug: values.slug,
701
- // `--channel` is repeatable for `slack doctor`; the github
702
- // subcommands target a single channel, so the last one wins.
703
- channel: values.channel?.at(-1),
704
- host: values.host,
705
- port,
706
- url: values.url,
707
- events: values.events,
708
- // `--repo` is repeatable for `serve --cursor-events`; the github
709
- // subcommands target a single repo, so the last one wins.
710
- repo: values.repo?.at(-1),
711
- org: values.org,
712
- secret: values.secret,
713
- install: values.install,
714
- json: values.json,
715
- prUrl: positionals[1],
716
- action: values.action,
717
- conclusion: values.conclusion,
718
- context: values.context,
719
- comment: values.comment,
720
- dryRun: values["dry-run"],
721
- out: values.out,
722
- });
723
- }
724
- case "gitlab": {
725
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
726
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
727
- process.stderr.write(`invalid --port: ${values.port}\n`);
728
- return 1;
729
- }
730
- const { cmdGitlab } = await import("../internal/cli-gitlab.js");
731
- return cmdGitlab(positionals[0], {
732
- dir,
733
- slug: values.slug,
734
- channel: values.channel?.at(-1),
735
- host: values.host,
736
- port,
737
- url: values.url,
738
- events: values.events,
739
- secret: values.secret,
740
- json: values.json,
741
- mrUrl: positionals[1],
742
- action: values.action,
743
- conclusion: values.conclusion,
744
- comment: values.comment,
745
- dryRun: values["dry-run"],
746
- out: values.out,
747
- });
748
- }
749
- case "bitbucket": {
750
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
751
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
752
- process.stderr.write(`invalid --port: ${values.port}\n`);
753
- return 1;
754
- }
755
- const { cmdBitbucket } = await import("../internal/cli-bitbucket.js");
756
- return cmdBitbucket(positionals[0], {
757
- dir,
758
- slug: values.slug,
759
- channel: values.channel?.at(-1),
760
- host: values.host,
761
- port,
762
- url: values.url,
763
- events: values.events,
764
- secret: values.secret,
765
- json: values.json,
766
- prUrl: positionals[1],
767
- comment: values.comment,
768
- dryRun: values["dry-run"],
769
- out: values.out,
770
- });
771
- }
772
- case "init": {
773
- return cmdInit({
774
- dir,
775
- initTarget: positionals[0],
776
- template: values.template,
777
- vars: values.var,
778
- json: values.json,
779
- });
780
- }
781
-
782
- case "convert-automation": {
783
- const { cmdConvertAutomation } = await import("../internal/cli-convert-automation.js");
784
- const dirFlagPassed = rest.includes("--dir") || rest.some(arg => arg.startsWith("--dir="));
785
- return cmdConvertAutomation({
786
- url: positionals[0],
787
- // Default target is ./<automation-name-slug>, not the cwd.
788
- dir: dirFlagPassed ? dir : undefined,
789
- json: values.json,
790
- apiKey: values["api-key"],
791
- });
792
- }
793
-
794
- case "install-skills": {
795
- const { cmdInstallSkills } = await import("../internal/cli-skills.js");
796
- return cmdInstallSkills({
797
- json: values.json,
798
- print: values.print,
799
- });
800
- }
801
-
802
- case "mcp": {
803
- const { cmdMcp } = await import("../internal/cli-mcp.js");
804
- const mcpSub = positionals[0];
805
- return cmdMcp(mcpSub, {
806
- dir,
807
- slug: values.slug,
808
- team: values.team,
809
- apiKey: values["api-key"],
810
- url: values.url,
811
- prod: values.prod,
812
- bearerToken: values["bearer-token"],
813
- name: values.name,
814
- print: values.print,
815
- json: values.json,
816
- store: values.store,
817
- remote: values.remote,
818
- oauthConnection: mcpSub === "oauth" ? positionals[1] : undefined,
819
- });
820
- }
821
-
822
- case "login": {
823
- const { cmdLogin } = await import("../internal/cli-cursor.js");
824
- return cmdLogin({
825
- apiKey: values["api-key"],
826
- keyName: values["key-name"],
827
- });
828
- }
829
-
830
- case "logout": {
831
- const { cmdLogout } = await import("../internal/cli-cursor.js");
832
- return cmdLogout();
833
- }
834
-
835
- case "whoami": {
836
- const { cmdWhoami } = await import("../internal/cli-cursor.js");
837
- return cmdWhoami({ json: values.json });
838
- }
839
-
840
- case "update": {
841
- return cmdUpdate();
842
- }
843
-
844
- case "deploy": {
845
- // `--repo` is repeatable for `serve --cursor-events`; deploy targets a
846
- // single source repo, so the last one wins.
847
- const repo = values.repo?.at(-1);
848
- return cmdDeploy({
849
- ...deployOptionsFromValues(values),
850
- dir,
851
- ...(values.slug === undefined ? {} : { slug: values.slug }),
852
- all: values.all === true,
853
- ...(repo === undefined ? {} : { repo }),
854
- ...(values.ref === undefined ? {} : { ref: values.ref }),
855
- ...(values.path === undefined ? {} : { path: values.path }),
856
- ...(values["cursor-events-repo"] === undefined
857
- ? {}
858
- : { cursorEventsRepos: values["cursor-events-repo"] }),
859
- ...(values["allow-domain"] === undefined ? {} : { allowDomains: values["allow-domain"] }),
860
- multiTenant: values["multi-tenant"] === true,
861
- });
862
- }
863
-
864
- case "manifest": {
865
- // Offline extraction of deploy metadata (events, egress, routes,
866
- // /v1/info payload) — no VM, no network. Wd-1 of the event-ingress
867
- // plan; `deploy` attaches this to the request from Wd-2 on.
868
- return cmdManifest({ dir, json: values.json === true });
869
- }
870
-
871
- case "deployments": {
872
- return cmdDeployments(deployOptionsFromValues(values));
873
- }
874
-
875
- case "deployment": {
876
- return cmdDeploymentStatus(positionals[0], deployOptionsFromValues(values));
877
- }
878
-
879
- case "stop": {
880
- return cmdStop(positionals[0], deployOptionsFromValues(values));
881
- }
882
-
883
- case "kill": {
884
- return cmdKill(positionals[0], deployOptionsFromValues(values));
885
- }
886
-
887
- case "unlock-deploys": {
888
- return cmdUnlockDeploys(positionals[0], deployOptionsFromValues(values));
889
- }
890
-
891
- case "start": {
892
- return cmdStart(positionals[0], deployOptionsFromValues(values));
893
- }
894
-
895
- case "cancel-runs": {
896
- return cmdCancelRuns(positionals[0], deployOptionsFromValues(values));
897
- }
898
-
899
- case "event-repos": {
900
- return cmdEventRepos(positionals[0], values.repo ?? [], deployOptionsFromValues(values));
901
- }
902
-
903
- case "upgrade": {
904
- return cmdUpgrade(
905
- { slug: positionals[0], release: values.release },
906
- deployOptionsFromValues(values),
907
- );
908
- }
909
-
910
- case "rollback": {
911
- return cmdRollback(
912
- { slug: positionals[0], release: values.release },
913
- deployOptionsFromValues(values),
914
- );
915
- }
916
-
917
- case "delete": {
918
- return cmdDelete(positionals[0], deployOptionsFromValues(values));
919
- }
920
-
921
- case "rotate-token": {
922
- return cmdRotateToken(positionals[0], deployOptionsFromValues(values));
923
- }
924
-
925
- case "secrets": {
926
- const base = deployOptionsFromValues(values);
927
- switch (positionals[0]) {
928
- case "set":
929
- return cmdSecretsSet(positionals[1], positionals.slice(2), base);
930
- case "list":
931
- return cmdSecretsList(positionals[1], base);
932
- case "unset":
933
- return cmdSecretsUnset(positionals[1], positionals[2], base);
934
- default:
935
- process.stderr.write(
936
- `Usage: ${CLI} secrets <set|list|unset> <slug> ... [--team <id>] [--json]\n`,
937
- );
938
- return 1;
939
- }
940
- }
941
-
942
- case "images": {
943
- const base = deployOptionsFromValues(values);
944
- switch (positionals[0]) {
945
- case "push":
946
- return cmdImagesPush({ image: positionals[1], name: values.name }, base);
947
- case "list":
948
- return cmdImagesList(base);
949
- case "rm":
950
- return cmdImagesRm(positionals[1], base);
951
- default:
952
- process.stderr.write(
953
- `Usage: ${CLI} images <push <local-image> --name <name>|list|rm <name>> [--team <id>] [--json]\n`,
954
- );
955
- return 1;
956
- }
957
- }
958
-
959
- case "run": {
960
- const messages = await loadMessages(values.message, values["messages-file"]);
961
- return cmdRun(
962
- axFromOptions({
963
- dir,
964
- messages,
965
- sessionId: values["session-id"] ?? values.session,
966
- continuationToken: values["continuation-token"],
967
- events: values["no-events"] ? false : values.events === undefined ? true : values.events,
968
- text: values.text,
969
- url: values.url,
970
- prod: values.prod,
971
- team: values.team,
972
- apiKey: values["api-key"],
973
- slug: values.slug,
974
- bearerToken: values["bearer-token"],
975
- stateRoot: values["state-root"],
976
- timeoutMs: parseTimeoutMs(values["timeout-ms"]),
977
- stream: values["no-stream"] ? false : undefined,
978
- dryRun: values["dry-run"],
979
- asOf: values["as-of"],
980
- componentKey: values.component,
981
- }),
982
- );
983
- }
984
-
985
- case "call": {
986
- return cmdCall(
987
- axFromOptions({
988
- dir,
989
- toolName: positionals[0],
990
- toolInput: values.input,
991
- sessionId: values["session-id"] ?? values.session,
992
- url: values.url,
993
- prod: values.prod,
994
- team: values.team,
995
- apiKey: values["api-key"],
996
- slug: values.slug,
997
- bearerToken: values["bearer-token"],
998
- stateRoot: values["state-root"],
999
- }),
1000
- );
1001
- }
1002
-
1003
- case "skill": {
1004
- return cmdSkill(
1005
- positionals[0],
1006
- axFromOptions({
1007
- dir,
1008
- text: values.text,
1009
- url: values.url,
1010
- prod: values.prod,
1011
- team: values.team,
1012
- apiKey: values["api-key"],
1013
- slug: values.slug,
1014
- bearerToken: values["bearer-token"],
1015
- stateRoot: values["state-root"],
1016
- }),
1017
- );
1018
- }
1019
-
1020
- case "trajectory": {
1021
- if (values.events === undefined) {
1022
- process.stderr.write("trajectory requires --events <file.ndjson>\n");
1023
- return 1;
1024
- }
1025
- return cmdTrajectory(
1026
- axFromOptions({
1027
- dir,
1028
- events: values.events,
1029
- text: values.text,
1030
- }),
1031
- );
1032
- }
1033
-
1034
- case "eval": {
1035
- // Remote status subcommand only when targeting --prod/--url. Otherwise
1036
- // the bare token "status" is a normal eval id (evals/status.eval.ts).
1037
- if (positionals[0] === "status" && (values.prod === true || values.url !== undefined)) {
1038
- return cmdEvalStatus(
1039
- positionals[1],
1040
- axFromOptions({
1041
- dir,
1042
- json: values.json,
1043
- url: values.url,
1044
- prod: values.prod,
1045
- team: values.team,
1046
- apiKey: values["api-key"],
1047
- slug: values.slug,
1048
- bearerToken: values["bearer-token"],
1049
- out: values.out,
1050
- }),
1051
- );
1052
- }
1053
- if (positionals[0] === "cancel" && (values.prod === true || values.url !== undefined)) {
1054
- return cmdEvalCancel(
1055
- positionals[1],
1056
- axFromOptions({
1057
- dir,
1058
- json: values.json,
1059
- url: values.url,
1060
- prod: values.prod,
1061
- team: values.team,
1062
- apiKey: values["api-key"],
1063
- slug: values.slug,
1064
- bearerToken: values["bearer-token"],
1065
- }),
1066
- );
1067
- }
1068
- return cmdEval(
1069
- axFromOptions({
1070
- dir,
1071
- evalIds: positionals,
1072
- list: values.list,
1073
- verbose: values.verbose,
1074
- json: values.json,
1075
- tags: values.tag,
1076
- url: values.url,
1077
- prod: values.prod,
1078
- noWait: values["no-wait"],
1079
- team: values.team,
1080
- apiKey: values["api-key"],
1081
- slug: values.slug,
1082
- bearerToken: values["bearer-token"],
1083
- stateRoot: values["state-root"],
1084
- timeoutMs: parseTimeoutMs(values["timeout-ms"]),
1085
- stream: values["no-stream"] ? false : undefined,
1086
- strict: values.strict,
1087
- junit: values.junit,
1088
- artifacts: values["no-artifacts"] ? false : values.artifacts,
1089
- skipReport: values["skip-report"],
1090
- maxConcurrency: parseMaxConcurrency(values["max-concurrency"]),
1091
- out: values.out,
1092
- }),
1093
- );
1094
- }
1095
-
1096
- case "chat": {
1097
- return cmdChat(
1098
- axFromOptions({
1099
- dir,
1100
- messages: values.message,
1101
- url: values.url,
1102
- prod: values.prod,
1103
- team: values.team,
1104
- apiKey: values["api-key"],
1105
- slug: values.slug,
1106
- sessionId: values["session-id"] ?? values.session,
1107
- resume: values.resume,
1108
- continuationToken: values["continuation-token"],
1109
- bearerToken: values["bearer-token"],
1110
- json: values.json,
1111
- text: values.text,
1112
- noColor: values["no-color"],
1113
- }),
1114
- );
1115
- }
1116
-
1117
- case "resume": {
1118
- return cmdResume(
1119
- positionals[0],
1120
- axFromOptions({
1121
- dir,
1122
- messages: values.message,
1123
- url: values.url,
1124
- prod: values.prod,
1125
- team: values.team,
1126
- apiKey: values["api-key"],
1127
- slug: values.slug,
1128
- // Positional wins; --session is accepted as a redundant alias.
1129
- // No id → resume previous (cmdResume sets resume: true).
1130
- sessionId: positionals[0] ?? values["session-id"] ?? values.session,
1131
- continuationToken: values["continuation-token"],
1132
- bearerToken: values["bearer-token"],
1133
- json: values.json,
1134
- text: values.text,
1135
- noColor: values["no-color"],
1136
- }),
1137
- );
1138
- }
1139
-
1140
- case "logs": {
1141
- return cmdLogs(
1142
- axFromOptions({
1143
- dir,
1144
- url: values.url,
1145
- prod: values.prod,
1146
- team: values.team,
1147
- apiKey: values["api-key"],
1148
- slug: values.slug,
1149
- bearerToken: values["bearer-token"],
1150
- json: values.json,
1151
- once: values.once,
1152
- }),
1153
- );
1154
- }
1155
-
1156
- case "sessions": {
1157
- return cmdSessions(
1158
- axFromOptions({
1159
- dir,
1160
- url: values.url,
1161
- prod: values.prod,
1162
- team: values.team,
1163
- apiKey: values["api-key"],
1164
- slug: values.slug,
1165
- bearerToken: values["bearer-token"],
1166
- json: values.json,
1167
- }),
1168
- );
1169
- }
1170
-
1171
- case "session": {
1172
- const messages = await loadMessages(values.message, values["messages-file"]);
1173
- return cmdSession(
1174
- positionals[0],
1175
- axFromOptions({
1176
- dir,
1177
- url: values.url,
1178
- prod: values.prod,
1179
- team: values.team,
1180
- apiKey: values["api-key"],
1181
- slug: values.slug,
1182
- bearerToken: values["bearer-token"],
1183
- json: values.json,
1184
- text: values.text,
1185
- rawEvents: values["raw-events"],
1186
- out: values.out,
1187
- messages,
1188
- sessionId: values["session-id"] ?? values.session,
1189
- dryRun: values["dry-run"],
1190
- asOf: values["as-of"],
1191
- componentKey: values.component,
1192
- }),
1193
- );
1194
- }
1195
-
1196
- case "cost": {
1197
- return cmdCost(
1198
- positionals[0] ?? values["session-id"] ?? values.session,
1199
- axFromOptions({
1200
- dir,
1201
- url: values.url,
1202
- prod: values.prod,
1203
- team: values.team,
1204
- apiKey: values["api-key"],
1205
- slug: values.slug,
1206
- bearerToken: values["bearer-token"],
1207
- json: values.json,
1208
- }),
1209
- );
1210
- }
1211
-
1212
- case "playground": {
1213
- return cmdPlayground(
1214
- axFromOptions({
1215
- dir,
1216
- url: values.url,
1217
- prod: values.prod,
1218
- team: values.team,
1219
- apiKey: values["api-key"],
1220
- slug: values.slug,
1221
- bearerToken: values["bearer-token"],
1222
- sessionId: values["session-id"] ?? values.session,
1223
- print: values.print,
1224
- }),
1225
- );
1226
- }
1227
-
1228
- case "docs": {
1229
- const docsPort = values.port === undefined ? 0 : Number.parseInt(values.port, 10);
1230
- if (Number.isNaN(docsPort) || docsPort < 0 || docsPort > 65535) {
1231
- process.stderr.write(`invalid --port: ${values.port}\n`);
1232
- return 1;
1233
- }
1234
- const { cmdDocs } = await import("../internal/cli-docs.js");
1235
- return cmdDocs({
1236
- port: docsPort,
1237
- host: values.host,
1238
- print: values.print === true,
1239
- });
1240
- }
1241
-
1242
- case "validate": {
1243
- const mounts = await loadMounts(dir);
1244
- let hasError = false;
1245
- for (const { slug, project } of mounts) {
1246
- const label = slug === "" ? project.name : `${slug} (${project.name})`;
1247
- if (project.diagnostics.length === 0) {
1248
- process.stdout.write(`ok: ${label} has no diagnostics\n`);
1249
- continue;
1250
- }
1251
- process.stdout.write(`${label}:\n${formatDiagnostics(project.diagnostics)}\n`);
1252
- hasError ||= project.diagnostics.some(d => d.severity === "error");
1253
- }
1254
- return hasError ? 1 : 0;
1255
- }
1256
-
1257
- case "info": {
1258
- const mounts = await loadMounts(dir);
1259
- if (values.json) {
1260
- const payload =
1261
- mounts.length === 1 && mounts[0]?.slug === ""
1262
- ? projectInfo(mounts[0].project)
1263
- : {
1264
- agents: mounts.map(({ slug, project }) => ({
1265
- slug,
1266
- ...projectInfo(project),
1267
- })),
1268
- };
1269
- process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
1270
- return 0;
1271
- }
1272
- if (mounts.length > 1 || mounts[0]?.slug !== "") {
1273
- process.stdout.write(`${mounts.length} agents under ${dir}:\n\n`);
1274
- for (const { slug, project } of mounts) {
1275
- const info = projectInfo(project);
1276
- process.stdout.write(
1277
- ` /${slug} — ${info.name} (${formatModel(info.model)}, ${info.tools.length} tools, ${info.channels.length} channels)\n`,
1278
- );
1279
- }
1280
- const anyError = mounts.some(m => m.project.diagnostics.some(d => d.severity === "error"));
1281
- return anyError ? 1 : 0;
1282
- }
1283
- const project = mounts[0]?.project as AgentProject;
1284
- const info = projectInfo(project);
1285
- const lines: string[] = [];
1286
- lines.push(`agent: ${info.name}`);
1287
- lines.push(`model: ${formatModel(info.model)}`);
1288
- lines.push(`mcp: ${info.mcp.path} (${info.mcp.tools.join(", ")})`);
1289
- if (info.instructions !== undefined) {
1290
- lines.push(`instructions: ${info.instructions.chars} chars`);
1291
- }
1292
- lines.push(
1293
- section(
1294
- "tools",
1295
- info.tools.map(t => `${t.name} — ${t.description}`),
1296
- ),
1297
- );
1298
- lines.push(
1299
- section(
1300
- "skills",
1301
- info.skills.map(s => `${s.name} — ${s.description}`),
1302
- ),
1303
- );
1304
- lines.push(
1305
- section(
1306
- "extensions",
1307
- info.extensions.map(
1308
- e => `${e.name} — ${[...e.tools, ...e.skills].join(", ") || "(nothing contributed)"}`,
1309
- ),
1310
- ),
1311
- );
1312
- lines.push(
1313
- section(
1314
- "MCP connections",
1315
- info.connections.map(c => `${c.name} — ${c.transport}`),
1316
- ),
1317
- );
1318
- lines.push(
1319
- section(
1320
- "subagents",
1321
- info.subagents.map(s => `${s.name} — ${s.description ?? ""}`),
1322
- ),
1323
- );
1324
- lines.push(
1325
- section(
1326
- "channels",
1327
- info.channels.map(
1328
- c =>
1329
- `${c.id}: ${c.routes.map(r => `${r.method} ${r.url}`).join(", ") || "(events only)"}`,
1330
- ),
1331
- ),
1332
- );
1333
- lines.push(
1334
- section(
1335
- "schedules",
1336
- info.schedules.map(s => `${s.name} (${s.cron}, ${s.kind})`),
1337
- ),
1338
- );
1339
- lines.push(section("hooks", info.hooks));
1340
- lines.push(section("hosting egress domains", info.hosting?.egressDomains ?? []));
1341
- lines.push(section("hosting secret names", info.hosting?.secretNames ?? []));
1342
- if (info.diagnostics.length > 0) {
1343
- lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
1344
- }
1345
- process.stdout.write(`${lines.filter(line => line !== "").join("\n")}\n`);
1346
- return info.diagnostics.some(d => d.severity === "error") ? 1 : 0;
1347
- }
1348
-
1349
- case "dev":
1350
- case "serve": {
1351
- const serveDirResult = resolveServeDir({
1352
- command,
1353
- dir,
1354
- positionals,
1355
- dirFlagPassed: rest.includes("--dir"),
1356
- });
1357
- if (typeof serveDirResult !== "string") {
1358
- process.stderr.write(serveDirResult.error);
1359
- return 1;
1360
- }
1361
- const serveDir = serveDirResult;
1362
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
1363
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
1364
- process.stderr.write(`invalid --port: ${values.port}\n`);
1365
- return 1;
1366
- }
1367
- if (values["allow-anonymous"] === true && values["bearer-token"] !== undefined) {
1368
- process.stderr.write("--allow-anonymous and --bearer-token are mutually exclusive\n");
1369
- return 1;
1370
- }
1371
- const mode = values.mode;
1372
- if (mode !== undefined && mode !== "single" && mode !== "multi") {
1373
- process.stderr.write(`invalid --mode: ${mode} (expected "single" or "multi")\n`);
1374
- return 1;
1375
- }
1376
- const dev = command === "dev" || values.dev === true;
1377
- const style = stdoutPalette();
1378
- // Real env wins (loadEnvFile never overrides). Runs inside start()
1379
- // so dev's Enter-restart picks up tokens written since boot.
1380
- const loadLocalEnv = (): void => {
1381
- const loadedEnvFiles = loadAgentLocalEnv(serveDir);
1382
- if (loadedEnvFiles.length > 0) {
1383
- process.stdout.write(`${style.dim(`env: loaded ${loadedEnvFiles.join(", ")}`)}\n`);
1384
- }
1385
- };
1386
- const serveOptions = {
1387
- port,
1388
- host: values.host,
1389
- mode: mode as "single" | "multi" | undefined,
1390
- dev,
1391
- apiKey: values["api-key"],
1392
- stateRoot: values["state-root"],
1393
- authToken: values["bearer-token"],
1394
- allowAnonymous: values["allow-anonymous"] === true ? true : undefined,
1395
- allowAnonymousCursorGithub:
1396
- values["allow-anonymous-cursor-github"] === true ? true : undefined,
1397
- allowAnonymousCursorAccountMcp:
1398
- values["allow-anonymous-cursor-account-mcp"] === true ? true : undefined,
1399
- allowAnonymousGrokbot: values["allow-anonymous-grokbot"] === true ? true : undefined,
1400
- cursorScmProxy: values["cursor-scm-proxy"] === true ? true : undefined,
1401
- schedules: values["no-schedules"] === true ? false : undefined,
1402
- noControlPlane: values["no-control-plane"] === true ? true : undefined,
1403
- playground: values["no-playground"] === true ? false : undefined,
1404
- docs: values["no-docs"] === true ? false : undefined,
1405
- publicUrl: values["public-url"],
1406
- cloudToolsUrl: values["cloud-tools-url"],
1407
- cursorEvents: values["cursor-events"] === true ? { repos: values.repo ?? [] } : undefined,
1408
- // Soft boot logs stay secondary to the banner. `dim` is a no-op on
1409
- // already-styled lines (the MCP warning box).
1410
- logger: (line: string) => {
1411
- process.stdout.write(`${style.dim(line)}\n`);
1412
- },
1413
- };
1414
- const enterToRestart = process.stdin.isTTY === true;
1415
- if (enterToRestart && !isServeRestartWorker()) {
1416
- return runEnterRestartSupervisor({
1417
- spawn: (command, args, spawnOptions) => spawn(command, args, spawnOptions),
1418
- onRestart: () => {
1419
- clearTerminal();
1420
- },
1421
- });
1422
- }
1423
-
1424
- const bannerOpts = {
1425
- noPlayground: values["no-playground"] === true,
1426
- dev,
1427
- bearerToken: values["bearer-token"] !== undefined,
1428
- noSchedules: values["no-schedules"] === true,
1429
- };
1430
-
1431
- const start = async (): Promise<AgentServeHandle> => {
1432
- loadLocalEnv();
1433
- const next = await serve(serveDir, serveOptions);
1434
- printServeBanner(next, bannerOpts);
1435
- if (enterToRestart) {
1436
- process.stdout.write(style.dim(" press Enter to restart\n"));
1437
- }
1438
- return next;
1439
- };
1440
-
1441
- const handle = await start();
1442
- let closing = false;
1443
- let restartRequested = false;
1444
-
1445
- await new Promise<void>(resolve => {
1446
- const shutdown = (): void => {
1447
- if (closing) {
1448
- return;
1449
- }
1450
- closing = true;
1451
- process.stdout.write("\nshutting down (draining running turns)\n");
1452
- void handle.close().finally(resolve);
1453
- };
1454
- process.on("SIGINT", shutdown);
1455
- process.on("SIGTERM", shutdown);
1456
-
1457
- if (!enterToRestart) {
1458
- return;
1459
- }
1460
-
1461
- process.stdin.resume();
1462
- process.stdin.on("data", (chunk: string | Buffer) => {
1463
- const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
1464
- if (!isEnterOnly(text) || closing) {
1465
- return;
1466
- }
1467
- closing = true;
1468
- restartRequested = true;
1469
- clearTerminal();
1470
- process.stdout.write(style.dim("restarting…\n"));
1471
- void handle.close().finally(resolve);
1472
- });
1473
- });
1474
- return restartRequested ? ENTER_RESTART_EXIT_CODE : 0;
1475
- }
1476
-
1477
- default: {
1478
- process.stderr.write(`Unknown command "${command}"\n\n${HELP}`);
1479
- return 1;
1480
- }
1481
- }
1482
- }
1483
-
1484
- function deployOptionsFromValues(values: {
1485
- team?: string;
1486
- json?: boolean;
1487
- "no-wait"?: boolean;
1488
- "cancel-runs"?: boolean;
1489
- channel?: string[];
1490
- "api-key"?: string;
1491
- "from-argv"?: boolean;
1492
- }): DeployCliOptions {
1493
- return {
1494
- team: values.team,
1495
- json: values.json === true,
1496
- noWait: values["no-wait"] === true,
1497
- cancelRuns: values["cancel-runs"] === true,
1498
- apiKey: values["api-key"],
1499
- fromArgv: values["from-argv"] === true ? true : undefined,
1500
- };
1501
- }
1502
-
1503
- function axFromOptions(partial: Partial<AxCliOptions> & { dir: string }): AxCliOptions {
1504
- return {
1505
- dir: partial.dir,
1506
- cwd: partial.cwd,
1507
- slug: partial.slug,
1508
- bearerToken: partial.bearerToken,
1509
- stateRoot: partial.stateRoot,
1510
- messages: partial.messages,
1511
- sessionId: partial.sessionId,
1512
- resume: partial.resume,
1513
- continuationToken: partial.continuationToken,
1514
- dryRun: partial.dryRun,
1515
- asOf: partial.asOf,
1516
- componentKey: partial.componentKey,
1517
- timeoutMs: partial.timeoutMs,
1518
- events: partial.events,
1519
- text: partial.text,
1520
- json: partial.json,
1521
- list: partial.list,
1522
- verbose: partial.verbose,
1523
- tags: partial.tags,
1524
- evalIds: partial.evalIds,
1525
- initTarget: partial.initTarget,
1526
- vars: partial.vars,
1527
- toolName: partial.toolName,
1528
- toolInput: partial.toolInput,
1529
- url: partial.url,
1530
- prod: partial.prod,
1531
- noWait: partial.noWait,
1532
- team: partial.team,
1533
- apiKey: partial.apiKey,
1534
- fetchImpl: partial.fetchImpl,
1535
- stream: partial.stream,
1536
- noColor: partial.noColor,
1537
- once: partial.once,
1538
- rawEvents: partial.rawEvents,
1539
- print: partial.print,
1540
- strict: partial.strict,
1541
- junit: partial.junit,
1542
- artifacts: partial.artifacts,
1543
- skipReport: partial.skipReport,
1544
- maxConcurrency: partial.maxConcurrency,
1545
- out: partial.out,
1546
- };
1547
- }
1548
-
1549
- async function loadMessages(
1550
- messages: string[] | undefined,
1551
- messagesFile: string | undefined,
1552
- ): Promise<string[]> {
1553
- const out: string[] = [];
1554
- if (messagesFile !== undefined) {
1555
- const raw = await readFile(resolve(messagesFile), "utf8");
1556
- const parsed = JSON.parse(raw) as unknown;
1557
- if (!Array.isArray(parsed)) {
1558
- throw new Error("--messages-file must be a JSON array of strings");
1559
- }
1560
- for (const item of parsed) {
1561
- if (typeof item !== "string") {
1562
- throw new Error("--messages-file entries must be strings");
1563
- }
1564
- out.push(item);
1565
- }
1566
- }
1567
- if (messages !== undefined) {
1568
- out.push(...messages);
1569
- }
1570
- return out;
1571
- }
1572
-
1573
- function parseTimeoutMs(value: string | undefined): number | undefined {
1574
- if (value === undefined) {
1575
- return undefined;
1576
- }
1577
- const n = Number.parseInt(value, 10);
1578
- if (Number.isNaN(n) || n <= 0) {
1579
- throw new Error(`invalid --timeout-ms: ${value}`);
1580
- }
1581
- return n;
1582
- }
1583
-
1584
- function parseMaxConcurrency(value: string | undefined): number | undefined {
1585
- if (value === undefined) {
1586
- return undefined;
1587
- }
1588
- const n = Number.parseInt(value, 10);
1589
- if (Number.isNaN(n) || n <= 0) {
1590
- throw new Error(`invalid --max-concurrency: ${value}`);
1591
- }
1592
- return n;
1593
- }
1594
-
1595
- /**
1596
- * Load mounts the same way `serve` does (multi-agent layout by default).
1597
- */
1598
- async function loadMounts(dir: string): Promise<Array<{ slug: string; project: AgentProject }>> {
1599
- return resolveAgentMounts(dir);
1600
- }
1601
-
1602
- function section(title: string, items: string[]): string {
1603
- if (items.length === 0) {
1604
- return "";
1605
- }
1606
- return `${title}:\n${items.map(item => ` - ${item}`).join("\n")}`;
1607
- }
1608
-
1609
- function isEnterOnly(text: string): boolean {
1610
- return text.length > 0 && [...text].every(ch => ch === "\n" || ch === "\r");
1611
- }
1612
-
1613
- /**
1614
- * `dev [path]` takes a positional project root; `serve` keeps `--dir` only.
1615
- * Reject mixing a positional with an explicit `--dir`, and extra args on `dev`.
1616
- */
1617
- function resolveServeDir(args: {
1618
- command: string;
1619
- dir: string;
1620
- positionals: string[];
1621
- dirFlagPassed: boolean;
1622
- }): string | { error: string } {
1623
- if (args.command !== "dev") {
1624
- return args.dir;
1625
- }
1626
- if (args.positionals.length > 1) {
1627
- return {
1628
- error: `${CLI} dev: unexpected arguments: ${args.positionals.slice(1).join(" ")}\n`,
1629
- };
1630
- }
1631
- const positionalDir = args.positionals[0];
1632
- if (positionalDir === undefined) {
1633
- return args.dir;
1634
- }
1635
- if (args.dirFlagPassed && args.dir !== positionalDir) {
1636
- return {
1637
- error: `${CLI} dev: pass a path as a positional or --dir, not both\n`,
1638
- };
1639
- }
1640
- return positionalDir;
1641
- }
1642
-
1643
- function printServeBanner(
1644
- handle: AgentServeHandle,
1645
- opts: {
1646
- noPlayground: boolean;
1647
- dev: boolean;
1648
- bearerToken: boolean;
1649
- noSchedules: boolean;
1650
- },
1651
- ): void {
1652
- const c = stdoutPalette();
1653
- const agents = handle.agents;
1654
- // Name the framework build in the boot line: hosted engines install the
1655
- // published package at provision time, so the serve log is the only
1656
- // durable record of which build a deployment's turns actually ran on.
1657
- const versionTag = c.dim(`(${PACKAGE_NAME} ${packageVersion()})`);
1658
- if (agents.length > 1) {
1659
- process.stdout.write(`${agents.length} agents listening ${versionTag}\n`);
1660
- } else {
1661
- const info = projectInfo(agents[0]?.project ?? handle.project);
1662
- process.stdout.write(`${info.name} listening ${versionTag}\n`);
1663
- }
1664
-
1665
- const playgroundUrl = resolvePlaygroundBannerUrl(handle, opts.noPlayground);
1666
- if (playgroundUrl !== undefined) {
1667
- process.stdout.write(` playground ${c.cyan(playgroundUrl)}\n`);
1668
- }
1669
- // `/` is only mounted when the playground host home is enabled.
1670
- if (!opts.noPlayground) {
1671
- process.stdout.write(` home ${c.cyan(`${handle.url}/`)}\n`);
1672
- }
1673
- // Dev is playground-first (Vite proxies the API). Keep API/route detail for
1674
- // plain `serve`, where operators often curl the HTTP surface directly.
1675
- if (!opts.dev) {
1676
- process.stdout.write(c.dim(` api ${handle.url}\n`));
1677
- if (agents.length > 1 || agents[0]?.slug !== "") {
1678
- for (const agent of agents) {
1679
- const info = projectInfo(agent.project);
1680
- process.stdout.write(c.dim(` /${agent.slug} ${info.name}\n`));
1681
- }
1682
- } else {
1683
- const info = projectInfo(handle.project);
1684
- process.stdout.write(c.dim(` POST ${handle.url}/v1/session\n`));
1685
- process.stdout.write(c.dim(` GET ${handle.url}/v1/session/:sessionId/stream\n`));
1686
- for (const channel of info.channels) {
1687
- if (channel.id === "http") {
1688
- continue;
1689
- }
1690
- for (const route of channel.routes) {
1691
- process.stdout.write(c.dim(` ${route.method} ${handle.url}${route.url}\n`));
1692
- }
1693
- }
1694
- if (info.schedules.length > 0) {
1695
- const scheduleMode = opts.noSchedules ? "disabled" : "running on cron cadence (UTC)";
1696
- process.stdout.write(
1697
- c.dim(` schedules: ${info.schedules.map(s => s.name).join(", ")} — ${scheduleMode}\n`),
1698
- );
1699
- }
1700
- }
1701
- if (handle.docsUrl !== undefined) {
1702
- process.stdout.write(c.dim(` docs ${handle.docsUrl}\n`));
1703
- }
1704
- }
1705
-
1706
- if (opts.bearerToken) {
1707
- process.stdout.write(
1708
- c.dim(" auth: bearer token required on API routes (playground has a token field)\n"),
1709
- );
1710
- }
1711
- if (
1712
- opts.dev &&
1713
- (process.env.GITHUB_WEBHOOK_SECRET === undefined || process.env.GITHUB_WEBHOOK_SECRET === "") &&
1714
- handle.agents.some(agent => projectInfo(agent.project).channels.some(c => c.kind === "github"))
1715
- ) {
1716
- process.stdout.write(
1717
- c.dim(
1718
- ` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`,
1719
- ),
1720
- );
1721
- }
1722
- if (
1723
- opts.dev &&
1724
- (process.env.GITLAB_WEBHOOK_SECRET === undefined || process.env.GITLAB_WEBHOOK_SECRET === "") &&
1725
- handle.agents.some(agent => projectInfo(agent.project).channels.some(c => c.kind === "gitlab"))
1726
- ) {
1727
- process.stdout.write(
1728
- c.dim(
1729
- ` gitlab: dev accepts unsigned loopback deliveries (${CLI} gitlab replay works without a secret; set GITLAB_WEBHOOK_SECRET to verify X-Gitlab-Token)\n`,
1730
- ),
1731
- );
1732
- }
1733
- if (
1734
- opts.dev &&
1735
- (process.env.BITBUCKET_WEBHOOK_SECRET === undefined ||
1736
- process.env.BITBUCKET_WEBHOOK_SECRET === "") &&
1737
- handle.agents.some(agent =>
1738
- projectInfo(agent.project).channels.some(c => c.kind === "bitbucket"),
1739
- )
1740
- ) {
1741
- process.stdout.write(
1742
- c.dim(
1743
- ` bitbucket: dev accepts unsigned loopback deliveries (${CLI} bitbucket replay works without a secret; set BITBUCKET_WEBHOOK_SECRET to verify X-Hub-Signature)\n`,
1744
- ),
1745
- );
1746
- }
1747
- }
1748
-
1749
- /** Prefer the Vite playground URL in --dev; otherwise the static SPA path. */
1750
- function resolvePlaygroundBannerUrl(
1751
- handle: AgentServeHandle,
1752
- noPlayground: boolean,
1753
- ): string | undefined {
1754
- if (noPlayground) {
1755
- return undefined;
1756
- }
1757
- if (handle.playgroundDevUrl !== undefined) {
1758
- return handle.playgroundDevUrl.replace(/\/$/, "");
1759
- }
1760
- if (handle.agents.length === 1) {
1761
- return `${handle.agents[0]!.url}/playground`;
1762
- }
1763
- if (handle.agents.length > 1) {
1764
- return handle.url;
1765
- }
1766
- return undefined;
1767
- }
1768
-
1769
- function formatModel(model: unknown): string {
1770
- if (model === undefined) {
1771
- return "(unset)";
1772
- }
1773
- if (typeof model === "string") {
1774
- return model;
1775
- }
1776
- return JSON.stringify(model);
1777
- }
1778
-
1779
- /**
1780
- * The Cursor SDK's Connect/HTTP2 client sometimes emits uncaught stream
1781
- * or TLS errors (notably `NGHTTP2_FRAME_SIZE_ERROR` on large shell/tool
1782
- * payloads, and mid-handshake socket disconnects) outside the promise
1783
- * `run.wait()` returns. Without a listener the unhandled rejection exits
1784
- * the whole agent-serve process with code 1. Swallow those transport
1785
- * failures so turns can fail cleanly and the server stays up.
1786
- */
1787
- function installTransportErrorGuards(): void {
1788
- const isTransportNoise = (reason: unknown): boolean => {
1789
- const message =
1790
- reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : String(reason);
1791
- const code =
1792
- reason !== null &&
1793
- typeof reason === "object" &&
1794
- "code" in reason &&
1795
- typeof (reason as { code: unknown }).code === "string"
1796
- ? (reason as { code: string }).code
1797
- : undefined;
1798
- return (
1799
- code === "ERR_HTTP2_STREAM_ERROR" ||
1800
- code === "ECONNRESET" ||
1801
- code === "ECONNREFUSED" ||
1802
- code === "EPIPE" ||
1803
- code === "ETIMEDOUT" ||
1804
- code === "ENOTFOUND" ||
1805
- code === "EAI_AGAIN" ||
1806
- message.includes("NGHTTP2_FRAME_SIZE_ERROR") ||
1807
- message.includes("Stream closed with error code") ||
1808
- message.includes(
1809
- "Client network socket disconnected before secure TLS connection was established",
1810
- ) ||
1811
- message.includes("socket hang up") ||
1812
- message.includes("other side closed")
1813
- );
1814
- };
1815
- const log = (label: string, reason: unknown): void => {
1816
- const text = reason instanceof Error ? reason.message : String(reason);
1817
- process.stderr.write(`[agent-sdk] ${label} (server stays up): ${text.slice(0, 400)}\n`);
1818
- };
1819
- process.on("unhandledRejection", reason => {
1820
- if (isTransportNoise(reason)) {
1821
- log("swallowed unhandledRejection", reason);
1822
- return;
1823
- }
1824
- log("unhandledRejection", reason);
1825
- });
1826
- process.on("uncaughtException", error => {
1827
- if (isTransportNoise(error)) {
1828
- log("swallowed uncaughtException", error);
1829
- return;
1830
- }
1831
- process.stderr.write(`[agent-sdk] uncaughtException: ${error.stack ?? error.message}\n`);
1832
- void flushSessionRunFatal(error).finally(() => {
1833
- process.exit(1);
1834
- });
1835
- });
1836
- }
1837
-
1838
- installTransportErrorGuards();
1839
-
1840
- // Authored agent files are TypeScript imported at runtime; install the tsx
1841
- // loader (and the framework import aliases on compiled runs) before any
1842
- // command touches a project. In-repo CLI is `bin/agent-serve.ts`.
1843
- registerAuthoredModuleLoaders()
1844
- .then(() => main(process.argv.slice(2)))
1845
- .then(
1846
- code => {
1847
- // Ephemeral run/eval can leave SDK/HTTP handles open; force exit.
1848
- process.exit(code);
1849
- },
1850
- error => {
1851
- process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
1852
- process.exit(1);
1853
- },
1854
- );