feat(hooks): add empty-message-sanitizer to prevent API errors from empty chat messages
Add new hook that uses the `experimental.chat.messages.transform` hook to prevent 'non-empty content' API errors by injecting placeholder text into empty messages BEFORE they're sent to the API. This is a preventive fix - unlike session-recovery which fixes errors after they occur, this hook prevents the error from happening by sanitizing messages before API transmission. Files: - src/hooks/empty-message-sanitizer/index.ts (new hook implementation) - src/hooks/index.ts (export hook function) - src/config/schema.ts (add hook to HookName type) - src/index.ts (wire up hook to plugin) 🤖 Generated with assistance of OhMyOpenCode (https://github.com/code-yeongyu/oh-my-opencode)
This commit is contained in:
@@ -19,3 +19,4 @@ export { createAgentUsageReminderHook } from "./agent-usage-reminder";
|
||||
export { createKeywordDetectorHook } from "./keyword-detector";
|
||||
export { createNonInteractiveEnvHook } from "./non-interactive-env";
|
||||
export { createInteractiveBashSessionHook } from "./interactive-bash-session";
|
||||
export { createEmptyMessageSanitizerHook } from "./empty-message-sanitizer";
|
||||
|
||||
Reference in New Issue
Block a user