@hiper2d/ai-agents 0.11.0 → 0.13.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 +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +35 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -540,8 +540,11 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
540
540
|
* - xAI Grok 4.7 (docs.x.ai/developers/model-capabilities/text/reasoning, 2026-09-22):
|
|
541
541
|
* low|medium|high|xhigh, default high, sent on the Responses API as `reasoning: {effort}`.
|
|
542
542
|
* Chat Completions has no equivalent. Grok 4.6 and earlier had no knob at all.
|
|
543
|
-
*
|
|
544
|
-
*
|
|
543
|
+
* - Moonshot Kimi K3 (platform.kimi.ai/docs/guide/use-reasoning-effort, 2026-09-22):
|
|
544
|
+
* low|high|max, default max, top-level on Chat Completions. Moonshot shipped the lower
|
|
545
|
+
* levels after launch; K3 accepted only "max" when this agent was written.
|
|
546
|
+
* Qwen accepts reasoning_effort but ignores it (thinking_budget is its knob); MiniMax exposes
|
|
547
|
+
* no effort parameter.
|
|
545
548
|
*/
|
|
546
549
|
type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
547
550
|
type AnthropicReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
@@ -552,6 +555,7 @@ type FuguReasoningEffort = 'high' | 'xhigh' | 'max';
|
|
|
552
555
|
type MetaReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
553
556
|
type MistralReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
554
557
|
type XaiReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh';
|
|
558
|
+
type KimiReasoningEffort = 'low' | 'high' | 'max';
|
|
555
559
|
/** The shared scale, lowest first. */
|
|
556
560
|
declare const REASONING_EFFORT_SCALE: readonly ReasoningEffort[];
|
|
557
561
|
declare const OPENAI_REASONING_EFFORTS: readonly OpenAIReasoningEffort[];
|
|
@@ -563,6 +567,7 @@ declare const FUGU_REASONING_EFFORTS: readonly FuguReasoningEffort[];
|
|
|
563
567
|
declare const META_REASONING_EFFORTS: readonly MetaReasoningEffort[];
|
|
564
568
|
declare const MISTRAL_REASONING_EFFORTS: readonly MistralReasoningEffort[];
|
|
565
569
|
declare const XAI_REASONING_EFFORTS: readonly XaiReasoningEffort[];
|
|
570
|
+
declare const KIMI_REASONING_EFFORTS: readonly KimiReasoningEffort[];
|
|
566
571
|
/** Clamps `effort` to the nearest level in `allowed` (by rank on the shared scale, ties go up). */
|
|
567
572
|
declare function clampReasoningEffort<T extends ReasoningEffort>(effort: ReasoningEffort, allowed: readonly T[]): T;
|
|
568
573
|
declare const toOpenAIEffort: (effort: ReasoningEffort) => OpenAIReasoningEffort;
|
|
@@ -574,6 +579,7 @@ declare const toMetaEffort: (effort: ReasoningEffort) => MetaReasoningEffort;
|
|
|
574
579
|
declare const toFuguEffort: (effort: ReasoningEffort) => FuguReasoningEffort;
|
|
575
580
|
declare const toMistralEffort: (effort: ReasoningEffort) => MistralReasoningEffort;
|
|
576
581
|
declare const toXaiEffort: (effort: ReasoningEffort) => XaiReasoningEffort;
|
|
582
|
+
declare const toKimiEffort: (effort: ReasoningEffort) => KimiReasoningEffort;
|
|
577
583
|
|
|
578
584
|
/**
|
|
579
585
|
* Unified token usage utilities for all AI providers
|
|
@@ -1388,6 +1394,15 @@ declare class Gpt5Agent extends AbstractAgent {
|
|
|
1388
1394
|
private readonly logTemplates;
|
|
1389
1395
|
private readonly errorMessages;
|
|
1390
1396
|
constructor(name: string, instruction: string, model: string, apiKey: string, temperature: number, enableThinking?: boolean, agentLoggingConfig?: AgentLoggingConfig);
|
|
1397
|
+
/**
|
|
1398
|
+
* `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
|
|
1399
|
+
* model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
|
|
1400
|
+
* astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
|
|
1401
|
+
* since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
|
|
1402
|
+
* The catalog pins all four to medium so the level is explicit in our request rather than
|
|
1403
|
+
* inherited from a default OpenAI can change under us.
|
|
1404
|
+
*/
|
|
1405
|
+
private reasoningParams;
|
|
1391
1406
|
/**
|
|
1392
1407
|
* Structured output method using Zod with OpenAI's Responses API
|
|
1393
1408
|
* This provides better schema handling and runtime validation
|
|
@@ -1736,4 +1751,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1736
1751
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1737
1752
|
}
|
|
1738
1753
|
|
|
1739
|
-
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, KimiAgent, 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, buildGoogleTtsPrompt, 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, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toMetaEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
|
1754
|
+
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, buildGoogleTtsPrompt, 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, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, 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
|
@@ -540,8 +540,11 @@ declare function getProviderSignatureFields(aiType: string, signature?: string):
|
|
|
540
540
|
* - xAI Grok 4.7 (docs.x.ai/developers/model-capabilities/text/reasoning, 2026-09-22):
|
|
541
541
|
* low|medium|high|xhigh, default high, sent on the Responses API as `reasoning: {effort}`.
|
|
542
542
|
* Chat Completions has no equivalent. Grok 4.6 and earlier had no knob at all.
|
|
543
|
-
*
|
|
544
|
-
*
|
|
543
|
+
* - Moonshot Kimi K3 (platform.kimi.ai/docs/guide/use-reasoning-effort, 2026-09-22):
|
|
544
|
+
* low|high|max, default max, top-level on Chat Completions. Moonshot shipped the lower
|
|
545
|
+
* levels after launch; K3 accepted only "max" when this agent was written.
|
|
546
|
+
* Qwen accepts reasoning_effort but ignores it (thinking_budget is its knob); MiniMax exposes
|
|
547
|
+
* no effort parameter.
|
|
545
548
|
*/
|
|
546
549
|
type OpenAIReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
547
550
|
type AnthropicReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
@@ -552,6 +555,7 @@ type FuguReasoningEffort = 'high' | 'xhigh' | 'max';
|
|
|
552
555
|
type MetaReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max';
|
|
553
556
|
type MistralReasoningEffort = 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
554
557
|
type XaiReasoningEffort = 'low' | 'medium' | 'high' | 'xhigh';
|
|
558
|
+
type KimiReasoningEffort = 'low' | 'high' | 'max';
|
|
555
559
|
/** The shared scale, lowest first. */
|
|
556
560
|
declare const REASONING_EFFORT_SCALE: readonly ReasoningEffort[];
|
|
557
561
|
declare const OPENAI_REASONING_EFFORTS: readonly OpenAIReasoningEffort[];
|
|
@@ -563,6 +567,7 @@ declare const FUGU_REASONING_EFFORTS: readonly FuguReasoningEffort[];
|
|
|
563
567
|
declare const META_REASONING_EFFORTS: readonly MetaReasoningEffort[];
|
|
564
568
|
declare const MISTRAL_REASONING_EFFORTS: readonly MistralReasoningEffort[];
|
|
565
569
|
declare const XAI_REASONING_EFFORTS: readonly XaiReasoningEffort[];
|
|
570
|
+
declare const KIMI_REASONING_EFFORTS: readonly KimiReasoningEffort[];
|
|
566
571
|
/** Clamps `effort` to the nearest level in `allowed` (by rank on the shared scale, ties go up). */
|
|
567
572
|
declare function clampReasoningEffort<T extends ReasoningEffort>(effort: ReasoningEffort, allowed: readonly T[]): T;
|
|
568
573
|
declare const toOpenAIEffort: (effort: ReasoningEffort) => OpenAIReasoningEffort;
|
|
@@ -574,6 +579,7 @@ declare const toMetaEffort: (effort: ReasoningEffort) => MetaReasoningEffort;
|
|
|
574
579
|
declare const toFuguEffort: (effort: ReasoningEffort) => FuguReasoningEffort;
|
|
575
580
|
declare const toMistralEffort: (effort: ReasoningEffort) => MistralReasoningEffort;
|
|
576
581
|
declare const toXaiEffort: (effort: ReasoningEffort) => XaiReasoningEffort;
|
|
582
|
+
declare const toKimiEffort: (effort: ReasoningEffort) => KimiReasoningEffort;
|
|
577
583
|
|
|
578
584
|
/**
|
|
579
585
|
* Unified token usage utilities for all AI providers
|
|
@@ -1388,6 +1394,15 @@ declare class Gpt5Agent extends AbstractAgent {
|
|
|
1388
1394
|
private readonly logTemplates;
|
|
1389
1395
|
private readonly errorMessages;
|
|
1390
1396
|
constructor(name: string, instruction: string, model: string, apiKey: string, temperature: number, enableThinking?: boolean, agentLoggingConfig?: AgentLoggingConfig);
|
|
1397
|
+
/**
|
|
1398
|
+
* `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
|
|
1399
|
+
* model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
|
|
1400
|
+
* astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
|
|
1401
|
+
* since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
|
|
1402
|
+
* The catalog pins all four to medium so the level is explicit in our request rather than
|
|
1403
|
+
* inherited from a default OpenAI can change under us.
|
|
1404
|
+
*/
|
|
1405
|
+
private reasoningParams;
|
|
1391
1406
|
/**
|
|
1392
1407
|
* Structured output method using Zod with OpenAI's Responses API
|
|
1393
1408
|
* This provides better schema handling and runtime validation
|
|
@@ -1736,4 +1751,4 @@ declare class MiniMaxAgent extends AbstractAgent {
|
|
|
1736
1751
|
doAskText(messages: AIMessage[]): Promise<[string, string, TokenUsage$1?, string?]>;
|
|
1737
1752
|
}
|
|
1738
1753
|
|
|
1739
|
-
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, KimiAgent, 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, buildGoogleTtsPrompt, 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, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, parseAndValidateLlmJson, pcmToWav, periodEnd, periodKey, safeValidateResponse, setBeforeAskHook, setLlmLogger, stableHashHex, stripInlineThinking, supportsNativeJsonSchema, toAnthropicEffort, toDeepSeekEffort, toFuguEffort, toGeminiEffort, toGlmEffort, toMetaEffort, toMistralEffort, toOpenAIEffort, toXaiEffort, transcribeWithGemini, transcribeWithOpenAi, validateResponse };
|
|
1754
|
+
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, buildGoogleTtsPrompt, 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, isWeekendAt, ledgerSpend, logger, mergeThinking, modelHasTag, modelIsFast, needsPromptBasedSchema, 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
|
@@ -55,6 +55,7 @@ __export(src_exports, {
|
|
|
55
55
|
Gpt5Agent: () => Gpt5Agent,
|
|
56
56
|
GrokAgent: () => GrokAgent,
|
|
57
57
|
InMemorySpendStore: () => InMemorySpendStore,
|
|
58
|
+
KIMI_REASONING_EFFORTS: () => KIMI_REASONING_EFFORTS,
|
|
58
59
|
KimiAgent: () => KimiAgent,
|
|
59
60
|
LLM_CONSTANTS: () => LLM_CONSTANTS,
|
|
60
61
|
MESSAGE_ROLE: () => MESSAGE_ROLE,
|
|
@@ -161,6 +162,7 @@ __export(src_exports, {
|
|
|
161
162
|
toFuguEffort: () => toFuguEffort,
|
|
162
163
|
toGeminiEffort: () => toGeminiEffort,
|
|
163
164
|
toGlmEffort: () => toGlmEffort,
|
|
165
|
+
toKimiEffort: () => toKimiEffort,
|
|
164
166
|
toMetaEffort: () => toMetaEffort,
|
|
165
167
|
toMistralEffort: () => toMistralEffort,
|
|
166
168
|
toOpenAIEffort: () => toOpenAIEffort,
|
|
@@ -1059,10 +1061,16 @@ var SupportedAiModels = {
|
|
|
1059
1061
|
// GPT-6 Astra (2026-09-03): OpenAI's frontier tier above Sol. No `none` reasoning effort;
|
|
1060
1062
|
// temperature/top_p are rejected — Gpt5Agent sends neither, so the same agent serves it.
|
|
1061
1063
|
// The catalog temperature is only carried for the agent constructor signature.
|
|
1064
|
+
// All four OpenAI entries carry reasoningEffort: 'medium' as of 2026-09-22. That is
|
|
1065
|
+
// OpenAI's own current default, established by MEASUREMENT rather than docs: each model was
|
|
1066
|
+
// called with no reasoning param and the effort it echoes back read off the response, since
|
|
1067
|
+
// OpenAI documents the default for Sol, Luna and the 5.6 family but never states Astra's.
|
|
1068
|
+
// Pinning it changes no behaviour today; it stops the default moving under us silently.
|
|
1062
1069
|
[LLM_CONSTANTS.GPT_ASTRA]: {
|
|
1063
1070
|
displayName: "GPT-6 Astra",
|
|
1064
1071
|
modelApiName: "gpt-6-astra",
|
|
1065
1072
|
apiKeyName: API_KEY_CONSTANTS.OPENAI,
|
|
1073
|
+
reasoningEffort: "medium",
|
|
1066
1074
|
hasThinking: true,
|
|
1067
1075
|
temperature: 1,
|
|
1068
1076
|
tags: ["expensive"]
|
|
@@ -1077,6 +1085,7 @@ var SupportedAiModels = {
|
|
|
1077
1085
|
displayName: "GPT-6 Sol",
|
|
1078
1086
|
modelApiName: "gpt-6-sol",
|
|
1079
1087
|
apiKeyName: API_KEY_CONSTANTS.OPENAI,
|
|
1088
|
+
reasoningEffort: "medium",
|
|
1080
1089
|
hasThinking: true,
|
|
1081
1090
|
temperature: 1,
|
|
1082
1091
|
tags: ["expensive"]
|
|
@@ -1085,6 +1094,7 @@ var SupportedAiModels = {
|
|
|
1085
1094
|
displayName: "GPT-5.6 Terra",
|
|
1086
1095
|
modelApiName: "gpt-5.6-terra",
|
|
1087
1096
|
apiKeyName: API_KEY_CONSTANTS.OPENAI,
|
|
1097
|
+
reasoningEffort: "medium",
|
|
1088
1098
|
hasThinking: true,
|
|
1089
1099
|
temperature: 1,
|
|
1090
1100
|
tags: ["fast", "expensive"]
|
|
@@ -1093,6 +1103,7 @@ var SupportedAiModels = {
|
|
|
1093
1103
|
displayName: "GPT-6 Luna",
|
|
1094
1104
|
modelApiName: "gpt-6-luna",
|
|
1095
1105
|
apiKeyName: API_KEY_CONSTANTS.OPENAI,
|
|
1106
|
+
reasoningEffort: "medium",
|
|
1096
1107
|
hasThinking: true,
|
|
1097
1108
|
temperature: 1,
|
|
1098
1109
|
tags: ["fast", "cheap"]
|
|
@@ -1142,6 +1153,7 @@ var SupportedAiModels = {
|
|
|
1142
1153
|
modelApiName: "grok-4.7",
|
|
1143
1154
|
apiKeyName: API_KEY_CONSTANTS.GROK,
|
|
1144
1155
|
hasThinking: true,
|
|
1156
|
+
reasoningEffort: "high",
|
|
1145
1157
|
temperature: 0.7
|
|
1146
1158
|
},
|
|
1147
1159
|
// Mistral models. Two hybrid entries since 2026-09-18: reasoning is off by default on the
|
|
@@ -1190,6 +1202,9 @@ var SupportedAiModels = {
|
|
|
1190
1202
|
hasThinking: true,
|
|
1191
1203
|
// Temperature is omitted from the request: kimi-k3 rejects any value other than 1.
|
|
1192
1204
|
// Speed samples: 17s (2026-08-04) and 28.9s (2026-08-05) — graded into the >25s tier.
|
|
1205
|
+
// Pinned 'high' 2026-09-22, down from Moonshot's 'max' default: K3 had no levels at
|
|
1206
|
+
// launch and the agent hardcoded max, so this is the first time the knob exists.
|
|
1207
|
+
reasoningEffort: "high",
|
|
1193
1208
|
tags: ["very-slow", "expensive"]
|
|
1194
1209
|
},
|
|
1195
1210
|
// Z.AI models — thinking-only entry (non-thinking variant retired 2026-08-05)
|
|
@@ -1704,6 +1719,7 @@ var FUGU_REASONING_EFFORTS = ["high", "xhigh", "max"];
|
|
|
1704
1719
|
var META_REASONING_EFFORTS = ["minimal", "low", "medium", "high", "xhigh", "max"];
|
|
1705
1720
|
var MISTRAL_REASONING_EFFORTS = ["minimal", "low", "medium", "high", "xhigh"];
|
|
1706
1721
|
var XAI_REASONING_EFFORTS = ["low", "medium", "high", "xhigh"];
|
|
1722
|
+
var KIMI_REASONING_EFFORTS = ["low", "high", "max"];
|
|
1707
1723
|
function clampReasoningEffort(effort, allowed) {
|
|
1708
1724
|
const rank = REASONING_EFFORT_SCALE.indexOf(effort);
|
|
1709
1725
|
let best = allowed[0];
|
|
@@ -1726,6 +1742,7 @@ var toMetaEffort = (effort) => clampReasoningEffort(effort, META_REASONING_EFFOR
|
|
|
1726
1742
|
var toFuguEffort = (effort) => clampReasoningEffort(effort, FUGU_REASONING_EFFORTS);
|
|
1727
1743
|
var toMistralEffort = (effort) => clampReasoningEffort(effort, MISTRAL_REASONING_EFFORTS);
|
|
1728
1744
|
var toXaiEffort = (effort) => clampReasoningEffort(effort, XAI_REASONING_EFFORTS);
|
|
1745
|
+
var toKimiEffort = (effort) => clampReasoningEffort(effort, KIMI_REASONING_EFFORTS);
|
|
1729
1746
|
|
|
1730
1747
|
// src/pricing/token-usage-utils.ts
|
|
1731
1748
|
function extractTokenUsage(response) {
|
|
@@ -2500,6 +2517,17 @@ ${instruction}`);
|
|
|
2500
2517
|
apiKey
|
|
2501
2518
|
});
|
|
2502
2519
|
}
|
|
2520
|
+
/**
|
|
2521
|
+
* `reasoning: {effort}`, sent only when the catalog names a level. Every current OpenAI
|
|
2522
|
+
* model defaults to "medium" when the field is omitted — verified 2026-09-22 by calling
|
|
2523
|
+
* astra/sol/terra/luna with no reasoning param and reading the effort the API echoes back,
|
|
2524
|
+
* since OpenAI documents the default for Sol, Luna and the 5.6 family but not for Astra.
|
|
2525
|
+
* The catalog pins all four to medium so the level is explicit in our request rather than
|
|
2526
|
+
* inherited from a default OpenAI can change under us.
|
|
2527
|
+
*/
|
|
2528
|
+
reasoningParams() {
|
|
2529
|
+
return this.reasoningEffort ? { reasoning: { effort: toOpenAIEffort(this.reasoningEffort) } } : {};
|
|
2530
|
+
}
|
|
2503
2531
|
/**
|
|
2504
2532
|
* Structured output method using Zod with OpenAI's Responses API
|
|
2505
2533
|
* This provides better schema handling and runtime validation
|
|
@@ -2520,6 +2548,7 @@ ${instruction}`);
|
|
|
2520
2548
|
input,
|
|
2521
2549
|
max_output_tokens: this.maxOutputTokens,
|
|
2522
2550
|
prompt_cache_key: this.promptCacheKey,
|
|
2551
|
+
...this.reasoningParams(),
|
|
2523
2552
|
text: {
|
|
2524
2553
|
format: (0, import_zod2.zodTextFormat)(schemaToSend, "response_schema")
|
|
2525
2554
|
}
|
|
@@ -2604,7 +2633,8 @@ ${instruction}`);
|
|
|
2604
2633
|
instructions: this.instruction,
|
|
2605
2634
|
input,
|
|
2606
2635
|
max_output_tokens: this.maxOutputTokens,
|
|
2607
|
-
prompt_cache_key: this.promptCacheKey
|
|
2636
|
+
prompt_cache_key: this.promptCacheKey,
|
|
2637
|
+
...this.reasoningParams()
|
|
2608
2638
|
});
|
|
2609
2639
|
const content = response.output_text;
|
|
2610
2640
|
if (!content) {
|
|
@@ -4100,8 +4130,8 @@ var KimiAgent = class extends AbstractAgent {
|
|
|
4100
4130
|
model: this.model,
|
|
4101
4131
|
stream: false,
|
|
4102
4132
|
max_tokens: this.maxOutputTokens,
|
|
4103
|
-
//
|
|
4104
|
-
reasoning_effort: "max"
|
|
4133
|
+
// "max" is not in the OpenAI SDK's ReasoningEffort union, hence the cast.
|
|
4134
|
+
reasoning_effort: toKimiEffort(this.reasoningEffort ?? "max")
|
|
4105
4135
|
};
|
|
4106
4136
|
}
|
|
4107
4137
|
// Log message templates
|
|
@@ -5378,6 +5408,7 @@ var AgentFactory = class {
|
|
|
5378
5408
|
Gpt5Agent,
|
|
5379
5409
|
GrokAgent,
|
|
5380
5410
|
InMemorySpendStore,
|
|
5411
|
+
KIMI_REASONING_EFFORTS,
|
|
5381
5412
|
KimiAgent,
|
|
5382
5413
|
LLM_CONSTANTS,
|
|
5383
5414
|
MESSAGE_ROLE,
|
|
@@ -5484,6 +5515,7 @@ var AgentFactory = class {
|
|
|
5484
5515
|
toFuguEffort,
|
|
5485
5516
|
toGeminiEffort,
|
|
5486
5517
|
toGlmEffort,
|
|
5518
|
+
toKimiEffort,
|
|
5487
5519
|
toMetaEffort,
|
|
5488
5520
|
toMistralEffort,
|
|
5489
5521
|
toOpenAIEffort,
|