feat: add reasoning event support to Gemini CLI bridge#1236
Open
ambient-code[bot] wants to merge 1 commit intomainfrom
Open
feat: add reasoning event support to Gemini CLI bridge#1236ambient-code[bot] wants to merge 1 commit intomainfrom
ambient-code[bot] wants to merge 1 commit intomainfrom
Conversation
Add support for emitting REASONING_MESSAGE_START/CONTENT/END AG-UI events in the Gemini CLI adapter by parsing 'thinking' events from the NDJSON stream. This reuses the existing reasoning event models from the Claude SDK adapter. The Gemini CLI internally tracks thinking via GeminiEventType.Thought but does not yet surface it in the stream-json output format. This change prepares the adapter to handle thinking events as soon as upstream support is added, while remaining a no-op for current CLI versions. Closes #1127 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
Circuit breaker triggered (retry_count=3)This PR has been retried 3 times without receiving human review. All CI checks pass and there are no merge conflicts or review comments to address. Current state:
The PR is ready for human review. Labeling as |
Contributor
|
@ambient-code This is WRONG. you are using claude types in the gemini CLI. You MUST only use Gemini types in the gemini cli and vise versa for claude. research the gemini cli more |
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
ThinkingEventtype toag_ui_gemini_cli/types.pyto parsethinkingevents from the Gemini CLI NDJSON streamREASONING_START,REASONING_MESSAGE_START/CONTENT/END, andREASONING_ENDAG-UI event emission in the Gemini CLI adapter, reusing the existing reasoning event models fromag_ui_claude_sdk.reasoning_eventsContext
Investigation of the Gemini CLI source confirms that:
GeminiEventType.Thoughtevents withThoughtSummarydata (subject + description)ThinkingMessage.tsx)stream-jsonoutput format does not currently emit thinking events — thenonInteractiveCli.tsevent loop silently drops themJsonStreamEventTypeenum only has 6 types:init,message,tool_use,tool_result,error,resultThis PR prepares the adapter so it will automatically handle thinking events when the Gemini CLI adds
thinkingto its streaming JSON output. Until then, unknown event types are harmlessly ignored byparse_event().Test plan
thinkingsupport upstreamCloses #1127
🤖 Generated with Claude Code