feat: add Pi coding agent source#3
Merged
Merged
Conversation
Adds OpenCode as a second trace source alongside Claude Code. Introduces Source enum, multi-source Input dispatch, opencode message normalizer, pi-ready state keys, and an OpenCode TypeScript plugin. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Update gather_env_tags to accept source and agent_version parameters.
Add version probing for all three sources (ClaudeCode, Opencode, PiAgent):
- ProbeCommand will run only when agent_version is not provided
- Push version tag in format "{source.version_tag_prefix()}:{version}"
- Include new tests for each source variant
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implement normalize_pi_agent_messages converting Pi agent session entries (user, assistant, toolResult roles) into the Claude-format shape expected by turns::build_turns, with thinking-block suppression and tool-result correlation following the opencode.rs pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds comprehensive integration test for Pi Agent message flow covering user messages, assistant messages with tool calls, and tool results. Test verifies proper normalization, turn building, and event emission for the pi-agent source. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add support for installing Pi Agent extension alongside the existing OpenCode plugin support. Includes --pi/-p flag, pi detection, and automatic or prompted installation to ~/.pi/agent/extensions. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add Pi Agent as a third input source in the architecture section. Document the pi_agent normalizer and pi extension in key files. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <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.
Summary
@earendil-works/pi-coding-agent) as a third trace source alongside Claude Code and OpenCodeplugin/pi-agent/code-trace.tsthat hooks Pi'sagent_endevent and pushes new session entries to thecode-tracebinary via stdin (push model, symmetric with the existing OpenCode plugin)src/pi_agent.rsnormalizer that converts Pi's session entry format (flat role-based entries withtoolCall/toolResulttypes) into the Claude-formatValueshape thatturns::build_turnsalready understandsinstall.shwith--pi/-pflag and auto-detect for~/.pi/agentTest Plan
cargo test)cargo clippy --all-targets -- -D warnings)end_to_end_pi_agent_transcriptintegration test covers user → assistant with tool_use → toolResult pipelineTRACE_TO_LANGFUSE=true, run a session, verify trace appears in Langfuse under "Pi Agent - Turn N"🤖 Generated with Claude Code