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:
@@ -62,6 +62,7 @@ export const HookNameSchema = z.enum([
|
||||
"agent-usage-reminder",
|
||||
"non-interactive-env",
|
||||
"interactive-bash-session",
|
||||
"empty-message-sanitizer",
|
||||
])
|
||||
|
||||
export const AgentOverrideConfigSchema = z.object({
|
||||
|
||||
Reference in New Issue
Block a user