Repository navigation
fix(agui): replace the CLI's custom events and frames with the standard AG-UI 1.0 contract - #1439
Conversation
|
@infer This a WIP. Can you continue the work on this PR? finalise this? update the PR's title and description when you're done. use /domain-driven-design /go /go-concurrency /clean-architecture /clean-code |
|
Model: Todos
Pull Request✅ Infer Result: SuccessThe work is committed and pushed, the PR title and description are updated. Final summary below - this is what will be posted. SummaryContinued PR #1439 (salvage of issue #1419) and brought it back to a buildable state, then updated the PR title and description as asked. Landed and pushed (commit
Explicitly not finished yet (documented in the PR body):
CI will stay red until the registry rework and the test migrations land - the PR body lists them as the acceptance-driven next steps. Model: Tokens: 14,637,152 in · 86,256 out · 14,723,408 total (80 requests) Tool calls: 123 total · 100% success rate TracesStatsTriggered by edenreich · Infer Action · OSS |
|
@infer CI is failing - can you fix this? |
|
Model: Todos
Pull Request
|
- the panel's conversation, history, skills, models and modes units get their write hook in NewPanel, so a fresh worker no longer panics on a nil frameWriter - conversations write MESSAGES_SNAPSHOT straight to the wire instead of borrowing an open run - run input message parts re-decode through the frame's JSON round trip and empty messages are dropped - the run writer no-ops writes after the run ended, streams reasoning under the reasoning role and lets RUN_ERROR keep its anonymous 1.0 shape - headless, agui and computer tests, the lint import gate and the trailing-newline gate move onto the 1.0 contract
- forward run_agent_input frames to the client's thread, the one entry point the old user_message and computer_use_control frames served - track the interrupts a suspended run waits on from its RUN_FINISHED outcome - the first resume wins and later ones are dropped - a resume that misses an open interrupt is refused with RUN_ERROR per the every-interrupt rule
…me, tests and docs The Telegram driving adapter still sent user_message frames and answered CUSTOM approval events the worker no longer reads or writes. It now starts runs with run_agent_input and answers the interrupts a suspended run ends on with resume entries, remembering the run's tool calls by id for the approval prompt. One-shot headless --format ag-ui never registered its control as the encoder's interrupt ledger, so resume entries were dropped there. The control now reaches the encoder through renderStream. The old frames and their dead code go: user_message forwarding in the registry, the panel's user_message history hook and unused snapshot flag, and the ipc UserMessage and ComputerUseControlMessage types. The registry's resume policy answers with a bool instead of a two-value enum. The registry gains a table test for the resume contract (first resume wins, incomplete resume refused with RUN_ERROR, late resume dropped), the e2e suite speaks protocol version 2 and the interrupt flow, and the docs describe the new contract. Part of #1419
|
🎉 This PR is included in version 0.221.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Resolves #1419 - moves the CLI's custom events and app frames onto the standard AG-UI 1.0 contract, so the opentask extension, the desktop app and the Telegram channel implement one wire once.
What this change does
usage, theinterruptoutcome andRunFinishedOutcome. Thecancelledoutcome is a typed constant, not a bare literal.internal/protocols/agui/run.go). Every event a run writes is validated in tests against the upstreamspec/1.0/schema.json(santhosh-tekuri/jsonschema), and nothing is written beforeRUN_STARTEDor after the run's terminal event.protocol_versionto 2.STATE_SNAPSHOTseedstodos,usage,backgroundTasksandscreenRecordingon every run, andSTATE_DELTApatches one key. Judge verdicts and local agent startup surface asACTIVITY_SNAPSHOT(boot progress observed before the first run opens is held until itsRUN_STARTED).token_usageis gone:usagelives in the state while the run is open and onRUN_FINISHEDandRUN_ERROR, with cost and the context window kept inresult. Queued notes render as text messages with the role they hold in the conversation.RUN_FINISHEDwith theinterruptoutcome, reasontool_callwith thetoolCallIdorinput_requiredwith a response schema. The answer is a resume entry on the next run, which continues with aSTATE_SNAPSHOTseeded from the interrupted run and writes theTOOL_CALL_RESULTfor the sametoolCallId.run_agent_inputframe carrying aRunAgentInputreplacesuser_message(attachments become content parts),computer_use_controland the approval and question response frames.messagesholds the new messages only. An input with no messages and no resume continues after a stopped run, which is how computer use pauses (interrupt) and resumes.RUN_ERROR, and drops later ones. The thread's other clients learn the decision from the continuation run'sRUN_STARTED.run_agent_inputand answers a suspended run's interrupts with resume entries, prompting the user for tool approvals by the call the run streamed.tool_requestapproval prompt, which runs outside any run.--format jsonoutput is unchanged. The worker still accepts the legacyapproval_responseanduser_question_responsestdin lines, but the resume entry is the documented contract.docs/ag-ui-output.md,docs/browser-extension-protocol.mdand the sessions and computer READMEs describe the new contract.Verification
task test(with-race),task test:e2eandtask precommit:runpass locally.run_agent_inputrouting, the registry's resume contract (first resume wins, incomplete resume refused, late resume dropped), the Telegram adapter's run input and interrupt answers, and the e2e daemon approval flow over two clients.Out of scope
usageon a run's terminal event is session-cumulative, asresultwas before, rather than per run as the 1.0 prose prefers. Splitting it per run needs per-run token stats from the conversation repository.