import { StrategyScriptRunner, type StrategyScriptRunnerOptions } from '@myclaw163/game-agent-runtime/strategy/strategy-script-runner.js'; import type { BehaviorInput, BehaviorDecision, BehaviorReadApi } from '../../../../sdk/behavior-plugin/index.js'; import { normalizeBehaviorDecision } from '../../behavior-decision.js'; import { createBehaviorReadApi } from '../../behavior-read-api.js'; import type { ClawclawBehaviorObservationSnapshot } from '../../behavior-observation-memory.js'; import type { ResolvedClawclawBehaviorSource } from './behavior-source.js'; import type { PreparedClawclawBehavior } from './behavior-normalization.js'; import { resolveDetailCapture } from '../../../observability/detail-capture.js'; import { CLAWCLAW_STRATEGY_WORKER_BRIDGE } from './behavior-worker-bridge.js'; export interface ClawclawBehaviorRunnerOptions extends Omit, 'bridge'|'createApi'|'normalize'|'inputMetadata'|'captureConfig'|'prepared'> { readonly prepared: PreparedClawclawBehavior } /** Only game read APIs, decision normalization and diagnostics are adapted here. */ export class ClawclawBehaviorRunner extends StrategyScriptRunner { declare readonly prepared:PreparedClawclawBehavior; constructor(options:ClawclawBehaviorRunnerOptions) { super({...options,bridge:CLAWCLAW_STRATEGY_WORKER_BRIDGE,createApi:createBehaviorReadApi, normalize:value=>normalizeBehaviorDecision(value) as BehaviorDecision,captureConfig:resolveDetailCapture(), inputMetadata:input=>({tick:input.gameState.tick,game_id:input.gameState.game_id})}); } }