Add Pi message parsing infrastructure#831
Draft
dersam wants to merge 1 commit intodersam/pi-provider-skeletonfrom
Draft
Add Pi message parsing infrastructure#831dersam wants to merge 1 commit intodersam/pi-provider-skeletonfrom
dersam wants to merge 1 commit intodersam/pi-provider-skeletonfrom
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Mar 2, 2026
Parse Pi's streaming JSON protocol into structured message objects, mirroring the Claude provider's message architecture. Message types implemented: - SessionMessage: Initial session metadata (id, version, cwd) - AgentStartMessage: Agent execution has begun - AgentEndMessage: Agent execution complete with full conversation; extracts final response, model, and usage from last assistant message - TurnStartMessage: New request/response cycle started - TurnEndMessage: Turn complete with usage stats per model - MessageStartMessage: User or assistant message starting - MessageUpdateMessage: Streaming deltas (text_delta, text_start/end, toolcall_start/delta/end) with format() for progress display - MessageEndMessage: Message complete with final content and usage - ToolExecutionStartMessage / ToolExecutionEndMessage: Tool execution - UnknownMessage: Catch-all for unrecognized types The Message base class provides a from_json/from_hash factory that dispatches to the appropriate subclass. PiInvocation now uses the Message classes instead of raw hash parsing. 91 new tests (119 total Pi provider tests), full suite passes (985).
cc37153 to
ca2f382
Compare
07b9833 to
f7587c7
Compare
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.

Parse Pi's streaming JSON protocol into structured message objects,
mirroring the Claude provider's message architecture.
Message types implemented:
extracts final response, model, and usage from last assistant message
toolcall_start/delta/end) with format() for progress display
The Message base class provides a from_json/from_hash factory that
dispatches to the appropriate subclass. PiInvocation now uses the
Message classes instead of raw hash parsing.
91 new tests (119 total Pi provider tests), full suite passes (985).