CLI: align PI runtime SDK stream contract#3274
Draft
chubes4 wants to merge 2 commits intounify-ai-runtimes-on-pifrom
Draft
CLI: align PI runtime SDK stream contract#3274chubes4 wants to merge 2 commits intounify-ai-runtimes-on-pifrom
chubes4 wants to merge 2 commits intounify-ai-runtimes-on-pifrom
Conversation
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.
Summary
turn_end, dedupe repeated assistant events, and treat PIstopReason: "error"as an SDK-style failed result.turn_end.Stack context
This is a draft stacked PR on top of Riad's PI runtime swap in #3246 (
unify-ai-runtimes-on-pi). It is not intended to land independently of that PR.It also builds on the eval-runner diagnostics that just landed in #3273. Those diagnostics made these runtime contract gaps visible in local SDK-vs-PI benchmarks: without these fixes, PI could look faster while failing to surface assistant output, provider errors, or tool execution in the SDK-shaped stream.
Why
Studio's UI, recorder, and eval tooling still consume an SDK-shaped message stream. This patch keeps the unified PI runtime compatible with that contract while preserving the PI branch's runtime direction.
The main compatibility fixes are:
turn_end.messagemay carry assistant output even when no separatemessage_endevent fired.stopReason: "error"should produce an SDK-style failed result, not a successful empty run.Testing
npm test -- apps/cli/ai/tests/pi-runtime.test.tsnpm -w wp-studio run typechecknpm run cli:build --silenthomeboy-rigseval scenarios:studio-agent-runtimestudio-agent-site-infoAI assistance