@cursor/bdk 0.2.8 → 0.2.10

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