import type {Json} from '../../../../types/bot/workflow/workflow.ts'; import type {WorkflowEventDefinition} from '../../../../types/bot/workflow/metadata.ts'; import * as message from './message.ts'; import * as chat from './chat.ts'; import * as whisper from './whisper.ts'; import * as spawn from './spawn.ts'; import * as health from './health.ts'; import * as custom from './custom.ts'; export const event_registry = {message, chat, whisper, spawn, health, custom} satisfies Record; export function normalize_event(event: string, args: unknown[]): Record | undefined { if (args.length > 32) return; if (Object.hasOwn(event_registry, event)) { const definition: WorkflowEventDefinition = event_registry[event as keyof typeof event_registry]; return definition.normalize(args); } return custom.normalize_custom_event(event, args); }