{"version":3,"file":"voice-property-names.mjs","names":[],"sources":["../../../src/codemods/v1/voice-property-names.ts"],"sourcesContent":["import { createTransformer } from '../lib/create-transformer';\n\n/**\n * Transforms voice property names in Agent configuration:\n * - speakProvider → output\n * - listenProvider → input\n * - realtimeProvider → realtime\n *\n * Only transforms properties within new Agent({ voice: { ... } })\n */\nexport default createTransformer((_fileInfo, _api, _options, context) => {\n  const { j, root } = context;\n\n  // Map of old property names to new property names\n  const propertyRenames: Record<string, string> = {\n    speakProvider: 'output',\n    listenProvider: 'input',\n    realtimeProvider: 'realtime',\n  };\n\n  // Find all new Agent({ ... }) expressions and transform in one pass\n  root\n    .find(j.NewExpression, {\n      callee: { type: 'Identifier', name: 'Agent' },\n    })\n    .forEach(agentPath => {\n      const configArg = agentPath.node.arguments[0];\n      if (!configArg || configArg.type !== 'ObjectExpression' || !configArg.properties) return;\n\n      // Find the voice property in the Agent config object\n      configArg.properties.forEach((prop: any) => {\n        if (\n          (prop.type === 'Property' || prop.type === 'ObjectProperty') &&\n          prop.key?.type === 'Identifier' &&\n          prop.key.name === 'voice' &&\n          prop.value?.type === 'ObjectExpression' &&\n          prop.value.properties\n        ) {\n          // Now rename properties within the voice object\n          prop.value.properties.forEach((voiceProp: any) => {\n            if (\n              (voiceProp.type === 'Property' || voiceProp.type === 'ObjectProperty') &&\n              voiceProp.key?.type === 'Identifier'\n            ) {\n              const oldName = voiceProp.key.name;\n              const newName = propertyRenames[oldName];\n\n              if (newName) {\n                voiceProp.key.name = newName;\n                context.hasChanges = true;\n              }\n            }\n          });\n        }\n      });\n    });\n\n  if (context.hasChanges) {\n    context.messages.push(\n      `Transformed voice property names: speakProvider/listenProvider/realtimeProvider → output/input/realtime`,\n    );\n  }\n});\n"],"mappings":";;;;;;;;;;AAUA,IAAA,+BAAe,mBAAmB,WAAW,MAAM,UAAU,YAAY;CACvE,MAAM,EAAE,GAAG,SAAS;CAGpB,MAAM,kBAA0C;EAC9C,eAAe;EACf,gBAAgB;EAChB,kBAAkB;CACpB;CAGA,KACG,KAAK,EAAE,eAAe,EACrB,QAAQ;EAAE,MAAM;EAAc,MAAM;CAAQ,EAC9C,CAAC,CAAC,CACD,SAAQ,cAAa;EACpB,MAAM,YAAY,UAAU,KAAK,UAAU;EAC3C,IAAI,CAAC,aAAa,UAAU,SAAS,sBAAsB,CAAC,UAAU,YAAY;EAGlF,UAAU,WAAW,SAAS,SAAc;GAC1C,KACG,KAAK,SAAS,cAAc,KAAK,SAAS,qBAC3C,KAAK,KAAK,SAAS,gBACnB,KAAK,IAAI,SAAS,WAClB,KAAK,OAAO,SAAS,sBACrB,KAAK,MAAM,YAGX,KAAK,MAAM,WAAW,SAAS,cAAmB;IAChD,KACG,UAAU,SAAS,cAAc,UAAU,SAAS,qBACrD,UAAU,KAAK,SAAS,cACxB;KACA,MAAM,UAAU,UAAU,IAAI;KAC9B,MAAM,UAAU,gBAAgB;KAEhC,IAAI,SAAS;MACX,UAAU,IAAI,OAAO;MACrB,QAAQ,aAAa;KACvB;IACF;GACF,CAAC;EAEL,CAAC;CACH,CAAC;CAEH,IAAI,QAAQ,YACV,QAAQ,SAAS,KACf,yGACF;AAEJ,CAAC"}