Class: Brute::Middleware::SlashCommands
- Defined in:
- lib/brute/middleware/001_slash_commands.rb
Overview
The head of every agent chain, put there by the builder itself rather
than by a use anyone writes. It switches on what was just said: the
newest message, and only when it is a user message, is offered to each
of env's checks in turn -- the commands registered with
AgentPipeline#map, which start puts there. The first check that
passes has its block run here, before the rest of the stack.
Brute.agent
.map("/compact") { |env| ... }
.run(->(env) { ... })
A command's block is a middleware, so what it leaves in env is what the rest of the chain works on.
Constant Summary
Constants included from Hooks
Hooks::COMPACT_DURATION_EVENT, Hooks::COMPACT_END_EVENT, Hooks::COMPACT_FAILURE_EVENT, Hooks::COMPACT_START_EVENT, Hooks::CONTENT_EVENT, Hooks::FARADAY_ERROR_EVENT, Hooks::LLM_DURATION_EVENT, Hooks::LLM_END_EVENT, Hooks::LLM_FAILURE_EVENT, Hooks::LLM_START_EVENT, Hooks::MIDDLEWARE_ADDED_EVENT, Hooks::MIDDLEWARE_DURATION_EVENT, Hooks::MIDDLEWARE_END_EVENT, Hooks::MIDDLEWARE_FAILURE_EVENT, Hooks::MIDDLEWARE_START_EVENT, Hooks::OPEN_ROUTER_SERVER_ERROR_EVENT, Hooks::REASONING_EVENT, Hooks::STANDARD_ERROR_EVENT, Hooks::TOOL_APPROVE_EVENT, Hooks::TOOL_CALLS_EVENT, Hooks::TOOL_DURATION_EVENT, Hooks::TOOL_END_EVENT, Hooks::TOOL_FAILURE_EVENT, Hooks::TOOL_START_EVENT, Hooks::TURN_DURATION_EVENT, Hooks::TURN_END_EVENT, Hooks::TURN_FAILURE_EVENT, Hooks::TURN_START_EVENT
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Brute::Middleware::Base
Instance Method Details
#call(env) ⇒ Object
22 23 24 25 |
# File 'lib/brute/middleware/001_slash_commands.rb', line 22 def call(env) matched(env)&.call(env) @app.call(env) end |