chore(minecraft): rename EventType to EventCategory

This commit is contained in:
Rin
2026-02-18 11:10:00 +08:00
committed by Neko Ayaka
parent 15d6d5aa79
commit 90588bd65c
2 changed files with 7 additions and 7 deletions
@@ -1,4 +1,4 @@
import type { BotEvent, EventType } from '../types'
import type { BotEvent, EventCategory } from '../types'
import EventEmitter from 'eventemitter3'
@@ -8,7 +8,7 @@ export class EventManager {
public emit<T>(event: BotEvent<T>): void {
// TODO: Temporal Context tracking
// TODO: Salience Detection / Filtering noise
// Sort/Filter logic could go here in the future
if (!event.priority) {
event.priority = 0 // Default priority
@@ -18,15 +18,15 @@ export class EventManager {
this.emitter.emit('*', event)
}
public on<T>(type: EventType | '*', handler: (event: BotEvent<T>) => void): void {
public on<T>(type: EventCategory | '*', handler: (event: BotEvent<T>) => void): void {
this.emitter.on(type, handler)
}
public off<T>(type: EventType | '*', handler: (event: BotEvent<T>) => void): void {
public off<T>(type: EventCategory | '*', handler: (event: BotEvent<T>) => void): void {
this.emitter.off(type, handler)
}
public once<T>(type: EventType | '*', handler: (event: BotEvent<T>) => void): void {
public once<T>(type: EventCategory | '*', handler: (event: BotEvent<T>) => void): void {
this.emitter.once(type, handler)
}
}
+2 -2
View File
@@ -29,7 +29,7 @@ export interface CognitiveEngineOptions {
}
// TODO: currently stimulus is just chat events, consider renaming to 'input' or 'user_interaction'
export type EventType = 'stimulus' | 'perception' | 'feedback' | 'world_update' | 'system_alert'
export type EventCategory = 'stimulus' | 'perception' | 'feedback' | 'world_update' | 'system_alert'
export interface BotEventSource {
type: 'minecraft' | 'airi' | 'system'
@@ -38,7 +38,7 @@ export interface BotEventSource {
}
export interface BotEvent<T = any> {
type: EventType
type: EventCategory
payload: T
source: BotEventSource
timestamp: number