@codelia/core 0.1.18 → 0.1.19
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 +773 -43
- package/dist/index.d.cts +39 -9
- package/dist/index.d.ts +39 -9
- package/dist/index.js +772 -43
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -211,7 +211,7 @@ type AgentServices = {
|
|
|
211
211
|
toolOutputCacheStore?: ToolOutputCacheStore | null;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
type ProviderName = "openai" | "anthropic" | "google";
|
|
214
|
+
type ProviderName = "openai" | "anthropic" | "openrouter" | "google";
|
|
215
215
|
type ChatInvokeInput = {
|
|
216
216
|
messages: BaseMessage[];
|
|
217
217
|
model?: string;
|
|
@@ -612,17 +612,17 @@ interface StoragePathService {
|
|
|
612
612
|
resolvePaths(options?: ResolveStorageOptions): StoragePaths;
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
-
declare const PROVIDER_NAME$
|
|
615
|
+
declare const PROVIDER_NAME$2: "anthropic";
|
|
616
616
|
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming;
|
|
617
|
-
type AnthropicInvokeOptions = Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream"
|
|
617
|
+
type AnthropicInvokeOptions = Partial<Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream">>;
|
|
618
618
|
type ChatAnthropicOptions = {
|
|
619
619
|
client?: Anthropic;
|
|
620
620
|
clientOptions?: ConstructorParameters<typeof Anthropic>[0];
|
|
621
621
|
model?: string;
|
|
622
622
|
maxTokens?: number;
|
|
623
623
|
};
|
|
624
|
-
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$
|
|
625
|
-
readonly provider: typeof PROVIDER_NAME$
|
|
624
|
+
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, AnthropicInvokeOptions> {
|
|
625
|
+
readonly provider: typeof PROVIDER_NAME$2;
|
|
626
626
|
readonly model: string;
|
|
627
627
|
private readonly client;
|
|
628
628
|
private readonly defaultMaxTokens;
|
|
@@ -637,7 +637,7 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$1, Ant
|
|
|
637
637
|
private debugResponseIfEnabled;
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
-
declare const PROVIDER_NAME: "openai";
|
|
640
|
+
declare const PROVIDER_NAME$1: "openai";
|
|
641
641
|
type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
642
642
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
643
643
|
reasoningEffort?: ReasoningEffort;
|
|
@@ -650,8 +650,8 @@ type ChatOpenAIOptions = {
|
|
|
650
650
|
reasoningEffort?: ReasoningEffort;
|
|
651
651
|
textVerbosity?: OpenAITextVerbosity;
|
|
652
652
|
};
|
|
653
|
-
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME, OpenAIInvokeOptions> {
|
|
654
|
-
readonly provider: typeof PROVIDER_NAME;
|
|
653
|
+
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAIInvokeOptions> {
|
|
654
|
+
readonly provider: typeof PROVIDER_NAME$1;
|
|
655
655
|
readonly model: string;
|
|
656
656
|
private readonly client;
|
|
657
657
|
private readonly defaultReasoningEffort?;
|
|
@@ -667,6 +667,36 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME, OpenAIIn
|
|
|
667
667
|
private debugResponseIfEnabled;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
+
declare const PROVIDER_NAME: "openrouter";
|
|
671
|
+
type OpenRouterTextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
672
|
+
type OpenRouterInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
673
|
+
reasoningEffort?: ReasoningEffort;
|
|
674
|
+
textVerbosity?: OpenRouterTextVerbosity;
|
|
675
|
+
};
|
|
676
|
+
type ChatOpenRouterOptions = {
|
|
677
|
+
client?: OpenAI;
|
|
678
|
+
clientOptions?: ClientOptions;
|
|
679
|
+
model?: string;
|
|
680
|
+
reasoningEffort?: ReasoningEffort;
|
|
681
|
+
textVerbosity?: OpenRouterTextVerbosity;
|
|
682
|
+
};
|
|
683
|
+
declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, OpenRouterInvokeOptions> {
|
|
684
|
+
readonly provider: typeof PROVIDER_NAME;
|
|
685
|
+
readonly model: string;
|
|
686
|
+
private readonly client;
|
|
687
|
+
private readonly defaultReasoningEffort?;
|
|
688
|
+
private readonly defaultTextVerbosity?;
|
|
689
|
+
private debugInvokeSeq;
|
|
690
|
+
private lastDebugRequestPayload;
|
|
691
|
+
constructor(options?: ChatOpenRouterOptions);
|
|
692
|
+
ainvoke(input: ChatInvokeInput & {
|
|
693
|
+
options?: OpenRouterInvokeOptions;
|
|
694
|
+
}, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
|
|
695
|
+
private nextDebugInvokeSeq;
|
|
696
|
+
private debugRequestIfEnabled;
|
|
697
|
+
private debugResponseIfEnabled;
|
|
698
|
+
}
|
|
699
|
+
|
|
670
700
|
declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
671
701
|
declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
672
702
|
|
|
@@ -687,4 +717,4 @@ declare class TaskComplete extends Error {
|
|
|
687
717
|
constructor(finalMessage?: string);
|
|
688
718
|
}
|
|
689
719
|
|
|
690
|
-
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, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, 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 ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, listModels, registerModels, resolveModel, stringifyContent, stringifyContentParts };
|
|
720
|
+
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 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 ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, listModels, registerModels, resolveModel, stringifyContent, stringifyContentParts };
|
package/dist/index.d.ts
CHANGED
|
@@ -211,7 +211,7 @@ type AgentServices = {
|
|
|
211
211
|
toolOutputCacheStore?: ToolOutputCacheStore | null;
|
|
212
212
|
};
|
|
213
213
|
|
|
214
|
-
type ProviderName = "openai" | "anthropic" | "google";
|
|
214
|
+
type ProviderName = "openai" | "anthropic" | "openrouter" | "google";
|
|
215
215
|
type ChatInvokeInput = {
|
|
216
216
|
messages: BaseMessage[];
|
|
217
217
|
model?: string;
|
|
@@ -612,17 +612,17 @@ interface StoragePathService {
|
|
|
612
612
|
resolvePaths(options?: ResolveStorageOptions): StoragePaths;
|
|
613
613
|
}
|
|
614
614
|
|
|
615
|
-
declare const PROVIDER_NAME$
|
|
615
|
+
declare const PROVIDER_NAME$2: "anthropic";
|
|
616
616
|
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming;
|
|
617
|
-
type AnthropicInvokeOptions = Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream"
|
|
617
|
+
type AnthropicInvokeOptions = Partial<Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream">>;
|
|
618
618
|
type ChatAnthropicOptions = {
|
|
619
619
|
client?: Anthropic;
|
|
620
620
|
clientOptions?: ConstructorParameters<typeof Anthropic>[0];
|
|
621
621
|
model?: string;
|
|
622
622
|
maxTokens?: number;
|
|
623
623
|
};
|
|
624
|
-
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$
|
|
625
|
-
readonly provider: typeof PROVIDER_NAME$
|
|
624
|
+
declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, AnthropicInvokeOptions> {
|
|
625
|
+
readonly provider: typeof PROVIDER_NAME$2;
|
|
626
626
|
readonly model: string;
|
|
627
627
|
private readonly client;
|
|
628
628
|
private readonly defaultMaxTokens;
|
|
@@ -637,7 +637,7 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$1, Ant
|
|
|
637
637
|
private debugResponseIfEnabled;
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
-
declare const PROVIDER_NAME: "openai";
|
|
640
|
+
declare const PROVIDER_NAME$1: "openai";
|
|
641
641
|
type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
642
642
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
643
643
|
reasoningEffort?: ReasoningEffort;
|
|
@@ -650,8 +650,8 @@ type ChatOpenAIOptions = {
|
|
|
650
650
|
reasoningEffort?: ReasoningEffort;
|
|
651
651
|
textVerbosity?: OpenAITextVerbosity;
|
|
652
652
|
};
|
|
653
|
-
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME, OpenAIInvokeOptions> {
|
|
654
|
-
readonly provider: typeof PROVIDER_NAME;
|
|
653
|
+
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAIInvokeOptions> {
|
|
654
|
+
readonly provider: typeof PROVIDER_NAME$1;
|
|
655
655
|
readonly model: string;
|
|
656
656
|
private readonly client;
|
|
657
657
|
private readonly defaultReasoningEffort?;
|
|
@@ -667,6 +667,36 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME, OpenAIIn
|
|
|
667
667
|
private debugResponseIfEnabled;
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
+
declare const PROVIDER_NAME: "openrouter";
|
|
671
|
+
type OpenRouterTextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
672
|
+
type OpenRouterInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
673
|
+
reasoningEffort?: ReasoningEffort;
|
|
674
|
+
textVerbosity?: OpenRouterTextVerbosity;
|
|
675
|
+
};
|
|
676
|
+
type ChatOpenRouterOptions = {
|
|
677
|
+
client?: OpenAI;
|
|
678
|
+
clientOptions?: ClientOptions;
|
|
679
|
+
model?: string;
|
|
680
|
+
reasoningEffort?: ReasoningEffort;
|
|
681
|
+
textVerbosity?: OpenRouterTextVerbosity;
|
|
682
|
+
};
|
|
683
|
+
declare class ChatOpenRouter implements BaseChatModel<typeof PROVIDER_NAME, OpenRouterInvokeOptions> {
|
|
684
|
+
readonly provider: typeof PROVIDER_NAME;
|
|
685
|
+
readonly model: string;
|
|
686
|
+
private readonly client;
|
|
687
|
+
private readonly defaultReasoningEffort?;
|
|
688
|
+
private readonly defaultTextVerbosity?;
|
|
689
|
+
private debugInvokeSeq;
|
|
690
|
+
private lastDebugRequestPayload;
|
|
691
|
+
constructor(options?: ChatOpenRouterOptions);
|
|
692
|
+
ainvoke(input: ChatInvokeInput & {
|
|
693
|
+
options?: OpenRouterInvokeOptions;
|
|
694
|
+
}, context?: ChatInvokeContext): Promise<ChatInvokeCompletion>;
|
|
695
|
+
private nextDebugInvokeSeq;
|
|
696
|
+
private debugRequestIfEnabled;
|
|
697
|
+
private debugResponseIfEnabled;
|
|
698
|
+
}
|
|
699
|
+
|
|
670
700
|
declare const ANTHROPIC_DEFAULT_MODEL = "claude-sonnet-4-5";
|
|
671
701
|
declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
672
702
|
|
|
@@ -687,4 +717,4 @@ declare class TaskComplete extends Error {
|
|
|
687
717
|
constructor(finalMessage?: string);
|
|
688
718
|
}
|
|
689
719
|
|
|
690
|
-
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, type ContentPart, DEFAULT_MODEL_REGISTRY, type DependencyKey, GOOGLE_MODELS, type LlmRequestRecord, type LlmResponseRecord, 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 ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, listModels, registerModels, resolveModel, stringifyContent, stringifyContentParts };
|
|
720
|
+
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 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 ToolContext, type ToolDefinition, type ToolExecution, type ToolOutputCacheConfig, type ToolOutputCacheReadOptions, type ToolOutputCacheRecord, type ToolOutputCacheSearchOptions, ToolOutputCacheService, type ToolOutputCacheStore, type ToolOutputRecord, type ToolOutputRef, type ToolPermissionDecision, type ToolPermissionHook, applyModelMetadata, createModelRegistry, defineTool, getDefaultSystemPromptPath, listModels, registerModels, resolveModel, stringifyContent, stringifyContentParts };
|