Fix RPC extension UI session reconciliation for editor/newSession flows#127
Open
jorgeavaldez wants to merge 8 commits intodnouri:masterfrom
Open
Fix RPC extension UI session reconciliation for editor/newSession flows#127jorgeavaldez wants to merge 8 commits intodnouri:masterfrom
jorgeavaldez wants to merge 8 commits intodnouri:masterfrom
Conversation
55001f1 to
7a2cf41
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.
Fixes RPC-mode extension UX so extension-driven flows (for example the handoff extension) behave like the pi CLI.
Handoff flow:
There were three gaps affecting extension flows:
extension_ui_requestmethodeditorctx.newSession()editorresponses could fail when callbacks ran outside the chat buffer (e.g. temporary editor buffer context)What changed
Added full
extension_ui_requesteditor support:C-c C-csubmit,C-c C-kcancelFixed unsupported extension UI responses to always echo the original request
:id(for correct RPC correlation).Added extension session reconciliation after extension-driven UI actions:
get_state, compare previous/current session identity (session-file, fallbacksession-id)get_messageshistory and update usage/headerExpanded reconciliation triggers:
confirm/select/input/editor)set_editor_textagent_endfallback sync for hook/tool-driven session changesAdded handling for editor callbacks from non-chat buffers:
pi-coding-agent--extension-ui-send-responsenow accepts optionalchat-bufpi-coding-agent--extension-ui-sync-session-statenow accepts optionalproc/chat-bufValidation
Added/updated unit tests for:
set_editor_textagent_endfallback syncset_editor_textRender test suite passes when run against the local checkout.
Disclaimer: This pull request was put together with assistance from an LLM. I reviewed and revised it to the best of my abilities, and I do believe I have a solid understanding of how it works and why this is a good fix 😄