Running background tasks
A foreground shell call is capped at 60s — anything slower needs background: true.
Servers/watchers (never finish on their own):
shell: npm run dev (background: true)
This returns a task_id (e.g. bg_abc123). Immediately follow with open_port on the port it listens on — that's how the user actually sees it.
Slow one-shot jobs (installs, builds, long scripts):
shell: npm install (background: true)
Then check on it instead of guessing how long it'll take:
wait_task: { "task_id": "bg_abc123" }
wait_task blocks (up to its own timeout, default 60s) and returns the exit code plus recent output once it's done. If it's still running, call wait_task again — don't poll with repeated plain shell commands against the log file, that's what this tool is for.
Don't background something that genuinely finishes in a few seconds — plain shell is simpler and the result comes back immediately.