Class: AgUi::Middleware::ForwardedProps

Inherits:
Object
  • Object
show all
Defined in:
lib/ag_ui/middleware/forwarded_props.rb

Overview

Exposes RunAgentInput.forwardedProps on the turn env so downstream middleware and the terminal can honor client-driven knobs — most importantly toolChoice ("function", function: {name}), which the suggestions engine uses to force copilotkitSuggest.

Instance Method Summary collapse

Constructor Details

#initialize(app, props: nil) ⇒ ForwardedProps

Returns a new instance of ForwardedProps.



13
14
15
16
# File 'lib/ag_ui/middleware/forwarded_props.rb', line 13

def initialize(app, props: nil)
  @app = app
  @props = props
end

Instance Method Details

#call(env) ⇒ Object



18
19
20
21
# File 'lib/ag_ui/middleware/forwarded_props.rb', line 18

def call(env)
  env[:forwarded_props] = @props
  @app.call(env)
end