import type { RuntimeOptions } from '../framework/runtime.js'; import { isClawclawRuntimeState } from './runtime-state.js'; export function isNotificationTurn(state: Record): boolean { return isClawclawRuntimeState(state) && state.cause === 'control' && state.control?.type === 'perception_notifications'; } /** A notification round has no fresh snapshot, backend tick, or new game action. */ export const clawclawNotificationFollowUp: NonNullable = (epoch, latest, events) => { if (!events.some(event => event.producerPluginId === 'clawclaw.behavior' && !event.notificationOf)) return; if (!isClawclawRuntimeState(latest.state)) return; return { scope: epoch.scope, sourceId: 'clawclaw.notification-turn', connectionId: latest.connectionId, sourceKey: `notification-after:${epoch.epochSeq}`, state: { ...latest.state, cause: 'control', control: { type: 'perception_notifications', after_epoch: epoch.epochSeq }, game_snapshot: { status: 'not_updated' } }, events: [], completeness: 'complete', coalescing: 'forbidden', receivedAt: new Date().toISOString(), }; };