Starts idle sessions that have queued input, then pumps until no session is running or
waiting, or timeout seconds have passed. Every session's checks (egress, replay, its model's
provider and key) pass before any is started, so a refusal starts none. On timeout the sessions
keep their running status and no condition is raised. A background session waiting for
approval continues only here, and you are asked as usual (see gptr-background).
Details
timeout limits reactor polling; it does not interrupt R code. Request preparation
and synchronous callbacks finish their current step before the deadline is checked
again, so a call can return after the specified time.
A timeout is not cancellation. Inspect $status and use gptr_cancel() if you want to
abort active work. In Rscript and rendered reports, a blocking call such as this is how
experimental background sessions progress when there is no idle console.
Examples
fake = gptr_fake_provider(list("a"))
runs = list(a = peter("one", model = fake, .run = FALSE),
b = peter("two", model = fake, .run = FALSE))
gptr_wait(runs, timeout = 10)
#> gptr: thinking
#> gptr: thinking
#> gptr: done · fake-1 · 1 request · 1.6k tokens · 99% context left
#> gptr: done · fake-1 · 1 request · 1.6k tokens · 99% context left
vapply(runs, function(x) x$status, "")
#> a b
#> "idle" "idle"