Repository navigation
The agent's turn followed as it happens: thinking, timed steps, and a stream a page picks up again - #17
Merged
Conversation
The tagline: the online judge for the LLM era
… and how long it took, and a page that reloads picks it up again A turn is told to every page watching it as numbered events, kept on the site while the turn runs: GET /api/sessions/:id/agent/events streams them as server-sent events, from the start or from the last one a page had (Last-Event-ID), so a reload, a second tab or a dropped line carries on where it was instead of asking every second and a half. Sending a message now only begins the turn. pi is asked to think where the provider's way of asking is known (OpenRouter, DeepSeek; an admin can choose low, medium, high or off), and what the model thinks is passed on as it comes and kept whole, with how long it took. Tool calls carry their times, an edit its diff, and a long write how much of it has been written; failed model calls being tried again are said, and what the run has spent is told after each call. A provider that refuses the turn for good says why (out of credit, the key refused, too many requests). In the panel: one line under a running turn says what the agent is doing, for how long, and about how many tokens it has written; thinking opens underneath; each step shows how it went and how long it took, with exit codes and diffs; a turn's work folds into a line that says what it came to. Scrollbars are slim throughout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Stream. A turn is now a numbered event log kept on the site while it runs.
POST /api/sessions/:id/agentonly begins the turn ({ turn, now });GET /api/sessions/:id/agent/events?turn=…streams it as server-sent events from the start or fromLast-Event-ID. A reload, a second tab or a dropped line carries on where it was instead of polling every 1.5 s. Text and thinking pieces that arrive close together are merged before they are numbered. A turn taken up again after the runner reconnects is told afresh.Thinking. pi is asked to think where the provider's way is known: OpenRouter (
reasoning: { effort }) and DeepSeek (thinking). A new admin setting covers auto / off / low / medium / high; other endpoints only think when an admin turns it on. Thinking is streamed asthinkevents and kept as athoughtitem, with its duration. pi only emitsthinking_endwith the message, so the runner closes a thought as soon as the reply's text or a tool call begins.Steps. Each tool result now has a duration, and an edit carries pi's unified patch. Long tool calls report how much has been written (
drafting). A retried model call is shown, and spend is pushed after each model call. When the provider refuses a turn for good (402, 401/403, 429), the learner is told why instead of seeing a generic failure.Panel. One status line sits under a running turn. It shows what the agent is doing (thinking / running X / writing file / replying / looking at a result), with a mark that moves differently for each, plus elapsed time and approximate tokens. The live thinking can be opened while it streams. A turn's work folds into a line such as "ran 3 commands, read 2 files, made 1 change · 1 failed", with the total time. Each step shows its status, duration, exit code and a coloured diff for edits. Scrollbars are slim throughout.
Tests
pnpm typecheck,pnpm test(40 passing, withFDEGYM_TEST_REQUIRE_DB=1against Postgres 16) andpnpm build, all run innode:22.docker composewith a real model (DeepSeekdeepseek-flashvia api.deepseek.com) on the campus_booking case:Notes
msorpatchfall back as before.🤖 Generated with Claude Code