Agent ergonomics and programmatic access for dev
#12793
Replies: 1 comment 1 reply
|
These are all interesting ideas. I've had I can say that I think my one, concrete, early opposition to all of this is: Should an agent be running a dev server anyway? I can see this line of thought if your usage looks more like "pair programming with an agent", where you run the dev server yourself, and then the agent is an actor that may want to interact off to the side. We should be careful about how we design this so we create a great experience for all modus operandi. |
Uh oh!
There was an error while loading. Please reload this page.
I built a small experimental runner (
procpane) after hitting friction runningturbo devfrom inside coding agents (Claude Code, Codex, Cursor agent mode). Posting this to map the agent UX gap against work already in flight — partly to share what I learned, partly because the experiment is more interesting if it informs where Turborepo itself is heading.The problem, concretely
Coding agents need to do three things with a running
devsession:@acme/api#devlog in the last 50 lines?"EADDRINUSEoriginate?"Today, none of these have a first-class answer with
turbo run dev:ui: "tui") is in-process — the ratatui buffer is unreachable from outside. Copy/paste is broken in many terminals (Turbo 2 UI: Can't copy terminal outputs #8372).--output-logs=errors-onlyis replay-only and ignored for non-cached tasks ([turborepo] The --output-logs errors-only flag is ignored for non-cached tasks. #6677).ui: "stream") interleaves all tasks to stdout. There's no per-task addressing once the stream is in a file, and persistent tasks emit forever, so the file grows unbounded.node_modules/.cache/turbo/<hash>-<task>.logare great, but they don't exist for persistentdevtasks (cache: false). That's where agents actually need them most.The agent ends up screen-scraping or attaching to a multiplexer — both lossy and brittle.
What's already in flight
To avoid asking for things that already exist:
--json(NDJSON to stdout) and--log-file[=path](structured JSON to.turbo/logs/) in v2.8.21-canary.2. This covers most of what an agent wants for build/one-shot tasks. ✓turbo logssubcommand was mentioned. Big +1 from this corner.The gap that remains, from an agent perspective, is live querying of persistent (
dev) tasks while they're running — not just consuming a log file after they finish.Concrete proposals
In rough order of "smallest thing that helps most":
turbo logs <pkg#task> [--tail N] [--since CURSOR] [--json]— read from the--log-fileartifacts, or an in-memory tail buffer for persistent tasks. The--sincecursor is the key for agent polling loops without re-reading the whole buffer.turbo logs grep PATTERN [--task FILTER]— server-side grep across tasks with task-name prefixed output. Avoids agents loading entire log files.--log-fileto write a rotating ring file (capped at, say, 2k lines) forcache: falsetasks. Today they're invisible.turbo run --headless— explicit third mode alongsidetui/stream. No interactive output to stdout; everything to.turbo/logs/. Useful as the agent default since it removes the "is this a TTY?" question.turbo status --json— list currentdevtask states + pids + log-file paths. Today an agent has to parse stream output to know what's running.What procpane does
procpane is a turbo.json-compatible runner that does (1–5) in-memory today for
devsessions. It deliberately doesn't reimplement turbo's value: non-persistentdependsOn(e.g.^build) chains are delegated to a singlepnpm exec turbo run …call, so users keep the cache. The wedge is purely agent-facing query fordev.The interesting outcome of the experiment isn't the runner itself — it's the shape of the API surface that emerged once you take agent ergonomics seriously. Happy to open separate issues for any of the above and turn the procpane work into prototype PRs if that's useful.
Links:
All reactions