@mastra/code-sdk 1.19.0-alpha.0 → 1.19.0-alpha.10

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 (75) hide show
  1. package/dist/acp/runtime.d.ts.map +1 -1
  2. package/dist/acp/runtime.js +1 -0
  3. package/dist/acp/runtime.js.map +1 -1
  4. package/dist/agent-connections/tools.d.ts.map +1 -1
  5. package/dist/agent-connections/tools.js +67 -2
  6. package/dist/agent-connections/tools.js.map +1 -1
  7. package/dist/agents/fastembed-subprocess.d.ts +31 -0
  8. package/dist/agents/fastembed-subprocess.d.ts.map +1 -0
  9. package/dist/agents/fastembed-subprocess.js +202 -0
  10. package/dist/agents/fastembed-subprocess.js.map +1 -0
  11. package/dist/agents/instructions.d.ts +5 -2
  12. package/dist/agents/instructions.d.ts.map +1 -1
  13. package/dist/agents/instructions.js +4 -2
  14. package/dist/agents/instructions.js.map +1 -1
  15. package/dist/agents/mastracode-gateway.d.ts +1 -0
  16. package/dist/agents/mastracode-gateway.d.ts.map +1 -1
  17. package/dist/agents/mastracode-gateway.js +9 -5
  18. package/dist/agents/mastracode-gateway.js.map +1 -1
  19. package/dist/agents/memory.d.ts.map +1 -1
  20. package/dist/agents/memory.js +4 -6
  21. package/dist/agents/memory.js.map +1 -1
  22. package/dist/agents/model.d.ts.map +1 -1
  23. package/dist/agents/model.js +10 -5
  24. package/dist/agents/model.js.map +1 -1
  25. package/dist/agents/modes/build.js +1 -1
  26. package/dist/agents/modes/build.js.map +1 -1
  27. package/dist/agents/modes/plan.js +1 -1
  28. package/dist/agents/modes/plan.js.map +1 -1
  29. package/dist/agents/prompts/index.d.ts.map +1 -1
  30. package/dist/agents/prompts/index.js +1 -0
  31. package/dist/agents/prompts/index.js.map +1 -1
  32. package/dist/agents/prompts/plan.d.ts +2 -0
  33. package/dist/agents/prompts/plan.d.ts.map +1 -1
  34. package/dist/agents/prompts/plan.js +10 -8
  35. package/dist/agents/prompts/plan.js.map +1 -1
  36. package/dist/agents/sandbox-filesystem.d.ts +25 -0
  37. package/dist/agents/sandbox-filesystem.d.ts.map +1 -1
  38. package/dist/agents/sandbox-filesystem.js +47 -6
  39. package/dist/agents/sandbox-filesystem.js.map +1 -1
  40. package/dist/auth/account-rotation-processor.d.ts +23 -0
  41. package/dist/auth/account-rotation-processor.d.ts.map +1 -1
  42. package/dist/auth/account-rotation-processor.js +63 -1
  43. package/dist/auth/account-rotation-processor.js.map +1 -1
  44. package/dist/auth/index.js +2 -2
  45. package/dist/auth/storage.d.ts +8 -0
  46. package/dist/auth/storage.d.ts.map +1 -1
  47. package/dist/auth/storage.js +37 -3
  48. package/dist/auth/storage.js.map +1 -1
  49. package/dist/experimental-agent.d.ts +8 -0
  50. package/dist/experimental-agent.d.ts.map +1 -1
  51. package/dist/experimental-agent.js +12 -1
  52. package/dist/experimental-agent.js.map +1 -1
  53. package/dist/headless/cli.d.ts.map +1 -1
  54. package/dist/headless/cli.js +2 -1
  55. package/dist/headless/cli.js.map +1 -1
  56. package/dist/index.d.ts +2 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +10 -3
  59. package/dist/index.js.map +1 -1
  60. package/dist/onboarding/settings.d.ts +4 -0
  61. package/dist/onboarding/settings.d.ts.map +1 -1
  62. package/dist/onboarding/settings.js +6 -2
  63. package/dist/onboarding/settings.js.map +1 -1
  64. package/dist/utils/token-estimator.d.ts.map +1 -1
  65. package/dist/utils/token-estimator.js +2 -1
  66. package/dist/utils/token-estimator.js.map +1 -1
  67. package/dist/voice/stt-registry.d.ts +6 -3
  68. package/dist/voice/stt-registry.d.ts.map +1 -1
  69. package/dist/voice/stt-registry.js +13 -10
  70. package/dist/voice/stt-registry.js.map +1 -1
  71. package/dist/voice/transcribe.d.ts +10 -0
  72. package/dist/voice/transcribe.d.ts.map +1 -0
  73. package/dist/voice/transcribe.js +77 -0
  74. package/dist/voice/transcribe.js.map +1 -0
  75. package/package.json +15 -12
@@ -1 +1 @@
1
- {"version":3,"file":"token-estimator.js","names":[],"sources":["../../src/utils/token-estimator.ts"],"sourcesContent":["import { estimateTokenCount, sliceByTokens } from 'tokenx';\n\nfunction sanitizeInput(text: string | object) {\n if (!text) return '';\n return (typeof text === `string` ? text : JSON.stringify(text))\n .replaceAll(`<|endoftext|>`, ``)\n .replaceAll(`<|endofprompt|>`, ``);\n}\n\nexport function tokenEstimate(text: string | object): number {\n return estimateTokenCount(sanitizeInput(text));\n}\n\nexport function truncateStringForTokenEstimate(text: string, desiredTokenCount: number, fromEnd = true) {\n const sanitized = sanitizeInput(text);\n const totalTokens = estimateTokenCount(sanitized);\n\n if (totalTokens <= desiredTokenCount) return sanitized;\n\n const kept = fromEnd ? sliceByTokens(sanitized, -desiredTokenCount) : sliceByTokens(sanitized, 0, desiredTokenCount);\n\n return `[Truncated ~${totalTokens - desiredTokenCount} tokens]\n${kept}`;\n}\n"],"mappings":";;AAEA,SAAS,cAAc,MAAuB;CAC5C,IAAI,CAAC,MAAM,OAAO;CAClB,QAAQ,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,IAAI,EAAA,CAC1D,WAAW,iBAAiB,EAAE,CAAC,CAC/B,WAAW,mBAAmB,EAAE;AACrC;AAEA,SAAgB,cAAc,MAA+B;CAC3D,OAAO,mBAAmB,cAAc,IAAI,CAAC;AAC/C;AAEA,SAAgB,+BAA+B,MAAc,mBAA2B,UAAU,MAAM;CACtG,MAAM,YAAY,cAAc,IAAI;CACpC,MAAM,cAAc,mBAAmB,SAAS;CAEhD,IAAI,eAAe,mBAAmB,OAAO;CAE7C,MAAM,OAAO,UAAU,cAAc,WAAW,CAAC,iBAAiB,IAAI,cAAc,WAAW,GAAG,iBAAiB;CAEnH,OAAO,eAAe,cAAc,kBAAkB;EACtD;AACF"}
1
+ {"version":3,"file":"token-estimator.js","names":[],"sources":["../../src/utils/token-estimator.ts"],"sourcesContent":["import { estimateTokenCount, sliceByTokens } from 'tokenx';\n\n// Unicode mode matches lone surrogate code points without matching complete pairs.\nconst UNPAIRED_SURROGATE_RE = /[\\uD800-\\uDFFF]/gu;\n\nfunction sanitizeInput(text: string | object) {\n if (!text) return '';\n return (typeof text === `string` ? text : JSON.stringify(text))\n .replaceAll(`<|endoftext|>`, ``)\n .replaceAll(`<|endofprompt|>`, ``);\n}\n\nexport function tokenEstimate(text: string | object): number {\n return estimateTokenCount(sanitizeInput(text));\n}\n\nexport function truncateStringForTokenEstimate(text: string, desiredTokenCount: number, fromEnd = true) {\n const sanitized = sanitizeInput(text);\n const totalTokens = estimateTokenCount(sanitized);\n\n if (totalTokens <= desiredTokenCount) return sanitized;\n\n // tokenx cuts on UTF-16 code units, so a cut can split a surrogate pair (emoji, math letters).\n // The lone half makes the provider request invalid JSON, so replace it with U+FFFD.\n const kept = (\n fromEnd ? sliceByTokens(sanitized, -desiredTokenCount) : sliceByTokens(sanitized, 0, desiredTokenCount)\n ).replace(UNPAIRED_SURROGATE_RE, '�');\n\n return `[Truncated ~${totalTokens - desiredTokenCount} tokens]\n${kept}`;\n}\n"],"mappings":";;AAGA,MAAM,wBAAwB;AAE9B,SAAS,cAAc,MAAuB;CAC5C,IAAI,CAAC,MAAM,OAAO;CAClB,QAAQ,OAAO,SAAS,WAAW,OAAO,KAAK,UAAU,IAAI,EAAA,CAC1D,WAAW,iBAAiB,EAAE,CAAC,CAC/B,WAAW,mBAAmB,EAAE;AACrC;AAEA,SAAgB,cAAc,MAA+B;CAC3D,OAAO,mBAAmB,cAAc,IAAI,CAAC;AAC/C;AAEA,SAAgB,+BAA+B,MAAc,mBAA2B,UAAU,MAAM;CACtG,MAAM,YAAY,cAAc,IAAI;CACpC,MAAM,cAAc,mBAAmB,SAAS;CAEhD,IAAI,eAAe,mBAAmB,OAAO;CAI7C,MAAM,QACJ,UAAU,cAAc,WAAW,CAAC,iBAAiB,IAAI,cAAc,WAAW,GAAG,iBAAiB,EAAA,CACtG,QAAQ,uBAAuB,GAAG;CAEpC,OAAO,eAAe,cAAc,kBAAkB;EACtD;AACF"}
@@ -11,8 +11,8 @@
11
11
  * built on the OpenAI client — `openai` uses the default endpoint, every other
12
12
  * OpenAI-compatible host supplies its `baseURL`. Deepgram is the exception: it
13
13
  * is not OpenAI-compatible, so it resolves through `@mastra/voice-deepgram`
14
- * (`DeepgramVoice`). Deepgram is not in the models.dev STT snapshot but is a
15
- * first-class hosted STT provider, so it is added deliberately.
14
+ * (`DeepgramVoice`), and Mistral through `@mastra/voice-mistral`. Neither is
15
+ * in the models.dev STT snapshot, so both are added by hand.
16
16
  *
17
17
  * The accompanying snapshot test (`__tests__/stt-registry.test.ts`) re-derives
18
18
  * the models.dev-backed entries from a checked-in snapshot so this list stays
@@ -25,8 +25,9 @@
25
25
  * (its `/audio/transcriptions` endpoint follows the OpenAI shape).
26
26
  * - `deepgram`: `DeepgramVoice` from `@mastra/voice-deepgram` (not
27
27
  * OpenAI-compatible; uses the Deepgram SDK).
28
+ * - `mistral`: `MistralVoice` from `@mastra/voice-mistral`.
28
29
  */
29
- export type STTResolver = 'openai' | 'openai-compatible' | 'deepgram';
30
+ export type STTResolver = 'openai' | 'openai-compatible' | 'deepgram' | 'mistral';
30
31
  export interface STTModel {
31
32
  /** models.dev provider id (also the AuthStorage key for the API key). */
32
33
  provider: string;
@@ -38,6 +39,7 @@ export interface STTModel {
38
39
  resolver: STTResolver;
39
40
  /** Base URL for `openai-compatible` providers (from models.dev `api`). */
40
41
  baseURL?: string;
42
+ realtimeModel?: string;
41
43
  }
42
44
  /**
43
45
  * The curated STT catalog. Order matters: the first entry for a provider is its
@@ -55,6 +57,7 @@ export declare function sttProviders(): string[];
55
57
  export declare function sttModelsForProvider(provider: string): STTModel[];
56
58
  /** The default (first) model for a provider, or undefined if unknown. */
57
59
  export declare function defaultModelForProvider(provider: string): STTModel | undefined;
60
+ export declare function findSTTModel(provider: string, model: string): STTModel | undefined;
58
61
  /**
59
62
  * Resolve a provider/model pair to a concrete registry entry.
60
63
  * Falls back to the provider default (then the global default) so callers
@@ -1 +1 @@
1
- {"version":3,"file":"stt-registry.d.ts","sourceRoot":"","sources":["../../src/voice/stt-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;GAOG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,mBAAmB,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,QAAQ;IACvB,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,QAAQ,EAAE,WAAW,CAAC;IACtB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAqFhC,CAAC;AAEX,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,EAAE,QAAyB,CAAC;AAE1D,wDAAwD;AACxD,eAAO,MAAM,oBAAoB,QAA6B,CAAC;AAE/D,6CAA6C;AAC7C,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAUvC;AAED,4DAA4D;AAC5D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAEjE;AAED,yEAAyE;AACzE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAU3E"}
1
+ {"version":3,"file":"stt-registry.d.ts","sourceRoot":"","sources":["../../src/voice/stt-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAElF,MAAM,WAAW,QAAQ;IACvB,yEAAyE;IACzE,QAAQ,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4CAA4C;IAC5C,QAAQ,EAAE,WAAW,CAAC;IACtB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EA4FhC,CAAC;AAEX,2DAA2D;AAC3D,eAAO,MAAM,iBAAiB,EAAE,QAAyB,CAAC;AAE1D,wDAAwD;AACxD,eAAO,MAAM,oBAAoB,QAA6B,CAAC;AAE/D,6CAA6C;AAC7C,wBAAgB,YAAY,IAAI,MAAM,EAAE,CAUvC;AAED,4DAA4D;AAC5D,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAEjE;AAED,yEAAyE;AACzE,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAE9E;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAElF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,QAAQ,CAG3E"}
@@ -43,6 +43,13 @@ const STT_MODELS = [
43
43
  label: "Deepgram Nova-3",
44
44
  resolver: "deepgram"
45
45
  },
46
+ {
47
+ provider: "mistral",
48
+ model: "voxtral-mini-latest",
49
+ label: "Mistral Voxtral Mini",
50
+ resolver: "mistral",
51
+ realtimeModel: "voxtral-mini-transcribe-realtime-3"
52
+ },
46
53
  {
47
54
  provider: "alibaba",
48
55
  model: "qwen3-asr-flash",
@@ -122,22 +129,18 @@ function sttModelsForProvider(provider) {
122
129
  function defaultModelForProvider(provider) {
123
130
  return STT_MODELS.find((m) => m.provider === provider);
124
131
  }
132
+ function findSTTModel(provider, model) {
133
+ return STT_MODELS.find((m) => m.provider === provider && m.model === model);
134
+ }
125
135
  /**
126
136
  * Resolve a provider/model pair to a concrete registry entry.
127
137
  * Falls back to the provider default (then the global default) so callers
128
138
  * always get a usable entry even if settings name an unknown model.
129
139
  */
130
140
  function resolveSTTModel(provider, model) {
131
- if (provider) {
132
- if (model) {
133
- const exact = STT_MODELS.find((m) => m.provider === provider && m.model === model);
134
- if (exact) return exact;
135
- }
136
- const providerDefault = defaultModelForProvider(provider);
137
- if (providerDefault) return providerDefault;
138
- }
139
- return DEFAULT_STT_MODEL;
141
+ if (!provider) return DEFAULT_STT_MODEL;
142
+ return (model ? findSTTModel(provider, model) : void 0) ?? defaultModelForProvider(provider) ?? DEFAULT_STT_MODEL;
140
143
  }
141
- export { DEFAULT_STT_MODEL, DEFAULT_STT_PROVIDER, STT_MODELS, defaultModelForProvider, resolveSTTModel, sttModelsForProvider, sttProviders };
144
+ export { DEFAULT_STT_MODEL, DEFAULT_STT_PROVIDER, STT_MODELS, defaultModelForProvider, findSTTModel, resolveSTTModel, sttModelsForProvider, sttProviders };
142
145
 
143
146
  //# sourceMappingURL=stt-registry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stt-registry.js","names":[],"sources":["../../src/voice/stt-registry.ts"],"sourcesContent":["/**\n * Speech-to-text (STT) model registry for push-to-talk voice input.\n *\n * This is the single source of truth shared by the `/voice` settings picker,\n * settings validation, and the cloud transcription resolver. Entries are\n * derived from models.dev (https://models.dev/api.json): a model is treated as\n * STT when its modalities are audio-in / text-out with no text input.\n *\n * Most cloud providers here speak the OpenAI `/audio/transcriptions` shape, so\n * the cloud engine resolves them through Mastra's `OpenAIVoice` (`MastraVoice`)\n * built on the OpenAI client — `openai` uses the default endpoint, every other\n * OpenAI-compatible host supplies its `baseURL`. Deepgram is the exception: it\n * is not OpenAI-compatible, so it resolves through `@mastra/voice-deepgram`\n * (`DeepgramVoice`). Deepgram is not in the models.dev STT snapshot but is a\n * first-class hosted STT provider, so it is added deliberately.\n *\n * The accompanying snapshot test (`__tests__/stt-registry.test.ts`) re-derives\n * the models.dev-backed entries from a checked-in snapshot so this list stays\n * honest and can be refreshed deliberately rather than drifting by hand.\n */\n\n/**\n * How a provider's transcription model is constructed.\n * - `openai`: `OpenAIVoice` with the default OpenAI endpoint.\n * - `openai-compatible`: `OpenAIVoice` pointed at the host's `baseURL`\n * (its `/audio/transcriptions` endpoint follows the OpenAI shape).\n * - `deepgram`: `DeepgramVoice` from `@mastra/voice-deepgram` (not\n * OpenAI-compatible; uses the Deepgram SDK).\n */\nexport type STTResolver = 'openai' | 'openai-compatible' | 'deepgram';\n\nexport interface STTModel {\n /** models.dev provider id (also the AuthStorage key for the API key). */\n provider: string;\n /** Bare model id passed to the provider's transcription factory. */\n model: string;\n /** Human-friendly label for the picker. */\n label: string;\n /** How to build the transcription model. */\n resolver: STTResolver;\n /** Base URL for `openai-compatible` providers (from models.dev `api`). */\n baseURL?: string;\n}\n\n/**\n * The curated STT catalog. Order matters: the first entry for a provider is its\n * default model, and the first overall entry (`openai`/`whisper-1`) is the\n * global default.\n */\nexport const STT_MODELS: readonly STTModel[] = [\n // OpenAI — default provider.\n { provider: 'openai', model: 'whisper-1', label: 'OpenAI Whisper', resolver: 'openai' },\n { provider: 'openai', model: 'gpt-4o-transcribe', label: 'OpenAI GPT-4o Transcribe', resolver: 'openai' },\n {\n provider: 'openai',\n model: 'gpt-4o-mini-transcribe',\n label: 'OpenAI GPT-4o mini Transcribe',\n resolver: 'openai',\n },\n // Groq — fast, cheap whisper hosting via its OpenAI-compatible endpoint.\n {\n provider: 'groq',\n model: 'whisper-large-v3-turbo',\n label: 'Groq Whisper Large v3 Turbo',\n resolver: 'openai-compatible',\n baseURL: 'https://api.groq.com/openai/v1',\n },\n {\n provider: 'groq',\n model: 'whisper-large-v3',\n label: 'Groq Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://api.groq.com/openai/v1',\n },\n // Deepgram — dedicated STT provider (not OpenAI-compatible); via @mastra/voice-deepgram.\n { provider: 'deepgram', model: 'nova-3', label: 'Deepgram Nova-3', resolver: 'deepgram' },\n // Alibaba Qwen ASR (OpenAI-compatible endpoints).\n {\n provider: 'alibaba',\n model: 'qwen3-asr-flash',\n label: 'Alibaba Qwen3 ASR Flash',\n resolver: 'openai-compatible',\n baseURL: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1',\n },\n {\n provider: 'alibaba-cn',\n model: 'qwen3-asr-flash',\n label: 'Alibaba Qwen3 ASR Flash (China)',\n resolver: 'openai-compatible',\n baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',\n },\n // Whisper hosts (OpenAI-compatible endpoints).\n {\n provider: 'scaleway',\n model: 'whisper-large-v3',\n label: 'Scaleway Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://api.scaleway.ai/v1',\n },\n {\n provider: 'nvidia',\n model: 'openai/whisper-large-v3',\n label: 'Nvidia Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://integrate.api.nvidia.com/v1',\n },\n {\n provider: 'nearai',\n model: 'openai/whisper-large-v3',\n label: 'NEAR AI Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://cloud-api.near.ai/v1',\n },\n {\n provider: 'evroc',\n model: 'openai/whisper-large-v3-turbo',\n label: 'evroc Whisper Large v3 Turbo',\n resolver: 'openai-compatible',\n baseURL: 'https://models.think.evroc.com/v1',\n },\n {\n provider: 'evroc',\n model: 'openai/whisper-large-v3',\n label: 'evroc Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://models.think.evroc.com/v1',\n },\n {\n provider: 'evroc',\n model: 'KBLab/kb-whisper-large',\n label: 'evroc KB-Whisper Large',\n resolver: 'openai-compatible',\n baseURL: 'https://models.think.evroc.com/v1',\n },\n] as const;\n\n/** The global default STT model (first registry entry). */\nexport const DEFAULT_STT_MODEL: STTModel = STT_MODELS[0]!;\n\n/** The default STT provider when none is configured. */\nexport const DEFAULT_STT_PROVIDER = DEFAULT_STT_MODEL.provider;\n\n/** Unique provider ids in registry order. */\nexport function sttProviders(): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const m of STT_MODELS) {\n if (!seen.has(m.provider)) {\n seen.add(m.provider);\n out.push(m.provider);\n }\n }\n return out;\n}\n\n/** All models offered for a provider, in registry order. */\nexport function sttModelsForProvider(provider: string): STTModel[] {\n return STT_MODELS.filter(m => m.provider === provider);\n}\n\n/** The default (first) model for a provider, or undefined if unknown. */\nexport function defaultModelForProvider(provider: string): STTModel | undefined {\n return STT_MODELS.find(m => m.provider === provider);\n}\n\n/**\n * Resolve a provider/model pair to a concrete registry entry.\n * Falls back to the provider default (then the global default) so callers\n * always get a usable entry even if settings name an unknown model.\n */\nexport function resolveSTTModel(provider?: string, model?: string): STTModel {\n if (provider) {\n if (model) {\n const exact = STT_MODELS.find(m => m.provider === provider && m.model === model);\n if (exact) return exact;\n }\n const providerDefault = defaultModelForProvider(provider);\n if (providerDefault) return providerDefault;\n }\n return DEFAULT_STT_MODEL;\n}\n"],"mappings":";;;;;;AAiDA,MAAa,aAAkC;CAE7C;EAAE,UAAU;EAAU,OAAO;EAAa,OAAO;EAAkB,UAAU;CAAS;CACtF;EAAE,UAAU;EAAU,OAAO;EAAqB,OAAO;EAA4B,UAAU;CAAS;CACxG;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;CACZ;CAEA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CAEA;EAAE,UAAU;EAAY,OAAO;EAAU,OAAO;EAAmB,UAAU;CAAW;CAExF;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CAEA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;AACF;;AAGA,MAAa,oBAA8B,WAAW;;AAGtD,MAAa,uBAAuB,kBAAkB;;AAGtD,SAAgB,eAAyB;CACvC,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,MAAgB,CAAC;CACvB,KAAK,MAAM,KAAK,YACd,IAAI,CAAC,KAAK,IAAI,EAAE,QAAQ,GAAG;EACzB,KAAK,IAAI,EAAE,QAAQ;EACnB,IAAI,KAAK,EAAE,QAAQ;CACrB;CAEF,OAAO;AACT;;AAGA,SAAgB,qBAAqB,UAA8B;CACjE,OAAO,WAAW,QAAO,MAAK,EAAE,aAAa,QAAQ;AACvD;;AAGA,SAAgB,wBAAwB,UAAwC;CAC9E,OAAO,WAAW,MAAK,MAAK,EAAE,aAAa,QAAQ;AACrD;;;;;;AAOA,SAAgB,gBAAgB,UAAmB,OAA0B;CAC3E,IAAI,UAAU;EACZ,IAAI,OAAO;GACT,MAAM,QAAQ,WAAW,MAAK,MAAK,EAAE,aAAa,YAAY,EAAE,UAAU,KAAK;GAC/E,IAAI,OAAO,OAAO;EACpB;EACA,MAAM,kBAAkB,wBAAwB,QAAQ;EACxD,IAAI,iBAAiB,OAAO;CAC9B;CACA,OAAO;AACT"}
1
+ {"version":3,"file":"stt-registry.js","names":[],"sources":["../../src/voice/stt-registry.ts"],"sourcesContent":["/**\n * Speech-to-text (STT) model registry for push-to-talk voice input.\n *\n * This is the single source of truth shared by the `/voice` settings picker,\n * settings validation, and the cloud transcription resolver. Entries are\n * derived from models.dev (https://models.dev/api.json): a model is treated as\n * STT when its modalities are audio-in / text-out with no text input.\n *\n * Most cloud providers here speak the OpenAI `/audio/transcriptions` shape, so\n * the cloud engine resolves them through Mastra's `OpenAIVoice` (`MastraVoice`)\n * built on the OpenAI client — `openai` uses the default endpoint, every other\n * OpenAI-compatible host supplies its `baseURL`. Deepgram is the exception: it\n * is not OpenAI-compatible, so it resolves through `@mastra/voice-deepgram`\n * (`DeepgramVoice`), and Mistral through `@mastra/voice-mistral`. Neither is\n * in the models.dev STT snapshot, so both are added by hand.\n *\n * The accompanying snapshot test (`__tests__/stt-registry.test.ts`) re-derives\n * the models.dev-backed entries from a checked-in snapshot so this list stays\n * honest and can be refreshed deliberately rather than drifting by hand.\n */\n\n/**\n * How a provider's transcription model is constructed.\n * - `openai`: `OpenAIVoice` with the default OpenAI endpoint.\n * - `openai-compatible`: `OpenAIVoice` pointed at the host's `baseURL`\n * (its `/audio/transcriptions` endpoint follows the OpenAI shape).\n * - `deepgram`: `DeepgramVoice` from `@mastra/voice-deepgram` (not\n * OpenAI-compatible; uses the Deepgram SDK).\n * - `mistral`: `MistralVoice` from `@mastra/voice-mistral`.\n */\nexport type STTResolver = 'openai' | 'openai-compatible' | 'deepgram' | 'mistral';\n\nexport interface STTModel {\n /** models.dev provider id (also the AuthStorage key for the API key). */\n provider: string;\n /** Bare model id passed to the provider's transcription factory. */\n model: string;\n /** Human-friendly label for the picker. */\n label: string;\n /** How to build the transcription model. */\n resolver: STTResolver;\n /** Base URL for `openai-compatible` providers (from models.dev `api`). */\n baseURL?: string;\n realtimeModel?: string;\n}\n\n/**\n * The curated STT catalog. Order matters: the first entry for a provider is its\n * default model, and the first overall entry (`openai`/`whisper-1`) is the\n * global default.\n */\nexport const STT_MODELS: readonly STTModel[] = [\n // OpenAI — default provider.\n { provider: 'openai', model: 'whisper-1', label: 'OpenAI Whisper', resolver: 'openai' },\n { provider: 'openai', model: 'gpt-4o-transcribe', label: 'OpenAI GPT-4o Transcribe', resolver: 'openai' },\n {\n provider: 'openai',\n model: 'gpt-4o-mini-transcribe',\n label: 'OpenAI GPT-4o mini Transcribe',\n resolver: 'openai',\n },\n // Groq — fast, cheap whisper hosting via its OpenAI-compatible endpoint.\n {\n provider: 'groq',\n model: 'whisper-large-v3-turbo',\n label: 'Groq Whisper Large v3 Turbo',\n resolver: 'openai-compatible',\n baseURL: 'https://api.groq.com/openai/v1',\n },\n {\n provider: 'groq',\n model: 'whisper-large-v3',\n label: 'Groq Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://api.groq.com/openai/v1',\n },\n // Deepgram — dedicated STT provider (not OpenAI-compatible); via @mastra/voice-deepgram.\n { provider: 'deepgram', model: 'nova-3', label: 'Deepgram Nova-3', resolver: 'deepgram' },\n {\n provider: 'mistral',\n model: 'voxtral-mini-latest',\n label: 'Mistral Voxtral Mini',\n resolver: 'mistral',\n realtimeModel: 'voxtral-mini-transcribe-realtime-3',\n },\n // Alibaba Qwen ASR (OpenAI-compatible endpoints).\n {\n provider: 'alibaba',\n model: 'qwen3-asr-flash',\n label: 'Alibaba Qwen3 ASR Flash',\n resolver: 'openai-compatible',\n baseURL: 'https://dashscope-intl.aliyuncs.com/compatible-mode/v1',\n },\n {\n provider: 'alibaba-cn',\n model: 'qwen3-asr-flash',\n label: 'Alibaba Qwen3 ASR Flash (China)',\n resolver: 'openai-compatible',\n baseURL: 'https://dashscope.aliyuncs.com/compatible-mode/v1',\n },\n // Whisper hosts (OpenAI-compatible endpoints).\n {\n provider: 'scaleway',\n model: 'whisper-large-v3',\n label: 'Scaleway Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://api.scaleway.ai/v1',\n },\n {\n provider: 'nvidia',\n model: 'openai/whisper-large-v3',\n label: 'Nvidia Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://integrate.api.nvidia.com/v1',\n },\n {\n provider: 'nearai',\n model: 'openai/whisper-large-v3',\n label: 'NEAR AI Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://cloud-api.near.ai/v1',\n },\n {\n provider: 'evroc',\n model: 'openai/whisper-large-v3-turbo',\n label: 'evroc Whisper Large v3 Turbo',\n resolver: 'openai-compatible',\n baseURL: 'https://models.think.evroc.com/v1',\n },\n {\n provider: 'evroc',\n model: 'openai/whisper-large-v3',\n label: 'evroc Whisper Large v3',\n resolver: 'openai-compatible',\n baseURL: 'https://models.think.evroc.com/v1',\n },\n {\n provider: 'evroc',\n model: 'KBLab/kb-whisper-large',\n label: 'evroc KB-Whisper Large',\n resolver: 'openai-compatible',\n baseURL: 'https://models.think.evroc.com/v1',\n },\n] as const;\n\n/** The global default STT model (first registry entry). */\nexport const DEFAULT_STT_MODEL: STTModel = STT_MODELS[0]!;\n\n/** The default STT provider when none is configured. */\nexport const DEFAULT_STT_PROVIDER = DEFAULT_STT_MODEL.provider;\n\n/** Unique provider ids in registry order. */\nexport function sttProviders(): string[] {\n const seen = new Set<string>();\n const out: string[] = [];\n for (const m of STT_MODELS) {\n if (!seen.has(m.provider)) {\n seen.add(m.provider);\n out.push(m.provider);\n }\n }\n return out;\n}\n\n/** All models offered for a provider, in registry order. */\nexport function sttModelsForProvider(provider: string): STTModel[] {\n return STT_MODELS.filter(m => m.provider === provider);\n}\n\n/** The default (first) model for a provider, or undefined if unknown. */\nexport function defaultModelForProvider(provider: string): STTModel | undefined {\n return STT_MODELS.find(m => m.provider === provider);\n}\n\nexport function findSTTModel(provider: string, model: string): STTModel | undefined {\n return STT_MODELS.find(m => m.provider === provider && m.model === model);\n}\n\n/**\n * Resolve a provider/model pair to a concrete registry entry.\n * Falls back to the provider default (then the global default) so callers\n * always get a usable entry even if settings name an unknown model.\n */\nexport function resolveSTTModel(provider?: string, model?: string): STTModel {\n if (!provider) return DEFAULT_STT_MODEL;\n return (model ? findSTTModel(provider, model) : undefined) ?? defaultModelForProvider(provider) ?? DEFAULT_STT_MODEL;\n}\n"],"mappings":";;;;;;AAmDA,MAAa,aAAkC;CAE7C;EAAE,UAAU;EAAU,OAAO;EAAa,OAAO;EAAkB,UAAU;CAAS;CACtF;EAAE,UAAU;EAAU,OAAO;EAAqB,OAAO;EAA4B,UAAU;CAAS;CACxG;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;CACZ;CAEA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CAEA;EAAE,UAAU;EAAY,OAAO;EAAU,OAAO;EAAmB,UAAU;CAAW;CACxF;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,eAAe;CACjB;CAEA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CAEA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;CACA;EACE,UAAU;EACV,OAAO;EACP,OAAO;EACP,UAAU;EACV,SAAS;CACX;AACF;;AAGA,MAAa,oBAA8B,WAAW;;AAGtD,MAAa,uBAAuB,kBAAkB;;AAGtD,SAAgB,eAAyB;CACvC,MAAM,uBAAO,IAAI,IAAY;CAC7B,MAAM,MAAgB,CAAC;CACvB,KAAK,MAAM,KAAK,YACd,IAAI,CAAC,KAAK,IAAI,EAAE,QAAQ,GAAG;EACzB,KAAK,IAAI,EAAE,QAAQ;EACnB,IAAI,KAAK,EAAE,QAAQ;CACrB;CAEF,OAAO;AACT;;AAGA,SAAgB,qBAAqB,UAA8B;CACjE,OAAO,WAAW,QAAO,MAAK,EAAE,aAAa,QAAQ;AACvD;;AAGA,SAAgB,wBAAwB,UAAwC;CAC9E,OAAO,WAAW,MAAK,MAAK,EAAE,aAAa,QAAQ;AACrD;AAEA,SAAgB,aAAa,UAAkB,OAAqC;CAClF,OAAO,WAAW,MAAK,MAAK,EAAE,aAAa,YAAY,EAAE,UAAU,KAAK;AAC1E;;;;;;AAOA,SAAgB,gBAAgB,UAAmB,OAA0B;CAC3E,IAAI,CAAC,UAAU,OAAO;CACtB,QAAQ,QAAQ,aAAa,UAAU,KAAK,IAAI,KAAA,MAAc,wBAAwB,QAAQ,KAAK;AACrG"}
@@ -0,0 +1,10 @@
1
+ import type { AuthStorage } from '../auth/storage.js';
2
+ import type { STTModel } from './stt-registry.js';
3
+ export declare function sttApiKeyEnvVar(provider: string): string | undefined;
4
+ export declare function resolveSTTApiKey(provider: string, authStorage?: AuthStorage): string | undefined;
5
+ export interface STTTranscriber {
6
+ /** `filetype` is the extension the provider reads the format from (`wav`, `webm`, `m4a`…). */
7
+ transcribe(audio: Buffer, filetype: string): Promise<string>;
8
+ }
9
+ export declare function createSTTTranscriber(entry: STTModel, apiKey: string): Promise<STTTranscriber>;
10
+ //# sourceMappingURL=transcribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcribe.d.ts","sourceRoot":"","sources":["../../src/voice/transcribe.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAQlD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS,CAIhG;AA0DD,MAAM,WAAW,cAAc;IAC7B,8FAA8F;IAC9F,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC9D;AAED,wBAAsB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAgBnG"}
@@ -0,0 +1,77 @@
1
+ import { providerApiKeyEnvVar } from "../agents/mastracode-gateway.js";
2
+ import { Readable } from "stream";
3
+ // src/voice/transcribe.ts
4
+ const STT_ONLY_API_KEY_ENV_VARS = { deepgram: "DEEPGRAM_API_KEY" };
5
+ const STT_TIMEOUT_MS = 6e4;
6
+ const STT_MAX_RETRIES = 1;
7
+ function sttApiKeyEnvVar(provider) {
8
+ return STT_ONLY_API_KEY_ENV_VARS[provider] ?? providerApiKeyEnvVar(provider);
9
+ }
10
+ function resolveSTTApiKey(provider, authStorage) {
11
+ const envVar = sttApiKeyEnvVar(provider);
12
+ return (envVar ? process.env[envVar]?.trim() : void 0) || authStorage?.getStoredApiKey(provider);
13
+ }
14
+ function listenWithFiletype(voice) {
15
+ return (audio, filetype) => voice.listen(Readable.from(audio), { filetype });
16
+ }
17
+ function openAIClientOptions(entry, apiKey) {
18
+ return {
19
+ timeout: STT_TIMEOUT_MS,
20
+ maxRetries: STT_MAX_RETRIES,
21
+ ...apiKey === process.env.OPENAI_API_KEY?.trim() ? {} : {
22
+ organization: null,
23
+ project: null
24
+ },
25
+ ...entry.resolver === "openai-compatible" && entry.baseURL ? { baseURL: entry.baseURL } : {}
26
+ };
27
+ }
28
+ async function buildListen(entry, apiKey) {
29
+ if (entry.resolver === "deepgram") {
30
+ const { DeepgramVoice } = await import("@mastra/voice-deepgram");
31
+ const voice = new DeepgramVoice({ listeningModel: {
32
+ name: entry.model,
33
+ apiKey
34
+ } });
35
+ return (audio) => voice.listen(Readable.from(audio));
36
+ }
37
+ const speechModel = { apiKey };
38
+ if (entry.resolver === "mistral") {
39
+ const { MistralVoice } = await import("@mastra/voice-mistral");
40
+ return listenWithFiletype(new MistralVoice({
41
+ speechModel,
42
+ listeningModel: {
43
+ name: entry.model,
44
+ apiKey
45
+ }
46
+ }));
47
+ }
48
+ const { OpenAIVoice } = await import("@mastra/voice-openai");
49
+ return listenWithFiletype(new OpenAIVoice({
50
+ speechModel,
51
+ listeningModel: {
52
+ name: entry.model,
53
+ apiKey,
54
+ options: openAIClientOptions(entry, apiKey)
55
+ }
56
+ }));
57
+ }
58
+ function normalizeTranscript(result) {
59
+ return (typeof result === "string" ? result : result.transcript ?? "").trim();
60
+ }
61
+ async function createSTTTranscriber(entry, apiKey) {
62
+ const listen = await buildListen(entry, apiKey);
63
+ return { async transcribe(audio, filetype) {
64
+ let timer;
65
+ const timeout = new Promise((_, reject) => {
66
+ timer = setTimeout(() => reject(/* @__PURE__ */ new Error("Speech-to-text timed out after 1 minute.")), STT_TIMEOUT_MS);
67
+ });
68
+ try {
69
+ return normalizeTranscript(await Promise.race([listen(audio, filetype), timeout]));
70
+ } finally {
71
+ clearTimeout(timer);
72
+ }
73
+ } };
74
+ }
75
+ export { createSTTTranscriber, resolveSTTApiKey, sttApiKeyEnvVar };
76
+
77
+ //# sourceMappingURL=transcribe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transcribe.js","names":[],"sources":["../../src/voice/transcribe.ts"],"sourcesContent":["// OAuth (Codex) tokens cannot call the transcription endpoints, so callers pass a real provider API key.\n\nimport { Readable } from 'node:stream';\n\nimport type { DeepgramModel } from '@mastra/voice-deepgram';\nimport type { OpenAIConfig } from '@mastra/voice-openai';\n\nimport { providerApiKeyEnvVar } from '../agents/mastracode-gateway.js';\nimport type { AuthStorage } from '../auth/storage.js';\nimport type { STTModel } from './stt-registry.js';\n\nconst STT_ONLY_API_KEY_ENV_VARS: Record<string, string> = { deepgram: 'DEEPGRAM_API_KEY' };\n\nconst STT_TIMEOUT_MS = 60_000;\n\nconst STT_MAX_RETRIES = 1;\n\nexport function sttApiKeyEnvVar(provider: string): string | undefined {\n return STT_ONLY_API_KEY_ENV_VARS[provider] ?? providerApiKeyEnvVar(provider);\n}\n\nexport function resolveSTTApiKey(provider: string, authStorage?: AuthStorage): string | undefined {\n const envVar = sttApiKeyEnvVar(provider);\n const fromEnv = envVar ? process.env[envVar]?.trim() : undefined;\n return fromEnv || authStorage?.getStoredApiKey(provider);\n}\n\n/** Structural, because each `@mastra/voice-*` package extends its own bundled `MastraVoice`. */\ninterface VoiceListener {\n listen(\n audioStream: NodeJS.ReadableStream,\n options?: Record<string, unknown>,\n ): Promise<string | { transcript?: string }>;\n}\n\ntype Listen = (audio: Buffer, filetype: string) => Promise<string | { transcript?: string }>;\n\nfunction listenWithFiletype(voice: VoiceListener): Listen {\n return (audio, filetype) => voice.listen(Readable.from(audio), { filetype });\n}\n\n// The OpenAI SDK reads OPENAI_ORG_ID and OPENAI_PROJECT_ID, which belong to the OPENAI_API_KEY account only.\nfunction openAIClientOptions(entry: STTModel, apiKey: string): OpenAIConfig['options'] {\n return {\n timeout: STT_TIMEOUT_MS,\n maxRetries: STT_MAX_RETRIES,\n ...(apiKey === process.env.OPENAI_API_KEY?.trim() ? {} : { organization: null, project: null }),\n ...(entry.resolver === 'openai-compatible' && entry.baseURL ? { baseURL: entry.baseURL } : {}),\n };\n}\n\n// Each voice SDK loads on first dictation, not with every session.\nasync function buildListen(entry: STTModel, apiKey: string): Promise<Listen> {\n if (entry.resolver === 'deepgram') {\n const { DeepgramVoice } = await import('@mastra/voice-deepgram');\n // `name` is typed for Deepgram's own ids; the registry's model string is passed verbatim.\n const voice = new DeepgramVoice({ listeningModel: { name: entry.model as DeepgramModel, apiKey } });\n return audio => voice.listen(Readable.from(audio));\n }\n // The OpenAI and Mistral constructors also build a TTS client and throw without its key.\n const speechModel = { apiKey };\n if (entry.resolver === 'mistral') {\n const { MistralVoice } = await import('@mastra/voice-mistral');\n return listenWithFiletype(new MistralVoice({ speechModel, listeningModel: { name: entry.model, apiKey } }));\n }\n const { OpenAIVoice } = await import('@mastra/voice-openai');\n return listenWithFiletype(\n new OpenAIVoice({\n speechModel,\n listeningModel: {\n // Typed for OpenAI's own ids; the client accepts any model string and baseURL.\n name: entry.model as OpenAIConfig['name'],\n apiKey,\n options: openAIClientOptions(entry, apiKey),\n },\n }),\n );\n}\n\nfunction normalizeTranscript(result: string | { transcript?: string }): string {\n return (typeof result === 'string' ? result : (result.transcript ?? '')).trim();\n}\n\nexport interface STTTranscriber {\n /** `filetype` is the extension the provider reads the format from (`wav`, `webm`, `m4a`…). */\n transcribe(audio: Buffer, filetype: string): Promise<string>;\n}\n\nexport async function createSTTTranscriber(entry: STTModel, apiKey: string): Promise<STTTranscriber> {\n const listen = await buildListen(entry, apiKey);\n return {\n async transcribe(audio, filetype) {\n let timer: NodeJS.Timeout | undefined;\n // Only the OpenAI client takes a timeout; Mistral and Deepgram calls, and an OpenAI retry after a slow attempt, are abandoned here, not cancelled.\n const timeout = new Promise<never>((_, reject) => {\n timer = setTimeout(() => reject(new Error('Speech-to-text timed out after 1 minute.')), STT_TIMEOUT_MS);\n });\n try {\n return normalizeTranscript(await Promise.race([listen(audio, filetype), timeout]));\n } finally {\n clearTimeout(timer);\n }\n },\n };\n}\n"],"mappings":";;;AAWA,MAAM,4BAAoD,EAAE,UAAU,mBAAmB;AAEzF,MAAM,iBAAiB;AAEvB,MAAM,kBAAkB;AAExB,SAAgB,gBAAgB,UAAsC;CACpE,OAAO,0BAA0B,aAAa,qBAAqB,QAAQ;AAC7E;AAEA,SAAgB,iBAAiB,UAAkB,aAA+C;CAChG,MAAM,SAAS,gBAAgB,QAAQ;CAEvC,QADgB,SAAS,QAAQ,IAAI,OAAO,EAAE,KAAK,IAAI,KAAA,MACrC,aAAa,gBAAgB,QAAQ;AACzD;AAYA,SAAS,mBAAmB,OAA8B;CACxD,QAAQ,OAAO,aAAa,MAAM,OAAO,SAAS,KAAK,KAAK,GAAG,EAAE,SAAS,CAAC;AAC7E;AAGA,SAAS,oBAAoB,OAAiB,QAAyC;CACrF,OAAO;EACL,SAAS;EACT,YAAY;EACZ,GAAI,WAAW,QAAQ,IAAI,gBAAgB,KAAK,IAAI,CAAC,IAAI;GAAE,cAAc;GAAM,SAAS;EAAK;EAC7F,GAAI,MAAM,aAAa,uBAAuB,MAAM,UAAU,EAAE,SAAS,MAAM,QAAQ,IAAI,CAAC;CAC9F;AACF;AAGA,eAAe,YAAY,OAAiB,QAAiC;CAC3E,IAAI,MAAM,aAAa,YAAY;EACjC,MAAM,EAAE,kBAAkB,MAAM,OAAO;EAEvC,MAAM,QAAQ,IAAI,cAAc,EAAE,gBAAgB;GAAE,MAAM,MAAM;GAAwB;EAAO,EAAE,CAAC;EAClG,QAAO,UAAS,MAAM,OAAO,SAAS,KAAK,KAAK,CAAC;CACnD;CAEA,MAAM,cAAc,EAAE,OAAO;CAC7B,IAAI,MAAM,aAAa,WAAW;EAChC,MAAM,EAAE,iBAAiB,MAAM,OAAO;EACtC,OAAO,mBAAmB,IAAI,aAAa;GAAE;GAAa,gBAAgB;IAAE,MAAM,MAAM;IAAO;GAAO;EAAE,CAAC,CAAC;CAC5G;CACA,MAAM,EAAE,gBAAgB,MAAM,OAAO;CACrC,OAAO,mBACL,IAAI,YAAY;EACd;EACA,gBAAgB;GAEd,MAAM,MAAM;GACZ;GACA,SAAS,oBAAoB,OAAO,MAAM;EAC5C;CACF,CAAC,CACH;AACF;AAEA,SAAS,oBAAoB,QAAkD;CAC7E,QAAQ,OAAO,WAAW,WAAW,SAAU,OAAO,cAAc,GAAA,CAAK,KAAK;AAChF;AAOA,eAAsB,qBAAqB,OAAiB,QAAyC;CACnG,MAAM,SAAS,MAAM,YAAY,OAAO,MAAM;CAC9C,OAAO,EACL,MAAM,WAAW,OAAO,UAAU;EAChC,IAAI;EAEJ,MAAM,UAAU,IAAI,SAAgB,GAAG,WAAW;GAChD,QAAQ,iBAAiB,uBAAO,IAAI,MAAM,0CAA0C,CAAC,GAAG,cAAc;EACxG,CAAC;EACD,IAAI;GACF,OAAO,oBAAoB,MAAM,QAAQ,KAAK,CAAC,OAAO,OAAO,QAAQ,GAAG,OAAO,CAAC,CAAC;EACnF,UAAU;GACR,aAAa,KAAK;EACpB;CACF,EACF;AACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mastra/code-sdk",
3
- "version": "1.19.0-alpha.0",
3
+ "version": "1.19.0-alpha.10",
4
4
  "description": "Mastra Code SDK: the agent core behind Mastra Code (everything except the TUI) — build your own UIs and surfaces on top of it",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -64,19 +64,22 @@
64
64
  "yaml": "^2.9.1",
65
65
  "zod": "^4.6.7",
66
66
  "@mastra/agent-browser": "0.6.0",
67
- "@mastra/client-js": "1.60.0-alpha.0",
68
- "@mastra/duckdb": "1.19.0-alpha.0",
69
- "@mastra/fastembed": "1.3.6",
67
+ "@mastra/client-js": "1.60.0-alpha.8",
68
+ "@mastra/duckdb": "1.19.0-alpha.3",
69
+ "@mastra/fastembed": "1.3.7-alpha.0",
70
70
  "@mastra/github-signals": "0.5.2",
71
- "@mastra/libsql": "1.30.0-alpha.0",
72
- "@mastra/mcp": "2.9.0-alpha.0",
73
- "@mastra/memory": "1.41.1-alpha.0",
74
- "@mastra/observability": "1.23.2-alpha.0",
71
+ "@mastra/libsql": "1.30.0-alpha.2",
72
+ "@mastra/mcp": "2.9.0-alpha.3",
73
+ "@mastra/memory": "1.41.1-alpha.3",
74
+ "@mastra/observability": "1.24.0-alpha.5",
75
75
  "@mastra/parallel": "0.1.5",
76
- "@mastra/pg": "1.36.0-alpha.0",
77
- "@mastra/schema-compat": "1.3.17",
76
+ "@mastra/pg": "1.36.0-alpha.3",
77
+ "@mastra/schema-compat": "1.3.18-alpha.0",
78
78
  "@mastra/stagehand": "0.4.0",
79
- "@mastra/tavily": "1.1.3"
79
+ "@mastra/tavily": "1.1.3",
80
+ "@mastra/voice-deepgram": "0.13.4-alpha.0",
81
+ "@mastra/voice-mistral": "0.1.3",
82
+ "@mastra/voice-openai": "0.13.4"
80
83
  },
81
84
  "devDependencies": {
82
85
  "@ai-sdk/provider": "^4.0.35",
@@ -91,7 +94,7 @@
91
94
  "@internal/lint": "0.0.148",
92
95
  "@internal/types-builder": "0.0.123",
93
96
  "@internal/workspace-test-utils": "0.0.92",
94
- "@mastra/core": "1.83.0-alpha.0"
97
+ "@mastra/core": "1.83.0-alpha.8"
95
98
  },
96
99
  "peerDependencies": {
97
100
  "@mastra/core": ">=1.83.0-0 <2.0.0-0"