@hiper2d/ai-agents 0.34.1 → 0.36.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.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +42 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -378,6 +378,18 @@ declare const API_KEY_CONSTANTS: {
|
|
|
378
378
|
readonly MINIMAX: "MINIMAX_API_KEY";
|
|
379
379
|
readonly META: "META_API_KEY";
|
|
380
380
|
};
|
|
381
|
+
/**
|
|
382
|
+
* Providers whose API ENFORCES a JSON schema on the answer (askWithZodSchema sends the
|
|
383
|
+
* schema natively and the provider constrains the output to it). The rest only get the
|
|
384
|
+
* schema described in the prompt: Grok, GLM and Fugu run in "JSON object" mode (valid JSON,
|
|
385
|
+
* any shape), DeepSeek and MiniMax have no JSON mode on these calls at all. Meta is listed
|
|
386
|
+
* although its json_schema runs with strict: false (the shape is guided, not guaranteed).
|
|
387
|
+
* Hosts use this to decide where a schema can replace a plain-text ask: on most enforcing
|
|
388
|
+
* providers the prompt cache is keyed on the output format, so a host that mixes text and
|
|
389
|
+
* schema calls loses the cache between them (measured 2026-11-12 on OpenAI, Mistral and
|
|
390
|
+
* Gemini: 0% cached on a text reply → schema vote, 77-83% with one schema on both).
|
|
391
|
+
*/
|
|
392
|
+
declare const SCHEMA_ENFORCING_API_KEYS: ReadonlySet<string>;
|
|
381
393
|
declare const SupportedAiKeyNames: Record<string, string>;
|
|
382
394
|
declare const LLM_CONSTANTS: {
|
|
383
395
|
CLAUDE_FABLE: string;
|
|
@@ -551,6 +563,8 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
551
563
|
metaEncryptedReasoning?: string;
|
|
552
564
|
openaiEncryptedReasoning?: string;
|
|
553
565
|
};
|
|
566
|
+
/** Whether the provider behind a catalog model enforces a JSON schema on the answer (see SCHEMA_ENFORCING_API_KEYS). Unknown ids: false. */
|
|
567
|
+
declare function enforcesSchema(modelId: string): boolean;
|
|
554
568
|
|
|
555
569
|
/**
|
|
556
570
|
* Per-provider reasoning-effort vocabularies.
|
|
@@ -565,7 +579,7 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
565
579
|
* Verified against provider docs 2026-08-30:
|
|
566
580
|
* - OpenAI GPT-5.x: minimal|low|medium|high|xhigh
|
|
567
581
|
* - Anthropic adaptive thinking (Fable 5 / Opus 4.8 / Sonnet 5): low|medium|high|xhigh|max
|
|
568
|
-
* - Gemini 3.x thinkingLevel: minimal|low|medium|high (3.1 Pro and
|
|
582
|
+
* - Gemini 3.x thinkingLevel: minimal|low|medium|high (3.1 Pro, 4 Argon and 4 Hydrogen reject minimal)
|
|
569
583
|
* - Z.AI GLM-5.3 / 5.3-Flash: low|high|max only
|
|
570
584
|
* - DeepSeek V4: low|high|max (the API itself aliases medium → high)
|
|
571
585
|
* - Sakana Fugu (verified live 2026-09-20): high|xhigh|max on every model ("low" → 400 naming
|
|
@@ -1920,4 +1934,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1920
1934
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1921
1935
|
}
|
|
1922
1936
|
|
|
1923
|
-
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 ClaudeCacheMode, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, 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, MINIMAX_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, type MiniMaxReasoningEffort, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, 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, type RetryHook, type RetrySettledFn, 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, setRetryHook, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMiniMaxEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
|
1937
|
+
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 ClaudeCacheMode, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, 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, MINIMAX_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, type MiniMaxReasoningEffort, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, 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, type RetryHook, type RetrySettledFn, SCHEMA_ENFORCING_API_KEYS, 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, enforcesSchema, 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, setRetryHook, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMiniMaxEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -378,6 +378,18 @@ declare const API_KEY_CONSTANTS: {
|
|
|
378
378
|
readonly MINIMAX: "MINIMAX_API_KEY";
|
|
379
379
|
readonly META: "META_API_KEY";
|
|
380
380
|
};
|
|
381
|
+
/**
|
|
382
|
+
* Providers whose API ENFORCES a JSON schema on the answer (askWithZodSchema sends the
|
|
383
|
+
* schema natively and the provider constrains the output to it). The rest only get the
|
|
384
|
+
* schema described in the prompt: Grok, GLM and Fugu run in "JSON object" mode (valid JSON,
|
|
385
|
+
* any shape), DeepSeek and MiniMax have no JSON mode on these calls at all. Meta is listed
|
|
386
|
+
* although its json_schema runs with strict: false (the shape is guided, not guaranteed).
|
|
387
|
+
* Hosts use this to decide where a schema can replace a plain-text ask: on most enforcing
|
|
388
|
+
* providers the prompt cache is keyed on the output format, so a host that mixes text and
|
|
389
|
+
* schema calls loses the cache between them (measured 2026-11-12 on OpenAI, Mistral and
|
|
390
|
+
* Gemini: 0% cached on a text reply → schema vote, 77-83% with one schema on both).
|
|
391
|
+
*/
|
|
392
|
+
declare const SCHEMA_ENFORCING_API_KEYS: ReadonlySet<string>;
|
|
381
393
|
declare const SupportedAiKeyNames: Record<string, string>;
|
|
382
394
|
declare const LLM_CONSTANTS: {
|
|
383
395
|
CLAUDE_FABLE: string;
|
|
@@ -551,6 +563,8 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
551
563
|
metaEncryptedReasoning?: string;
|
|
552
564
|
openaiEncryptedReasoning?: string;
|
|
553
565
|
};
|
|
566
|
+
/** Whether the provider behind a catalog model enforces a JSON schema on the answer (see SCHEMA_ENFORCING_API_KEYS). Unknown ids: false. */
|
|
567
|
+
declare function enforcesSchema(modelId: string): boolean;
|
|
554
568
|
|
|
555
569
|
/**
|
|
556
570
|
* Per-provider reasoning-effort vocabularies.
|
|
@@ -565,7 +579,7 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
565
579
|
* Verified against provider docs 2026-08-30:
|
|
566
580
|
* - OpenAI GPT-5.x: minimal|low|medium|high|xhigh
|
|
567
581
|
* - Anthropic adaptive thinking (Fable 5 / Opus 4.8 / Sonnet 5): low|medium|high|xhigh|max
|
|
568
|
-
* - Gemini 3.x thinkingLevel: minimal|low|medium|high (3.1 Pro and
|
|
582
|
+
* - Gemini 3.x thinkingLevel: minimal|low|medium|high (3.1 Pro, 4 Argon and 4 Hydrogen reject minimal)
|
|
569
583
|
* - Z.AI GLM-5.3 / 5.3-Flash: low|high|max only
|
|
570
584
|
* - DeepSeek V4: low|high|max (the API itself aliases medium → high)
|
|
571
585
|
* - Sakana Fugu (verified live 2026-09-20): high|xhigh|max on every model ("low" → 400 naming
|
|
@@ -1920,4 +1934,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1920
1934
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1921
1935
|
}
|
|
1922
1936
|
|
|
1923
|
-
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 ClaudeCacheMode, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, 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, MINIMAX_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, type MiniMaxReasoningEffort, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, 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, type RetryHook, type RetrySettledFn, 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, setRetryHook, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMiniMaxEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
|
1937
|
+
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 ClaudeCacheMode, type CostCalculationOptions, DEEPSEEK_PEAK_SCHEDULE, DEEPSEEK_REASONING_EFFORTS, DEFAULT_LOGGING_CONFIG, DEFAULT_MAX_OUTPUT_TOKENS, DEFAULT_REQUEST_TIMEOUT_MS, 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, MINIMAX_REASONING_EFFORTS, MISTRAL_REASONING_EFFORTS, MODEL_PRICING, MetaAgent, type MetaReasoningEffort, type MetaTokenUsage, MiniMaxAgent, type MiniMaxReasoningEffort, MistralAgent, type MistralReasoningEffort, type MistralTokenUsage, type Modality, ModelAuthenticationError, type ModelConfig, ModelError, ModelInvalidResponseError, ModelOverloadError, type ModelPricing, ModelQuotaExceededError, ModelRateLimitError, ModelRefusalError, type ModelTag, ModelTimeoutError, 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, type RetryHook, type RetrySettledFn, SCHEMA_ENFORCING_API_KEYS, 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, enforcesSchema, 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, setRetryHook, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toKimiEffort, toMetaEffort, toMiniMaxEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
package/dist/index.js
CHANGED
|
@@ -80,6 +80,7 @@ __export(src_exports, {
|
|
|
80
80
|
OpenAiVoiceAgent: () => OpenAiVoiceAgent,
|
|
81
81
|
QwenAgent: () => QwenAgent,
|
|
82
82
|
REASONING_EFFORT_SCALE: () => REASONING_EFFORT_SCALE,
|
|
83
|
+
SCHEMA_ENFORCING_API_KEYS: () => SCHEMA_ENFORCING_API_KEYS,
|
|
83
84
|
SUPPORTED_VOICE_PROVIDERS: () => SUPPORTED_VOICE_PROVIDERS,
|
|
84
85
|
SupportedAiKeyNames: () => SupportedAiKeyNames,
|
|
85
86
|
SupportedAiModels: () => SupportedAiModels,
|
|
@@ -109,6 +110,7 @@ __export(src_exports, {
|
|
|
109
110
|
createCatalog: () => createCatalog,
|
|
110
111
|
createVoiceAgent: () => createVoiceAgent,
|
|
111
112
|
describeEmptyTtsResponse: () => describeEmptyTtsResponse,
|
|
113
|
+
enforcesSchema: () => enforcesSchema,
|
|
112
114
|
evaluateBudget: () => evaluateBudget,
|
|
113
115
|
extractAnthropicTokenUsage: () => extractAnthropicTokenUsage,
|
|
114
116
|
extractAnthropicTokenUsageFromResponse: () => extractTokenUsageFromResponse6,
|
|
@@ -988,6 +990,15 @@ var API_KEY_CONSTANTS = {
|
|
|
988
990
|
MINIMAX: "MINIMAX_API_KEY",
|
|
989
991
|
META: "META_API_KEY"
|
|
990
992
|
};
|
|
993
|
+
var SCHEMA_ENFORCING_API_KEYS = /* @__PURE__ */ new Set([
|
|
994
|
+
API_KEY_CONSTANTS.OPENAI,
|
|
995
|
+
API_KEY_CONSTANTS.ANTHROPIC,
|
|
996
|
+
API_KEY_CONSTANTS.GOOGLE,
|
|
997
|
+
API_KEY_CONSTANTS.MISTRAL,
|
|
998
|
+
API_KEY_CONSTANTS.QWEN,
|
|
999
|
+
API_KEY_CONSTANTS.MOONSHOT,
|
|
1000
|
+
API_KEY_CONSTANTS.META
|
|
1001
|
+
]);
|
|
991
1002
|
var SupportedAiKeyNames = {
|
|
992
1003
|
[API_KEY_CONSTANTS.OPENAI]: "OpenAI",
|
|
993
1004
|
[API_KEY_CONSTANTS.ANTHROPIC]: "Anthropic",
|
|
@@ -1227,14 +1238,27 @@ var SupportedAiModels = {
|
|
|
1227
1238
|
tags: ["expensive"]
|
|
1228
1239
|
},
|
|
1229
1240
|
[LLM_CONSTANTS.GEMINI_FLASH]: {
|
|
1230
|
-
// Repointed 3.6 → 3.7 (2026-08-13) → 3.8 (2026-09-02)
|
|
1231
|
-
//
|
|
1232
|
-
//
|
|
1233
|
-
|
|
1234
|
-
|
|
1241
|
+
// Repointed 3.6 → 3.7 (2026-08-13) → 3.8 (2026-09-02) → Gemini 4 Hydrogen (2026-11-12);
|
|
1242
|
+
// stable picker id, same pattern as gpt — the slot keeps the name `gemini-flash` although
|
|
1243
|
+
// Google dropped "Flash" from the model's name. Id verified against GET /v1beta/models
|
|
1244
|
+
// (1M in / 65K out). Accepts low|medium|high, rejects 'minimal' (400, probed — as did
|
|
1245
|
+
// 3.7 and 3.8 Flash).
|
|
1246
|
+
// Pinned 'low' (3.8 Flash ran 'medium'): Hydrogen is twice the price and thinks about
|
|
1247
|
+
// twice as much per level. Werewolf day-2 vote fixture, 3 runs a level, 2026-11-12:
|
|
1248
|
+
// Hydrogen low 3.4-3.9s 211-263 thinking tokens 0.58-0.60¢
|
|
1249
|
+
// Hydrogen medium 5.4-6.7s 528-761 0.81-0.98¢
|
|
1250
|
+
// Hydrogen high 6.4-7.8s 839-1175 1.03-1.29¢
|
|
1251
|
+
// 3.8 Flash medium 5.1-7.1s 203-315 0.29-0.34¢
|
|
1252
|
+
// 3.8 Flash low 2.1-2.3s 0 0.21¢
|
|
1253
|
+
// So 'low' is the level that thinks as much as the model it replaces did, a little
|
|
1254
|
+
// faster, at twice the cost instead of three times; every run named the same vote target
|
|
1255
|
+
// with a reason as specific. No `temperature` (see the Pro note). No speed tag until it
|
|
1256
|
+
// has 100+ production turns (3.8 Flash had none: p50 9.9s).
|
|
1257
|
+
displayName: "Gemini 4 Hydrogen",
|
|
1258
|
+
modelApiName: "gemini-4-hydrogen",
|
|
1235
1259
|
apiKeyName: API_KEY_CONSTANTS.GOOGLE,
|
|
1236
1260
|
hasThinking: true,
|
|
1237
|
-
reasoningEffort: "
|
|
1261
|
+
reasoningEffort: "low"
|
|
1238
1262
|
},
|
|
1239
1263
|
[LLM_CONSTANTS.GEMINI_LITE]: {
|
|
1240
1264
|
displayName: "Gemini 3.5 Flash Lite",
|
|
@@ -1742,13 +1766,12 @@ var MODEL_PRICING = {
|
|
|
1742
1766
|
extendedContextThresholdTokens: 2e5
|
|
1743
1767
|
},
|
|
1744
1768
|
[SupportedAiModels[LLM_CONSTANTS.GEMINI_FLASH].modelApiName]: {
|
|
1745
|
-
//
|
|
1746
|
-
//
|
|
1747
|
-
//
|
|
1748
|
-
//
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
outputPrice: 3.75,
|
|
1769
|
+
// Gemini 4 Hydrogen (ai.google.dev pricing page, Standard tier, read 2026-11-12): one
|
|
1770
|
+
// flat tier, twice the input and output rates of the 3.8 Flash it replaced
|
|
1771
|
+
// ($0.75 / $3.75) with the same $0.075 cached rate (5% of input, as on Argon). Implicit
|
|
1772
|
+
// caching only — explicit caching is not supported, so there is no storage cost.
|
|
1773
|
+
inputPrice: 1.5,
|
|
1774
|
+
outputPrice: 7.5,
|
|
1752
1775
|
cacheHitPrice: 0.075
|
|
1753
1776
|
},
|
|
1754
1777
|
[SupportedAiModels[LLM_CONSTANTS.GEMINI_LITE].modelApiName]: {
|
|
@@ -1911,6 +1934,10 @@ function getProviderSignatureFields(aiType, signature) {
|
|
|
1911
1934
|
}
|
|
1912
1935
|
return {};
|
|
1913
1936
|
}
|
|
1937
|
+
function enforcesSchema(modelId) {
|
|
1938
|
+
const config = SupportedAiModels[modelId];
|
|
1939
|
+
return !!config && SCHEMA_ENFORCING_API_KEYS.has(config.apiKeyName);
|
|
1940
|
+
}
|
|
1914
1941
|
|
|
1915
1942
|
// src/reasoning-effort.ts
|
|
1916
1943
|
var REASONING_EFFORT_SCALE = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
@@ -5882,6 +5909,7 @@ var AgentFactory = class {
|
|
|
5882
5909
|
OpenAiVoiceAgent,
|
|
5883
5910
|
QwenAgent,
|
|
5884
5911
|
REASONING_EFFORT_SCALE,
|
|
5912
|
+
SCHEMA_ENFORCING_API_KEYS,
|
|
5885
5913
|
SUPPORTED_VOICE_PROVIDERS,
|
|
5886
5914
|
SupportedAiKeyNames,
|
|
5887
5915
|
SupportedAiModels,
|
|
@@ -5911,6 +5939,7 @@ var AgentFactory = class {
|
|
|
5911
5939
|
createCatalog,
|
|
5912
5940
|
createVoiceAgent,
|
|
5913
5941
|
describeEmptyTtsResponse,
|
|
5942
|
+
enforcesSchema,
|
|
5914
5943
|
evaluateBudget,
|
|
5915
5944
|
extractAnthropicTokenUsage,
|
|
5916
5945
|
extractAnthropicTokenUsageFromResponse,
|