-
Notifications
You must be signed in to change notification settings - Fork 0
Add Pi support for MCP, plugins, and subagents #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| package main | ||
|
|
||
| import "strings" | ||
|
|
||
| var piToolMapping = map[string]string{ | ||
| "bash": "bash", | ||
| "edit": "edit", | ||
| "glob": "find", | ||
| "grep": "grep", | ||
| "read": "read", | ||
| "webfetch": "fetch_content", | ||
| "websearch": "web_search", | ||
| "write": "write", | ||
| } | ||
|
|
||
| // renderPiAgentRole emits the user-agent format consumed by pi-subagents. | ||
| // Vanilla Pi itself ignores this directory when the extension is absent. | ||
| func renderPiAgentRole(role agentRole) string { | ||
| model := strings.TrimSpace(role.Pi.Model) | ||
| if model == "" && !canonicalModelTier(role.Model) { | ||
| model = strings.TrimSpace(role.Model) | ||
| } | ||
| thinking := strings.TrimSpace(role.Pi.Thinking) | ||
| if thinking == "" { | ||
| thinking = strings.TrimSpace(role.Effort) | ||
| } | ||
|
|
||
| var b strings.Builder | ||
| b.WriteString("---\n") | ||
| writeYAMLScalar(&b, "name", role.Name) | ||
| writeYAMLScalar(&b, "description", role.Description) | ||
| writeYAMLScalar(&b, "model", model) | ||
| writeYAMLScalar(&b, "thinking", thinking) | ||
| if tools := piToolsFor(role.Tools); len(tools) > 0 { | ||
| b.WriteString("tools:\n") | ||
| for _, tool := range tools { | ||
| writeYAMLListItem(&b, tool) | ||
| } | ||
| } | ||
| b.WriteString("---\n\n") | ||
| b.WriteString("<!-- ") | ||
| b.WriteString(generatedAgentMarker) | ||
| b.WriteString(" from ") | ||
| b.WriteString(agentRoleSourceLabel(role)) | ||
| b.WriteString("; do not edit directly. -->\n\n") | ||
| b.WriteString(role.Instructions) | ||
| b.WriteString("\n") | ||
| return b.String() | ||
| } | ||
|
|
||
| func piToolsFor(tools []string) []string { | ||
| out := make([]string, 0, len(tools)) | ||
| seen := make(map[string]struct{}, len(tools)) | ||
| for _, tool := range tools { | ||
| mapped := piToolMapping[strings.ToLower(strings.TrimSpace(tool))] | ||
| if mapped == "" { | ||
| continue | ||
| } | ||
| if _, ok := seen[mapped]; ok { | ||
| continue | ||
| } | ||
| seen[mapped] = struct{}{} | ||
| out = append(out, mapped) | ||
| } | ||
| return out | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
setupdetects Pi with an existing third-partypi-subagentsrole, this newly configured agent root makesscanNativeRolesoffer the role for import. After the user accepts, the canonical copy is created but the source remains unchanged; the firstrunSyncrenders a version containing the dotagents marker, classifies the original source as a non-managed conflict, and aborts setup. Accepted Pi role imports therefore cannot complete their required first sync and need to be recognized or otherwise reconciled without modifying the source.AGENTS.md reference: AGENTS.md:L17-L18
Useful? React with 👍 / 👎.