@codelia/core 0.1.82 → 0.1.83
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 +289 -67
- package/dist/index.d.ts +17 -9
- package/dist/index.js +288 -67
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _codelia_shared_types from '@codelia/shared-types';
|
|
2
|
-
import { LlmCallTiming, ProviderName, AgentEvent, SessionStateSummary as SessionStateSummary$1, ModelReasoningLevel } from '@codelia/shared-types';
|
|
2
|
+
import { LlmCallTiming, ProviderName, ModelFastMode, AgentEvent, SessionStateSummary as SessionStateSummary$1, ModelReasoningLevel } from '@codelia/shared-types';
|
|
3
3
|
export { AgentEvent, FinalResponseEvent, LlmRetryEvent, LlmStatusEvent, ReasoningEvent, StepCompleteEvent, StepStartEvent, TextEvent, ToolCallEvent, ToolResultEvent } from '@codelia/shared-types';
|
|
4
4
|
import { JSONSchema7 } from 'json-schema';
|
|
5
5
|
import { ZodSchema } from 'zod';
|
|
@@ -136,6 +136,8 @@ type AssistantMessage = {
|
|
|
136
136
|
name?: string;
|
|
137
137
|
tool_calls?: ToolCall[];
|
|
138
138
|
refusal?: string | null;
|
|
139
|
+
/** Provider-owned response metadata, preserved for exact history replay. */
|
|
140
|
+
provider_meta?: unknown;
|
|
139
141
|
};
|
|
140
142
|
type ToolOutputRef = {
|
|
141
143
|
id: string;
|
|
@@ -467,7 +469,7 @@ type SessionHeader = {
|
|
|
467
469
|
provider?: string;
|
|
468
470
|
name?: string;
|
|
469
471
|
reasoning?: string;
|
|
470
|
-
fast?:
|
|
472
|
+
fast?: ModelFastMode;
|
|
471
473
|
source?: "config" | "session";
|
|
472
474
|
};
|
|
473
475
|
prompts?: {
|
|
@@ -535,7 +537,7 @@ type LlmRequestRecord = {
|
|
|
535
537
|
provider?: string;
|
|
536
538
|
name?: string;
|
|
537
539
|
reasoning?: string;
|
|
538
|
-
fast?:
|
|
540
|
+
fast?: ModelFastMode;
|
|
539
541
|
};
|
|
540
542
|
input: {
|
|
541
543
|
messages: BaseMessage[];
|
|
@@ -780,7 +782,9 @@ type ChatMoonshotOptions = {
|
|
|
780
782
|
timeoutMs?: number;
|
|
781
783
|
maxRetries?: number;
|
|
782
784
|
reasoningLevelRequested?: ModelReasoningLevel;
|
|
785
|
+
reasoningEffort?: MoonshotReasoningEffort;
|
|
783
786
|
};
|
|
787
|
+
type MoonshotReasoningEffort = "low" | "high" | "max";
|
|
784
788
|
declare class ChatMoonshot implements BaseChatModel<typeof PROVIDER_NAME$4, MoonshotInvokeOptions> {
|
|
785
789
|
readonly provider: typeof PROVIDER_NAME$4;
|
|
786
790
|
readonly model: string;
|
|
@@ -788,6 +792,7 @@ declare class ChatMoonshot implements BaseChatModel<typeof PROVIDER_NAME$4, Moon
|
|
|
788
792
|
private readonly apiKey?;
|
|
789
793
|
private readonly clientOptions;
|
|
790
794
|
private readonly reasoningLevelRequested;
|
|
795
|
+
private readonly reasoningEffort;
|
|
791
796
|
private debugInvokeSeq;
|
|
792
797
|
private lastDebugRequestPayload;
|
|
793
798
|
constructor(options?: ChatMoonshotOptions);
|
|
@@ -819,10 +824,12 @@ type OpenAiResponsesWsLike = {
|
|
|
819
824
|
|
|
820
825
|
declare const PROVIDER_NAME$3: "openai";
|
|
821
826
|
type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
827
|
+
/** The SDK service-tier union can lag public OpenAI API additions. */
|
|
828
|
+
type OpenAiServiceTier = ResponseCreateParamsBase["service_tier"] | "ultrafast";
|
|
822
829
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
823
830
|
reasoningEffort?: ResponsesReasoningEffort;
|
|
824
831
|
textVerbosity?: OpenAITextVerbosity;
|
|
825
|
-
serviceTier?:
|
|
832
|
+
serviceTier?: OpenAiServiceTier;
|
|
826
833
|
};
|
|
827
834
|
type OpenAIResponsesWsOptions = NonNullable<ConstructorParameters<typeof ResponsesWS>[1]> & {
|
|
828
835
|
headers?: Record<string, string>;
|
|
@@ -838,7 +845,7 @@ type ChatOpenAIOptions = {
|
|
|
838
845
|
reasoningLevelApplied?: ModelReasoningLevel;
|
|
839
846
|
reasoningFallbackApplied?: boolean;
|
|
840
847
|
textVerbosity?: OpenAITextVerbosity;
|
|
841
|
-
serviceTier?:
|
|
848
|
+
serviceTier?: OpenAiServiceTier;
|
|
842
849
|
websocketMode?: OpenAiWebsocketMode;
|
|
843
850
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
844
851
|
createResponsesWs?: (client: OpenAI, options?: OpenAIResponsesWsOptions) => OpenAiResponsesWsLike;
|
|
@@ -928,7 +935,7 @@ declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME$2, Op
|
|
|
928
935
|
}
|
|
929
936
|
|
|
930
937
|
declare const PROVIDER_NAME$1: "xai";
|
|
931
|
-
type XaiReasoningEffort = "low" | "medium" | "high";
|
|
938
|
+
type XaiReasoningEffort = "low" | "medium" | "high" | "xhigh";
|
|
932
939
|
type XaiInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream" | "reasoning"> & {
|
|
933
940
|
reasoningEffort?: XaiReasoningEffort;
|
|
934
941
|
};
|
|
@@ -959,10 +966,10 @@ declare class ChatXai implements BaseChatModel<typeof PROVIDER_NAME$1, XaiInvoke
|
|
|
959
966
|
private debugResponseIfEnabled;
|
|
960
967
|
}
|
|
961
968
|
|
|
962
|
-
type ZaiReasoningEffort = "high" | "max";
|
|
969
|
+
type ZaiReasoningEffort = "low" | "high" | "max";
|
|
963
970
|
|
|
964
971
|
declare const PROVIDER_NAME: "zai";
|
|
965
|
-
type ZaiAppliedReasoningLevel = Extract<ModelReasoningLevel, "high" | "xhigh" | "max">;
|
|
972
|
+
type ZaiAppliedReasoningLevel = Extract<ModelReasoningLevel, "low" | "high" | "xhigh" | "max">;
|
|
966
973
|
type ZaiInvokeOptions = {
|
|
967
974
|
max_tokens?: number;
|
|
968
975
|
temperature?: number;
|
|
@@ -1009,6 +1016,7 @@ declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
|
1009
1016
|
declare const GOOGLE_MODELS: ModelSpec[];
|
|
1010
1017
|
|
|
1011
1018
|
declare const MOONSHOT_DEFAULT_MODEL = "kimi-k3";
|
|
1019
|
+
declare const MOONSHOT_K3_1_MODELS: Set<string>;
|
|
1012
1020
|
declare const MOONSHOT_MODELS: ModelSpec[];
|
|
1013
1021
|
|
|
1014
1022
|
declare const OPENAI_DEFAULT_MODEL = "gpt-5.6";
|
|
@@ -1066,4 +1074,4 @@ declare class ChatResponses implements BaseChatModel<string, ResponsesInvokeOpti
|
|
|
1066
1074
|
}, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
|
|
1067
1075
|
}
|
|
1068
1076
|
|
|
1069
|
-
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, ChatMoonshot, ChatOpenAI, ChatOpenRouter, ChatResponses, ChatXai, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type ImageTokenEstimate, type ImageTokenInput, type LlmRequestRecord, type LlmResponseRecord, MOONSHOT_DEFAULT_MODEL, MOONSHOT_MODELS, 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 ProviderFailure, type ProviderFailureClassifier, ProviderFailureError, type ProviderFailureKind, type ResolveStorageOptions, type ResponsesInvokeOptions, type RetryDelaySource, 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, ToolPermissionDenied, type ToolPermissionHook, type ToolResult, XAI_DEFAULT_MODEL, XAI_DEFAULT_REASONING_EFFORT, XAI_MODELS, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isProviderFailureError, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
|
1077
|
+
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, ChatMoonshot, ChatOpenAI, ChatOpenRouter, ChatResponses, ChatXai, ChatZai, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type ImageTokenEstimate, type ImageTokenInput, type LlmRequestRecord, type LlmResponseRecord, MOONSHOT_DEFAULT_MODEL, MOONSHOT_K3_1_MODELS, MOONSHOT_MODELS, 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 ProviderFailure, type ProviderFailureClassifier, ProviderFailureError, type ProviderFailureKind, type ResolveStorageOptions, type ResponsesInvokeOptions, type RetryDelaySource, 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, ToolPermissionDenied, type ToolPermissionHook, type ToolResult, XAI_DEFAULT_MODEL, XAI_DEFAULT_REASONING_EFFORT, XAI_MODELS, ZAI_DEFAULT_MODEL, ZAI_MODELS, ZAI_REASONING_EFFORT_MODELS, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, isProviderFailureError, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|