@mastra/voice-openai-realtime 0.14.9 → 0.14.10-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/dist/_types/{@internal_voice@0.0.45/dist/_types/@internal_ai-sdk-v5@0.0.96 → @internal_voice@0.0.47/dist/_types/@internal_ai-sdk-v5@0.0.98}/dist/index.d.ts +61 -2
  2. package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/aisdk/speech.d.ts +1 -1
  3. package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/aisdk/transcription.d.ts +1 -1
  4. package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/composite-voice.d.ts +1 -1
  5. package/dist/docs/SKILL.md +2 -2
  6. package/dist/docs/assets/SOURCE_MAP.json +1 -1
  7. package/dist/docs/references/integrations-voice-openai.md +4 -4
  8. package/dist/docs/references/reference-voice-voice.close.md +1 -1
  9. package/dist/docs/references/reference-voice-voice.connect.md +1 -1
  10. package/dist/index.cjs +0 -2
  11. package/dist/index.d.ts +2 -2
  12. package/dist/index.js +0 -2
  13. package/dist/utils.d.ts +1 -1
  14. package/package.json +8 -7
  15. package/dist/index.cjs.map +0 -1
  16. package/dist/index.d.ts.map +0 -1
  17. package/dist/index.js.map +0 -1
  18. package/dist/utils.d.ts.map +0 -1
  19. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/@internal_core@0.1.4/dist/base/index.d.ts +0 -0
  20. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/@internal_core@0.1.4/dist/index-Diz1p9N7.d.ts +0 -0
  21. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/@internal_core@0.1.4/dist/request-context/index.d.ts +0 -0
  22. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/@internal_core@0.1.4/dist/types/index.d.ts +0 -0
  23. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/ZodError.d.ts +0 -0
  24. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/errors.d.ts +0 -0
  25. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/external.d.ts +0 -0
  26. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/helpers/enumUtil.d.ts +0 -0
  27. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/helpers/errorUtil.d.ts +0 -0
  28. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/helpers/parseUtil.d.ts +0 -0
  29. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/helpers/partialUtil.d.ts +0 -0
  30. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/helpers/typeAliases.d.ts +0 -0
  31. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/helpers/util.d.ts +0 -0
  32. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/index.d.ts +0 -0
  33. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/locales/en.d.ts +0 -0
  34. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/standard-schema.d.ts +0 -0
  35. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v3/types.d.ts +0 -0
  36. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/checks.d.ts +0 -0
  37. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/coerce.d.ts +0 -0
  38. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/compat.d.ts +0 -0
  39. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/deep-partial.d.ts +0 -0
  40. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/errors.d.ts +0 -0
  41. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/external.d.ts +0 -0
  42. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/from-json-schema.d.ts +0 -0
  43. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/in-out.d.ts +0 -0
  44. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/index.d.ts +0 -0
  45. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/iso.d.ts +0 -0
  46. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/parse.d.ts +0 -0
  47. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/classic/schemas.d.ts +0 -0
  48. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/api.d.ts +0 -0
  49. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/checks.d.ts +0 -0
  50. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/compile.d.ts +0 -0
  51. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/core.d.ts +0 -0
  52. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/doc.d.ts +0 -0
  53. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/errors.d.ts +0 -0
  54. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/index.d.ts +0 -0
  55. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/json-schema-generator.d.ts +0 -0
  56. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/json-schema-processors.d.ts +0 -0
  57. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/json-schema.d.ts +0 -0
  58. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/memoizer.d.ts +0 -0
  59. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/parse.d.ts +0 -0
  60. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/regexes.d.ts +0 -0
  61. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/registries.d.ts +0 -0
  62. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/schemas.d.ts +0 -0
  63. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/standard-schema.d.ts +0 -0
  64. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/to-json-schema.d.ts +0 -0
  65. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/util.d.ts +0 -0
  66. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/core/versions.d.ts +0 -0
  67. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/index.d.cts +0 -0
  68. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ar.d.ts +0 -0
  69. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/az.d.ts +0 -0
  70. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/be.d.ts +0 -0
  71. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/bg.d.ts +0 -0
  72. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/bn.d.ts +0 -0
  73. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ca.d.ts +0 -0
  74. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ckb.d.ts +0 -0
  75. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/cs.d.ts +0 -0
  76. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/da.d.ts +0 -0
  77. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/de.d.ts +0 -0
  78. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/el.d.ts +0 -0
  79. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/en.d.ts +0 -0
  80. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/eo.d.ts +0 -0
  81. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/es.d.ts +0 -0
  82. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/fa.d.ts +0 -0
  83. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/fi.d.ts +0 -0
  84. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/fr-CA.d.ts +0 -0
  85. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/fr.d.ts +0 -0
  86. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/gu.d.ts +0 -0
  87. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/he.d.ts +0 -0
  88. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/hi.d.ts +0 -0
  89. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/hr.d.ts +0 -0
  90. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/hu.d.ts +0 -0
  91. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/hy.d.ts +0 -0
  92. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/id.d.ts +0 -0
  93. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/index.d.ts +0 -0
  94. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/is.d.ts +0 -0
  95. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/it.d.ts +0 -0
  96. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ja.d.ts +0 -0
  97. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ka.d.ts +0 -0
  98. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/kh.d.ts +0 -0
  99. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/km.d.ts +0 -0
  100. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/kn.d.ts +0 -0
  101. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ko.d.ts +0 -0
  102. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/lt.d.ts +0 -0
  103. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/mk.d.ts +0 -0
  104. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ms.d.ts +0 -0
  105. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ne.d.ts +0 -0
  106. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/nl.d.ts +0 -0
  107. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/nn.d.ts +0 -0
  108. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/no.d.ts +0 -0
  109. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ota.d.ts +0 -0
  110. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/pl.d.ts +0 -0
  111. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ps.d.ts +0 -0
  112. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/pt-BR.d.ts +0 -0
  113. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/pt.d.ts +0 -0
  114. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ro.d.ts +0 -0
  115. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ru.d.ts +0 -0
  116. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/sk.d.ts +0 -0
  117. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/sl.d.ts +0 -0
  118. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/sv.d.ts +0 -0
  119. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ta.d.ts +0 -0
  120. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/tg.d.ts +0 -0
  121. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/th.d.ts +0 -0
  122. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/tk.d.ts +0 -0
  123. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/tr.d.ts +0 -0
  124. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ua.d.ts +0 -0
  125. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/uk.d.ts +0 -0
  126. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/ur.d.ts +0 -0
  127. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/uz.d.ts +0 -0
  128. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/vi.d.ts +0 -0
  129. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/yo.d.ts +0 -0
  130. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/zh-CN.d.ts +0 -0
  131. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/_types/zod@4.6.7/v4/locales/zh-TW.d.ts +0 -0
  132. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/index.d.ts +0 -0
  133. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/aisdk/index.d.ts +0 -0
  134. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/default-voice.d.ts +0 -0
  135. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/index.d.ts +0 -0
  136. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/dist/voice/voice.d.ts +0 -0
  137. /package/dist/_types/{@internal_voice@0.0.45 → @internal_voice@0.0.47}/package.json +0 -0
@@ -200,9 +200,11 @@ declare namespace _ai_sdk_provider_utils {
200
200
  getRuntimeEnvironmentUserAgent,
201
201
  injectJsonInstructionIntoMessages,
202
202
  isAbortError,
203
+ isArrayBuffer,
203
204
  isBrowserRuntime,
204
205
  isParsableJson,
205
206
  isSameOrigin,
207
+ isUint8Array,
206
208
  isUrlSupported,
207
209
  isValidator,
208
210
  jsonSchema,
@@ -224,7 +226,9 @@ declare namespace _ai_sdk_provider_utils {
224
226
  resolve,
225
227
  safeParseJSON,
226
228
  safeValidateTypes,
229
+ secureJsonParse,
227
230
  standardSchemaValidator,
231
+ stringifyWithBigIntAndCycles,
228
232
  tool,
229
233
  validateDownloadUrl,
230
234
  validateTypes,
@@ -2178,7 +2182,7 @@ declare type FetchFunction = typeof globalThis.fetch;
2178
2182
  * Redirects are rejected by default. Callers using `redirect: 'manual'` must
2179
2183
  * validate the Location target before issuing another request.
2180
2184
  */
2181
- declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, }: {
2185
+ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, trustedOrigin, redirect, requireDnsValidation, }: {
2182
2186
  url: string | URL;
2183
2187
  init?: RequestInit;
2184
2188
  fetch?: FetchFunction;
@@ -2188,6 +2192,11 @@ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, tru
2188
2192
  */
2189
2193
  trustedOrigin?: string;
2190
2194
  redirect?: 'error' | 'manual';
2195
+ /**
2196
+ * Reject untrusted URLs on server runtimes without a DNS-pinned default
2197
+ * transport unless an explicit custom fetch provides equivalent validation.
2198
+ */
2199
+ requireDnsValidation?: boolean;
2191
2200
  }): Promise<Response>;
2192
2201
 
2193
2202
  /**
@@ -2199,6 +2208,12 @@ declare function fetchWithValidatedEndpoint({ url, init, fetch: customFetch, tru
2199
2208
  * target (e.g. an internal address) before we ever see its URL, defeating the
2200
2209
  * SSRF guard.
2201
2210
  *
2211
+ * Manually followed redirects from HTTPS to HTTP are rejected before requesting
2212
+ * the target.
2213
+ *
2214
+ * All caller headers except User-Agent are dropped on cross-origin redirects.
2215
+ * Callers must decide which credentials may be sent to the initial URL.
2216
+ *
2202
2217
  * A `redirect: 'manual'` request yields an unreadable opaque response in the
2203
2218
  * browser (and in other spec-compliant fetch implementations), so the redirect
2204
2219
  * target cannot be validated here. In a real browser this is safe to follow
@@ -3029,13 +3044,44 @@ export declare interface GenerateTextResult<TOOLS extends ToolSet, OUTPUT> {
3029
3044
 
3030
3045
  declare function getErrorMessage(error: unknown | undefined): string;
3031
3046
 
3032
- declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, }: {
3047
+ declare const getFromApi: <T>({ url, headers, successfulResponseHandler, failedResponseHandler, abortSignal, fetch, validateUrl, credentialedOrigin, trustedOrigin, }: {
3033
3048
  url: string;
3034
3049
  headers?: Record<string, string | undefined>;
3035
3050
  failedResponseHandler: ResponseHandler<Error>;
3036
3051
  successfulResponseHandler: ResponseHandler<T>;
3037
3052
  abortSignal?: AbortSignal;
3038
3053
  fetch?: FetchFunction;
3054
+ /**
3055
+ * Set `true` when `url` is untrusted (e.g. taken from a provider response
3056
+ * body): it is routed through {@link fetchWithValidatedRedirects}, which
3057
+ * rejects private/loopback/link-local targets and re-validates redirect
3058
+ * hops; blocked URLs throw `DownloadError`. Set `false` only for URLs built
3059
+ * from a developer-configured endpoint.
3060
+ *
3061
+ * Optional for backwards compatibility with existing callers; omitting it
3062
+ * behaves like `false` (no validation).
3063
+ */
3064
+ validateUrl?: boolean;
3065
+ /**
3066
+ * When set, `headers` are sent only if `url` is same-origin with this origin
3067
+ * (the user-agent suffix is always kept). Pass the provider's configured
3068
+ * base URL alongside `validateUrl: true` so credentials never ride a request
3069
+ * to a response-supplied host on a different origin (e.g. a CDN). Redirects
3070
+ * that later cross origin drop all caller headers regardless (see
3071
+ * {@link fetchWithValidatedRedirects}).
3072
+ */
3073
+ credentialedOrigin?: string;
3074
+ /**
3075
+ * A developer-configured origin (e.g. the provider's `baseURL`) that is
3076
+ * exempt from URL validation when `validateUrl` is `true`. A response URL
3077
+ * (or redirect hop) that is same-origin with it is fetched without target
3078
+ * validation — it points at exactly the host a config-derived
3079
+ * `validateUrl: false` request would fetch anyway, so blocking it would
3080
+ * only break legitimate self-hosted / localhost deployments whose response
3081
+ * URLs point back at the configured host. Hops on any other origin are
3082
+ * still validated. Must never be derived from response data.
3083
+ */
3084
+ trustedOrigin?: string;
3039
3085
  }) => Promise<{
3040
3086
  value: T;
3041
3087
  rawValue?: unknown;
@@ -3524,6 +3570,8 @@ export declare class InvalidToolInputError extends AISDKError {
3524
3570
 
3525
3571
  declare function isAbortError(error: unknown): error is Error;
3526
3572
 
3573
+ declare function isArrayBuffer(value: unknown): value is ArrayBuffer;
3574
+
3527
3575
  /**
3528
3576
  * Returns `true` when running in a browser.
3529
3577
  *
@@ -3585,6 +3633,8 @@ export declare function isToolOrDynamicToolUIPart<TOOLS extends UITools>(part: U
3585
3633
 
3586
3634
  export declare function isToolUIPart<TOOLS extends UITools>(part: UIMessagePart<UIDataTypes, TOOLS>): part is ToolUIPart<TOOLS>;
3587
3635
 
3636
+ declare function isUint8Array(value: unknown): value is Uint8Array;
3637
+
3588
3638
  /**
3589
3639
  * Checks if the given URL is supported natively by the model.
3590
3640
  *
@@ -5833,6 +5883,8 @@ export declare type Schema<OBJECT = unknown> = Validator<OBJECT> & {
5833
5883
  */
5834
5884
  declare const schemaSymbol: unique symbol;
5835
5885
 
5886
+ declare function secureJsonParse(text: string): any;
5887
+
5836
5888
  export declare class SerialJobExecutor {
5837
5889
  private queue;
5838
5890
  private isProcessing;
@@ -7548,6 +7600,13 @@ export declare type StreamTextTransform<TOOLS extends ToolSet> = (options: {
7548
7600
  stopStream: () => void;
7549
7601
  }) => TransformStream<TextStreamPart<TOOLS>, TextStreamPart<TOOLS>>;
7550
7602
 
7603
+ /**
7604
+ * Serializes a value as JSON, representing BigInt values as decimal strings and
7605
+ * ancestor cycles as "[Circular]". Reused objects, toJSON methods, and other JSON
7606
+ * serialization behavior are preserved. Getters and toJSON methods may throw.
7607
+ */
7608
+ declare function stringifyWithBigIntAndCycles(value: unknown): string;
7609
+
7551
7610
  declare const symbol$1: unique symbol;
7552
7611
 
7553
7612
  declare const symbol$1_2: unique symbol;
@@ -1,4 +1,4 @@
1
- import type { SpeechModel } from '../../_types/@internal_ai-sdk-v5@0.0.96/dist/index.js';
1
+ import type { SpeechModel } from '../../_types/@internal_ai-sdk-v5@0.0.98/dist/index.js';
2
2
  import { MastraVoice } from '../voice.js';
3
3
  export declare class AISDKSpeech extends MastraVoice {
4
4
  private model;
@@ -1,4 +1,4 @@
1
- import type { TranscriptionModel } from '../../_types/@internal_ai-sdk-v5@0.0.96/dist/index.js';
1
+ import type { TranscriptionModel } from '../../_types/@internal_ai-sdk-v5@0.0.98/dist/index.js';
2
2
  import { MastraVoice } from '../voice.js';
3
3
  export declare class AISDKTranscription extends MastraVoice {
4
4
  private model;
@@ -1,4 +1,4 @@
1
- import type { TranscriptionModel, SpeechModel } from '../_types/@internal_ai-sdk-v5@0.0.96/dist/index.js';
1
+ import type { TranscriptionModel, SpeechModel } from '../_types/@internal_ai-sdk-v5@0.0.98/dist/index.js';
2
2
  import type { ToolsInput } from '../_types/@internal_core@0.1.4/dist/types/index.js';
3
3
  import { MastraVoice } from './voice.js';
4
4
  import type { IMastraVoice, VoiceEventType, VoiceEventMap } from '.';
@@ -3,7 +3,7 @@ name: mastra-voice-openai-realtime
3
3
  description: Documentation for @mastra/voice-openai-realtime. Use when working with @mastra/voice-openai-realtime APIs, configuration, or implementation.
4
4
  metadata:
5
5
  package: "@mastra/voice-openai-realtime"
6
- version: "0.14.9"
6
+ version: "0.14.10-alpha.1"
7
7
  ---
8
8
 
9
9
  ## When to use
@@ -23,7 +23,7 @@ Read the individual reference documents for detailed explanations and code examp
23
23
  - [Reference: voice.addInstructions()](references/reference-voice-voice.addInstructions.md) - The addInstructions() method equips a voice provider with instructions that guide the model's behavior during real-time interactions.
24
24
  - [Reference: voice.addTools()](references/reference-voice-voice.addTools.md) - The addTools() method equips a voice provider with tools (functions) that the model can call during real-time interactions.
25
25
  - [Reference: voice.answer()](references/reference-voice-voice.answer.md) - The answer() method is used in real-time voice providers to trigger the AI to generate a response.
26
- - [Reference: voice.close()](references/reference-voice-voice.close.md) - The close() method disconnects from a real-time voice service and cleans up resources. This is important for properly ending voice sessions and preventing resource leaks.
26
+ - [Reference: voice.close()](references/reference-voice-voice.close.md) - The close() method disconnects from a real-time voice service and cleans up resources. This is important for ending voice sessions and preventing resource leaks.
27
27
  - [Reference: voice.connect()](references/reference-voice-voice.connect.md) - The connect() method establishes a WebSocket or WebRTC connection for real-time speech-to-speech communication.
28
28
  - [Reference: voice.off()](references/reference-voice-voice.off.md) - The off() method removes event listeners previously registered with the on() method.
29
29
  - [Reference: voice.on()](references/reference-voice-voice.on.md) - Use voice.on() to register listeners for real-time voice events, including audio, transcripts, responses, errors, and connection changes.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.14.9",
2
+ "version": "0.14.10-alpha.1",
3
3
  "package": "@mastra/voice-openai-realtime",
4
4
  "exports": {
5
5
  "OpenAIRealtimeVoice": {
@@ -204,7 +204,7 @@ voice.connect()
204
204
 
205
205
  **speaker** (`string`): Default voice ID for speech synthesis. (Default: `'alloy'`)
206
206
 
207
- #### Voice Activity Detection (VAD) Configuration
207
+ #### Voice activity detection (VAD) configuration
208
208
 
209
209
  **type** (`string`): Type of VAD to use. Server-side VAD provides better accuracy. (Default: `'server_vad'`)
210
210
 
@@ -318,7 +318,7 @@ The OpenAIRealtimeVoice class emits the following events:
318
318
 
319
319
  **error** (`event`): Emitted when an error occurs. Callback receives the error object.
320
320
 
321
- #### OpenAI Realtime Events
321
+ #### OpenAI Realtime events
322
322
 
323
323
  Every server event received from the OpenAI Realtime API is also emitted with the `openAIRealtime:` prefix, using the [OpenAI server event type](https://platform.openai.com/docs/api-reference/realtime-server-events) as the suffix. The callback receives the complete event payload.
324
324
 
@@ -328,7 +328,7 @@ voice.on('openAIRealtime:rate_limits.updated', event => {
328
328
  })
329
329
  ```
330
330
 
331
- #### Socket Events
331
+ #### Socket events
332
332
 
333
333
  **open** (`event`): Emitted when the WebSocket connection to OpenAI opens.
334
334
 
@@ -354,5 +354,5 @@ The following voice options are available:
354
354
  - Server-side Voice Activity Detection (VAD) provides better accuracy for speech detection
355
355
  - All audio data is processed as Int16Array format
356
356
  - The voice instance must be connected with `connect()` before using other methods
357
- - Always call `close()` when done to properly clean up resources
357
+ - Always call `close()` when done to clean up resources
358
358
  - Memory management is handled by OpenAI Realtime API
@@ -4,7 +4,7 @@
4
4
 
5
5
  # voice.close()
6
6
 
7
- The `close()` method disconnects from a real-time voice service and cleans up resources. This is important for properly ending voice sessions and preventing resource leaks.
7
+ The `close()` method disconnects from a real-time voice service and cleans up resources. This is important for ending voice sessions and preventing resource leaks.
8
8
 
9
9
  ## Usage example
10
10
 
@@ -97,7 +97,7 @@ await voice.connect()
97
97
  - This method is only implemented by real-time voice providers that support speech-to-speech capabilities
98
98
  - Providers that inherit the base `connect()` implementation log a debug message and resolve without establishing a connection
99
99
  - The connection must be established before using other real-time methods like `send()` or `answer()`
100
- - When you're done with the voice instance, call `close()` to properly clean up resources
100
+ - When you're done with the voice instance, call `close()` to clean up resources
101
101
  - Some providers may automatically reconnect on connection loss, depending on their implementation
102
102
  - Connection errors will typically be thrown as exceptions that should be caught and handled
103
103
 
package/dist/index.cjs CHANGED
@@ -1162,5 +1162,3 @@ var OpenAIRealtimeVoice = class extends MastraVoice {
1162
1162
  }
1163
1163
  };
1164
1164
  exports.OpenAIRealtimeVoice = OpenAIRealtimeVoice;
1165
-
1166
- //# sourceMappingURL=index.cjs.map
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import type { ToolsInput, RequestContext } from './_types/@internal_voice@0.0.45/dist/index.js';
2
- import { MastraVoice } from './_types/@internal_voice@0.0.45/dist/index.js';
1
+ import type { ToolsInput, RequestContext } from './_types/@internal_voice@0.0.47/dist/index.js';
2
+ import { MastraVoice } from './_types/@internal_voice@0.0.47/dist/index.js';
3
3
  import type { Realtime } from 'openai-realtime-api';
4
4
  /**
5
5
  * Event callback function type
package/dist/index.js CHANGED
@@ -1161,5 +1161,3 @@ var OpenAIRealtimeVoice = class extends MastraVoice {
1161
1161
  }
1162
1162
  };
1163
1163
  export { OpenAIRealtimeVoice };
1164
-
1165
- //# sourceMappingURL=index.js.map
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { ToolsInput } from './_types/@internal_voice@0.0.45/dist/index.js';
1
+ import type { ToolsInput } from './_types/@internal_voice@0.0.47/dist/index.js';
2
2
  export type OpenAIExecuteFunction = (args: any) => Promise<any>;
3
3
  type ToolDefinition = {
4
4
  type: 'function';
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@mastra/voice-openai-realtime",
3
- "version": "0.14.9",
3
+ "version": "0.14.10-alpha.1",
4
4
  "description": "Mastra OpenAI Realtime API integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "files": [
9
- "dist"
9
+ "dist",
10
+ "!dist/**/*.d.*ts.map"
10
11
  ],
11
12
  "exports": {
12
13
  ".": {
@@ -24,8 +25,8 @@
24
25
  "license": "Apache-2.0",
25
26
  "dependencies": {
26
27
  "openai-realtime-api": "^1.0.8",
27
- "ws": "^8.22.0",
28
- "@mastra/schema-compat": "1.4.0"
28
+ "ws": "^8.23.0",
29
+ "@mastra/schema-compat": "1.4.1-alpha.0"
29
30
  },
30
31
  "devDependencies": {
31
32
  "@types/node": "22.19.15",
@@ -37,9 +38,9 @@
37
38
  "typescript": "^7.0.2",
38
39
  "vitest": "5.1.0",
39
40
  "zod": "^4.6.7",
40
- "@internal/lint": "0.0.149",
41
- "@internal/types-builder": "0.0.124",
42
- "@internal/voice": "0.0.45"
41
+ "@internal/lint": "0.0.151",
42
+ "@internal/types-builder": "0.0.126",
43
+ "@internal/voice": "0.0.47"
43
44
  },
44
45
  "peerDependencies": {
45
46
  "zod": "^3.25.0 || ^4.0.0"
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["Readable","standardSchemaToJSONSchema","toStandardSchema","EventEmitter","ws","WebSocket","PassThrough"],"sources":["../../../packages/_internal-core/dist/logger/index.js","../../../packages/_internal-core/dist/base/index.js","../../../packages/_internals/voice/dist/aisdk-c08VRfTf.js","../src/utils.ts","../src/index.ts"],"sourcesContent":["import { Transform } from \"stream\";\n// src/logger/adapter.ts\nfunction isAdaptableLogger(logger) {\n\treturn typeof logger.__attachObservability === \"function\";\n}\n/**\n* Export a tracked exception through the adapter sink, mirroring the\n* DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`\n* when present on a MastraError-like value). Never throws into the caller.\n*/\nfunction exportTrackedException(ctx, error, metadata) {\n\tif (!ctx?.options.export) return;\n\ttry {\n\t\tconst mastraError = error;\n\t\tctx.getLogSink()?.error(error.message, {\n\t\t\t...mastraError.id !== void 0 ? { errorId: mastraError.id } : {},\n\t\t\t...mastraError.domain !== void 0 ? { domain: mastraError.domain } : {},\n\t\t\t...mastraError.category !== void 0 ? { category: mastraError.category } : {},\n\t\t\t...mastraError.details !== void 0 ? { details: mastraError.details } : {},\n\t\t\t...error.cause instanceof Error ? { cause: error.cause.message } : {},\n\t\t\t...metadata\n\t\t});\n\t} catch {}\n}\n/**\n* Adapt IMastraLogger's variadic args into the structured `data` payload of\n* an exported log record. Extracts the first plain object as data,\n* serializes an Error arg, and collects remaining primitives under `args`\n* so the derived record preserves all context from the native call.\n*/\nfunction buildLogRecordData(args) {\n\tconst objectData = args.find((arg) => arg !== null && typeof arg === \"object\" && !Array.isArray(arg) && !(arg instanceof Error));\n\tconst errorArg = args.find((arg) => arg instanceof Error);\n\tconst extraArgs = args.filter((arg) => arg !== objectData && arg !== errorArg);\n\tif (!objectData && !errorArg && extraArgs.length === 0) return void 0;\n\treturn {\n\t\t...objectData ?? {},\n\t\t...errorArg ? { error: {\n\t\t\tname: errorArg.name,\n\t\t\tmessage: errorArg.message,\n\t\t\tstack: errorArg.stack\n\t\t} } : {},\n\t\t...extraArgs.length > 0 ? { args: extraArgs } : {}\n\t};\n}\n// src/logger/noop-logger.ts\nconst noopLogger = {\n\tdebug: () => {},\n\tinfo: () => {},\n\twarn: () => {},\n\terror: () => {},\n\tcleanup: async () => {},\n\tgetTransports: () => /* @__PURE__ */ new Map(),\n\ttrackException: () => {},\n\tlistLogs: async () => ({\n\t\tlogs: [],\n\t\ttotal: 0,\n\t\tpage: 1,\n\t\tperPage: 100,\n\t\thasMore: false\n\t}),\n\tlistLogsByRunId: async () => ({\n\t\tlogs: [],\n\t\ttotal: 0,\n\t\tpage: 1,\n\t\tperPage: 100,\n\t\thasMore: false\n\t})\n};\n// src/logger/index.ts\nconst RegisteredLogger = {\n\tAGENT: \"AGENT\",\n\tOBSERVABILITY: \"OBSERVABILITY\",\n\tAUTH: \"AUTH\",\n\tBROWSER: \"BROWSER\",\n\tNETWORK: \"NETWORK\",\n\tWORKFLOW: \"WORKFLOW\",\n\tLLM: \"LLM\",\n\tTTS: \"TTS\",\n\tVOICE: \"VOICE\",\n\tVECTOR: \"VECTOR\",\n\tBUNDLER: \"BUNDLER\",\n\tDEPLOYER: \"DEPLOYER\",\n\tMEMORY: \"MEMORY\",\n\tSTORAGE: \"STORAGE\",\n\tEMBEDDINGS: \"EMBEDDINGS\",\n\tMCP_SERVER: \"MCP_SERVER\",\n\tSERVER_CACHE: \"SERVER_CACHE\",\n\tSERVER: \"SERVER\",\n\tWORKSPACE: \"WORKSPACE\",\n\tCHANNEL: \"CHANNEL\"\n};\nconst LogLevel = {\n\tDEBUG: \"debug\",\n\tINFO: \"info\",\n\tWARN: \"warn\",\n\tERROR: \"error\",\n\tNONE: \"silent\"\n};\nvar LoggerTransport = class extends Transform {\n\tconstructor(opts = {}) {\n\t\tsuper({\n\t\t\t...opts,\n\t\t\tobjectMode: true\n\t\t});\n\t}\n\tasync listLogsByRunId(_args) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _args?.page ?? 1,\n\t\t\tperPage: _args?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n\tasync listLogs(_args) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _args?.page ?? 1,\n\t\t\tperPage: _args?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n};\nconst createCustomTransport = (stream, listLogs, listLogsByRunId) => {\n\tlet transport = stream;\n\tif (listLogs) transport.listLogs = listLogs;\n\tif (listLogsByRunId) transport.listLogsByRunId = listLogsByRunId;\n\treturn transport;\n};\nvar MastraLogger = class {\n\tname;\n\tlevel;\n\ttransports;\n\tconstructor(options = {}) {\n\t\tthis.name = options.name || \"Mastra\";\n\t\tthis.level = options.level || LogLevel.ERROR;\n\t\tthis.transports = new Map(Object.entries(options.transports || {}));\n\t}\n\tgetTransports() {\n\t\treturn this.transports;\n\t}\n\ttrackException(_error, _metadata) {}\n\tasync listLogs(transportId, params) {\n\t\tif (!transportId || !this.transports.has(transportId)) return {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: params?.page ?? 1,\n\t\t\tperPage: params?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t\treturn this.transports.get(transportId).listLogs?.(params) ?? {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: params?.page ?? 1,\n\t\t\tperPage: params?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n\tasync listLogsByRunId({ transportId, runId, fromDate, toDate, logLevel, filters, page, perPage }) {\n\t\tif (!transportId || !this.transports.has(transportId) || !runId) return {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: page ?? 1,\n\t\t\tperPage: perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t\treturn this.transports.get(transportId).listLogsByRunId?.({\n\t\t\trunId,\n\t\t\tfromDate,\n\t\t\ttoDate,\n\t\t\tlogLevel,\n\t\t\tfilters,\n\t\t\tpage,\n\t\t\tperPage\n\t\t}) ?? {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: page ?? 1,\n\t\t\tperPage: perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n};\nvar ConsoleLogger = class ConsoleLogger extends MastraLogger {\n\tcomponent;\n\tfilter;\n\t#adapterContext;\n\tconstructor(options = {}) {\n\t\tsuper(options);\n\t\tthis.component = options.component;\n\t\tthis.filter = options.filter;\n\t}\n\t/**\n\t* Adapter hook (see `AdaptableLogger`): enables native trace correlation\n\t* (trace_id/span_id appended to console output) and observability export\n\t* derived from the same record. Called by Mastra during setup.\n\t*/\n\t__attachObservability(ctx) {\n\t\tthis.#adapterContext = ctx;\n\t}\n\tchild(componentOrBindings) {\n\t\tconst component = typeof componentOrBindings === \"string\" ? componentOrBindings : componentOrBindings?.component ?? this.component;\n\t\tconst child = new ConsoleLogger({\n\t\t\tname: this.name,\n\t\t\tlevel: this.level,\n\t\t\tcomponent,\n\t\t\tfilter: this.filter\n\t\t});\n\t\tif (this.#adapterContext) child.__attachObservability(this.#adapterContext);\n\t\treturn child;\n\t}\n\t/**\n\t* Native-record correlation: when a span is active, append the trace\n\t* fields object to the console args so every destination sees them.\n\t*/\n\t#correlate(args) {\n\t\tconst ctx = this.#adapterContext;\n\t\tif (!ctx?.options.correlation) return args;\n\t\ttry {\n\t\t\tconst fields = ctx.resolveTraceFields();\n\t\t\treturn fields ? [...args, fields] : args;\n\t\t} catch {\n\t\t\treturn args;\n\t\t}\n\t}\n\t/**\n\t* Export the record derived from the same native call to observability.\n\t* Mirrors DualLogger semantics: export is independent of the console\n\t* level filter, and never throws into the caller.\n\t*/\n\t#export(level, message, args) {\n\t\tconst ctx = this.#adapterContext;\n\t\tif (!ctx?.options.export) return;\n\t\ttry {\n\t\t\tctx.getLogSink()?.[level](message, buildLogRecordData(args));\n\t\t} catch {}\n\t}\n\tshouldLog(level, message, args) {\n\t\tif (!this.filter) return true;\n\t\ttry {\n\t\t\treturn this.filter({\n\t\t\t\tcomponent: this.component,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\targs\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.error(`[Logger] Filter error for component=${this.component} level=${level}:`, e);\n\t\t\treturn true;\n\t\t}\n\t}\n\tprefix() {\n\t\treturn this.component ? `[${this.component}] ` : \"\";\n\t}\n\tdebug(message, ...args) {\n\t\tif (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"debug\", message, args);\n\t}\n\tinfo(message, ...args) {\n\t\tif ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"info\", message, args);\n\t}\n\twarn(message, ...args) {\n\t\tif ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args)) console.warn(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"warn\", message, args);\n\t}\n\terror(message, ...args) {\n\t\tif ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args)) console.error(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"error\", message, args);\n\t}\n\ttrackException(error, metadata) {\n\t\texportTrackedException(this.#adapterContext, error, metadata);\n\t}\n\tasync listLogs(_transportId, _params) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _params?.page ?? 1,\n\t\t\tperPage: _params?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n\tasync listLogsByRunId(_args) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _args.page ?? 1,\n\t\t\tperPage: _args.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n};\nexport { ConsoleLogger, LogLevel, LoggerTransport, MastraLogger, RegisteredLogger, buildLogRecordData, createCustomTransport, exportTrackedException, isAdaptableLogger, noopLogger };\n\n//# sourceMappingURL=index.js.map","import { ConsoleLogger, RegisteredLogger } from \"../logger/index.js\";\n// src/base/MastraBase.ts\nvar MastraBase = class {\n\tcomponent = RegisteredLogger.LLM;\n\tlogger;\n\tname;\n\t#rawConfig;\n\tconstructor({ component, name, rawConfig }) {\n\t\tthis.component = component || RegisteredLogger.LLM;\n\t\tthis.name = name;\n\t\tthis.#rawConfig = rawConfig;\n\t\tthis.logger = new ConsoleLogger({ name: `${this.component} - ${this.name}` });\n\t}\n\t/**\n\t* Returns the raw storage configuration this primitive was created from,\n\t* or undefined if it was created from code.\n\t*/\n\ttoRawConfig() {\n\t\treturn this.#rawConfig;\n\t}\n\t/**\n\t* Sets the raw storage configuration for this primitive.\n\t* @internal\n\t*/\n\t__setRawConfig(rawConfig) {\n\t\tthis.#rawConfig = rawConfig;\n\t}\n\t/**\n\t* Set the logger for the agent\n\t* @param logger\n\t*/\n\t__setLogger(logger) {\n\t\tthis.logger = \"child\" in logger && typeof logger.child === \"function\" ? logger.child({ component: this.component }) : logger;\n\t}\n};\nexport { MastraBase };\n\n//# sourceMappingURL=index.js.map","import { MastraBase } from \"@internal/core/base\";\nimport { PassThrough } from \"stream\";\nimport { experimental_generateSpeech, experimental_transcribe } from \"@internal/ai-sdk-v5\";\n// src/voice/voice.ts\nvar MastraVoice = class extends MastraBase {\n\tlisteningModel;\n\tspeechModel;\n\tspeaker;\n\trealtimeConfig;\n\tconstructor({ listeningModel, speechModel, speaker, realtimeConfig, name } = {}) {\n\t\tsuper({\n\t\t\tcomponent: \"VOICE\",\n\t\t\tname\n\t\t});\n\t\tthis.listeningModel = listeningModel;\n\t\tthis.speechModel = speechModel;\n\t\tthis.speaker = speaker;\n\t\tthis.realtimeConfig = realtimeConfig;\n\t}\n\t/**\n\t* Custom serialization for tracing/observability spans.\n\t* Excludes `apiKey` from listeningModel / speechModel / realtimeConfig\n\t* and any provider-specific state held by subclasses. Subclasses that\n\t* need to expose additional non-sensitive fields can override.\n\t*/\n\tserializeForSpan() {\n\t\treturn {\n\t\t\tcomponent: \"VOICE\",\n\t\t\tname: this.name,\n\t\t\tspeaker: this.speaker,\n\t\t\tlisteningModel: this.listeningModel ? { name: this.listeningModel.name } : void 0,\n\t\t\tspeechModel: this.speechModel ? { name: this.speechModel.name } : void 0,\n\t\t\trealtimeModel: this.realtimeConfig?.model\n\t\t};\n\t}\n\tupdateConfig(_options) {\n\t\tthis.logger.debug(\"updateConfig not implemented by this voice provider\");\n\t}\n\t/**\n\t* Initializes a WebSocket or WebRTC connection for real-time communication\n\t* @returns Promise that resolves when the connection is established\n\t*/\n\tasync connect(_options) {\n\t\tthis.logger.debug(\"connect not implemented by this voice provider\");\n\t}\n\t/**\n\t* Relay audio data to the voice provider for real-time processing\n\t* @param audioData Audio data to relay\n\t*/\n\tasync send(_audioData) {\n\t\tthis.logger.debug(\"relay not implemented by this voice provider\");\n\t}\n\t/**\n\t* Trigger voice providers to respond\n\t*/\n\tasync answer(_options) {\n\t\tthis.logger.debug(\"answer not implemented by this voice provider\");\n\t}\n\t/**\n\t* Equip the voice provider with instructions\n\t* @param instructions Instructions to add\n\t*/\n\taddInstructions(_instructions) {}\n\t/**\n\t* Equip the voice provider with tools\n\t* @param tools Array of tools to add\n\t*/\n\taddTools(_tools) {}\n\t/**\n\t* Disconnect from the WebSocket or WebRTC connection\n\t*/\n\tclose() {\n\t\tthis.logger.debug(\"close not implemented by this voice provider\");\n\t}\n\t/**\n\t* Register an event listener\n\t* @param event Event name (e.g., 'speaking', 'writing', 'error')\n\t* @param callback Callback function that receives event data\n\t*/\n\ton(_event, _callback) {\n\t\tthis.logger.debug(\"on not implemented by this voice provider\");\n\t}\n\t/**\n\t* Remove an event listener\n\t* @param event Event name (e.g., 'speaking', 'writing', 'error')\n\t* @param callback Callback function to remove\n\t*/\n\toff(_event, _callback) {\n\t\tthis.logger.debug(\"off not implemented by this voice provider\");\n\t}\n\t/**\n\t* Get available speakers/voices\n\t* @returns Array of available voice IDs and their metadata\n\t*/\n\tgetSpeakers() {\n\t\tthis.logger.debug(\"getSpeakers not implemented by this voice provider\");\n\t\treturn Promise.resolve([]);\n\t}\n\t/**\n\t* Get available speakers/voices\n\t* @returns Array of available voice IDs and their metadata\n\t*/\n\tgetListener() {\n\t\tthis.logger.debug(\"getListener not implemented by this voice provider\");\n\t\treturn Promise.resolve({ enabled: false });\n\t}\n};\n// src/voice/aisdk/speech.ts\nvar AISDKSpeech = class extends MastraVoice {\n\tmodel;\n\tdefaultVoice;\n\tconstructor(model, options) {\n\t\tsuper({ name: \"ai-sdk-speech\" });\n\t\tthis.model = model;\n\t\tthis.defaultVoice = options?.voice;\n\t}\n\tasync speak(input, options) {\n\t\tconst text = typeof input === \"string\" ? input : await this.streamToText(input);\n\t\tconst result = await experimental_generateSpeech({\n\t\t\tmodel: this.model,\n\t\t\ttext,\n\t\t\tvoice: options?.speaker || this.defaultVoice,\n\t\t\tlanguage: options?.language,\n\t\t\tproviderOptions: options?.providerOptions,\n\t\t\tabortSignal: options?.abortSignal,\n\t\t\theaders: options?.headers\n\t\t});\n\t\tconst stream = new PassThrough();\n\t\tstream.end(Buffer.from(result.audio.uint8Array));\n\t\treturn stream;\n\t}\n\tasync listen() {\n\t\tthrow new Error(\"AI SDK speech models do not support transcription. Use AISDKTranscription instead.\");\n\t}\n\tasync getSpeakers() {\n\t\treturn [];\n\t}\n\tasync getListener() {\n\t\treturn { enabled: false };\n\t}\n\tasync streamToText(stream) {\n\t\tconst chunks = [];\n\t\tfor await (const chunk of stream) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n\t\treturn Buffer.concat(chunks).toString(\"utf-8\");\n\t}\n};\n// src/voice/aisdk/transcription.ts\nvar AISDKTranscription = class extends MastraVoice {\n\tmodel;\n\tconstructor(model) {\n\t\tsuper({ name: \"ai-sdk-transcription\" });\n\t\tthis.model = model;\n\t}\n\tasync speak() {\n\t\tthrow new Error(\"AI SDK transcription models do not support text-to-speech. Use AISDKSpeech instead.\");\n\t}\n\tasync getSpeakers() {\n\t\treturn [];\n\t}\n\tasync getListener() {\n\t\treturn { enabled: true };\n\t}\n\t/**\n\t* Transcribe audio to text\n\t* For enhanced metadata (segments, language, duration), use AI SDK's transcribe() directly\n\t*/\n\tasync listen(audioStream, options) {\n\t\tconst audioBuffer = await this.convertToBuffer(audioStream);\n\t\treturn (await experimental_transcribe({\n\t\t\tmodel: this.model,\n\t\t\taudio: audioBuffer,\n\t\t\tproviderOptions: options?.providerOptions,\n\t\t\tabortSignal: options?.abortSignal,\n\t\t\theaders: options?.headers\n\t\t})).text;\n\t}\n\tasync convertToBuffer(audio) {\n\t\tif (Buffer.isBuffer(audio)) return audio;\n\t\tif (audio instanceof Uint8Array) return Buffer.from(audio);\n\t\tif (typeof audio === \"string\") return Buffer.from(audio, \"base64\");\n\t\tconst chunks = [];\n\t\tfor await (const chunk of audio) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n\t\treturn Buffer.concat(chunks);\n\t}\n};\nexport { AISDKSpeech as n, MastraVoice as r, AISDKTranscription as t };\n\n//# sourceMappingURL=aisdk-c08VRfTf.js.map","import { Readable } from 'node:stream';\nimport type { ToolsInput } from '@internal/voice';\nimport { standardSchemaToJSONSchema, toStandardSchema } from '@mastra/schema-compat/schema';\n\nexport type OpenAIExecuteFunction = (args: any) => Promise<any>;\ntype ToolDefinition = {\n type: 'function';\n name: string;\n description: string;\n parameters: {\n [key: string]: any;\n };\n};\n\ntype TTools = ToolsInput;\nexport const transformTools = (tools?: TTools) => {\n const openaiTools: { openaiTool: ToolDefinition; execute: OpenAIExecuteFunction }[] = [];\n for (const [name, tool] of Object.entries(tools || {})) {\n let parameters: { [key: string]: any };\n\n if ('inputSchema' in tool && tool.inputSchema) {\n parameters = toToolParameters(tool.inputSchema);\n } else if ('parameters' in tool) {\n parameters = toToolParameters(tool.parameters);\n } else {\n console.warn(`Tool ${name} has neither inputSchema nor parameters, skipping`);\n continue;\n }\n const openaiTool: ToolDefinition = {\n type: 'function',\n name,\n description: tool.description || `Tool: ${name}`,\n parameters,\n };\n\n if (tool.execute) {\n // Create an adapter function that works with both ToolAction and VercelTool execute functions\n const executeAdapter = async (args: any) => {\n try {\n if (!tool.execute) {\n throw new Error(`Tool ${name} has no execute function`);\n }\n\n // Both ToolAction (createTool) and VercelTool take the input data as the\n // first argument, matching @mastra/core's ToolExecuteFunction(inputData, context).\n return await tool.execute(args, {\n toolCallId: 'unknown',\n messages: [],\n });\n } catch (error) {\n console.error(`Error executing tool ${name}:`, error);\n throw error;\n }\n };\n openaiTools.push({ openaiTool, execute: executeAdapter });\n } else {\n console.warn(`Tool ${name} has no execute function, skipping`);\n }\n }\n return openaiTools;\n};\n\nexport const isReadableStream = (obj: unknown) => {\n return (\n obj &&\n obj instanceof Readable &&\n typeof obj.read === 'function' &&\n typeof obj.pipe === 'function' &&\n obj.readable === true\n );\n};\n\nfunction toToolParameters(schema: unknown): { [key: string]: any } {\n const parameters = standardSchemaToJSONSchema(toStandardSchema(schema as never), { io: 'input' }) as {\n [key: string]: any;\n };\n delete parameters.$schema;\n return parameters;\n}\n","import { EventEmitter } from 'node:events';\nimport { PassThrough } from 'node:stream';\nimport type { ToolsInput, RequestContext } from '@internal/voice';\nimport { MastraVoice } from '@internal/voice';\nimport type { Realtime, RealtimeServerEvents } from 'openai-realtime-api';\nimport { WebSocket } from 'ws';\nimport { isReadableStream, transformTools } from './utils';\n\n/**\n * Event callback function type\n */\ntype EventCallback = (...args: any[]) => void;\n\ntype StreamWithId = PassThrough & { id: string };\n\n/**\n * Map of event types to their callback arrays\n */\ntype EventMap = {\n transcribing: [{ text: string }];\n writing: [{ text: string }];\n speaking: [{ audio: string }];\n speaker: [StreamWithId];\n error: [Error];\n} & {\n [key: string]: EventCallback[];\n};\n\n/** Default voice for text-to-speech. 'alloy' provides a neutral, balanced voice suitable for most use cases */\nconst DEFAULT_VOICE: Realtime.Voice = 'alloy';\n\nconst DEFAULT_TRANSCRIBER: Realtime.AudioTranscriptionModel = 'whisper-1';\n\nconst DEFAULT_URL = 'wss://api.openai.com/v1/realtime';\n\n/**\n * Default model for real-time voice interactions.\n * This model is optimized for low-latency responses while maintaining high quality output.\n */\nconst DEFAULT_MODEL = 'gpt-realtime-2.1-mini';\n\n// /**\n// * Default Voice Activity Detection (VAD) configuration.\n// * These settings control how the system detects speech segments.\n// *\n// * @property {string} type - Uses server-side VAD for better accuracy\n// * @property {number} threshold - Speech detection sensitivity (0.5 = balanced)\n// * @property {number} prefix_padding_ms - Includes 1 second of audio before speech\n// * @property {number} silence_duration_ms - Waits 1 second of silence before ending turn\n// */\n// const DEFAULT_VAD_CONFIG = {\n// type: 'server_vad',\n// threshold: 0.5,\n// prefix_padding_ms: 1000,\n// silence_duration_ms: 1000,\n// } as Realtime.TurnDetection;\n\ntype TTools = ToolsInput;\n\n/**\n * Available voice options for text-to-speech.\n * Each voice has unique characteristics suitable for different use cases:\n * - alloy: Neutral and balanced\n * - echo: Warm and natural\n * - shimmer: Clear and expressive\n * - And more...\n */\nconst VOICES = ['alloy', 'ash', 'ballad', 'coral', 'echo', 'sage', 'shimmer', 'verse'];\n\ntype RealtimeClientServerEventMap = {\n [K in RealtimeServerEvents.EventType]: [RealtimeServerEvents.EventMap[K]];\n} & {\n ['conversation.item.input_audio_transcription.delta']: [{ delta: string; item_id: string; content_index: number }];\n ['conversation.item.input_audio_transcription.completed']: [\n { transcript: string; item_id: string; content_index: number; usage?: unknown },\n ];\n ['response.output_audio.delta']: [{ delta: string; response_id: string }];\n ['response.output_audio.done']: [{ response_id: string }];\n ['response.output_audio_transcript.delta']: [{ delta: string; response_id: string }];\n ['response.output_audio_transcript.done']: [{ response_id: string }];\n ['response.output_text.delta']: [{ delta: string; response_id: string }];\n ['response.output_text.done']: [{ response_id: string }];\n};\n\n/**\n * OpenAIRealtimeVoice provides real-time voice interaction capabilities using OpenAI's\n * WebSocket-based API. It supports:\n * - Real-time text-to-speech\n * - Speech-to-text (transcription)\n * - Voice activity detection\n * - Multiple voice options\n * - Event-based audio streaming\n *\n * The class manages WebSocket connections, audio streaming, and event handling\n * for seamless voice interactions.\n *\n * @extends MastraVoice\n *\n * @example\n * ```typescript\n * const voice = new OpenAIRealtimeVoice({\n * apiKey: process.env.OPENAI_API_KEY,\n * model: 'gpt-realtime-2.1-mini'\n * });\n *\n * await voice.open();\n * voice.on('speaking', (audioData) => {\n * // Handle audio data\n * });\n *\n * await voice.speak('Hello, how can I help you today?');\n * ```\n */\nexport class OpenAIRealtimeVoice extends MastraVoice {\n private ws?: WebSocket;\n private state: 'close' | 'open';\n private client: EventEmitter<RealtimeClientServerEventMap>;\n private events: EventMap;\n private instructions?: string;\n private tools?: TTools;\n private debug: boolean;\n private queue: unknown[] = [];\n private sessionReady = false;\n private transcriber: Realtime.AudioTranscriptionModel;\n private requestContext?: RequestContext;\n private connectionAbort?: AbortController;\n private speakerStreams = new Map<string, StreamWithId>();\n /**\n * Creates a new instance of OpenAIRealtimeVoice.\n *\n * @param options - Configuration options for the voice instance\n * @param options.url - The base URL for the OpenAI Realtime API\n * @param options.model - The model ID to use (defaults to gpt-realtime-2.1-mini)\n * @param options.apiKey - OpenAI API key. Falls back to process.env.OPENAI_API_KEY\n * @param options.speaker - Voice ID to use (defaults to 'alloy')\n * @param options.debug - Enable debug mode\n *\n * @example\n * ```typescript\n * const voice = new OpenAIRealtimeVoice({\n * apiKey: 'your-api-key',\n * model: 'gpt-realtime-2.1-mini',\n * speaker: 'alloy'\n * });\n * ```\n */\n constructor(\n private options: {\n model?: string;\n url?: string;\n apiKey?: string;\n speaker?: Realtime.Voice;\n transcriber?: Realtime.AudioTranscriptionModel;\n debug?: boolean;\n /** Maximum connection handshake duration in milliseconds. Defaults to 15,000. */\n connectTimeoutMs?: number;\n } = {},\n ) {\n super();\n\n if (\n options.connectTimeoutMs !== undefined &&\n (!Number.isFinite(options.connectTimeoutMs) ||\n options.connectTimeoutMs <= 0 ||\n options.connectTimeoutMs > 2_147_483_647)\n ) {\n throw new Error('connectTimeoutMs must be a positive finite number no greater than 2147483647');\n }\n\n this.client = new EventEmitter();\n this.state = 'close';\n this.events = {} as EventMap;\n this.speaker = options.speaker || DEFAULT_VOICE;\n this.transcriber = options.transcriber || DEFAULT_TRANSCRIBER;\n this.debug = options.debug || false;\n }\n\n /**\n * Returns a list of available voice speakers.\n *\n * @returns Promise resolving to an array of voice objects, each containing at least a voiceId\n *\n * @example\n * ```typescript\n * const speakers = await voice.getSpeakers();\n * // speakers = [{ voiceId: 'alloy' }, { voiceId: 'echo' }, ...]\n * ```\n */\n getSpeakers(): Promise<Array<{ voiceId: string; [key: string]: any }>> {\n return Promise.resolve(VOICES.map(v => ({ voiceId: v })));\n }\n\n /**\n * Disconnects from the OpenAI realtime session and cleans up resources.\n * Should be called when you're done with the voice instance.\n *\n * @example\n * ```typescript\n * voice.close(); // Disconnects and cleans up\n * ```\n */\n close() {\n if (!this.ws) return;\n this.ws.close();\n this.state = 'close';\n this.closeSpeakerStreams();\n }\n\n /**\n * Equips the voice instance with a set of instructions.\n * Instructions allow the model to perform additional actions during conversations.\n *\n * @param instructions - Optional instructions to addInstructions\n * @returns Transformed instructions ready for use with the model\n *\n * @example\n * ```typescript\n * voice.addInstructions('You are a helpful assistant.');\n * ```\n */\n addInstructions(instructions?: string) {\n this.instructions = instructions;\n }\n\n /**\n * Equips the voice instance with a set of tools.\n * Tools allow the model to perform additional actions during conversations.\n *\n * @param tools - Optional tools configuration to addTools\n * @returns Transformed tools configuration ready for use with the model\n *\n * @example\n * ```typescript\n * const tools = {\n * search: async (query: string) => { ... },\n * calculate: (expression: string) => { ... }\n * };\n * voice.addTools(tools);\n * ```\n */\n addTools(tools?: TTools) {\n this.tools = tools || {};\n }\n\n /**\n * Emits a speaking event using the configured voice model.\n * Can accept either a string or a readable stream as input.\n *\n * @param input - The text to convert to speech, or a readable stream containing the text\n * @param options - Optional configuration for this specific speech request\n * @param options.speaker - Override the voice to use for this specific request\n *\n * @throws {Error} If the input text is empty\n *\n * @example\n * ```typescript\n * // Simple text to speech\n * await voice.speak('Hello world');\n *\n * // With custom voice\n * await voice.speak('Hello world', { speaker: 'echo' });\n *\n * // Using a stream\n * const stream = fs.createReadStream('text.txt');\n * await voice.speak(stream);\n * ```\n */\n async speak(input: string | NodeJS.ReadableStream, options?: { speaker?: Realtime.Voice }): Promise<void> {\n if (typeof input !== 'string') {\n const chunks: Buffer[] = [];\n for await (const chunk of input) {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));\n }\n input = Buffer.concat(chunks).toString('utf-8');\n }\n\n if (input.trim().length === 0) {\n throw new Error('Input text is empty');\n }\n\n this.sendEvent('response.create', {\n response: {\n instructions: `Repeat the following text: ${input}`,\n voice: options?.speaker ? options.speaker : undefined,\n },\n });\n }\n\n /**\n * Updates the session configuration for the voice instance.\n * This can be used to modify voice settings, turn detection, and other parameters.\n *\n * @param sessionConfig - New session configuration to apply\n *\n * @example\n * ```typescript\n * voice.updateConfig({\n * voice: 'echo',\n * turn_detection: {\n * type: 'server_vad',\n * threshold: 0.5,\n * silence_duration_ms: 1000\n * }\n * });\n * ```\n */\n updateConfig(sessionConfig: unknown): void {\n this.sendEvent('session.update', { session: sessionConfig });\n }\n\n /**\n * Checks if listening capabilities are enabled.\n *\n * @returns {Promise<{ enabled: boolean }>}\n */\n async getListener() {\n return { enabled: true };\n }\n\n /**\n * Processes audio input for speech recognition.\n * Takes a readable stream of audio data and emits a writing event.\n * The output of the writing event is int16 audio data.\n *\n * @param audioData - Readable stream containing the audio data to process\n * @param options - Optional configuration for audio processing\n *\n * @throws {Error} If the audio data format is not supported\n *\n * @example\n * ```typescript\n * // Process audio from a file\n * const audioStream = fs.createReadStream('audio.raw');\n * await voice.listen(audioStream);\n *\n * // Process audio with options\n * await voice.listen(microphoneStream, {\n * format: 'int16',\n * sampleRate: 24000\n * });\n * ```\n */\n async listen(audioData: NodeJS.ReadableStream): Promise<void> {\n if (isReadableStream(audioData)) {\n const chunks: Buffer[] = [];\n for await (const chunk of audioData) {\n const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n chunks.push(buffer);\n }\n\n const buffer = Buffer.concat(chunks);\n const int16Array = new Int16Array(buffer.buffer, buffer.byteOffset ?? 0, (buffer.byteLength ?? 0) / 2);\n const base64Audio = this.int16ArrayToBase64(int16Array);\n\n this.sendEvent('conversation.item.create', {\n item: {\n type: 'message',\n role: 'user',\n content: [{ type: 'input_audio', audio: base64Audio }],\n },\n });\n\n this.sendEvent('response.create', {\n response: {\n modalities: ['text'],\n instructions: `ONLY repeat the input and DO NOT say anything else`,\n },\n });\n } else {\n this.emit('error', new Error('Unsupported audio data format'));\n }\n }\n\n waitForOpen(): Promise<void> {\n return this.waitForHandshake('open');\n }\n\n waitForSessionCreated(): Promise<void> {\n return this.waitForHandshake('session.created');\n }\n\n private waitForHandshake(event: 'open' | 'session.created'): Promise<void> {\n const ws = this.ws;\n const signal = this.connectionAbort?.signal;\n return new Promise((resolve, reject) => {\n if (!ws) {\n reject(new Error('WebSocket not initialized'));\n return;\n }\n if (signal?.aborted) {\n reject(signal.reason);\n return;\n }\n if (ws.readyState === WebSocket.CLOSED || ws.readyState === WebSocket.CLOSING) {\n reject(new Error('OpenAI realtime WebSocket is closed'));\n return;\n }\n if (event === 'open' && ws.readyState === WebSocket.OPEN) {\n resolve();\n return;\n }\n\n const cleanup = () => {\n clearTimeout(timer);\n ws.removeListener('open', onReady);\n ws.removeListener('error', onError);\n ws.removeListener('close', onClose);\n this.client.removeListener('session.created', onReady);\n this.client.removeListener('error', onProtocolError);\n signal?.removeEventListener('abort', onAbort);\n };\n const onReady = () => {\n cleanup();\n resolve();\n };\n const onError = (error: Error) => {\n cleanup();\n reject(error);\n };\n const onClose = (code: number, reason: Buffer) =>\n onError(new Error(`OpenAI realtime WebSocket closed during handshake (${code}: ${reason.toString()})`));\n const onProtocolError = (event: RealtimeServerEvents.EventMap['error']) =>\n onError(new Error(event.error.message, { cause: event.error }));\n const onAbort = () => onError(signal!.reason);\n const timeoutMs = this.options.connectTimeoutMs ?? 15_000;\n const timer = setTimeout(\n () => onError(new Error(`OpenAI realtime connection timed out after ${timeoutMs}ms`)),\n timeoutMs,\n );\n\n if (event === 'open') ws.once('open', onReady);\n else this.client.once('session.created', onReady);\n ws.once('error', onError);\n ws.once('close', onClose);\n this.client.once('error', onProtocolError);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n }\n\n /**\n * Establishes a connection to the OpenAI realtime service.\n * Must be called before using speak, listen, or relay functions.\n *\n * @throws {Error} If connection fails or session creation times out\n *\n * @example\n * ```typescript\n * await voice.open();\n * // Now ready for voice interactions\n * ```\n */\n async connect({ requestContext }: { requestContext?: RequestContext } = {}) {\n const url = `${this.options.url || DEFAULT_URL}?model=${this.options.model || DEFAULT_MODEL}`;\n const apiKey = this.options.apiKey || process.env.OPENAI_API_KEY;\n this.requestContext = requestContext;\n\n this.ws = new WebSocket(url, undefined, {\n headers: {\n Authorization: 'Bearer ' + apiKey,\n },\n });\n\n const ws = this.ws;\n this.state = 'close';\n this.sessionReady = false;\n this.client.removeAllListeners();\n this.closeSpeakerStreams();\n const controller = new AbortController();\n this.connectionAbort = controller;\n this.setupEventListeners();\n try {\n await Promise.all([this.waitForOpen(), this.waitForSessionCreated()]);\n } catch (error) {\n controller.abort(error);\n this.state = 'close';\n this.ws = undefined;\n ws.close();\n throw error;\n } finally {\n this.connectionAbort = undefined;\n }\n\n this.sessionReady = true;\n const openaiTools = transformTools(this.tools);\n this.updateConfig({\n type: 'realtime',\n instructions: this.instructions,\n tools: openaiTools.map(t => t.openaiTool),\n audio: {\n input: {\n transcription: {\n model: this.transcriber,\n },\n },\n output: {\n voice: this.speaker,\n },\n },\n });\n this.state = 'open';\n }\n\n disconnect() {\n this.state = 'close';\n this.connectionAbort?.abort(new Error('OpenAI realtime connection disconnected during handshake'));\n this.ws?.close();\n this.closeSpeakerStreams();\n }\n\n /**\n * Streams audio data in real-time to the OpenAI service.\n * Useful for continuous audio streaming scenarios like live microphone input.\n * Must be in 'open' state before calling this method.\n *\n * @param audioData - Readable stream of audio data to relay\n * @throws {Error} If audio format is not supported\n *\n * @example\n * ```typescript\n * // First connect\n * await voice.open();\n *\n * // Then relay audio\n * const micStream = getMicrophoneStream();\n * await voice.relay(micStream);\n * ```\n */\n async send(audioData: NodeJS.ReadableStream | Int16Array, eventId?: string): Promise<void> {\n if (!this.state || this.state !== 'open') {\n console.warn('Cannot relay audio when not open. Call open() first.');\n return;\n }\n\n if (isReadableStream(audioData)) {\n const stream = audioData as NodeJS.ReadableStream;\n stream.on('data', chunk => {\n try {\n const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n this.sendEvent('input_audio_buffer.append', { audio: buffer.toString('base64'), event_id: eventId });\n } catch (err) {\n this.emit('error', err);\n }\n });\n } else if (audioData instanceof Int16Array) {\n try {\n const base64Audio = this.int16ArrayToBase64(audioData);\n this.sendEvent('input_audio_buffer.append', { audio: base64Audio, event_id: eventId });\n } catch (err) {\n this.emit('error', err);\n }\n } else {\n this.emit('error', new Error('Unsupported audio data format'));\n }\n }\n\n /**\n * Sends a response to the OpenAI Realtime API.\n *\n * Trigger a response to the real-time session.\n *\n * @param {Object} params - The parameters object\n * @param {Realtime.ResponseConfig} params.options - Configuration options for the response\n * @returns {Promise<void>} A promise that resolves when the response has been sent\n *\n * @example\n * // Send a simple text response\n * await realtimeVoice.answer({\n * options: {\n * content: \"Hello, how can I help you today?\",\n * voice: \"alloy\"\n * }\n * });\n */\n async answer({ options }: { options?: Realtime.ResponseConfig }) {\n this.sendEvent('response.create', { response: options ?? {} });\n }\n\n /**\n * Registers an event listener for voice events.\n * Voice events include 'speaking', 'writing', and 'error'.\n * Supported native input events use their unprefixed OpenAI names:\n * 'input_audio_buffer.speech_started', 'input_audio_buffer.speech_stopped',\n * and 'conversation.item.input_audio_transcription.completed'.\n * These native events deliver the complete received payload, including transcription usage when present.\n * Every server event is also emitted as 'openAIRealtime:<event.type>', and the socket emits 'open' and 'close'.\n *\n * @param event - Name of the event to listen for\n * @param callback - Function to call when the event occurs\n *\n * @example\n * ```typescript\n * // Listen for speech events\n * voice.on('speaking', (audioData: Int16Array) => {\n * // Handle audio data\n * });\n *\n * // Handle errors\n * voice.on('error', (error: Error) => {\n * console.error('Voice error:', error);\n * });\n * ```\n */\n on(event: string, callback: EventCallback): void {\n if (!this.events[event]) {\n this.events[event] = [];\n }\n this.events[event].push(callback);\n }\n\n /**\n * Removes a previously registered event listener.\n *\n * @param event - Name of the event to stop listening to\n * @param callback - The specific callback function to remove\n *\n * @example\n * ```typescript\n * // Create event handler\n * const handleSpeech = (audioData: Int16Array) => {\n * // Handle audio data\n * };\n *\n * // Add listener\n * voice.on('speaking', handleSpeech);\n *\n * // Later, remove the listener\n * voice.off('speaking', handleSpeech);\n * ```\n */\n off(event: string, callback: EventCallback): void {\n if (!this.events[event]) return;\n\n const index = this.events[event].indexOf(callback);\n if (index !== -1) {\n this.events[event].splice(index, 1);\n }\n }\n\n /**\n * Emit an event with arguments\n * @param event Event name\n * @param args Arguments to pass to the callbacks\n */\n private emit(event: string, ...args: any[]): void {\n if (!this.events[event]) return;\n\n for (const callback of this.events[event]) {\n callback(...args);\n }\n }\n\n private closeSpeakerStreams(): void {\n for (const stream of this.speakerStreams.values()) {\n if (!stream.writableEnded) stream.end();\n }\n this.speakerStreams.clear();\n }\n\n private setupEventListeners(): void {\n const speakerStreams = this.speakerStreams;\n const userTranscriptionDeltaItems = new Set<string>();\n\n if (!this.ws) {\n throw new Error('WebSocket not initialized');\n }\n\n const ws = this.ws;\n ws.on('error', error => {\n if (this.ws === ws) this.emit('error', error);\n });\n ws.on('open', () => {\n if (this.ws === ws) this.emit('open');\n });\n ws.on('close', (code, reason) => {\n if (this.ws !== ws) return;\n this.state = 'close';\n this.sessionReady = false;\n this.closeSpeakerStreams();\n this.emit('close', { code, reason: reason.toString() });\n });\n ws.on('message', message => {\n if (this.ws !== ws) return;\n const data = JSON.parse(message.toString());\n this.client.emit(data.type, data);\n this.emit(`openAIRealtime:${data.type}`, data);\n\n if (this.debug) {\n const { delta, ...fields } = data;\n console.info(data.type, fields, delta?.length < 100 ? delta : '');\n }\n });\n\n this.client.on('session.created', ev => {\n this.emit('session.created', ev);\n\n this.sessionReady = true;\n const queue = this.queue.splice(0, this.queue.length);\n for (const ev of queue) {\n this.ws?.send(JSON.stringify(ev));\n }\n });\n this.client.on('session.updated', ev => {\n this.emit('session.updated', ev);\n });\n this.client.on('input_audio_buffer.speech_started', ev => {\n this.emit('input_audio_buffer.speech_started', ev);\n });\n this.client.on('input_audio_buffer.speech_stopped', ev => {\n this.emit('input_audio_buffer.speech_stopped', ev);\n });\n this.client.on('response.created', ev => {\n this.emit('response.created', ev);\n\n const speakerStream = new PassThrough() as StreamWithId;\n\n speakerStream.id = ev.response.id;\n\n speakerStreams.set(ev.response.id, speakerStream);\n this.emit('speaker', speakerStream);\n });\n this.client.on('conversation.item.input_audio_transcription.delta', ev => {\n userTranscriptionDeltaItems.add(ev.item_id);\n this.emit('writing', { text: ev.delta, response_id: ev.item_id, role: 'user' });\n });\n this.client.on('conversation.item.input_audio_transcription.completed', ev => {\n this.emit('conversation.item.input_audio_transcription.completed', ev);\n if (!userTranscriptionDeltaItems.has(ev.item_id) && ev.transcript) {\n this.emit('writing', { text: ev.transcript, response_id: ev.item_id, role: 'user' });\n }\n userTranscriptionDeltaItems.delete(ev.item_id);\n this.emit('writing', { text: '\\n', response_id: ev.item_id, role: 'user' });\n });\n const handleAudioDelta = (ev: { delta: string; response_id: string }) => {\n const audio = Buffer.from(ev.delta, 'base64');\n this.emit('speaking', { audio, response_id: ev.response_id });\n\n const stream = speakerStreams.get(ev.response_id);\n stream?.write(audio);\n };\n const handleAudioDone = (ev: { response_id: string }) => {\n this.emit('speaking.done', { response_id: ev.response_id });\n\n const stream = speakerStreams.get(ev.response_id);\n stream?.end();\n };\n const handleAudioTranscriptDelta = (ev: { delta: string; response_id: string }) => {\n this.emit('writing', { text: ev.delta, response_id: ev.response_id, role: 'assistant' });\n };\n const handleAudioTranscriptDone = (ev: { response_id: string }) => {\n this.emit('writing', { text: '\\n', response_id: ev.response_id, role: 'assistant' });\n };\n const handleTextDelta = (ev: { delta: string; response_id: string }) => {\n this.emit('writing', { text: ev.delta, response_id: ev.response_id, role: 'assistant' });\n };\n const handleTextDone = (ev: { response_id: string }) => {\n this.emit('writing', { text: '\\n', response_id: ev.response_id, role: 'assistant' });\n };\n this.client.on('response.audio.delta', handleAudioDelta);\n this.client.on('response.output_audio.delta', handleAudioDelta);\n this.client.on('response.audio.done', handleAudioDone);\n this.client.on('response.output_audio.done', handleAudioDone);\n this.client.on('response.audio_transcript.delta', handleAudioTranscriptDelta);\n this.client.on('response.output_audio_transcript.delta', handleAudioTranscriptDelta);\n this.client.on('response.audio_transcript.done', handleAudioTranscriptDone);\n this.client.on('response.output_audio_transcript.done', handleAudioTranscriptDone);\n this.client.on('response.text.delta', handleTextDelta);\n this.client.on('response.output_text.delta', handleTextDelta);\n this.client.on('response.text.done', handleTextDone);\n this.client.on('response.output_text.done', handleTextDone);\n this.client.on('response.done', async ev => {\n // Responses without audio (tool-call-only turns, text modality, or cancelled before any audio)\n // never send output_audio.done, so end the stream here. Do it before running tools so a slow\n // or failing tool cannot hold the stream open.\n const stream = speakerStreams.get(ev.response.id);\n if (stream && !stream.writableEnded) stream.end();\n speakerStreams.delete(ev.response.id);\n\n await this.handleFunctionCalls(ev);\n this.emit('response.done', ev);\n });\n this.client.on('error', async ev => {\n this.emit('error', ev);\n });\n }\n\n private async handleFunctionCalls(ev: any) {\n let handledFunctionCall = false;\n for (const output of ev.response?.output ?? []) {\n if (output.type === 'function_call' && Object.hasOwn(this.tools ?? {}, output.name)) {\n handledFunctionCall = true;\n await this.handleFunctionCall(output);\n }\n }\n if (handledFunctionCall) {\n this.sendEvent('response.create', {});\n }\n }\n\n private async handleFunctionCall(output: any) {\n try {\n const context = JSON.parse(output.arguments);\n const tool = this.tools?.[output.name];\n if (!tool) {\n console.warn(`Tool \"${output.name}\" not found`);\n return;\n }\n\n if (tool?.execute) {\n this.emit('tool-call-start', {\n toolCallId: output.call_id,\n toolName: output.name,\n toolDescription: tool.description,\n args: context,\n });\n }\n\n const result = await tool?.execute?.(context, {\n toolCallId: output.call_id,\n messages: [],\n requestContext: this.requestContext,\n });\n\n this.emit('tool-call-result', {\n toolCallId: output.call_id,\n toolName: output.name,\n toolDescription: tool.description,\n args: context,\n result,\n });\n\n this.sendEvent('conversation.item.create', {\n item: {\n type: 'function_call_output',\n call_id: output.call_id,\n output: JSON.stringify(result ?? null),\n },\n });\n } catch (e) {\n const err = e as Error;\n console.warn(`Error calling tool \"${output.name}\":`, err.message);\n this.sendEvent('conversation.item.create', {\n item: {\n type: 'function_call_output',\n call_id: output.call_id,\n output: JSON.stringify({ error: err.message }),\n },\n });\n }\n }\n\n private int16ArrayToBase64(int16Array: Int16Array): string {\n const buffer = new ArrayBuffer(int16Array.length * 2);\n const view = new DataView(buffer);\n for (let i = 0; i < int16Array.length; i++) {\n view.setInt16(i * 2, int16Array[i]!, true);\n }\n const uint8Array = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < uint8Array.length; i++) {\n binary += String.fromCharCode(uint8Array[i]!);\n }\n return btoa(binary);\n }\n\n /**\n * Sends a raw client event to the OpenAI Realtime session.\n * Events sent before the session is created are queued and flushed once it is.\n *\n * @param type - OpenAI Realtime client event type, such as 'conversation.item.create'\n * @param data - Event payload merged alongside the type\n *\n * @example\n * ```typescript\n * voice.sendEvent('conversation.item.create', {\n * item: { type: 'message', role: 'user', content: [{ type: 'input_text', text: 'Hello' }] },\n * });\n * ```\n */\n sendEvent(type: string, data: Record<string, unknown> = {}) {\n if (!this.sessionReady || !this.ws || this.ws.readyState !== this.ws.OPEN) {\n this.queue.push({ ...data, type });\n } else {\n this.ws?.send(\n JSON.stringify({\n ...data,\n type,\n }),\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;;AAUA,SAAS,uBAAuB,KAAK,OAAO,UAAU;CACrD,IAAI,CAAC,KAAK,QAAQ,QAAQ;CAC1B,IAAI;EACH,MAAM,cAAc;EACpB,IAAI,WAAW,CAAC,EAAE,MAAM,MAAM,SAAS;GACtC,GAAG,YAAY,OAAO,KAAK,IAAI,EAAE,SAAS,YAAY,GAAG,IAAI,CAAC;GAC9D,GAAG,YAAY,WAAW,KAAK,IAAI,EAAE,QAAQ,YAAY,OAAO,IAAI,CAAC;GACrE,GAAG,YAAY,aAAa,KAAK,IAAI,EAAE,UAAU,YAAY,SAAS,IAAI,CAAC;GAC3E,GAAG,YAAY,YAAY,KAAK,IAAI,EAAE,SAAS,YAAY,QAAQ,IAAI,CAAC;GACxE,GAAG,MAAM,iBAAiB,QAAQ,EAAE,OAAO,MAAM,MAAM,QAAQ,IAAI,CAAC;GACpE,GAAG;EACJ,CAAC;CACF,QAAQ,CAAC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EAAE,OAAO,EAAE,EAAE;QAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,cAAc,CAAA;KAAE,iBAE9D;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAK/C;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAOhD;IAED;;;;OAIG;IACH,OAAO,CAAC,IAAI;IAQZ,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,mBAAmB;YA+Hb,mBAAmB;YAanB,kBAAkB;IAoDhC,OAAO,CAAC,kBAAkB;IAc1B;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,QAWzD;CACF"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../packages/_internal-core/dist/logger/index.js","../../../packages/_internal-core/dist/base/index.js","../../../packages/_internals/voice/dist/aisdk-c08VRfTf.js","../src/utils.ts","../src/index.ts"],"sourcesContent":["import { Transform } from \"stream\";\n// src/logger/adapter.ts\nfunction isAdaptableLogger(logger) {\n\treturn typeof logger.__attachObservability === \"function\";\n}\n/**\n* Export a tracked exception through the adapter sink, mirroring the\n* DualLogger dual-write shape (`errorId`/`domain`/`category`/`details`/`cause`\n* when present on a MastraError-like value). Never throws into the caller.\n*/\nfunction exportTrackedException(ctx, error, metadata) {\n\tif (!ctx?.options.export) return;\n\ttry {\n\t\tconst mastraError = error;\n\t\tctx.getLogSink()?.error(error.message, {\n\t\t\t...mastraError.id !== void 0 ? { errorId: mastraError.id } : {},\n\t\t\t...mastraError.domain !== void 0 ? { domain: mastraError.domain } : {},\n\t\t\t...mastraError.category !== void 0 ? { category: mastraError.category } : {},\n\t\t\t...mastraError.details !== void 0 ? { details: mastraError.details } : {},\n\t\t\t...error.cause instanceof Error ? { cause: error.cause.message } : {},\n\t\t\t...metadata\n\t\t});\n\t} catch {}\n}\n/**\n* Adapt IMastraLogger's variadic args into the structured `data` payload of\n* an exported log record. Extracts the first plain object as data,\n* serializes an Error arg, and collects remaining primitives under `args`\n* so the derived record preserves all context from the native call.\n*/\nfunction buildLogRecordData(args) {\n\tconst objectData = args.find((arg) => arg !== null && typeof arg === \"object\" && !Array.isArray(arg) && !(arg instanceof Error));\n\tconst errorArg = args.find((arg) => arg instanceof Error);\n\tconst extraArgs = args.filter((arg) => arg !== objectData && arg !== errorArg);\n\tif (!objectData && !errorArg && extraArgs.length === 0) return void 0;\n\treturn {\n\t\t...objectData ?? {},\n\t\t...errorArg ? { error: {\n\t\t\tname: errorArg.name,\n\t\t\tmessage: errorArg.message,\n\t\t\tstack: errorArg.stack\n\t\t} } : {},\n\t\t...extraArgs.length > 0 ? { args: extraArgs } : {}\n\t};\n}\n// src/logger/noop-logger.ts\nconst noopLogger = {\n\tdebug: () => {},\n\tinfo: () => {},\n\twarn: () => {},\n\terror: () => {},\n\tcleanup: async () => {},\n\tgetTransports: () => /* @__PURE__ */ new Map(),\n\ttrackException: () => {},\n\tlistLogs: async () => ({\n\t\tlogs: [],\n\t\ttotal: 0,\n\t\tpage: 1,\n\t\tperPage: 100,\n\t\thasMore: false\n\t}),\n\tlistLogsByRunId: async () => ({\n\t\tlogs: [],\n\t\ttotal: 0,\n\t\tpage: 1,\n\t\tperPage: 100,\n\t\thasMore: false\n\t})\n};\n// src/logger/index.ts\nconst RegisteredLogger = {\n\tAGENT: \"AGENT\",\n\tOBSERVABILITY: \"OBSERVABILITY\",\n\tAUTH: \"AUTH\",\n\tBROWSER: \"BROWSER\",\n\tNETWORK: \"NETWORK\",\n\tWORKFLOW: \"WORKFLOW\",\n\tLLM: \"LLM\",\n\tTTS: \"TTS\",\n\tVOICE: \"VOICE\",\n\tVECTOR: \"VECTOR\",\n\tBUNDLER: \"BUNDLER\",\n\tDEPLOYER: \"DEPLOYER\",\n\tMEMORY: \"MEMORY\",\n\tSTORAGE: \"STORAGE\",\n\tEMBEDDINGS: \"EMBEDDINGS\",\n\tMCP_SERVER: \"MCP_SERVER\",\n\tSERVER_CACHE: \"SERVER_CACHE\",\n\tSERVER: \"SERVER\",\n\tWORKSPACE: \"WORKSPACE\",\n\tCHANNEL: \"CHANNEL\"\n};\nconst LogLevel = {\n\tDEBUG: \"debug\",\n\tINFO: \"info\",\n\tWARN: \"warn\",\n\tERROR: \"error\",\n\tNONE: \"silent\"\n};\nvar LoggerTransport = class extends Transform {\n\tconstructor(opts = {}) {\n\t\tsuper({\n\t\t\t...opts,\n\t\t\tobjectMode: true\n\t\t});\n\t}\n\tasync listLogsByRunId(_args) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _args?.page ?? 1,\n\t\t\tperPage: _args?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n\tasync listLogs(_args) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _args?.page ?? 1,\n\t\t\tperPage: _args?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n};\nconst createCustomTransport = (stream, listLogs, listLogsByRunId) => {\n\tlet transport = stream;\n\tif (listLogs) transport.listLogs = listLogs;\n\tif (listLogsByRunId) transport.listLogsByRunId = listLogsByRunId;\n\treturn transport;\n};\nvar MastraLogger = class {\n\tname;\n\tlevel;\n\ttransports;\n\tconstructor(options = {}) {\n\t\tthis.name = options.name || \"Mastra\";\n\t\tthis.level = options.level || LogLevel.ERROR;\n\t\tthis.transports = new Map(Object.entries(options.transports || {}));\n\t}\n\tgetTransports() {\n\t\treturn this.transports;\n\t}\n\ttrackException(_error, _metadata) {}\n\tasync listLogs(transportId, params) {\n\t\tif (!transportId || !this.transports.has(transportId)) return {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: params?.page ?? 1,\n\t\t\tperPage: params?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t\treturn this.transports.get(transportId).listLogs?.(params) ?? {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: params?.page ?? 1,\n\t\t\tperPage: params?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n\tasync listLogsByRunId({ transportId, runId, fromDate, toDate, logLevel, filters, page, perPage }) {\n\t\tif (!transportId || !this.transports.has(transportId) || !runId) return {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: page ?? 1,\n\t\t\tperPage: perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t\treturn this.transports.get(transportId).listLogsByRunId?.({\n\t\t\trunId,\n\t\t\tfromDate,\n\t\t\ttoDate,\n\t\t\tlogLevel,\n\t\t\tfilters,\n\t\t\tpage,\n\t\t\tperPage\n\t\t}) ?? {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: page ?? 1,\n\t\t\tperPage: perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n};\nvar ConsoleLogger = class ConsoleLogger extends MastraLogger {\n\tcomponent;\n\tfilter;\n\t#adapterContext;\n\tconstructor(options = {}) {\n\t\tsuper(options);\n\t\tthis.component = options.component;\n\t\tthis.filter = options.filter;\n\t}\n\t/**\n\t* Adapter hook (see `AdaptableLogger`): enables native trace correlation\n\t* (trace_id/span_id appended to console output) and observability export\n\t* derived from the same record. Called by Mastra during setup.\n\t*/\n\t__attachObservability(ctx) {\n\t\tthis.#adapterContext = ctx;\n\t}\n\tchild(componentOrBindings) {\n\t\tconst component = typeof componentOrBindings === \"string\" ? componentOrBindings : componentOrBindings?.component ?? this.component;\n\t\tconst child = new ConsoleLogger({\n\t\t\tname: this.name,\n\t\t\tlevel: this.level,\n\t\t\tcomponent,\n\t\t\tfilter: this.filter\n\t\t});\n\t\tif (this.#adapterContext) child.__attachObservability(this.#adapterContext);\n\t\treturn child;\n\t}\n\t/**\n\t* Native-record correlation: when a span is active, append the trace\n\t* fields object to the console args so every destination sees them.\n\t*/\n\t#correlate(args) {\n\t\tconst ctx = this.#adapterContext;\n\t\tif (!ctx?.options.correlation) return args;\n\t\ttry {\n\t\t\tconst fields = ctx.resolveTraceFields();\n\t\t\treturn fields ? [...args, fields] : args;\n\t\t} catch {\n\t\t\treturn args;\n\t\t}\n\t}\n\t/**\n\t* Export the record derived from the same native call to observability.\n\t* Mirrors DualLogger semantics: export is independent of the console\n\t* level filter, and never throws into the caller.\n\t*/\n\t#export(level, message, args) {\n\t\tconst ctx = this.#adapterContext;\n\t\tif (!ctx?.options.export) return;\n\t\ttry {\n\t\t\tctx.getLogSink()?.[level](message, buildLogRecordData(args));\n\t\t} catch {}\n\t}\n\tshouldLog(level, message, args) {\n\t\tif (!this.filter) return true;\n\t\ttry {\n\t\t\treturn this.filter({\n\t\t\t\tcomponent: this.component,\n\t\t\t\tlevel,\n\t\t\t\tmessage,\n\t\t\t\targs\n\t\t\t});\n\t\t} catch (e) {\n\t\t\tconsole.error(`[Logger] Filter error for component=${this.component} level=${level}:`, e);\n\t\t\treturn true;\n\t\t}\n\t}\n\tprefix() {\n\t\treturn this.component ? `[${this.component}] ` : \"\";\n\t}\n\tdebug(message, ...args) {\n\t\tif (this.level === LogLevel.DEBUG && this.shouldLog(LogLevel.DEBUG, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"debug\", message, args);\n\t}\n\tinfo(message, ...args) {\n\t\tif ((this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.INFO, message, args)) console.info(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"info\", message, args);\n\t}\n\twarn(message, ...args) {\n\t\tif ((this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.WARN, message, args)) console.warn(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"warn\", message, args);\n\t}\n\terror(message, ...args) {\n\t\tif ((this.level === LogLevel.ERROR || this.level === LogLevel.WARN || this.level === LogLevel.INFO || this.level === LogLevel.DEBUG) && this.shouldLog(LogLevel.ERROR, message, args)) console.error(`${this.prefix()}${message}`, ...this.#correlate(args));\n\t\tthis.#export(\"error\", message, args);\n\t}\n\ttrackException(error, metadata) {\n\t\texportTrackedException(this.#adapterContext, error, metadata);\n\t}\n\tasync listLogs(_transportId, _params) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _params?.page ?? 1,\n\t\t\tperPage: _params?.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n\tasync listLogsByRunId(_args) {\n\t\treturn {\n\t\t\tlogs: [],\n\t\t\ttotal: 0,\n\t\t\tpage: _args.page ?? 1,\n\t\t\tperPage: _args.perPage ?? 100,\n\t\t\thasMore: false\n\t\t};\n\t}\n};\nexport { ConsoleLogger, LogLevel, LoggerTransport, MastraLogger, RegisteredLogger, buildLogRecordData, createCustomTransport, exportTrackedException, isAdaptableLogger, noopLogger };\n\n//# sourceMappingURL=index.js.map","import { ConsoleLogger, RegisteredLogger } from \"../logger/index.js\";\n// src/base/MastraBase.ts\nvar MastraBase = class {\n\tcomponent = RegisteredLogger.LLM;\n\tlogger;\n\tname;\n\t#rawConfig;\n\tconstructor({ component, name, rawConfig }) {\n\t\tthis.component = component || RegisteredLogger.LLM;\n\t\tthis.name = name;\n\t\tthis.#rawConfig = rawConfig;\n\t\tthis.logger = new ConsoleLogger({ name: `${this.component} - ${this.name}` });\n\t}\n\t/**\n\t* Returns the raw storage configuration this primitive was created from,\n\t* or undefined if it was created from code.\n\t*/\n\ttoRawConfig() {\n\t\treturn this.#rawConfig;\n\t}\n\t/**\n\t* Sets the raw storage configuration for this primitive.\n\t* @internal\n\t*/\n\t__setRawConfig(rawConfig) {\n\t\tthis.#rawConfig = rawConfig;\n\t}\n\t/**\n\t* Set the logger for the agent\n\t* @param logger\n\t*/\n\t__setLogger(logger) {\n\t\tthis.logger = \"child\" in logger && typeof logger.child === \"function\" ? logger.child({ component: this.component }) : logger;\n\t}\n};\nexport { MastraBase };\n\n//# sourceMappingURL=index.js.map","import { MastraBase } from \"@internal/core/base\";\nimport { PassThrough } from \"stream\";\nimport { experimental_generateSpeech, experimental_transcribe } from \"@internal/ai-sdk-v5\";\n// src/voice/voice.ts\nvar MastraVoice = class extends MastraBase {\n\tlisteningModel;\n\tspeechModel;\n\tspeaker;\n\trealtimeConfig;\n\tconstructor({ listeningModel, speechModel, speaker, realtimeConfig, name } = {}) {\n\t\tsuper({\n\t\t\tcomponent: \"VOICE\",\n\t\t\tname\n\t\t});\n\t\tthis.listeningModel = listeningModel;\n\t\tthis.speechModel = speechModel;\n\t\tthis.speaker = speaker;\n\t\tthis.realtimeConfig = realtimeConfig;\n\t}\n\t/**\n\t* Custom serialization for tracing/observability spans.\n\t* Excludes `apiKey` from listeningModel / speechModel / realtimeConfig\n\t* and any provider-specific state held by subclasses. Subclasses that\n\t* need to expose additional non-sensitive fields can override.\n\t*/\n\tserializeForSpan() {\n\t\treturn {\n\t\t\tcomponent: \"VOICE\",\n\t\t\tname: this.name,\n\t\t\tspeaker: this.speaker,\n\t\t\tlisteningModel: this.listeningModel ? { name: this.listeningModel.name } : void 0,\n\t\t\tspeechModel: this.speechModel ? { name: this.speechModel.name } : void 0,\n\t\t\trealtimeModel: this.realtimeConfig?.model\n\t\t};\n\t}\n\tupdateConfig(_options) {\n\t\tthis.logger.debug(\"updateConfig not implemented by this voice provider\");\n\t}\n\t/**\n\t* Initializes a WebSocket or WebRTC connection for real-time communication\n\t* @returns Promise that resolves when the connection is established\n\t*/\n\tasync connect(_options) {\n\t\tthis.logger.debug(\"connect not implemented by this voice provider\");\n\t}\n\t/**\n\t* Relay audio data to the voice provider for real-time processing\n\t* @param audioData Audio data to relay\n\t*/\n\tasync send(_audioData) {\n\t\tthis.logger.debug(\"relay not implemented by this voice provider\");\n\t}\n\t/**\n\t* Trigger voice providers to respond\n\t*/\n\tasync answer(_options) {\n\t\tthis.logger.debug(\"answer not implemented by this voice provider\");\n\t}\n\t/**\n\t* Equip the voice provider with instructions\n\t* @param instructions Instructions to add\n\t*/\n\taddInstructions(_instructions) {}\n\t/**\n\t* Equip the voice provider with tools\n\t* @param tools Array of tools to add\n\t*/\n\taddTools(_tools) {}\n\t/**\n\t* Disconnect from the WebSocket or WebRTC connection\n\t*/\n\tclose() {\n\t\tthis.logger.debug(\"close not implemented by this voice provider\");\n\t}\n\t/**\n\t* Register an event listener\n\t* @param event Event name (e.g., 'speaking', 'writing', 'error')\n\t* @param callback Callback function that receives event data\n\t*/\n\ton(_event, _callback) {\n\t\tthis.logger.debug(\"on not implemented by this voice provider\");\n\t}\n\t/**\n\t* Remove an event listener\n\t* @param event Event name (e.g., 'speaking', 'writing', 'error')\n\t* @param callback Callback function to remove\n\t*/\n\toff(_event, _callback) {\n\t\tthis.logger.debug(\"off not implemented by this voice provider\");\n\t}\n\t/**\n\t* Get available speakers/voices\n\t* @returns Array of available voice IDs and their metadata\n\t*/\n\tgetSpeakers() {\n\t\tthis.logger.debug(\"getSpeakers not implemented by this voice provider\");\n\t\treturn Promise.resolve([]);\n\t}\n\t/**\n\t* Get available speakers/voices\n\t* @returns Array of available voice IDs and their metadata\n\t*/\n\tgetListener() {\n\t\tthis.logger.debug(\"getListener not implemented by this voice provider\");\n\t\treturn Promise.resolve({ enabled: false });\n\t}\n};\n// src/voice/aisdk/speech.ts\nvar AISDKSpeech = class extends MastraVoice {\n\tmodel;\n\tdefaultVoice;\n\tconstructor(model, options) {\n\t\tsuper({ name: \"ai-sdk-speech\" });\n\t\tthis.model = model;\n\t\tthis.defaultVoice = options?.voice;\n\t}\n\tasync speak(input, options) {\n\t\tconst text = typeof input === \"string\" ? input : await this.streamToText(input);\n\t\tconst result = await experimental_generateSpeech({\n\t\t\tmodel: this.model,\n\t\t\ttext,\n\t\t\tvoice: options?.speaker || this.defaultVoice,\n\t\t\tlanguage: options?.language,\n\t\t\tproviderOptions: options?.providerOptions,\n\t\t\tabortSignal: options?.abortSignal,\n\t\t\theaders: options?.headers\n\t\t});\n\t\tconst stream = new PassThrough();\n\t\tstream.end(Buffer.from(result.audio.uint8Array));\n\t\treturn stream;\n\t}\n\tasync listen() {\n\t\tthrow new Error(\"AI SDK speech models do not support transcription. Use AISDKTranscription instead.\");\n\t}\n\tasync getSpeakers() {\n\t\treturn [];\n\t}\n\tasync getListener() {\n\t\treturn { enabled: false };\n\t}\n\tasync streamToText(stream) {\n\t\tconst chunks = [];\n\t\tfor await (const chunk of stream) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n\t\treturn Buffer.concat(chunks).toString(\"utf-8\");\n\t}\n};\n// src/voice/aisdk/transcription.ts\nvar AISDKTranscription = class extends MastraVoice {\n\tmodel;\n\tconstructor(model) {\n\t\tsuper({ name: \"ai-sdk-transcription\" });\n\t\tthis.model = model;\n\t}\n\tasync speak() {\n\t\tthrow new Error(\"AI SDK transcription models do not support text-to-speech. Use AISDKSpeech instead.\");\n\t}\n\tasync getSpeakers() {\n\t\treturn [];\n\t}\n\tasync getListener() {\n\t\treturn { enabled: true };\n\t}\n\t/**\n\t* Transcribe audio to text\n\t* For enhanced metadata (segments, language, duration), use AI SDK's transcribe() directly\n\t*/\n\tasync listen(audioStream, options) {\n\t\tconst audioBuffer = await this.convertToBuffer(audioStream);\n\t\treturn (await experimental_transcribe({\n\t\t\tmodel: this.model,\n\t\t\taudio: audioBuffer,\n\t\t\tproviderOptions: options?.providerOptions,\n\t\t\tabortSignal: options?.abortSignal,\n\t\t\theaders: options?.headers\n\t\t})).text;\n\t}\n\tasync convertToBuffer(audio) {\n\t\tif (Buffer.isBuffer(audio)) return audio;\n\t\tif (audio instanceof Uint8Array) return Buffer.from(audio);\n\t\tif (typeof audio === \"string\") return Buffer.from(audio, \"base64\");\n\t\tconst chunks = [];\n\t\tfor await (const chunk of audio) chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));\n\t\treturn Buffer.concat(chunks);\n\t}\n};\nexport { AISDKSpeech as n, MastraVoice as r, AISDKTranscription as t };\n\n//# sourceMappingURL=aisdk-c08VRfTf.js.map","import { Readable } from 'node:stream';\nimport type { ToolsInput } from '@internal/voice';\nimport { standardSchemaToJSONSchema, toStandardSchema } from '@mastra/schema-compat/schema';\n\nexport type OpenAIExecuteFunction = (args: any) => Promise<any>;\ntype ToolDefinition = {\n type: 'function';\n name: string;\n description: string;\n parameters: {\n [key: string]: any;\n };\n};\n\ntype TTools = ToolsInput;\nexport const transformTools = (tools?: TTools) => {\n const openaiTools: { openaiTool: ToolDefinition; execute: OpenAIExecuteFunction }[] = [];\n for (const [name, tool] of Object.entries(tools || {})) {\n let parameters: { [key: string]: any };\n\n if ('inputSchema' in tool && tool.inputSchema) {\n parameters = toToolParameters(tool.inputSchema);\n } else if ('parameters' in tool) {\n parameters = toToolParameters(tool.parameters);\n } else {\n console.warn(`Tool ${name} has neither inputSchema nor parameters, skipping`);\n continue;\n }\n const openaiTool: ToolDefinition = {\n type: 'function',\n name,\n description: tool.description || `Tool: ${name}`,\n parameters,\n };\n\n if (tool.execute) {\n // Create an adapter function that works with both ToolAction and VercelTool execute functions\n const executeAdapter = async (args: any) => {\n try {\n if (!tool.execute) {\n throw new Error(`Tool ${name} has no execute function`);\n }\n\n // Both ToolAction (createTool) and VercelTool take the input data as the\n // first argument, matching @mastra/core's ToolExecuteFunction(inputData, context).\n return await tool.execute(args, {\n toolCallId: 'unknown',\n messages: [],\n });\n } catch (error) {\n console.error(`Error executing tool ${name}:`, error);\n throw error;\n }\n };\n openaiTools.push({ openaiTool, execute: executeAdapter });\n } else {\n console.warn(`Tool ${name} has no execute function, skipping`);\n }\n }\n return openaiTools;\n};\n\nexport const isReadableStream = (obj: unknown) => {\n return (\n obj &&\n obj instanceof Readable &&\n typeof obj.read === 'function' &&\n typeof obj.pipe === 'function' &&\n obj.readable === true\n );\n};\n\nfunction toToolParameters(schema: unknown): { [key: string]: any } {\n const parameters = standardSchemaToJSONSchema(toStandardSchema(schema as never), { io: 'input' }) as {\n [key: string]: any;\n };\n delete parameters.$schema;\n return parameters;\n}\n","import { EventEmitter } from 'node:events';\nimport { PassThrough } from 'node:stream';\nimport type { ToolsInput, RequestContext } from '@internal/voice';\nimport { MastraVoice } from '@internal/voice';\nimport type { Realtime, RealtimeServerEvents } from 'openai-realtime-api';\nimport { WebSocket } from 'ws';\nimport { isReadableStream, transformTools } from './utils';\n\n/**\n * Event callback function type\n */\ntype EventCallback = (...args: any[]) => void;\n\ntype StreamWithId = PassThrough & { id: string };\n\n/**\n * Map of event types to their callback arrays\n */\ntype EventMap = {\n transcribing: [{ text: string }];\n writing: [{ text: string }];\n speaking: [{ audio: string }];\n speaker: [StreamWithId];\n error: [Error];\n} & {\n [key: string]: EventCallback[];\n};\n\n/** Default voice for text-to-speech. 'alloy' provides a neutral, balanced voice suitable for most use cases */\nconst DEFAULT_VOICE: Realtime.Voice = 'alloy';\n\nconst DEFAULT_TRANSCRIBER: Realtime.AudioTranscriptionModel = 'whisper-1';\n\nconst DEFAULT_URL = 'wss://api.openai.com/v1/realtime';\n\n/**\n * Default model for real-time voice interactions.\n * This model is optimized for low-latency responses while maintaining high quality output.\n */\nconst DEFAULT_MODEL = 'gpt-realtime-2.1-mini';\n\n// /**\n// * Default Voice Activity Detection (VAD) configuration.\n// * These settings control how the system detects speech segments.\n// *\n// * @property {string} type - Uses server-side VAD for better accuracy\n// * @property {number} threshold - Speech detection sensitivity (0.5 = balanced)\n// * @property {number} prefix_padding_ms - Includes 1 second of audio before speech\n// * @property {number} silence_duration_ms - Waits 1 second of silence before ending turn\n// */\n// const DEFAULT_VAD_CONFIG = {\n// type: 'server_vad',\n// threshold: 0.5,\n// prefix_padding_ms: 1000,\n// silence_duration_ms: 1000,\n// } as Realtime.TurnDetection;\n\ntype TTools = ToolsInput;\n\n/**\n * Available voice options for text-to-speech.\n * Each voice has unique characteristics suitable for different use cases:\n * - alloy: Neutral and balanced\n * - echo: Warm and natural\n * - shimmer: Clear and expressive\n * - And more...\n */\nconst VOICES = ['alloy', 'ash', 'ballad', 'coral', 'echo', 'sage', 'shimmer', 'verse'];\n\ntype RealtimeClientServerEventMap = {\n [K in RealtimeServerEvents.EventType]: [RealtimeServerEvents.EventMap[K]];\n} & {\n ['conversation.item.input_audio_transcription.delta']: [{ delta: string; item_id: string; content_index: number }];\n ['conversation.item.input_audio_transcription.completed']: [\n { transcript: string; item_id: string; content_index: number; usage?: unknown },\n ];\n ['response.output_audio.delta']: [{ delta: string; response_id: string }];\n ['response.output_audio.done']: [{ response_id: string }];\n ['response.output_audio_transcript.delta']: [{ delta: string; response_id: string }];\n ['response.output_audio_transcript.done']: [{ response_id: string }];\n ['response.output_text.delta']: [{ delta: string; response_id: string }];\n ['response.output_text.done']: [{ response_id: string }];\n};\n\n/**\n * OpenAIRealtimeVoice provides real-time voice interaction capabilities using OpenAI's\n * WebSocket-based API. It supports:\n * - Real-time text-to-speech\n * - Speech-to-text (transcription)\n * - Voice activity detection\n * - Multiple voice options\n * - Event-based audio streaming\n *\n * The class manages WebSocket connections, audio streaming, and event handling\n * for seamless voice interactions.\n *\n * @extends MastraVoice\n *\n * @example\n * ```typescript\n * const voice = new OpenAIRealtimeVoice({\n * apiKey: process.env.OPENAI_API_KEY,\n * model: 'gpt-realtime-2.1-mini'\n * });\n *\n * await voice.open();\n * voice.on('speaking', (audioData) => {\n * // Handle audio data\n * });\n *\n * await voice.speak('Hello, how can I help you today?');\n * ```\n */\nexport class OpenAIRealtimeVoice extends MastraVoice {\n private ws?: WebSocket;\n private state: 'close' | 'open';\n private client: EventEmitter<RealtimeClientServerEventMap>;\n private events: EventMap;\n private instructions?: string;\n private tools?: TTools;\n private debug: boolean;\n private queue: unknown[] = [];\n private sessionReady = false;\n private transcriber: Realtime.AudioTranscriptionModel;\n private requestContext?: RequestContext;\n private connectionAbort?: AbortController;\n private speakerStreams = new Map<string, StreamWithId>();\n /**\n * Creates a new instance of OpenAIRealtimeVoice.\n *\n * @param options - Configuration options for the voice instance\n * @param options.url - The base URL for the OpenAI Realtime API\n * @param options.model - The model ID to use (defaults to gpt-realtime-2.1-mini)\n * @param options.apiKey - OpenAI API key. Falls back to process.env.OPENAI_API_KEY\n * @param options.speaker - Voice ID to use (defaults to 'alloy')\n * @param options.debug - Enable debug mode\n *\n * @example\n * ```typescript\n * const voice = new OpenAIRealtimeVoice({\n * apiKey: 'your-api-key',\n * model: 'gpt-realtime-2.1-mini',\n * speaker: 'alloy'\n * });\n * ```\n */\n constructor(\n private options: {\n model?: string;\n url?: string;\n apiKey?: string;\n speaker?: Realtime.Voice;\n transcriber?: Realtime.AudioTranscriptionModel;\n debug?: boolean;\n /** Maximum connection handshake duration in milliseconds. Defaults to 15,000. */\n connectTimeoutMs?: number;\n } = {},\n ) {\n super();\n\n if (\n options.connectTimeoutMs !== undefined &&\n (!Number.isFinite(options.connectTimeoutMs) ||\n options.connectTimeoutMs <= 0 ||\n options.connectTimeoutMs > 2_147_483_647)\n ) {\n throw new Error('connectTimeoutMs must be a positive finite number no greater than 2147483647');\n }\n\n this.client = new EventEmitter();\n this.state = 'close';\n this.events = {} as EventMap;\n this.speaker = options.speaker || DEFAULT_VOICE;\n this.transcriber = options.transcriber || DEFAULT_TRANSCRIBER;\n this.debug = options.debug || false;\n }\n\n /**\n * Returns a list of available voice speakers.\n *\n * @returns Promise resolving to an array of voice objects, each containing at least a voiceId\n *\n * @example\n * ```typescript\n * const speakers = await voice.getSpeakers();\n * // speakers = [{ voiceId: 'alloy' }, { voiceId: 'echo' }, ...]\n * ```\n */\n getSpeakers(): Promise<Array<{ voiceId: string; [key: string]: any }>> {\n return Promise.resolve(VOICES.map(v => ({ voiceId: v })));\n }\n\n /**\n * Disconnects from the OpenAI realtime session and cleans up resources.\n * Should be called when you're done with the voice instance.\n *\n * @example\n * ```typescript\n * voice.close(); // Disconnects and cleans up\n * ```\n */\n close() {\n if (!this.ws) return;\n this.ws.close();\n this.state = 'close';\n this.closeSpeakerStreams();\n }\n\n /**\n * Equips the voice instance with a set of instructions.\n * Instructions allow the model to perform additional actions during conversations.\n *\n * @param instructions - Optional instructions to addInstructions\n * @returns Transformed instructions ready for use with the model\n *\n * @example\n * ```typescript\n * voice.addInstructions('You are a helpful assistant.');\n * ```\n */\n addInstructions(instructions?: string) {\n this.instructions = instructions;\n }\n\n /**\n * Equips the voice instance with a set of tools.\n * Tools allow the model to perform additional actions during conversations.\n *\n * @param tools - Optional tools configuration to addTools\n * @returns Transformed tools configuration ready for use with the model\n *\n * @example\n * ```typescript\n * const tools = {\n * search: async (query: string) => { ... },\n * calculate: (expression: string) => { ... }\n * };\n * voice.addTools(tools);\n * ```\n */\n addTools(tools?: TTools) {\n this.tools = tools || {};\n }\n\n /**\n * Emits a speaking event using the configured voice model.\n * Can accept either a string or a readable stream as input.\n *\n * @param input - The text to convert to speech, or a readable stream containing the text\n * @param options - Optional configuration for this specific speech request\n * @param options.speaker - Override the voice to use for this specific request\n *\n * @throws {Error} If the input text is empty\n *\n * @example\n * ```typescript\n * // Simple text to speech\n * await voice.speak('Hello world');\n *\n * // With custom voice\n * await voice.speak('Hello world', { speaker: 'echo' });\n *\n * // Using a stream\n * const stream = fs.createReadStream('text.txt');\n * await voice.speak(stream);\n * ```\n */\n async speak(input: string | NodeJS.ReadableStream, options?: { speaker?: Realtime.Voice }): Promise<void> {\n if (typeof input !== 'string') {\n const chunks: Buffer[] = [];\n for await (const chunk of input) {\n chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(String(chunk)));\n }\n input = Buffer.concat(chunks).toString('utf-8');\n }\n\n if (input.trim().length === 0) {\n throw new Error('Input text is empty');\n }\n\n this.sendEvent('response.create', {\n response: {\n instructions: `Repeat the following text: ${input}`,\n voice: options?.speaker ? options.speaker : undefined,\n },\n });\n }\n\n /**\n * Updates the session configuration for the voice instance.\n * This can be used to modify voice settings, turn detection, and other parameters.\n *\n * @param sessionConfig - New session configuration to apply\n *\n * @example\n * ```typescript\n * voice.updateConfig({\n * voice: 'echo',\n * turn_detection: {\n * type: 'server_vad',\n * threshold: 0.5,\n * silence_duration_ms: 1000\n * }\n * });\n * ```\n */\n updateConfig(sessionConfig: unknown): void {\n this.sendEvent('session.update', { session: sessionConfig });\n }\n\n /**\n * Checks if listening capabilities are enabled.\n *\n * @returns {Promise<{ enabled: boolean }>}\n */\n async getListener() {\n return { enabled: true };\n }\n\n /**\n * Processes audio input for speech recognition.\n * Takes a readable stream of audio data and emits a writing event.\n * The output of the writing event is int16 audio data.\n *\n * @param audioData - Readable stream containing the audio data to process\n * @param options - Optional configuration for audio processing\n *\n * @throws {Error} If the audio data format is not supported\n *\n * @example\n * ```typescript\n * // Process audio from a file\n * const audioStream = fs.createReadStream('audio.raw');\n * await voice.listen(audioStream);\n *\n * // Process audio with options\n * await voice.listen(microphoneStream, {\n * format: 'int16',\n * sampleRate: 24000\n * });\n * ```\n */\n async listen(audioData: NodeJS.ReadableStream): Promise<void> {\n if (isReadableStream(audioData)) {\n const chunks: Buffer[] = [];\n for await (const chunk of audioData) {\n const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n chunks.push(buffer);\n }\n\n const buffer = Buffer.concat(chunks);\n const int16Array = new Int16Array(buffer.buffer, buffer.byteOffset ?? 0, (buffer.byteLength ?? 0) / 2);\n const base64Audio = this.int16ArrayToBase64(int16Array);\n\n this.sendEvent('conversation.item.create', {\n item: {\n type: 'message',\n role: 'user',\n content: [{ type: 'input_audio', audio: base64Audio }],\n },\n });\n\n this.sendEvent('response.create', {\n response: {\n modalities: ['text'],\n instructions: `ONLY repeat the input and DO NOT say anything else`,\n },\n });\n } else {\n this.emit('error', new Error('Unsupported audio data format'));\n }\n }\n\n waitForOpen(): Promise<void> {\n return this.waitForHandshake('open');\n }\n\n waitForSessionCreated(): Promise<void> {\n return this.waitForHandshake('session.created');\n }\n\n private waitForHandshake(event: 'open' | 'session.created'): Promise<void> {\n const ws = this.ws;\n const signal = this.connectionAbort?.signal;\n return new Promise((resolve, reject) => {\n if (!ws) {\n reject(new Error('WebSocket not initialized'));\n return;\n }\n if (signal?.aborted) {\n reject(signal.reason);\n return;\n }\n if (ws.readyState === WebSocket.CLOSED || ws.readyState === WebSocket.CLOSING) {\n reject(new Error('OpenAI realtime WebSocket is closed'));\n return;\n }\n if (event === 'open' && ws.readyState === WebSocket.OPEN) {\n resolve();\n return;\n }\n\n const cleanup = () => {\n clearTimeout(timer);\n ws.removeListener('open', onReady);\n ws.removeListener('error', onError);\n ws.removeListener('close', onClose);\n this.client.removeListener('session.created', onReady);\n this.client.removeListener('error', onProtocolError);\n signal?.removeEventListener('abort', onAbort);\n };\n const onReady = () => {\n cleanup();\n resolve();\n };\n const onError = (error: Error) => {\n cleanup();\n reject(error);\n };\n const onClose = (code: number, reason: Buffer) =>\n onError(new Error(`OpenAI realtime WebSocket closed during handshake (${code}: ${reason.toString()})`));\n const onProtocolError = (event: RealtimeServerEvents.EventMap['error']) =>\n onError(new Error(event.error.message, { cause: event.error }));\n const onAbort = () => onError(signal!.reason);\n const timeoutMs = this.options.connectTimeoutMs ?? 15_000;\n const timer = setTimeout(\n () => onError(new Error(`OpenAI realtime connection timed out after ${timeoutMs}ms`)),\n timeoutMs,\n );\n\n if (event === 'open') ws.once('open', onReady);\n else this.client.once('session.created', onReady);\n ws.once('error', onError);\n ws.once('close', onClose);\n this.client.once('error', onProtocolError);\n signal?.addEventListener('abort', onAbort, { once: true });\n });\n }\n\n /**\n * Establishes a connection to the OpenAI realtime service.\n * Must be called before using speak, listen, or relay functions.\n *\n * @throws {Error} If connection fails or session creation times out\n *\n * @example\n * ```typescript\n * await voice.open();\n * // Now ready for voice interactions\n * ```\n */\n async connect({ requestContext }: { requestContext?: RequestContext } = {}) {\n const url = `${this.options.url || DEFAULT_URL}?model=${this.options.model || DEFAULT_MODEL}`;\n const apiKey = this.options.apiKey || process.env.OPENAI_API_KEY;\n this.requestContext = requestContext;\n\n this.ws = new WebSocket(url, undefined, {\n headers: {\n Authorization: 'Bearer ' + apiKey,\n },\n });\n\n const ws = this.ws;\n this.state = 'close';\n this.sessionReady = false;\n this.client.removeAllListeners();\n this.closeSpeakerStreams();\n const controller = new AbortController();\n this.connectionAbort = controller;\n this.setupEventListeners();\n try {\n await Promise.all([this.waitForOpen(), this.waitForSessionCreated()]);\n } catch (error) {\n controller.abort(error);\n this.state = 'close';\n this.ws = undefined;\n ws.close();\n throw error;\n } finally {\n this.connectionAbort = undefined;\n }\n\n this.sessionReady = true;\n const openaiTools = transformTools(this.tools);\n this.updateConfig({\n type: 'realtime',\n instructions: this.instructions,\n tools: openaiTools.map(t => t.openaiTool),\n audio: {\n input: {\n transcription: {\n model: this.transcriber,\n },\n },\n output: {\n voice: this.speaker,\n },\n },\n });\n this.state = 'open';\n }\n\n disconnect() {\n this.state = 'close';\n this.connectionAbort?.abort(new Error('OpenAI realtime connection disconnected during handshake'));\n this.ws?.close();\n this.closeSpeakerStreams();\n }\n\n /**\n * Streams audio data in real-time to the OpenAI service.\n * Useful for continuous audio streaming scenarios like live microphone input.\n * Must be in 'open' state before calling this method.\n *\n * @param audioData - Readable stream of audio data to relay\n * @throws {Error} If audio format is not supported\n *\n * @example\n * ```typescript\n * // First connect\n * await voice.open();\n *\n * // Then relay audio\n * const micStream = getMicrophoneStream();\n * await voice.relay(micStream);\n * ```\n */\n async send(audioData: NodeJS.ReadableStream | Int16Array, eventId?: string): Promise<void> {\n if (!this.state || this.state !== 'open') {\n console.warn('Cannot relay audio when not open. Call open() first.');\n return;\n }\n\n if (isReadableStream(audioData)) {\n const stream = audioData as NodeJS.ReadableStream;\n stream.on('data', chunk => {\n try {\n const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);\n this.sendEvent('input_audio_buffer.append', { audio: buffer.toString('base64'), event_id: eventId });\n } catch (err) {\n this.emit('error', err);\n }\n });\n } else if (audioData instanceof Int16Array) {\n try {\n const base64Audio = this.int16ArrayToBase64(audioData);\n this.sendEvent('input_audio_buffer.append', { audio: base64Audio, event_id: eventId });\n } catch (err) {\n this.emit('error', err);\n }\n } else {\n this.emit('error', new Error('Unsupported audio data format'));\n }\n }\n\n /**\n * Sends a response to the OpenAI Realtime API.\n *\n * Trigger a response to the real-time session.\n *\n * @param {Object} params - The parameters object\n * @param {Realtime.ResponseConfig} params.options - Configuration options for the response\n * @returns {Promise<void>} A promise that resolves when the response has been sent\n *\n * @example\n * // Send a simple text response\n * await realtimeVoice.answer({\n * options: {\n * content: \"Hello, how can I help you today?\",\n * voice: \"alloy\"\n * }\n * });\n */\n async answer({ options }: { options?: Realtime.ResponseConfig }) {\n this.sendEvent('response.create', { response: options ?? {} });\n }\n\n /**\n * Registers an event listener for voice events.\n * Voice events include 'speaking', 'writing', and 'error'.\n * Supported native input events use their unprefixed OpenAI names:\n * 'input_audio_buffer.speech_started', 'input_audio_buffer.speech_stopped',\n * and 'conversation.item.input_audio_transcription.completed'.\n * These native events deliver the complete received payload, including transcription usage when present.\n * Every server event is also emitted as 'openAIRealtime:<event.type>', and the socket emits 'open' and 'close'.\n *\n * @param event - Name of the event to listen for\n * @param callback - Function to call when the event occurs\n *\n * @example\n * ```typescript\n * // Listen for speech events\n * voice.on('speaking', (audioData: Int16Array) => {\n * // Handle audio data\n * });\n *\n * // Handle errors\n * voice.on('error', (error: Error) => {\n * console.error('Voice error:', error);\n * });\n * ```\n */\n on(event: string, callback: EventCallback): void {\n if (!this.events[event]) {\n this.events[event] = [];\n }\n this.events[event].push(callback);\n }\n\n /**\n * Removes a previously registered event listener.\n *\n * @param event - Name of the event to stop listening to\n * @param callback - The specific callback function to remove\n *\n * @example\n * ```typescript\n * // Create event handler\n * const handleSpeech = (audioData: Int16Array) => {\n * // Handle audio data\n * };\n *\n * // Add listener\n * voice.on('speaking', handleSpeech);\n *\n * // Later, remove the listener\n * voice.off('speaking', handleSpeech);\n * ```\n */\n off(event: string, callback: EventCallback): void {\n if (!this.events[event]) return;\n\n const index = this.events[event].indexOf(callback);\n if (index !== -1) {\n this.events[event].splice(index, 1);\n }\n }\n\n /**\n * Emit an event with arguments\n * @param event Event name\n * @param args Arguments to pass to the callbacks\n */\n private emit(event: string, ...args: any[]): void {\n if (!this.events[event]) return;\n\n for (const callback of this.events[event]) {\n callback(...args);\n }\n }\n\n private closeSpeakerStreams(): void {\n for (const stream of this.speakerStreams.values()) {\n if (!stream.writableEnded) stream.end();\n }\n this.speakerStreams.clear();\n }\n\n private setupEventListeners(): void {\n const speakerStreams = this.speakerStreams;\n const userTranscriptionDeltaItems = new Set<string>();\n\n if (!this.ws) {\n throw new Error('WebSocket not initialized');\n }\n\n const ws = this.ws;\n ws.on('error', error => {\n if (this.ws === ws) this.emit('error', error);\n });\n ws.on('open', () => {\n if (this.ws === ws) this.emit('open');\n });\n ws.on('close', (code, reason) => {\n if (this.ws !== ws) return;\n this.state = 'close';\n this.sessionReady = false;\n this.closeSpeakerStreams();\n this.emit('close', { code, reason: reason.toString() });\n });\n ws.on('message', message => {\n if (this.ws !== ws) return;\n const data = JSON.parse(message.toString());\n this.client.emit(data.type, data);\n this.emit(`openAIRealtime:${data.type}`, data);\n\n if (this.debug) {\n const { delta, ...fields } = data;\n console.info(data.type, fields, delta?.length < 100 ? delta : '');\n }\n });\n\n this.client.on('session.created', ev => {\n this.emit('session.created', ev);\n\n this.sessionReady = true;\n const queue = this.queue.splice(0, this.queue.length);\n for (const ev of queue) {\n this.ws?.send(JSON.stringify(ev));\n }\n });\n this.client.on('session.updated', ev => {\n this.emit('session.updated', ev);\n });\n this.client.on('input_audio_buffer.speech_started', ev => {\n this.emit('input_audio_buffer.speech_started', ev);\n });\n this.client.on('input_audio_buffer.speech_stopped', ev => {\n this.emit('input_audio_buffer.speech_stopped', ev);\n });\n this.client.on('response.created', ev => {\n this.emit('response.created', ev);\n\n const speakerStream = new PassThrough() as StreamWithId;\n\n speakerStream.id = ev.response.id;\n\n speakerStreams.set(ev.response.id, speakerStream);\n this.emit('speaker', speakerStream);\n });\n this.client.on('conversation.item.input_audio_transcription.delta', ev => {\n userTranscriptionDeltaItems.add(ev.item_id);\n this.emit('writing', { text: ev.delta, response_id: ev.item_id, role: 'user' });\n });\n this.client.on('conversation.item.input_audio_transcription.completed', ev => {\n this.emit('conversation.item.input_audio_transcription.completed', ev);\n if (!userTranscriptionDeltaItems.has(ev.item_id) && ev.transcript) {\n this.emit('writing', { text: ev.transcript, response_id: ev.item_id, role: 'user' });\n }\n userTranscriptionDeltaItems.delete(ev.item_id);\n this.emit('writing', { text: '\\n', response_id: ev.item_id, role: 'user' });\n });\n const handleAudioDelta = (ev: { delta: string; response_id: string }) => {\n const audio = Buffer.from(ev.delta, 'base64');\n this.emit('speaking', { audio, response_id: ev.response_id });\n\n const stream = speakerStreams.get(ev.response_id);\n stream?.write(audio);\n };\n const handleAudioDone = (ev: { response_id: string }) => {\n this.emit('speaking.done', { response_id: ev.response_id });\n\n const stream = speakerStreams.get(ev.response_id);\n stream?.end();\n };\n const handleAudioTranscriptDelta = (ev: { delta: string; response_id: string }) => {\n this.emit('writing', { text: ev.delta, response_id: ev.response_id, role: 'assistant' });\n };\n const handleAudioTranscriptDone = (ev: { response_id: string }) => {\n this.emit('writing', { text: '\\n', response_id: ev.response_id, role: 'assistant' });\n };\n const handleTextDelta = (ev: { delta: string; response_id: string }) => {\n this.emit('writing', { text: ev.delta, response_id: ev.response_id, role: 'assistant' });\n };\n const handleTextDone = (ev: { response_id: string }) => {\n this.emit('writing', { text: '\\n', response_id: ev.response_id, role: 'assistant' });\n };\n this.client.on('response.audio.delta', handleAudioDelta);\n this.client.on('response.output_audio.delta', handleAudioDelta);\n this.client.on('response.audio.done', handleAudioDone);\n this.client.on('response.output_audio.done', handleAudioDone);\n this.client.on('response.audio_transcript.delta', handleAudioTranscriptDelta);\n this.client.on('response.output_audio_transcript.delta', handleAudioTranscriptDelta);\n this.client.on('response.audio_transcript.done', handleAudioTranscriptDone);\n this.client.on('response.output_audio_transcript.done', handleAudioTranscriptDone);\n this.client.on('response.text.delta', handleTextDelta);\n this.client.on('response.output_text.delta', handleTextDelta);\n this.client.on('response.text.done', handleTextDone);\n this.client.on('response.output_text.done', handleTextDone);\n this.client.on('response.done', async ev => {\n // Responses without audio (tool-call-only turns, text modality, or cancelled before any audio)\n // never send output_audio.done, so end the stream here. Do it before running tools so a slow\n // or failing tool cannot hold the stream open.\n const stream = speakerStreams.get(ev.response.id);\n if (stream && !stream.writableEnded) stream.end();\n speakerStreams.delete(ev.response.id);\n\n await this.handleFunctionCalls(ev);\n this.emit('response.done', ev);\n });\n this.client.on('error', async ev => {\n this.emit('error', ev);\n });\n }\n\n private async handleFunctionCalls(ev: any) {\n let handledFunctionCall = false;\n for (const output of ev.response?.output ?? []) {\n if (output.type === 'function_call' && Object.hasOwn(this.tools ?? {}, output.name)) {\n handledFunctionCall = true;\n await this.handleFunctionCall(output);\n }\n }\n if (handledFunctionCall) {\n this.sendEvent('response.create', {});\n }\n }\n\n private async handleFunctionCall(output: any) {\n try {\n const context = JSON.parse(output.arguments);\n const tool = this.tools?.[output.name];\n if (!tool) {\n console.warn(`Tool \"${output.name}\" not found`);\n return;\n }\n\n if (tool?.execute) {\n this.emit('tool-call-start', {\n toolCallId: output.call_id,\n toolName: output.name,\n toolDescription: tool.description,\n args: context,\n });\n }\n\n const result = await tool?.execute?.(context, {\n toolCallId: output.call_id,\n messages: [],\n requestContext: this.requestContext,\n });\n\n this.emit('tool-call-result', {\n toolCallId: output.call_id,\n toolName: output.name,\n toolDescription: tool.description,\n args: context,\n result,\n });\n\n this.sendEvent('conversation.item.create', {\n item: {\n type: 'function_call_output',\n call_id: output.call_id,\n output: JSON.stringify(result ?? null),\n },\n });\n } catch (e) {\n const err = e as Error;\n console.warn(`Error calling tool \"${output.name}\":`, err.message);\n this.sendEvent('conversation.item.create', {\n item: {\n type: 'function_call_output',\n call_id: output.call_id,\n output: JSON.stringify({ error: err.message }),\n },\n });\n }\n }\n\n private int16ArrayToBase64(int16Array: Int16Array): string {\n const buffer = new ArrayBuffer(int16Array.length * 2);\n const view = new DataView(buffer);\n for (let i = 0; i < int16Array.length; i++) {\n view.setInt16(i * 2, int16Array[i]!, true);\n }\n const uint8Array = new Uint8Array(buffer);\n let binary = '';\n for (let i = 0; i < uint8Array.length; i++) {\n binary += String.fromCharCode(uint8Array[i]!);\n }\n return btoa(binary);\n }\n\n /**\n * Sends a raw client event to the OpenAI Realtime session.\n * Events sent before the session is created are queued and flushed once it is.\n *\n * @param type - OpenAI Realtime client event type, such as 'conversation.item.create'\n * @param data - Event payload merged alongside the type\n *\n * @example\n * ```typescript\n * voice.sendEvent('conversation.item.create', {\n * item: { type: 'message', role: 'user', content: [{ type: 'input_text', text: 'Hello' }] },\n * });\n * ```\n */\n sendEvent(type: string, data: Record<string, unknown> = {}) {\n if (!this.sessionReady || !this.ws || this.ws.readyState !== this.ws.OPEN) {\n this.queue.push({ ...data, type });\n } else {\n this.ws?.send(\n JSON.stringify({\n ...data,\n type,\n }),\n );\n }\n }\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAS,uBAAuB,KAAK,OAAO,UAAU;CACrD,IAAI,CAAC,KAAK,QAAQ,QAAQ;CAC1B,IAAI;EACH,MAAM,cAAc;EACpB,IAAI,WAAW,CAAC,EAAE,MAAM,MAAM,SAAS;GACtC,GAAG,YAAY,OAAO,KAAK,IAAI,EAAE,SAAS,YAAY,GAAG,IAAI,CAAC;GAC9D,GAAG,YAAY,WAAW,KAAK,IAAI,EAAE,QAAQ,YAAY,OAAO,IAAI,CAAC;GACrE,GAAG,YAAY,aAAa,KAAK,IAAI,EAAE,UAAU,YAAY,SAAS,IAAI,CAAC;GAC3E,GAAG,YAAY,YAAY,KAAK,IAAI,EAAE,SAAS,YAAY,QAAQ,IAAI,CAAC;GACxE,GAAG,MAAM,iBAAiB,QAAQ,EAAE,OAAO,MAAM,MAAM,QAAQ,IAAI,CAAC;GACp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