@cursor/july 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. package/AGENTS.md +16 -5
  2. package/README.md +8 -9
  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 +416 -155
  6. package/dist/channels/slack/log.d.ts +1 -1
  7. package/dist/channels/slack/log.d.ts.map +1 -1
  8. package/dist/channels/slack/log.js +4 -5
  9. package/dist/channels/slack/setup.js +1 -1
  10. package/dist/channels/slack/socket-mode.d.ts.map +1 -1
  11. package/dist/channels/slack/socket-mode.js +10 -9
  12. package/dist/docs/404.html +2 -2
  13. package/dist/docs/ab.html +3 -3
  14. package/dist/docs/assets/{app.Oje4vhlk.js → app.DF-Yx4OP.js} +1 -1
  15. package/dist/docs/assets/chunks/@localSearchIndexroot.0XrheBv2.js +1 -0
  16. package/dist/docs/assets/chunks/{VPLocalSearchBox.H5XZ2zCB.js → VPLocalSearchBox.DSeJSudL.js} +1 -1
  17. package/dist/docs/assets/chunks/{theme.CTR_TuaE.js → theme.DZVLTXOC.js} +2 -2
  18. package/dist/docs/assets/{index.md.m81y7TY7.js → index.md.Cylk70gg.js} +1 -1
  19. package/dist/docs/assets/{quickstart.md.CfU8_uTC.js → quickstart.md.BU6Iwi_9.js} +18 -6
  20. package/dist/docs/assets/{reference_cli.md.DA730zCu.js → reference_cli.md.Bv6pOxcF.js} +11 -6
  21. package/dist/docs/assets/{reference_cli.md.DA730zCu.lean.js → reference_cli.md.Bv6pOxcF.lean.js} +1 -1
  22. package/dist/docs/building-with-agents.html +3 -3
  23. package/dist/docs/concepts.html +3 -3
  24. package/dist/docs/deployment.html +3 -3
  25. package/dist/docs/evals.html +3 -3
  26. package/dist/docs/guides/agent-to-agent.html +3 -3
  27. package/dist/docs/guides/cloud-runtime.html +3 -3
  28. package/dist/docs/guides/github.html +3 -3
  29. package/dist/docs/guides/human-in-the-loop.html +3 -3
  30. package/dist/docs/guides/slack.html +3 -3
  31. package/dist/docs/guides/webhooks.html +3 -3
  32. package/dist/docs/hashmap.json +1 -1
  33. package/dist/docs/hillclimbing.html +3 -3
  34. package/dist/docs/index.html +5 -5
  35. package/dist/docs/quickstart.html +22 -10
  36. package/dist/docs/reference/agent-config.html +3 -3
  37. package/dist/docs/reference/channels.html +3 -3
  38. package/dist/docs/reference/cli.html +14 -9
  39. package/dist/docs/reference/connections.html +3 -3
  40. package/dist/docs/reference/hooks.html +3 -3
  41. package/dist/docs/reference/http-api.html +3 -3
  42. package/dist/docs/reference/instructions.html +3 -3
  43. package/dist/docs/reference/playground.html +3 -3
  44. package/dist/docs/reference/project-layout.html +3 -3
  45. package/dist/docs/reference/schedules.html +3 -3
  46. package/dist/docs/reference/sessions.html +3 -3
  47. package/dist/docs/reference/skills.html +3 -3
  48. package/dist/docs/reference/subagents.html +3 -3
  49. package/dist/docs/reference/tools.html +3 -3
  50. package/dist/docs/scaffolding-agents.html +3 -3
  51. package/dist/docs/storage.html +3 -3
  52. package/dist/docs/troubleshooting.html +3 -3
  53. package/dist/internal/ab-collector.js +3 -3
  54. package/dist/internal/ab-fold.js +1 -1
  55. package/dist/internal/chat-client.d.ts +29 -3
  56. package/dist/internal/chat-client.d.ts.map +1 -1
  57. package/dist/internal/chat-client.js +180 -27
  58. package/dist/internal/cli-ax.d.ts +83 -2
  59. package/dist/internal/cli-ax.d.ts.map +1 -1
  60. package/dist/internal/cli-ax.js +626 -52
  61. package/dist/internal/cli-cursor.d.ts.map +1 -1
  62. package/dist/internal/cli-cursor.js +8 -36
  63. package/dist/internal/cli-deploy.d.ts +59 -3
  64. package/dist/internal/cli-deploy.d.ts.map +1 -1
  65. package/dist/internal/cli-deploy.js +316 -38
  66. package/dist/internal/cli-github.js +13 -13
  67. package/dist/internal/cursor/account-mcp.js +3 -3
  68. package/dist/internal/cursor/backend-client.js +1 -1
  69. package/dist/internal/cursor/credentials.d.ts +14 -3
  70. package/dist/internal/cursor/credentials.d.ts.map +1 -1
  71. package/dist/internal/cursor/credentials.js +21 -6
  72. package/dist/internal/cursor/github-credentials.js +3 -3
  73. package/dist/internal/cursor-event-relay.js +1 -1
  74. package/dist/internal/cursor-relay-core.d.ts +1 -1
  75. package/dist/internal/cursor-relay-core.d.ts.map +1 -1
  76. package/dist/internal/cursor-relay-core.js +2 -1
  77. package/dist/internal/cursor-slack-relay.js +1 -1
  78. package/dist/internal/deploy-client.d.ts +9 -1
  79. package/dist/internal/deploy-client.d.ts.map +1 -1
  80. package/dist/internal/deploy-client.js +23 -3
  81. package/dist/internal/deploy-source.d.ts +35 -0
  82. package/dist/internal/deploy-source.d.ts.map +1 -0
  83. package/dist/internal/deploy-source.js +118 -0
  84. package/dist/internal/discovery.d.ts +11 -0
  85. package/dist/internal/discovery.d.ts.map +1 -1
  86. package/dist/internal/discovery.js +43 -14
  87. package/dist/internal/distribution.d.ts +7 -0
  88. package/dist/internal/distribution.d.ts.map +1 -1
  89. package/dist/internal/distribution.js +7 -0
  90. package/dist/internal/docs-site.js +3 -3
  91. package/dist/internal/eval-run-store.d.ts.map +1 -1
  92. package/dist/internal/eval-run-store.js +10 -9
  93. package/dist/internal/eval-runner.d.ts +2 -0
  94. package/dist/internal/eval-runner.d.ts.map +1 -1
  95. package/dist/internal/eval-runner.js +2 -0
  96. package/dist/internal/event-mapper.d.ts +54 -1
  97. package/dist/internal/event-mapper.d.ts.map +1 -1
  98. package/dist/internal/event-mapper.js +151 -41
  99. package/dist/internal/github-fanout.js +2 -2
  100. package/dist/internal/host-platforms.js +5 -5
  101. package/dist/internal/init-project.d.ts +88 -1
  102. package/dist/internal/init-project.d.ts.map +1 -1
  103. package/dist/internal/init-project.js +221 -31
  104. package/dist/internal/install-cursor-skills.d.ts +64 -0
  105. package/dist/internal/install-cursor-skills.d.ts.map +1 -0
  106. package/dist/internal/install-cursor-skills.js +274 -0
  107. package/dist/internal/logs-client.d.ts +60 -0
  108. package/dist/internal/logs-client.d.ts.map +1 -0
  109. package/dist/internal/logs-client.js +311 -0
  110. package/dist/internal/mcp-endpoint.d.ts.map +1 -1
  111. package/dist/internal/mcp-endpoint.js +1 -1
  112. package/dist/internal/open-browser.d.ts +5 -0
  113. package/dist/internal/open-browser.d.ts.map +1 -0
  114. package/dist/internal/open-browser.js +34 -0
  115. package/dist/internal/playground/toolchain.d.ts.map +1 -1
  116. package/dist/internal/playground/toolchain.js +19 -14
  117. package/dist/internal/playground-proxy.d.ts +69 -0
  118. package/dist/internal/playground-proxy.d.ts.map +1 -0
  119. package/dist/internal/playground-proxy.js +468 -0
  120. package/dist/internal/prompt-context.d.ts +35 -0
  121. package/dist/internal/prompt-context.d.ts.map +1 -0
  122. package/dist/internal/prompt-context.js +71 -0
  123. package/dist/internal/reminder-runner.d.ts.map +1 -1
  124. package/dist/internal/reminder-runner.js +11 -11
  125. package/dist/internal/request-headers.d.ts +11 -0
  126. package/dist/internal/request-headers.d.ts.map +1 -0
  127. package/dist/internal/request-headers.js +14 -0
  128. package/dist/internal/resolve-prod-target.d.ts +44 -0
  129. package/dist/internal/resolve-prod-target.d.ts.map +1 -0
  130. package/dist/internal/resolve-prod-target.js +134 -0
  131. package/dist/internal/resolved-connections.js +5 -5
  132. package/dist/internal/run-client.d.ts +2 -2
  133. package/dist/internal/run-client.d.ts.map +1 -1
  134. package/dist/internal/run-client.js +38 -23
  135. package/dist/internal/schedule-runner.js +1 -1
  136. package/dist/internal/server.d.ts.map +1 -1
  137. package/dist/internal/server.js +23 -17
  138. package/dist/internal/session-engine.d.ts +1 -1
  139. package/dist/internal/session-engine.d.ts.map +1 -1
  140. package/dist/internal/session-engine.js +34 -19
  141. package/dist/internal/sessions-client.d.ts +34 -0
  142. package/dist/internal/sessions-client.d.ts.map +1 -0
  143. package/dist/internal/sessions-client.js +193 -0
  144. package/dist/internal/storage-coordinator.js +6 -6
  145. package/dist/internal/stream-progress.d.ts.map +1 -1
  146. package/dist/internal/stream-progress.js +31 -3
  147. package/dist/internal/terminal-style.d.ts +22 -0
  148. package/dist/internal/terminal-style.d.ts.map +1 -0
  149. package/dist/internal/terminal-style.js +49 -0
  150. package/dist/internal/trajectory.d.ts +10 -5
  151. package/dist/internal/trajectory.d.ts.map +1 -1
  152. package/dist/internal/trajectory.js +82 -10
  153. package/dist/internal/update-check.d.ts +93 -0
  154. package/dist/internal/update-check.d.ts.map +1 -0
  155. package/dist/internal/update-check.js +431 -0
  156. package/dist/internal/workspace.d.ts +11 -0
  157. package/dist/internal/workspace.d.ts.map +1 -1
  158. package/dist/internal/workspace.js +38 -4
  159. package/dist/playground/assets/index-Ct_Usdm8.css +1 -0
  160. package/dist/playground/assets/index-Dsyb-Vaj.js +319 -0
  161. package/dist/playground/index.html +2 -2
  162. package/dist/types.d.ts +29 -2
  163. package/dist/types.d.ts.map +1 -1
  164. package/docs/README.md +0 -1
  165. package/docs/quickstart.md +22 -7
  166. package/docs/reference/cli.md +51 -3
  167. package/package.json +4 -1
  168. package/skills/ab/SKILL.md +8 -8
  169. package/skills/create-agent/SKILL.md +28 -22
  170. package/skills/debug/SKILL.md +11 -11
  171. package/skills/evals/SKILL.md +16 -16
  172. package/skills/framework-map/SKILL.md +6 -6
  173. package/skills/github/SKILL.md +13 -13
  174. package/skills/hillclimb/SKILL.md +10 -10
  175. package/skills/setup-slack/SKILL.md +14 -14
  176. package/src/bin/agent-serve.ts +451 -191
  177. package/src/channels/slack/log.ts +5 -5
  178. package/src/channels/slack/setup.ts +1 -1
  179. package/src/channels/slack/socket-mode.ts +11 -9
  180. package/src/internal/ab-collector.ts +3 -3
  181. package/src/internal/ab-fold.ts +1 -1
  182. package/src/internal/chat-client.ts +252 -37
  183. package/src/internal/cli-ax.ts +761 -72
  184. package/src/internal/cli-cursor.ts +14 -42
  185. package/src/internal/cli-deploy.ts +428 -49
  186. package/src/internal/cli-github.ts +13 -15
  187. package/src/internal/cursor/account-mcp.ts +3 -3
  188. package/src/internal/cursor/backend-client.ts +1 -1
  189. package/src/internal/cursor/credentials.ts +26 -7
  190. package/src/internal/cursor/github-credentials.ts +3 -3
  191. package/src/internal/cursor-event-relay.ts +1 -1
  192. package/src/internal/cursor-relay-core.ts +4 -2
  193. package/src/internal/cursor-slack-relay.ts +1 -1
  194. package/src/internal/deploy-client.ts +45 -4
  195. package/src/internal/deploy-source.ts +133 -0
  196. package/src/internal/discovery.ts +53 -16
  197. package/src/internal/distribution.ts +8 -0
  198. package/src/internal/docs-site.ts +3 -3
  199. package/src/internal/eval-run-store.ts +10 -11
  200. package/src/internal/eval-runner.ts +5 -0
  201. package/src/internal/event-mapper.ts +222 -42
  202. package/src/internal/github-fanout.ts +2 -2
  203. package/src/internal/host-platforms.ts +5 -5
  204. package/src/internal/init-project.ts +333 -51
  205. package/src/internal/install-cursor-skills.ts +327 -0
  206. package/src/internal/logs-client.ts +442 -0
  207. package/src/internal/mcp-endpoint.ts +1 -3
  208. package/src/internal/open-browser.ts +41 -0
  209. package/src/internal/playground/toolchain.ts +18 -16
  210. package/src/internal/playground-proxy.ts +576 -0
  211. package/src/internal/prompt-context.ts +95 -0
  212. package/src/internal/reminder-runner.ts +11 -17
  213. package/src/internal/request-headers.ts +23 -0
  214. package/src/internal/resolve-prod-target.ts +182 -0
  215. package/src/internal/resolved-connections.ts +5 -5
  216. package/src/internal/run-client.ts +39 -36
  217. package/src/internal/schedule-runner.ts +1 -1
  218. package/src/internal/server.ts +25 -16
  219. package/src/internal/session-engine.ts +35 -18
  220. package/src/internal/sessions-client.ts +216 -0
  221. package/src/internal/storage-coordinator.ts +6 -6
  222. package/src/internal/stream-progress.ts +36 -2
  223. package/src/internal/terminal-style.ts +74 -0
  224. package/src/internal/trajectory.ts +91 -13
  225. package/src/internal/update-check.ts +552 -0
  226. package/src/internal/workspace.ts +42 -4
  227. package/src/types.ts +45 -7
  228. package/dist/docs/assets/chunks/@localSearchIndexroot.zwQ9RCQ7.js +0 -1
  229. package/dist/playground/assets/index-B1Qc9h2u.css +0 -1
  230. package/dist/playground/assets/index-CpDYCj8W.js +0 -79
  231. /package/dist/docs/assets/{index.md.m81y7TY7.lean.js → index.md.Cylk70gg.lean.js} +0 -0
  232. /package/dist/docs/assets/{quickstart.md.CfU8_uTC.lean.js → quickstart.md.BU6Iwi_9.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,12 +27,11 @@ 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";
30
31
  import { cmdDeploy, cmdDeploymentStatus, cmdDeployments, cmdRotatePodCredential, cmdRotateToken, cmdSecretsList, cmdSecretsSet, cmdSecretsUnset, cmdStop, } from "../internal/cli-deploy.js";
31
32
  import { CLI_COMMAND_NAME as CLI } from "../internal/distribution.js";
32
- import { runSession } from "../internal/run-client.js";
33
- import { formatTrajectoryText } from "../internal/trajectory.js";
33
+ import { clearTerminal, stdoutPalette } from "../internal/terminal-style.js";
34
+ import { cmdUpdate, warnIfOutdated } from "../internal/update-check.js";
34
35
  const HELP = `${CLI} — serve a filesystem-defined Cursor agent over channels
35
36
 
36
37
  Usage:
@@ -38,24 +39,43 @@ Usage:
38
39
  [--mode single|multi] [--api-key <key>] [--no-schedules]
39
40
  [--public-url <url>]
40
41
  [--cursor-events --repo <owner/name>]...
41
- ${CLI} chat [--url <baseUrl>] [--message <text>] [--json] [--text]
42
- ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl>]
42
+ ${CLI} dev [path] [--port <n>] [--host <host>]
43
+ Same flags as serve; implies --dev. Path defaults to
44
+ the current directory (or pass --dir).
45
+ ${CLI} chat [--url <baseUrl> | --prod] [--message <text>] [--json] [--text]
46
+ [--session <id> | --resume] [--continuation-token <t>]
47
+ [--slug <slug>] [--team <id>]
48
+ ${CLI} resume [sessionId] [--url <baseUrl> | --prod] [--message <text>]
49
+ [--json] [--text] [--continuation-token <t>]
50
+ [--slug <slug>] [--team <id>]
51
+ ${CLI} logs [--url <baseUrl> | --prod] [--once] [--json]
52
+ [--slug <slug>] [--team <id>] [--dir <path>]
53
+ ${CLI} sessions [--url <baseUrl> | --prod] [--json]
54
+ [--slug <slug>] [--team <id>] [--dir <path>]
55
+ ${CLI} session <sessionId> [--url <baseUrl> | --prod]
56
+ [--json | --text | --events]
57
+ [--slug <slug>] [--team <id>] [--dir <path>]
58
+ ${CLI} playground [--url <baseUrl> | --prod] [--session <id>] [--print]
59
+ [--slug <slug>] [--team <id>] [--dir <path>]
60
+ ${CLI} run [--dir <path>] [--message <text>]... [--url <baseUrl> | --prod]
43
61
  [--session <id>] [--continuation-token <t>]
44
62
  [--events <file.ndjson>] [--no-events] [--text]
45
- [--timeout-ms <n>] [--no-stream]
63
+ [--timeout-ms <n>] [--no-stream] [--slug <slug>] [--team <id>]
46
64
  ${CLI} trajectory --events <file.ndjson> [--text]
47
- ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl>]
48
- [--session <id>] [--slug <slug>]
49
- ${CLI} init [dir]
65
+ ${CLI} call <tool> [--input <json>] [--dir <path> | --url <baseUrl> | --prod]
66
+ [--session <id>] [--slug <slug>] [--team <id>]
67
+ ${CLI} init [dir] [--json]
50
68
  ${CLI} eval [--dir <path>] [evalId...] [--list] [--json]
51
69
  [--tag <tag>]... [--verbose] [--timeout-ms <n>]
52
- [--no-stream]
70
+ [--no-stream] [--url <baseUrl> | --prod] [--slug <slug>]
71
+ [--team <id>]
53
72
  ${CLI} info [--dir <path>] [--json]
54
73
  ${CLI} validate [--dir <path>]
55
74
  ${CLI} login [--api-key <key>] [--key-name <name>]
56
75
  ${CLI} logout
57
76
  ${CLI} whoami [--json]
58
- ${CLI} deploy [--dir <path>] [--slug <slug>] [--team <id>] [--json]
77
+ ${CLI} update
78
+ ${CLI} deploy [--dir <path>] [--slug <slug> | --all] [--team <id>] [--json]
59
79
  [--no-wait] [--repo <url>] [--ref <ref>]
60
80
  [--path <agentPath>] [--cursor-events-repo <owner/name>]...
61
81
  [--allow-domain <domain>]...
@@ -72,15 +92,45 @@ Usage:
72
92
  Commands:
73
93
  serve Serve agents under /<slug>/... (index at /). On a TTY, press
74
94
  Enter to restart (reloads agent code + Vite HMR child).
75
- chat Talk to a running server (streams the reply). --json prints a trajectory.
95
+ dev Local development: same as \`${CLI} serve --dev\` (manual
96
+ schedule/reminder dispatch, unsigned GitHub loopback, Vite HMR).
97
+ chat Interactive REPL against a running server (follow-ups keep the
98
+ session + continuation token). Optional --message seeds the first
99
+ turn then stays open on a TTY. --session reattaches (looks up the
100
+ continuation token via /v1/sessions when omitted) and replays the
101
+ transcript. --resume reattaches the most recently updated
102
+ followable session (no id needed). --json is one-shot. Pass
103
+ --prod to hit the team's hosted deployment (slug from --slug or
104
+ the directory name).
105
+ resume Reattach chat to a session (same as \`${CLI} chat --session <id>\`
106
+ or \`${CLI} chat --resume\` with no id). Omit the session id to
107
+ resume the previous followable session from /v1/sessions. Looks
108
+ up the continuation token via /v1/sessions when
109
+ --continuation-token is omitted, then replays the transcript.
110
+ Pass --prod for a hosted deployment.
111
+ logs Tail agent logs. Default follows (Ctrl-C to stop); --once dumps
112
+ the current buffer. --prod shows deploy progress until the
113
+ hosted deployment is running, then tails runtime logs. Without
114
+ --prod, tails the local server (or --url).
115
+ sessions List sessions on a running agent (or --prod hosted deployment).
116
+ session Show one session. Default: text trajectory. --json for trajectory
117
+ JSON; --events for the raw event list. To continue interactively,
118
+ use \`${CLI} resume [id]\`.
119
+ playground Open the web playground. --prod starts a loopback proxy that
120
+ injects hosted engine credentials (browsers cannot set them).
121
+ --print skips opening a browser. Ctrl-C stops the proxy.
76
122
  run One-shot create→test loop: ephemeral server + JSON trajectory.
77
123
  Writes a single events.ndjson trace (visualize in the playground).
78
124
  Streams tool calls and reply text to stderr when stderr is a TTY.
125
+ Pass --prod to hit the hosted deployment instead of a local server.
79
126
  trajectory Summarize an events.ndjson file into a trajectory.
80
127
  call Call an authored server tool deterministically (no model turn)
81
128
  via POST /v1/tools/:toolName. --session runs it inside an
82
129
  existing session and records it on that session's event stream.
83
- init Scaffold a project, or print the coding-agent setup guide (no args).
130
+ init Scaffold a project (skipping existing files), npm install,
131
+ run login when unsigned, then print next steps. --json is
132
+ machine-readable and never blocks on login. No directory:
133
+ print the setup guide.
84
134
  eval Run filesystem evals under evals/**/*.eval.ts (streams on a TTY).
85
135
  Pass evalId args to select: one datapoint (weather/nyc), a whole
86
136
  file (weather → all cases in that file), several of either, or
@@ -92,9 +142,14 @@ Commands:
92
142
  inference, cloud runtime, and cursorAccount MCP connections.
93
143
  logout Remove the stored Cursor credentials.
94
144
  whoami Show which Cursor account powers this host (and why).
145
+ update Upgrade this install to the latest published version (detects
146
+ global npm/pnpm/yarn/bun installs and project dependencies).
95
147
  deploy Deploy onto Cursor's managed agent-serve hosting, then wait for
96
- the engine to come up. First deploy of a slug prints the alias
97
- token exactly once save it.
148
+ the engine to come up. --repo/--ref/--path stay available;
149
+ inside an agent git checkout they are inferred when omitted
150
+ (flags always win). When --dir is a multi-agent parent,
151
+ pick one interactively, or pass --slug / --all. First deploy
152
+ of a slug prints the alias token exactly once — save it.
98
153
  deployments List the team's deployments (slug, status, generation, kind).
99
154
  deployment Show one deployment in full (status, lastError, engine info).
100
155
  stop Stop a deployment and wait until it reports stopped.
@@ -115,6 +170,7 @@ Agent loop:
115
170
  ${CLI} info --dir . --json
116
171
  ${CLI} run --dir . --message "..."
117
172
  ${CLI} eval --dir .
173
+ ${CLI} dev .
118
174
 
119
175
  Options:
120
176
  --dir Project root (defaults to the current directory).
@@ -135,28 +191,53 @@ Options:
135
191
  send it as the Authorization bearer.
136
192
  --allow-anonymous serve: admit all HTTP callers (allowAll). For demos behind a
137
193
  trusted network only; mutually exclusive with --bearer-token.
194
+ --allow-anonymous-cursor-github
195
+ serve: allow --allow-anonymous together with
196
+ githubChannel({ cursorAccount }). Admitted callers can drive
197
+ sessions holding the account's repo-scoped GitHub credential,
198
+ so use only behind a trusted boundary (e.g. an SSO proxy).
138
199
  --public-url serve: base URL where this host is reachable from outside
139
200
  (e.g. https://agent-serve.example.com). Required for peer
140
201
  connections (defineConnection({ agent })) on cloud-runtime
141
202
  turns; local turns always use loopback.
142
203
  --no-schedules Disable the cron runner outside dev mode.
143
- --team deploy/deployments/deployment/stop/rotate-token: Cursor
144
- team id. Defaults to the account's team when it has one.
204
+ --team deploy/deployments/deployment/stop/rotate-token and
205
+ chat/resume/run/call/eval/logs/sessions/session/playground
206
+ --prod: Cursor team id. Defaults to the account's team when
207
+ it has one.
208
+ --prod chat/resume/run/call/eval/logs/sessions/session/playground:
209
+ use the team's hosted deployment. Slug from --slug or the
210
+ --dir basename. Mutually exclusive with --url. Requires
211
+ \`${CLI} login\`.
212
+ --once logs: print current progress / log buffer once and exit
213
+ (default is to follow).
214
+ --print playground: print the URL only; do not open a browser.
145
215
  --no-wait deploy/stop: return right after the request is accepted
146
216
  instead of polling until a terminal status.
147
217
  --no-playground Disable the bundled web playground at /playground (also skips
148
218
  auto-build / HMR).
149
219
  --no-docs Disable the documentation site at /docs (also skips its
150
220
  auto-build).
151
- --url chat/run/eval: base URL of a running agent (skip local host).
152
- --message chat/run: user message (repeatable for run).
221
+ --url chat/resume/run/call/eval/logs/sessions/session/playground:
222
+ base URL of a running agent (skip local host). Mutually
223
+ exclusive with --prod.
224
+ --message chat/resume/run: user message (repeatable for run).
153
225
  --input call: JSON object of tool arguments (default {}).
154
226
  --messages-file JSON array of strings (run).
155
- --session Existing session id for a follow-up turn.
156
- --continuation-token Token from a prior run/chat response.
227
+ --session Existing session id (run/call follow-up, or chat reattach).
228
+ Prefer \`${CLI} resume [sessionId]\` for interactive
229
+ reattach.
230
+ --resume chat: reattach the previous followable session (most
231
+ recently updated in /v1/sessions). Same as
232
+ \`${CLI} resume\` with no session id. Ignored when
233
+ --session is also set.
234
+ --continuation-token Token from a prior run/chat/resume response (optional
235
+ for resume / chat --session/--resume; looked up via
236
+ /v1/sessions when omitted).
157
237
  --events run: write NDJSON trace to this path (default
158
238
  <dir>/.agent-serve/traces/<sessionId>.ndjson).
159
- trajectory: read this file.
239
+ trajectory: read this file. session: print raw
240
+ { sessionId, events } JSON (boolean; no path).
160
241
  --no-events run: do not write a trace file.
161
242
  --slug Agent slug when --dir mounts multiple agents.
162
243
  --timeout-ms Abort a hung turn after N milliseconds.
@@ -164,7 +245,9 @@ Options:
164
245
  --list eval: print discovered cases without running.
165
246
  --verbose eval: stream t.log lines and reply snippets.
166
247
  --no-stream run/eval: silence live progress on stderr (JSON still prints).
167
- --json JSON output (info/chat/eval/github; run defaults to JSON).
248
+ --json JSON output (init/info/chat/eval/logs/sessions/session/
249
+ github; run defaults to JSON). logs: NDJSON progress/log
250
+ events. session: trajectory JSON (not raw events).
168
251
  --no-color chat: force plain output.
169
252
  --cursor-events serve: pull SCM webhook events from /v0/scm-events. The
170
253
  stream is read as your Cursor user, so serve requires
@@ -174,10 +257,15 @@ Options:
174
257
  --repo serve --cursor-events: repo to subscribe to (repeatable).
175
258
  github forward: owner/repo to forward from (inferred from
176
259
  the git remote when omitted; last wins).
177
- deploy: https git repo URL the control plane builds from.
178
- --ref deploy: git ref to build (defaults to the repo's default
179
- branch server-side).
180
- --path deploy: agent directory relative to the repo root.
260
+ deploy: https git repo URL (optional; inferred from
261
+ git remote origin when omitted).
262
+ --ref deploy: git ref to build (optional; inferred from the
263
+ current branch when omitted).
264
+ --path deploy: agent dir relative to repo root (optional;
265
+ inferred from --dir vs git toplevel when omitted).
266
+ --all deploy: every child agent under a multi-agent --dir
267
+ (skips the interactive picker; mutually exclusive with
268
+ --slug).
181
269
  --cursor-events-repo deploy: repo (owner/name) whose SCM events the
182
270
  deployed engine pulls (repeatable).
183
271
  --allow-domain deploy: egress domain the engine pod may reach
@@ -198,9 +286,9 @@ Options:
198
286
  `;
199
287
  function main(argv) {
200
288
  return __awaiter(this, void 0, void 0, function* () {
201
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
202
- var _k, _l, _m, _o, _p, _q, _r, _s;
203
- const [command, ...rest] = argv;
289
+ var _a, _b, _c, _d, _e, _f, _g;
290
+ var _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
291
+ const [command, ...restIn] = argv;
204
292
  if (command === undefined ||
205
293
  command === "help" ||
206
294
  command === "--help" ||
@@ -208,6 +296,11 @@ function main(argv) {
208
296
  process.stdout.write(HELP);
209
297
  return command === undefined ? 1 : 0;
210
298
  }
299
+ // `session --events` means "dump raw events" (boolean). Rewrite so it does
300
+ // not collide with run/trajectory's `--events <file.ndjson>` string flag.
301
+ const rest = command === "session"
302
+ ? restIn.map((arg) => (arg === "--events" ? "--raw-events" : arg))
303
+ : restIn;
211
304
  const { values, positionals } = parseArgs({
212
305
  args: rest,
213
306
  allowPositionals: true,
@@ -222,15 +315,18 @@ function main(argv) {
222
315
  "state-root": { type: "string" },
223
316
  "bearer-token": { type: "string" },
224
317
  "allow-anonymous": { type: "boolean", default: false },
318
+ "allow-anonymous-cursor-github": { type: "boolean", default: false },
225
319
  "no-schedules": { type: "boolean", default: false },
226
320
  "no-playground": { type: "boolean", default: false },
227
321
  "no-docs": { type: "boolean", default: false },
228
322
  url: { type: "string" },
323
+ prod: { type: "boolean", default: false },
229
324
  message: { type: "string", multiple: true },
230
325
  input: { type: "string" },
231
326
  "messages-file": { type: "string" },
232
327
  "session-id": { type: "string" },
233
328
  session: { type: "string" },
329
+ resume: { type: "boolean", default: false },
234
330
  "continuation-token": { type: "string" },
235
331
  events: { type: "string" },
236
332
  "no-events": { type: "boolean", default: false },
@@ -242,6 +338,8 @@ function main(argv) {
242
338
  text: { type: "boolean", default: false },
243
339
  "no-color": { type: "boolean", default: false },
244
340
  "no-stream": { type: "boolean", default: false },
341
+ once: { type: "boolean", default: false },
342
+ "raw-events": { type: "boolean", default: false },
245
343
  json: { type: "boolean", default: false },
246
344
  name: { type: "string" },
247
345
  env: { type: "string" },
@@ -269,11 +367,17 @@ function main(argv) {
269
367
  "no-wait": { type: "boolean", default: false },
270
368
  ref: { type: "string" },
271
369
  path: { type: "string" },
370
+ all: { type: "boolean", default: false },
272
371
  "cursor-events-repo": { type: "string", multiple: true },
273
372
  "allow-domain": { type: "string", multiple: true },
274
373
  },
275
374
  });
276
- const dir = (_k = values.dir) !== null && _k !== void 0 ? _k : ".";
375
+ const dir = (_h = values.dir) !== null && _h !== void 0 ? _h : ".";
376
+ // Best-effort, cached, and silent on failure. `update` does its own fresh
377
+ // lookup, and --json runs stay quiet for machine consumers.
378
+ if (command !== "update" && values.json !== true) {
379
+ yield warnIfOutdated();
380
+ }
277
381
  switch (command) {
278
382
  case "slack": {
279
383
  const { cmdSlack } = yield import("../internal/cli-slack.js");
@@ -329,6 +433,7 @@ function main(argv) {
329
433
  return cmdInit({
330
434
  dir,
331
435
  initTarget: positionals[0],
436
+ json: values.json,
332
437
  });
333
438
  }
334
439
  case "login": {
@@ -346,11 +451,14 @@ function main(argv) {
346
451
  const { cmdWhoami } = yield import("../internal/cli-cursor.js");
347
452
  return cmdWhoami({ json: values.json });
348
453
  }
454
+ case "update": {
455
+ return cmdUpdate();
456
+ }
349
457
  case "deploy": {
350
458
  // `--repo` is repeatable for `serve --cursor-events`; deploy targets a
351
459
  // single source repo, so the last one wins.
352
460
  const repo = (_b = values.repo) === null || _b === void 0 ? void 0 : _b.at(-1);
353
- return cmdDeploy(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 })), (repo === undefined ? {} : { repo })), (values.ref === undefined ? {} : { ref: values.ref })), (values.path === undefined ? {} : { path: values.path })), (values["cursor-events-repo"] === undefined
461
+ 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
354
462
  ? {}
355
463
  : { cursorEventsRepos: values["cursor-events-repo"] })), (values["allow-domain"] === undefined
356
464
  ? {}
@@ -390,7 +498,7 @@ function main(argv) {
390
498
  return cmdRun(axFromOptions({
391
499
  dir,
392
500
  messages,
393
- sessionId: (_l = values["session-id"]) !== null && _l !== void 0 ? _l : values.session,
501
+ sessionId: (_j = values["session-id"]) !== null && _j !== void 0 ? _j : values.session,
394
502
  continuationToken: values["continuation-token"],
395
503
  events: values["no-events"]
396
504
  ? false
@@ -399,6 +507,9 @@ function main(argv) {
399
507
  : values.events,
400
508
  text: values.text,
401
509
  url: values.url,
510
+ prod: values.prod,
511
+ team: values.team,
512
+ apiKey: values["api-key"],
402
513
  slug: values.slug,
403
514
  bearerToken: values["bearer-token"],
404
515
  stateRoot: values["state-root"],
@@ -411,8 +522,11 @@ function main(argv) {
411
522
  dir,
412
523
  toolName: positionals[0],
413
524
  toolInput: values.input,
414
- sessionId: (_m = values["session-id"]) !== null && _m !== void 0 ? _m : values.session,
525
+ sessionId: (_k = values["session-id"]) !== null && _k !== void 0 ? _k : values.session,
415
526
  url: values.url,
527
+ prod: values.prod,
528
+ team: values.team,
529
+ apiKey: values["api-key"],
416
530
  slug: values.slug,
417
531
  bearerToken: values["bearer-token"],
418
532
  stateRoot: values["state-root"],
@@ -438,6 +552,9 @@ function main(argv) {
438
552
  json: values.json,
439
553
  tags: values.tag,
440
554
  url: values.url,
555
+ prod: values.prod,
556
+ team: values.team,
557
+ apiKey: values["api-key"],
441
558
  slug: values.slug,
442
559
  bearerToken: values["bearer-token"],
443
560
  stateRoot: values["state-root"],
@@ -446,20 +563,93 @@ function main(argv) {
446
563
  }));
447
564
  }
448
565
  case "chat": {
449
- if (values.json) {
450
- return chatJson({
451
- baseUrl: (_o = values.url) !== null && _o !== void 0 ? _o : "http://127.0.0.1:3000",
452
- message: (_c = values.message) === null || _c === void 0 ? void 0 : _c[0],
453
- bearerToken: values["bearer-token"],
454
- text: values.text,
455
- });
456
- }
457
- yield runChat(Object.assign(Object.assign(Object.assign({ baseUrl: (_p = values.url) !== null && _p !== void 0 ? _p : "http://127.0.0.1:3000" }, (((_d = values.message) === null || _d === void 0 ? void 0 : _d[0]) === undefined
458
- ? {}
459
- : { message: values.message[0] })), (values["bearer-token"] === undefined
460
- ? {}
461
- : { bearerToken: values["bearer-token"] })), (values["no-color"] ? { noColor: true } : {})));
462
- return 0;
566
+ return cmdChat(axFromOptions({
567
+ dir,
568
+ messages: values.message,
569
+ url: values.url,
570
+ prod: values.prod,
571
+ team: values.team,
572
+ apiKey: values["api-key"],
573
+ slug: values.slug,
574
+ sessionId: (_l = values["session-id"]) !== null && _l !== void 0 ? _l : values.session,
575
+ resume: values.resume,
576
+ continuationToken: values["continuation-token"],
577
+ bearerToken: values["bearer-token"],
578
+ json: values.json,
579
+ text: values.text,
580
+ noColor: values["no-color"],
581
+ }));
582
+ }
583
+ case "resume": {
584
+ return cmdResume(positionals[0], axFromOptions({
585
+ dir,
586
+ messages: values.message,
587
+ url: values.url,
588
+ prod: values.prod,
589
+ team: values.team,
590
+ apiKey: values["api-key"],
591
+ slug: values.slug,
592
+ // Positional wins; --session is accepted as a redundant alias.
593
+ // No id → resume previous (cmdResume sets resume: true).
594
+ sessionId: (_o = (_m = positionals[0]) !== null && _m !== void 0 ? _m : values["session-id"]) !== null && _o !== void 0 ? _o : values.session,
595
+ continuationToken: values["continuation-token"],
596
+ bearerToken: values["bearer-token"],
597
+ json: values.json,
598
+ text: values.text,
599
+ noColor: values["no-color"],
600
+ }));
601
+ }
602
+ case "logs": {
603
+ return cmdLogs(axFromOptions({
604
+ dir,
605
+ url: values.url,
606
+ prod: values.prod,
607
+ team: values.team,
608
+ apiKey: values["api-key"],
609
+ slug: values.slug,
610
+ bearerToken: values["bearer-token"],
611
+ json: values.json,
612
+ once: values.once,
613
+ }));
614
+ }
615
+ case "sessions": {
616
+ return cmdSessions(axFromOptions({
617
+ dir,
618
+ url: values.url,
619
+ prod: values.prod,
620
+ team: values.team,
621
+ apiKey: values["api-key"],
622
+ slug: values.slug,
623
+ bearerToken: values["bearer-token"],
624
+ json: values.json,
625
+ }));
626
+ }
627
+ case "session": {
628
+ return cmdSession(positionals[0], axFromOptions({
629
+ dir,
630
+ url: values.url,
631
+ prod: values.prod,
632
+ team: values.team,
633
+ apiKey: values["api-key"],
634
+ slug: values.slug,
635
+ bearerToken: values["bearer-token"],
636
+ json: values.json,
637
+ text: values.text,
638
+ rawEvents: values["raw-events"],
639
+ }));
640
+ }
641
+ case "playground": {
642
+ return cmdPlayground(axFromOptions({
643
+ dir,
644
+ url: values.url,
645
+ prod: values.prod,
646
+ team: values.team,
647
+ apiKey: values["api-key"],
648
+ slug: values.slug,
649
+ bearerToken: values["bearer-token"],
650
+ sessionId: (_p = values["session-id"]) !== null && _p !== void 0 ? _p : values.session,
651
+ print: values.print,
652
+ }));
463
653
  }
464
654
  case "validate": {
465
655
  const mounts = yield loadMounts(dir);
@@ -478,7 +668,7 @@ function main(argv) {
478
668
  case "info": {
479
669
  const mounts = yield loadMounts(dir);
480
670
  if (values.json) {
481
- const payload = mounts.length === 1 && ((_e = mounts[0]) === null || _e === void 0 ? void 0 : _e.slug) === ""
671
+ const payload = mounts.length === 1 && ((_c = mounts[0]) === null || _c === void 0 ? void 0 : _c.slug) === ""
482
672
  ? projectInfo(mounts[0].project)
483
673
  : {
484
674
  agents: mounts.map(({ slug, project }) => (Object.assign({ slug }, projectInfo(project)))),
@@ -486,7 +676,7 @@ function main(argv) {
486
676
  process.stdout.write(`${JSON.stringify(payload, null, 2)}\n`);
487
677
  return 0;
488
678
  }
489
- if (mounts.length > 1 || ((_f = mounts[0]) === null || _f === void 0 ? void 0 : _f.slug) !== "") {
679
+ if (mounts.length > 1 || ((_d = mounts[0]) === null || _d === void 0 ? void 0 : _d.slug) !== "") {
490
680
  process.stdout.write(`${mounts.length} agents under ${dir}:\n\n`);
491
681
  for (const { slug, project } of mounts) {
492
682
  const info = projectInfo(project);
@@ -495,7 +685,7 @@ function main(argv) {
495
685
  const anyError = mounts.some((m) => m.project.diagnostics.some((d) => d.severity === "error"));
496
686
  return anyError ? 1 : 0;
497
687
  }
498
- const project = (_g = mounts[0]) === null || _g === void 0 ? void 0 : _g.project;
688
+ const project = (_e = mounts[0]) === null || _e === void 0 ? void 0 : _e.project;
499
689
  const info = projectInfo(project);
500
690
  const lines = [];
501
691
  lines.push(`agent: ${info.name}`);
@@ -512,15 +702,27 @@ function main(argv) {
512
702
  "(events only)"}`)));
513
703
  lines.push(section("schedules", info.schedules.map((s) => `${s.name} (${s.cron}, ${s.kind})`)));
514
704
  lines.push(section("hooks", info.hooks));
515
- lines.push(section("hosting egress domains", (_q = (_h = info.hosting) === null || _h === void 0 ? void 0 : _h.egressDomains) !== null && _q !== void 0 ? _q : []));
516
- lines.push(section("hosting secret names", (_r = (_j = info.hosting) === null || _j === void 0 ? void 0 : _j.secretNames) !== null && _r !== void 0 ? _r : []));
705
+ lines.push(section("hosting egress domains", (_q = (_f = info.hosting) === null || _f === void 0 ? void 0 : _f.egressDomains) !== null && _q !== void 0 ? _q : []));
706
+ lines.push(section("hosting secret names", (_r = (_g = info.hosting) === null || _g === void 0 ? void 0 : _g.secretNames) !== null && _r !== void 0 ? _r : []));
517
707
  if (info.diagnostics.length > 0) {
518
708
  lines.push(`\ndiagnostics:\n${formatDiagnostics(info.diagnostics)}`);
519
709
  }
520
710
  process.stdout.write(`${lines.filter((line) => line !== "").join("\n")}\n`);
521
711
  return info.diagnostics.some((d) => d.severity === "error") ? 1 : 0;
522
712
  }
713
+ case "dev":
523
714
  case "serve": {
715
+ const serveDirResult = resolveServeDir({
716
+ command,
717
+ dir,
718
+ positionals,
719
+ dirFlagPassed: rest.includes("--dir"),
720
+ });
721
+ if (typeof serveDirResult !== "string") {
722
+ process.stderr.write(serveDirResult.error);
723
+ return 1;
724
+ }
725
+ const serveDir = serveDirResult;
524
726
  const port = values.port === undefined ? 3000 : Number.parseInt(values.port, 10);
525
727
  if (Number.isNaN(port) || port < 0 || port > 65535) {
526
728
  process.stderr.write(`invalid --port: ${values.port}\n`);
@@ -536,29 +738,42 @@ function main(argv) {
536
738
  process.stderr.write(`invalid --mode: ${mode} (expected "single" or "multi")\n`);
537
739
  return 1;
538
740
  }
539
- 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
540
- ? {}
541
- : { apiKey: values["api-key"] })), (values["state-root"] === undefined
542
- ? {}
543
- : { stateRoot: values["state-root"] })), (values["bearer-token"] === undefined
544
- ? {}
545
- : { 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
546
- ? {}
547
- : { publicUrl: values["public-url"] })), (values["cursor-events"]
548
- ? { cursorEvents: { repos: (_s = values.repo) !== null && _s !== void 0 ? _s : [] } }
549
- : {}));
741
+ const dev = command === "dev" || values.dev === true;
742
+ const style = stdoutPalette();
743
+ const serveOptions = {
744
+ port,
745
+ host: values.host,
746
+ mode: mode,
747
+ dev,
748
+ apiKey: values["api-key"],
749
+ stateRoot: values["state-root"],
750
+ authToken: values["bearer-token"],
751
+ allowAnonymous: values["allow-anonymous"] === true ? true : undefined,
752
+ allowAnonymousCursorGithub: values["allow-anonymous-cursor-github"] === true ? true : undefined,
753
+ schedules: values["no-schedules"] === true ? false : undefined,
754
+ playground: values["no-playground"] === true ? false : undefined,
755
+ docs: values["no-docs"] === true ? false : undefined,
756
+ publicUrl: values["public-url"],
757
+ cursorEvents: values["cursor-events"] === true
758
+ ? { repos: (_s = values.repo) !== null && _s !== void 0 ? _s : [] }
759
+ : undefined,
760
+ // Soft boot logs (GitHub auth, etc.) stay secondary to the banner.
761
+ logger: (line) => {
762
+ process.stdout.write(`${style.dim(line)}\n`);
763
+ },
764
+ };
550
765
  const enterToRestart = process.stdin.isTTY === true;
551
766
  const bannerOpts = {
552
767
  noPlayground: values["no-playground"] === true,
553
- dev: values.dev === true,
768
+ dev,
554
769
  bearerToken: values["bearer-token"] !== undefined,
555
770
  noSchedules: values["no-schedules"] === true,
556
771
  };
557
772
  const start = () => __awaiter(this, void 0, void 0, function* () {
558
- const next = yield serve(dir, serveOptions);
773
+ const next = yield serve(serveDir, serveOptions);
559
774
  printServeBanner(next, bannerOpts);
560
775
  if (enterToRestart) {
561
- process.stdout.write(" press Enter to restart\n");
776
+ process.stdout.write(style.dim(" press Enter to restart\n"));
562
777
  }
563
778
  return next;
564
779
  });
@@ -586,16 +801,22 @@ function main(argv) {
586
801
  return;
587
802
  }
588
803
  restarting = true;
589
- process.stdout.write("\nrestarting…\n");
590
- void handle
591
- .close()
592
- .then(start)
804
+ // Close + re-serve reloads authored agent modules and respawns Vite.
805
+ // Hold the "restarting…" frame briefly so a fast close doesn't look
806
+ // like Enter did nothing.
807
+ clearTerminal();
808
+ process.stdout.write(style.dim("restarting…\n"));
809
+ void Promise.all([handle.close(), sleep(450)])
810
+ .then(() => {
811
+ clearTerminal();
812
+ return start();
813
+ })
593
814
  .then((next) => {
594
815
  handle = next;
595
816
  })
596
817
  .catch((error) => {
597
818
  var _a;
598
- process.stderr.write(`[agent-serve] restart failed: ${error instanceof Error
819
+ process.stderr.write(`[agentkit] restart failed: ${error instanceof Error
599
820
  ? ((_a = error.stack) !== null && _a !== void 0 ? _a : error.message)
600
821
  : String(error)}\n`);
601
822
  closing = true;
@@ -619,21 +840,38 @@ function deployOptionsFromValues(values) {
619
840
  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"] }));
620
841
  }
621
842
  function axFromOptions(partial) {
622
- 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
623
- ? {}
624
- : { bearerToken: partial.bearerToken })), (partial.stateRoot === undefined
625
- ? {}
626
- : { stateRoot: partial.stateRoot })), (partial.messages === undefined ? {} : { messages: partial.messages })), (partial.sessionId === undefined
627
- ? {}
628
- : { sessionId: partial.sessionId })), (partial.continuationToken === undefined
629
- ? {}
630
- : { continuationToken: partial.continuationToken })), (partial.timeoutMs === undefined
631
- ? {}
632
- : { 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
633
- ? {}
634
- : { initTarget: partial.initTarget })), (partial.toolName === undefined ? {} : { toolName: partial.toolName })), (partial.toolInput === undefined
635
- ? {}
636
- : { toolInput: partial.toolInput })), (partial.url === undefined ? {} : { url: partial.url })), (partial.stream === undefined ? {} : { stream: partial.stream }));
843
+ return {
844
+ dir: partial.dir,
845
+ cwd: partial.cwd,
846
+ slug: partial.slug,
847
+ bearerToken: partial.bearerToken,
848
+ stateRoot: partial.stateRoot,
849
+ messages: partial.messages,
850
+ sessionId: partial.sessionId,
851
+ resume: partial.resume,
852
+ continuationToken: partial.continuationToken,
853
+ timeoutMs: partial.timeoutMs,
854
+ events: partial.events,
855
+ text: partial.text,
856
+ json: partial.json,
857
+ list: partial.list,
858
+ verbose: partial.verbose,
859
+ tags: partial.tags,
860
+ evalIds: partial.evalIds,
861
+ initTarget: partial.initTarget,
862
+ toolName: partial.toolName,
863
+ toolInput: partial.toolInput,
864
+ url: partial.url,
865
+ prod: partial.prod,
866
+ team: partial.team,
867
+ apiKey: partial.apiKey,
868
+ fetchImpl: partial.fetchImpl,
869
+ stream: partial.stream,
870
+ noColor: partial.noColor,
871
+ once: partial.once,
872
+ rawEvents: partial.rawEvents,
873
+ print: partial.print,
874
+ };
637
875
  }
638
876
  function loadMessages(messages, messagesFile) {
639
877
  return __awaiter(this, void 0, void 0, function* () {
@@ -667,30 +905,6 @@ function parseTimeoutMs(value) {
667
905
  }
668
906
  return n;
669
907
  }
670
- function chatJson(args) {
671
- return __awaiter(this, void 0, void 0, function* () {
672
- var _a;
673
- if (args.message === undefined) {
674
- process.stderr.write("chat --json requires --message\n");
675
- return 2;
676
- }
677
- const result = yield runSession(Object.assign({ baseUrl: args.baseUrl, messages: [args.message] }, (args.bearerToken === undefined
678
- ? {}
679
- : { bearerToken: args.bearerToken })));
680
- if (args.text) {
681
- process.stdout.write(formatTrajectoryText(result.trajectory));
682
- }
683
- else {
684
- console.log(JSON.stringify({
685
- ok: result.ok,
686
- sessionId: result.sessionId,
687
- continuationToken: (_a = result.continuationToken) !== null && _a !== void 0 ? _a : null,
688
- trajectory: result.trajectory,
689
- }, null, 2));
690
- }
691
- return result.ok ? 0 : 1;
692
- });
693
- }
694
908
  /**
695
909
  * Load mounts the same way `serve` does (multi-agent layout by default).
696
910
  */
@@ -708,62 +922,109 @@ function section(title, items) {
708
922
  function isEnterOnly(text) {
709
923
  return text.length > 0 && [...text].every((ch) => ch === "\n" || ch === "\r");
710
924
  }
925
+ function sleep(ms) {
926
+ return new Promise((resolve) => {
927
+ setTimeout(resolve, ms);
928
+ });
929
+ }
930
+ /**
931
+ * `dev [path]` takes a positional project root; `serve` keeps `--dir` only.
932
+ * Reject mixing a positional with an explicit `--dir`, and extra args on `dev`.
933
+ */
934
+ function resolveServeDir(args) {
935
+ if (args.command !== "dev") {
936
+ return args.dir;
937
+ }
938
+ if (args.positionals.length > 1) {
939
+ return {
940
+ error: `${CLI} dev: unexpected arguments: ${args.positionals.slice(1).join(" ")}\n`,
941
+ };
942
+ }
943
+ const positionalDir = args.positionals[0];
944
+ if (positionalDir === undefined) {
945
+ return args.dir;
946
+ }
947
+ if (args.dirFlagPassed && args.dir !== positionalDir) {
948
+ return {
949
+ error: `${CLI} dev: pass a path as a positional or --dir, not both\n`,
950
+ };
951
+ }
952
+ return positionalDir;
953
+ }
711
954
  function printServeBanner(handle, opts) {
712
- var _a;
713
- const multi = handle.agents.length > 1 || ((_a = handle.agents[0]) === null || _a === void 0 ? void 0 : _a.slug) !== "";
714
- if (multi) {
715
- process.stdout.write(`${handle.agents.length} agents listening on ${handle.url}\n`);
716
- if (!opts.noPlayground) {
717
- process.stdout.write(` index: ${handle.url}/\n`);
718
- }
719
- for (const agent of handle.agents) {
720
- const info = projectInfo(agent.project);
721
- const suffix = opts.noPlayground
722
- ? `${agent.url}/v1/session`
723
- : `${agent.url}/playground`;
724
- process.stdout.write(` /${agent.slug} ${info.name} — ${suffix}\n`);
725
- }
955
+ var _a, _b;
956
+ var _c;
957
+ const c = stdoutPalette();
958
+ const agents = handle.agents;
959
+ if (agents.length > 1) {
960
+ process.stdout.write(`${agents.length} agents listening\n`);
726
961
  }
727
962
  else {
728
- const info = projectInfo(handle.project);
729
- process.stdout.write(`${info.name} listening on ${handle.url}\n`);
730
- if (!opts.noPlayground) {
731
- process.stdout.write(` playground: ${handle.url}/playground\n`);
732
- }
733
- process.stdout.write(` POST ${handle.url}/v1/session\n`);
734
- process.stdout.write(` GET ${handle.url}/v1/session/:sessionId/stream\n`);
735
- for (const channel of info.channels) {
736
- if (channel.id === "http") {
737
- continue;
738
- }
739
- for (const route of channel.routes) {
740
- process.stdout.write(` ${route.method} ${handle.url}${route.url}\n`);
963
+ const info = projectInfo((_c = (_a = agents[0]) === null || _a === void 0 ? void 0 : _a.project) !== null && _c !== void 0 ? _c : handle.project);
964
+ process.stdout.write(`${info.name} listening\n`);
965
+ }
966
+ const playgroundUrl = resolvePlaygroundBannerUrl(handle, opts.noPlayground);
967
+ if (playgroundUrl !== undefined) {
968
+ process.stdout.write(` playground ${c.cyan(playgroundUrl)}\n`);
969
+ }
970
+ // Dev is playground-first (Vite proxies the API). Keep API/route detail for
971
+ // plain `serve`, where operators often curl the HTTP surface directly.
972
+ if (!opts.dev) {
973
+ process.stdout.write(c.dim(` api ${handle.url}\n`));
974
+ if (agents.length > 1 || ((_b = agents[0]) === null || _b === void 0 ? void 0 : _b.slug) !== "") {
975
+ for (const agent of agents) {
976
+ const info = projectInfo(agent.project);
977
+ process.stdout.write(c.dim(` /${agent.slug} ${info.name}\n`));
741
978
  }
742
979
  }
743
- if (info.schedules.length > 0) {
744
- const scheduleMode = opts.dev
745
- ? "dev mode: dispatch with POST /v1/dev/schedules/:scheduleId"
746
- : opts.noSchedules
980
+ else {
981
+ const info = projectInfo(handle.project);
982
+ process.stdout.write(c.dim(` POST ${handle.url}/v1/session\n`));
983
+ process.stdout.write(c.dim(` GET ${handle.url}/v1/session/:sessionId/stream\n`));
984
+ for (const channel of info.channels) {
985
+ if (channel.id === "http") {
986
+ continue;
987
+ }
988
+ for (const route of channel.routes) {
989
+ process.stdout.write(c.dim(` ${route.method} ${handle.url}${route.url}\n`));
990
+ }
991
+ }
992
+ if (info.schedules.length > 0) {
993
+ const scheduleMode = opts.noSchedules
747
994
  ? "disabled"
748
995
  : "running on cron cadence (UTC)";
749
- process.stdout.write(` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`);
996
+ process.stdout.write(c.dim(` schedules: ${info.schedules.map((s) => s.name).join(", ")} — ${scheduleMode}\n`));
997
+ }
998
+ }
999
+ if (handle.docsUrl !== undefined) {
1000
+ process.stdout.write(c.dim(` docs ${handle.docsUrl}\n`));
750
1001
  }
751
- }
752
- if (handle.playgroundDevUrl !== undefined) {
753
- process.stdout.write(` playground (HMR): ${handle.playgroundDevUrl}\n`);
754
- }
755
- if (handle.docsUrl !== undefined) {
756
- process.stdout.write(` docs: ${handle.docsUrl}\n`);
757
1002
  }
758
1003
  if (opts.bearerToken) {
759
- process.stdout.write(" auth: bearer token required on API routes (playground has a token field)\n");
1004
+ process.stdout.write(c.dim(" auth: bearer token required on API routes (playground has a token field)\n"));
760
1005
  }
761
1006
  if (opts.dev &&
762
1007
  (process.env.GITHUB_WEBHOOK_SECRET === undefined ||
763
1008
  process.env.GITHUB_WEBHOOK_SECRET === "") &&
764
1009
  handle.agents.some((agent) => projectInfo(agent.project).channels.some((c) => c.kind === "github"))) {
765
- process.stdout.write(` github: dev accepts unsigned loopback deliveries (${CLI} github forward works without a secret; set GITHUB_WEBHOOK_SECRET to verify signatures)\n`);
1010
+ 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`));
1011
+ }
1012
+ }
1013
+ /** Prefer the Vite playground URL in --dev; otherwise the static SPA path. */
1014
+ function resolvePlaygroundBannerUrl(handle, noPlayground) {
1015
+ if (noPlayground) {
1016
+ return undefined;
1017
+ }
1018
+ if (handle.playgroundDevUrl !== undefined) {
1019
+ return handle.playgroundDevUrl.replace(/\/$/, "");
1020
+ }
1021
+ if (handle.agents.length === 1) {
1022
+ return `${handle.agents[0].url}/playground`;
1023
+ }
1024
+ if (handle.agents.length > 1) {
1025
+ return handle.url;
766
1026
  }
1027
+ return undefined;
767
1028
  }
768
1029
  function formatModel(model) {
769
1030
  if (model === undefined) {
@@ -809,7 +1070,7 @@ function installTransportErrorGuards() {
809
1070
  };
810
1071
  const log = (label, reason) => {
811
1072
  const text = reason instanceof Error ? reason.message : String(reason);
812
- process.stderr.write(`[agent-serve] ${label} (server stays up): ${text.slice(0, 400)}\n`);
1073
+ process.stderr.write(`[agentkit] ${label} (server stays up): ${text.slice(0, 400)}\n`);
813
1074
  };
814
1075
  process.on("unhandledRejection", (reason) => {
815
1076
  if (isTransportNoise(reason)) {
@@ -824,7 +1085,7 @@ function installTransportErrorGuards() {
824
1085
  log("swallowed uncaughtException", error);
825
1086
  return;
826
1087
  }
827
- process.stderr.write(`[agent-serve] uncaughtException: ${(_a = error.stack) !== null && _a !== void 0 ? _a : error.message}\n`);
1088
+ process.stderr.write(`[agentkit] uncaughtException: ${(_a = error.stack) !== null && _a !== void 0 ? _a : error.message}\n`);
828
1089
  process.exit(1);
829
1090
  });
830
1091
  }