Skip to content

feat: middleware V2#125

Open
xavidop wants to merge 2 commits intoxavier/reflection-v2-apifrom
xavier/middleware-v2
Open

feat: middleware V2#125
xavidop wants to merge 2 commits intoxavier/reflection-v2-apifrom
xavier/middleware-v2

Conversation

@xavidop
Copy link
Copy Markdown
Collaborator

@xavidop xavidop commented Mar 29, 2026

Description

Re-design middleware to implement a v2 to wrap, generate, models and tools

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test improvements
  • CI/CD improvements

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • All existing tests pass

Checklist

  • My code follows the project's code style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Documentation

  • README updated
  • Plugin documentation updated
  • API documentation updated
  • Sample code updated

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the V2 GenerationMiddleware system, which provides granular hooks for the generation pipeline (Generate, Model, and Tool). It includes the core interfaces, parameter objects, and a base implementation, along with comprehensive tests and a new sample project. The Genkit class has been updated to support these hooks during generation, and a new ReflectionServerV2 has been implemented using WebSockets and JSON-RPC 2.0 for improved dev tool integration. Review feedback identified a critical bug in the action cancellation logic where all actions were interrupted regardless of trace ID, a missing implementation for streaming in the reflection server, and a failure to collect tools provided by middleware.

@xavidop xavidop changed the base branch from main to xavier/reflection-v2-api March 29, 2026 23:17
@xavidop xavidop changed the title Xavier/middleware v2 feat: middleware V2 Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant