-
-
Notifications
You must be signed in to change notification settings - Fork 52.6k
Closed as not planned
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Request for message:sent and message:received hook events to enable response filtering/validation before messages are sent to users.
Use Case
I'm building a fact-checker middleware that validates AI responses before they reach the user. The goal is to catch "guessed" facts and force rewrites.
Currently, the hooks system supports:
command:new,command:reset,command:stopagent:bootstrapgateway:startuptool_result_persist
But there's no way to intercept outgoing messages.
Proposed Events
// Triggered before a message is sent to the user
// Handler can modify or reject the message
message:sent
// Triggered when a message is received from the user
// Handler can preprocess or filter
message:receivedExample Handler
const factCheckHandler: HookHandler = async (event) => {
if (event.type !== 'message' || event.action !== 'sent') return;
const result = await factChecker.check(event.context.message);
if (!result.passed) {
// Reject message, request rewrite
event.reject = true;
event.rejectReason = result.grund;
}
};Notes
I see these are already listed as "Future Events" in the docs. Any timeline for implementation?
Thanks for the great project! 🚀
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request