@hiper2d/ai-agents 0.1.5 → 0.2.0

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.
package/dist/index.mjs CHANGED
@@ -1618,6 +1618,263 @@ function extractTokenUsageFromResponse7(response) {
1618
1618
  return extractMistralTokenUsage(response);
1619
1619
  }
1620
1620
 
1621
+ // src/voice/voice-catalog.ts
1622
+ var VOICE_MODEL_CONSTANTS = {
1623
+ OPENAI_TTS: "gpt-4o-mini-tts",
1624
+ OPENAI_STT: "whisper-1",
1625
+ // ai.google.dev/gemini-api/docs/speech-generation
1626
+ GOOGLE_TTS: "gemini-3.1-flash-tts-preview",
1627
+ // ai.google.dev/gemini-api/docs/transcribe — Interactions API only (see google-stt.ts)
1628
+ GOOGLE_STT: "gemini-3.5-transcribe"
1629
+ };
1630
+ var SUPPORTED_VOICE_PROVIDERS = ["openai", "google"];
1631
+ var VOICE_PROVIDER_API_KEY = {
1632
+ openai: API_KEY_CONSTANTS.OPENAI,
1633
+ google: API_KEY_CONSTANTS.GOOGLE
1634
+ };
1635
+ var VOICE_MODEL_PRICING = {
1636
+ [VOICE_MODEL_CONSTANTS.OPENAI_TTS]: { pricePerMillionCharacters: 15 },
1637
+ [VOICE_MODEL_CONSTANTS.OPENAI_STT]: { pricePerMinute: 6e-3 },
1638
+ // Measured 2026-09-05: ~32 audio tokens per second of speech, so a 15-second
1639
+ // line is ~$0.01 — about 3-5x an OpenAI line of the same length.
1640
+ [VOICE_MODEL_CONSTANTS.GOOGLE_TTS]: { textInputPricePerM: 1, audioOutputPricePerM: 20 },
1641
+ // ~25 audio tokens per second in, ~175 text tokens per minute out: ≈ $0.005/min.
1642
+ [VOICE_MODEL_CONSTANTS.GOOGLE_STT]: { audioInputPricePerM: 2, textOutputPricePerM: 12 }
1643
+ };
1644
+
1645
+ // src/voice/voice-pricing.ts
1646
+ function roundUSD(value) {
1647
+ return parseFloat((value || 0).toFixed(6));
1648
+ }
1649
+ function calculateOpenAiTtsCost(characterCount) {
1650
+ const rate = VOICE_MODEL_PRICING[VOICE_MODEL_CONSTANTS.OPENAI_TTS]?.pricePerMillionCharacters ?? 0;
1651
+ if (!characterCount || characterCount <= 0 || rate <= 0) return 0;
1652
+ return roundUSD(characterCount / 1e6 * rate);
1653
+ }
1654
+ function calculateOpenAiSttCost(durationSeconds) {
1655
+ const rate = VOICE_MODEL_PRICING[VOICE_MODEL_CONSTANTS.OPENAI_STT]?.pricePerMinute ?? 0;
1656
+ if (!durationSeconds || durationSeconds <= 0 || rate <= 0) return 0;
1657
+ return roundUSD(durationSeconds / 60 * rate);
1658
+ }
1659
+ function calculateGeminiTtsCost(usage) {
1660
+ const pricing = VOICE_MODEL_PRICING[VOICE_MODEL_CONSTANTS.GOOGLE_TTS];
1661
+ return tokenPairCost(usage, pricing?.textInputPricePerM ?? 0, pricing?.audioOutputPricePerM ?? 0);
1662
+ }
1663
+ function calculateGeminiSttCost(usage) {
1664
+ const pricing = VOICE_MODEL_PRICING[VOICE_MODEL_CONSTANTS.GOOGLE_STT];
1665
+ return tokenPairCost(usage, pricing?.audioInputPricePerM ?? 0, pricing?.textOutputPricePerM ?? 0);
1666
+ }
1667
+ function tokenPairCost(usage, inputRate, outputRate) {
1668
+ const inputTokens = Math.max(0, usage.inputTokens || 0);
1669
+ const outputTokens = Math.max(0, usage.outputTokens || 0);
1670
+ return inputTokens / 1e6 * inputRate + outputTokens / 1e6 * outputRate;
1671
+ }
1672
+
1673
+ // src/voice/openai-tts.ts
1674
+ import { OpenAI } from "openai";
1675
+ async function generateOpenAiTtsAudio(text, apiKey, options = {}) {
1676
+ const client = new OpenAI({ apiKey });
1677
+ const speechOptions = {
1678
+ model: VOICE_MODEL_CONSTANTS.OPENAI_TTS,
1679
+ voice: options.voice || "alloy",
1680
+ input: text,
1681
+ speed: options.speed || 1,
1682
+ response_format: options.format || "wav"
1683
+ };
1684
+ if (options.instructions) {
1685
+ speechOptions.instructions = options.instructions;
1686
+ }
1687
+ const response = await client.audio.speech.create(speechOptions);
1688
+ return await response.arrayBuffer();
1689
+ }
1690
+
1691
+ // src/voice/openai-stt.ts
1692
+ import { OpenAI as OpenAI2 } from "openai";
1693
+ async function transcribeWithOpenAi(audioBuffer, apiKey, options = {}) {
1694
+ const client = new OpenAI2({ apiKey });
1695
+ const audioFile = new File([new Uint8Array(audioBuffer)], options.fileName || "audio.webm", { type: options.mimeType || "audio/webm" });
1696
+ const transcription = await client.audio.transcriptions.create({
1697
+ file: audioFile,
1698
+ model: VOICE_MODEL_CONSTANTS.OPENAI_STT,
1699
+ language: options.language || "en",
1700
+ prompt: options.prompt,
1701
+ temperature: options.temperature || 0,
1702
+ response_format: "verbose_json"
1703
+ });
1704
+ const explicitDuration = Number(transcription?.duration) || 0;
1705
+ const segments = Array.isArray(transcription?.segments) ? transcription.segments : [];
1706
+ const segmentsDuration = segments.reduce((max, segment) => {
1707
+ const end = Number(segment?.end);
1708
+ return end > max ? end : max;
1709
+ }, 0);
1710
+ const text = typeof transcription?.text === "string" ? transcription.text : segments.map((segment) => segment?.text || "").join(" ");
1711
+ return { text: text.trim(), durationSeconds: explicitDuration || segmentsDuration };
1712
+ }
1713
+
1714
+ // src/voice/openai-voice-agent.ts
1715
+ var OpenAiVoiceAgent = class {
1716
+ constructor(apiKey) {
1717
+ this.apiKey = apiKey;
1718
+ }
1719
+ apiKey;
1720
+ provider = "openai";
1721
+ ttsModel = VOICE_MODEL_CONSTANTS.OPENAI_TTS;
1722
+ sttModel = VOICE_MODEL_CONSTANTS.OPENAI_STT;
1723
+ async speak(request) {
1724
+ const audio = await generateOpenAiTtsAudio(request.text, this.apiKey, {
1725
+ voice: request.voice,
1726
+ instructions: request.voiceStyle || void 0
1727
+ });
1728
+ const characters = request.text.length;
1729
+ return { audio, costUSD: calculateOpenAiTtsCost(characters), usage: { characters } };
1730
+ }
1731
+ async transcribe(request) {
1732
+ const { text, durationSeconds } = await transcribeWithOpenAi(request.audio, this.apiKey, {
1733
+ language: request.language,
1734
+ prompt: request.prompt,
1735
+ fileName: request.fileName,
1736
+ mimeType: request.mimeType
1737
+ });
1738
+ return { text, durationSeconds, costUSD: calculateOpenAiSttCost(durationSeconds), usage: { audioSeconds: durationSeconds } };
1739
+ }
1740
+ };
1741
+
1742
+ // src/voice/google-tts.ts
1743
+ import { GoogleGenAI } from "@google/genai";
1744
+ var AUDIO_TOKENS_PER_SECOND = 32;
1745
+ var SAMPLE_RATE = 24e3;
1746
+ var PCM_BYTES_PER_SECOND = SAMPLE_RATE * 2;
1747
+ function buildGoogleTtsPrompt(text, voiceStyle) {
1748
+ const style = voiceStyle?.trim().replace(/[:.!,;\s]+$/, "");
1749
+ if (!style) return text;
1750
+ const isShort = style.split(/\s+/).length <= 3 && !/[.!?,;]/.test(style);
1751
+ return isShort ? `Say ${style}: ${text}` : `${style}:
1752
+ ${text}`;
1753
+ }
1754
+ function pcmToWav(pcmData, sampleRate = SAMPLE_RATE) {
1755
+ const numChannels = 1;
1756
+ const bitsPerSample = 16;
1757
+ const blockAlign = numChannels * (bitsPerSample / 8);
1758
+ const byteRate = sampleRate * blockAlign;
1759
+ const headerSize = 44;
1760
+ const buffer = new ArrayBuffer(headerSize + pcmData.length);
1761
+ const view = new DataView(buffer);
1762
+ const writeString = (offset, str) => {
1763
+ for (let i = 0; i < str.length; i++) view.setUint8(offset + i, str.charCodeAt(i));
1764
+ };
1765
+ writeString(0, "RIFF");
1766
+ view.setUint32(4, 36 + pcmData.length, true);
1767
+ writeString(8, "WAVE");
1768
+ writeString(12, "fmt ");
1769
+ view.setUint32(16, 16, true);
1770
+ view.setUint16(20, 1, true);
1771
+ view.setUint16(22, numChannels, true);
1772
+ view.setUint32(24, sampleRate, true);
1773
+ view.setUint32(28, byteRate, true);
1774
+ view.setUint16(32, blockAlign, true);
1775
+ view.setUint16(34, bitsPerSample, true);
1776
+ writeString(36, "data");
1777
+ view.setUint32(40, pcmData.length, true);
1778
+ new Uint8Array(buffer, headerSize).set(pcmData);
1779
+ return buffer;
1780
+ }
1781
+ async function generateGoogleTtsAudio(text, apiKey, options) {
1782
+ const client = new GoogleGenAI({ apiKey });
1783
+ const response = await client.models.generateContent({
1784
+ model: VOICE_MODEL_CONSTANTS.GOOGLE_TTS,
1785
+ contents: [{ parts: [{ text: buildGoogleTtsPrompt(text, options.voiceStyle) }] }],
1786
+ config: {
1787
+ responseModalities: ["AUDIO"],
1788
+ speechConfig: { voiceConfig: { prebuiltVoiceConfig: { voiceName: options.voiceName } } }
1789
+ }
1790
+ });
1791
+ const parts = response.candidates?.[0]?.content?.parts ?? [];
1792
+ const audioPart = parts.find((part) => part.inlineData?.mimeType?.startsWith("audio/"));
1793
+ if (!audioPart?.inlineData?.data) {
1794
+ throw new Error("No audio data in Google TTS response");
1795
+ }
1796
+ const pcmData = new Uint8Array(Buffer.from(audioPart.inlineData.data, "base64"));
1797
+ const usageMetadata = response.usageMetadata ?? {};
1798
+ const inputTokens = usageMetadata.promptTokenCount ?? 0;
1799
+ const reportedOutput = usageMetadata.candidatesTokenCount;
1800
+ const outputTokens = reportedOutput && reportedOutput > 0 ? reportedOutput : Math.ceil(pcmData.length / PCM_BYTES_PER_SECOND * AUDIO_TOKENS_PER_SECOND);
1801
+ return { audio: pcmToWav(pcmData), usage: { inputTokens, outputTokens } };
1802
+ }
1803
+
1804
+ // src/voice/google-stt.ts
1805
+ import { GoogleGenAI as GoogleGenAI2 } from "@google/genai";
1806
+ var GEMINI_AUDIO_TOKENS_PER_SECOND = 25;
1807
+ async function transcribeWithGemini(audioBuffer, apiKey, options = {}) {
1808
+ const client = new GoogleGenAI2({ apiKey });
1809
+ const interaction = await client.interactions.create({
1810
+ model: VOICE_MODEL_CONSTANTS.GOOGLE_STT,
1811
+ input: [{ type: "audio", data: Buffer.from(audioBuffer).toString("base64"), mime_type: options.mimeType || "audio/webm" }]
1812
+ });
1813
+ const text = typeof interaction?.output_text === "string" ? interaction.output_text.trim() : "";
1814
+ const usage = interaction?.usage ?? {};
1815
+ const byModality = (rows, modality) => (rows ?? []).filter((r) => r?.modality === modality).reduce((sum, r) => sum + (Number(r?.tokens) || 0), 0);
1816
+ const inputTokens = byModality(usage.input_tokens_by_modality, "audio") || usage.total_input_tokens || 0;
1817
+ const invocationOutput = (usage.model_invocation_token_counts ?? []).reduce((sum, inv) => sum + (inv?.candidates_tokens_details ?? []).reduce((s, d) => s + (Number(d?.tokens) || 0), 0), 0);
1818
+ const outputTokens = usage.total_output_tokens || invocationOutput || Math.ceil(text.length / 4);
1819
+ return { text, durationSeconds: inputTokens / GEMINI_AUDIO_TOKENS_PER_SECOND, usage: { inputTokens, outputTokens } };
1820
+ }
1821
+
1822
+ // src/voice/google-voice-agent.ts
1823
+ var GoogleVoiceAgent = class {
1824
+ constructor(apiKey) {
1825
+ this.apiKey = apiKey;
1826
+ }
1827
+ apiKey;
1828
+ provider = "google";
1829
+ ttsModel = VOICE_MODEL_CONSTANTS.GOOGLE_TTS;
1830
+ sttModel = VOICE_MODEL_CONSTANTS.GOOGLE_STT;
1831
+ async speak(request) {
1832
+ const { audio, usage } = await generateGoogleTtsAudio(request.text, this.apiKey, {
1833
+ voiceName: request.voice,
1834
+ voiceStyle: request.voiceStyle
1835
+ });
1836
+ return { audio, costUSD: calculateGeminiTtsCost(usage), usage };
1837
+ }
1838
+ async transcribe(request) {
1839
+ const { text, durationSeconds, usage } = await transcribeWithGemini(request.audio, this.apiKey, { mimeType: request.mimeType });
1840
+ return { text, durationSeconds, costUSD: calculateGeminiSttCost(usage), usage };
1841
+ }
1842
+ };
1843
+
1844
+ // src/voice/voice-agent-factory.ts
1845
+ var VoiceAgentFactory = class _VoiceAgentFactory {
1846
+ /** Build an agent from a key already resolved by the caller. */
1847
+ static createAgent(provider, apiKey) {
1848
+ switch (provider) {
1849
+ case "openai":
1850
+ return new OpenAiVoiceAgent(apiKey);
1851
+ case "google":
1852
+ return new GoogleVoiceAgent(apiKey);
1853
+ default:
1854
+ throw new Error(`Unknown voice provider: ${provider}`);
1855
+ }
1856
+ }
1857
+ /**
1858
+ * Build an agent from a key map (the shape AgentFactory takes), reading the
1859
+ * provider's key by its API_KEY_CONSTANTS name. Throws when the key is missing
1860
+ * so the host can report a misconfiguration before any SDK is touched.
1861
+ */
1862
+ static createAgentFromKeys(provider, apiKeys) {
1863
+ if (!SUPPORTED_VOICE_PROVIDERS.includes(provider)) {
1864
+ throw new Error(`Unknown voice provider: ${provider}`);
1865
+ }
1866
+ const keyName = VOICE_PROVIDER_API_KEY[provider];
1867
+ const apiKey = apiKeys[keyName];
1868
+ if (!apiKey) {
1869
+ throw new Error(`Missing API key ${keyName} for voice provider ${provider}`);
1870
+ }
1871
+ return _VoiceAgentFactory.createAgent(provider, apiKey);
1872
+ }
1873
+ };
1874
+ function createVoiceAgent(provider, apiKey) {
1875
+ return VoiceAgentFactory.createAgent(provider, apiKey);
1876
+ }
1877
+
1621
1878
  // src/agents/abstract-agent.ts
1622
1879
  var AbstractAgent = class {
1623
1880
  name;
@@ -1764,7 +2021,7 @@ ${msg.content}` };
1764
2021
  };
1765
2022
 
1766
2023
  // src/agents/gpt-5-agent.ts
1767
- import OpenAI from "openai";
2024
+ import OpenAI3 from "openai";
1768
2025
  import { zodTextFormat } from "openai/helpers/zod";
1769
2026
  var Gpt5Agent = class extends AbstractAgent {
1770
2027
  client;
@@ -1780,7 +2037,7 @@ var Gpt5Agent = class extends AbstractAgent {
1780
2037
  };
1781
2038
  constructor(name, instruction, model, apiKey, temperature, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
1782
2039
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
1783
- this.client = new OpenAI({
2040
+ this.client = new OpenAI3({
1784
2041
  apiKey
1785
2042
  });
1786
2043
  }
@@ -2312,7 +2569,7 @@ ${schemaDescription}`;
2312
2569
  };
2313
2570
 
2314
2571
  // src/agents/google-agent.ts
2315
- import { GoogleGenAI } from "@google/genai";
2572
+ import { GoogleGenAI as GoogleGenAI3 } from "@google/genai";
2316
2573
  var GoogleAgent = class extends AbstractAgent {
2317
2574
  client;
2318
2575
  defaultConfig = {
@@ -2331,7 +2588,7 @@ var GoogleAgent = class extends AbstractAgent {
2331
2588
  };
2332
2589
  constructor(name, instruction, model, apiKey, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
2333
2590
  super(name, instruction, model, 0.2, enableThinking, agentLoggingConfig);
2334
- this.client = new GoogleGenAI({
2591
+ this.client = new GoogleGenAI3({
2335
2592
  apiKey
2336
2593
  });
2337
2594
  }
@@ -2892,7 +3149,7 @@ ${schemaDescription}`
2892
3149
  };
2893
3150
 
2894
3151
  // src/agents/deepseek-v2-agent.ts
2895
- import OpenAI2 from "openai";
3152
+ import OpenAI4 from "openai";
2896
3153
  var DeepSeekV2Agent = class extends AbstractAgent {
2897
3154
  client;
2898
3155
  // Log message templates
@@ -2908,7 +3165,7 @@ var DeepSeekV2Agent = class extends AbstractAgent {
2908
3165
  };
2909
3166
  constructor(name, instruction, model, apiKey, temperature, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
2910
3167
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
2911
- this.client = new OpenAI2({
3168
+ this.client = new OpenAI4({
2912
3169
  baseURL: "https://api.deepseek.com",
2913
3170
  apiKey
2914
3171
  });
@@ -3100,7 +3357,7 @@ ${schemaDescription}`
3100
3357
  };
3101
3358
 
3102
3359
  // src/agents/grok-agent.ts
3103
- import { OpenAI as OpenAI3 } from "openai";
3360
+ import { OpenAI as OpenAI5 } from "openai";
3104
3361
  var GrokAgent = class extends AbstractAgent {
3105
3362
  client;
3106
3363
  // Log message templates
@@ -3117,7 +3374,7 @@ var GrokAgent = class extends AbstractAgent {
3117
3374
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
3118
3375
  const convId = stableHashHex(`${name}
3119
3376
  ${instruction}`);
3120
- this.client = new OpenAI3({
3377
+ this.client = new OpenAI5({
3121
3378
  apiKey,
3122
3379
  baseURL: "https://api.x.ai/v1",
3123
3380
  timeout: 12e5,
@@ -3290,7 +3547,7 @@ ${input[0].content}`;
3290
3547
  };
3291
3548
 
3292
3549
  // src/agents/kimi-agent.ts
3293
- import { OpenAI as OpenAI4 } from "openai";
3550
+ import { OpenAI as OpenAI6 } from "openai";
3294
3551
  var KimiAgent = class extends AbstractAgent {
3295
3552
  client;
3296
3553
  // kimi-k3 rejects any temperature other than 1, so we never send the field.
@@ -3317,7 +3574,7 @@ var KimiAgent = class extends AbstractAgent {
3317
3574
  };
3318
3575
  constructor(name, instruction, model, apiKey, temperature, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
3319
3576
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
3320
- this.client = new OpenAI4({
3577
+ this.client = new OpenAI6({
3321
3578
  apiKey,
3322
3579
  baseURL: "https://api.moonshot.ai/v1"
3323
3580
  });
@@ -3508,7 +3765,7 @@ ${openAIMessages[0].content}`;
3508
3765
  };
3509
3766
 
3510
3767
  // src/agents/glm-agent.ts
3511
- import { OpenAI as OpenAI5 } from "openai";
3768
+ import { OpenAI as OpenAI7 } from "openai";
3512
3769
  var GlmAgent = class extends AbstractAgent {
3513
3770
  client;
3514
3771
  // A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
@@ -3534,7 +3791,7 @@ var GlmAgent = class extends AbstractAgent {
3534
3791
  };
3535
3792
  constructor(name, instruction, model, apiKey, temperature, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
3536
3793
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
3537
- this.client = new OpenAI5({
3794
+ this.client = new OpenAI7({
3538
3795
  apiKey,
3539
3796
  baseURL: "https://api.z.ai/api/paas/v4/"
3540
3797
  });
@@ -3688,7 +3945,7 @@ ${openAIMessages[0].content}`;
3688
3945
  };
3689
3946
 
3690
3947
  // src/agents/fugu-agent.ts
3691
- import { OpenAI as OpenAI6 } from "openai";
3948
+ import { OpenAI as OpenAI8 } from "openai";
3692
3949
  var FuguAgent = class extends AbstractAgent {
3693
3950
  client;
3694
3951
  // A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
@@ -3712,7 +3969,7 @@ var FuguAgent = class extends AbstractAgent {
3712
3969
  };
3713
3970
  constructor(name, instruction, model, apiKey, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
3714
3971
  super(name, instruction, model, 1, enableThinking, agentLoggingConfig);
3715
- this.client = new OpenAI6({
3972
+ this.client = new OpenAI8({
3716
3973
  apiKey,
3717
3974
  baseURL: "https://api.sakana.ai/v1",
3718
3975
  timeout: 12e5
@@ -3879,7 +4136,7 @@ ${schemaDescription}`;
3879
4136
  };
3880
4137
 
3881
4138
  // src/agents/qwen-agent.ts
3882
- import { OpenAI as OpenAI7 } from "openai";
4139
+ import { OpenAI as OpenAI9 } from "openai";
3883
4140
  var QwenAgent = class extends AbstractAgent {
3884
4141
  client;
3885
4142
  // A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
@@ -3904,7 +4161,7 @@ var QwenAgent = class extends AbstractAgent {
3904
4161
  };
3905
4162
  constructor(name, instruction, model, apiKey, temperature, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
3906
4163
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
3907
- this.client = new OpenAI7({
4164
+ this.client = new OpenAI9({
3908
4165
  apiKey,
3909
4166
  baseURL: "https://dashscope-intl.aliyuncs.com/compatible-mode/v1"
3910
4167
  });
@@ -4079,7 +4336,7 @@ ${openAIMessages[0].content}`;
4079
4336
  };
4080
4337
 
4081
4338
  // src/agents/minimax-agent.ts
4082
- import { OpenAI as OpenAI8 } from "openai";
4339
+ import { OpenAI as OpenAI10 } from "openai";
4083
4340
  var MiniMaxAgent = class extends AbstractAgent {
4084
4341
  client;
4085
4342
  // A getter, not a field: `maxOutputTokens` can be raised after construction, and a field
@@ -4104,7 +4361,7 @@ var MiniMaxAgent = class extends AbstractAgent {
4104
4361
  };
4105
4362
  constructor(name, instruction, model, apiKey, temperature, enableThinking = false, agentLoggingConfig = DEFAULT_LOGGING_CONFIG.agents) {
4106
4363
  super(name, instruction, model, temperature, enableThinking, agentLoggingConfig);
4107
- this.client = new OpenAI8({
4364
+ this.client = new OpenAI10({
4108
4365
  apiKey,
4109
4366
  baseURL: "https://api.minimax.io/v1"
4110
4367
  });
@@ -4341,10 +4598,12 @@ export {
4341
4598
  DeepSeekV2Agent,
4342
4599
  FUGU_REASONING_EFFORTS,
4343
4600
  FuguAgent,
4601
+ GEMINI_AUDIO_TOKENS_PER_SECOND,
4344
4602
  GEMINI_REASONING_EFFORTS,
4345
4603
  GLM_REASONING_EFFORTS,
4346
4604
  GlmAgent,
4347
4605
  GoogleAgent,
4606
+ GoogleVoiceAgent,
4348
4607
  Gpt5Agent,
4349
4608
  GrokAgent,
4350
4609
  KimiAgent,
@@ -4362,23 +4621,35 @@ export {
4362
4621
  ModelRefusalError,
4363
4622
  ModelUnavailableError,
4364
4623
  OPENAI_REASONING_EFFORTS,
4624
+ OpenAiVoiceAgent,
4365
4625
  QwenAgent,
4366
4626
  REASONING_EFFORT_SCALE,
4627
+ SUPPORTED_VOICE_PROVIDERS,
4367
4628
  SupportedAiKeyNames,
4368
4629
  SupportedAiModels,
4630
+ VOICE_MODEL_CONSTANTS,
4631
+ VOICE_MODEL_PRICING,
4632
+ VOICE_PROVIDER_API_KEY,
4633
+ VoiceAgentFactory,
4369
4634
  ZodSchemaConverter,
4635
+ buildGoogleTtsPrompt,
4370
4636
  calculateAnthropicCost,
4371
4637
  calculateCost,
4372
4638
  calculateDeepSeekCost,
4639
+ calculateGeminiSttCost,
4640
+ calculateGeminiTtsCost,
4373
4641
  calculateGoogleCost,
4374
4642
  calculateGrokCost,
4375
4643
  calculateKimiCost,
4376
4644
  calculateMistralCost,
4377
4645
  calculateModelCost,
4378
4646
  calculateOpenAICost,
4647
+ calculateOpenAiSttCost,
4648
+ calculateOpenAiTtsCost,
4379
4649
  clampReasoningEffort,
4380
4650
  cleanResponse,
4381
4651
  createCatalog,
4652
+ createVoiceAgent,
4382
4653
  extractAnthropicTokenUsage,
4383
4654
  extractTokenUsageFromResponse5 as extractAnthropicTokenUsageFromResponse,
4384
4655
  extractDeepSeekTokenUsage,
@@ -4396,6 +4667,8 @@ export {
4396
4667
  extractTokenUsageFromResponse as extractOpenAITokenUsageFromResponse,
4397
4668
  extractTokenUsage,
4398
4669
  extractUsageAndCalculateCost,
4670
+ generateGoogleTtsAudio,
4671
+ generateOpenAiTtsAudio,
4399
4672
  generateSchemaInstructions,
4400
4673
  getModelConfigByApiName,
4401
4674
  getModelDisplayName,
@@ -4412,6 +4685,7 @@ export {
4412
4685
  modelIsFast,
4413
4686
  needsPromptBasedSchema,
4414
4687
  parseAndValidateLlmJson,
4688
+ pcmToWav,
4415
4689
  safeValidateResponse,
4416
4690
  setLlmLogger,
4417
4691
  stableHashHex,
@@ -4423,6 +4697,8 @@ export {
4423
4697
  toGeminiEffort,
4424
4698
  toGlmEffort,
4425
4699
  toOpenAIEffort,
4700
+ transcribeWithGemini,
4701
+ transcribeWithOpenAi,
4426
4702
  validateResponse
4427
4703
  };
4428
4704
  //# sourceMappingURL=index.mjs.map