configureToolsetHandlers sets up elicitation and OAuth handlers for all toolsets of an agent.
(a *agent.Agent, events EventSink)
| 1158 | |
| 1159 | // configureToolsetHandlers sets up elicitation and OAuth handlers for all toolsets of an agent. |
| 1160 | func (r *LocalRuntime) configureToolsetHandlers(a *agent.Agent, events EventSink) { |
| 1161 | for _, toolset := range a.ToolSets() { |
| 1162 | tools.ConfigureHandlers(toolset, |
| 1163 | r.elicitationHandler, |
| 1164 | r.samplingHandler, |
| 1165 | func() { events.Emit(Authorization(tools.ElicitationActionAccept, a.Name())) }, |
| 1166 | r.managedOAuth, |
| 1167 | r.unmanagedOAuthRedirectURI, |
| 1168 | ) |
| 1169 | |
| 1170 | // Wire RAG event forwarding so the TUI shows indexing progress. |
| 1171 | // Use a non-blocking sink because the RAG file watcher is a |
| 1172 | // long-lived goroutine that may outlive the per-message events |
| 1173 | // channel; a blocking send after the channel is closed would |
| 1174 | // crash, and a blocking send when the consumer has gone away |
| 1175 | // would deadlock. |
| 1176 | if ragTool, ok := tools.As[ragtypes.EventForwarder](toolset); ok { |
| 1177 | ragTool.SetEventCallback(ragEventForwarder(ragTool.Name(), r, nonBlocking(events).Emit)) |
| 1178 | } |
| 1179 | } |
| 1180 | } |
| 1181 | |
| 1182 | // emitAgentWarnings drains and emits any pending toolset warnings as |
| 1183 | // persistent TUI notifications. Failures ("start failed", "list failed") |
no test coverage detected