@cursor/july 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (298) hide show
  1. package/AGENTS.md +40 -7
  2. package/README.md +33 -24
  3. package/dist/bin/agent-serve.d.ts +3 -1
  4. package/dist/bin/agent-serve.d.ts.map +1 -1
  5. package/dist/bin/agent-serve.js +466 -140
  6. package/dist/channels/github/api.d.ts.map +1 -1
  7. package/dist/channels/github/api.js +31 -14
  8. package/dist/channels/github/cursor-account.d.ts +43 -0
  9. package/dist/channels/github/cursor-account.d.ts.map +1 -0
  10. package/dist/channels/github/cursor-account.js +95 -0
  11. package/dist/channels/github/github-channel.d.ts.map +1 -1
  12. package/dist/channels/github/github-channel.js +46 -9
  13. package/dist/channels/github/index.d.ts +2 -2
  14. package/dist/channels/github/index.js +2 -2
  15. package/dist/channels/github/types.d.ts +17 -0
  16. package/dist/channels/github/types.d.ts.map +1 -1
  17. package/dist/channels/slack/slack-channel.d.ts +8 -2
  18. package/dist/channels/slack/slack-channel.d.ts.map +1 -1
  19. package/dist/channels/slack/slack-channel.js +8 -0
  20. package/dist/channels/slack/types.d.ts +24 -3
  21. package/dist/channels/slack/types.d.ts.map +1 -1
  22. package/dist/channels/slack/types.js +15 -1
  23. package/dist/docs/404.html +2 -2
  24. package/dist/docs/ab.html +8 -8
  25. package/dist/docs/assets/{ab.md.COdXkces.js → ab.md.BMCZ6Hd7.js} +3 -3
  26. package/dist/docs/assets/{ab.md.COdXkces.lean.js → ab.md.BMCZ6Hd7.lean.js} +1 -1
  27. package/dist/docs/assets/{app.DqfFEmJd.js → app.BR0RbIdx.js} +1 -1
  28. package/dist/docs/assets/chunks/@localSearchIndexroot.DtIOQzGj.js +1 -0
  29. package/dist/docs/assets/chunks/{VPLocalSearchBox.BaLEdS15.js → VPLocalSearchBox.qjsVTneI.js} +1 -1
  30. package/dist/docs/assets/chunks/{theme.CZRvu_0q.js → theme.2Kg8jIp_.js} +2 -2
  31. package/dist/docs/assets/{deployment.md.Dx1TYNk5.js → deployment.md.DTKwE15Z.js} +3 -3
  32. package/dist/docs/assets/{deployment.md.Dx1TYNk5.lean.js → deployment.md.DTKwE15Z.lean.js} +1 -1
  33. package/dist/docs/assets/{evals.md.DPZ_MAnI.js → evals.md.DAgEc_hL.js} +3 -3
  34. package/dist/docs/assets/{guides_agent-to-agent.md.CrtrsySy.js → guides_agent-to-agent.md.Bpzgq2Pq.js} +1 -1
  35. package/dist/docs/assets/{guides_cloud-runtime.md.CYlNMTNp.js → guides_cloud-runtime.md.gVzabdQL.js} +1 -1
  36. package/dist/docs/assets/{guides_github.md.DwbKhCeS.js → guides_github.md.DOOCpqsW.js} +11 -4
  37. package/dist/docs/assets/{guides_github.md.DwbKhCeS.lean.js → guides_github.md.DOOCpqsW.lean.js} +1 -1
  38. package/dist/docs/assets/{guides_human-in-the-loop.md.Dvuctx7s.js → guides_human-in-the-loop.md.DlUqsp1S.js} +2 -2
  39. package/dist/docs/assets/{guides_slack.md.bv41fHfW.js → guides_slack.md.CCwqHvSV.js} +4 -4
  40. package/dist/docs/assets/{guides_slack.md.bv41fHfW.lean.js → guides_slack.md.CCwqHvSV.lean.js} +1 -1
  41. package/dist/docs/assets/{guides_webhooks.md.hFTik3lf.js → guides_webhooks.md.B1EswtUu.js} +2 -2
  42. package/dist/docs/assets/index.md.m81y7TY7.js +20 -0
  43. package/dist/docs/assets/{index.md.BPKcj5AI.lean.js → index.md.m81y7TY7.lean.js} +1 -1
  44. package/dist/docs/assets/quickstart.md.BU6Iwi_9.js +204 -0
  45. package/dist/docs/assets/quickstart.md.BU6Iwi_9.lean.js +1 -0
  46. package/dist/docs/assets/{reference_agent-config.md.Bpd7HQwf.js → reference_agent-config.md.DrW2JUM8.js} +4 -4
  47. package/dist/docs/assets/{reference_agent-config.md.Bpd7HQwf.lean.js → reference_agent-config.md.DrW2JUM8.lean.js} +1 -1
  48. package/dist/docs/assets/{reference_channels.md.D7JTR03W.js → reference_channels.md.DdmiKgqf.js} +4 -4
  49. package/dist/docs/assets/{reference_channels.md.D7JTR03W.lean.js → reference_channels.md.DdmiKgqf.lean.js} +1 -1
  50. package/dist/docs/assets/{reference_cli.md.DA730zCu.js → reference_cli.md.Bv6pOxcF.js} +11 -6
  51. package/dist/docs/assets/{reference_cli.md.DA730zCu.lean.js → reference_cli.md.Bv6pOxcF.lean.js} +1 -1
  52. package/dist/docs/assets/{reference_connections.md.C3vNH_DE.js → reference_connections.md.zaEYCLHT.js} +1 -1
  53. package/dist/docs/assets/{reference_hooks.md.BCEc3MyM.js → reference_hooks.md.DyLVfE1O.js} +1 -1
  54. package/dist/docs/assets/{reference_hooks.md.BCEc3MyM.lean.js → reference_hooks.md.DyLVfE1O.lean.js} +1 -1
  55. package/dist/docs/assets/{reference_http-api.md.DBAahtdz.js → reference_http-api.md.Dx_nmDG6.js} +1 -1
  56. package/dist/docs/assets/{reference_instructions.md.BC05LEQ8.js → reference_instructions.md.CgoV-YEb.js} +9 -7
  57. package/dist/docs/assets/{reference_instructions.md.BC05LEQ8.lean.js → reference_instructions.md.CgoV-YEb.lean.js} +1 -1
  58. package/dist/docs/assets/{reference_schedules.md.D7qijxLk.js → reference_schedules.md.w_F2mXB6.js} +2 -2
  59. package/dist/docs/assets/{reference_skills.md.VQnlBT3Q.js → reference_skills.md.B_jHN7JL.js} +3 -3
  60. package/dist/docs/assets/{reference_skills.md.VQnlBT3Q.lean.js → reference_skills.md.B_jHN7JL.lean.js} +1 -1
  61. package/dist/docs/assets/{reference_subagents.md.CIRAVcPK.js → reference_subagents.md.zWAMNfi1.js} +1 -1
  62. package/dist/docs/assets/{reference_tools.md.DF5kwlt0.js → reference_tools.md.CqgJroI0.js} +2 -2
  63. package/dist/docs/assets/scaffolding-agents.md.C3pTrmoE.js +1 -0
  64. package/dist/docs/assets/scaffolding-agents.md.C3pTrmoE.lean.js +1 -0
  65. package/dist/docs/assets/storage.md.CVnInNiN.js +17 -0
  66. package/dist/docs/assets/storage.md.CVnInNiN.lean.js +1 -0
  67. package/dist/docs/building-with-agents.html +4 -4
  68. package/dist/docs/concepts.html +4 -4
  69. package/dist/docs/deployment.html +7 -7
  70. package/dist/docs/evals.html +7 -7
  71. package/dist/docs/guides/agent-to-agent.html +6 -6
  72. package/dist/docs/guides/cloud-runtime.html +5 -5
  73. package/dist/docs/guides/github.html +14 -7
  74. package/dist/docs/guides/human-in-the-loop.html +6 -6
  75. package/dist/docs/guides/slack.html +8 -8
  76. package/dist/docs/guides/webhooks.html +6 -6
  77. package/dist/docs/hashmap.json +1 -1
  78. package/dist/docs/hillclimbing.html +5 -5
  79. package/dist/docs/index.html +7 -7
  80. package/dist/docs/quickstart.html +195 -26
  81. package/dist/docs/reference/agent-config.html +7 -7
  82. package/dist/docs/reference/channels.html +8 -8
  83. package/dist/docs/reference/cli.html +14 -9
  84. package/dist/docs/reference/connections.html +5 -5
  85. package/dist/docs/reference/hooks.html +5 -5
  86. package/dist/docs/reference/http-api.html +6 -6
  87. package/dist/docs/reference/instructions.html +13 -11
  88. package/dist/docs/reference/playground.html +4 -4
  89. package/dist/docs/reference/project-layout.html +4 -4
  90. package/dist/docs/reference/schedules.html +7 -7
  91. package/dist/docs/reference/sessions.html +4 -4
  92. package/dist/docs/reference/skills.html +6 -6
  93. package/dist/docs/reference/subagents.html +6 -6
  94. package/dist/docs/reference/tools.html +7 -7
  95. package/dist/docs/scaffolding-agents.html +5 -5
  96. package/dist/docs/storage.html +41 -0
  97. package/dist/docs/troubleshooting.html +4 -4
  98. package/dist/index.d.ts +2 -0
  99. package/dist/index.d.ts.map +1 -1
  100. package/dist/index.js +1 -0
  101. package/dist/internal/chat-client.d.ts +29 -3
  102. package/dist/internal/chat-client.d.ts.map +1 -1
  103. package/dist/internal/chat-client.js +180 -27
  104. package/dist/internal/cli-ax.d.ts +75 -2
  105. package/dist/internal/cli-ax.d.ts.map +1 -1
  106. package/dist/internal/cli-ax.js +600 -52
  107. package/dist/internal/cli-cursor.d.ts.map +1 -1
  108. package/dist/internal/cli-cursor.js +8 -36
  109. package/dist/internal/cli-deploy.d.ts +108 -0
  110. package/dist/internal/cli-deploy.d.ts.map +1 -0
  111. package/dist/internal/cli-deploy.js +1009 -0
  112. package/dist/internal/cursor/backend-client.d.ts +10 -1
  113. package/dist/internal/cursor/backend-client.d.ts.map +1 -1
  114. package/dist/internal/cursor/backend-client.js +79 -1
  115. package/dist/internal/cursor/credentials.d.ts +9 -0
  116. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  117. package/dist/internal/cursor/credentials.js +12 -0
  118. package/dist/internal/cursor/github-credentials.d.ts +44 -0
  119. package/dist/internal/cursor/github-credentials.d.ts.map +1 -0
  120. package/dist/internal/cursor/github-credentials.js +195 -0
  121. package/dist/internal/deploy-client.d.ts +184 -0
  122. package/dist/internal/deploy-client.d.ts.map +1 -0
  123. package/dist/internal/deploy-client.js +395 -0
  124. package/dist/internal/deploy-source.d.ts +35 -0
  125. package/dist/internal/deploy-source.d.ts.map +1 -0
  126. package/dist/internal/deploy-source.js +118 -0
  127. package/dist/internal/discovery.d.ts +11 -0
  128. package/dist/internal/discovery.d.ts.map +1 -1
  129. package/dist/internal/discovery.js +116 -19
  130. package/dist/internal/distribution.d.ts.map +1 -1
  131. package/dist/internal/distribution.js +1 -0
  132. package/dist/internal/eval-run-store.d.ts +22 -3
  133. package/dist/internal/eval-run-store.d.ts.map +1 -1
  134. package/dist/internal/eval-run-store.js +39 -20
  135. package/dist/internal/eval-runner.d.ts +2 -0
  136. package/dist/internal/eval-runner.d.ts.map +1 -1
  137. package/dist/internal/eval-runner.js +2 -0
  138. package/dist/internal/event-mapper.d.ts +54 -1
  139. package/dist/internal/event-mapper.d.ts.map +1 -1
  140. package/dist/internal/event-mapper.js +151 -41
  141. package/dist/internal/handleAgentServeTrigger.d.ts.map +1 -1
  142. package/dist/internal/handleAgentServeTrigger.js +10 -12
  143. package/dist/internal/host-platforms.d.ts +7 -2
  144. package/dist/internal/host-platforms.d.ts.map +1 -1
  145. package/dist/internal/host-platforms.js +15 -10
  146. package/dist/internal/hosting.d.ts +37 -0
  147. package/dist/internal/hosting.d.ts.map +1 -0
  148. package/dist/internal/hosting.js +67 -0
  149. package/dist/internal/init-project.d.ts +88 -1
  150. package/dist/internal/init-project.d.ts.map +1 -1
  151. package/dist/internal/init-project.js +221 -31
  152. package/dist/internal/install-cursor-skills.d.ts +64 -0
  153. package/dist/internal/install-cursor-skills.d.ts.map +1 -0
  154. package/dist/internal/install-cursor-skills.js +274 -0
  155. package/dist/internal/logs-client.d.ts +60 -0
  156. package/dist/internal/logs-client.d.ts.map +1 -0
  157. package/dist/internal/logs-client.js +311 -0
  158. package/dist/internal/open-browser.d.ts +5 -0
  159. package/dist/internal/open-browser.d.ts.map +1 -0
  160. package/dist/internal/open-browser.js +34 -0
  161. package/dist/internal/playground/toolchain.d.ts.map +1 -1
  162. package/dist/internal/playground/toolchain.js +16 -11
  163. package/dist/internal/playground-proxy.d.ts +69 -0
  164. package/dist/internal/playground-proxy.d.ts.map +1 -0
  165. package/dist/internal/playground-proxy.js +468 -0
  166. package/dist/internal/prompt-context.d.ts +35 -0
  167. package/dist/internal/prompt-context.d.ts.map +1 -0
  168. package/dist/internal/prompt-context.js +71 -0
  169. package/dist/internal/reminder-runner.d.ts +7 -0
  170. package/dist/internal/reminder-runner.d.ts.map +1 -1
  171. package/dist/internal/reminder-runner.js +50 -6
  172. package/dist/internal/reminder-store.d.ts +2 -0
  173. package/dist/internal/reminder-store.d.ts.map +1 -1
  174. package/dist/internal/reminder-store.js +18 -0
  175. package/dist/internal/request-headers.d.ts +11 -0
  176. package/dist/internal/request-headers.d.ts.map +1 -0
  177. package/dist/internal/request-headers.js +14 -0
  178. package/dist/internal/resolve-prod-target.d.ts +42 -0
  179. package/dist/internal/resolve-prod-target.d.ts.map +1 -0
  180. package/dist/internal/resolve-prod-target.js +111 -0
  181. package/dist/internal/run-client.d.ts +2 -2
  182. package/dist/internal/run-client.d.ts.map +1 -1
  183. package/dist/internal/run-client.js +38 -23
  184. package/dist/internal/server.d.ts.map +1 -1
  185. package/dist/internal/server.js +182 -45
  186. package/dist/internal/session-engine.d.ts +50 -1
  187. package/dist/internal/session-engine.d.ts.map +1 -1
  188. package/dist/internal/session-engine.js +267 -23
  189. package/dist/internal/sessions-client.d.ts +21 -0
  190. package/dist/internal/sessions-client.d.ts.map +1 -0
  191. package/dist/internal/sessions-client.js +168 -0
  192. package/dist/internal/storage-coordinator.d.ts +139 -0
  193. package/dist/internal/storage-coordinator.d.ts.map +1 -0
  194. package/dist/internal/storage-coordinator.js +499 -0
  195. package/dist/internal/stream-progress.d.ts.map +1 -1
  196. package/dist/internal/stream-progress.js +31 -3
  197. package/dist/internal/terminal-style.d.ts +22 -0
  198. package/dist/internal/terminal-style.d.ts.map +1 -0
  199. package/dist/internal/terminal-style.js +49 -0
  200. package/dist/internal/trajectory.d.ts +10 -5
  201. package/dist/internal/trajectory.d.ts.map +1 -1
  202. package/dist/internal/trajectory.js +82 -10
  203. package/dist/internal/workspace.d.ts +11 -0
  204. package/dist/internal/workspace.d.ts.map +1 -1
  205. package/dist/internal/workspace.js +38 -4
  206. package/dist/playground/assets/cursor-icons-outline-BxTT_FVJ.woff2 +0 -0
  207. package/dist/playground/assets/index-D-vo2lV_.css +1 -0
  208. package/dist/playground/assets/index-x60b9q2j.js +312 -0
  209. package/dist/playground/index.html +2 -2
  210. package/dist/storage.d.ts +204 -0
  211. package/dist/storage.d.ts.map +1 -0
  212. package/dist/storage.js +153 -0
  213. package/dist/types.d.ts +70 -4
  214. package/dist/types.d.ts.map +1 -1
  215. package/docs/README.md +3 -2
  216. package/docs/guides/github.md +43 -8
  217. package/docs/guides/slack.md +1 -1
  218. package/docs/quickstart.md +350 -57
  219. package/docs/reference/cli.md +51 -3
  220. package/docs/reference/instructions.md +8 -6
  221. package/docs/scaffolding-agents.md +1 -1
  222. package/docs/storage.md +98 -0
  223. package/package.json +10 -1
  224. package/skills/ab/SKILL.md +8 -8
  225. package/skills/create-agent/SKILL.md +28 -22
  226. package/skills/debug/SKILL.md +11 -11
  227. package/skills/evals/SKILL.md +16 -16
  228. package/skills/framework-map/SKILL.md +6 -6
  229. package/skills/github/SKILL.md +22 -14
  230. package/skills/hillclimb/SKILL.md +10 -10
  231. package/skills/setup-slack/SKILL.md +13 -13
  232. package/src/bin/agent-serve.ts +552 -179
  233. package/src/channels/github/api.ts +42 -23
  234. package/src/channels/github/cursor-account.ts +165 -0
  235. package/src/channels/github/github-channel.ts +66 -6
  236. package/src/channels/github/index.ts +2 -2
  237. package/src/channels/github/types.ts +19 -0
  238. package/src/channels/slack/slack-channel.ts +17 -3
  239. package/src/channels/slack/types.ts +44 -3
  240. package/src/index.ts +13 -0
  241. package/src/internal/chat-client.ts +252 -37
  242. package/src/internal/cli-ax.ts +722 -72
  243. package/src/internal/cli-cursor.ts +14 -42
  244. package/src/internal/cli-deploy.ts +1319 -0
  245. package/src/internal/cursor/backend-client.ts +103 -1
  246. package/src/internal/cursor/credentials.ts +14 -0
  247. package/src/internal/cursor/github-credentials.ts +248 -0
  248. package/src/internal/deploy-client.ts +632 -0
  249. package/src/internal/deploy-source.ts +133 -0
  250. package/src/internal/discovery.ts +141 -17
  251. package/src/internal/distribution.ts +1 -0
  252. package/src/internal/eval-run-store.ts +50 -20
  253. package/src/internal/eval-runner.ts +5 -0
  254. package/src/internal/event-mapper.ts +222 -42
  255. package/src/internal/handleAgentServeTrigger.ts +10 -12
  256. package/src/internal/host-platforms.ts +28 -11
  257. package/src/internal/hosting.ts +77 -0
  258. package/src/internal/init-project.ts +333 -51
  259. package/src/internal/install-cursor-skills.ts +327 -0
  260. package/src/internal/logs-client.ts +442 -0
  261. package/src/internal/open-browser.ts +41 -0
  262. package/src/internal/playground/toolchain.ts +15 -13
  263. package/src/internal/playground-proxy.ts +576 -0
  264. package/src/internal/prompt-context.ts +95 -0
  265. package/src/internal/reminder-runner.ts +50 -6
  266. package/src/internal/reminder-store.ts +21 -0
  267. package/src/internal/request-headers.ts +23 -0
  268. package/src/internal/resolve-prod-target.ts +150 -0
  269. package/src/internal/run-client.ts +39 -36
  270. package/src/internal/server.ts +223 -28
  271. package/src/internal/session-engine.ts +307 -10
  272. package/src/internal/sessions-client.ts +182 -0
  273. package/src/internal/storage-coordinator.ts +615 -0
  274. package/src/internal/stream-progress.ts +36 -2
  275. package/src/internal/terminal-style.ts +74 -0
  276. package/src/internal/trajectory.ts +91 -13
  277. package/src/internal/workspace.ts +42 -4
  278. package/src/storage.ts +325 -0
  279. package/src/types.ts +82 -8
  280. package/dist/docs/assets/chunks/@localSearchIndexroot.CcVk1uKq.js +0 -1
  281. package/dist/docs/assets/index.md.BPKcj5AI.js +0 -20
  282. package/dist/docs/assets/quickstart.md.tVPiGK_L.js +0 -35
  283. package/dist/docs/assets/quickstart.md.tVPiGK_L.lean.js +0 -1
  284. package/dist/docs/assets/scaffolding-agents.md.CyYfWGdc.js +0 -1
  285. package/dist/docs/assets/scaffolding-agents.md.CyYfWGdc.lean.js +0 -1
  286. package/dist/playground/assets/cursor-icons-outline-oY2V_mvK.woff2 +0 -0
  287. package/dist/playground/assets/index-1K-hG-7p.css +0 -1
  288. package/dist/playground/assets/index-FlWjhg3x.js +0 -79
  289. /package/dist/docs/assets/{evals.md.DPZ_MAnI.lean.js → evals.md.DAgEc_hL.lean.js} +0 -0
  290. /package/dist/docs/assets/{guides_agent-to-agent.md.CrtrsySy.lean.js → guides_agent-to-agent.md.Bpzgq2Pq.lean.js} +0 -0
  291. /package/dist/docs/assets/{guides_cloud-runtime.md.CYlNMTNp.lean.js → guides_cloud-runtime.md.gVzabdQL.lean.js} +0 -0
  292. /package/dist/docs/assets/{guides_human-in-the-loop.md.Dvuctx7s.lean.js → guides_human-in-the-loop.md.DlUqsp1S.lean.js} +0 -0
  293. /package/dist/docs/assets/{guides_webhooks.md.hFTik3lf.lean.js → guides_webhooks.md.B1EswtUu.lean.js} +0 -0
  294. /package/dist/docs/assets/{reference_connections.md.C3vNH_DE.lean.js → reference_connections.md.zaEYCLHT.lean.js} +0 -0
  295. /package/dist/docs/assets/{reference_http-api.md.DBAahtdz.lean.js → reference_http-api.md.Dx_nmDG6.lean.js} +0 -0
  296. /package/dist/docs/assets/{reference_schedules.md.D7qijxLk.lean.js → reference_schedules.md.w_F2mXB6.lean.js} +0 -0
  297. /package/dist/docs/assets/{reference_subagents.md.CIRAVcPK.lean.js → reference_subagents.md.zWAMNfi1.lean.js} +0 -0
  298. /package/dist/docs/assets/{reference_tools.md.DF5kwlt0.lean.js → reference_tools.md.CqgJroI0.lean.js} +0 -0
@@ -3,10 +3,12 @@
3
3
  * agent-serve CLI.
4
4
  *
5
5
  * agent-serve serve [--dir .] [--port 3000] [--host 127.0.0.1] [--dev]
6
+ * agent-serve dev [path] [--port 3000] [--host 127.0.0.1]
6
7
  * agent-serve chat [--url http://127.0.0.1:3000] [--message "..."] [--json]
8
+ * agent-serve resume <sessionId> [--url | --prod] [--message "..."]
7
9
  * agent-serve run [--dir .] [--message "..."] [--json|--text]
8
10
  * agent-serve trajectory --events <file.ndjson>
9
- * agent-serve init [dir]
11
+ * agent-serve init [dir] [--json]
10
12
  * agent-serve eval [--dir .] [evalId...]
11
13
  * agent-serve validate [--dir .]
12
14
  * agent-serve slack <subcommand>
@@ -22,18 +24,34 @@ import {
22
24
  serve,
23
25
  } from "../index.js";
24
26
  import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
25
- import { runChat } from "../internal/chat-client.js";
26
27
  import {
27
28
  type AxCliOptions,
28
29
  cmdCall,
30
+ cmdChat,
29
31
  cmdEval,
30
32
  cmdInit,
33
+ cmdLogs,
34
+ cmdPlayground,
35
+ cmdResume,
31
36
  cmdRun,
37
+ cmdSession,
38
+ cmdSessions,
32
39
  cmdTrajectory,
33
40
  } from "../internal/cli-ax.js";
41
+ import {
42
+ cmdDeploy,
43
+ cmdDeploymentStatus,
44
+ cmdDeployments,
45
+ cmdRotatePodCredential,
46
+ cmdRotateToken,
47
+ cmdSecretsList,
48
+ cmdSecretsSet,
49
+ cmdSecretsUnset,
50
+ cmdStop,
51
+ type DeployCliOptions,
52
+ } from "../internal/cli-deploy.js";
34
53
  import { CLI_COMMAND_NAME as CLI } from "../internal/distribution.js";
35
- import { runSession } from "../internal/run-client.js";
36
- import { formatTrajectoryText } from "../internal/trajectory.js";
54
+ import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
37
55
  import type { AgentProject, AgentServeHandle } from "../types.js";
38
56
 
39
57
  const HELP = `${CLI} — serve a filesystem-defined Cursor agent over channels
@@ -43,38 +61,93 @@ Usage:
43
61
  [--mode single|multi] [--api-key <key>] [--no-schedules]
44
62
  [--public-url <url>]
45
63
  [--cursor-events --repo <owner/name>]...
46
- ${CLI} chat [--url <baseUrl>] [--message <text>] [--json] [--text]
47
- ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl>]
64
+ ${CLI} dev [path] [--port <n>] [--host <host>]
65
+ Same flags as serve; implies --dev. Path defaults to
66
+ the current directory (or pass --dir).
67
+ ${CLI} chat [--url <baseUrl> | --prod] [--message <text>] [--json] [--text]
68
+ [--session <id>] [--continuation-token <t>]
69
+ [--slug <slug>] [--team <id>]
70
+ ${CLI} resume <sessionId> [--url <baseUrl> | --prod] [--message <text>]
71
+ [--json] [--text] [--continuation-token <t>]
72
+ [--slug <slug>] [--team <id>]
73
+ ${CLI} logs [--url <baseUrl> | --prod] [--once] [--json]
74
+ [--slug <slug>] [--team <id>] [--dir <path>]
75
+ ${CLI} sessions [--url <baseUrl> | --prod] [--json]
76
+ [--slug <slug>] [--team <id>] [--dir <path>]
77
+ ${CLI} session <sessionId> [--url <baseUrl> | --prod]
78
+ [--json | --text | --events]
79
+ [--slug <slug>] [--team <id>] [--dir <path>]
80
+ ${CLI} playground [--url <baseUrl> | --prod] [--session <id>] [--print]
81
+ [--slug <slug>] [--team <id>] [--dir <path>]
82
+ ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl> | --prod]
48
83
  [--session <id>] [--continuation-token <t>]
49
84
  [--events <file.ndjson>] [--no-events] [--text]
50
- [--timeout-ms <n>] [--no-stream]
85
+ [--timeout-ms <n>] [--no-stream] [--slug <slug>] [--team <id>]
51
86
  ${CLI} trajectory --events <file.ndjson> [--text]
52
- ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl>]
53
- [--session <id>] [--slug <slug>]
54
- ${CLI} init [dir]
87
+ ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
88
+ [--session <id>] [--slug <slug>] [--team <id>]
89
+ ${CLI} init [dir] [--json]
55
90
  ${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
56
91
  [--tag <tag>]... [--verbose] [--timeout-ms <n>]
57
- [--no-stream]
92
+ [--no-stream] [--url <baseUrl> | --prod] [--slug <slug>]
93
+ [--team <id>]
58
94
  ${CLI} info [--dir <path>] [--json]
59
95
  ${CLI} validate [--dir <path>]
60
96
  ${CLI} login [--api-key <key>] [--key-name <name>]
61
97
  ${CLI} logout
62
98
  ${CLI} whoami [--json]
99
+ ${CLI} deploy [--dir <path>] [--slug <slug> | --all] [--team <id>] [--json]
100
+ [--no-wait] [--repo <url>] [--ref <ref>]
101
+ [--path <agentPath>] [--cursor-events-repo <owner/name>]...
102
+ [--allow-domain <domain>]...
103
+ ${CLI} deployments [--team <id>] [--json]
104
+ ${CLI} deployment <slug> [--team <id>] [--json]
105
+ ${CLI} stop <slug> [--team <id>] [--json] [--no-wait]
106
+ ${CLI} rotate-token <slug> [--team <id>]
107
+ ${CLI} rotate-pod-credential <slug> [--team <id>]
108
+ ${CLI} secrets set <slug> NAME[=VALUE]... | list <slug> | unset <slug> NAME
109
+ [--team <id>] [--json]
63
110
  ${CLI} slack <subcommand> …
64
111
  ${CLI} github <subcommand> …
65
112
 
66
113
  Commands:
67
114
  serve Serve agents under /<slug>/... (index at /). On a TTY, press
68
115
  Enter to restart (reloads agent code + Vite HMR child).
69
- chat Talk to a running server (streams the reply). --json prints a trajectory.
116
+ dev Local development: same as \`${CLI} serve --dev\` (manual
117
+ schedule/reminder dispatch, unsigned GitHub loopback, Vite HMR).
118
+ chat Interactive REPL against a running server (follow-ups keep the
119
+ session + continuation token). Optional --message seeds the first
120
+ turn then stays open on a TTY. --session reattaches (looks up the
121
+ continuation token via /v1/sessions when omitted) and replays the
122
+ transcript. --json is one-shot. Pass --prod to hit the team's
123
+ hosted deployment (slug from --slug or the directory name).
124
+ resume Reattach chat to an existing session id (same as
125
+ \`${CLI} chat --session <id>\`). Looks up the continuation token
126
+ via /v1/sessions when --continuation-token is omitted, then
127
+ replays the transcript. Pass --prod for a hosted deployment.
128
+ logs Tail agent logs. Default follows (Ctrl-C to stop); --once dumps
129
+ the current buffer. --prod shows deploy progress until the
130
+ hosted deployment is running, then tails runtime logs. Without
131
+ --prod, tails the local server (or --url).
132
+ sessions List sessions on a running agent (or --prod hosted deployment).
133
+ session Show one session. Default: text trajectory. --json for trajectory
134
+ JSON; --events for the raw event list. To continue interactively,
135
+ use \`${CLI} resume <id>\`.
136
+ playground Open the web playground. --prod starts a loopback proxy that
137
+ injects hosted engine credentials (browsers cannot set them).
138
+ --print skips opening a browser. Ctrl-C stops the proxy.
70
139
  run One-shot create→test loop: ephemeral server + JSON trajectory.
71
140
  Writes a single events.ndjson trace (visualize in the playground).
72
141
  Streams tool calls and reply text to stderr when stderr is a TTY.
142
+ Pass --prod to hit the hosted deployment instead of a local server.
73
143
  trajectory Summarize an events.ndjson file into a trajectory.
74
144
  call Call an authored server tool deterministically (no model turn)
75
145
  via POST /v1/tools/:toolName. --session runs it inside an
76
146
  existing session and records it on that session's event stream.
77
- init Scaffold a project, or print the coding-agent setup guide (no args).
147
+ init Scaffold a project (skipping existing files), npm install,
148
+ run login when unsigned, then print next steps. --json is
149
+ machine-readable and never blocks on login. No directory:
150
+ print the setup guide.
78
151
  eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
79
152
  Pass evalId args to select: one datapoint (weather/nyc), a whole
80
153
  file (weather → all cases in that file), several of either, or
@@ -86,6 +159,23 @@ Commands:
86
159
  inference, cloud runtime, and cursorAccount MCP connections.
87
160
  logout Remove the stored Cursor credentials.
88
161
  whoami Show which Cursor account powers this host (and why).
162
+ deploy Deploy onto Cursor's managed agent-serve hosting, then wait for
163
+ the engine to come up. --repo/--ref/--path stay available;
164
+ inside an agent git checkout they are inferred when omitted
165
+ (flags always win). When --dir is a multi-agent parent,
166
+ pick one interactively, or pass --slug / --all. First deploy
167
+ of a slug prints the alias token exactly once — save it.
168
+ deployments List the team's deployments (slug, status, generation, kind).
169
+ deployment Show one deployment in full (status, lastError, engine info).
170
+ stop Stop a deployment and wait until it reports stopped.
171
+ rotate-token Mint a new alias token for a deployment (shown once); the old
172
+ token stops working immediately.
173
+ rotate-pod-credential
174
+ Rotate a deployment's pod credential (prints the masked key);
175
+ the running pod keeps the old one until the next deploy.
176
+ secrets Manage deployment secrets: set (upsert by name; NAMEs without
177
+ =VALUE are prompted for with hidden input, or read from piped
178
+ stdin), list (names + createdAt; never values), unset.
89
179
  slack Slack channel pack: init, manifests, doctor (see slack help).
90
180
  github GitHub webhook pack: forward live deliveries, events, doctor
91
181
  (wraps \`gh webhook forward\`; see github help).
@@ -95,6 +185,7 @@ Agent loop:
95
185
  ${CLI} info --dir . --json
96
186
  ${CLI} run --dir . --message "..."
97
187
  ${CLI} eval --dir .
188
+ ${CLI} dev .
98
189
 
99
190
  Options:
100
191
  --dir Project root (defaults to the current directory).
@@ -115,24 +206,49 @@ Options:
115
206
  send it as the Authorization bearer.
116
207
  --allow-anonymous serve: admit all HTTP callers (allowAll). For demos behind a
117
208
  trusted network only; mutually exclusive with --bearer-token.
209
+ --allow-anonymous-cursor-github
210
+ serve: allow --allow-anonymous together with
211
+ githubChannel({ cursorAccount }). Admitted callers can drive
212
+ sessions holding the account's repo-scoped GitHub credential,
213
+ so use only behind a trusted boundary (e.g. an SSO proxy).
118
214
  --public-url serve: base URL where this host is reachable from outside
119
215
  (e.g. https://agent-serve.example.com). Required for peer
120
216
  connections (defineConnection({ agent })) on cloud-runtime
121
217
  turns; local turns always use loopback.
122
218
  --no-schedules Disable the cron runner outside dev mode.
219
+ --team deploy/deployments/deployment/stop/rotate-token and
220
+ chat/resume/run/call/eval/logs/sessions/session/playground
221
+ --prod: Cursor team id. Defaults to the account's team when
222
+ it has one.
223
+ --prod chat/resume/run/call/eval/logs/sessions/session/playground:
224
+ use the team's hosted deployment. Slug from --slug or the
225
+ --dir basename. Mutually exclusive with --url. Requires
226
+ \`${CLI} login\`.
227
+ --once logs: print current progress / log buffer once and exit
228
+ (default is to follow).
229
+ --print playground: print the URL only; do not open a browser.
230
+ --no-wait deploy/stop: return right after the request is accepted
231
+ instead of polling until a terminal status.
123
232
  --no-playground Disable the bundled web playground at /playground (also skips
124
233
  auto-build / HMR).
125
234
  --no-docs Disable the documentation site at /docs (also skips its
126
235
  auto-build).
127
- --url chat/run/eval: base URL of a running agent (skip local host).
128
- --message chat/run: user message (repeatable for run).
236
+ --url chat/resume/run/call/eval/logs/sessions/session/playground:
237
+ base URL of a running agent (skip local host). Mutually
238
+ exclusive with --prod.
239
+ --message chat/resume/run: user message (repeatable for run).
129
240
  --input call: JSON object of tool arguments (default {}).
130
241
  --messages-file JSON array of strings (run).
131
- --session Existing session id for a follow-up turn.
132
- --continuation-token Token from a prior run/chat response.
242
+ --session Existing session id (run/call follow-up, or chat reattach).
243
+ Prefer \`${CLI} resume <sessionId>\` for interactive
244
+ reattach.
245
+ --continuation-token Token from a prior run/chat/resume response (optional
246
+ for resume / chat --session; looked up via /v1/sessions
247
+ when omitted).
133
248
  --events run: write NDJSON trace to this path (default
134
249
  <dir>/.agent-serve/traces/<sessionId>.ndjson).
135
- trajectory: read this file.
250
+ trajectory: read this file. session: print raw
251
+ { sessionId, events } JSON (boolean; no path).
136
252
  --no-events run: do not write a trace file.
137
253
  --slug Agent slug when --dir mounts multiple agents.
138
254
  --timeout-ms Abort a hung turn after N milliseconds.
@@ -140,7 +256,9 @@ Options:
140
256
  --list eval: print discovered cases without running.
141
257
  --verbose eval: stream t.log lines and reply snippets.
142
258
  --no-stream run/eval: silence live progress on stderr (JSON still prints).
143
- --json JSON output (info/chat/eval/github; run defaults to JSON).
259
+ --json JSON output (init/info/chat/eval/logs/sessions/session/
260
+ github; run defaults to JSON). logs: NDJSON progress/log
261
+ events. session: trajectory JSON (not raw events).
144
262
  --no-color chat: force plain output.
145
263
  --cursor-events serve: pull SCM webhook events from /v0/scm-events. The
146
264
  stream is read as your Cursor user, so serve requires
@@ -150,6 +268,20 @@ Options:
150
268
  --repo serve --cursor-events: repo to subscribe to (repeatable).
151
269
  github forward: owner/repo to forward from (inferred from
152
270
  the git remote when omitted; last wins).
271
+ deploy: https git repo URL (optional; inferred from
272
+ git remote origin when omitted).
273
+ --ref deploy: git ref to build (optional; inferred from the
274
+ current branch when omitted).
275
+ --path deploy: agent dir relative to repo root (optional;
276
+ inferred from --dir vs git toplevel when omitted).
277
+ --all deploy: every child agent under a multi-agent --dir
278
+ (skips the interactive picker; mutually exclusive with
279
+ --slug).
280
+ --cursor-events-repo deploy: repo (owner/name) whose SCM events the
281
+ deployed engine pulls (repeatable).
282
+ --allow-domain deploy: egress domain the engine pod may reach
283
+ (repeatable; unioned with hosting.egressDomains from the
284
+ agent manifest). Repo-backed deploys only.
153
285
  --org github forward: organization login (org-level hooks).
154
286
  --channel github: select one channel id when several are declared.
155
287
  --secret github forward: webhook signing secret (defaults to
@@ -165,7 +297,7 @@ Options:
165
297
  `;
166
298
 
167
299
  async function main(argv: string[]): Promise<number> {
168
- const [command, ...rest] = argv;
300
+ const [command, ...restIn] = argv;
169
301
  if (
170
302
  command === undefined ||
171
303
  command === "help" ||
@@ -176,6 +308,13 @@ async function main(argv: string[]): Promise<number> {
176
308
  return command === undefined ? 1 : 0;
177
309
  }
178
310
 
311
+ // `session --events` means "dump raw events" (boolean). Rewrite so it does
312
+ // not collide with run/trajectory's `--events <file.ndjson>` string flag.
313
+ const rest =
314
+ command === "session"
315
+ ? restIn.map((arg) => (arg === "--events" ? "--raw-events" : arg))
316
+ : restIn;
317
+
179
318
  const { values, positionals } = parseArgs({
180
319
  args: rest,
181
320
  allowPositionals: true,
@@ -190,10 +329,12 @@ async function main(argv: string[]): Promise<number> {
190
329
  "state-root": { type: "string" },
191
330
  "bearer-token": { type: "string" },
192
331
  "allow-anonymous": { type: "boolean", default: false },
332
+ "allow-anonymous-cursor-github": { type: "boolean", default: false },
193
333
  "no-schedules": { type: "boolean", default: false },
194
334
  "no-playground": { type: "boolean", default: false },
195
335
  "no-docs": { type: "boolean", default: false },
196
336
  url: { type: "string" },
337
+ prod: { type: "boolean", default: false },
197
338
  message: { type: "string", multiple: true },
198
339
  input: { type: "string" },
199
340
  "messages-file": { type: "string" },
@@ -210,6 +351,8 @@ async function main(argv: string[]): Promise<number> {
210
351
  text: { type: "boolean", default: false },
211
352
  "no-color": { type: "boolean", default: false },
212
353
  "no-stream": { type: "boolean", default: false },
354
+ once: { type: "boolean", default: false },
355
+ "raw-events": { type: "boolean", default: false },
213
356
  json: { type: "boolean", default: false },
214
357
  name: { type: "string" },
215
358
  env: { type: "string" },
@@ -233,6 +376,13 @@ async function main(argv: string[]): Promise<number> {
233
376
  comment: { type: "string" },
234
377
  "dry-run": { type: "boolean", default: false },
235
378
  out: { type: "string" },
379
+ team: { type: "string" },
380
+ "no-wait": { type: "boolean", default: false },
381
+ ref: { type: "string" },
382
+ path: { type: "string" },
383
+ all: { type: "boolean", default: false },
384
+ "cursor-events-repo": { type: "string", multiple: true },
385
+ "allow-domain": { type: "string", multiple: true },
236
386
  },
237
387
  });
238
388
  const dir = values.dir ?? ".";
@@ -296,6 +446,7 @@ async function main(argv: string[]): Promise<number> {
296
446
  return cmdInit({
297
447
  dir,
298
448
  initTarget: positionals[0],
449
+ json: values.json,
299
450
  });
300
451
  }
301
452
 
@@ -317,6 +468,70 @@ async function main(argv: string[]): Promise<number> {
317
468
  return cmdWhoami({ json: values.json });
318
469
  }
319
470
 
471
+ case "deploy": {
472
+ // `--repo` is repeatable for `serve --cursor-events`; deploy targets a
473
+ // single source repo, so the last one wins.
474
+ const repo = values.repo?.at(-1);
475
+ return cmdDeploy({
476
+ ...deployOptionsFromValues(values),
477
+ dir,
478
+ ...(values.slug === undefined ? {} : { slug: values.slug }),
479
+ all: values.all === true,
480
+ ...(repo === undefined ? {} : { repo }),
481
+ ...(values.ref === undefined ? {} : { ref: values.ref }),
482
+ ...(values.path === undefined ? {} : { path: values.path }),
483
+ ...(values["cursor-events-repo"] === undefined
484
+ ? {}
485
+ : { cursorEventsRepos: values["cursor-events-repo"] }),
486
+ ...(values["allow-domain"] === undefined
487
+ ? {}
488
+ : { allowDomains: values["allow-domain"] }),
489
+ });
490
+ }
491
+
492
+ case "deployments": {
493
+ return cmdDeployments(deployOptionsFromValues(values));
494
+ }
495
+
496
+ case "deployment": {
497
+ return cmdDeploymentStatus(
498
+ positionals[0],
499
+ deployOptionsFromValues(values)
500
+ );
501
+ }
502
+
503
+ case "stop": {
504
+ return cmdStop(positionals[0], deployOptionsFromValues(values));
505
+ }
506
+
507
+ case "rotate-token": {
508
+ return cmdRotateToken(positionals[0], deployOptionsFromValues(values));
509
+ }
510
+
511
+ case "rotate-pod-credential": {
512
+ return cmdRotatePodCredential(
513
+ positionals[0],
514
+ deployOptionsFromValues(values)
515
+ );
516
+ }
517
+
518
+ case "secrets": {
519
+ const base = deployOptionsFromValues(values);
520
+ switch (positionals[0]) {
521
+ case "set":
522
+ return cmdSecretsSet(positionals[1], positionals.slice(2), base);
523
+ case "list":
524
+ return cmdSecretsList(positionals[1], base);
525
+ case "unset":
526
+ return cmdSecretsUnset(positionals[1], positionals[2], base);
527
+ default:
528
+ process.stderr.write(
529
+ `Usage: ${CLI} secrets <set|list|unset> <slug> ... [--team <id>] [--json]\n`
530
+ );
531
+ return 1;
532
+ }
533
+ }
534
+
320
535
  case "run": {
321
536
  const messages = await loadMessages(
322
537
  values.message,
@@ -335,6 +550,9 @@ async function main(argv: string[]): Promise<number> {
335
550
  : values.events,
336
551
  text: values.text,
337
552
  url: values.url,
553
+ prod: values.prod,
554
+ team: values.team,
555
+ apiKey: values["api-key"],
338
556
  slug: values.slug,
339
557
  bearerToken: values["bearer-token"],
340
558
  stateRoot: values["state-root"],
@@ -352,6 +570,9 @@ async function main(argv: string[]): Promise<number> {
352
570
  toolInput: values.input,
353
571
  sessionId: values["session-id"] ?? values.session,
354
572
  url: values.url,
573
+ prod: values.prod,
574
+ team: values.team,
575
+ apiKey: values["api-key"],
355
576
  slug: values.slug,
356
577
  bearerToken: values["bearer-token"],
357
578
  stateRoot: values["state-root"],
@@ -383,6 +604,9 @@ async function main(argv: string[]): Promise<number> {
383
604
  json: values.json,
384
605
  tags: values.tag,
385
606
  url: values.url,
607
+ prod: values.prod,
608
+ team: values.team,
609
+ apiKey: values["api-key"],
386
610
  slug: values.slug,
387
611
  bearerToken: values["bearer-token"],
388
612
  stateRoot: values["state-root"],
@@ -393,25 +617,110 @@ async function main(argv: string[]): Promise<number> {
393
617
  }
394
618
 
395
619
  case "chat": {
396
- if (values.json) {
397
- return chatJson({
398
- baseUrl: values.url ?? "http://127.0.0.1:3000",
399
- message: (values.message as string[] | undefined)?.[0],
620
+ return cmdChat(
621
+ axFromOptions({
622
+ dir,
623
+ messages: values.message,
624
+ url: values.url,
625
+ prod: values.prod,
626
+ team: values.team,
627
+ apiKey: values["api-key"],
628
+ slug: values.slug,
629
+ sessionId: values["session-id"] ?? values.session,
630
+ continuationToken: values["continuation-token"],
400
631
  bearerToken: values["bearer-token"],
632
+ json: values.json,
401
633
  text: values.text,
402
- });
403
- }
404
- await runChat({
405
- baseUrl: values.url ?? "http://127.0.0.1:3000",
406
- ...((values.message as string[] | undefined)?.[0] === undefined
407
- ? {}
408
- : { message: (values.message as string[])[0]! }),
409
- ...(values["bearer-token"] === undefined
410
- ? {}
411
- : { bearerToken: values["bearer-token"] }),
412
- ...(values["no-color"] ? { noColor: true } : {}),
413
- });
414
- return 0;
634
+ noColor: values["no-color"],
635
+ })
636
+ );
637
+ }
638
+
639
+ case "resume": {
640
+ return cmdResume(
641
+ positionals[0],
642
+ axFromOptions({
643
+ dir,
644
+ messages: values.message,
645
+ url: values.url,
646
+ prod: values.prod,
647
+ team: values.team,
648
+ apiKey: values["api-key"],
649
+ slug: values.slug,
650
+ // Positional wins; --session is accepted as a redundant alias.
651
+ sessionId: positionals[0] ?? values["session-id"] ?? values.session,
652
+ continuationToken: values["continuation-token"],
653
+ bearerToken: values["bearer-token"],
654
+ json: values.json,
655
+ text: values.text,
656
+ noColor: values["no-color"],
657
+ })
658
+ );
659
+ }
660
+
661
+ case "logs": {
662
+ return cmdLogs(
663
+ axFromOptions({
664
+ dir,
665
+ url: values.url,
666
+ prod: values.prod,
667
+ team: values.team,
668
+ apiKey: values["api-key"],
669
+ slug: values.slug,
670
+ bearerToken: values["bearer-token"],
671
+ json: values.json,
672
+ once: values.once,
673
+ })
674
+ );
675
+ }
676
+
677
+ case "sessions": {
678
+ return cmdSessions(
679
+ axFromOptions({
680
+ dir,
681
+ url: values.url,
682
+ prod: values.prod,
683
+ team: values.team,
684
+ apiKey: values["api-key"],
685
+ slug: values.slug,
686
+ bearerToken: values["bearer-token"],
687
+ json: values.json,
688
+ })
689
+ );
690
+ }
691
+
692
+ case "session": {
693
+ return cmdSession(
694
+ positionals[0],
695
+ axFromOptions({
696
+ dir,
697
+ url: values.url,
698
+ prod: values.prod,
699
+ team: values.team,
700
+ apiKey: values["api-key"],
701
+ slug: values.slug,
702
+ bearerToken: values["bearer-token"],
703
+ json: values.json,
704
+ text: values.text,
705
+ rawEvents: values["raw-events"],
706
+ })
707
+ );
708
+ }
709
+
710
+ case "playground": {
711
+ return cmdPlayground(
712
+ axFromOptions({
713
+ dir,
714
+ url: values.url,
715
+ prod: values.prod,
716
+ team: values.team,
717
+ apiKey: values["api-key"],
718
+ slug: values.slug,
719
+ bearerToken: values["bearer-token"],
720
+ sessionId: values["session-id"] ?? values.session,
721
+ print: values.print,
722
+ })
723
+ );
415
724
  }
416
725
 
417
726
  case "validate": {
@@ -511,6 +820,12 @@ async function main(argv: string[]): Promise<number> {
511
820
  )
512
821
  );
513
822
  lines.push(section("hooks", info.hooks));
823
+ lines.push(
824
+ section("hosting egress domains", info.hosting?.egressDomains ?? [])
825
+ );
826
+ lines.push(
827
+ section("hosting secret names", info.hosting?.secretNames ?? [])
828
+ );
514
829
  if (info.diagnostics.length > 0) {
515
830
  lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
516
831
  }
@@ -520,7 +835,19 @@ async function main(argv: string[]): Promise<number> {
520
835
  return info.diagnostics.some((d) => d.severity === "error") ? 1 : 0;
521
836
  }
522
837
 
838
+ case "dev":
523
839
  case "serve": {
840
+ const serveDirResult = resolveServeDir({
841
+ command,
842
+ dir,
843
+ positionals,
844
+ dirFlagPassed: rest.includes("--dir"),
845
+ });
846
+ if (typeof serveDirResult !== "string") {
847
+ process.stderr.write(serveDirResult.error);
848
+ return 1;
849
+ }
850
+ const serveDir = serveDirResult;
524
851
  const port =
525
852
  values.port === undefined ? 3000 : Number.parseInt(values.port, 10);
526
853
  if (Number.isNaN(port) || port < 0 || port > 65535) {
@@ -543,44 +870,45 @@ async function main(argv: string[]): Promise<number> {
543
870
  );
544
871
  return 1;
545
872
  }
873
+ const dev = command === "dev" || values.dev === true;
874
+ const style = stdoutPalette();
546
875
  const serveOptions = {
547
876
  port,
548
- ...(values.host === undefined ? {} : { host: values.host }),
549
- ...(mode === undefined ? {} : { mode: mode as "single" | "multi" }),
550
- dev: values.dev,
551
- ...(values["api-key"] === undefined
552
- ? {}
553
- : { apiKey: values["api-key"] }),
554
- ...(values["state-root"] === undefined
555
- ? {}
556
- : { stateRoot: values["state-root"] }),
557
- ...(values["bearer-token"] === undefined
558
- ? {}
559
- : { authToken: values["bearer-token"] }),
560
- ...(values["allow-anonymous"] ? { allowAnonymous: true } : {}),
561
- ...(values["no-schedules"] ? { schedules: false } : {}),
562
- ...(values["no-playground"] ? { playground: false } : {}),
563
- ...(values["no-docs"] ? { docs: false } : {}),
564
- ...(values["public-url"] === undefined
565
- ? {}
566
- : { publicUrl: values["public-url"] }),
567
- ...(values["cursor-events"]
568
- ? { cursorEvents: { repos: values.repo ?? [] } }
569
- : {}),
877
+ host: values.host,
878
+ mode: mode as "single" | "multi" | undefined,
879
+ dev,
880
+ apiKey: values["api-key"],
881
+ stateRoot: values["state-root"],
882
+ authToken: values["bearer-token"],
883
+ allowAnonymous: values["allow-anonymous"] === true ? true : undefined,
884
+ allowAnonymousCursorGithub:
885
+ values["allow-anonymous-cursor-github"] === true ? true : undefined,
886
+ schedules: values["no-schedules"] === true ? false : undefined,
887
+ playground: values["no-playground"] === true ? false : undefined,
888
+ docs: values["no-docs"] === true ? false : undefined,
889
+ publicUrl: values["public-url"],
890
+ cursorEvents:
891
+ values["cursor-events"] === true
892
+ ? { repos: values.repo ?? [] }
893
+ : undefined,
894
+ // Soft boot logs (GitHub auth, etc.) stay secondary to the banner.
895
+ logger: (line: string) => {
896
+ process.stdout.write(`${style.dim(line)}\n`);
897
+ },
570
898
  };
571
899
  const enterToRestart = process.stdin.isTTY === true;
572
900
  const bannerOpts = {
573
901
  noPlayground: values["no-playground"] === true,
574
- dev: values.dev === true,
902
+ dev,
575
903
  bearerToken: values["bearer-token"] !== undefined,
576
904
  noSchedules: values["no-schedules"] === true,
577
905
  };
578
906
 
579
907
  const start = async (): Promise<AgentServeHandle> => {
580
- const next = await serve(dir, serveOptions);
908
+ const next = await serve(serveDir, serveOptions);
581
909
  printServeBanner(next, bannerOpts);
582
910
  if (enterToRestart) {
583
- process.stdout.write(" press Enter to restart\n");
911
+ process.stdout.write(style.dim(" press Enter to restart\n"));
584
912
  }
585
913
  return next;
586
914
  };
@@ -613,10 +941,16 @@ async function main(argv: string[]): Promise<number> {
613
941
  return;
614
942
  }
615
943
  restarting = true;
616
- process.stdout.write("\nrestarting…\n");
617
- void handle
618
- .close()
619
- .then(start)
944
+ // Close + re-serve reloads authored agent modules and respawns Vite.
945
+ // Hold the "restarting…" frame briefly so a fast close doesn't look
946
+ // like Enter did nothing.
947
+ clearTerminal();
948
+ process.stdout.write(style.dim("restarting…\n"));
949
+ void Promise.all([handle.close(), sleep(450)])
950
+ .then(() => {
951
+ clearTerminal();
952
+ return start();
953
+ })
620
954
  .then((next) => {
621
955
  handle = next;
622
956
  })
@@ -646,45 +980,53 @@ async function main(argv: string[]): Promise<number> {
646
980
  }
647
981
  }
648
982
 
983
+ function deployOptionsFromValues(values: {
984
+ team?: string;
985
+ json?: boolean;
986
+ "no-wait"?: boolean;
987
+ "api-key"?: string;
988
+ }): DeployCliOptions {
989
+ return {
990
+ ...(values.team === undefined ? {} : { team: values.team }),
991
+ json: values.json === true,
992
+ noWait: values["no-wait"] === true,
993
+ ...(values["api-key"] === undefined ? {} : { apiKey: values["api-key"] }),
994
+ };
995
+ }
996
+
649
997
  function axFromOptions(
650
998
  partial: Partial<AxCliOptions> & { dir: string }
651
999
  ): AxCliOptions {
652
1000
  return {
653
1001
  dir: partial.dir,
654
- ...(partial.cwd === undefined ? {} : { cwd: partial.cwd }),
655
- ...(partial.slug === undefined ? {} : { slug: partial.slug }),
656
- ...(partial.bearerToken === undefined
657
- ? {}
658
- : { bearerToken: partial.bearerToken }),
659
- ...(partial.stateRoot === undefined
660
- ? {}
661
- : { stateRoot: partial.stateRoot }),
662
- ...(partial.messages === undefined ? {} : { messages: partial.messages }),
663
- ...(partial.sessionId === undefined
664
- ? {}
665
- : { sessionId: partial.sessionId }),
666
- ...(partial.continuationToken === undefined
667
- ? {}
668
- : { continuationToken: partial.continuationToken }),
669
- ...(partial.timeoutMs === undefined
670
- ? {}
671
- : { timeoutMs: partial.timeoutMs }),
672
- ...(partial.events === undefined ? {} : { events: partial.events }),
673
- ...(partial.text === undefined ? {} : { text: partial.text }),
674
- ...(partial.json === undefined ? {} : { json: partial.json }),
675
- ...(partial.list === undefined ? {} : { list: partial.list }),
676
- ...(partial.verbose === undefined ? {} : { verbose: partial.verbose }),
677
- ...(partial.tags === undefined ? {} : { tags: partial.tags }),
678
- ...(partial.evalIds === undefined ? {} : { evalIds: partial.evalIds }),
679
- ...(partial.initTarget === undefined
680
- ? {}
681
- : { initTarget: partial.initTarget }),
682
- ...(partial.toolName === undefined ? {} : { toolName: partial.toolName }),
683
- ...(partial.toolInput === undefined
684
- ? {}
685
- : { toolInput: partial.toolInput }),
686
- ...(partial.url === undefined ? {} : { url: partial.url }),
687
- ...(partial.stream === undefined ? {} : { stream: partial.stream }),
1002
+ cwd: partial.cwd,
1003
+ slug: partial.slug,
1004
+ bearerToken: partial.bearerToken,
1005
+ stateRoot: partial.stateRoot,
1006
+ messages: partial.messages,
1007
+ sessionId: partial.sessionId,
1008
+ continuationToken: partial.continuationToken,
1009
+ timeoutMs: partial.timeoutMs,
1010
+ events: partial.events,
1011
+ text: partial.text,
1012
+ json: partial.json,
1013
+ list: partial.list,
1014
+ verbose: partial.verbose,
1015
+ tags: partial.tags,
1016
+ evalIds: partial.evalIds,
1017
+ initTarget: partial.initTarget,
1018
+ toolName: partial.toolName,
1019
+ toolInput: partial.toolInput,
1020
+ url: partial.url,
1021
+ prod: partial.prod,
1022
+ team: partial.team,
1023
+ apiKey: partial.apiKey,
1024
+ fetchImpl: partial.fetchImpl,
1025
+ stream: partial.stream,
1026
+ noColor: partial.noColor,
1027
+ once: partial.once,
1028
+ rawEvents: partial.rawEvents,
1029
+ print: partial.print,
688
1030
  };
689
1031
  }
690
1032
 
@@ -723,42 +1065,6 @@ function parseTimeoutMs(value: string | undefined): number | undefined {
723
1065
  return n;
724
1066
  }
725
1067
 
726
- async function chatJson(args: {
727
- baseUrl: string;
728
- message?: string;
729
- bearerToken?: string;
730
- text?: boolean;
731
- }): Promise<number> {
732
- if (args.message === undefined) {
733
- process.stderr.write("chat --json requires --message\n");
734
- return 2;
735
- }
736
- const result = await runSession({
737
- baseUrl: args.baseUrl,
738
- messages: [args.message],
739
- ...(args.bearerToken === undefined
740
- ? {}
741
- : { bearerToken: args.bearerToken }),
742
- });
743
- if (args.text) {
744
- process.stdout.write(formatTrajectoryText(result.trajectory));
745
- } else {
746
- console.log(
747
- JSON.stringify(
748
- {
749
- ok: result.ok,
750
- sessionId: result.sessionId,
751
- continuationToken: result.continuationToken ?? null,
752
- trajectory: result.trajectory,
753
- },
754
- null,
755
- 2
756
- )
757
- );
758
- }
759
- return result.ok ? 0 : 1;
760
- }
761
-
762
1068
  /**
763
1069
  * Load mounts the same way `serve` does (multi-agent layout by default).
764
1070
  */
@@ -779,6 +1085,42 @@ function isEnterOnly(text: string): boolean {
779
1085
  return text.length > 0 && [...text].every((ch) => ch === "\n" || ch === "\r");
780
1086
  }
781
1087
 
1088
+ function sleep(ms: number): Promise<void> {
1089
+ return new Promise((resolve) => {
1090
+ setTimeout(resolve, ms);
1091
+ });
1092
+ }
1093
+
1094
+ /**
1095
+ * `dev [path]` takes a positional project root; `serve` keeps `--dir` only.
1096
+ * Reject mixing a positional with an explicit `--dir`, and extra args on `dev`.
1097
+ */
1098
+ function resolveServeDir(args: {
1099
+ command: string;
1100
+ dir: string;
1101
+ positionals: string[];
1102
+ dirFlagPassed: boolean;
1103
+ }): string | { error: string } {
1104
+ if (args.command !== "dev") {
1105
+ return args.dir;
1106
+ }
1107
+ if (args.positionals.length > 1) {
1108
+ return {
1109
+ error: `${CLI} dev: unexpected arguments: ${args.positionals.slice(1).join(" ")}\n`,
1110
+ };
1111
+ }
1112
+ const positionalDir = args.positionals[0];
1113
+ if (positionalDir === undefined) {
1114
+ return args.dir;
1115
+ }
1116
+ if (args.dirFlagPassed && args.dir !== positionalDir) {
1117
+ return {
1118
+ error: `${CLI} dev: pass a path as a positional or --dir, not both\n`,
1119
+ };
1120
+ }
1121
+ return positionalDir;
1122
+ }
1123
+
782
1124
  function printServeBanner(
783
1125
  handle: AgentServeHandle,
784
1126
  opts: {
@@ -788,57 +1130,66 @@ function printServeBanner(
788
1130
  noSchedules: boolean;
789
1131
  }
790
1132
  ): void {
791
- const multi = handle.agents.length > 1 || handle.agents[0]?.slug !== "";
792
- if (multi) {
793
- process.stdout.write(
794
- `${handle.agents.length} agents listening on ${handle.url}\n`
795
- );
796
- if (!opts.noPlayground) {
797
- process.stdout.write(` index: ${handle.url}/\n`);
798
- }
799
- for (const agent of handle.agents) {
800
- const info = projectInfo(agent.project);
801
- const suffix = opts.noPlayground
802
- ? `${agent.url}/v1/session`
803
- : `${agent.url}/playground`;
804
- process.stdout.write(` /${agent.slug} ${info.name} — ${suffix}\n`);
805
- }
1133
+ const c = stdoutPalette();
1134
+ const agents = handle.agents;
1135
+ if (agents.length > 1) {
1136
+ process.stdout.write(`${agents.length} agents listening\n`);
806
1137
  } else {
807
- const info = projectInfo(handle.project);
808
- process.stdout.write(`${info.name} listening on ${handle.url}\n`);
809
- if (!opts.noPlayground) {
810
- process.stdout.write(` playground: ${handle.url}/playground\n`);
811
- }
812
- process.stdout.write(` POST ${handle.url}/v1/session\n`);
813
- process.stdout.write(` GET ${handle.url}/v1/session/:sessionId/stream\n`);
814
- for (const channel of info.channels) {
815
- if (channel.id === "http") {
816
- continue;
1138
+ const info = projectInfo(agents[0]?.project ?? handle.project);
1139
+ process.stdout.write(`${info.name} listening\n`);
1140
+ }
1141
+
1142
+ const playgroundUrl = resolvePlaygroundBannerUrl(handle, opts.noPlayground);
1143
+ if (playgroundUrl !== undefined) {
1144
+ process.stdout.write(` playground ${c.cyan(playgroundUrl)}\n`);
1145
+ }
1146
+
1147
+ // Dev is playground-first (Vite proxies the API). Keep API/route detail for
1148
+ // plain `serve`, where operators often curl the HTTP surface directly.
1149
+ if (!opts.dev) {
1150
+ process.stdout.write(c.dim(` api ${handle.url}\n`));
1151
+ if (agents.length > 1 || agents[0]?.slug !== "") {
1152
+ for (const agent of agents) {
1153
+ const info = projectInfo(agent.project);
1154
+ process.stdout.write(c.dim(` /${agent.slug} ${info.name}\n`));
817
1155
  }
818
- for (const route of channel.routes) {
819
- process.stdout.write(` ${route.method} ${handle.url}${route.url}\n`);
1156
+ } else {
1157
+ const info = projectInfo(handle.project);
1158
+ process.stdout.write(c.dim(` POST ${handle.url}/v1/session\n`));
1159
+ process.stdout.write(
1160
+ c.dim(` GET ${handle.url}/v1/session/:sessionId/stream\n`)
1161
+ );
1162
+ for (const channel of info.channels) {
1163
+ if (channel.id === "http") {
1164
+ continue;
1165
+ }
1166
+ for (const route of channel.routes) {
1167
+ process.stdout.write(
1168
+ c.dim(` ${route.method} ${handle.url}${route.url}\n`)
1169
+ );
1170
+ }
820
1171
  }
821
- }
822
- if (info.schedules.length > 0) {
823
- const scheduleMode = opts.dev
824
- ? "dev mode: dispatch with POST /v1/dev/schedules/:scheduleId"
825
- : opts.noSchedules
1172
+ if (info.schedules.length > 0) {
1173
+ const scheduleMode = opts.noSchedules
826
1174
  ? "disabled"
827
1175
  : "running on cron cadence (UTC)";
828
- process.stdout.write(
829
- ` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`
830
- );
1176
+ process.stdout.write(
1177
+ c.dim(
1178
+ ` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`
1179
+ )
1180
+ );
1181
+ }
1182
+ }
1183
+ if (handle.docsUrl !== undefined) {
1184
+ process.stdout.write(c.dim(` docs ${handle.docsUrl}\n`));
831
1185
  }
832
1186
  }
833
- if (handle.playgroundDevUrl !== undefined) {
834
- process.stdout.write(` playground (HMR): ${handle.playgroundDevUrl}\n`);
835
- }
836
- if (handle.docsUrl !== undefined) {
837
- process.stdout.write(` docs: ${handle.docsUrl}\n`);
838
- }
1187
+
839
1188
  if (opts.bearerToken) {
840
1189
  process.stdout.write(
841
- " auth: bearer token required on API routes (playground has a token field)\n"
1190
+ c.dim(
1191
+ " auth: bearer token required on API routes (playground has a token field)\n"
1192
+ )
842
1193
  );
843
1194
  }
844
1195
  if (
@@ -850,11 +1201,33 @@ function printServeBanner(
850
1201
  )
851
1202
  ) {
852
1203
  process.stdout.write(
853
- ` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`
1204
+ c.dim(
1205
+ ` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`
1206
+ )
854
1207
  );
855
1208
  }
856
1209
  }
857
1210
 
1211
+ /** Prefer the Vite playground URL in --dev; otherwise the static SPA path. */
1212
+ function resolvePlaygroundBannerUrl(
1213
+ handle: AgentServeHandle,
1214
+ noPlayground: boolean
1215
+ ): string | undefined {
1216
+ if (noPlayground) {
1217
+ return undefined;
1218
+ }
1219
+ if (handle.playgroundDevUrl !== undefined) {
1220
+ return handle.playgroundDevUrl.replace(/\/$/, "");
1221
+ }
1222
+ if (handle.agents.length === 1) {
1223
+ return `${handle.agents[0]!.url}/playground`;
1224
+ }
1225
+ if (handle.agents.length > 1) {
1226
+ return handle.url;
1227
+ }
1228
+ return undefined;
1229
+ }
1230
+
858
1231
  function formatModel(model: unknown): string {
859
1232
  if (model === undefined) {
860
1233
  return "(unset)";