class HistoryLength
Parses request.history_length and applies history truncation to
the task loaded by FetchTask.
Sets env["a2a.history"]:
nilwhen history_length is 0 (exclude history)- truncated array when history_length > 0
- full history when history_length is not specified
Should be placed after FetchTask in the middleware stack so that
env["a2a.task"] is available.
Usage:
on "GetTask" do use A2A::Middleware::FetchTask, store: sqlite_store use A2A::Middleware::HistoryLength respond_with -> (env) { task = env["a2a.task"] history = env["a2a.history"] # ... } end