@codelia/core 0.1.68 → 0.1.69

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.cts CHANGED
@@ -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$2: "anthropic";
640
+ declare const PROVIDER_NAME$3: "anthropic";
640
641
  type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
641
642
  speed?: "standard" | "fast" | null;
642
643
  betas?: string[];
@@ -654,8 +655,8 @@ type ChatAnthropicOptions = {
654
655
  reasoningFallbackApplied?: boolean;
655
656
  reasoningBudgetPreset?: string;
656
657
  };
657
- declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, AnthropicInvokeOptions> {
658
- readonly provider: typeof PROVIDER_NAME$2;
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,7 +686,7 @@ type OpenAiResponsesWsLike = {
685
686
  }): void;
686
687
  };
687
688
 
688
- declare const PROVIDER_NAME$1: "openai";
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;
@@ -711,8 +712,8 @@ type ChatOpenAIOptions = {
711
712
  websocketConnectTimeoutMs?: number;
712
713
  websocketResponseIdleTimeoutMs?: number;
713
714
  };
714
- declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAIInvokeOptions> {
715
- readonly provider: typeof PROVIDER_NAME$1;
715
+ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$2, OpenAIInvokeOptions> {
716
+ readonly provider: typeof PROVIDER_NAME$2;
716
717
  readonly model: string;
717
718
  private readonly providerModel;
718
719
  private readonly client;
@@ -755,7 +756,7 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
755
756
  private getHttpStreamDebugObserver;
756
757
  }
757
758
 
758
- declare const PROVIDER_NAME: "openrouter";
759
+ declare const PROVIDER_NAME$1: "openrouter";
759
760
  type OpenRouterTextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
760
761
  type OpenRouterInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
761
762
  reasoningEffort?: ReasoningEffort;
@@ -772,8 +773,8 @@ type ChatOpenRouterOptions = {
772
773
  reasoningFallbackApplied?: boolean;
773
774
  textVerbosity?: OpenRouterTextVerbosity;
774
775
  };
775
- declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, OpenRouterInvokeOptions> {
776
- readonly provider: typeof PROVIDER_NAME;
776
+ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME$1, OpenRouterInvokeOptions> {
777
+ readonly provider: typeof PROVIDER_NAME$1;
777
778
  readonly model: string;
778
779
  private readonly client;
779
780
  private readonly defaultReasoningEffort?;
@@ -790,6 +791,48 @@ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, Open
790
791
  private debugResponseIfEnabled;
791
792
  }
792
793
 
794
+ type ZaiReasoningEffort = "high" | "max";
795
+
796
+ declare const PROVIDER_NAME: "zai";
797
+ type ZaiInvokeOptions = {
798
+ max_tokens?: number;
799
+ temperature?: number;
800
+ top_p?: number;
801
+ reasoningEffort?: ZaiReasoningEffort | null;
802
+ [key: string]: unknown;
803
+ };
804
+ type ChatZaiOptions = {
805
+ apiKey?: string;
806
+ baseURL?: string;
807
+ fetch?: typeof fetch;
808
+ model?: string;
809
+ timeoutMs?: number | null;
810
+ reasoningEffort?: ZaiReasoningEffort | null;
811
+ reasoningLevelRequested?: "low" | "medium" | "high" | "xhigh";
812
+ reasoningLevelApplied?: "high" | "xhigh";
813
+ reasoningFallbackApplied?: boolean;
814
+ };
815
+ declare class ChatZai implements BaseChatModel<typeof PROVIDER_NAME, ZaiInvokeOptions> {
816
+ readonly provider: typeof PROVIDER_NAME;
817
+ readonly model: string;
818
+ private readonly apiKey?;
819
+ private readonly baseURL;
820
+ private readonly fetchImpl;
821
+ private readonly timeoutMs;
822
+ private readonly defaultReasoningEffort;
823
+ private readonly reasoningLevelMeta;
824
+ private debugInvokeSeq;
825
+ private lastDebugRequestPayload;
826
+ constructor(options?: ChatZaiOptions);
827
+ ainvoke(input: ChatInvokeInput & {
828
+ options?: ZaiInvokeOptions;
829
+ }, _context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
830
+ private streamRequest;
831
+ private nextDebugInvokeSeq;
832
+ private debugRequestIfEnabled;
833
+ private debugResponseIfEnabled;
834
+ }
835
+
793
836
  declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
794
837
  declare const ANTHROPIC_MODELS: ModelSpec[];
795
838
 
@@ -799,6 +842,10 @@ declare const OPENAI_DEFAULT_MODEL = "gpt-5.5";
799
842
  declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
800
843
  declare const OPENAI_MODELS: ModelSpec[];
801
844
 
845
+ declare const ZAI_DEFAULT_MODEL = "glm-5.2";
846
+ declare const ZAI_REASONING_EFFORT_MODELS: Set<string>;
847
+ declare const ZAI_MODELS: ModelSpec[];
848
+
802
849
  declare const DEFAULT_MODEL_REGISTRY: ModelRegistry;
803
850
 
804
851
  declare const getDefaultSystemPromptPath: () => string;
@@ -810,4 +857,4 @@ declare class TaskComplete extends Error {
810
857
  constructor(finalMessage?: string);
811
858
  }
812
859
 
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 };
860
+ 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
@@ -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$2: "anthropic";
640
+ declare const PROVIDER_NAME$3: "anthropic";
640
641
  type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
641
642
  speed?: "standard" | "fast" | null;
642
643
  betas?: string[];
@@ -654,8 +655,8 @@ type ChatAnthropicOptions = {
654
655
  reasoningFallbackApplied?: boolean;
655
656
  reasoningBudgetPreset?: string;
656
657
  };
657
- declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, AnthropicInvokeOptions> {
658
- readonly provider: typeof PROVIDER_NAME$2;
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,7 +686,7 @@ type OpenAiResponsesWsLike = {
685
686
  }): void;
686
687
  };
687
688
 
688
- declare const PROVIDER_NAME$1: "openai";
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;
@@ -711,8 +712,8 @@ type ChatOpenAIOptions = {
711
712
  websocketConnectTimeoutMs?: number;
712
713
  websocketResponseIdleTimeoutMs?: number;
713
714
  };
714
- declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAIInvokeOptions> {
715
- readonly provider: typeof PROVIDER_NAME$1;
715
+ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$2, OpenAIInvokeOptions> {
716
+ readonly provider: typeof PROVIDER_NAME$2;
716
717
  readonly model: string;
717
718
  private readonly providerModel;
718
719
  private readonly client;
@@ -755,7 +756,7 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
755
756
  private getHttpStreamDebugObserver;
756
757
  }
757
758
 
758
- declare const PROVIDER_NAME: "openrouter";
759
+ declare const PROVIDER_NAME$1: "openrouter";
759
760
  type OpenRouterTextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
760
761
  type OpenRouterInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
761
762
  reasoningEffort?: ReasoningEffort;
@@ -772,8 +773,8 @@ type ChatOpenRouterOptions = {
772
773
  reasoningFallbackApplied?: boolean;
773
774
  textVerbosity?: OpenRouterTextVerbosity;
774
775
  };
775
- declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, OpenRouterInvokeOptions> {
776
- readonly provider: typeof PROVIDER_NAME;
776
+ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME$1, OpenRouterInvokeOptions> {
777
+ readonly provider: typeof PROVIDER_NAME$1;
777
778
  readonly model: string;
778
779
  private readonly client;
779
780
  private readonly defaultReasoningEffort?;
@@ -790,6 +791,48 @@ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, Open
790
791
  private debugResponseIfEnabled;
791
792
  }
792
793
 
794
+ type ZaiReasoningEffort = "high" | "max";
795
+
796
+ declare const PROVIDER_NAME: "zai";
797
+ type ZaiInvokeOptions = {
798
+ max_tokens?: number;
799
+ temperature?: number;
800
+ top_p?: number;
801
+ reasoningEffort?: ZaiReasoningEffort | null;
802
+ [key: string]: unknown;
803
+ };
804
+ type ChatZaiOptions = {
805
+ apiKey?: string;
806
+ baseURL?: string;
807
+ fetch?: typeof fetch;
808
+ model?: string;
809
+ timeoutMs?: number | null;
810
+ reasoningEffort?: ZaiReasoningEffort | null;
811
+ reasoningLevelRequested?: "low" | "medium" | "high" | "xhigh";
812
+ reasoningLevelApplied?: "high" | "xhigh";
813
+ reasoningFallbackApplied?: boolean;
814
+ };
815
+ declare class ChatZai implements BaseChatModel<typeof PROVIDER_NAME, ZaiInvokeOptions> {
816
+ readonly provider: typeof PROVIDER_NAME;
817
+ readonly model: string;
818
+ private readonly apiKey?;
819
+ private readonly baseURL;
820
+ private readonly fetchImpl;
821
+ private readonly timeoutMs;
822
+ private readonly defaultReasoningEffort;
823
+ private readonly reasoningLevelMeta;
824
+ private debugInvokeSeq;
825
+ private lastDebugRequestPayload;
826
+ constructor(options?: ChatZaiOptions);
827
+ ainvoke(input: ChatInvokeInput & {
828
+ options?: ZaiInvokeOptions;
829
+ }, _context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
830
+ private streamRequest;
831
+ private nextDebugInvokeSeq;
832
+ private debugRequestIfEnabled;
833
+ private debugResponseIfEnabled;
834
+ }
835
+
793
836
  declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
794
837
  declare const ANTHROPIC_MODELS: ModelSpec[];
795
838
 
@@ -799,6 +842,10 @@ declare const OPENAI_DEFAULT_MODEL = "gpt-5.5";
799
842
  declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
800
843
  declare const OPENAI_MODELS: ModelSpec[];
801
844
 
845
+ declare const ZAI_DEFAULT_MODEL = "glm-5.2";
846
+ declare const ZAI_REASONING_EFFORT_MODELS: Set<string>;
847
+ declare const ZAI_MODELS: ModelSpec[];
848
+
802
849
  declare const DEFAULT_MODEL_REGISTRY: ModelRegistry;
803
850
 
804
851
  declare const getDefaultSystemPromptPath: () => string;
@@ -810,4 +857,4 @@ declare class TaskComplete extends Error {
810
857
  constructor(finalMessage?: string);
811
858
  }
812
859
 
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 };
860
+ 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 };