From 6a50bcf98e5b4c216601509740eba6a18a3f4f11 Mon Sep 17 00:00:00 2001 From: Rin Date: Mon, 9 Feb 2026 21:24:37 +0800 Subject: [PATCH] feat(minecraft): remove greeting reflex behavior and associated state tracking Remove greetingBehavior from reflex system, delete lastGreetingAtBySpeaker tracking from ReflexSocialState and context snapshot, unregister greeting behavior from ReflexManager, clean up stale comments about greeting behavior compatibility --- .../cognitive/reflex/behaviors/greeting.ts | 40 ------------------- .../minecraft/src/cognitive/reflex/context.ts | 7 +--- .../src/cognitive/reflex/reflex-manager.ts | 3 -- 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 services/minecraft/src/cognitive/reflex/behaviors/greeting.ts diff --git a/services/minecraft/src/cognitive/reflex/behaviors/greeting.ts b/services/minecraft/src/cognitive/reflex/behaviors/greeting.ts deleted file mode 100644 index 593511469..000000000 --- a/services/minecraft/src/cognitive/reflex/behaviors/greeting.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { ReflexBehavior } from '../types/behavior' - -export const greetingBehavior: ReflexBehavior = { - id: 'greeting', - modes: ['social'], - cooldownMs: 10_000, - when: (ctx) => { - const msg = ctx.social.lastMessage - if (!msg) - return false - - const lower = msg.toLowerCase().trim() - return lower === 'hi' || lower === 'hello' - }, - score: (ctx) => { - if (!ctx.social.lastSpeaker) - return 0 - - const lastGreetAt = ctx.social.lastGreetingAtBySpeaker[ctx.social.lastSpeaker] - if (lastGreetAt && ctx.now - lastGreetAt < 10_000) - return 0 - - return 10 - }, - run: ({ bot, context }) => { - const snap = context.getSnapshot() - const speaker = snap.social.lastSpeaker - if (!speaker) - return - - bot.bot.chat('Hi there! (Reflex)') - - context.updateSocial({ - lastGreetingAtBySpeaker: { - ...snap.social.lastGreetingAtBySpeaker, - [speaker]: snap.now, - }, - }) - }, -} diff --git a/services/minecraft/src/cognitive/reflex/context.ts b/services/minecraft/src/cognitive/reflex/context.ts index fbc3d911b..237095270 100644 --- a/services/minecraft/src/cognitive/reflex/context.ts +++ b/services/minecraft/src/cognitive/reflex/context.ts @@ -19,7 +19,6 @@ export interface ReflexSocialState { lastSpeaker: string | null lastMessage: string | null lastMessageAt: number | null - lastGreetingAtBySpeaker: Record lastGesture: string | null lastGestureAt: number | null } @@ -76,7 +75,6 @@ export class ReflexContext { lastSpeaker: null, lastMessage: null, lastMessageAt: null, - lastGreetingAtBySpeaker: {}, lastGesture: null, lastGestureAt: null, }, @@ -108,10 +106,7 @@ export class ReflexContext { nearbyPlayers: this.state.environment.nearbyPlayers.map(p => ({ ...p })), nearbyEntities: this.state.environment.nearbyEntities.map(e => ({ ...e })), }, - social: { - ...this.state.social, - lastGreetingAtBySpeaker: { ...this.state.social.lastGreetingAtBySpeaker }, - }, + social: { ...this.state.social }, threat: { ...this.state.threat }, attention: { ...this.state.attention }, autonomy: { ...this.state.autonomy }, diff --git a/services/minecraft/src/cognitive/reflex/reflex-manager.ts b/services/minecraft/src/cognitive/reflex/reflex-manager.ts index 2828fc76a..b4a1e4a7f 100644 --- a/services/minecraft/src/cognitive/reflex/reflex-manager.ts +++ b/services/minecraft/src/cognitive/reflex/reflex-manager.ts @@ -8,7 +8,6 @@ import type { MineflayerWithAgents } from '../types' import type { ReflexContextState } from './context' import { DebugService } from '../../debug' -import { greetingBehavior } from './behaviors/greeting' import { lookAtBehavior } from './behaviors/look-at' import { teabagBehavior } from './behaviors/teabag' import { ReflexRuntime } from './runtime' @@ -34,7 +33,6 @@ export class ReflexManager { onModeChange: () => this.emitReflexState(), }) - this.runtime.registerBehavior(greetingBehavior) this.runtime.registerBehavior(lookAtBehavior) this.runtime.registerBehavior(teabagBehavior) } @@ -161,7 +159,6 @@ export class ReflexManager { // If it's a chat message (simulated via signal for now, or direct?) // For now we rely on signal metadata or separate chat event. // Assuming 'signal:social:chat' or similar might exist later. - // For greeting behavior compatibility, we might need to map specific signals to social state. // Trigger behavior selection this.runtime.tick(bot, 0, this.deps.perception)