@codelia/core 0.1.68 → 0.1.70
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.cjs +638 -8
- package/dist/index.d.cts +71 -22
- package/dist/index.d.ts +71 -22
- package/dist/index.js +634 -8
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ZodSchema } from 'zod';
|
|
3
3
|
import { Logger } from 'openai/client';
|
|
4
|
-
import { AgentEvent, SessionStateSummary as SessionStateSummary$1 } from '@codelia/shared-types';
|
|
4
|
+
import { AgentEvent, SessionStateSummary as SessionStateSummary$1, ModelReasoningLevel } from '@codelia/shared-types';
|
|
5
5
|
export { AgentEvent, FinalResponseEvent, ReasoningEvent, StepCompleteEvent, StepStartEvent, TextEvent, ToolCallEvent, ToolResultEvent } from '@codelia/shared-types';
|
|
6
6
|
import Anthropic from '@anthropic-ai/sdk';
|
|
7
7
|
import { MessageCreateParamsNonStreaming } from '@anthropic-ai/sdk/resources/messages/messages';
|
|
@@ -223,7 +223,7 @@ type AgentServices = {
|
|
|
223
223
|
toolOutputCacheStore?: ToolOutputCacheStore | null;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
type ProviderName = "openai" | "anthropic" | "openrouter" | "google";
|
|
226
|
+
type ProviderName = "openai" | "anthropic" | "openrouter" | "google" | "zai";
|
|
227
227
|
type ChatInvokeInput = {
|
|
228
228
|
messages: BaseMessage[];
|
|
229
229
|
model?: string;
|
|
@@ -384,6 +384,7 @@ type SessionHeader = {
|
|
|
384
384
|
name?: string;
|
|
385
385
|
reasoning?: string;
|
|
386
386
|
fast?: boolean;
|
|
387
|
+
source?: "config" | "session";
|
|
387
388
|
};
|
|
388
389
|
prompts?: {
|
|
389
390
|
system?: string;
|
|
@@ -636,7 +637,7 @@ interface StoragePathService {
|
|
|
636
637
|
resolvePaths(options?: ResolveStorageOptions): StoragePaths;
|
|
637
638
|
}
|
|
638
639
|
|
|
639
|
-
declare const PROVIDER_NAME$
|
|
640
|
+
declare const PROVIDER_NAME$3: "anthropic";
|
|
640
641
|
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
|
|
641
642
|
speed?: "standard" | "fast" | null;
|
|
642
643
|
betas?: string[];
|
|
@@ -649,13 +650,13 @@ type ChatAnthropicOptions = {
|
|
|
649
650
|
maxTokens?: number;
|
|
650
651
|
invokeOptions?: AnthropicInvokeOptions;
|
|
651
652
|
fastMode?: boolean;
|
|
652
|
-
reasoningLevelRequested?:
|
|
653
|
-
reasoningLevelApplied?:
|
|
653
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
654
|
+
reasoningLevelApplied?: ModelReasoningLevel;
|
|
654
655
|
reasoningFallbackApplied?: boolean;
|
|
655
656
|
reasoningBudgetPreset?: string;
|
|
656
657
|
};
|
|
657
|
-
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$
|
|
658
|
-
readonly provider: typeof PROVIDER_NAME$
|
|
658
|
+
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$3, AnthropicInvokeOptions> {
|
|
659
|
+
readonly provider: typeof PROVIDER_NAME$3;
|
|
659
660
|
readonly model: string;
|
|
660
661
|
private readonly client;
|
|
661
662
|
private readonly defaultMaxTokens;
|
|
@@ -685,14 +686,16 @@ type OpenAiResponsesWsLike = {
|
|
|
685
686
|
}): void;
|
|
686
687
|
};
|
|
687
688
|
|
|
688
|
-
declare const PROVIDER_NAME$
|
|
689
|
+
declare const PROVIDER_NAME$2: "openai";
|
|
689
690
|
type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
690
691
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
691
692
|
reasoningEffort?: ReasoningEffort;
|
|
692
693
|
textVerbosity?: OpenAITextVerbosity;
|
|
693
694
|
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
694
695
|
};
|
|
695
|
-
type
|
|
696
|
+
type OpenAIResponsesWsOptions = NonNullable<ConstructorParameters<typeof ResponsesWS>[1]> & {
|
|
697
|
+
headers?: Record<string, string>;
|
|
698
|
+
};
|
|
696
699
|
|
|
697
700
|
type ChatOpenAIOptions = {
|
|
698
701
|
client?: OpenAI;
|
|
@@ -700,19 +703,19 @@ type ChatOpenAIOptions = {
|
|
|
700
703
|
model?: string;
|
|
701
704
|
providerModel?: string;
|
|
702
705
|
reasoningEffort?: ReasoningEffort;
|
|
703
|
-
reasoningLevelRequested?:
|
|
704
|
-
reasoningLevelApplied?:
|
|
706
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
707
|
+
reasoningLevelApplied?: ModelReasoningLevel;
|
|
705
708
|
reasoningFallbackApplied?: boolean;
|
|
706
709
|
textVerbosity?: OpenAITextVerbosity;
|
|
707
710
|
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
708
711
|
websocketMode?: OpenAiWebsocketMode;
|
|
709
712
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
710
|
-
createResponsesWs?: (client: OpenAI, options?:
|
|
713
|
+
createResponsesWs?: (client: OpenAI, options?: OpenAIResponsesWsOptions) => OpenAiResponsesWsLike;
|
|
711
714
|
websocketConnectTimeoutMs?: number;
|
|
712
715
|
websocketResponseIdleTimeoutMs?: number;
|
|
713
716
|
};
|
|
714
|
-
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$
|
|
715
|
-
readonly provider: typeof PROVIDER_NAME$
|
|
717
|
+
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$2, OpenAIInvokeOptions> {
|
|
718
|
+
readonly provider: typeof PROVIDER_NAME$2;
|
|
716
719
|
readonly model: string;
|
|
717
720
|
private readonly providerModel;
|
|
718
721
|
private readonly client;
|
|
@@ -755,25 +758,24 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
755
758
|
private getHttpStreamDebugObserver;
|
|
756
759
|
}
|
|
757
760
|
|
|
758
|
-
declare const PROVIDER_NAME: "openrouter";
|
|
761
|
+
declare const PROVIDER_NAME$1: "openrouter";
|
|
759
762
|
type OpenRouterTextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
760
763
|
type OpenRouterInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
761
764
|
reasoningEffort?: ReasoningEffort;
|
|
762
765
|
textVerbosity?: OpenRouterTextVerbosity;
|
|
763
766
|
};
|
|
764
|
-
type OpenRouterReasoningLevel = "low" | "medium" | "high" | "xhigh";
|
|
765
767
|
type ChatOpenRouterOptions = {
|
|
766
768
|
client?: OpenAI;
|
|
767
769
|
clientOptions?: ClientOptions;
|
|
768
770
|
model?: string;
|
|
769
771
|
reasoningEffort?: ReasoningEffort;
|
|
770
|
-
reasoningLevelRequested?:
|
|
771
|
-
reasoningLevelApplied?:
|
|
772
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
773
|
+
reasoningLevelApplied?: ModelReasoningLevel;
|
|
772
774
|
reasoningFallbackApplied?: boolean;
|
|
773
775
|
textVerbosity?: OpenRouterTextVerbosity;
|
|
774
776
|
};
|
|
775
|
-
declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, OpenRouterInvokeOptions> {
|
|
776
|
-
readonly provider: typeof PROVIDER_NAME;
|
|
777
|
+
declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME$1, OpenRouterInvokeOptions> {
|
|
778
|
+
readonly provider: typeof PROVIDER_NAME$1;
|
|
777
779
|
readonly model: string;
|
|
778
780
|
private readonly client;
|
|
779
781
|
private readonly defaultReasoningEffort?;
|
|
@@ -790,15 +792,62 @@ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, Open
|
|
|
790
792
|
private debugResponseIfEnabled;
|
|
791
793
|
}
|
|
792
794
|
|
|
795
|
+
type ZaiReasoningEffort = "high" | "max";
|
|
796
|
+
|
|
797
|
+
declare const PROVIDER_NAME: "zai";
|
|
798
|
+
type ZaiAppliedReasoningLevel = Extract<ModelReasoningLevel, "high" | "xhigh" | "max">;
|
|
799
|
+
type ZaiInvokeOptions = {
|
|
800
|
+
max_tokens?: number;
|
|
801
|
+
temperature?: number;
|
|
802
|
+
top_p?: number;
|
|
803
|
+
reasoningEffort?: ZaiReasoningEffort | null;
|
|
804
|
+
[key: string]: unknown;
|
|
805
|
+
};
|
|
806
|
+
type ChatZaiOptions = {
|
|
807
|
+
apiKey?: string;
|
|
808
|
+
baseURL?: string;
|
|
809
|
+
fetch?: typeof fetch;
|
|
810
|
+
model?: string;
|
|
811
|
+
timeoutMs?: number | null;
|
|
812
|
+
reasoningEffort?: ZaiReasoningEffort | null;
|
|
813
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
814
|
+
reasoningLevelApplied?: ZaiAppliedReasoningLevel;
|
|
815
|
+
reasoningFallbackApplied?: boolean;
|
|
816
|
+
};
|
|
817
|
+
declare class ChatZai implements BaseChatModel<typeof PROVIDER_NAME, ZaiInvokeOptions> {
|
|
818
|
+
readonly provider: typeof PROVIDER_NAME;
|
|
819
|
+
readonly model: string;
|
|
820
|
+
private readonly apiKey?;
|
|
821
|
+
private readonly baseURL;
|
|
822
|
+
private readonly fetchImpl;
|
|
823
|
+
private readonly timeoutMs;
|
|
824
|
+
private readonly defaultReasoningEffort;
|
|
825
|
+
private readonly reasoningLevelMeta;
|
|
826
|
+
private debugInvokeSeq;
|
|
827
|
+
private lastDebugRequestPayload;
|
|
828
|
+
constructor(options?: ChatZaiOptions);
|
|
829
|
+
ainvoke(input: ChatInvokeInput & {
|
|
830
|
+
options?: ZaiInvokeOptions;
|
|
831
|
+
}, _context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
|
|
832
|
+
private streamRequest;
|
|
833
|
+
private nextDebugInvokeSeq;
|
|
834
|
+
private debugRequestIfEnabled;
|
|
835
|
+
private debugResponseIfEnabled;
|
|
836
|
+
}
|
|
837
|
+
|
|
793
838
|
declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
794
839
|
declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
795
840
|
|
|
796
841
|
declare const GOOGLE_MODELS: ModelSpec[];
|
|
797
842
|
|
|
798
|
-
declare const OPENAI_DEFAULT_MODEL = "gpt-5.
|
|
843
|
+
declare const OPENAI_DEFAULT_MODEL = "gpt-5.6";
|
|
799
844
|
declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
800
845
|
declare const OPENAI_MODELS: ModelSpec[];
|
|
801
846
|
|
|
847
|
+
declare const ZAI_DEFAULT_MODEL = "glm-5.2";
|
|
848
|
+
declare const ZAI_REASONING_EFFORT_MODELS: Set<string>;
|
|
849
|
+
declare const ZAI_MODELS: ModelSpec[];
|
|
850
|
+
|
|
802
851
|
declare const DEFAULT_MODEL_REGISTRY: ModelRegistry;
|
|
803
852
|
|
|
804
853
|
declare const getDefaultSystemPromptPath: () => string;
|
|
@@ -810,4 +859,4 @@ declare class TaskComplete extends Error {
|
|
|
810
859
|
constructor(finalMessage?: string);
|
|
811
860
|
}
|
|
812
861
|
|
|
813
|
-
export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
|
862
|
+
export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JSONSchema7 } from 'json-schema';
|
|
2
2
|
import { ZodSchema } from 'zod';
|
|
3
3
|
import { Logger } from 'openai/client';
|
|
4
|
-
import { AgentEvent, SessionStateSummary as SessionStateSummary$1 } from '@codelia/shared-types';
|
|
4
|
+
import { AgentEvent, SessionStateSummary as SessionStateSummary$1, ModelReasoningLevel } from '@codelia/shared-types';
|
|
5
5
|
export { AgentEvent, FinalResponseEvent, ReasoningEvent, StepCompleteEvent, StepStartEvent, TextEvent, ToolCallEvent, ToolResultEvent } from '@codelia/shared-types';
|
|
6
6
|
import Anthropic from '@anthropic-ai/sdk';
|
|
7
7
|
import { MessageCreateParamsNonStreaming } from '@anthropic-ai/sdk/resources/messages/messages';
|
|
@@ -223,7 +223,7 @@ type AgentServices = {
|
|
|
223
223
|
toolOutputCacheStore?: ToolOutputCacheStore | null;
|
|
224
224
|
};
|
|
225
225
|
|
|
226
|
-
type ProviderName = "openai" | "anthropic" | "openrouter" | "google";
|
|
226
|
+
type ProviderName = "openai" | "anthropic" | "openrouter" | "google" | "zai";
|
|
227
227
|
type ChatInvokeInput = {
|
|
228
228
|
messages: BaseMessage[];
|
|
229
229
|
model?: string;
|
|
@@ -384,6 +384,7 @@ type SessionHeader = {
|
|
|
384
384
|
name?: string;
|
|
385
385
|
reasoning?: string;
|
|
386
386
|
fast?: boolean;
|
|
387
|
+
source?: "config" | "session";
|
|
387
388
|
};
|
|
388
389
|
prompts?: {
|
|
389
390
|
system?: string;
|
|
@@ -636,7 +637,7 @@ interface StoragePathService {
|
|
|
636
637
|
resolvePaths(options?: ResolveStorageOptions): StoragePaths;
|
|
637
638
|
}
|
|
638
639
|
|
|
639
|
-
declare const PROVIDER_NAME$
|
|
640
|
+
declare const PROVIDER_NAME$3: "anthropic";
|
|
640
641
|
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
|
|
641
642
|
speed?: "standard" | "fast" | null;
|
|
642
643
|
betas?: string[];
|
|
@@ -649,13 +650,13 @@ type ChatAnthropicOptions = {
|
|
|
649
650
|
maxTokens?: number;
|
|
650
651
|
invokeOptions?: AnthropicInvokeOptions;
|
|
651
652
|
fastMode?: boolean;
|
|
652
|
-
reasoningLevelRequested?:
|
|
653
|
-
reasoningLevelApplied?:
|
|
653
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
654
|
+
reasoningLevelApplied?: ModelReasoningLevel;
|
|
654
655
|
reasoningFallbackApplied?: boolean;
|
|
655
656
|
reasoningBudgetPreset?: string;
|
|
656
657
|
};
|
|
657
|
-
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$
|
|
658
|
-
readonly provider: typeof PROVIDER_NAME$
|
|
658
|
+
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$3, AnthropicInvokeOptions> {
|
|
659
|
+
readonly provider: typeof PROVIDER_NAME$3;
|
|
659
660
|
readonly model: string;
|
|
660
661
|
private readonly client;
|
|
661
662
|
private readonly defaultMaxTokens;
|
|
@@ -685,14 +686,16 @@ type OpenAiResponsesWsLike = {
|
|
|
685
686
|
}): void;
|
|
686
687
|
};
|
|
687
688
|
|
|
688
|
-
declare const PROVIDER_NAME$
|
|
689
|
+
declare const PROVIDER_NAME$2: "openai";
|
|
689
690
|
type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
690
691
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
691
692
|
reasoningEffort?: ReasoningEffort;
|
|
692
693
|
textVerbosity?: OpenAITextVerbosity;
|
|
693
694
|
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
694
695
|
};
|
|
695
|
-
type
|
|
696
|
+
type OpenAIResponsesWsOptions = NonNullable<ConstructorParameters<typeof ResponsesWS>[1]> & {
|
|
697
|
+
headers?: Record<string, string>;
|
|
698
|
+
};
|
|
696
699
|
|
|
697
700
|
type ChatOpenAIOptions = {
|
|
698
701
|
client?: OpenAI;
|
|
@@ -700,19 +703,19 @@ type ChatOpenAIOptions = {
|
|
|
700
703
|
model?: string;
|
|
701
704
|
providerModel?: string;
|
|
702
705
|
reasoningEffort?: ReasoningEffort;
|
|
703
|
-
reasoningLevelRequested?:
|
|
704
|
-
reasoningLevelApplied?:
|
|
706
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
707
|
+
reasoningLevelApplied?: ModelReasoningLevel;
|
|
705
708
|
reasoningFallbackApplied?: boolean;
|
|
706
709
|
textVerbosity?: OpenAITextVerbosity;
|
|
707
710
|
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
708
711
|
websocketMode?: OpenAiWebsocketMode;
|
|
709
712
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
710
|
-
createResponsesWs?: (client: OpenAI, options?:
|
|
713
|
+
createResponsesWs?: (client: OpenAI, options?: OpenAIResponsesWsOptions) => OpenAiResponsesWsLike;
|
|
711
714
|
websocketConnectTimeoutMs?: number;
|
|
712
715
|
websocketResponseIdleTimeoutMs?: number;
|
|
713
716
|
};
|
|
714
|
-
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$
|
|
715
|
-
readonly provider: typeof PROVIDER_NAME$
|
|
717
|
+
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$2, OpenAIInvokeOptions> {
|
|
718
|
+
readonly provider: typeof PROVIDER_NAME$2;
|
|
716
719
|
readonly model: string;
|
|
717
720
|
private readonly providerModel;
|
|
718
721
|
private readonly client;
|
|
@@ -755,25 +758,24 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
755
758
|
private getHttpStreamDebugObserver;
|
|
756
759
|
}
|
|
757
760
|
|
|
758
|
-
declare const PROVIDER_NAME: "openrouter";
|
|
761
|
+
declare const PROVIDER_NAME$1: "openrouter";
|
|
759
762
|
type OpenRouterTextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
760
763
|
type OpenRouterInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
761
764
|
reasoningEffort?: ReasoningEffort;
|
|
762
765
|
textVerbosity?: OpenRouterTextVerbosity;
|
|
763
766
|
};
|
|
764
|
-
type OpenRouterReasoningLevel = "low" | "medium" | "high" | "xhigh";
|
|
765
767
|
type ChatOpenRouterOptions = {
|
|
766
768
|
client?: OpenAI;
|
|
767
769
|
clientOptions?: ClientOptions;
|
|
768
770
|
model?: string;
|
|
769
771
|
reasoningEffort?: ReasoningEffort;
|
|
770
|
-
reasoningLevelRequested?:
|
|
771
|
-
reasoningLevelApplied?:
|
|
772
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
773
|
+
reasoningLevelApplied?: ModelReasoningLevel;
|
|
772
774
|
reasoningFallbackApplied?: boolean;
|
|
773
775
|
textVerbosity?: OpenRouterTextVerbosity;
|
|
774
776
|
};
|
|
775
|
-
declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, OpenRouterInvokeOptions> {
|
|
776
|
-
readonly provider: typeof PROVIDER_NAME;
|
|
777
|
+
declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME$1, OpenRouterInvokeOptions> {
|
|
778
|
+
readonly provider: typeof PROVIDER_NAME$1;
|
|
777
779
|
readonly model: string;
|
|
778
780
|
private readonly client;
|
|
779
781
|
private readonly defaultReasoningEffort?;
|
|
@@ -790,15 +792,62 @@ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, Open
|
|
|
790
792
|
private debugResponseIfEnabled;
|
|
791
793
|
}
|
|
792
794
|
|
|
795
|
+
type ZaiReasoningEffort = "high" | "max";
|
|
796
|
+
|
|
797
|
+
declare const PROVIDER_NAME: "zai";
|
|
798
|
+
type ZaiAppliedReasoningLevel = Extract<ModelReasoningLevel, "high" | "xhigh" | "max">;
|
|
799
|
+
type ZaiInvokeOptions = {
|
|
800
|
+
max_tokens?: number;
|
|
801
|
+
temperature?: number;
|
|
802
|
+
top_p?: number;
|
|
803
|
+
reasoningEffort?: ZaiReasoningEffort | null;
|
|
804
|
+
[key: string]: unknown;
|
|
805
|
+
};
|
|
806
|
+
type ChatZaiOptions = {
|
|
807
|
+
apiKey?: string;
|
|
808
|
+
baseURL?: string;
|
|
809
|
+
fetch?: typeof fetch;
|
|
810
|
+
model?: string;
|
|
811
|
+
timeoutMs?: number | null;
|
|
812
|
+
reasoningEffort?: ZaiReasoningEffort | null;
|
|
813
|
+
reasoningLevelRequested?: ModelReasoningLevel;
|
|
814
|
+
reasoningLevelApplied?: ZaiAppliedReasoningLevel;
|
|
815
|
+
reasoningFallbackApplied?: boolean;
|
|
816
|
+
};
|
|
817
|
+
declare class ChatZai implements BaseChatModel<typeof PROVIDER_NAME, ZaiInvokeOptions> {
|
|
818
|
+
readonly provider: typeof PROVIDER_NAME;
|
|
819
|
+
readonly model: string;
|
|
820
|
+
private readonly apiKey?;
|
|
821
|
+
private readonly baseURL;
|
|
822
|
+
private readonly fetchImpl;
|
|
823
|
+
private readonly timeoutMs;
|
|
824
|
+
private readonly defaultReasoningEffort;
|
|
825
|
+
private readonly reasoningLevelMeta;
|
|
826
|
+
private debugInvokeSeq;
|
|
827
|
+
private lastDebugRequestPayload;
|
|
828
|
+
constructor(options?: ChatZaiOptions);
|
|
829
|
+
ainvoke(input: ChatInvokeInput & {
|
|
830
|
+
options?: ZaiInvokeOptions;
|
|
831
|
+
}, _context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
|
|
832
|
+
private streamRequest;
|
|
833
|
+
private nextDebugInvokeSeq;
|
|
834
|
+
private debugRequestIfEnabled;
|
|
835
|
+
private debugResponseIfEnabled;
|
|
836
|
+
}
|
|
837
|
+
|
|
793
838
|
declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
794
839
|
declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
795
840
|
|
|
796
841
|
declare const GOOGLE_MODELS: ModelSpec[];
|
|
797
842
|
|
|
798
|
-
declare const OPENAI_DEFAULT_MODEL = "gpt-5.
|
|
843
|
+
declare const OPENAI_DEFAULT_MODEL = "gpt-5.6";
|
|
799
844
|
declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
800
845
|
declare const OPENAI_MODELS: ModelSpec[];
|
|
801
846
|
|
|
847
|
+
declare const ZAI_DEFAULT_MODEL = "glm-5.2";
|
|
848
|
+
declare const ZAI_REASONING_EFFORT_MODELS: Set<string>;
|
|
849
|
+
declare const ZAI_MODELS: ModelSpec[];
|
|
850
|
+
|
|
802
851
|
declare const DEFAULT_MODEL_REGISTRY: ModelRegistry;
|
|
803
852
|
|
|
804
853
|
declare const getDefaultSystemPromptPath: () => string;
|
|
@@ -810,4 +859,4 @@ declare class TaskComplete extends Error {
|
|
|
810
859
|
constructor(finalMessage?: string);
|
|
811
860
|
}
|
|
812
861
|
|
|
813
|
-
export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
|
862
|
+
export { ANTHROPIC_DEFAULT_MODEL, ANTHROPIC_MODELS, Agent, type AgentEventRecord, type AgentOptions, type AgentRunOptions, type AgentServices, type AgentSession, type BaseChatModel, type BaseMessage, ChatAnthropic, type ChatInvokeContext, type ChatInvokeInput, ChatOpenAI, ChatOpenRouter, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, type ModelCapabilities, type ModelCost, type ModelEntry, type ModelLimits, type ModelMetadataIndex, type ModelMetadataService, type ModelRegistry, type ModelSpec, OPENAI_DEFAULT_MODEL, OPENAI_DEFAULT_REASONING_EFFORT, OPENAI_MODELS, type ResolveStorageOptions, type RunContextRecord, type RunEndRecord, type RunErrorRecord, type RunEventStoreFactory, type RunEventStoreInit, type RunStartRecord, type RunStatusRecord, type SessionHeader, type SessionRecord, type SessionState, type SessionStateStore, type SessionStateSummary, type SessionStore, type StorageLayout, type StoragePathService, type StoragePaths, type StringifyContentMode, type StringifyContentOptions, TaskComplete, type Tool, type ToolChoice, type ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, type ToolResult, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|