@cursor/bdk 0.2.9 → 0.2.11

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 (569) hide show
  1. package/dist/artifacts.js +3 -5
  2. package/dist/bin/agent-serve.js +803 -812
  3. package/dist/channels/bitbucket/api.js +305 -321
  4. package/dist/channels/bitbucket/binding.js +97 -61
  5. package/dist/channels/bitbucket/bitbucket-channel.d.ts +15 -1
  6. package/dist/channels/bitbucket/bitbucket-channel.d.ts.map +1 -1
  7. package/dist/channels/bitbucket/bitbucket-channel.js +95 -42
  8. package/dist/channels/bitbucket/bitbucket-webhook.d.ts +11 -0
  9. package/dist/channels/bitbucket/bitbucket-webhook.d.ts.map +1 -1
  10. package/dist/channels/bitbucket/bitbucket-webhook.js +214 -204
  11. package/dist/channels/bitbucket/checks.js +9 -21
  12. package/dist/channels/bitbucket/cursor-account.js +1 -1
  13. package/dist/channels/bitbucket/defaults.js +14 -4
  14. package/dist/channels/bitbucket/events.js +1 -2
  15. package/dist/channels/bitbucket/index.d.ts +6 -2
  16. package/dist/channels/bitbucket/index.d.ts.map +1 -1
  17. package/dist/channels/bitbucket/index.js +6 -2
  18. package/dist/channels/bitbucket/replay.js +80 -56
  19. package/dist/channels/bitbucket/state.js +16 -7
  20. package/dist/channels/bitbucket/types.d.ts +11 -2
  21. package/dist/channels/bitbucket/types.d.ts.map +1 -1
  22. package/dist/channels/checks.js +18 -28
  23. package/dist/channels/deployments/deployments-channel.js +26 -34
  24. package/dist/channels/github/api.js +216 -210
  25. package/dist/channels/github/auth.d.ts +5 -1
  26. package/dist/channels/github/auth.d.ts.map +1 -1
  27. package/dist/channels/github/auth.js +157 -174
  28. package/dist/channels/github/binding.js +48 -39
  29. package/dist/channels/github/checks.js +9 -14
  30. package/dist/channels/github/cursor-account.js +6 -11
  31. package/dist/channels/github/defaults.js +105 -130
  32. package/dist/channels/github/forward.js +13 -17
  33. package/dist/channels/github/github-channel.d.ts +43 -2
  34. package/dist/channels/github/github-channel.d.ts.map +1 -1
  35. package/dist/channels/github/github-channel.js +1228 -958
  36. package/dist/channels/github/progress.js +145 -146
  37. package/dist/channels/github/replay.js +30 -39
  38. package/dist/channels/github/state.js +40 -16
  39. package/dist/channels/github/types.d.ts +30 -6
  40. package/dist/channels/github/types.d.ts.map +1 -1
  41. package/dist/channels/gitlab/api.js +100 -114
  42. package/dist/channels/gitlab/binding.js +52 -33
  43. package/dist/channels/gitlab/checks.js +28 -29
  44. package/dist/channels/gitlab/cursor-account.js +1 -1
  45. package/dist/channels/gitlab/defaults.js +9 -3
  46. package/dist/channels/gitlab/gitlab-channel.d.ts +16 -1
  47. package/dist/channels/gitlab/gitlab-channel.d.ts.map +1 -1
  48. package/dist/channels/gitlab/gitlab-channel.js +95 -42
  49. package/dist/channels/gitlab/gitlab-webhook.d.ts +10 -1
  50. package/dist/channels/gitlab/gitlab-webhook.d.ts.map +1 -1
  51. package/dist/channels/gitlab/gitlab-webhook.js +282 -249
  52. package/dist/channels/gitlab/index.d.ts +6 -2
  53. package/dist/channels/gitlab/index.d.ts.map +1 -1
  54. package/dist/channels/gitlab/index.js +6 -2
  55. package/dist/channels/gitlab/replay.js +50 -27
  56. package/dist/channels/gitlab/state.js +14 -6
  57. package/dist/channels/gitlab/types.d.ts +13 -2
  58. package/dist/channels/gitlab/types.d.ts.map +1 -1
  59. package/dist/channels/origin/api.js +100 -116
  60. package/dist/channels/origin/binding.js +15 -16
  61. package/dist/channels/origin/checks.js +30 -28
  62. package/dist/channels/origin/defaults.js +50 -65
  63. package/dist/channels/origin/origin-channel.js +266 -272
  64. package/dist/channels/origin/origin-webhook.js +70 -88
  65. package/dist/channels/origin/reactions.js +9 -21
  66. package/dist/channels/origin/state.js +13 -5
  67. package/dist/channels/slack/agentic-delivery.js +426 -478
  68. package/dist/channels/slack/agentic-posted.js +9 -10
  69. package/dist/channels/slack/agentic-signals.js +2 -3
  70. package/dist/channels/slack/api.js +417 -427
  71. package/dist/channels/slack/approvals.js +1 -1
  72. package/dist/channels/slack/assistant.js +37 -47
  73. package/dist/channels/slack/attachments.js +188 -206
  74. package/dist/channels/slack/auth.js +8 -6
  75. package/dist/channels/slack/bot-mentions.js +31 -45
  76. package/dist/channels/slack/channel-watch.js +42 -48
  77. package/dist/channels/slack/cli-project.js +112 -137
  78. package/dist/channels/slack/code-fences.js +3 -5
  79. package/dist/channels/slack/constants.js +2 -2
  80. package/dist/channels/slack/credentials.js +23 -38
  81. package/dist/channels/slack/defaults.js +292 -331
  82. package/dist/channels/slack/dispatch.d.ts.map +1 -1
  83. package/dist/channels/slack/dispatch.js +533 -460
  84. package/dist/channels/slack/doctor.js +200 -214
  85. package/dist/channels/slack/eval-directive.js +79 -96
  86. package/dist/channels/slack/event-id-dedupe.js +1 -1
  87. package/dist/channels/slack/external-policy.js +26 -39
  88. package/dist/channels/slack/footer.js +28 -41
  89. package/dist/channels/slack/inbound.d.ts +1 -0
  90. package/dist/channels/slack/inbound.d.ts.map +1 -1
  91. package/dist/channels/slack/inbound.js +50 -31
  92. package/dist/channels/slack/init.d.ts +1 -5
  93. package/dist/channels/slack/init.d.ts.map +1 -1
  94. package/dist/channels/slack/init.js +42 -59
  95. package/dist/channels/slack/interactive.d.ts +9 -3
  96. package/dist/channels/slack/interactive.d.ts.map +1 -1
  97. package/dist/channels/slack/interactive.js +160 -162
  98. package/dist/channels/slack/links.js +1 -2
  99. package/dist/channels/slack/live-delivery.js +172 -190
  100. package/dist/channels/slack/manifest.d.ts.map +1 -1
  101. package/dist/channels/slack/manifest.js +44 -23
  102. package/dist/channels/slack/message-body.js +2 -2
  103. package/dist/channels/slack/nudge-carrier.js +30 -42
  104. package/dist/channels/slack/nudge-store.js +164 -191
  105. package/dist/channels/slack/paint-start.js +66 -81
  106. package/dist/channels/slack/placeholder.js +123 -152
  107. package/dist/channels/slack/pr-ref.js +1 -1
  108. package/dist/channels/slack/progress-delivery.js +65 -78
  109. package/dist/channels/slack/reasoning-card.js +36 -49
  110. package/dist/channels/slack/recording-sink.js +12 -24
  111. package/dist/channels/slack/reply-options.js +7 -12
  112. package/dist/channels/slack/self-identity.js +27 -35
  113. package/dist/channels/slack/sender-name.d.ts +12 -3
  114. package/dist/channels/slack/sender-name.d.ts.map +1 -1
  115. package/dist/channels/slack/sender-name.js +57 -61
  116. package/dist/channels/slack/setup.js +2 -4
  117. package/dist/channels/slack/slack-channel.d.ts +6 -4
  118. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  119. package/dist/channels/slack/slack-channel.js +441 -308
  120. package/dist/channels/slack/socket-mode.js +38 -52
  121. package/dist/channels/slack/thread-context.js +143 -160
  122. package/dist/channels/slack/tool-approval-events.js +149 -166
  123. package/dist/channels/slack/tool-cards.js +6 -11
  124. package/dist/channels/slack/tool-chip.js +1 -2
  125. package/dist/channels/slack/types.d.ts +15 -17
  126. package/dist/channels/slack/types.d.ts.map +1 -1
  127. package/dist/channels/slack/upload.js +84 -97
  128. package/dist/channels/slack/user-info.js +27 -41
  129. package/dist/channels.js +9 -20
  130. package/dist/dashboard-session-url.js +3 -4
  131. package/dist/docs/404.html +2 -2
  132. package/dist/docs/assets/{app.BNhEdGa8.js → app.DXI7bwox.js} +4 -4
  133. package/dist/docs/assets/{building-with-agents.md.BPjPFxFg.js → building-with-agents.md.Df87rAe1.js} +1 -1
  134. package/dist/docs/assets/chunks/@localSearchIndexroot.CtLtpWcx.js +1 -0
  135. package/dist/docs/assets/chunks/{VPLocalSearchBox.DIdUV1Ph.js → VPLocalSearchBox.BrbO5mEe.js} +1 -1
  136. package/dist/docs/assets/chunks/{arc.lELI4_SR.js → arc.BOG1yms8.js} +1 -1
  137. package/dist/docs/assets/chunks/{architectureDiagram-Q4EWVU46.iCMdvuoM.js → architectureDiagram-Q4EWVU46.C0hsMZnZ.js} +1 -1
  138. package/dist/docs/assets/chunks/{baseUniq.C1-nDJBf.js → baseUniq.H044KjKs.js} +1 -1
  139. package/dist/docs/assets/chunks/{blockDiagram-DXYQGD6D.ClemzBox.js → blockDiagram-DXYQGD6D.BsRW6GoB.js} +1 -1
  140. package/dist/docs/assets/chunks/{c4Diagram-AHTNJAMY.BqTak6cR.js → c4Diagram-AHTNJAMY.B9HV5PFR.js} +1 -1
  141. package/dist/docs/assets/chunks/channel.CBwrU9rP.js +1 -0
  142. package/dist/docs/assets/chunks/{chunk-4BX2VUAB.CUS3qs_R.js → chunk-4BX2VUAB.CPoT_ajl.js} +1 -1
  143. package/dist/docs/assets/chunks/{chunk-4TB4RGXK.dz5fdHcl.js → chunk-4TB4RGXK.DZBwWuCL.js} +1 -1
  144. package/dist/docs/assets/chunks/{chunk-55IACEB6.D6BEBmve.js → chunk-55IACEB6.CZ3yTiyq.js} +1 -1
  145. package/dist/docs/assets/chunks/{chunk-EDXVE4YY.B5uK4ID9.js → chunk-EDXVE4YY.6DfvHSd8.js} +1 -1
  146. package/dist/docs/assets/chunks/{chunk-FMBD7UC4.PgOJgNQs.js → chunk-FMBD7UC4.CpBj8HfK.js} +1 -1
  147. package/dist/docs/assets/chunks/{chunk-OYMX7WX6.CvkTrCii.js → chunk-OYMX7WX6.BdKo8YqS.js} +1 -1
  148. package/dist/docs/assets/chunks/{chunk-QZHKN3VN.BnSfKYsB.js → chunk-QZHKN3VN.BnXNyxJx.js} +1 -1
  149. package/dist/docs/assets/chunks/{chunk-YZCP3GAM.MZH6v5UC.js → chunk-YZCP3GAM.Cg1OcF8G.js} +1 -1
  150. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.CbC_mrvB.js +1 -0
  151. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.CbC_mrvB.js +1 -0
  152. package/dist/docs/assets/chunks/clone.BTvFyY1a.js +1 -0
  153. package/dist/docs/assets/chunks/{cose-bilkent-S5V4N54A.BBbw_YZi.js → cose-bilkent-S5V4N54A.1SP8al9c.js} +1 -1
  154. package/dist/docs/assets/chunks/{dagre-KV5264BT.CNJB2l7E.js → dagre-KV5264BT.DS1L6hJt.js} +1 -1
  155. package/dist/docs/assets/chunks/{diagram-5BDNPKRD.BQzlnFfq.js → diagram-5BDNPKRD.ChsausbG.js} +1 -1
  156. package/dist/docs/assets/chunks/{diagram-G4DWMVQ6.DkgqqZMz.js → diagram-G4DWMVQ6.3XsptNWj.js} +1 -1
  157. package/dist/docs/assets/chunks/{diagram-MMDJMWI5.DIT8L7H_.js → diagram-MMDJMWI5.DPA9Dk_P.js} +1 -1
  158. package/dist/docs/assets/chunks/{diagram-TYMM5635.3xLPZWGJ.js → diagram-TYMM5635.BVswXWrB.js} +1 -1
  159. package/dist/docs/assets/chunks/{erDiagram-SMLLAGMA.5_IHz8jF.js → erDiagram-SMLLAGMA.BSak5OSP.js} +1 -1
  160. package/dist/docs/assets/chunks/{flowDiagram-DWJPFMVM.BGUCXz8A.js → flowDiagram-DWJPFMVM.CQgN4TTz.js} +1 -1
  161. package/dist/docs/assets/chunks/{ganttDiagram-T4ZO3ILL.DbfFavS1.js → ganttDiagram-T4ZO3ILL.GrT0kA4a.js} +1 -1
  162. package/dist/docs/assets/chunks/{gitGraphDiagram-UUTBAWPF.D2yKdeNW.js → gitGraphDiagram-UUTBAWPF.CdS7Ucll.js} +1 -1
  163. package/dist/docs/assets/chunks/{graph.CSCxwHba.js → graph.BVqKRmRo.js} +1 -1
  164. package/dist/docs/assets/chunks/{infoDiagram-42DDH7IO.FDeb6xHY.js → infoDiagram-42DDH7IO.C3C9FRto.js} +1 -1
  165. package/dist/docs/assets/chunks/{ishikawaDiagram-UXIWVN3A.DbeYs9VL.js → ishikawaDiagram-UXIWVN3A.2FuAh_Zj.js} +1 -1
  166. package/dist/docs/assets/chunks/{journeyDiagram-VCZTEJTY.CWjKINpx.js → journeyDiagram-VCZTEJTY.CaHMfK4b.js} +1 -1
  167. package/dist/docs/assets/chunks/{kanban-definition-6JOO6SKY.B4FrAlwz.js → kanban-definition-6JOO6SKY.CjhIUwcA.js} +1 -1
  168. package/dist/docs/assets/chunks/{layout.DFGxQ9ab.js → layout.CGU3gfSf.js} +1 -1
  169. package/dist/docs/assets/chunks/{linear.BmjZ-G59.js → linear.DaihpW_n.js} +1 -1
  170. package/dist/docs/assets/chunks/{min.DZSxulMW.js → min.BS-j8kHQ.js} +1 -1
  171. package/dist/docs/assets/chunks/{mindmap-definition-QFDTVHPH.CHLi3-aN.js → mindmap-definition-QFDTVHPH.BVJ1Bbnk.js} +1 -1
  172. package/dist/docs/assets/chunks/{pieDiagram-DEJITSTG.DteG-CkU.js → pieDiagram-DEJITSTG.Cz1WIv9r.js} +1 -1
  173. package/dist/docs/assets/chunks/{quadrantDiagram-34T5L4WZ.D458ipN3.js → quadrantDiagram-34T5L4WZ.DKLFxcjy.js} +1 -1
  174. package/dist/docs/assets/chunks/{requirementDiagram-MS252O5E.DcFgUxst.js → requirementDiagram-MS252O5E.BHegiK7x.js} +1 -1
  175. package/dist/docs/assets/chunks/{sankeyDiagram-XADWPNL6.BwQAMmSA.js → sankeyDiagram-XADWPNL6.DYkY6yPc.js} +1 -1
  176. package/dist/docs/assets/chunks/{sequenceDiagram-FGHM5R23.B_Xdsrh9.js → sequenceDiagram-FGHM5R23.DYQ1QUrI.js} +1 -1
  177. package/dist/docs/assets/chunks/{stateDiagram-FHFEXIEX.CdfDW6-C.js → stateDiagram-FHFEXIEX.Iru8BsFo.js} +1 -1
  178. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.BYXl4LW6.js +1 -0
  179. package/dist/docs/assets/chunks/{theme.sfdL3srp.js → theme.DaplWQhQ.js} +2 -2
  180. package/dist/docs/assets/chunks/{timeline-definition-GMOUNBTQ.56-4hXaC.js → timeline-definition-GMOUNBTQ.BwFA8hiX.js} +1 -1
  181. package/dist/docs/assets/chunks/{vennDiagram-DHZGUBPP.CvZSQBO7.js → vennDiagram-DHZGUBPP.CZ60W1C_.js} +1 -1
  182. package/dist/docs/assets/chunks/{wardley-RL74JXVD.C9qc8k39.js → wardley-RL74JXVD.iXazD3Z7.js} +1 -1
  183. package/dist/docs/assets/chunks/{wardleyDiagram-NUSXRM2D.D9s0nihi.js → wardleyDiagram-NUSXRM2D.B69D2r8-.js} +1 -1
  184. package/dist/docs/assets/chunks/{xychartDiagram-5P7HB3ND.BVJSpYrC.js → xychartDiagram-5P7HB3ND.CLPZEIU9.js} +1 -1
  185. package/dist/docs/assets/{deployment.md.BdqTiGdc.js → deployment.md.BYuEcDBv.js} +2 -2
  186. package/dist/docs/assets/{guides_bitbucket.md.BB6fqD-M.js → guides_bitbucket.md.CKUayYtD.js} +3 -3
  187. package/dist/docs/assets/{guides_bitbucket.md.BB6fqD-M.lean.js → guides_bitbucket.md.CKUayYtD.lean.js} +1 -1
  188. package/dist/docs/assets/{guides_github.md.Cr1Xlf-m.js → guides_github.md.TuNiZAOQ.js} +4 -4
  189. package/dist/docs/assets/{guides_github.md.Cr1Xlf-m.lean.js → guides_github.md.TuNiZAOQ.lean.js} +1 -1
  190. package/dist/docs/assets/{guides_gitlab.md.CMpmFi4M.js → guides_gitlab.md.CtNI4fSH.js} +4 -4
  191. package/dist/docs/assets/{guides_gitlab.md.CMpmFi4M.lean.js → guides_gitlab.md.CtNI4fSH.lean.js} +1 -1
  192. package/dist/docs/assets/guides_migrate.md.sCAvvlC6.js +7 -0
  193. package/dist/docs/assets/guides_migrate.md.sCAvvlC6.lean.js +1 -0
  194. package/dist/docs/assets/{reference_cli.md.GwugN3n-.js → reference_cli.md.dYCAL2lB.js} +4 -3
  195. package/dist/docs/assets/reference_cli.md.dYCAL2lB.lean.js +1 -0
  196. package/dist/docs/assets/troubleshooting.md.x-GBa7wN.js +1 -0
  197. package/dist/docs/assets/{troubleshooting.md.Bscj6ODe.lean.js → troubleshooting.md.x-GBa7wN.lean.js} +1 -1
  198. package/dist/docs/building-with-agents.html +37 -37
  199. package/dist/docs/building-with-agents.md +2 -0
  200. package/dist/docs/deployment.html +38 -38
  201. package/dist/docs/deployment.md +7 -0
  202. package/dist/docs/evals.html +36 -36
  203. package/dist/docs/guides/agent-to-agent.html +35 -35
  204. package/dist/docs/guides/bitbucket.html +38 -38
  205. package/dist/docs/guides/bitbucket.md +9 -1
  206. package/dist/docs/guides/cloud-agents.html +35 -35
  207. package/dist/docs/guides/convert-automation.html +35 -35
  208. package/dist/docs/guides/github.html +39 -39
  209. package/dist/docs/guides/github.md +20 -4
  210. package/dist/docs/guides/gitlab.html +38 -38
  211. package/dist/docs/guides/gitlab.md +9 -1
  212. package/dist/docs/guides/grokbot-agents.html +35 -35
  213. package/dist/docs/guides/hooks.html +35 -35
  214. package/dist/docs/guides/improve.html +35 -35
  215. package/dist/docs/guides/jev.html +35 -35
  216. package/dist/docs/guides/mcp-oauth.html +35 -35
  217. package/dist/docs/guides/migrate.html +66 -0
  218. package/dist/docs/guides/migrate.md +122 -0
  219. package/dist/docs/guides/opentelemetry.html +35 -35
  220. package/dist/docs/guides/slack.html +35 -35
  221. package/dist/docs/guides/webhooks.html +35 -35
  222. package/dist/docs/hashmap.json +1 -1
  223. package/dist/docs/hillclimbing.html +35 -35
  224. package/dist/docs/index.html +35 -35
  225. package/dist/docs/llms-full.txt +214 -6
  226. package/dist/docs/llms.txt +1 -0
  227. package/dist/docs/quickstart.html +35 -35
  228. package/dist/docs/reference/agent-config.html +35 -35
  229. package/dist/docs/reference/artifacts.html +35 -35
  230. package/dist/docs/reference/channels.html +35 -35
  231. package/dist/docs/reference/cli.html +39 -38
  232. package/dist/docs/reference/cli.md +39 -0
  233. package/dist/docs/reference/connections.html +35 -35
  234. package/dist/docs/reference/evals.html +35 -35
  235. package/dist/docs/reference/extensions.html +35 -35
  236. package/dist/docs/reference/hooks.html +35 -35
  237. package/dist/docs/reference/http-api.html +35 -35
  238. package/dist/docs/reference/instructions.html +35 -35
  239. package/dist/docs/reference/playground.html +35 -35
  240. package/dist/docs/reference/project-layout.html +35 -35
  241. package/dist/docs/reference/prompt.html +35 -35
  242. package/dist/docs/reference/schedules.html +35 -35
  243. package/dist/docs/reference/sessions.html +35 -35
  244. package/dist/docs/reference/skills.html +35 -35
  245. package/dist/docs/reference/subagents.html +35 -35
  246. package/dist/docs/reference/tools.html +35 -35
  247. package/dist/docs/templates/agentic-owners.html +35 -35
  248. package/dist/docs/templates/grokbot-agents.html +35 -35
  249. package/dist/docs/templates/security-reviewer.html +35 -35
  250. package/dist/docs/templates/thermo-quality-review.html +35 -35
  251. package/dist/docs/templates/thermo-review.html +35 -35
  252. package/dist/docs/templates/triage.html +35 -35
  253. package/dist/docs/troubleshooting.html +36 -36
  254. package/dist/docs/troubleshooting.md +1 -0
  255. package/dist/evals/assertions.js +20 -34
  256. package/dist/evals/expect.js +3 -6
  257. package/dist/evals/judge.js +5 -8
  258. package/dist/evals/loaders.js +45 -62
  259. package/dist/evals/matchers.js +2 -3
  260. package/dist/evals/reporters.js +43 -67
  261. package/dist/evals/results.js +1 -1
  262. package/dist/evals/run-facts.js +5 -6
  263. package/dist/evals.js +27 -15
  264. package/dist/extensions/cursor-cloud-agents/extension.js +4 -1
  265. package/dist/extensions/cursor-cloud-agents/lib/backend.js +100 -126
  266. package/dist/extensions/cursor-cloud-agents/lib/fleet.js +22 -38
  267. package/dist/extensions/cursor-cloud-agents/lib/repos.js +8 -10
  268. package/dist/extensions/cursor-cloud-agents/lib/transcript.js +2 -3
  269. package/dist/extensions/cursor-cloud-agents/lib/watch.js +52 -66
  270. package/dist/extensions/cursor-cloud-agents/reminders/cloud-agent-stop-watch.js +29 -40
  271. package/dist/extensions/cursor-cloud-agents/tools/cancel.js +6 -17
  272. package/dist/extensions/cursor-cloud-agents/tools/dump.js +25 -36
  273. package/dist/extensions/cursor-cloud-agents/tools/get.js +3 -14
  274. package/dist/extensions/cursor-cloud-agents/tools/launch.js +13 -21
  275. package/dist/extensions/cursor-cloud-agents/tools/list.js +8 -19
  276. package/dist/extensions/cursor-cloud-agents/tools/reply.js +5 -16
  277. package/dist/extensions/cursor-grokbot-agents/extension.js +4 -1
  278. package/dist/extensions/cursor-grokbot-agents/lib/agents.js +3 -3
  279. package/dist/extensions/cursor-grokbot-agents/lib/backend.js +53 -73
  280. package/dist/extensions/cursor-grokbot-agents/lib/contacts.js +10 -23
  281. package/dist/extensions/cursor-grokbot-agents/lib/conversation.js +112 -132
  282. package/dist/extensions/cursor-grokbot-agents/lib/lock.js +1 -2
  283. package/dist/extensions/cursor-grokbot-agents/tools/ask.js +5 -16
  284. package/dist/extensions/cursor-grokbot-agents/tools/check.js +4 -15
  285. package/dist/extensions/cursor-grokbot-agents/tools/interrupt.js +2 -13
  286. package/dist/extensions/cursor-grokbot-agents/tools/list.js +11 -23
  287. package/dist/extensions/jev/extension.js +3 -3
  288. package/dist/extensions/jev/lib/evaluate.js +43 -60
  289. package/dist/extensions/jev/tools/evaluate.js +6 -17
  290. package/dist/extensions/slack-communication/tools/post-file.js +1 -1
  291. package/dist/extensions.js +3 -5
  292. package/dist/files-backends/cursor-hosted.js +504 -523
  293. package/dist/files-backends/local-fs.js +72 -134
  294. package/dist/files.js +3 -3
  295. package/dist/filesystem.js +562 -861
  296. package/dist/index.js +16 -35
  297. package/dist/internal/advertise-tools.js +74 -86
  298. package/dist/internal/artifacts-store.js +298 -361
  299. package/dist/internal/as-of.js +2 -4
  300. package/dist/internal/authored-alias-hooks.js +6 -4
  301. package/dist/internal/authored-loaders.js +37 -52
  302. package/dist/internal/bounded-int.js +1 -2
  303. package/dist/internal/bounded.js +13 -24
  304. package/dist/internal/brand.js +1 -1
  305. package/dist/internal/browser-origin-guard.js +4 -4
  306. package/dist/internal/builtin-tools/artifacts.js +15 -27
  307. package/dist/internal/builtin-tools/index.js +2 -3
  308. package/dist/internal/builtin-tools/reminders.js +33 -52
  309. package/dist/internal/channel-architecture.d.ts +21 -0
  310. package/dist/internal/channel-architecture.d.ts.map +1 -0
  311. package/dist/internal/channel-architecture.js +41 -0
  312. package/dist/internal/channel-dispatch.js +3 -4
  313. package/dist/internal/channel-route-dispatch.js +40 -51
  314. package/dist/internal/channel-state.js +1 -1
  315. package/dist/internal/chat-client.js +319 -340
  316. package/dist/internal/cli-ax.js +1262 -1294
  317. package/dist/internal/cli-bitbucket.js +244 -272
  318. package/dist/internal/cli-convert-automation.js +137 -151
  319. package/dist/internal/cli-cursor.js +126 -147
  320. package/dist/internal/cli-deploy.d.ts.map +1 -1
  321. package/dist/internal/cli-deploy.js +1457 -1507
  322. package/dist/internal/cli-docs.js +130 -147
  323. package/dist/internal/cli-github.js +437 -476
  324. package/dist/internal/cli-gitlab.js +259 -288
  325. package/dist/internal/cli-images.js +266 -334
  326. package/dist/internal/cli-manifest.js +25 -37
  327. package/dist/internal/cli-mcp-oauth.js +228 -247
  328. package/dist/internal/cli-mcp.js +358 -383
  329. package/dist/internal/cli-migrate.js +73 -90
  330. package/dist/internal/cli-skills.js +35 -47
  331. package/dist/internal/cli-slack-manual.d.ts +0 -1
  332. package/dist/internal/cli-slack-manual.d.ts.map +1 -1
  333. package/dist/internal/cli-slack-manual.js +175 -204
  334. package/dist/internal/cli-slack.d.ts +1 -1
  335. package/dist/internal/cli-slack.d.ts.map +1 -1
  336. package/dist/internal/cli-slack.js +416 -456
  337. package/dist/internal/cloud-merge.js +7 -3
  338. package/dist/internal/cloud-turn-cost.js +8 -1
  339. package/dist/internal/connection-env.js +5 -6
  340. package/dist/internal/continuation-channel.js +10 -7
  341. package/dist/internal/continuation-identity.js +85 -67
  342. package/dist/internal/conversation-mirror.js +112 -131
  343. package/dist/internal/convert-automation/convert-workflow.js +21 -31
  344. package/dist/internal/cron.js +3 -3
  345. package/dist/internal/cursor/account-mcp.js +147 -146
  346. package/dist/internal/cursor/backend-client.js +290 -320
  347. package/dist/internal/cursor/bound-secret-file.js +3 -3
  348. package/dist/internal/cursor/credentials.js +127 -142
  349. package/dist/internal/cursor/cursor-api-transport.js +4 -8
  350. package/dist/internal/cursor/github-credentials.js +91 -108
  351. package/dist/internal/cursor/hosted-bound-secrets.js +3 -4
  352. package/dist/internal/cursor/hosted-deployment-secrets.js +1 -1
  353. package/dist/internal/cursor/hosted-store-secrets.js +5 -9
  354. package/dist/internal/cursor/session-token.js +36 -48
  355. package/dist/internal/cursor/store-api-client.js +77 -92
  356. package/dist/internal/cursor-account-mcp-auth.js +132 -149
  357. package/dist/internal/cursor-agent-template.js +1 -1
  358. package/dist/internal/cursor-deployment-relay.js +33 -54
  359. package/dist/internal/cursor-event-relay.js +65 -59
  360. package/dist/internal/cursor-relay-core.js +258 -286
  361. package/dist/internal/deferred-channel-session.js +3 -12
  362. package/dist/internal/deploy-client.d.ts.map +1 -1
  363. package/dist/internal/deploy-client.js +413 -475
  364. package/dist/internal/deploy-manifest.d.ts +17 -0
  365. package/dist/internal/deploy-manifest.d.ts.map +1 -1
  366. package/dist/internal/deploy-manifest.js +71 -21
  367. package/dist/internal/deploy-source.js +31 -43
  368. package/dist/internal/discovery/agent-config.js +45 -59
  369. package/dist/internal/discovery/agent.js +276 -280
  370. package/dist/internal/discovery/channels.js +67 -80
  371. package/dist/internal/discovery/connections.js +286 -296
  372. package/dist/internal/discovery/context.js +2 -13
  373. package/dist/internal/discovery/cursor-plugin.js +223 -259
  374. package/dist/internal/discovery/extension-overlay.js +104 -131
  375. package/dist/internal/discovery/extensions.js +276 -281
  376. package/dist/internal/discovery/fs.js +56 -79
  377. package/dist/internal/discovery/hooks.js +39 -50
  378. package/dist/internal/discovery/info.js +17 -19
  379. package/dist/internal/discovery/instructions.js +58 -71
  380. package/dist/internal/discovery/modules.js +45 -58
  381. package/dist/internal/discovery/project.d.ts.map +1 -1
  382. package/dist/internal/discovery/project.js +192 -215
  383. package/dist/internal/discovery/reminders.js +41 -52
  384. package/dist/internal/discovery/runtime.js +1 -1
  385. package/dist/internal/discovery/schedules.js +71 -82
  386. package/dist/internal/discovery/seed-files.js +21 -32
  387. package/dist/internal/discovery/services.js +74 -96
  388. package/dist/internal/discovery/skills.js +77 -94
  389. package/dist/internal/discovery/subagent.js +79 -95
  390. package/dist/internal/discovery/tools.js +12 -23
  391. package/dist/internal/distribution.js +2 -2
  392. package/dist/internal/docs-site.js +30 -45
  393. package/dist/internal/duration.js +1 -1
  394. package/dist/internal/env-file.js +48 -64
  395. package/dist/internal/eval-judge-model.js +17 -28
  396. package/dist/internal/eval-run-store.js +265 -254
  397. package/dist/internal/eval-runner.d.ts +8 -0
  398. package/dist/internal/eval-runner.d.ts.map +1 -1
  399. package/dist/internal/eval-runner.js +406 -408
  400. package/dist/internal/eval-transport.d.ts +24 -0
  401. package/dist/internal/eval-transport.d.ts.map +1 -0
  402. package/dist/internal/eval-transport.js +22 -0
  403. package/dist/internal/evals-client.js +242 -246
  404. package/dist/internal/event-log.js +72 -120
  405. package/dist/internal/event-mapper.js +30 -31
  406. package/dist/internal/factory-resource-channel.js +16 -30
  407. package/dist/internal/filesystem/errors.js +6 -6
  408. package/dist/internal/filesystem/format.js +10 -13
  409. package/dist/internal/filesystem/merge.js +52 -94
  410. package/dist/internal/filesystem/nearest.js +15 -27
  411. package/dist/internal/filesystem/scratch.js +65 -85
  412. package/dist/internal/filesystem/tools.js +221 -241
  413. package/dist/internal/filesystem/walk.js +76 -143
  414. package/dist/internal/framework-file-storage.js +118 -139
  415. package/dist/internal/framework-storage-selection.js +21 -13
  416. package/dist/internal/frontmatter.js +4 -6
  417. package/dist/internal/github-fanout.js +50 -64
  418. package/dist/internal/guest-network.js +96 -109
  419. package/dist/internal/handleAgentServeTrigger.js +121 -126
  420. package/dist/internal/host-files.js +73 -88
  421. package/dist/internal/host-kv.js +21 -36
  422. package/dist/internal/host-otel.js +22 -19
  423. package/dist/internal/host-platforms.js +49 -63
  424. package/dist/internal/hosted-catch-protocol.d.ts +1 -0
  425. package/dist/internal/hosted-catch-protocol.d.ts.map +1 -1
  426. package/dist/internal/hosted-catch-protocol.js +1 -0
  427. package/dist/internal/hosted-catch.d.ts +5 -3
  428. package/dist/internal/hosted-catch.d.ts.map +1 -1
  429. package/dist/internal/hosted-catch.js +84 -93
  430. package/dist/internal/hosted-delivery-protocol.js +32 -8
  431. package/dist/internal/hosted-delivery.d.ts +13 -1
  432. package/dist/internal/hosted-delivery.d.ts.map +1 -1
  433. package/dist/internal/hosted-delivery.js +614 -584
  434. package/dist/internal/hosted-eval-cases.d.ts +21 -0
  435. package/dist/internal/hosted-eval-cases.d.ts.map +1 -0
  436. package/dist/internal/hosted-eval-cases.js +162 -0
  437. package/dist/internal/hosted-execution-diag.js +38 -30
  438. package/dist/internal/hosted-execution-flush.js +75 -66
  439. package/dist/internal/hosted-execution-latency.js +16 -8
  440. package/dist/internal/hosted-managed-automation.js +2 -2
  441. package/dist/internal/hosting.js +2 -3
  442. package/dist/internal/http-channel-define.js +4 -1
  443. package/dist/internal/http-channel.js +101 -112
  444. package/dist/internal/http-control-plane-session.d.ts +18 -1
  445. package/dist/internal/http-control-plane-session.d.ts.map +1 -1
  446. package/dist/internal/http-control-plane-session.js +66 -32
  447. package/dist/internal/incoming-headers-to-fetch.js +1 -2
  448. package/dist/internal/init-interview.js +73 -93
  449. package/dist/internal/init-project.js +182 -214
  450. package/dist/internal/init-scaffold.js +10 -21
  451. package/dist/internal/inline-stdio-mcp.js +80 -86
  452. package/dist/internal/install-cursor-skills.js +231 -273
  453. package/dist/internal/legacy-command-guard.js +18 -31
  454. package/dist/internal/listen-port.js +34 -45
  455. package/dist/internal/local-control-plane.js +293 -307
  456. package/dist/internal/local-env.js +1 -1
  457. package/dist/internal/local-ingress.js +15 -9
  458. package/dist/internal/log-ring.js +1 -2
  459. package/dist/internal/logs-client.js +207 -227
  460. package/dist/internal/map-pool.js +24 -38
  461. package/dist/internal/mcp-endpoint.js +204 -180
  462. package/dist/internal/mcp-host.js +165 -168
  463. package/dist/internal/mcp-oauth-on-demand.js +170 -207
  464. package/dist/internal/mcp-oauth-persist.js +15 -29
  465. package/dist/internal/mcp-oauth.js +209 -266
  466. package/dist/internal/named-webhook-secret.d.ts +39 -0
  467. package/dist/internal/named-webhook-secret.d.ts.map +1 -0
  468. package/dist/internal/named-webhook-secret.js +47 -0
  469. package/dist/internal/open-browser.js +2 -3
  470. package/dist/internal/otel/collector.js +104 -68
  471. package/dist/internal/otel/config.js +24 -37
  472. package/dist/internal/otel/http.js +5 -7
  473. package/dist/internal/otel/mcp.js +3 -12
  474. package/dist/internal/otel/runtime.js +69 -83
  475. package/dist/internal/package-inline-stdio.js +57 -65
  476. package/dist/internal/peer-connections.js +9 -5
  477. package/dist/internal/platform-schedule-sync.js +39 -54
  478. package/dist/internal/platform-timers.js +176 -210
  479. package/dist/internal/playground/static.js +1 -2
  480. package/dist/internal/playground/toolchain.js +37 -53
  481. package/dist/internal/playground-proxy.js +230 -270
  482. package/dist/internal/process-memory-telemetry.js +33 -51
  483. package/dist/internal/prompt-context.js +3 -6
  484. package/dist/internal/reminder-control-plane-protocol.js +46 -13
  485. package/dist/internal/reminder-runner.js +770 -785
  486. package/dist/internal/reminder-schedule.js +1 -1
  487. package/dist/internal/reminder-store.js +57 -78
  488. package/dist/internal/request-error-status.js +1 -3
  489. package/dist/internal/request-headers.js +2 -2
  490. package/dist/internal/resolve-prod-target.js +119 -135
  491. package/dist/internal/resolved-connections.js +16 -6
  492. package/dist/internal/run-client.js +221 -229
  493. package/dist/internal/runtime-dispatch-runner.js +18 -43
  494. package/dist/internal/schedule-runner.js +49 -58
  495. package/dist/internal/scm/pr-url.js +7 -6
  496. package/dist/internal/sdk-runner.js +388 -363
  497. package/dist/internal/serve-restart.js +26 -39
  498. package/dist/internal/server.d.ts.map +1 -1
  499. package/dist/internal/server.js +1283 -1244
  500. package/dist/internal/session-cost.js +7 -9
  501. package/dist/internal/session-engine.d.ts +3 -1
  502. package/dist/internal/session-engine.d.ts.map +1 -1
  503. package/dist/internal/session-engine.js +2801 -2777
  504. package/dist/internal/session-links.js +12 -16
  505. package/dist/internal/session-run-log.js +134 -82
  506. package/dist/internal/session-store.js +133 -164
  507. package/dist/internal/sessions-client.js +97 -118
  508. package/dist/internal/skill-catalog.js +18 -23
  509. package/dist/internal/skills-sync.js +16 -30
  510. package/dist/internal/slack-provision-client.js +90 -116
  511. package/dist/internal/start-log-store.js +48 -67
  512. package/dist/internal/steering.js +1 -2
  513. package/dist/internal/storage-coordinator.js +160 -196
  514. package/dist/internal/store-mirror.js +16 -30
  515. package/dist/internal/stream-progress.js +6 -8
  516. package/dist/internal/terminal-style.js +3 -4
  517. package/dist/internal/testing/scm-continuation-fixtures.js +6 -2
  518. package/dist/internal/testing/slack-continuation-fixtures.d.ts +26 -0
  519. package/dist/internal/testing/slack-continuation-fixtures.d.ts.map +1 -0
  520. package/dist/internal/testing/slack-continuation-fixtures.js +136 -0
  521. package/dist/internal/tool-catalog.js +11 -5
  522. package/dist/internal/tool-result.js +1 -1
  523. package/dist/internal/trajectory.js +19 -22
  524. package/dist/internal/turn-cost.js +52 -62
  525. package/dist/internal/turn-governor.js +5 -8
  526. package/dist/internal/turn-lease-store.js +85 -105
  527. package/dist/internal/turn-outbox.js +28 -43
  528. package/dist/internal/update-check.js +231 -259
  529. package/dist/internal/v2-hosting.js +1 -2
  530. package/dist/internal/workspace-sync.js +25 -41
  531. package/dist/internal/workspace.js +111 -139
  532. package/dist/kv/memory-kv.js +27 -51
  533. package/dist/memory.js +106 -148
  534. package/dist/otel.js +5 -8
  535. package/dist/playground/assets/{index-Co4CUVTQ.js → index-Be0-1hw2.js} +45 -45
  536. package/dist/playground/assets/index-Clz6uHj9.css +1 -0
  537. package/dist/playground/index.html +2 -2
  538. package/dist/prompt.js +2 -4
  539. package/dist/storage-backends/cursor-hosted-v2.js +53 -83
  540. package/dist/storage-backends/cursor-hosted.js +105 -145
  541. package/dist/storage-backends/file-kv.js +100 -128
  542. package/dist/storage-protocol.js +3 -5
  543. package/dist/storage.js +17 -26
  544. package/dist/types.d.ts +68 -0
  545. package/dist/types.d.ts.map +1 -1
  546. package/dist/types.js +20 -18
  547. package/docs/building-with-agents.md +2 -0
  548. package/docs/deployment.md +7 -0
  549. package/docs/guides/bitbucket.md +9 -1
  550. package/docs/guides/github.md +20 -4
  551. package/docs/guides/gitlab.md +9 -1
  552. package/docs/guides/migrate.md +127 -0
  553. package/docs/reference/cli.md +39 -0
  554. package/docs/troubleshooting.md +1 -0
  555. package/package.json +1 -1
  556. package/skills/debug/SKILL.md +1 -0
  557. package/skills/github/SKILL.md +23 -0
  558. package/skills/migrate-v2/SKILL.md +51 -10
  559. package/dist/docs/assets/chunks/@localSearchIndexroot.BJ8UZggu.js +0 -1
  560. package/dist/docs/assets/chunks/channel.BTJ5J9FI.js +0 -1
  561. package/dist/docs/assets/chunks/classDiagram-6PBFFD2Q.D4BZ3cVV.js +0 -1
  562. package/dist/docs/assets/chunks/classDiagram-v2-HSJHXN6E.D4BZ3cVV.js +0 -1
  563. package/dist/docs/assets/chunks/clone.62tX-O-1.js +0 -1
  564. package/dist/docs/assets/chunks/stateDiagram-v2-QKLJ7IA2.DkTs1aEU.js +0 -1
  565. package/dist/docs/assets/reference_cli.md.GwugN3n-.lean.js +0 -1
  566. package/dist/docs/assets/troubleshooting.md.Bscj6ODe.js +0 -1
  567. package/dist/playground/assets/index-C1g_PTTZ.css +0 -1
  568. /package/dist/docs/assets/{building-with-agents.md.BPjPFxFg.lean.js → building-with-agents.md.Df87rAe1.lean.js} +0 -0
  569. /package/dist/docs/assets/{deployment.md.BdqTiGdc.lean.js → deployment.md.BYuEcDBv.lean.js} +0 -0
@@ -16,15 +16,6 @@
16
16
  * agent-sdk validate [--dir .]
17
17
  * agent-sdk slack <subcommand>
18
18
  */
19
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
20
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
- return new (P || (P = Promise))(function (resolve, reject) {
22
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
- step((generator = generator.apply(thisArg, _arguments || [])).next());
26
- });
27
- };
28
19
  import { spawn } from "node:child_process";
29
20
  import { readFile } from "node:fs/promises";
30
21
  import { resolve } from "node:path";
@@ -499,824 +490,832 @@ function writeStdout(text) {
499
490
  });
500
491
  });
501
492
  }
502
- function main(argv) {
503
- return __awaiter(this, void 0, void 0, function* () {
504
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
505
- var _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
506
- const [command, ...restIn] = argv;
507
- if (command === undefined || command === "help" || command === "--help" || command === "-h") {
508
- // Await the write: HELP is larger than a pipe buffer, and process.exit
509
- // after main() would otherwise truncate --help under execFile / CI.
510
- yield writeStdout(HELP);
511
- return command === undefined ? 1 : 0;
512
- }
513
- if (command === "version" || command === "--version" || command === "-V") {
514
- yield writeStdout(formatCliVersion({ json: restIn.includes("--json") }));
515
- return 0;
493
+ async function main(argv) {
494
+ const [command, ...restIn] = argv;
495
+ if (command === undefined || command === "help" || command === "--help" || command === "-h") {
496
+ // Await the write: HELP is larger than a pipe buffer, and process.exit
497
+ // after main() would otherwise truncate --help under execFile / CI.
498
+ await writeStdout(HELP);
499
+ return command === undefined ? 1 : 0;
500
+ }
501
+ if (command === "version" || command === "--version" || command === "-V") {
502
+ await writeStdout(formatCliVersion({ json: restIn.includes("--json") }));
503
+ return 0;
504
+ }
505
+ // `session --events` means "dump raw events" (boolean). Rewrite so it does
506
+ // not collide with run/trajectory's `--events <file.ndjson>` string flag.
507
+ const rest = command === "session" ? restIn.map(arg => (arg === "--events" ? "--raw-events" : arg)) : restIn;
508
+ const { values, positionals } = parseArgs({
509
+ args: rest,
510
+ allowPositionals: true,
511
+ options: {
512
+ dir: { type: "string", default: "." },
513
+ template: { type: "string" },
514
+ var: { type: "string", multiple: true },
515
+ port: { type: "string" },
516
+ host: { type: "string" },
517
+ mode: { type: "string" },
518
+ dev: { type: "boolean", default: false },
519
+ "api-key": { type: "string" },
520
+ "key-name": { type: "string" },
521
+ "state-root": { type: "string" },
522
+ "bearer-token": { type: "string" },
523
+ "allow-anonymous": { type: "boolean", default: false },
524
+ "allow-anonymous-cursor-github": { type: "boolean", default: false },
525
+ "allow-anonymous-cursor-account-mcp": { type: "boolean", default: false },
526
+ "allow-anonymous-grokbot": { type: "boolean", default: false },
527
+ "cursor-scm-proxy": { type: "boolean", default: false },
528
+ "no-schedules": { type: "boolean", default: false },
529
+ "no-control-plane": { type: "boolean", default: false },
530
+ "no-playground": { type: "boolean", default: false },
531
+ "no-docs": { type: "boolean", default: false },
532
+ url: { type: "string" },
533
+ prod: { type: "boolean", default: false },
534
+ message: { type: "string", multiple: true },
535
+ input: { type: "string" },
536
+ "messages-file": { type: "string" },
537
+ "session-id": { type: "string" },
538
+ session: { type: "string" },
539
+ resume: { type: "boolean", default: false },
540
+ "continuation-token": { type: "string" },
541
+ events: { type: "string" },
542
+ "no-events": { type: "boolean", default: false },
543
+ slug: { type: "string" },
544
+ "timeout-ms": { type: "string" },
545
+ tag: { type: "string", multiple: true },
546
+ list: { type: "boolean", default: false },
547
+ verbose: { type: "boolean", default: false },
548
+ text: { type: "boolean", default: false },
549
+ "no-color": { type: "boolean", default: false },
550
+ "no-stream": { type: "boolean", default: false },
551
+ once: { type: "boolean", default: false },
552
+ "raw-events": { type: "boolean", default: false },
553
+ json: { type: "boolean", default: false },
554
+ name: { type: "string" },
555
+ env: { type: "string" },
556
+ "public-url": { type: "string" },
557
+ "cloud-tools-url": { type: "string" },
558
+ "mount-path": { type: "string" },
559
+ "base-url": { type: "string" },
560
+ print: { type: "boolean", default: false },
561
+ store: { type: "boolean", default: false },
562
+ remote: { type: "boolean", default: false },
563
+ transport: { type: "string" },
564
+ prefix: { type: "string" },
565
+ "no-prefix": { type: "boolean", default: false },
566
+ "channel-posts": { type: "boolean", default: false },
567
+ "slack-team": { type: "string" },
568
+ icon: { type: "string" },
569
+ force: { type: "boolean", default: false },
570
+ manual: { type: "boolean", default: false },
571
+ repo: { type: "string", multiple: true },
572
+ org: { type: "string" },
573
+ "cursor-events": { type: "boolean", default: false },
574
+ secret: { type: "string" },
575
+ channel: { type: "string", multiple: true },
576
+ install: { type: "boolean", default: false },
577
+ "no-install": { type: "boolean", default: false },
578
+ action: { type: "string" },
579
+ conclusion: { type: "string" },
580
+ context: { type: "string" },
581
+ comment: { type: "string" },
582
+ "dry-run": { type: "boolean", default: false },
583
+ "as-of": { type: "string" },
584
+ component: { type: "string" },
585
+ out: { type: "string" },
586
+ team: { type: "string" },
587
+ "no-wait": { type: "boolean", default: false },
588
+ "cancel-runs": { type: "boolean", default: false },
589
+ ref: { type: "string" },
590
+ release: { type: "string" },
591
+ path: { type: "string" },
592
+ all: { type: "boolean", default: false },
593
+ "cursor-events-repo": { type: "string", multiple: true },
594
+ "allow-domain": { type: "string", multiple: true },
595
+ // Hidden Anysphere-only flag; omitted from help.
596
+ "multi-tenant": { type: "boolean", default: false },
597
+ "from-argv": { type: "boolean", default: false },
598
+ strict: { type: "boolean", default: false },
599
+ junit: { type: "string" },
600
+ artifacts: { type: "string" },
601
+ "no-artifacts": { type: "boolean", default: false },
602
+ "skip-report": { type: "boolean", default: false },
603
+ "max-concurrency": { type: "string" },
604
+ version: { type: "boolean", short: "V", default: false },
605
+ },
606
+ });
607
+ const dir = values.dir ?? ".";
608
+ if (values.version === true) {
609
+ await writeStdout(formatCliVersion({ json: values.json === true }));
610
+ return 0;
611
+ }
612
+ // Best-effort, cached, and silent on failure. `update` does its own fresh
613
+ // lookup, --json runs stay quiet for machine consumers, and `mcp` skips it
614
+ // so MCP client spawns stay fast (stdout there is the protocol wire).
615
+ if (command !== "update" &&
616
+ command !== "mcp" &&
617
+ values.json !== true &&
618
+ !isServeRestartWorker()) {
619
+ await warnIfOutdated();
620
+ }
621
+ switch (command) {
622
+ case "slack": {
623
+ const { cmdSlack } = await import("../internal/cli-slack.js");
624
+ const env = values.env === "dev" || values.env === "prod" || values.env === "both"
625
+ ? values.env
626
+ : undefined;
627
+ return cmdSlack(positionals[0], {
628
+ dir,
629
+ name: values.name,
630
+ env,
631
+ json: values.json,
632
+ print: values.print,
633
+ prefix: values.prefix,
634
+ noPrefix: values["no-prefix"],
635
+ channelPosts: values["channel-posts"],
636
+ channels: values.channel,
637
+ slackTeam: values["slack-team"],
638
+ prod: values.prod,
639
+ team: values.team,
640
+ apiKey: values["api-key"],
641
+ icon: values.icon,
642
+ force: values.force,
643
+ manual: values.manual,
644
+ install: values.install,
645
+ noInstall: values["no-install"],
646
+ iconSource: positionals[0] === "icon" ? positionals[1] : undefined,
647
+ });
516
648
  }
517
- // `session --events` means "dump raw events" (boolean). Rewrite so it does
518
- // not collide with run/trajectory's `--events <file.ndjson>` string flag.
519
- const rest = command === "session" ? restIn.map(arg => (arg === "--events" ? "--raw-events" : arg)) : restIn;
520
- const { values, positionals } = parseArgs({
521
- args: rest,
522
- allowPositionals: true,
523
- options: {
524
- dir: { type: "string", default: "." },
525
- template: { type: "string" },
526
- var: { type: "string", multiple: true },
527
- port: { type: "string" },
528
- host: { type: "string" },
529
- mode: { type: "string" },
530
- dev: { type: "boolean", default: false },
531
- "api-key": { type: "string" },
532
- "key-name": { type: "string" },
533
- "state-root": { type: "string" },
534
- "bearer-token": { type: "string" },
535
- "allow-anonymous": { type: "boolean", default: false },
536
- "allow-anonymous-cursor-github": { type: "boolean", default: false },
537
- "allow-anonymous-cursor-account-mcp": { type: "boolean", default: false },
538
- "allow-anonymous-grokbot": { type: "boolean", default: false },
539
- "cursor-scm-proxy": { type: "boolean", default: false },
540
- "no-schedules": { type: "boolean", default: false },
541
- "no-control-plane": { type: "boolean", default: false },
542
- "no-playground": { type: "boolean", default: false },
543
- "no-docs": { type: "boolean", default: false },
544
- url: { type: "string" },
545
- prod: { type: "boolean", default: false },
546
- message: { type: "string", multiple: true },
547
- input: { type: "string" },
548
- "messages-file": { type: "string" },
549
- "session-id": { type: "string" },
550
- session: { type: "string" },
551
- resume: { type: "boolean", default: false },
552
- "continuation-token": { type: "string" },
553
- events: { type: "string" },
554
- "no-events": { type: "boolean", default: false },
555
- slug: { type: "string" },
556
- "timeout-ms": { type: "string" },
557
- tag: { type: "string", multiple: true },
558
- list: { type: "boolean", default: false },
559
- verbose: { type: "boolean", default: false },
560
- text: { type: "boolean", default: false },
561
- "no-color": { type: "boolean", default: false },
562
- "no-stream": { type: "boolean", default: false },
563
- once: { type: "boolean", default: false },
564
- "raw-events": { type: "boolean", default: false },
565
- json: { type: "boolean", default: false },
566
- name: { type: "string" },
567
- env: { type: "string" },
568
- "public-url": { type: "string" },
569
- "cloud-tools-url": { type: "string" },
570
- "mount-path": { type: "string" },
571
- "base-url": { type: "string" },
572
- print: { type: "boolean", default: false },
573
- store: { type: "boolean", default: false },
574
- remote: { type: "boolean", default: false },
575
- transport: { type: "string" },
576
- prefix: { type: "string" },
577
- "no-prefix": { type: "boolean", default: false },
578
- "channel-posts": { type: "boolean", default: false },
579
- "slack-team": { type: "string" },
580
- icon: { type: "string" },
581
- force: { type: "boolean", default: false },
582
- manual: { type: "boolean", default: false },
583
- repo: { type: "string", multiple: true },
584
- org: { type: "string" },
585
- "cursor-events": { type: "boolean", default: false },
586
- secret: { type: "string" },
587
- channel: { type: "string", multiple: true },
588
- install: { type: "boolean", default: false },
589
- "no-install": { type: "boolean", default: false },
590
- action: { type: "string" },
591
- conclusion: { type: "string" },
592
- context: { type: "string" },
593
- comment: { type: "string" },
594
- "dry-run": { type: "boolean", default: false },
595
- "as-of": { type: "string" },
596
- component: { type: "string" },
597
- out: { type: "string" },
598
- team: { type: "string" },
599
- "no-wait": { type: "boolean", default: false },
600
- "cancel-runs": { type: "boolean", default: false },
601
- ref: { type: "string" },
602
- release: { type: "string" },
603
- path: { type: "string" },
604
- all: { type: "boolean", default: false },
605
- "cursor-events-repo": { type: "string", multiple: true },
606
- "allow-domain": { type: "string", multiple: true },
607
- // Hidden Anysphere-only flag; omitted from help.
608
- "multi-tenant": { type: "boolean", default: false },
609
- "from-argv": { type: "boolean", default: false },
610
- strict: { type: "boolean", default: false },
611
- junit: { type: "string" },
612
- artifacts: { type: "string" },
613
- "no-artifacts": { type: "boolean", default: false },
614
- "skip-report": { type: "boolean", default: false },
615
- "max-concurrency": { type: "string" },
616
- version: { type: "boolean", short: "V", default: false },
617
- },
618
- });
619
- const dir = (_m = values.dir) !== null && _m !== void 0 ? _m : ".";
620
- if (values.version === true) {
621
- yield writeStdout(formatCliVersion({ json: values.json === true }));
622
- return 0;
649
+ case "github": {
650
+ const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
651
+ if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
652
+ process.stderr.write(`invalid --port: ${values.port}\n`);
653
+ return 1;
654
+ }
655
+ const { cmdGithub } = await import("../internal/cli-github.js");
656
+ return cmdGithub(positionals[0], {
657
+ dir,
658
+ slug: values.slug,
659
+ // `--channel` is repeatable for `slack doctor`; the github
660
+ // subcommands target a single channel, so the last one wins.
661
+ channel: values.channel?.at(-1),
662
+ host: values.host,
663
+ port,
664
+ url: values.url,
665
+ events: values.events,
666
+ // `--repo` is repeatable for `serve --cursor-events`; the github
667
+ // subcommands target a single repo, so the last one wins.
668
+ repo: values.repo?.at(-1),
669
+ org: values.org,
670
+ secret: values.secret,
671
+ install: values.install,
672
+ json: values.json,
673
+ prUrl: positionals[1],
674
+ action: values.action,
675
+ conclusion: values.conclusion,
676
+ context: values.context,
677
+ comment: values.comment,
678
+ dryRun: values["dry-run"],
679
+ out: values.out,
680
+ });
623
681
  }
624
- // Best-effort, cached, and silent on failure. `update` does its own fresh
625
- // lookup, --json runs stay quiet for machine consumers, and `mcp` skips it
626
- // so MCP client spawns stay fast (stdout there is the protocol wire).
627
- if (command !== "update" &&
628
- command !== "mcp" &&
629
- values.json !== true &&
630
- !isServeRestartWorker()) {
631
- yield warnIfOutdated();
682
+ case "gitlab": {
683
+ const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
684
+ if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
685
+ process.stderr.write(`invalid --port: ${values.port}\n`);
686
+ return 1;
687
+ }
688
+ const { cmdGitlab } = await import("../internal/cli-gitlab.js");
689
+ return cmdGitlab(positionals[0], {
690
+ dir,
691
+ slug: values.slug,
692
+ channel: values.channel?.at(-1),
693
+ host: values.host,
694
+ port,
695
+ url: values.url,
696
+ events: values.events,
697
+ secret: values.secret,
698
+ json: values.json,
699
+ mrUrl: positionals[1],
700
+ action: values.action,
701
+ conclusion: values.conclusion,
702
+ comment: values.comment,
703
+ dryRun: values["dry-run"],
704
+ out: values.out,
705
+ });
632
706
  }
633
- switch (command) {
634
- case "slack": {
635
- const { cmdSlack } = yield import("../internal/cli-slack.js");
636
- const env = values.env === "dev" || values.env === "prod" || values.env === "both"
637
- ? values.env
638
- : undefined;
639
- return cmdSlack(positionals[0], {
640
- dir,
641
- name: values.name,
642
- env,
643
- json: values.json,
644
- print: values.print,
645
- prefix: values.prefix,
646
- noPrefix: values["no-prefix"],
647
- channelPosts: values["channel-posts"],
648
- channels: values.channel,
649
- slackTeam: values["slack-team"],
650
- prod: values.prod,
651
- team: values.team,
652
- apiKey: values["api-key"],
653
- icon: values.icon,
654
- force: values.force,
655
- manual: values.manual,
656
- install: values.install,
657
- noInstall: values["no-install"],
658
- iconSource: positionals[0] === "icon" ? positionals[1] : undefined,
659
- });
707
+ case "bitbucket": {
708
+ const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
709
+ if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
710
+ process.stderr.write(`invalid --port: ${values.port}\n`);
711
+ return 1;
660
712
  }
661
- case "github": {
662
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
663
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
664
- process.stderr.write(`invalid --port: ${values.port}\n`);
713
+ const { cmdBitbucket } = await import("../internal/cli-bitbucket.js");
714
+ return cmdBitbucket(positionals[0], {
715
+ dir,
716
+ slug: values.slug,
717
+ channel: values.channel?.at(-1),
718
+ host: values.host,
719
+ port,
720
+ url: values.url,
721
+ events: values.events,
722
+ secret: values.secret,
723
+ json: values.json,
724
+ prUrl: positionals[1],
725
+ comment: values.comment,
726
+ dryRun: values["dry-run"],
727
+ out: values.out,
728
+ });
729
+ }
730
+ case "init": {
731
+ return cmdInit({
732
+ dir,
733
+ initTarget: positionals[0],
734
+ template: values.template,
735
+ vars: values.var,
736
+ json: values.json,
737
+ });
738
+ }
739
+ case "convert-automation": {
740
+ const { cmdConvertAutomation } = await import("../internal/cli-convert-automation.js");
741
+ const dirFlagPassed = rest.includes("--dir") || rest.some(arg => arg.startsWith("--dir="));
742
+ return cmdConvertAutomation({
743
+ url: positionals[0],
744
+ // Default target is ./<automation-name-slug>, not the cwd.
745
+ dir: dirFlagPassed ? dir : undefined,
746
+ json: values.json,
747
+ apiKey: values["api-key"],
748
+ });
749
+ }
750
+ case "migrate": {
751
+ const { cmdMigrate } = await import("../internal/cli-migrate.js");
752
+ return cmdMigrate({
753
+ dir,
754
+ repo: values.repo?.at(-1),
755
+ ref: values.ref,
756
+ path: values.path,
757
+ noWait: values["no-wait"],
758
+ json: values.json,
759
+ apiKey: values["api-key"],
760
+ });
761
+ }
762
+ case "install-skills": {
763
+ const { cmdInstallSkills } = await import("../internal/cli-skills.js");
764
+ return cmdInstallSkills({
765
+ json: values.json,
766
+ print: values.print,
767
+ });
768
+ }
769
+ case "mcp": {
770
+ const { cmdMcp } = await import("../internal/cli-mcp.js");
771
+ const mcpSub = positionals[0];
772
+ return cmdMcp(mcpSub, {
773
+ dir,
774
+ slug: values.slug,
775
+ team: values.team,
776
+ apiKey: values["api-key"],
777
+ url: values.url,
778
+ prod: values.prod,
779
+ bearerToken: values["bearer-token"],
780
+ name: values.name,
781
+ print: values.print,
782
+ json: values.json,
783
+ store: values.store,
784
+ remote: values.remote,
785
+ oauthConnection: mcpSub === "oauth" ? positionals[1] : undefined,
786
+ });
787
+ }
788
+ case "login": {
789
+ const { cmdLogin } = await import("../internal/cli-cursor.js");
790
+ return cmdLogin({
791
+ apiKey: values["api-key"],
792
+ keyName: values["key-name"],
793
+ });
794
+ }
795
+ case "logout": {
796
+ const { cmdLogout } = await import("../internal/cli-cursor.js");
797
+ return cmdLogout();
798
+ }
799
+ case "whoami": {
800
+ const { cmdWhoami } = await import("../internal/cli-cursor.js");
801
+ return cmdWhoami({ json: values.json });
802
+ }
803
+ case "update": {
804
+ return cmdUpdate();
805
+ }
806
+ case "deploy": {
807
+ // `--repo` is repeatable for `serve --cursor-events`; deploy targets a
808
+ // single source repo, so the last one wins.
809
+ const repo = values.repo?.at(-1);
810
+ const dirFlagPassed = rest.includes("--dir") || rest.some(arg => arg.startsWith("--dir="));
811
+ return cmdDeploy({
812
+ ...deployOptionsFromValues(values),
813
+ dir: dirFlagPassed ? dir : undefined,
814
+ ...(values.slug === undefined ? {} : { slug: values.slug }),
815
+ all: values.all === true,
816
+ ...(repo === undefined ? {} : { repo }),
817
+ ...(values.ref === undefined ? {} : { ref: values.ref }),
818
+ ...(values.path === undefined ? {} : { path: values.path }),
819
+ ...(values["cursor-events-repo"] === undefined
820
+ ? {}
821
+ : { cursorEventsRepos: values["cursor-events-repo"] }),
822
+ ...(values["allow-domain"] === undefined ? {} : { allowDomains: values["allow-domain"] }),
823
+ multiTenant: values["multi-tenant"] === true,
824
+ });
825
+ }
826
+ case "manifest": {
827
+ // Offline extraction of deploy metadata (events, egress, routes,
828
+ // /v1/info payload) — no VM, no network. Wd-1 of the event-ingress
829
+ // plan; `deploy` attaches this to the request from Wd-2 on.
830
+ return cmdManifest({ dir, json: values.json === true });
831
+ }
832
+ case "deployments": {
833
+ return cmdDeployments(deployOptionsFromValues(values));
834
+ }
835
+ case "deployment": {
836
+ return cmdDeploymentStatus(positionals[0], deployOptionsFromValues(values));
837
+ }
838
+ case "stop": {
839
+ return cmdStop(positionals[0], deployOptionsFromValues(values));
840
+ }
841
+ case "kill": {
842
+ return cmdKill(positionals[0], deployOptionsFromValues(values));
843
+ }
844
+ case "unlock-deploys": {
845
+ return cmdUnlockDeploys(positionals[0], deployOptionsFromValues(values));
846
+ }
847
+ case "start": {
848
+ return cmdStart(positionals[0], deployOptionsFromValues(values));
849
+ }
850
+ case "cancel-runs": {
851
+ return cmdCancelRuns(positionals[0], deployOptionsFromValues(values));
852
+ }
853
+ case "event-repos": {
854
+ return cmdEventRepos(positionals[0], values.repo ?? [], deployOptionsFromValues(values));
855
+ }
856
+ case "upgrade": {
857
+ return cmdUpgrade({ slug: positionals[0], release: values.release }, deployOptionsFromValues(values));
858
+ }
859
+ case "rollback": {
860
+ return cmdRollback({ slug: positionals[0], release: values.release }, deployOptionsFromValues(values));
861
+ }
862
+ case "delete": {
863
+ return cmdDelete(positionals[0], deployOptionsFromValues(values));
864
+ }
865
+ case "rotate-token": {
866
+ return cmdRotateToken(positionals[0], deployOptionsFromValues(values));
867
+ }
868
+ case "secrets": {
869
+ const base = deployOptionsFromValues(values);
870
+ switch (positionals[0]) {
871
+ case "set":
872
+ return cmdSecretsSet(positionals[1], positionals.slice(2), base);
873
+ case "list":
874
+ return cmdSecretsList(positionals[1], base);
875
+ case "unset":
876
+ return cmdSecretsUnset(positionals[1], positionals[2], base);
877
+ default:
878
+ process.stderr.write(`Usage: ${CLI} secrets <set|list|unset> <slug> ... [--team <id>] [--json]\n`);
665
879
  return 1;
666
- }
667
- const { cmdGithub } = yield import("../internal/cli-github.js");
668
- return cmdGithub(positionals[0], {
669
- dir,
670
- slug: values.slug,
671
- // `--channel` is repeatable for `slack doctor`; the github
672
- // subcommands target a single channel, so the last one wins.
673
- channel: (_a = values.channel) === null || _a === void 0 ? void 0 : _a.at(-1),
674
- host: values.host,
675
- port,
676
- url: values.url,
677
- events: values.events,
678
- // `--repo` is repeatable for `serve --cursor-events`; the github
679
- // subcommands target a single repo, so the last one wins.
680
- repo: (_b = values.repo) === null || _b === void 0 ? void 0 : _b.at(-1),
681
- org: values.org,
682
- secret: values.secret,
683
- install: values.install,
684
- json: values.json,
685
- prUrl: positionals[1],
686
- action: values.action,
687
- conclusion: values.conclusion,
688
- context: values.context,
689
- comment: values.comment,
690
- dryRun: values["dry-run"],
691
- out: values.out,
692
- });
693
880
  }
694
- case "gitlab": {
695
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
696
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
697
- process.stderr.write(`invalid --port: ${values.port}\n`);
881
+ }
882
+ case "images": {
883
+ const base = deployOptionsFromValues(values);
884
+ switch (positionals[0]) {
885
+ case "push":
886
+ return cmdImagesPush({ image: positionals[1], name: values.name }, base);
887
+ case "list":
888
+ return cmdImagesList(base);
889
+ case "rm":
890
+ return cmdImagesRm(positionals[1], base);
891
+ default:
892
+ process.stderr.write(`Usage: ${CLI} images <push <local-image> --name <name>|list|rm <name>> [--team <id>] [--json]\n`);
698
893
  return 1;
699
- }
700
- const { cmdGitlab } = yield import("../internal/cli-gitlab.js");
701
- return cmdGitlab(positionals[0], {
702
- dir,
703
- slug: values.slug,
704
- channel: (_c = values.channel) === null || _c === void 0 ? void 0 : _c.at(-1),
705
- host: values.host,
706
- port,
707
- url: values.url,
708
- events: values.events,
709
- secret: values.secret,
710
- json: values.json,
711
- mrUrl: positionals[1],
712
- action: values.action,
713
- conclusion: values.conclusion,
714
- comment: values.comment,
715
- dryRun: values["dry-run"],
716
- out: values.out,
717
- });
718
894
  }
719
- case "bitbucket": {
720
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
721
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
722
- process.stderr.write(`invalid --port: ${values.port}\n`);
723
- return 1;
724
- }
725
- const { cmdBitbucket } = yield import("../internal/cli-bitbucket.js");
726
- return cmdBitbucket(positionals[0], {
727
- dir,
728
- slug: values.slug,
729
- channel: (_d = values.channel) === null || _d === void 0 ? void 0 : _d.at(-1),
730
- host: values.host,
731
- port,
732
- url: values.url,
733
- events: values.events,
734
- secret: values.secret,
735
- json: values.json,
736
- prUrl: positionals[1],
737
- comment: values.comment,
738
- dryRun: values["dry-run"],
739
- out: values.out,
740
- });
741
- }
742
- case "init": {
743
- return cmdInit({
744
- dir,
745
- initTarget: positionals[0],
746
- template: values.template,
747
- vars: values.var,
748
- json: values.json,
749
- });
750
- }
751
- case "convert-automation": {
752
- const { cmdConvertAutomation } = yield import("../internal/cli-convert-automation.js");
753
- const dirFlagPassed = rest.includes("--dir") || rest.some(arg => arg.startsWith("--dir="));
754
- return cmdConvertAutomation({
755
- url: positionals[0],
756
- // Default target is ./<automation-name-slug>, not the cwd.
757
- dir: dirFlagPassed ? dir : undefined,
758
- json: values.json,
759
- apiKey: values["api-key"],
760
- });
761
- }
762
- case "migrate": {
763
- const { cmdMigrate } = yield import("../internal/cli-migrate.js");
764
- return cmdMigrate({
765
- dir,
766
- repo: (_e = values.repo) === null || _e === void 0 ? void 0 : _e.at(-1),
767
- ref: values.ref,
768
- path: values.path,
769
- noWait: values["no-wait"],
770
- json: values.json,
771
- apiKey: values["api-key"],
772
- });
773
- }
774
- case "install-skills": {
775
- const { cmdInstallSkills } = yield import("../internal/cli-skills.js");
776
- return cmdInstallSkills({
777
- json: values.json,
778
- print: values.print,
779
- });
895
+ }
896
+ case "run": {
897
+ const messages = await loadMessages(values.message, values["messages-file"]);
898
+ return cmdRun(axFromOptions({
899
+ dir,
900
+ messages,
901
+ sessionId: values["session-id"] ?? values.session,
902
+ continuationToken: values["continuation-token"],
903
+ events: values["no-events"] ? false : values.events === undefined ? true : values.events,
904
+ text: values.text,
905
+ url: values.url,
906
+ prod: values.prod,
907
+ team: values.team,
908
+ apiKey: values["api-key"],
909
+ slug: values.slug,
910
+ bearerToken: values["bearer-token"],
911
+ stateRoot: values["state-root"],
912
+ timeoutMs: parseTimeoutMs(values["timeout-ms"]),
913
+ stream: values["no-stream"] ? false : undefined,
914
+ dryRun: values["dry-run"],
915
+ asOf: values["as-of"],
916
+ componentKey: values.component,
917
+ }));
918
+ }
919
+ case "call": {
920
+ return cmdCall(axFromOptions({
921
+ dir,
922
+ toolName: positionals[0],
923
+ toolInput: values.input,
924
+ sessionId: values["session-id"] ?? values.session,
925
+ url: values.url,
926
+ prod: values.prod,
927
+ team: values.team,
928
+ apiKey: values["api-key"],
929
+ slug: values.slug,
930
+ bearerToken: values["bearer-token"],
931
+ stateRoot: values["state-root"],
932
+ }));
933
+ }
934
+ case "skill": {
935
+ return cmdSkill(positionals[0], axFromOptions({
936
+ dir,
937
+ text: values.text,
938
+ url: values.url,
939
+ prod: values.prod,
940
+ team: values.team,
941
+ apiKey: values["api-key"],
942
+ slug: values.slug,
943
+ bearerToken: values["bearer-token"],
944
+ stateRoot: values["state-root"],
945
+ }));
946
+ }
947
+ case "trajectory": {
948
+ if (values.events === undefined) {
949
+ process.stderr.write("trajectory requires --events <file.ndjson>\n");
950
+ return 1;
780
951
  }
781
- case "mcp": {
782
- const { cmdMcp } = yield import("../internal/cli-mcp.js");
783
- const mcpSub = positionals[0];
784
- return cmdMcp(mcpSub, {
952
+ return cmdTrajectory(axFromOptions({
953
+ dir,
954
+ events: values.events,
955
+ text: values.text,
956
+ }));
957
+ }
958
+ case "eval": {
959
+ // Remote status subcommand only when targeting --url. Otherwise the
960
+ // bare token "status" is a normal eval id (evals/status.eval.ts).
961
+ if (positionals[0] === "status" && values.url !== undefined) {
962
+ return cmdEvalStatus(positionals[1], axFromOptions({
785
963
  dir,
786
- slug: values.slug,
787
- team: values.team,
788
- apiKey: values["api-key"],
789
- url: values.url,
790
- prod: values.prod,
791
- bearerToken: values["bearer-token"],
792
- name: values.name,
793
- print: values.print,
794
964
  json: values.json,
795
- store: values.store,
796
- remote: values.remote,
797
- oauthConnection: mcpSub === "oauth" ? positionals[1] : undefined,
798
- });
799
- }
800
- case "login": {
801
- const { cmdLogin } = yield import("../internal/cli-cursor.js");
802
- return cmdLogin({
803
- apiKey: values["api-key"],
804
- keyName: values["key-name"],
805
- });
806
- }
807
- case "logout": {
808
- const { cmdLogout } = yield import("../internal/cli-cursor.js");
809
- return cmdLogout();
810
- }
811
- case "whoami": {
812
- const { cmdWhoami } = yield import("../internal/cli-cursor.js");
813
- return cmdWhoami({ json: values.json });
814
- }
815
- case "update": {
816
- return cmdUpdate();
817
- }
818
- case "deploy": {
819
- // `--repo` is repeatable for `serve --cursor-events`; deploy targets a
820
- // single source repo, so the last one wins.
821
- const repo = (_f = values.repo) === null || _f === void 0 ? void 0 : _f.at(-1);
822
- const dirFlagPassed = rest.includes("--dir") || rest.some(arg => arg.startsWith("--dir="));
823
- return cmdDeploy(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, deployOptionsFromValues(values)), { dir: dirFlagPassed ? dir : undefined }), (values.slug === undefined ? {} : { slug: values.slug })), { all: values.all === true }), (repo === undefined ? {} : { repo })), (values.ref === undefined ? {} : { ref: values.ref })), (values.path === undefined ? {} : { path: values.path })), (values["cursor-events-repo"] === undefined
824
- ? {}
825
- : { cursorEventsRepos: values["cursor-events-repo"] })), (values["allow-domain"] === undefined ? {} : { allowDomains: values["allow-domain"] })), { multiTenant: values["multi-tenant"] === true }));
826
- }
827
- case "manifest": {
828
- // Offline extraction of deploy metadata (events, egress, routes,
829
- // /v1/info payload) — no VM, no network. Wd-1 of the event-ingress
830
- // plan; `deploy` attaches this to the request from Wd-2 on.
831
- return cmdManifest({ dir, json: values.json === true });
832
- }
833
- case "deployments": {
834
- return cmdDeployments(deployOptionsFromValues(values));
835
- }
836
- case "deployment": {
837
- return cmdDeploymentStatus(positionals[0], deployOptionsFromValues(values));
838
- }
839
- case "stop": {
840
- return cmdStop(positionals[0], deployOptionsFromValues(values));
841
- }
842
- case "kill": {
843
- return cmdKill(positionals[0], deployOptionsFromValues(values));
844
- }
845
- case "unlock-deploys": {
846
- return cmdUnlockDeploys(positionals[0], deployOptionsFromValues(values));
847
- }
848
- case "start": {
849
- return cmdStart(positionals[0], deployOptionsFromValues(values));
850
- }
851
- case "cancel-runs": {
852
- return cmdCancelRuns(positionals[0], deployOptionsFromValues(values));
853
- }
854
- case "event-repos": {
855
- return cmdEventRepos(positionals[0], (_o = values.repo) !== null && _o !== void 0 ? _o : [], deployOptionsFromValues(values));
856
- }
857
- case "upgrade": {
858
- return cmdUpgrade({ slug: positionals[0], release: values.release }, deployOptionsFromValues(values));
859
- }
860
- case "rollback": {
861
- return cmdRollback({ slug: positionals[0], release: values.release }, deployOptionsFromValues(values));
862
- }
863
- case "delete": {
864
- return cmdDelete(positionals[0], deployOptionsFromValues(values));
865
- }
866
- case "rotate-token": {
867
- return cmdRotateToken(positionals[0], deployOptionsFromValues(values));
868
- }
869
- case "secrets": {
870
- const base = deployOptionsFromValues(values);
871
- switch (positionals[0]) {
872
- case "set":
873
- return cmdSecretsSet(positionals[1], positionals.slice(2), base);
874
- case "list":
875
- return cmdSecretsList(positionals[1], base);
876
- case "unset":
877
- return cmdSecretsUnset(positionals[1], positionals[2], base);
878
- default:
879
- process.stderr.write(`Usage: ${CLI} secrets <set|list|unset> <slug> ... [--team <id>] [--json]\n`);
880
- return 1;
881
- }
882
- }
883
- case "images": {
884
- const base = deployOptionsFromValues(values);
885
- switch (positionals[0]) {
886
- case "push":
887
- return cmdImagesPush({ image: positionals[1], name: values.name }, base);
888
- case "list":
889
- return cmdImagesList(base);
890
- case "rm":
891
- return cmdImagesRm(positionals[1], base);
892
- default:
893
- process.stderr.write(`Usage: ${CLI} images <push <local-image> --name <name>|list|rm <name>> [--team <id>] [--json]\n`);
894
- return 1;
895
- }
896
- }
897
- case "run": {
898
- const messages = yield loadMessages(values.message, values["messages-file"]);
899
- return cmdRun(axFromOptions({
900
- dir,
901
- messages,
902
- sessionId: (_p = values["session-id"]) !== null && _p !== void 0 ? _p : values.session,
903
- continuationToken: values["continuation-token"],
904
- events: values["no-events"] ? false : values.events === undefined ? true : values.events,
905
- text: values.text,
906
965
  url: values.url,
907
966
  prod: values.prod,
908
- team: values.team,
909
- apiKey: values["api-key"],
910
967
  slug: values.slug,
911
968
  bearerToken: values["bearer-token"],
912
- stateRoot: values["state-root"],
913
- timeoutMs: parseTimeoutMs(values["timeout-ms"]),
914
- stream: values["no-stream"] ? false : undefined,
915
- dryRun: values["dry-run"],
916
- asOf: values["as-of"],
917
- componentKey: values.component,
969
+ out: values.out,
918
970
  }));
919
971
  }
920
- case "call": {
921
- return cmdCall(axFromOptions({
972
+ if (positionals[0] === "cancel" && values.url !== undefined) {
973
+ return cmdEvalCancel(positionals[1], axFromOptions({
922
974
  dir,
923
- toolName: positionals[0],
924
- toolInput: values.input,
925
- sessionId: (_q = values["session-id"]) !== null && _q !== void 0 ? _q : values.session,
975
+ json: values.json,
926
976
  url: values.url,
927
977
  prod: values.prod,
928
- team: values.team,
929
- apiKey: values["api-key"],
930
978
  slug: values.slug,
931
979
  bearerToken: values["bearer-token"],
932
- stateRoot: values["state-root"],
933
980
  }));
934
981
  }
935
- case "skill": {
936
- return cmdSkill(positionals[0], axFromOptions({
937
- dir,
938
- text: values.text,
939
- url: values.url,
940
- prod: values.prod,
941
- team: values.team,
942
- apiKey: values["api-key"],
943
- slug: values.slug,
944
- bearerToken: values["bearer-token"],
945
- stateRoot: values["state-root"],
946
- }));
982
+ return cmdEval(axFromOptions({
983
+ dir,
984
+ evalIds: positionals,
985
+ list: values.list,
986
+ verbose: values.verbose,
987
+ json: values.json,
988
+ tags: values.tag,
989
+ url: values.url,
990
+ prod: values.prod,
991
+ noWait: values["no-wait"],
992
+ slug: values.slug,
993
+ bearerToken: values["bearer-token"],
994
+ stateRoot: values["state-root"],
995
+ timeoutMs: parseTimeoutMs(values["timeout-ms"]),
996
+ stream: values["no-stream"] ? false : undefined,
997
+ strict: values.strict,
998
+ junit: values.junit,
999
+ artifacts: values["no-artifacts"] ? false : values.artifacts,
1000
+ skipReport: values["skip-report"],
1001
+ maxConcurrency: parseMaxConcurrency(values["max-concurrency"]),
1002
+ out: values.out,
1003
+ }));
1004
+ }
1005
+ case "chat": {
1006
+ return cmdChat(axFromOptions({
1007
+ dir,
1008
+ messages: values.message,
1009
+ url: values.url,
1010
+ prod: values.prod,
1011
+ team: values.team,
1012
+ apiKey: values["api-key"],
1013
+ slug: values.slug,
1014
+ sessionId: values["session-id"] ?? values.session,
1015
+ resume: values.resume,
1016
+ continuationToken: values["continuation-token"],
1017
+ bearerToken: values["bearer-token"],
1018
+ json: values.json,
1019
+ text: values.text,
1020
+ noColor: values["no-color"],
1021
+ }));
1022
+ }
1023
+ case "resume": {
1024
+ return cmdResume(positionals[0], axFromOptions({
1025
+ dir,
1026
+ messages: values.message,
1027
+ url: values.url,
1028
+ prod: values.prod,
1029
+ team: values.team,
1030
+ apiKey: values["api-key"],
1031
+ slug: values.slug,
1032
+ // Positional wins; --session is accepted as a redundant alias.
1033
+ // No id → resume previous (cmdResume sets resume: true).
1034
+ sessionId: positionals[0] ?? values["session-id"] ?? values.session,
1035
+ continuationToken: values["continuation-token"],
1036
+ bearerToken: values["bearer-token"],
1037
+ json: values.json,
1038
+ text: values.text,
1039
+ noColor: values["no-color"],
1040
+ }));
1041
+ }
1042
+ case "logs": {
1043
+ return cmdLogs(axFromOptions({
1044
+ dir,
1045
+ url: values.url,
1046
+ prod: values.prod,
1047
+ team: values.team,
1048
+ apiKey: values["api-key"],
1049
+ slug: values.slug,
1050
+ bearerToken: values["bearer-token"],
1051
+ sessionId: positionals[0] ?? values["session-id"] ?? values.session,
1052
+ json: values.json,
1053
+ once: values.once,
1054
+ }));
1055
+ }
1056
+ case "sessions": {
1057
+ return cmdSessions(axFromOptions({
1058
+ dir,
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
+ json: values.json,
1066
+ }));
1067
+ }
1068
+ case "session": {
1069
+ const messages = await loadMessages(values.message, values["messages-file"]);
1070
+ return cmdSession(positionals[0], axFromOptions({
1071
+ dir,
1072
+ url: values.url,
1073
+ prod: values.prod,
1074
+ team: values.team,
1075
+ apiKey: values["api-key"],
1076
+ slug: values.slug,
1077
+ bearerToken: values["bearer-token"],
1078
+ json: values.json,
1079
+ text: values.text,
1080
+ rawEvents: values["raw-events"],
1081
+ out: values.out,
1082
+ messages,
1083
+ sessionId: values["session-id"] ?? values.session,
1084
+ dryRun: values["dry-run"],
1085
+ asOf: values["as-of"],
1086
+ componentKey: values.component,
1087
+ }));
1088
+ }
1089
+ case "cost": {
1090
+ return cmdCost(positionals[0] ?? values["session-id"] ?? values.session, axFromOptions({
1091
+ dir,
1092
+ url: values.url,
1093
+ prod: values.prod,
1094
+ team: values.team,
1095
+ apiKey: values["api-key"],
1096
+ slug: values.slug,
1097
+ bearerToken: values["bearer-token"],
1098
+ json: values.json,
1099
+ }));
1100
+ }
1101
+ case "playground": {
1102
+ return cmdPlayground(axFromOptions({
1103
+ dir,
1104
+ url: values.url,
1105
+ prod: values.prod,
1106
+ team: values.team,
1107
+ apiKey: values["api-key"],
1108
+ slug: values.slug,
1109
+ bearerToken: values["bearer-token"],
1110
+ sessionId: values["session-id"] ?? values.session,
1111
+ print: values.print,
1112
+ }));
1113
+ }
1114
+ case "docs": {
1115
+ const docsPort = values.port === undefined ? 0 : Number.parseInt(values.port, 10);
1116
+ if (Number.isNaN(docsPort) || docsPort < 0 || docsPort > 65535) {
1117
+ process.stderr.write(`invalid --port: ${values.port}\n`);
1118
+ return 1;
947
1119
  }
948
- case "trajectory": {
949
- if (values.events === undefined) {
950
- process.stderr.write("trajectory requires --events <file.ndjson>\n");
951
- return 1;
1120
+ const { cmdDocs } = await import("../internal/cli-docs.js");
1121
+ return cmdDocs({
1122
+ port: docsPort,
1123
+ host: values.host,
1124
+ print: values.print === true,
1125
+ });
1126
+ }
1127
+ case "validate": {
1128
+ const mounts = await loadMounts(dir);
1129
+ let hasError = false;
1130
+ for (const { slug, project } of mounts) {
1131
+ const label = slug === "" ? project.name : `${slug} (${project.name})`;
1132
+ if (project.diagnostics.length === 0) {
1133
+ process.stdout.write(`ok: ${label} has no diagnostics\n`);
1134
+ continue;
952
1135
  }
953
- return cmdTrajectory(axFromOptions({
954
- dir,
955
- events: values.events,
956
- text: values.text,
957
- }));
1136
+ process.stdout.write(`${label}:\n${formatDiagnostics(project.diagnostics)}\n`);
1137
+ hasError ||= project.diagnostics.some(d => d.severity === "error");
958
1138
  }
959
- case "eval": {
960
- // Remote status subcommand only when targeting --url. Otherwise the
961
- // bare token "status" is a normal eval id (evals/status.eval.ts).
962
- if (positionals[0] === "status" && values.url !== undefined) {
963
- return cmdEvalStatus(positionals[1], axFromOptions({
964
- dir,
965
- json: values.json,
966
- url: values.url,
967
- prod: values.prod,
968
- slug: values.slug,
969
- bearerToken: values["bearer-token"],
970
- out: values.out,
971
- }));
972
- }
973
- if (positionals[0] === "cancel" && values.url !== undefined) {
974
- return cmdEvalCancel(positionals[1], axFromOptions({
975
- dir,
976
- json: values.json,
977
- url: values.url,
978
- prod: values.prod,
979
- slug: values.slug,
980
- bearerToken: values["bearer-token"],
981
- }));
982
- }
983
- return cmdEval(axFromOptions({
984
- dir,
985
- evalIds: positionals,
986
- list: values.list,
987
- verbose: values.verbose,
988
- json: values.json,
989
- tags: values.tag,
990
- url: values.url,
991
- prod: values.prod,
992
- noWait: values["no-wait"],
993
- slug: values.slug,
994
- bearerToken: values["bearer-token"],
995
- stateRoot: values["state-root"],
996
- timeoutMs: parseTimeoutMs(values["timeout-ms"]),
997
- stream: values["no-stream"] ? false : undefined,
998
- strict: values.strict,
999
- junit: values.junit,
1000
- artifacts: values["no-artifacts"] ? false : values.artifacts,
1001
- skipReport: values["skip-report"],
1002
- maxConcurrency: parseMaxConcurrency(values["max-concurrency"]),
1003
- out: values.out,
1004
- }));
1139
+ return hasError ? 1 : 0;
1140
+ }
1141
+ case "info": {
1142
+ const mounts = await loadMounts(dir);
1143
+ if (values.json) {
1144
+ const payload = mounts.length === 1 && mounts[0]?.slug === ""
1145
+ ? projectInfo(mounts[0].project)
1146
+ : {
1147
+ agents: mounts.map(({ slug, project }) => ({
1148
+ slug,
1149
+ ...projectInfo(project),
1150
+ })),
1151
+ };
1152
+ process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
1153
+ return 0;
1005
1154
  }
1006
- case "chat": {
1007
- return cmdChat(axFromOptions({
1008
- dir,
1009
- messages: values.message,
1010
- url: values.url,
1011
- prod: values.prod,
1012
- team: values.team,
1013
- apiKey: values["api-key"],
1014
- slug: values.slug,
1015
- sessionId: (_r = values["session-id"]) !== null && _r !== void 0 ? _r : values.session,
1016
- resume: values.resume,
1017
- continuationToken: values["continuation-token"],
1018
- bearerToken: values["bearer-token"],
1019
- json: values.json,
1020
- text: values.text,
1021
- noColor: values["no-color"],
1022
- }));
1155
+ if (mounts.length > 1 || mounts[0]?.slug !== "") {
1156
+ process.stdout.write(`${mounts.length} agents under ${dir}:\n\n`);
1157
+ for (const { slug, project } of mounts) {
1158
+ const info = projectInfo(project);
1159
+ process.stdout.write(` /${slug} — ${info.name} (${formatModel(info.model)}, ${info.tools.length} tools, ${info.channels.length} channels)\n`);
1160
+ }
1161
+ const anyError = mounts.some(m => m.project.diagnostics.some(d => d.severity === "error"));
1162
+ return anyError ? 1 : 0;
1023
1163
  }
1024
- case "resume": {
1025
- return cmdResume(positionals[0], axFromOptions({
1026
- dir,
1027
- messages: values.message,
1028
- url: values.url,
1029
- prod: values.prod,
1030
- team: values.team,
1031
- apiKey: values["api-key"],
1032
- slug: values.slug,
1033
- // Positional wins; --session is accepted as a redundant alias.
1034
- // No id → resume previous (cmdResume sets resume: true).
1035
- sessionId: (_t = (_s = positionals[0]) !== null && _s !== void 0 ? _s : values["session-id"]) !== null && _t !== void 0 ? _t : values.session,
1036
- continuationToken: values["continuation-token"],
1037
- bearerToken: values["bearer-token"],
1038
- json: values.json,
1039
- text: values.text,
1040
- noColor: values["no-color"],
1041
- }));
1164
+ const project = mounts[0]?.project;
1165
+ const info = projectInfo(project);
1166
+ const lines = [];
1167
+ lines.push(`agent: ${info.name}`);
1168
+ lines.push(`model: ${formatModel(info.model)}`);
1169
+ lines.push(`mcp: ${info.mcp.path} (${info.mcp.tools.join(", ")})`);
1170
+ if (info.instructions !== undefined) {
1171
+ lines.push(`instructions: ${info.instructions.chars} chars`);
1042
1172
  }
1043
- case "logs": {
1044
- return cmdLogs(axFromOptions({
1045
- dir,
1046
- url: values.url,
1047
- prod: values.prod,
1048
- team: values.team,
1049
- apiKey: values["api-key"],
1050
- slug: values.slug,
1051
- bearerToken: values["bearer-token"],
1052
- sessionId: (_v = (_u = positionals[0]) !== null && _u !== void 0 ? _u : values["session-id"]) !== null && _v !== void 0 ? _v : values.session,
1053
- json: values.json,
1054
- once: values.once,
1055
- }));
1173
+ lines.push(section("tools", info.tools.map(t => `${t.name} — ${t.description}`)));
1174
+ lines.push(section("skills", info.skills.map(s => `${s.name} — ${s.description}`)));
1175
+ lines.push(section("extensions", info.extensions.map(e => {
1176
+ const contributed = [...e.tools, ...e.skills].join(", ") || "(nothing contributed)";
1177
+ const egress = e.hosting?.egressDomains ?? [];
1178
+ return egress.length === 0
1179
+ ? `${e.name} — ${contributed}`
1180
+ : `${e.name} — ${contributed}; egress: ${egress.join(", ")}`;
1181
+ })));
1182
+ lines.push(section("MCP connections", info.connections.map(c => `${c.name} — ${c.transport}`)));
1183
+ lines.push(section("subagents", info.subagents.map(s => `${s.name} — ${s.description ?? ""}`)));
1184
+ lines.push(section("channels", info.channels.map(c => `${c.id}: ${c.routes.map(r => `${r.method} ${r.url}`).join(", ") || "(events only)"}`)));
1185
+ lines.push(section("schedules", info.schedules.map(s => `${s.name} (${s.cron}, ${s.kind})`)));
1186
+ lines.push(section("hooks", info.hooks));
1187
+ lines.push(section("hosting egress domains", info.hosting?.egressDomains ?? []));
1188
+ lines.push(section("hosting secret names", info.hosting?.secretNames ?? []));
1189
+ if (info.diagnostics.length > 0) {
1190
+ lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
1056
1191
  }
1057
- case "sessions": {
1058
- return cmdSessions(axFromOptions({
1059
- dir,
1060
- url: values.url,
1061
- prod: values.prod,
1062
- team: values.team,
1063
- apiKey: values["api-key"],
1064
- slug: values.slug,
1065
- bearerToken: values["bearer-token"],
1066
- json: values.json,
1067
- }));
1192
+ process.stdout.write(`${lines.filter(line => line !== "").join("\n")}\n`);
1193
+ return info.diagnostics.some(d => d.severity === "error") ? 1 : 0;
1194
+ }
1195
+ case "dev":
1196
+ case "serve": {
1197
+ const serveDirResult = resolveServeDir({
1198
+ command,
1199
+ dir,
1200
+ positionals,
1201
+ dirFlagPassed: rest.includes("--dir"),
1202
+ });
1203
+ if (typeof serveDirResult !== "string") {
1204
+ process.stderr.write(serveDirResult.error);
1205
+ return 1;
1068
1206
  }
1069
- case "session": {
1070
- const messages = yield loadMessages(values.message, values["messages-file"]);
1071
- return cmdSession(positionals[0], axFromOptions({
1072
- dir,
1073
- url: values.url,
1074
- prod: values.prod,
1075
- team: values.team,
1076
- apiKey: values["api-key"],
1077
- slug: values.slug,
1078
- bearerToken: values["bearer-token"],
1079
- json: values.json,
1080
- text: values.text,
1081
- rawEvents: values["raw-events"],
1082
- out: values.out,
1083
- messages,
1084
- sessionId: (_w = values["session-id"]) !== null && _w !== void 0 ? _w : values.session,
1085
- dryRun: values["dry-run"],
1086
- asOf: values["as-of"],
1087
- componentKey: values.component,
1088
- }));
1207
+ const serveDir = serveDirResult;
1208
+ const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
1209
+ if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
1210
+ process.stderr.write(`invalid --port: ${values.port}\n`);
1211
+ return 1;
1089
1212
  }
1090
- case "cost": {
1091
- return cmdCost((_y = (_x = positionals[0]) !== null && _x !== void 0 ? _x : values["session-id"]) !== null && _y !== void 0 ? _y : values.session, axFromOptions({
1092
- dir,
1093
- url: values.url,
1094
- prod: values.prod,
1095
- team: values.team,
1096
- apiKey: values["api-key"],
1097
- slug: values.slug,
1098
- bearerToken: values["bearer-token"],
1099
- json: values.json,
1100
- }));
1213
+ if (values["allow-anonymous"] === true && values["bearer-token"] !== undefined) {
1214
+ process.stderr.write("--allow-anonymous and --bearer-token are mutually exclusive\n");
1215
+ return 1;
1101
1216
  }
1102
- case "playground": {
1103
- return cmdPlayground(axFromOptions({
1104
- dir,
1105
- url: values.url,
1106
- prod: values.prod,
1107
- team: values.team,
1108
- apiKey: values["api-key"],
1109
- slug: values.slug,
1110
- bearerToken: values["bearer-token"],
1111
- sessionId: (_z = values["session-id"]) !== null && _z !== void 0 ? _z : values.session,
1112
- print: values.print,
1113
- }));
1217
+ const mode = values.mode;
1218
+ if (mode !== undefined && mode !== "single" && mode !== "multi") {
1219
+ process.stderr.write(`invalid --mode: ${mode} (expected "single" or "multi")\n`);
1220
+ return 1;
1114
1221
  }
1115
- case "docs": {
1116
- const docsPort = values.port === undefined ? 0 : Number.parseInt(values.port, 10);
1117
- if (Number.isNaN(docsPort) || docsPort < 0 || docsPort > 65535) {
1118
- process.stderr.write(`invalid --port: ${values.port}\n`);
1119
- return 1;
1222
+ const dev = command === "dev" || values.dev === true;
1223
+ const style = stdoutPalette();
1224
+ // Real env wins (loadEnvFile never overrides). Runs inside start()
1225
+ // so dev's Enter-restart picks up tokens written since boot.
1226
+ const loadLocalEnv = () => {
1227
+ const loadedEnvFiles = loadAgentLocalEnv(serveDir);
1228
+ if (loadedEnvFiles.length > 0) {
1229
+ process.stdout.write(`${style.dim(`env: loaded ${loadedEnvFiles.join(", ")}`)}\n`);
1120
1230
  }
1121
- const { cmdDocs } = yield import("../internal/cli-docs.js");
1122
- return cmdDocs({
1123
- port: docsPort,
1124
- host: values.host,
1125
- print: values.print === true,
1231
+ };
1232
+ const serveOptions = {
1233
+ port,
1234
+ host: values.host,
1235
+ mode: mode,
1236
+ dev,
1237
+ apiKey: values["api-key"],
1238
+ stateRoot: values["state-root"],
1239
+ authToken: values["bearer-token"],
1240
+ allowAnonymous: values["allow-anonymous"] === true ? true : undefined,
1241
+ allowAnonymousCursorGithub: values["allow-anonymous-cursor-github"] === true ? true : undefined,
1242
+ allowAnonymousCursorAccountMcp: values["allow-anonymous-cursor-account-mcp"] === true ? true : undefined,
1243
+ allowAnonymousGrokbot: values["allow-anonymous-grokbot"] === true ? true : undefined,
1244
+ cursorScmProxy: values["cursor-scm-proxy"] === true ? true : undefined,
1245
+ schedules: values["no-schedules"] === true ? false : undefined,
1246
+ noControlPlane: values["no-control-plane"] === true ? true : undefined,
1247
+ playground: values["no-playground"] === true ? false : undefined,
1248
+ docs: values["no-docs"] === true ? false : undefined,
1249
+ publicUrl: values["public-url"],
1250
+ cloudToolsUrl: values["cloud-tools-url"],
1251
+ cursorEvents: values["cursor-events"] === true ? { repos: values.repo ?? [] } : undefined,
1252
+ // Soft boot logs stay secondary to the banner. `dim` is a no-op on
1253
+ // already-styled lines (the MCP warning box).
1254
+ logger: (line) => {
1255
+ process.stdout.write(`${style.dim(line)}\n`);
1256
+ },
1257
+ };
1258
+ const enterToRestart = process.stdin.isTTY === true;
1259
+ if (enterToRestart && !isServeRestartWorker()) {
1260
+ return runEnterRestartSupervisor({
1261
+ spawn: (command, args, spawnOptions) => spawn(command, args, spawnOptions),
1262
+ onRestart: () => {
1263
+ clearTerminal();
1264
+ },
1126
1265
  });
1127
1266
  }
1128
- case "validate": {
1129
- const mounts = yield loadMounts(dir);
1130
- let hasError = false;
1131
- for (const { slug, project } of mounts) {
1132
- const label = slug === "" ? project.name : `${slug} (${project.name})`;
1133
- if (project.diagnostics.length === 0) {
1134
- process.stdout.write(`ok: ${label} has no diagnostics\n`);
1135
- continue;
1136
- }
1137
- process.stdout.write(`${label}:\n${formatDiagnostics(project.diagnostics)}\n`);
1138
- hasError || (hasError = project.diagnostics.some(d => d.severity === "error"));
1139
- }
1140
- return hasError ? 1 : 0;
1141
- }
1142
- case "info": {
1143
- const mounts = yield loadMounts(dir);
1144
- if (values.json) {
1145
- const payload = mounts.length === 1 && ((_g = mounts[0]) === null || _g === void 0 ? void 0 : _g.slug) === ""
1146
- ? projectInfo(mounts[0].project)
1147
- : {
1148
- agents: mounts.map(({ slug, project }) => (Object.assign({ slug }, projectInfo(project)))),
1149
- };
1150
- process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
1151
- return 0;
1152
- }
1153
- if (mounts.length > 1 || ((_h = mounts[0]) === null || _h === void 0 ? void 0 : _h.slug) !== "") {
1154
- process.stdout.write(`${mounts.length} agents under ${dir}:\n\n`);
1155
- for (const { slug, project } of mounts) {
1156
- const info = projectInfo(project);
1157
- process.stdout.write(` /${slug} — ${info.name} (${formatModel(info.model)}, ${info.tools.length} tools, ${info.channels.length} channels)\n`);
1158
- }
1159
- const anyError = mounts.some(m => m.project.diagnostics.some(d => d.severity === "error"));
1160
- return anyError ? 1 : 0;
1161
- }
1162
- const project = (_j = mounts[0]) === null || _j === void 0 ? void 0 : _j.project;
1163
- const info = projectInfo(project);
1164
- const lines = [];
1165
- lines.push(`agent: ${info.name}`);
1166
- lines.push(`model: ${formatModel(info.model)}`);
1167
- lines.push(`mcp: ${info.mcp.path} (${info.mcp.tools.join(", ")})`);
1168
- if (info.instructions !== undefined) {
1169
- lines.push(`instructions: ${info.instructions.chars} chars`);
1170
- }
1171
- lines.push(section("tools", info.tools.map(t => `${t.name} — ${t.description}`)));
1172
- lines.push(section("skills", info.skills.map(s => `${s.name} — ${s.description}`)));
1173
- lines.push(section("extensions", info.extensions.map(e => {
1174
- var _a;
1175
- var _b;
1176
- const contributed = [...e.tools, ...e.skills].join(", ") || "(nothing contributed)";
1177
- const egress = (_b = (_a = e.hosting) === null || _a === void 0 ? void 0 : _a.egressDomains) !== null && _b !== void 0 ? _b : [];
1178
- return egress.length === 0
1179
- ? `${e.name} — ${contributed}`
1180
- : `${e.name} — ${contributed}; egress: ${egress.join(", ")}`;
1181
- })));
1182
- lines.push(section("MCP connections", info.connections.map(c => `${c.name} — ${c.transport}`)));
1183
- lines.push(section("subagents", info.subagents.map(s => { var _a; return `${s.name} — ${(_a = s.description) !== null && _a !== void 0 ? _a : ""}`; })));
1184
- lines.push(section("channels", info.channels.map(c => `${c.id}: ${c.routes.map(r => `${r.method} ${r.url}`).join(", ") || "(events only)"}`)));
1185
- lines.push(section("schedules", info.schedules.map(s => `${s.name} (${s.cron}, ${s.kind})`)));
1186
- lines.push(section("hooks", info.hooks));
1187
- lines.push(section("hosting egress domains", (_0 = (_k = info.hosting) === null || _k === void 0 ? void 0 : _k.egressDomains) !== null && _0 !== void 0 ? _0 : []));
1188
- lines.push(section("hosting secret names", (_1 = (_l = info.hosting) === null || _l === void 0 ? void 0 : _l.secretNames) !== null && _1 !== void 0 ? _1 : []));
1189
- if (info.diagnostics.length > 0) {
1190
- lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
1191
- }
1192
- process.stdout.write(`${lines.filter(line => line !== "").join("\n")}\n`);
1193
- return info.diagnostics.some(d => d.severity === "error") ? 1 : 0;
1194
- }
1195
- case "dev":
1196
- case "serve": {
1197
- const serveDirResult = resolveServeDir({
1198
- command,
1199
- dir,
1200
- positionals,
1201
- dirFlagPassed: rest.includes("--dir"),
1202
- });
1203
- if (typeof serveDirResult !== "string") {
1204
- process.stderr.write(serveDirResult.error);
1205
- return 1;
1206
- }
1207
- const serveDir = serveDirResult;
1208
- const port = values.port === undefined ? undefined : Number.parseInt(values.port, 10);
1209
- if (port !== undefined && (Number.isNaN(port) || port < 0 || port > 65535)) {
1210
- process.stderr.write(`invalid --port: ${values.port}\n`);
1211
- return 1;
1212
- }
1213
- if (values["allow-anonymous"] === true && values["bearer-token"] !== undefined) {
1214
- process.stderr.write("--allow-anonymous and --bearer-token are mutually exclusive\n");
1215
- return 1;
1216
- }
1217
- const mode = values.mode;
1218
- if (mode !== undefined && mode !== "single" && mode !== "multi") {
1219
- process.stderr.write(`invalid --mode: ${mode} (expected "single" or "multi")\n`);
1220
- return 1;
1267
+ const bannerOpts = {
1268
+ noPlayground: values["no-playground"] === true,
1269
+ dev,
1270
+ bearerToken: values["bearer-token"] !== undefined,
1271
+ noSchedules: values["no-schedules"] === true,
1272
+ };
1273
+ const start = async () => {
1274
+ loadLocalEnv();
1275
+ const next = await serve(serveDir, serveOptions);
1276
+ printServeBanner(next, bannerOpts);
1277
+ if (enterToRestart) {
1278
+ process.stdout.write(style.dim(" press Enter to restart\n"));
1221
1279
  }
1222
- const dev = command === "dev" || values.dev === true;
1223
- const style = stdoutPalette();
1224
- // Real env wins (loadEnvFile never overrides). Runs inside start()
1225
- // so dev's Enter-restart picks up tokens written since boot.
1226
- const loadLocalEnv = () => {
1227
- const loadedEnvFiles = loadAgentLocalEnv(serveDir);
1228
- if (loadedEnvFiles.length > 0) {
1229
- process.stdout.write(`${style.dim(`env: loaded ${loadedEnvFiles.join(", ")}`)}\n`);
1280
+ return next;
1281
+ };
1282
+ const handle = await start();
1283
+ let closing = false;
1284
+ let restartRequested = false;
1285
+ await new Promise(resolve => {
1286
+ const shutdown = () => {
1287
+ if (closing) {
1288
+ return;
1230
1289
  }
1290
+ closing = true;
1291
+ process.stdout.write("\nshutting down (draining running turns)\n");
1292
+ void handle.close().finally(resolve);
1231
1293
  };
1232
- const serveOptions = {
1233
- port,
1234
- host: values.host,
1235
- mode: mode,
1236
- dev,
1237
- apiKey: values["api-key"],
1238
- stateRoot: values["state-root"],
1239
- authToken: values["bearer-token"],
1240
- allowAnonymous: values["allow-anonymous"] === true ? true : undefined,
1241
- allowAnonymousCursorGithub: values["allow-anonymous-cursor-github"] === true ? true : undefined,
1242
- allowAnonymousCursorAccountMcp: values["allow-anonymous-cursor-account-mcp"] === true ? true : undefined,
1243
- allowAnonymousGrokbot: values["allow-anonymous-grokbot"] === true ? true : undefined,
1244
- cursorScmProxy: values["cursor-scm-proxy"] === true ? true : undefined,
1245
- schedules: values["no-schedules"] === true ? false : undefined,
1246
- noControlPlane: values["no-control-plane"] === true ? true : undefined,
1247
- playground: values["no-playground"] === true ? false : undefined,
1248
- docs: values["no-docs"] === true ? false : undefined,
1249
- publicUrl: values["public-url"],
1250
- cloudToolsUrl: values["cloud-tools-url"],
1251
- cursorEvents: values["cursor-events"] === true ? { repos: (_2 = values.repo) !== null && _2 !== void 0 ? _2 : [] } : undefined,
1252
- // Soft boot logs stay secondary to the banner. `dim` is a no-op on
1253
- // already-styled lines (the MCP warning box).
1254
- logger: (line) => {
1255
- process.stdout.write(`${style.dim(line)}\n`);
1256
- },
1257
- };
1258
- const enterToRestart = process.stdin.isTTY === true;
1259
- if (enterToRestart && !isServeRestartWorker()) {
1260
- return runEnterRestartSupervisor({
1261
- spawn: (command, args, spawnOptions) => spawn(command, args, spawnOptions),
1262
- onRestart: () => {
1263
- clearTerminal();
1264
- },
1265
- });
1294
+ process.on("SIGINT", shutdown);
1295
+ process.on("SIGTERM", shutdown);
1296
+ if (!enterToRestart) {
1297
+ return;
1266
1298
  }
1267
- const bannerOpts = {
1268
- noPlayground: values["no-playground"] === true,
1269
- dev,
1270
- bearerToken: values["bearer-token"] !== undefined,
1271
- noSchedules: values["no-schedules"] === true,
1272
- };
1273
- const start = () => __awaiter(this, void 0, void 0, function* () {
1274
- loadLocalEnv();
1275
- const next = yield serve(serveDir, serveOptions);
1276
- printServeBanner(next, bannerOpts);
1277
- if (enterToRestart) {
1278
- process.stdout.write(style.dim(" press Enter to restart\n"));
1279
- }
1280
- return next;
1281
- });
1282
- const handle = yield start();
1283
- let closing = false;
1284
- let restartRequested = false;
1285
- yield new Promise(resolve => {
1286
- const shutdown = () => {
1287
- if (closing) {
1288
- return;
1289
- }
1290
- closing = true;
1291
- process.stdout.write("\nshutting down (draining running turns)\n");
1292
- void handle.close().finally(resolve);
1293
- };
1294
- process.on("SIGINT", shutdown);
1295
- process.on("SIGTERM", shutdown);
1296
- if (!enterToRestart) {
1299
+ process.stdin.resume();
1300
+ process.stdin.on("data", (chunk) => {
1301
+ const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
1302
+ if (!isEnterOnly(text) || closing) {
1297
1303
  return;
1298
1304
  }
1299
- process.stdin.resume();
1300
- process.stdin.on("data", (chunk) => {
1301
- const text = typeof chunk === "string" ? chunk : chunk.toString("utf8");
1302
- if (!isEnterOnly(text) || closing) {
1303
- return;
1304
- }
1305
- closing = true;
1306
- restartRequested = true;
1307
- clearTerminal();
1308
- process.stdout.write(style.dim("restarting…\n"));
1309
- void handle.close().finally(resolve);
1310
- });
1305
+ closing = true;
1306
+ restartRequested = true;
1307
+ clearTerminal();
1308
+ process.stdout.write(style.dim("restarting…\n"));
1309
+ void handle.close().finally(resolve);
1311
1310
  });
1312
- return restartRequested ? ENTER_RESTART_EXIT_CODE : 0;
1313
- }
1314
- default: {
1315
- process.stderr.write(`Unknown command "${command}"\n\n${HELP}`);
1316
- return 1;
1317
- }
1311
+ });
1312
+ return restartRequested ? ENTER_RESTART_EXIT_CODE : 0;
1318
1313
  }
1319
- });
1314
+ default: {
1315
+ process.stderr.write(`Unknown command "${command}"\n\n${HELP}`);
1316
+ return 1;
1317
+ }
1318
+ }
1320
1319
  }
1321
1320
  function deployOptionsFromValues(values) {
1322
1321
  return {
@@ -1373,27 +1372,25 @@ function axFromOptions(partial) {
1373
1372
  out: partial.out,
1374
1373
  };
1375
1374
  }
1376
- function loadMessages(messages, messagesFile) {
1377
- return __awaiter(this, void 0, void 0, function* () {
1378
- const out = [];
1379
- if (messagesFile !== undefined) {
1380
- const raw = yield readFile(resolve(messagesFile), "utf8");
1381
- const parsed = JSON.parse(raw);
1382
- if (!Array.isArray(parsed)) {
1383
- throw new Error("--messages-file must be a JSON array of strings");
1384
- }
1385
- for (const item of parsed) {
1386
- if (typeof item !== "string") {
1387
- throw new Error("--messages-file entries must be strings");
1388
- }
1389
- out.push(item);
1390
- }
1375
+ async function loadMessages(messages, messagesFile) {
1376
+ const out = [];
1377
+ if (messagesFile !== undefined) {
1378
+ const raw = await readFile(resolve(messagesFile), "utf8");
1379
+ const parsed = JSON.parse(raw);
1380
+ if (!Array.isArray(parsed)) {
1381
+ throw new Error("--messages-file must be a JSON array of strings");
1391
1382
  }
1392
- if (messages !== undefined) {
1393
- out.push(...messages);
1383
+ for (const item of parsed) {
1384
+ if (typeof item !== "string") {
1385
+ throw new Error("--messages-file entries must be strings");
1386
+ }
1387
+ out.push(item);
1394
1388
  }
1395
- return out;
1396
- });
1389
+ }
1390
+ if (messages !== undefined) {
1391
+ out.push(...messages);
1392
+ }
1393
+ return out;
1397
1394
  }
1398
1395
  function parseTimeoutMs(value) {
1399
1396
  if (value === undefined) {
@@ -1418,10 +1415,8 @@ function parseMaxConcurrency(value) {
1418
1415
  /**
1419
1416
  * Load mounts the same way `serve` does (multi-agent layout by default).
1420
1417
  */
1421
- function loadMounts(dir) {
1422
- return __awaiter(this, void 0, void 0, function* () {
1423
- return resolveAgentMounts(dir);
1424
- });
1418
+ async function loadMounts(dir) {
1419
+ return resolveAgentMounts(dir);
1425
1420
  }
1426
1421
  function section(title, items) {
1427
1422
  if (items.length === 0) {
@@ -1457,8 +1452,6 @@ function resolveServeDir(args) {
1457
1452
  return positionalDir;
1458
1453
  }
1459
1454
  function printServeBanner(handle, opts) {
1460
- var _a, _b;
1461
- var _c;
1462
1455
  const c = stdoutPalette();
1463
1456
  const agents = handle.agents;
1464
1457
  // Name the framework build in the boot line: hosted engines install the
@@ -1469,7 +1462,7 @@ function printServeBanner(handle, opts) {
1469
1462
  process.stdout.write(`${agents.length} agents listening ${versionTag}\n`);
1470
1463
  }
1471
1464
  else {
1472
- const info = projectInfo((_c = (_a = agents[0]) === null || _a === void 0 ? void 0 : _a.project) !== null && _c !== void 0 ? _c : handle.project);
1465
+ const info = projectInfo(agents[0]?.project ?? handle.project);
1473
1466
  process.stdout.write(`${info.name} listening ${versionTag}\n`);
1474
1467
  }
1475
1468
  const playgroundUrl = resolvePlaygroundBannerUrl(handle, opts.noPlayground);
@@ -1484,7 +1477,7 @@ function printServeBanner(handle, opts) {
1484
1477
  // plain `serve`, where operators often curl the HTTP surface directly.
1485
1478
  if (!opts.dev) {
1486
1479
  process.stdout.write(c.dim(` api ${handle.url}\n`));
1487
- if (agents.length > 1 || ((_b = agents[0]) === null || _b === void 0 ? void 0 : _b.slug) !== "") {
1480
+ if (agents.length > 1 || agents[0]?.slug !== "") {
1488
1481
  for (const agent of agents) {
1489
1482
  const info = projectInfo(agent.project);
1490
1483
  process.stdout.write(c.dim(` /${agent.slug} ${info.name}\n`));
@@ -1566,8 +1559,7 @@ function formatModel(model) {
1566
1559
  */
1567
1560
  function installTransportErrorGuards() {
1568
1561
  const isTransportNoise = (reason) => {
1569
- var _a;
1570
- const message = reason instanceof Error ? `${reason.message}\n${(_a = reason.stack) !== null && _a !== void 0 ? _a : ""}` : String(reason);
1562
+ const message = reason instanceof Error ? `${reason.message}\n${reason.stack ?? ""}` : String(reason);
1571
1563
  const code = reason !== null &&
1572
1564
  typeof reason === "object" &&
1573
1565
  "code" in reason &&
@@ -1599,12 +1591,11 @@ function installTransportErrorGuards() {
1599
1591
  log("unhandledRejection", reason);
1600
1592
  });
1601
1593
  process.on("uncaughtException", error => {
1602
- var _a;
1603
1594
  if (isTransportNoise(error)) {
1604
1595
  log("swallowed uncaughtException", error);
1605
1596
  return;
1606
1597
  }
1607
- process.stderr.write(`[bdk] uncaughtException: ${(_a = error.stack) !== null && _a !== void 0 ? _a : error.message}\n`);
1598
+ process.stderr.write(`[bdk] uncaughtException: ${error.stack ?? error.message}\n`);
1608
1599
  void flushSessionRunFatal(error).finally(() => {
1609
1600
  process.exit(1);
1610
1601
  });