@cursor/bdk 0.2.2 → 0.2.4

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