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
This commit is contained in:
@@ -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,
|
||||
},
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -19,7 +19,6 @@ export interface ReflexSocialState {
|
||||
lastSpeaker: string | null
|
||||
lastMessage: string | null
|
||||
lastMessageAt: number | null
|
||||
lastGreetingAtBySpeaker: Record<string, number>
|
||||
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 },
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user