@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>
@@ -25,11 +27,10 @@ import { resolve } from "node:path";
25
27
  import { parseArgs } from "node:util";
26
28
  import { formatDiagnostics, projectInfo, resolveAgentMounts, serve, } from "../index.js";
27
29
  import { registerAuthoredModuleLoaders } from "../internal/authored-loaders.js";
28
- import { runChat } from "../internal/chat-client.js";
29
- import { cmdCall, cmdEval, cmdInit, cmdRun, cmdTrajectory, } from "../internal/cli-ax.js";
30
+ import { cmdCall, cmdChat, cmdEval, cmdInit, cmdLogs, cmdPlayground, cmdResume, cmdRun, cmdSession, cmdSessions, cmdTrajectory, } from "../internal/cli-ax.js";
31
+ import { cmdDeploy, cmdDeploymentStatus, cmdDeployments, cmdRotatePodCredential, cmdRotateToken, cmdSecretsList, cmdSecretsSet, cmdSecretsUnset, cmdStop, } from "../internal/cli-deploy.js";
30
32
  import { CLI_COMMAND_NAME as CLI } from "../internal/distribution.js";
31
- import { runSession } from "../internal/run-client.js";
32
- import { formatTrajectoryText } from "../internal/trajectory.js";
33
+ import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
33
34
  const HELP = `${CLI} — serve a filesystem-defined Cursor agent over channels
34
35
 
35
36
  Usage:
@@ -37,38 +38,93 @@ Usage:
37
38
  [--mode single|multi] [--api-key <key>] [--no-schedules]
38
39
  [--public-url <url>]
39
40
  [--cursor-events --repo <owner/name>]...
40
- ${CLI} chat [--url <baseUrl>] [--message <text>] [--json] [--text]
41
- ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl>]
41
+ ${CLI} dev [path] [--port <n>] [--host <host>]
42
+ Same flags as serve; implies --dev. Path defaults to
43
+ the current directory (or pass --dir).
44
+ ${CLI} chat [--url <baseUrl> | --prod] [--message <text>] [--json] [--text]
45
+ [--session <id>] [--continuation-token <t>]
46
+ [--slug <slug>] [--team <id>]
47
+ ${CLI} resume <sessionId> [--url <baseUrl> | --prod] [--message <text>]
48
+ [--json] [--text] [--continuation-token <t>]
49
+ [--slug <slug>] [--team <id>]
50
+ ${CLI} logs [--url <baseUrl> | --prod] [--once] [--json]
51
+ [--slug <slug>] [--team <id>] [--dir <path>]
52
+ ${CLI} sessions [--url <baseUrl> | --prod] [--json]
53
+ [--slug <slug>] [--team <id>] [--dir <path>]
54
+ ${CLI} session <sessionId> [--url <baseUrl> | --prod]
55
+ [--json | --text | --events]
56
+ [--slug <slug>] [--team <id>] [--dir <path>]
57
+ ${CLI} playground [--url <baseUrl> | --prod] [--session <id>] [--print]
58
+ [--slug <slug>] [--team <id>] [--dir <path>]
59
+ ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl> | --prod]
42
60
  [--session <id>] [--continuation-token <t>]
43
61
  [--events <file.ndjson>] [--no-events] [--text]
44
- [--timeout-ms <n>] [--no-stream]
62
+ [--timeout-ms <n>] [--no-stream] [--slug <slug>] [--team <id>]
45
63
  ${CLI} trajectory --events <file.ndjson> [--text]
46
- ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl>]
47
- [--session <id>] [--slug <slug>]
48
- ${CLI} init [dir]
64
+ ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
65
+ [--session <id>] [--slug <slug>] [--team <id>]
66
+ ${CLI} init [dir] [--json]
49
67
  ${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
50
68
  [--tag <tag>]... [--verbose] [--timeout-ms <n>]
51
- [--no-stream]
69
+ [--no-stream] [--url <baseUrl> | --prod] [--slug <slug>]
70
+ [--team <id>]
52
71
  ${CLI} info [--dir <path>] [--json]
53
72
  ${CLI} validate [--dir <path>]
54
73
  ${CLI} login [--api-key <key>] [--key-name <name>]
55
74
  ${CLI} logout
56
75
  ${CLI} whoami [--json]
76
+ ${CLI} deploy [--dir <path>] [--slug <slug> | --all] [--team <id>] [--json]
77
+ [--no-wait] [--repo <url>] [--ref <ref>]
78
+ [--path <agentPath>] [--cursor-events-repo <owner/name>]...
79
+ [--allow-domain <domain>]...
80
+ ${CLI} deployments [--team <id>] [--json]
81
+ ${CLI} deployment <slug> [--team <id>] [--json]
82
+ ${CLI} stop <slug> [--team <id>] [--json] [--no-wait]
83
+ ${CLI} rotate-token <slug> [--team <id>]
84
+ ${CLI} rotate-pod-credential <slug> [--team <id>]
85
+ ${CLI} secrets set <slug> NAME[=VALUE]... | list <slug> | unset <slug> NAME
86
+ [--team <id>] [--json]
57
87
  ${CLI} slack <subcommand> …
58
88
  ${CLI} github <subcommand> …
59
89
 
60
90
  Commands:
61
91
  serve Serve agents under /<slug>/... (index at /). On a TTY, press
62
92
  Enter to restart (reloads agent code + Vite HMR child).
63
- chat Talk to a running server (streams the reply). --json prints a trajectory.
93
+ dev Local development: same as \`${CLI} serve --dev\` (manual
94
+ schedule/reminder dispatch, unsigned GitHub loopback, Vite HMR).
95
+ chat Interactive REPL against a running server (follow-ups keep the
96
+ session + continuation token). Optional --message seeds the first
97
+ turn then stays open on a TTY. --session reattaches (looks up the
98
+ continuation token via /v1/sessions when omitted) and replays the
99
+ transcript. --json is one-shot. Pass --prod to hit the team's
100
+ hosted deployment (slug from --slug or the directory name).
101
+ resume Reattach chat to an existing session id (same as
102
+ \`${CLI} chat --session <id>\`). Looks up the continuation token
103
+ via /v1/sessions when --continuation-token is omitted, then
104
+ replays the transcript. Pass --prod for a hosted deployment.
105
+ logs Tail agent logs. Default follows (Ctrl-C to stop); --once dumps
106
+ the current buffer. --prod shows deploy progress until the
107
+ hosted deployment is running, then tails runtime logs. Without
108
+ --prod, tails the local server (or --url).
109
+ sessions List sessions on a running agent (or --prod hosted deployment).
110
+ session Show one session. Default: text trajectory. --json for trajectory
111
+ JSON; --events for the raw event list. To continue interactively,
112
+ use \`${CLI} resume <id>\`.
113
+ playground Open the web playground. --prod starts a loopback proxy that
114
+ injects hosted engine credentials (browsers cannot set them).
115
+ --print skips opening a browser. Ctrl-C stops the proxy.
64
116
  run One-shot create→test loop: ephemeral server + JSON trajectory.
65
117
  Writes a single events.ndjson trace (visualize in the playground).
66
118
  Streams tool calls and reply text to stderr when stderr is a TTY.
119
+ Pass --prod to hit the hosted deployment instead of a local server.
67
120
  trajectory Summarize an events.ndjson file into a trajectory.
68
121
  call Call an authored server tool deterministically (no model turn)
69
122
  via POST /v1/tools/:toolName. --session runs it inside an
70
123
  existing session and records it on that session's event stream.
71
- init Scaffold a project, or print the coding-agent setup guide (no args).
124
+ init Scaffold a project (skipping existing files), npm install,
125
+ run login when unsigned, then print next steps. --json is
126
+ machine-readable and never blocks on login. No directory:
127
+ print the setup guide.
72
128
  eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
73
129
  Pass evalId args to select: one datapoint (weather/nyc), a whole
74
130
  file (weather → all cases in that file), several of either, or
@@ -80,6 +136,23 @@ Commands:
80
136
  inference, cloud runtime, and cursorAccount MCP connections.
81
137
  logout Remove the stored Cursor credentials.
82
138
  whoami Show which Cursor account powers this host (and why).
139
+ deploy Deploy onto Cursor's managed agent-serve hosting, then wait for
140
+ the engine to come up. --repo/--ref/--path stay available;
141
+ inside an agent git checkout they are inferred when omitted
142
+ (flags always win). When --dir is a multi-agent parent,
143
+ pick one interactively, or pass --slug / --all. First deploy
144
+ of a slug prints the alias token exactly once — save it.
145
+ deployments List the team's deployments (slug, status, generation, kind).
146
+ deployment Show one deployment in full (status, lastError, engine info).
147
+ stop Stop a deployment and wait until it reports stopped.
148
+ rotate-token Mint a new alias token for a deployment (shown once); the old
149
+ token stops working immediately.
150
+ rotate-pod-credential
151
+ Rotate a deployment's pod credential (prints the masked key);
152
+ the running pod keeps the old one until the next deploy.
153
+ secrets Manage deployment secrets: set (upsert by name; NAMEs without
154
+ =VALUE are prompted for with hidden input, or read from piped
155
+ stdin), list (names + createdAt; never values), unset.
83
156
  slack Slack channel pack: init, manifests, doctor (see slack help).
84
157
  github GitHub webhook pack: forward live deliveries, events, doctor
85
158
  (wraps \`gh webhook forward\`; see github help).
@@ -89,6 +162,7 @@ Agent loop:
89
162
  ${CLI} info --dir . --json
90
163
  ${CLI} run --dir . --message "..."
91
164
  ${CLI} eval --dir .
165
+ ${CLI} dev .
92
166
 
93
167
  Options:
94
168
  --dir Project root (defaults to the current directory).
@@ -109,24 +183,49 @@ Options:
109
183
  send it as the Authorization bearer.
110
184
  --allow-anonymous serve: admit all HTTP callers (allowAll). For demos behind a
111
185
  trusted network only; mutually exclusive with --bearer-token.
186
+ --allow-anonymous-cursor-github
187
+ serve: allow --allow-anonymous together with
188
+ githubChannel({ cursorAccount }). Admitted callers can drive
189
+ sessions holding the account's repo-scoped GitHub credential,
190
+ so use only behind a trusted boundary (e.g. an SSO proxy).
112
191
  --public-url serve: base URL where this host is reachable from outside
113
192
  (e.g. https://agent-serve.example.com). Required for peer
114
193
  connections (defineConnection({ agent })) on cloud-runtime
115
194
  turns; local turns always use loopback.
116
195
  --no-schedules Disable the cron runner outside dev mode.
196
+ --team deploy/deployments/deployment/stop/rotate-token and
197
+ chat/resume/run/call/eval/logs/sessions/session/playground
198
+ --prod: Cursor team id. Defaults to the account's team when
199
+ it has one.
200
+ --prod chat/resume/run/call/eval/logs/sessions/session/playground:
201
+ use the team's hosted deployment. Slug from --slug or the
202
+ --dir basename. Mutually exclusive with --url. Requires
203
+ \`${CLI} login\`.
204
+ --once logs: print current progress / log buffer once and exit
205
+ (default is to follow).
206
+ --print playground: print the URL only; do not open a browser.
207
+ --no-wait deploy/stop: return right after the request is accepted
208
+ instead of polling until a terminal status.
117
209
  --no-playground Disable the bundled web playground at /playground (also skips
118
210
  auto-build / HMR).
119
211
  --no-docs Disable the documentation site at /docs (also skips its
120
212
  auto-build).
121
- --url chat/run/eval: base URL of a running agent (skip local host).
122
- --message chat/run: user message (repeatable for run).
213
+ --url chat/resume/run/call/eval/logs/sessions/session/playground:
214
+ base URL of a running agent (skip local host). Mutually
215
+ exclusive with --prod.
216
+ --message chat/resume/run: user message (repeatable for run).
123
217
  --input call: JSON object of tool arguments (default {}).
124
218
  --messages-file JSON array of strings (run).
125
- --session Existing session id for a follow-up turn.
126
- --continuation-token Token from a prior run/chat response.
219
+ --session Existing session id (run/call follow-up, or chat reattach).
220
+ Prefer \`${CLI} resume <sessionId>\` for interactive
221
+ reattach.
222
+ --continuation-token Token from a prior run/chat/resume response (optional
223
+ for resume / chat --session; looked up via /v1/sessions
224
+ when omitted).
127
225
  --events run: write NDJSON trace to this path (default
128
226
  <dir>/.agent-serve/traces/<sessionId>.ndjson).
129
- trajectory: read this file.
227
+ trajectory: read this file. session: print raw
228
+ { sessionId, events } JSON (boolean; no path).
130
229
  --no-events run: do not write a trace file.
131
230
  --slug Agent slug when --dir mounts multiple agents.
132
231
  --timeout-ms Abort a hung turn after N milliseconds.
@@ -134,7 +233,9 @@ Options:
134
233
  --list eval: print discovered cases without running.
135
234
  --verbose eval: stream t.log lines and reply snippets.
136
235
  --no-stream run/eval: silence live progress on stderr (JSON still prints).
137
- --json JSON output (info/chat/eval/github; run defaults to JSON).
236
+ --json JSON output (init/info/chat/eval/logs/sessions/session/
237
+ github; run defaults to JSON). logs: NDJSON progress/log
238
+ events. session: trajectory JSON (not raw events).
138
239
  --no-color chat: force plain output.
139
240
  --cursor-events serve: pull SCM webhook events from /v0/scm-events. The
140
241
  stream is read as your Cursor user, so serve requires
@@ -144,6 +245,20 @@ Options:
144
245
  --repo serve --cursor-events: repo to subscribe to (repeatable).
145
246
  github forward: owner/repo to forward from (inferred from
146
247
  the git remote when omitted; last wins).
248
+ deploy: https git repo URL (optional; inferred from
249
+ git remote origin when omitted).
250
+ --ref deploy: git ref to build (optional; inferred from the
251
+ current branch when omitted).
252
+ --path deploy: agent dir relative to repo root (optional;
253
+ inferred from --dir vs git toplevel when omitted).
254
+ --all deploy: every child agent under a multi-agent --dir
255
+ (skips the interactive picker; mutually exclusive with
256
+ --slug).
257
+ --cursor-events-repo deploy: repo (owner/name) whose SCM events the
258
+ deployed engine pulls (repeatable).
259
+ --allow-domain deploy: egress domain the engine pod may reach
260
+ (repeatable; unioned with hosting.egressDomains from the
261
+ agent manifest). Repo-backed deploys only.
147
262
  --org github forward: organization login (org-level hooks).
148
263
  --channel github: select one channel id when several are declared.
149
264
  --secret github forward: webhook signing secret (defaults to
@@ -159,9 +274,9 @@ Options:
159
274
  `;
160
275
  function main(argv) {
161
276
  return __awaiter(this, void 0, void 0, function* () {
162
- var _a, _b, _c, _d, _e, _f;
163
- var _g, _h, _j, _k, _l, _m;
164
- const [command, ...rest] = argv;
277
+ var _a, _b, _c, _d, _e, _f, _g;
278
+ var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
279
+ const [command, ...restIn] = argv;
165
280
  if (command === undefined ||
166
281
  command === "help" ||
167
282
  command === "--help" ||
@@ -169,6 +284,11 @@ function main(argv) {
169
284
  process.stdout.write(HELP);
170
285
  return command === undefined ? 1 : 0;
171
286
  }
287
+ // `session --events` means "dump raw events" (boolean). Rewrite so it does
288
+ // not collide with run/trajectory's `--events <file.ndjson>` string flag.
289
+ const rest = command === "session"
290
+ ? restIn.map((arg) => (arg === "--events" ? "--raw-events" : arg))
291
+ : restIn;
172
292
  const { values, positionals } = parseArgs({
173
293
  args: rest,
174
294
  allowPositionals: true,
@@ -183,10 +303,12 @@ function main(argv) {
183
303
  "state-root": { type: "string" },
184
304
  "bearer-token": { type: "string" },
185
305
  "allow-anonymous": { type: "boolean", default: false },
306
+ "allow-anonymous-cursor-github": { type: "boolean", default: false },
186
307
  "no-schedules": { type: "boolean", default: false },
187
308
  "no-playground": { type: "boolean", default: false },
188
309
  "no-docs": { type: "boolean", default: false },
189
310
  url: { type: "string" },
311
+ prod: { type: "boolean", default: false },
190
312
  message: { type: "string", multiple: true },
191
313
  input: { type: "string" },
192
314
  "messages-file": { type: "string" },
@@ -203,6 +325,8 @@ function main(argv) {
203
325
  text: { type: "boolean", default: false },
204
326
  "no-color": { type: "boolean", default: false },
205
327
  "no-stream": { type: "boolean", default: false },
328
+ once: { type: "boolean", default: false },
329
+ "raw-events": { type: "boolean", default: false },
206
330
  json: { type: "boolean", default: false },
207
331
  name: { type: "string" },
208
332
  env: { type: "string" },
@@ -226,9 +350,16 @@ function main(argv) {
226
350
  comment: { type: "string" },
227
351
  "dry-run": { type: "boolean", default: false },
228
352
  out: { type: "string" },
353
+ team: { type: "string" },
354
+ "no-wait": { type: "boolean", default: false },
355
+ ref: { type: "string" },
356
+ path: { type: "string" },
357
+ all: { type: "boolean", default: false },
358
+ "cursor-events-repo": { type: "string", multiple: true },
359
+ "allow-domain": { type: "string", multiple: true },
229
360
  },
230
361
  });
231
- const dir = (_g = values.dir) !== null && _g !== void 0 ? _g : ".";
362
+ const dir = (_h = values.dir) !== null && _h !== void 0 ? _h : ".";
232
363
  switch (command) {
233
364
  case "slack": {
234
365
  const { cmdSlack } = yield import("../internal/cli-slack.js");
@@ -284,6 +415,7 @@ function main(argv) {
284
415
  return cmdInit({
285
416
  dir,
286
417
  initTarget: positionals[0],
418
+ json: values.json,
287
419
  });
288
420
  }
289
421
  case "login": {
@@ -301,12 +433,51 @@ function main(argv) {
301
433
  const { cmdWhoami } = yield import("../internal/cli-cursor.js");
302
434
  return cmdWhoami({ json: values.json });
303
435
  }
436
+ case "deploy": {
437
+ // `--repo` is repeatable for `serve --cursor-events`; deploy targets a
438
+ // single source repo, so the last one wins.
439
+ const repo = (_b = values.repo) === null || _b === void 0 ? void 0 : _b.at(-1);
440
+ return cmdDeploy(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, deployOptionsFromValues(values)), { dir }), (values.slug === undefined ? {} : { slug: values.slug })), { all: values.all === true }), (repo === undefined ? {} : { repo })), (values.ref === undefined ? {} : { ref: values.ref })), (values.path === undefined ? {} : { path: values.path })), (values["cursor-events-repo"] === undefined
441
+ ? {}
442
+ : { cursorEventsRepos: values["cursor-events-repo"] })), (values["allow-domain"] === undefined
443
+ ? {}
444
+ : { allowDomains: values["allow-domain"] })));
445
+ }
446
+ case "deployments": {
447
+ return cmdDeployments(deployOptionsFromValues(values));
448
+ }
449
+ case "deployment": {
450
+ return cmdDeploymentStatus(positionals[0], deployOptionsFromValues(values));
451
+ }
452
+ case "stop": {
453
+ return cmdStop(positionals[0], deployOptionsFromValues(values));
454
+ }
455
+ case "rotate-token": {
456
+ return cmdRotateToken(positionals[0], deployOptionsFromValues(values));
457
+ }
458
+ case "rotate-pod-credential": {
459
+ return cmdRotatePodCredential(positionals[0], deployOptionsFromValues(values));
460
+ }
461
+ case "secrets": {
462
+ const base = deployOptionsFromValues(values);
463
+ switch (positionals[0]) {
464
+ case "set":
465
+ return cmdSecretsSet(positionals[1], positionals.slice(2), base);
466
+ case "list":
467
+ return cmdSecretsList(positionals[1], base);
468
+ case "unset":
469
+ return cmdSecretsUnset(positionals[1], positionals[2], base);
470
+ default:
471
+ process.stderr.write(`Usage: ${CLI} secrets <set|list|unset> <slug> ... [--team <id>] [--json]\n`);
472
+ return 1;
473
+ }
474
+ }
304
475
  case "run": {
305
476
  const messages = yield loadMessages(values.message, values["messages-file"]);
306
477
  return cmdRun(axFromOptions({
307
478
  dir,
308
479
  messages,
309
- sessionId: (_h = values["session-id"]) !== null && _h !== void 0 ? _h : values.session,
480
+ sessionId: (_j = values["session-id"]) !== null && _j !== void 0 ? _j : values.session,
310
481
  continuationToken: values["continuation-token"],
311
482
  events: values["no-events"]
312
483
  ? false
@@ -315,6 +486,9 @@ function main(argv) {
315
486
  : values.events,
316
487
  text: values.text,
317
488
  url: values.url,
489
+ prod: values.prod,
490
+ team: values.team,
491
+ apiKey: values["api-key"],
318
492
  slug: values.slug,
319
493
  bearerToken: values["bearer-token"],
320
494
  stateRoot: values["state-root"],
@@ -327,8 +501,11 @@ function main(argv) {
327
501
  dir,
328
502
  toolName: positionals[0],
329
503
  toolInput: values.input,
330
- sessionId: (_j = values["session-id"]) !== null && _j !== void 0 ? _j : values.session,
504
+ sessionId: (_k = values["session-id"]) !== null && _k !== void 0 ? _k : values.session,
331
505
  url: values.url,
506
+ prod: values.prod,
507
+ team: values.team,
508
+ apiKey: values["api-key"],
332
509
  slug: values.slug,
333
510
  bearerToken: values["bearer-token"],
334
511
  stateRoot: values["state-root"],
@@ -354,6 +531,9 @@ function main(argv) {
354
531
  json: values.json,
355
532
  tags: values.tag,
356
533
  url: values.url,
534
+ prod: values.prod,
535
+ team: values.team,
536
+ apiKey: values["api-key"],
357
537
  slug: values.slug,
358
538
  bearerToken: values["bearer-token"],
359
539
  stateRoot: values["state-root"],
@@ -362,20 +542,91 @@ function main(argv) {
362
542
  }));
363
543
  }
364
544
  case "chat": {
365
- if (values.json) {
366
- return chatJson({
367
- baseUrl: (_k = values.url) !== null && _k !== void 0 ? _k : "http://127.0.0.1:3000",
368
- message: (_b = values.message) === null || _b === void 0 ? void 0 : _b[0],
369
- bearerToken: values["bearer-token"],
370
- text: values.text,
371
- });
372
- }
373
- yield runChat(Object.assign(Object.assign(Object.assign({ baseUrl: (_l = values.url) !== null && _l !== void 0 ? _l : "http://127.0.0.1:3000" }, (((_c = values.message) === null || _c === void 0 ? void 0 : _c[0]) === undefined
374
- ? {}
375
- : { message: values.message[0] })), (values["bearer-token"] === undefined
376
- ? {}
377
- : { bearerToken: values["bearer-token"] })), (values["no-color"] ? { noColor: true } : {})));
378
- return 0;
545
+ return cmdChat(axFromOptions({
546
+ dir,
547
+ messages: values.message,
548
+ url: values.url,
549
+ prod: values.prod,
550
+ team: values.team,
551
+ apiKey: values["api-key"],
552
+ slug: values.slug,
553
+ sessionId: (_l = values["session-id"]) !== null && _l !== void 0 ? _l : values.session,
554
+ continuationToken: values["continuation-token"],
555
+ bearerToken: values["bearer-token"],
556
+ json: values.json,
557
+ text: values.text,
558
+ noColor: values["no-color"],
559
+ }));
560
+ }
561
+ case "resume": {
562
+ return cmdResume(positionals[0], axFromOptions({
563
+ dir,
564
+ messages: values.message,
565
+ url: values.url,
566
+ prod: values.prod,
567
+ team: values.team,
568
+ apiKey: values["api-key"],
569
+ slug: values.slug,
570
+ // Positional wins; --session is accepted as a redundant alias.
571
+ sessionId: (_o = (_m = positionals[0]) !== null && _m !== void 0 ? _m : values["session-id"]) !== null && _o !== void 0 ? _o : values.session,
572
+ continuationToken: values["continuation-token"],
573
+ bearerToken: values["bearer-token"],
574
+ json: values.json,
575
+ text: values.text,
576
+ noColor: values["no-color"],
577
+ }));
578
+ }
579
+ case "logs": {
580
+ return cmdLogs(axFromOptions({
581
+ dir,
582
+ url: values.url,
583
+ prod: values.prod,
584
+ team: values.team,
585
+ apiKey: values["api-key"],
586
+ slug: values.slug,
587
+ bearerToken: values["bearer-token"],
588
+ json: values.json,
589
+ once: values.once,
590
+ }));
591
+ }
592
+ case "sessions": {
593
+ return cmdSessions(axFromOptions({
594
+ dir,
595
+ url: values.url,
596
+ prod: values.prod,
597
+ team: values.team,
598
+ apiKey: values["api-key"],
599
+ slug: values.slug,
600
+ bearerToken: values["bearer-token"],
601
+ json: values.json,
602
+ }));
603
+ }
604
+ case "session": {
605
+ return cmdSession(positionals[0], axFromOptions({
606
+ dir,
607
+ url: values.url,
608
+ prod: values.prod,
609
+ team: values.team,
610
+ apiKey: values["api-key"],
611
+ slug: values.slug,
612
+ bearerToken: values["bearer-token"],
613
+ json: values.json,
614
+ text: values.text,
615
+ rawEvents: values["raw-events"],
616
+ }));
617
+ }
618
+ case "playground": {
619
+ return cmdPlayground(axFromOptions({
620
+ dir,
621
+ url: values.url,
622
+ prod: values.prod,
623
+ team: values.team,
624
+ apiKey: values["api-key"],
625
+ slug: values.slug,
626
+ bearerToken: values["bearer-token"],
627
+ sessionId: (_p = values["session-id"]) !== null && _p !== void 0 ? _p : values.session,
628
+ print: values.print,
629
+ }));
379
630
  }
380
631
  case "validate": {
381
632
  const mounts = yield loadMounts(dir);
@@ -394,7 +645,7 @@ function main(argv) {
394
645
  case "info": {
395
646
  const mounts = yield loadMounts(dir);
396
647
  if (values.json) {
397
- const payload = mounts.length === 1 && ((_d = mounts[0]) === null || _d === void 0 ? void 0 : _d.slug) === ""
648
+ const payload = mounts.length === 1 && ((_c = mounts[0]) === null || _c === void 0 ? void 0 : _c.slug) === ""
398
649
  ? projectInfo(mounts[0].project)
399
650
  : {
400
651
  agents: mounts.map(({ slug, project }) => (Object.assign({ slug }, projectInfo(project)))),
@@ -402,7 +653,7 @@ function main(argv) {
402
653
  process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
403
654
  return 0;
404
655
  }
405
- if (mounts.length > 1 || ((_e = mounts[0]) === null || _e === void 0 ? void 0 : _e.slug) !== "") {
656
+ if (mounts.length > 1 || ((_d = mounts[0]) === null || _d === void 0 ? void 0 : _d.slug) !== "") {
406
657
  process.stdout.write(`${mounts.length} agents under ${dir}:\n\n`);
407
658
  for (const { slug, project } of mounts) {
408
659
  const info = projectInfo(project);
@@ -411,7 +662,7 @@ function main(argv) {
411
662
  const anyError = mounts.some((m) => m.project.diagnostics.some((d) => d.severity === "error"));
412
663
  return anyError ? 1 : 0;
413
664
  }
414
- const project = (_f = mounts[0]) === null || _f === void 0 ? void 0 : _f.project;
665
+ const project = (_e = mounts[0]) === null || _e === void 0 ? void 0 : _e.project;
415
666
  const info = projectInfo(project);
416
667
  const lines = [];
417
668
  lines.push(`agent: ${info.name}`);
@@ -428,13 +679,27 @@ function main(argv) {
428
679
  "(events only)"}`)));
429
680
  lines.push(section("schedules", info.schedules.map((s) => `${s.name} (${s.cron}, ${s.kind})`)));
430
681
  lines.push(section("hooks", info.hooks));
682
+ lines.push(section("hosting egress domains", (_q = (_f = info.hosting) === null || _f === void 0 ? void 0 : _f.egressDomains) !== null && _q !== void 0 ? _q : []));
683
+ lines.push(section("hosting secret names", (_r = (_g = info.hosting) === null || _g === void 0 ? void 0 : _g.secretNames) !== null && _r !== void 0 ? _r : []));
431
684
  if (info.diagnostics.length > 0) {
432
685
  lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
433
686
  }
434
687
  process.stdout.write(`${lines.filter((line) => line !== "").join("\n")}\n`);
435
688
  return info.diagnostics.some((d) => d.severity === "error") ? 1 : 0;
436
689
  }
690
+ case "dev":
437
691
  case "serve": {
692
+ const serveDirResult = resolveServeDir({
693
+ command,
694
+ dir,
695
+ positionals,
696
+ dirFlagPassed: rest.includes("--dir"),
697
+ });
698
+ if (typeof serveDirResult !== "string") {
699
+ process.stderr.write(serveDirResult.error);
700
+ return 1;
701
+ }
702
+ const serveDir = serveDirResult;
438
703
  const port = values.port === undefined ? 3000 : Number.parseInt(values.port, 10);
439
704
  if (Number.isNaN(port) || port < 0 || port > 65535) {
440
705
  process.stderr.write(`invalid --port: ${values.port}\n`);
@@ -450,29 +715,42 @@ function main(argv) {
450
715
  process.stderr.write(`invalid --mode: ${mode} (expected "single" or "multi")\n`);
451
716
  return 1;
452
717
  }
453
- const serveOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ port }, (values.host === undefined ? {} : { host: values.host })), (mode === undefined ? {} : { mode: mode })), { dev: values.dev }), (values["api-key"] === undefined
454
- ? {}
455
- : { apiKey: values["api-key"] })), (values["state-root"] === undefined
456
- ? {}
457
- : { stateRoot: values["state-root"] })), (values["bearer-token"] === undefined
458
- ? {}
459
- : { authToken: values["bearer-token"] })), (values["allow-anonymous"] ? { allowAnonymous: true } : {})), (values["no-schedules"] ? { schedules: false } : {})), (values["no-playground"] ? { playground: false } : {})), (values["no-docs"] ? { docs: false } : {})), (values["public-url"] === undefined
460
- ? {}
461
- : { publicUrl: values["public-url"] })), (values["cursor-events"]
462
- ? { cursorEvents: { repos: (_m = values.repo) !== null && _m !== void 0 ? _m : [] } }
463
- : {}));
718
+ const dev = command === "dev" || values.dev === true;
719
+ const style = stdoutPalette();
720
+ const serveOptions = {
721
+ port,
722
+ host: values.host,
723
+ mode: mode,
724
+ dev,
725
+ apiKey: values["api-key"],
726
+ stateRoot: values["state-root"],
727
+ authToken: values["bearer-token"],
728
+ allowAnonymous: values["allow-anonymous"] === true ? true : undefined,
729
+ allowAnonymousCursorGithub: values["allow-anonymous-cursor-github"] === true ? true : undefined,
730
+ schedules: values["no-schedules"] === true ? false : undefined,
731
+ playground: values["no-playground"] === true ? false : undefined,
732
+ docs: values["no-docs"] === true ? false : undefined,
733
+ publicUrl: values["public-url"],
734
+ cursorEvents: values["cursor-events"] === true
735
+ ? { repos: (_s = values.repo) !== null && _s !== void 0 ? _s : [] }
736
+ : undefined,
737
+ // Soft boot logs (GitHub auth, etc.) stay secondary to the banner.
738
+ logger: (line) => {
739
+ process.stdout.write(`${style.dim(line)}\n`);
740
+ },
741
+ };
464
742
  const enterToRestart = process.stdin.isTTY === true;
465
743
  const bannerOpts = {
466
744
  noPlayground: values["no-playground"] === true,
467
- dev: values.dev === true,
745
+ dev,
468
746
  bearerToken: values["bearer-token"] !== undefined,
469
747
  noSchedules: values["no-schedules"] === true,
470
748
  };
471
749
  const start = () => __awaiter(this, void 0, void 0, function* () {
472
- const next = yield serve(dir, serveOptions);
750
+ const next = yield serve(serveDir, serveOptions);
473
751
  printServeBanner(next, bannerOpts);
474
752
  if (enterToRestart) {
475
- process.stdout.write(" press Enter to restart\n");
753
+ process.stdout.write(style.dim(" press Enter to restart\n"));
476
754
  }
477
755
  return next;
478
756
  });
@@ -500,10 +778,16 @@ function main(argv) {
500
778
  return;
501
779
  }
502
780
  restarting = true;
503
- process.stdout.write("\nrestarting…\n");
504
- void handle
505
- .close()
506
- .then(start)
781
+ // Close + re-serve reloads authored agent modules and respawns Vite.
782
+ // Hold the "restarting…" frame briefly so a fast close doesn't look
783
+ // like Enter did nothing.
784
+ clearTerminal();
785
+ process.stdout.write(style.dim("restarting…\n"));
786
+ void Promise.all([handle.close(), sleep(450)])
787
+ .then(() => {
788
+ clearTerminal();
789
+ return start();
790
+ })
507
791
  .then((next) => {
508
792
  handle = next;
509
793
  })
@@ -529,22 +813,41 @@ function main(argv) {
529
813
  }
530
814
  });
531
815
  }
816
+ function deployOptionsFromValues(values) {
817
+ return Object.assign(Object.assign(Object.assign({}, (values.team === undefined ? {} : { team: values.team })), { json: values.json === true, noWait: values["no-wait"] === true }), (values["api-key"] === undefined ? {} : { apiKey: values["api-key"] }));
818
+ }
532
819
  function axFromOptions(partial) {
533
- return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ dir: partial.dir }, (partial.cwd === undefined ? {} : { cwd: partial.cwd })), (partial.slug === undefined ? {} : { slug: partial.slug })), (partial.bearerToken === undefined
534
- ? {}
535
- : { bearerToken: partial.bearerToken })), (partial.stateRoot === undefined
536
- ? {}
537
- : { stateRoot: partial.stateRoot })), (partial.messages === undefined ? {} : { messages: partial.messages })), (partial.sessionId === undefined
538
- ? {}
539
- : { sessionId: partial.sessionId })), (partial.continuationToken === undefined
540
- ? {}
541
- : { continuationToken: partial.continuationToken })), (partial.timeoutMs === undefined
542
- ? {}
543
- : { timeoutMs: partial.timeoutMs })), (partial.events === undefined ? {} : { events: partial.events })), (partial.text === undefined ? {} : { text: partial.text })), (partial.json === undefined ? {} : { json: partial.json })), (partial.list === undefined ? {} : { list: partial.list })), (partial.verbose === undefined ? {} : { verbose: partial.verbose })), (partial.tags === undefined ? {} : { tags: partial.tags })), (partial.evalIds === undefined ? {} : { evalIds: partial.evalIds })), (partial.initTarget === undefined
544
- ? {}
545
- : { initTarget: partial.initTarget })), (partial.toolName === undefined ? {} : { toolName: partial.toolName })), (partial.toolInput === undefined
546
- ? {}
547
- : { toolInput: partial.toolInput })), (partial.url === undefined ? {} : { url: partial.url })), (partial.stream === undefined ? {} : { stream: partial.stream }));
820
+ return {
821
+ dir: partial.dir,
822
+ cwd: partial.cwd,
823
+ slug: partial.slug,
824
+ bearerToken: partial.bearerToken,
825
+ stateRoot: partial.stateRoot,
826
+ messages: partial.messages,
827
+ sessionId: partial.sessionId,
828
+ continuationToken: partial.continuationToken,
829
+ timeoutMs: partial.timeoutMs,
830
+ events: partial.events,
831
+ text: partial.text,
832
+ json: partial.json,
833
+ list: partial.list,
834
+ verbose: partial.verbose,
835
+ tags: partial.tags,
836
+ evalIds: partial.evalIds,
837
+ initTarget: partial.initTarget,
838
+ toolName: partial.toolName,
839
+ toolInput: partial.toolInput,
840
+ url: partial.url,
841
+ prod: partial.prod,
842
+ team: partial.team,
843
+ apiKey: partial.apiKey,
844
+ fetchImpl: partial.fetchImpl,
845
+ stream: partial.stream,
846
+ noColor: partial.noColor,
847
+ once: partial.once,
848
+ rawEvents: partial.rawEvents,
849
+ print: partial.print,
850
+ };
548
851
  }
549
852
  function loadMessages(messages, messagesFile) {
550
853
  return __awaiter(this, void 0, void 0, function* () {
@@ -578,30 +881,6 @@ function parseTimeoutMs(value) {
578
881
  }
579
882
  return n;
580
883
  }
581
- function chatJson(args) {
582
- return __awaiter(this, void 0, void 0, function* () {
583
- var _a;
584
- if (args.message === undefined) {
585
- process.stderr.write("chat --json requires --message\n");
586
- return 2;
587
- }
588
- const result = yield runSession(Object.assign({ baseUrl: args.baseUrl, messages: [args.message] }, (args.bearerToken === undefined
589
- ? {}
590
- : { bearerToken: args.bearerToken })));
591
- if (args.text) {
592
- process.stdout.write(formatTrajectoryText(result.trajectory));
593
- }
594
- else {
595
- console.log(JSON.stringify({
596
- ok: result.ok,
597
- sessionId: result.sessionId,
598
- continuationToken: (_a = result.continuationToken) !== null && _a !== void 0 ? _a : null,
599
- trajectory: result.trajectory,
600
- }, null, 2));
601
- }
602
- return result.ok ? 0 : 1;
603
- });
604
- }
605
884
  /**
606
885
  * Load mounts the same way `serve` does (multi-agent layout by default).
607
886
  */
@@ -619,62 +898,109 @@ function section(title, items) {
619
898
  function isEnterOnly(text) {
620
899
  return text.length > 0 && [...text].every((ch) => ch === "\n" || ch === "\r");
621
900
  }
901
+ function sleep(ms) {
902
+ return new Promise((resolve) => {
903
+ setTimeout(resolve, ms);
904
+ });
905
+ }
906
+ /**
907
+ * `dev [path]` takes a positional project root; `serve` keeps `--dir` only.
908
+ * Reject mixing a positional with an explicit `--dir`, and extra args on `dev`.
909
+ */
910
+ function resolveServeDir(args) {
911
+ if (args.command !== "dev") {
912
+ return args.dir;
913
+ }
914
+ if (args.positionals.length > 1) {
915
+ return {
916
+ error: `${CLI} dev: unexpected arguments: ${args.positionals.slice(1).join(" ")}\n`,
917
+ };
918
+ }
919
+ const positionalDir = args.positionals[0];
920
+ if (positionalDir === undefined) {
921
+ return args.dir;
922
+ }
923
+ if (args.dirFlagPassed && args.dir !== positionalDir) {
924
+ return {
925
+ error: `${CLI} dev: pass a path as a positional or --dir, not both\n`,
926
+ };
927
+ }
928
+ return positionalDir;
929
+ }
622
930
  function printServeBanner(handle, opts) {
623
- var _a;
624
- const multi = handle.agents.length > 1 || ((_a = handle.agents[0]) === null || _a === void 0 ? void 0 : _a.slug) !== "";
625
- if (multi) {
626
- process.stdout.write(`${handle.agents.length} agents listening on ${handle.url}\n`);
627
- if (!opts.noPlayground) {
628
- process.stdout.write(` index: ${handle.url}/\n`);
629
- }
630
- for (const agent of handle.agents) {
631
- const info = projectInfo(agent.project);
632
- const suffix = opts.noPlayground
633
- ? `${agent.url}/v1/session`
634
- : `${agent.url}/playground`;
635
- process.stdout.write(` /${agent.slug} ${info.name} — ${suffix}\n`);
636
- }
931
+ var _a, _b;
932
+ var _c;
933
+ const c = stdoutPalette();
934
+ const agents = handle.agents;
935
+ if (agents.length > 1) {
936
+ process.stdout.write(`${agents.length} agents listening\n`);
637
937
  }
638
938
  else {
639
- const info = projectInfo(handle.project);
640
- process.stdout.write(`${info.name} listening on ${handle.url}\n`);
641
- if (!opts.noPlayground) {
642
- process.stdout.write(` playground: ${handle.url}/playground\n`);
643
- }
644
- process.stdout.write(` POST ${handle.url}/v1/session\n`);
645
- process.stdout.write(` GET ${handle.url}/v1/session/:sessionId/stream\n`);
646
- for (const channel of info.channels) {
647
- if (channel.id === "http") {
648
- continue;
649
- }
650
- for (const route of channel.routes) {
651
- process.stdout.write(` ${route.method} ${handle.url}${route.url}\n`);
939
+ const info = projectInfo((_c = (_a = agents[0]) === null || _a === void 0 ? void 0 : _a.project) !== null && _c !== void 0 ? _c : handle.project);
940
+ process.stdout.write(`${info.name} listening\n`);
941
+ }
942
+ const playgroundUrl = resolvePlaygroundBannerUrl(handle, opts.noPlayground);
943
+ if (playgroundUrl !== undefined) {
944
+ process.stdout.write(` playground ${c.cyan(playgroundUrl)}\n`);
945
+ }
946
+ // Dev is playground-first (Vite proxies the API). Keep API/route detail for
947
+ // plain `serve`, where operators often curl the HTTP surface directly.
948
+ if (!opts.dev) {
949
+ process.stdout.write(c.dim(` api ${handle.url}\n`));
950
+ if (agents.length > 1 || ((_b = agents[0]) === null || _b === void 0 ? void 0 : _b.slug) !== "") {
951
+ for (const agent of agents) {
952
+ const info = projectInfo(agent.project);
953
+ process.stdout.write(c.dim(` /${agent.slug} ${info.name}\n`));
652
954
  }
653
955
  }
654
- if (info.schedules.length > 0) {
655
- const scheduleMode = opts.dev
656
- ? "dev mode: dispatch with POST /v1/dev/schedules/:scheduleId"
657
- : opts.noSchedules
956
+ else {
957
+ const info = projectInfo(handle.project);
958
+ process.stdout.write(c.dim(` POST ${handle.url}/v1/session\n`));
959
+ process.stdout.write(c.dim(` GET ${handle.url}/v1/session/:sessionId/stream\n`));
960
+ for (const channel of info.channels) {
961
+ if (channel.id === "http") {
962
+ continue;
963
+ }
964
+ for (const route of channel.routes) {
965
+ process.stdout.write(c.dim(` ${route.method} ${handle.url}${route.url}\n`));
966
+ }
967
+ }
968
+ if (info.schedules.length > 0) {
969
+ const scheduleMode = opts.noSchedules
658
970
  ? "disabled"
659
971
  : "running on cron cadence (UTC)";
660
- process.stdout.write(` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`);
972
+ process.stdout.write(c.dim(` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`));
973
+ }
974
+ }
975
+ if (handle.docsUrl !== undefined) {
976
+ process.stdout.write(c.dim(` docs ${handle.docsUrl}\n`));
661
977
  }
662
- }
663
- if (handle.playgroundDevUrl !== undefined) {
664
- process.stdout.write(` playground (HMR): ${handle.playgroundDevUrl}\n`);
665
- }
666
- if (handle.docsUrl !== undefined) {
667
- process.stdout.write(` docs: ${handle.docsUrl}\n`);
668
978
  }
669
979
  if (opts.bearerToken) {
670
- process.stdout.write(" auth: bearer token required on API routes (playground has a token field)\n");
980
+ process.stdout.write(c.dim(" auth: bearer token required on API routes (playground has a token field)\n"));
671
981
  }
672
982
  if (opts.dev &&
673
983
  (process.env.GITHUB_WEBHOOK_SECRET === undefined ||
674
984
  process.env.GITHUB_WEBHOOK_SECRET === "") &&
675
985
  handle.agents.some((agent) => projectInfo(agent.project).channels.some((c) => c.kind === "github"))) {
676
- process.stdout.write(` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`);
986
+ process.stdout.write(c.dim(` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`));
987
+ }
988
+ }
989
+ /** Prefer the Vite playground URL in --dev; otherwise the static SPA path. */
990
+ function resolvePlaygroundBannerUrl(handle, noPlayground) {
991
+ if (noPlayground) {
992
+ return undefined;
993
+ }
994
+ if (handle.playgroundDevUrl !== undefined) {
995
+ return handle.playgroundDevUrl.replace(/\/$/, "");
996
+ }
997
+ if (handle.agents.length === 1) {
998
+ return `${handle.agents[0].url}/playground`;
999
+ }
1000
+ if (handle.agents.length > 1) {
1001
+ return handle.url;
677
1002
  }
1003
+ return undefined;
678
1004
  }
679
1005
  function formatModel(model) {
680
1006
  if (model === undefined) {