import { ThreadStrategyExecutor, prepareStrategyInWorker, type ThreadStrategyExecutorOptions, type StrategyThreadPreparation } from '@myclaw163/game-agent-runtime/strategy/thread-strategy-executor.js'; import type { BehaviorInput, BehaviorDecision, ClawclawBehaviorManifest } from '../../../../sdk/behavior-plugin/index.js'; import type { ClawclawBehaviorObservationSnapshot } from '../../behavior-observation-memory.js'; import type { ResolvedClawclawBehaviorSource } from './behavior-source.js'; import { CLAWCLAW_STRATEGY_WORKER_BRIDGE } from './behavior-worker-bridge.js'; export { PARALLEL_STRATEGY_THREAD_POOL_SIZE as PARALLEL_BEHAVIOR_THREAD_POOL_SIZE } from '@myclaw163/game-agent-runtime/strategy/thread-strategy-executor.js'; export type { ThreadStrategyExecutorSnapshot as ThreadBehaviorExecutorSnapshot } from '@myclaw163/game-agent-runtime/strategy/thread-strategy-executor.js'; export type ThreadBehaviorExecutorOptions = Omit, 'bridge' | 'inputMetadata'>; export type BehaviorThreadPreparation = StrategyThreadPreparation; export const prepareBehaviorInWorker = (source: ResolvedClawclawBehaviorSource, input: Readonly>, options: {maxOldGenerationSizeMb?: number; diagnosticsEnabled?: boolean; retainWorker?: boolean} = {}): Promise => prepareStrategyInWorker(source, input, {...options, bridge: CLAWCLAW_STRATEGY_WORKER_BRIDGE}); export class ThreadBehaviorExecutor extends ThreadStrategyExecutor { constructor(options: ThreadBehaviorExecutorOptions) { super({...options, bridge: CLAWCLAW_STRATEGY_WORKER_BRIDGE, inputMetadata: frame => frame.gameState.tick === undefined ? {} : {tick: frame.gameState.tick} }); } }