@hiper2d/ai-agents 0.15.0 → 0.17.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/README.md +3 -3
- package/dist/index.d.mts +27 -14
- package/dist/index.d.ts +27 -14
- package/dist/index.js +65 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -69,10 +69,10 @@ const { audio, costUSD } = await voice.speak({ text: 'Night falls.', voice: 'Kor
|
|
|
69
69
|
const { text } = await voice.transcribe({ audio: recording, mimeType: 'audio/webm' });
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
`openai` runs gpt-4o-mini-tts + Whisper, `google` runs Gemini 3.
|
|
72
|
+
`openai` runs gpt-4o-mini-tts + Whisper, `google` runs Gemini 3.8 Flash-Lite TTS + Gemini 3.5
|
|
73
73
|
Transcribe (`VOICE_MODEL_CONSTANTS`, prices in `VOICE_MODEL_PRICING`). The `voiceStyle`
|
|
74
|
-
direction works for both providers: OpenAI takes it as instructions, Gemini
|
|
75
|
-
|
|
74
|
+
direction works for both providers: OpenAI takes it as instructions, Gemini as the part's
|
|
75
|
+
`speechMetadata.style` (3.8 TTS reads the text verbatim, so no inline "Say X:" prefix).
|
|
76
76
|
|
|
77
77
|
### Images and portrait sheets (`@hiper2d/ai-agents/images`)
|
|
78
78
|
|
package/dist/index.d.mts
CHANGED
|
@@ -502,7 +502,7 @@ declare function calculateModelCost(modelApiName: string, inputTokens: number, o
|
|
|
502
502
|
/**
|
|
503
503
|
* Returns provider-specific signature fields based on the model's API name prefix.
|
|
504
504
|
* Used when storing messages with thinking signatures from different providers.
|
|
505
|
-
* @param aiType - The model API name (e.g. "claude-sonnet-5", "gemini-3.7-flash")
|
|
505
|
+
* @param aiType - The model API name (e.g. "claude-sonnet-5-5", "gemini-3.7-flash")
|
|
506
506
|
* @param signature - The thinking signature from the API response (may be undefined)
|
|
507
507
|
* @returns Object with appropriate signature fields for the message
|
|
508
508
|
*/
|
|
@@ -907,6 +907,8 @@ interface SpeechResult {
|
|
|
907
907
|
audio: ArrayBuffer;
|
|
908
908
|
costUSD: number;
|
|
909
909
|
usage: SpeechUsage;
|
|
910
|
+
/** Gemini only: the styled request was safety-blocked, so the line was read without its style. */
|
|
911
|
+
styleDropped?: boolean;
|
|
910
912
|
}
|
|
911
913
|
interface TranscriptionRequest {
|
|
912
914
|
audio: ArrayBuffer;
|
|
@@ -943,7 +945,7 @@ interface VoiceAgent {
|
|
|
943
945
|
declare const VOICE_MODEL_CONSTANTS: {
|
|
944
946
|
readonly OPENAI_TTS: "gpt-4o-mini-tts";
|
|
945
947
|
readonly OPENAI_STT: "whisper-1";
|
|
946
|
-
readonly GOOGLE_TTS: "gemini-3.
|
|
948
|
+
readonly GOOGLE_TTS: "gemini-3.8-flash-lite-tts";
|
|
947
949
|
readonly GOOGLE_STT: "gemini-3.5-transcribe";
|
|
948
950
|
};
|
|
949
951
|
declare const SUPPORTED_VOICE_PROVIDERS: readonly VoiceProvider[];
|
|
@@ -1006,7 +1008,7 @@ declare class OpenAiVoiceAgent implements VoiceAgent {
|
|
|
1006
1008
|
declare class GoogleVoiceAgent implements VoiceAgent {
|
|
1007
1009
|
private readonly apiKey;
|
|
1008
1010
|
readonly provider: "google";
|
|
1009
|
-
readonly ttsModel: "gemini-3.
|
|
1011
|
+
readonly ttsModel: "gemini-3.8-flash-lite-tts";
|
|
1010
1012
|
readonly sttModel: "gemini-3.5-transcribe";
|
|
1011
1013
|
constructor(apiKey: string);
|
|
1012
1014
|
speak(request: SpeechRequest): Promise<SpeechResult>;
|
|
@@ -1042,7 +1044,7 @@ declare function transcribeWithOpenAi(audioBuffer: ArrayBuffer, apiKey: string,
|
|
|
1042
1044
|
interface GoogleTtsAudioOptions {
|
|
1043
1045
|
/** e.g. "Kore", "Puck" */
|
|
1044
1046
|
voiceName: string;
|
|
1045
|
-
/** "mysteriously", "excitedly", or a longer direction */
|
|
1047
|
+
/** "mysteriously", "excitedly", or a longer direction; sent as speechMetadata.style */
|
|
1046
1048
|
voiceStyle?: string;
|
|
1047
1049
|
}
|
|
1048
1050
|
interface GoogleTtsResult {
|
|
@@ -1053,15 +1055,16 @@ interface GoogleTtsResult {
|
|
|
1053
1055
|
inputTokens: number;
|
|
1054
1056
|
outputTokens: number;
|
|
1055
1057
|
};
|
|
1058
|
+
/** True when the styled request was safety-blocked and the line was read without its style. */
|
|
1059
|
+
styleDropped?: boolean;
|
|
1056
1060
|
}
|
|
1057
1061
|
/**
|
|
1058
|
-
* Gemini TTS
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
* value feeds OpenAI's `instructions`, so one field serves both providers.
|
|
1062
|
+
* Gemini 3.8 TTS reads the part text as a verbatim transcript: an inline
|
|
1063
|
+
* "Say cheerfully:" prefix (the 3.1 convention) may be spoken aloud. Delivery
|
|
1064
|
+
* direction goes in the part's `speechMetadata.style` instead, short adverb or
|
|
1065
|
+
* longer sentence alike. Trailing punctuation is trimmed; blank means none.
|
|
1063
1066
|
*/
|
|
1064
|
-
declare function
|
|
1067
|
+
declare function normalizeTtsStyle(voiceStyle?: string): string | undefined;
|
|
1065
1068
|
/** Wraps raw 16-bit mono PCM in a WAV header. */
|
|
1066
1069
|
declare function pcmToWav(pcmData: Uint8Array, sampleRate?: number): ArrayBuffer;
|
|
1067
1070
|
/**
|
|
@@ -1071,12 +1074,22 @@ declare function pcmToWav(pcmData: Uint8Array, sampleRate?: number): ArrayBuffer
|
|
|
1071
1074
|
* difference between a diagnosable log line and "no audio data".
|
|
1072
1075
|
*/
|
|
1073
1076
|
declare function describeEmptyTtsResponse(response: any): string;
|
|
1077
|
+
/**
|
|
1078
|
+
* A safety block on the prompt or the candidate. The 3.1 preview model
|
|
1079
|
+
* false-positived on volume directions ("Say quietly: <harmless line>" blocked
|
|
1080
|
+
* 4 of 6 on 2026-09-24); 3.8 Flash-Lite with the style in speechMetadata passed
|
|
1081
|
+
* the same lines 9 of 9, but the fallback below stays as a net.
|
|
1082
|
+
*/
|
|
1083
|
+
declare function isSafetyBlocked(response: any): boolean;
|
|
1074
1084
|
/**
|
|
1075
1085
|
* Core Gemini TTS call: text + API key in, WAV + token usage out.
|
|
1076
1086
|
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1087
|
+
* 3.8 TTS returns WAV with a RIFF header by default (3.1 returned headerless
|
|
1088
|
+
* audio/l16); raw PCM is still wrapped if a response ever carries it.
|
|
1089
|
+
*
|
|
1090
|
+
* When a styled request comes back safety-blocked, the line is read once more
|
|
1091
|
+
* without the style: a block on the direction should not silence the line. An
|
|
1092
|
+
* unstyled block is not repeated.
|
|
1080
1093
|
*/
|
|
1081
1094
|
declare function generateGoogleTtsAudio(text: string, apiKey: string, options: GoogleTtsAudioOptions): Promise<GoogleTtsResult>;
|
|
1082
1095
|
|
|
@@ -1791,4 +1804,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1791
1804
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1792
1805
|
}
|
|
1793
1806
|
|
|
1794
|
-
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend,
|
|
1807
|
+
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend, calculateAnthropicCost, calculateCost, calculateDeepSeekCost, calculateGeminiSttCost, calculateGeminiTtsCost, calculateGoogleCost, calculateGrokCost, calculateKimiCost, calculateMetaCost, calculateMistralCost, calculateModelCost, calculateOpenAICost, calculateOpenAiSttCost, calculateOpenAiTtsCost, clampReasoningEffort, cleanResponse, createCatalog, createVoiceAgent, describeEmptyTtsResponse, evaluateBudget, extractAnthropicTokenUsage, extractTokenUsageFromResponse$2 as extractAnthropicTokenUsageFromResponse, extractDeepSeekTokenUsage, extractTokenUsageFromResponse$6 as extractDeepSeekTokenUsageFromResponse, extractFirstJsonObject, extractGoogleTokenUsage, extractTokenUsageFromResponse$1 as extractGoogleTokenUsageFromResponse, extractGrokTokenUsage, extractTokenUsageFromResponse$4 as extractGrokTokenUsageFromResponse, extractKimiTokenUsage, extractTokenUsageFromResponse$5 as extractKimiTokenUsageFromResponse, extractMetaTokenUsage, extractTokenUsageFromResponse$3 as extractMetaTokenUsageFromResponse, extractMistralTokenUsage, extractTokenUsageFromResponse as extractMistralTokenUsageFromResponse, extractOpenAITokenUsage, extractTokenUsageFromResponse$7 as extractOpenAITokenUsageFromResponse, extractTokenUsage, extractUsageAndCalculateCost, firstRefusal, generateGoogleTtsAudio, generateOpenAiTtsAudio, generateSchemaInstructions, getModelConfigByApiName, getModelDisplayName, getModelProviderName, getModelTags, getProviderSignatureFields, isBudgetExceededError, isHybridThinkingModel, isInPeakWindow, isPeakBilling, isSafetyBlocked, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, normalizeTtsStyle, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -502,7 +502,7 @@ declare function calculateModelCost(modelApiName: string, inputTokens: number, o
|
|
|
502
502
|
/**
|
|
503
503
|
* Returns provider-specific signature fields based on the model's API name prefix.
|
|
504
504
|
* Used when storing messages with thinking signatures from different providers.
|
|
505
|
-
* @param aiType - The model API name (e.g. "claude-sonnet-5", "gemini-3.7-flash")
|
|
505
|
+
* @param aiType - The model API name (e.g. "claude-sonnet-5-5", "gemini-3.7-flash")
|
|
506
506
|
* @param signature - The thinking signature from the API response (may be undefined)
|
|
507
507
|
* @returns Object with appropriate signature fields for the message
|
|
508
508
|
*/
|
|
@@ -907,6 +907,8 @@ interface SpeechResult {
|
|
|
907
907
|
audio: ArrayBuffer;
|
|
908
908
|
costUSD: number;
|
|
909
909
|
usage: SpeechUsage;
|
|
910
|
+
/** Gemini only: the styled request was safety-blocked, so the line was read without its style. */
|
|
911
|
+
styleDropped?: boolean;
|
|
910
912
|
}
|
|
911
913
|
interface TranscriptionRequest {
|
|
912
914
|
audio: ArrayBuffer;
|
|
@@ -943,7 +945,7 @@ interface VoiceAgent {
|
|
|
943
945
|
declare const VOICE_MODEL_CONSTANTS: {
|
|
944
946
|
readonly OPENAI_TTS: "gpt-4o-mini-tts";
|
|
945
947
|
readonly OPENAI_STT: "whisper-1";
|
|
946
|
-
readonly GOOGLE_TTS: "gemini-3.
|
|
948
|
+
readonly GOOGLE_TTS: "gemini-3.8-flash-lite-tts";
|
|
947
949
|
readonly GOOGLE_STT: "gemini-3.5-transcribe";
|
|
948
950
|
};
|
|
949
951
|
declare const SUPPORTED_VOICE_PROVIDERS: readonly VoiceProvider[];
|
|
@@ -1006,7 +1008,7 @@ declare class OpenAiVoiceAgent implements VoiceAgent {
|
|
|
1006
1008
|
declare class GoogleVoiceAgent implements VoiceAgent {
|
|
1007
1009
|
private readonly apiKey;
|
|
1008
1010
|
readonly provider: "google";
|
|
1009
|
-
readonly ttsModel: "gemini-3.
|
|
1011
|
+
readonly ttsModel: "gemini-3.8-flash-lite-tts";
|
|
1010
1012
|
readonly sttModel: "gemini-3.5-transcribe";
|
|
1011
1013
|
constructor(apiKey: string);
|
|
1012
1014
|
speak(request: SpeechRequest): Promise<SpeechResult>;
|
|
@@ -1042,7 +1044,7 @@ declare function transcribeWithOpenAi(audioBuffer: ArrayBuffer, apiKey: string,
|
|
|
1042
1044
|
interface GoogleTtsAudioOptions {
|
|
1043
1045
|
/** e.g. "Kore", "Puck" */
|
|
1044
1046
|
voiceName: string;
|
|
1045
|
-
/** "mysteriously", "excitedly", or a longer direction */
|
|
1047
|
+
/** "mysteriously", "excitedly", or a longer direction; sent as speechMetadata.style */
|
|
1046
1048
|
voiceStyle?: string;
|
|
1047
1049
|
}
|
|
1048
1050
|
interface GoogleTtsResult {
|
|
@@ -1053,15 +1055,16 @@ interface GoogleTtsResult {
|
|
|
1053
1055
|
inputTokens: number;
|
|
1054
1056
|
outputTokens: number;
|
|
1055
1057
|
};
|
|
1058
|
+
/** True when the styled request was safety-blocked and the line was read without its style. */
|
|
1059
|
+
styleDropped?: boolean;
|
|
1056
1060
|
}
|
|
1057
1061
|
/**
|
|
1058
|
-
* Gemini TTS
|
|
1059
|
-
*
|
|
1060
|
-
*
|
|
1061
|
-
*
|
|
1062
|
-
* value feeds OpenAI's `instructions`, so one field serves both providers.
|
|
1062
|
+
* Gemini 3.8 TTS reads the part text as a verbatim transcript: an inline
|
|
1063
|
+
* "Say cheerfully:" prefix (the 3.1 convention) may be spoken aloud. Delivery
|
|
1064
|
+
* direction goes in the part's `speechMetadata.style` instead, short adverb or
|
|
1065
|
+
* longer sentence alike. Trailing punctuation is trimmed; blank means none.
|
|
1063
1066
|
*/
|
|
1064
|
-
declare function
|
|
1067
|
+
declare function normalizeTtsStyle(voiceStyle?: string): string | undefined;
|
|
1065
1068
|
/** Wraps raw 16-bit mono PCM in a WAV header. */
|
|
1066
1069
|
declare function pcmToWav(pcmData: Uint8Array, sampleRate?: number): ArrayBuffer;
|
|
1067
1070
|
/**
|
|
@@ -1071,12 +1074,22 @@ declare function pcmToWav(pcmData: Uint8Array, sampleRate?: number): ArrayBuffer
|
|
|
1071
1074
|
* difference between a diagnosable log line and "no audio data".
|
|
1072
1075
|
*/
|
|
1073
1076
|
declare function describeEmptyTtsResponse(response: any): string;
|
|
1077
|
+
/**
|
|
1078
|
+
* A safety block on the prompt or the candidate. The 3.1 preview model
|
|
1079
|
+
* false-positived on volume directions ("Say quietly: <harmless line>" blocked
|
|
1080
|
+
* 4 of 6 on 2026-09-24); 3.8 Flash-Lite with the style in speechMetadata passed
|
|
1081
|
+
* the same lines 9 of 9, but the fallback below stays as a net.
|
|
1082
|
+
*/
|
|
1083
|
+
declare function isSafetyBlocked(response: any): boolean;
|
|
1074
1084
|
/**
|
|
1075
1085
|
* Core Gemini TTS call: text + API key in, WAV + token usage out.
|
|
1076
1086
|
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1087
|
+
* 3.8 TTS returns WAV with a RIFF header by default (3.1 returned headerless
|
|
1088
|
+
* audio/l16); raw PCM is still wrapped if a response ever carries it.
|
|
1089
|
+
*
|
|
1090
|
+
* When a styled request comes back safety-blocked, the line is read once more
|
|
1091
|
+
* without the style: a block on the direction should not silence the line. An
|
|
1092
|
+
* unstyled block is not repeated.
|
|
1080
1093
|
*/
|
|
1081
1094
|
declare function generateGoogleTtsAudio(text: string, apiKey: string, options: GoogleTtsAudioOptions): Promise<GoogleTtsResult>;
|
|
1082
1095
|
|
|
@@ -1791,4 +1804,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1791
1804
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1792
1805
|
}
|
|
1793
1806
|
|
|
1794
|
-
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend,
|
|
1807
|
+
export { type AIMessage, ANTHROPIC_REASONING_EFFORTS, API_KEY_CONSTANTS, AbstractAgent, type AgentActivityData, AgentFactory, type AgentLoggingConfig, type AnthropicReasoningEffort, type AnthropicTokenUsage, type ApiKeyMap, type BeforeAskHook, BotResponseError, BudgetController, type BudgetControllerOptions, BudgetExceededError, type BudgetLimit, type BudgetVerdict, CACHE_TIER_MARKER, ClaudeAgent, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, type DeepSeekReasoningEffort, type DeepSeekTokenUsage, DeepSeekV2Agent, FUGU_REASONING_EFFORTS, FuguAgent, type FuguReasoningEffort, GEMINI_AUDIO_TOKENS_PER_SECOND, GEMINI_REASONING_EFFORTS, GLM_REASONING_EFFORTS, type GeminiReasoningEffort, GlmAgent, type GlmReasoningEffort, GoogleAgent, type GoogleSttOptions, type GoogleSttResult, type GoogleTokenUsage, type GoogleTtsAudioOptions, type GoogleTtsResult, GoogleVoiceAgent, Gpt5Agent, GrokAgent, type GrokTokenUsage, InMemorySpendStore, type JsonSchemaOptions, KIMI_REASONING_EFFORTS, KimiAgent, type KimiReasoningEffort, type KimiTokenUsage, type LLMModel, LLM_CONSTANTS, type LlmLogger, type LoggingConfig, MESSAGE_ROLE, META_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelUnavailableError, OPENAI_REASONING_EFFORTS, type OpenAIReasoningEffort, type OpenAITokenUsage, type OpenAiSttOptions, type OpenAiSttResult, type OpenAiTtsAudioOptions, type OpenAiTtsVoice, OpenAiVoiceAgent, type PeakPricing, type PricingUnit, type ProviderSchema, type TokenUsage as ProviderTokenUsage, type ProviderType, QwenAgent, REASONING_EFFORT_SCALE, type ReasoningEffort, SUPPORTED_VOICE_PROVIDERS, type SpeechRequest, type SpeechResult, type SpeechUsage, type SpendInput, type SpendKind, type SpendLedger, type SpendLedgers, type SpendStore, type SpendWindow, SupportedAiKeyNames, SupportedAiModels, type TokenPairUsage, type TokenUsage$1 as TokenUsage, type TranscriptionRequest, type TranscriptionResult, type TranscriptionUsage, VOICE_MODEL_CONSTANTS, VOICE_MODEL_PRICING, VOICE_PROVIDER_API_KEY, type VoiceAgent, VoiceAgentFactory, type VoiceModelPricing, type VoiceProvider, XAI_REASONING_EFFORTS, type XaiReasoningEffort, ZodSchemaConverter, applySpend, calculateAnthropicCost, calculateCost, calculateDeepSeekCost, calculateGeminiSttCost, calculateGeminiTtsCost, calculateGoogleCost, calculateGrokCost, calculateKimiCost, calculateMetaCost, calculateMistralCost, calculateModelCost, calculateOpenAICost, calculateOpenAiSttCost, calculateOpenAiTtsCost, clampReasoningEffort, cleanResponse, createCatalog, createVoiceAgent, describeEmptyTtsResponse, evaluateBudget, extractAnthropicTokenUsage, extractTokenUsageFromResponse$2 as extractAnthropicTokenUsageFromResponse, extractDeepSeekTokenUsage, extractTokenUsageFromResponse$6 as extractDeepSeekTokenUsageFromResponse, extractFirstJsonObject, extractGoogleTokenUsage, extractTokenUsageFromResponse$1 as extractGoogleTokenUsageFromResponse, extractGrokTokenUsage, extractTokenUsageFromResponse$4 as extractGrokTokenUsageFromResponse, extractKimiTokenUsage, extractTokenUsageFromResponse$5 as extractKimiTokenUsageFromResponse, extractMetaTokenUsage, extractTokenUsageFromResponse$3 as extractMetaTokenUsageFromResponse, extractMistralTokenUsage, extractTokenUsageFromResponse as extractMistralTokenUsageFromResponse, extractOpenAITokenUsage, extractTokenUsageFromResponse$7 as extractOpenAITokenUsageFromResponse, extractTokenUsage, extractUsageAndCalculateCost, firstRefusal, generateGoogleTtsAudio, generateOpenAiTtsAudio, generateSchemaInstructions, getModelConfigByApiName, getModelDisplayName, getModelProviderName, getModelTags, getProviderSignatureFields, isBudgetExceededError, isHybridThinkingModel, isInPeakWindow, isPeakBilling, isSafetyBlocked, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, normalizeTtsStyle, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
package/dist/index.js
CHANGED
|
@@ -87,7 +87,6 @@ __export(src_exports, {
|
|
|
87
87
|
XAI_REASONING_EFFORTS: () => XAI_REASONING_EFFORTS,
|
|
88
88
|
ZodSchemaConverter: () => ZodSchemaConverter,
|
|
89
89
|
applySpend: () => applySpend,
|
|
90
|
-
buildGoogleTtsPrompt: () => buildGoogleTtsPrompt,
|
|
91
90
|
calculateAnthropicCost: () => calculateAnthropicCost,
|
|
92
91
|
calculateCost: () => calculateCost,
|
|
93
92
|
calculateDeepSeekCost: () => calculateDeepSeekCost,
|
|
@@ -140,6 +139,7 @@ __export(src_exports, {
|
|
|
140
139
|
isHybridThinkingModel: () => isHybridThinkingModel,
|
|
141
140
|
isInPeakWindow: () => isInPeakWindow,
|
|
142
141
|
isPeakBilling: () => isPeakBilling,
|
|
142
|
+
isSafetyBlocked: () => isSafetyBlocked,
|
|
143
143
|
isWeekendAt: () => isWeekendAt,
|
|
144
144
|
ledgerSpend: () => ledgerSpend,
|
|
145
145
|
logger: () => logger,
|
|
@@ -147,6 +147,7 @@ __export(src_exports, {
|
|
|
147
147
|
modelHasTag: () => modelHasTag,
|
|
148
148
|
modelIsFast: () => modelIsFast,
|
|
149
149
|
needsPromptBasedSchema: () => needsPromptBasedSchema,
|
|
150
|
+
normalizeTtsStyle: () => normalizeTtsStyle,
|
|
150
151
|
parseAndValidateLlmJson: () => parseAndValidateLlmJson,
|
|
151
152
|
pcmToWav: () => pcmToWav,
|
|
152
153
|
periodEnd: () => periodEnd,
|
|
@@ -1014,9 +1015,14 @@ var SupportedAiModels = {
|
|
|
1014
1015
|
reasoningEffort: "high",
|
|
1015
1016
|
tags: ["expensive"]
|
|
1016
1017
|
},
|
|
1018
|
+
// Sonnet moved 5 → 5.5 on 2026-09-28 (`claude-sonnet-5-5`, verified live with the platform key).
|
|
1019
|
+
// Same price, 1M context / 128K output. Adaptive thinking, API default effort `high` (effort
|
|
1020
|
+
// levels were recalibrated vs Sonnet 5 — same pin, not necessarily the same thinking depth).
|
|
1021
|
+
// It rejects `thinking: {type: "disabled"}`; ClaudeAgent sends `between_tools` instead. It
|
|
1022
|
+
// reads Sonnet 5 thinking blocks, so games moving onto it keep the bots' earlier reasoning.
|
|
1017
1023
|
[LLM_CONSTANTS.CLAUDE_SONNET]: {
|
|
1018
|
-
displayName: "Claude 5 Sonnet",
|
|
1019
|
-
modelApiName: "claude-sonnet-5",
|
|
1024
|
+
displayName: "Claude 5.5 Sonnet",
|
|
1025
|
+
modelApiName: "claude-sonnet-5-5",
|
|
1020
1026
|
apiKeyName: API_KEY_CONSTANTS.ANTHROPIC,
|
|
1021
1027
|
hasThinking: true,
|
|
1022
1028
|
reasoningEffort: "high",
|
|
@@ -1520,6 +1526,7 @@ var MODEL_PRICING = {
|
|
|
1520
1526
|
cacheHitPrice: 0.2
|
|
1521
1527
|
},
|
|
1522
1528
|
[SupportedAiModels[LLM_CONSTANTS.CLAUDE_SONNET].modelApiName]: {
|
|
1529
|
+
// Sonnet 5.5 (2026-09-28): same $2/$10 and $0.20 cache reads as Sonnet 5.
|
|
1523
1530
|
inputPrice: 2,
|
|
1524
1531
|
outputPrice: 10,
|
|
1525
1532
|
cacheHitPrice: 0.2
|
|
@@ -1931,8 +1938,9 @@ function extractTokenUsageFromResponse8(response) {
|
|
|
1931
1938
|
var VOICE_MODEL_CONSTANTS = {
|
|
1932
1939
|
OPENAI_TTS: "gpt-4o-mini-tts",
|
|
1933
1940
|
OPENAI_STT: "whisper-1",
|
|
1934
|
-
// ai.google.dev/gemini-api/docs/speech-generation
|
|
1935
|
-
|
|
1941
|
+
// ai.google.dev/gemini-api/docs/speech-generation — Google's named replacement
|
|
1942
|
+
// for gemini-3.1-flash-tts-preview (2026-09-24: ~6 s vs ~15 s per line, ~4x cheaper)
|
|
1943
|
+
GOOGLE_TTS: "gemini-3.8-flash-lite-tts",
|
|
1936
1944
|
// ai.google.dev/gemini-api/docs/transcribe — Interactions API only (see google-stt.ts)
|
|
1937
1945
|
GOOGLE_STT: "gemini-3.5-transcribe"
|
|
1938
1946
|
};
|
|
@@ -1944,9 +1952,9 @@ var VOICE_PROVIDER_API_KEY = {
|
|
|
1944
1952
|
var VOICE_MODEL_PRICING = {
|
|
1945
1953
|
[VOICE_MODEL_CONSTANTS.OPENAI_TTS]: { pricePerMillionCharacters: 15 },
|
|
1946
1954
|
[VOICE_MODEL_CONSTANTS.OPENAI_STT]: { pricePerMinute: 6e-3 },
|
|
1947
|
-
//
|
|
1948
|
-
//
|
|
1949
|
-
[VOICE_MODEL_CONSTANTS.GOOGLE_TTS]: { textInputPricePerM:
|
|
1955
|
+
// ~32 audio tokens per second of speech, so a 15-second line is ~$0.003.
|
|
1956
|
+
// Google doubles both rates to $1 / $12 on 2027-01-01 — update then.
|
|
1957
|
+
[VOICE_MODEL_CONSTANTS.GOOGLE_TTS]: { textInputPricePerM: 0.5, audioOutputPricePerM: 6 },
|
|
1950
1958
|
// ~25 audio tokens per second in, ~175 text tokens per minute out: ≈ $0.005/min.
|
|
1951
1959
|
[VOICE_MODEL_CONSTANTS.GOOGLE_STT]: { audioInputPricePerM: 2, textOutputPricePerM: 12 }
|
|
1952
1960
|
};
|
|
@@ -2053,12 +2061,10 @@ var import_genai = require("@google/genai");
|
|
|
2053
2061
|
var AUDIO_TOKENS_PER_SECOND = 32;
|
|
2054
2062
|
var SAMPLE_RATE = 24e3;
|
|
2055
2063
|
var PCM_BYTES_PER_SECOND = SAMPLE_RATE * 2;
|
|
2056
|
-
|
|
2064
|
+
var WAV_HEADER_BYTES = 44;
|
|
2065
|
+
function normalizeTtsStyle(voiceStyle) {
|
|
2057
2066
|
const style = voiceStyle?.trim().replace(/[:.!,;\s]+$/, "");
|
|
2058
|
-
|
|
2059
|
-
const isShort = style.split(/\s+/).length <= 3 && !/[.!?,;]/.test(style);
|
|
2060
|
-
return isShort ? `Say ${style}: ${text}` : `${style}:
|
|
2061
|
-
${text}`;
|
|
2067
|
+
return style || void 0;
|
|
2062
2068
|
}
|
|
2063
2069
|
function pcmToWav(pcmData, sampleRate = SAMPLE_RATE) {
|
|
2064
2070
|
const numChannels = 1;
|
|
@@ -2102,28 +2108,51 @@ function describeEmptyTtsResponse(response) {
|
|
|
2102
2108
|
if (!parts.length) bits.push("no parts");
|
|
2103
2109
|
return bits.join(", ");
|
|
2104
2110
|
}
|
|
2111
|
+
function isSafetyBlocked(response) {
|
|
2112
|
+
const finish = response?.candidates?.[0]?.finishReason;
|
|
2113
|
+
return finish === "SAFETY" || finish === "PROHIBITED_CONTENT" || !!response?.promptFeedback?.blockReason;
|
|
2114
|
+
}
|
|
2115
|
+
function findAudioPart(response) {
|
|
2116
|
+
const parts = response?.candidates?.[0]?.content?.parts ?? [];
|
|
2117
|
+
const inline = parts.find((part) => part.inlineData?.mimeType?.startsWith("audio/") && part.inlineData?.data)?.inlineData;
|
|
2118
|
+
return inline ? { data: inline.data, mimeType: inline.mimeType } : void 0;
|
|
2119
|
+
}
|
|
2105
2120
|
async function generateGoogleTtsAudio(text, apiKey, options) {
|
|
2106
2121
|
const client = new import_genai.GoogleGenAI({ apiKey });
|
|
2107
|
-
const
|
|
2122
|
+
const request = (style2) => client.models.generateContent({
|
|
2108
2123
|
model: VOICE_MODEL_CONSTANTS.GOOGLE_TTS,
|
|
2109
|
-
contents: [{ parts: [{ text:
|
|
2124
|
+
contents: [{ parts: [style2 ? { text, speechMetadata: { style: style2 } } : { text }] }],
|
|
2110
2125
|
config: {
|
|
2111
2126
|
responseModalities: ["AUDIO"],
|
|
2112
2127
|
speechConfig: { voiceConfig: { prebuiltVoiceConfig: { voiceName: options.voiceName } } }
|
|
2113
2128
|
}
|
|
2114
2129
|
});
|
|
2115
|
-
const
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2130
|
+
const style = normalizeTtsStyle(options.voiceStyle);
|
|
2131
|
+
let response = await request(style);
|
|
2132
|
+
let styleDropped = false;
|
|
2133
|
+
let blockedInputTokens = 0;
|
|
2134
|
+
if (!findAudioPart(response) && style && isSafetyBlocked(response)) {
|
|
2135
|
+
blockedInputTokens = response?.usageMetadata?.promptTokenCount ?? 0;
|
|
2136
|
+
response = await request(void 0);
|
|
2137
|
+
styleDropped = true;
|
|
2138
|
+
}
|
|
2139
|
+
const audioPart = findAudioPart(response);
|
|
2140
|
+
if (!audioPart) {
|
|
2141
|
+
throw new Error(`No audio data in Google TTS response (${describeEmptyTtsResponse(response)}${styleDropped ? ", also without the style" : ""})`);
|
|
2142
|
+
}
|
|
2143
|
+
const bytes = new Uint8Array(Buffer.from(audioPart.data, "base64"));
|
|
2144
|
+
const isWav = /^audio\/(x-)?wav/i.test(audioPart.mimeType);
|
|
2145
|
+
const audio = isWav ? bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength) : pcmToWav(bytes);
|
|
2146
|
+
const pcmBytes = isWav ? Math.max(0, bytes.length - WAV_HEADER_BYTES) : bytes.length;
|
|
2122
2147
|
const usageMetadata = response.usageMetadata ?? {};
|
|
2123
|
-
const inputTokens = usageMetadata.promptTokenCount ?? 0;
|
|
2148
|
+
const inputTokens = (usageMetadata.promptTokenCount ?? 0) + blockedInputTokens;
|
|
2124
2149
|
const reportedOutput = usageMetadata.candidatesTokenCount;
|
|
2125
|
-
const outputTokens = reportedOutput && reportedOutput > 0 ? reportedOutput : Math.ceil(
|
|
2126
|
-
return {
|
|
2150
|
+
const outputTokens = reportedOutput && reportedOutput > 0 ? reportedOutput : Math.ceil(pcmBytes / PCM_BYTES_PER_SECOND * AUDIO_TOKENS_PER_SECOND);
|
|
2151
|
+
return {
|
|
2152
|
+
audio,
|
|
2153
|
+
usage: { inputTokens, outputTokens },
|
|
2154
|
+
...styleDropped ? { styleDropped } : {}
|
|
2155
|
+
};
|
|
2127
2156
|
}
|
|
2128
2157
|
|
|
2129
2158
|
// src/voice/google-stt.ts
|
|
@@ -2154,11 +2183,11 @@ var GoogleVoiceAgent = class {
|
|
|
2154
2183
|
ttsModel = VOICE_MODEL_CONSTANTS.GOOGLE_TTS;
|
|
2155
2184
|
sttModel = VOICE_MODEL_CONSTANTS.GOOGLE_STT;
|
|
2156
2185
|
async speak(request) {
|
|
2157
|
-
const { audio, usage } = await generateGoogleTtsAudio(request.text, this.apiKey, {
|
|
2186
|
+
const { audio, usage, styleDropped } = await generateGoogleTtsAudio(request.text, this.apiKey, {
|
|
2158
2187
|
voiceName: request.voice,
|
|
2159
2188
|
voiceStyle: request.voiceStyle
|
|
2160
2189
|
});
|
|
2161
|
-
return { audio, costUSD: calculateGeminiTtsCost(usage), usage };
|
|
2190
|
+
return { audio, costUSD: calculateGeminiTtsCost(usage), usage, ...styleDropped ? { styleDropped } : {} };
|
|
2162
2191
|
}
|
|
2163
2192
|
async transcribe(request) {
|
|
2164
2193
|
const { text, durationSeconds, usage } = await transcribeWithGemini(request.audio, this.apiKey, { mimeType: request.mimeType });
|
|
@@ -2747,6 +2776,7 @@ ${instruction}`);
|
|
|
2747
2776
|
// src/agents/anthropic-agent.ts
|
|
2748
2777
|
var import_sdk = require("@anthropic-ai/sdk");
|
|
2749
2778
|
var rejectsDisabledThinking = (model) => model.includes("fable") || model.includes("opus-5-5");
|
|
2779
|
+
var usesBetweenToolsForOff = (model) => model.includes("sonnet-5-5");
|
|
2750
2780
|
var ClaudeAgent = class extends AbstractAgent {
|
|
2751
2781
|
client;
|
|
2752
2782
|
/**
|
|
@@ -2963,7 +2993,9 @@ ${schemaDescription}`;
|
|
|
2963
2993
|
params.temperature = 1;
|
|
2964
2994
|
}
|
|
2965
2995
|
} else if (usesAdaptiveThinking) {
|
|
2966
|
-
if (
|
|
2996
|
+
if (usesBetweenToolsForOff(this.model)) {
|
|
2997
|
+
params.thinking = { type: "between_tools" };
|
|
2998
|
+
} else if (!rejectsDisabledThinking(this.model)) {
|
|
2967
2999
|
params.thinking = { type: "disabled" };
|
|
2968
3000
|
}
|
|
2969
3001
|
} else {
|
|
@@ -3059,7 +3091,9 @@ ${schemaDescription}`;
|
|
|
3059
3091
|
params.temperature = 1;
|
|
3060
3092
|
}
|
|
3061
3093
|
} else if (usesAdaptiveThinking) {
|
|
3062
|
-
if (
|
|
3094
|
+
if (usesBetweenToolsForOff(this.model)) {
|
|
3095
|
+
params.thinking = { type: "between_tools" };
|
|
3096
|
+
} else if (!rejectsDisabledThinking(this.model)) {
|
|
3063
3097
|
params.thinking = { type: "disabled" };
|
|
3064
3098
|
}
|
|
3065
3099
|
} else {
|
|
@@ -5527,7 +5561,6 @@ var AgentFactory = class {
|
|
|
5527
5561
|
XAI_REASONING_EFFORTS,
|
|
5528
5562
|
ZodSchemaConverter,
|
|
5529
5563
|
applySpend,
|
|
5530
|
-
buildGoogleTtsPrompt,
|
|
5531
5564
|
calculateAnthropicCost,
|
|
5532
5565
|
calculateCost,
|
|
5533
5566
|
calculateDeepSeekCost,
|
|
@@ -5580,6 +5613,7 @@ var AgentFactory = class {
|
|
|
5580
5613
|
isHybridThinkingModel,
|
|
5581
5614
|
isInPeakWindow,
|
|
5582
5615
|
isPeakBilling,
|
|
5616
|
+
isSafetyBlocked,
|
|
5583
5617
|
isWeekendAt,
|
|
5584
5618
|
ledgerSpend,
|
|
5585
5619
|
logger,
|
|
@@ -5587,6 +5621,7 @@ var AgentFactory = class {
|
|
|
5587
5621
|
modelHasTag,
|
|
5588
5622
|
modelIsFast,
|
|
5589
5623
|
needsPromptBasedSchema,
|
|
5624
|
+
normalizeTtsStyle,
|
|
5590
5625
|
parseAndValidateLlmJson,
|
|
5591
5626
|
pcmToWav,
|
|
5592
5627
|
periodEnd,
|