ADR-004: PSR-14 Event System
- Status
-
Superseded
- Date
-
2024-02
- Superseded
-
2026 by ADR-026
- Authors
-
Netresearch DTT GmbH
Note
The PSR-14 events described below (Before /
After) were never implemented and no longer reflect
the request path. The separate
Classes/ does exist and reports record
writes; see Events. It is not a before-request/after-response hook. The extension points this ADR
set out to provide (request modification, response processing, cost tracking,
rate limiting) are delivered instead by the provider middleware pipeline
(ADR-026): Fallback, Budget,
Usage and Cache wrap every provider call. New
cross-cutting behaviour should be added as a middleware, not an event
listener. The original decision is kept below for historical context.
Context
Consumers need extension points for:
- Logging and monitoring.
- Request modification.
- Response processing.
- Cost tracking and rate limiting.
Decision
Use TYPO3's PSR-14 event system with events:
Before: Modify requests before sending.Request Event After: Process responses after receiving.Response Event
Events are dispatched by Llm and provide:
- Full context (messages, options, provider).
- Mutable options (before request).
- Response data (after response).
- Timing information.
Consequences
Positive:
- ●● Follows TYPO3 conventions.
- ●● Decoupled extension mechanism.
- ● Multiple listeners without modification.
- ● Testable event handlers.
Negative:
- ◑ Event overhead on every request.
- ◑ Listener ordering considerations.
- ◑ Debugging event flow complexity.
Net Score: +6.5 (Strong positive impact - standard TYPO3 integration with decoupled extensibility)