import type { BehaviorLookup } from '../graph/lookup'; import { resolveAssetProps } from '../properties/resolve'; import { findAsset, type Project } from './Project'; /** * What a `Run behavior` node needs from the project. `defaults` are the asset's variable values; * every call copies them, so a nested behavior never carries state from one call to the next. */ export function behaviorLookup(project: Project): BehaviorLookup { return (assetId) => { const asset = findAsset(project, assetId); if (!asset || asset.type !== 'behavior') return null; return { name: asset.name, graph: asset.graph, defaults: resolveAssetProps(asset) }; }; }