@codelia/core 0.1.64 → 0.1.66
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 +641 -48
- package/dist/index.d.cts +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +638 -47
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -250,6 +250,7 @@ type ModelSpec = {
|
|
|
250
250
|
supportsTools?: boolean;
|
|
251
251
|
supportsVision?: boolean;
|
|
252
252
|
supportsReasoning?: boolean;
|
|
253
|
+
supportsFast?: boolean;
|
|
253
254
|
supportsJsonSchema?: boolean;
|
|
254
255
|
};
|
|
255
256
|
type ModelRegistry = {
|
|
@@ -260,7 +261,9 @@ declare function createModelRegistry(specs: ModelSpec[]): ModelRegistry;
|
|
|
260
261
|
declare function registerModels(registry: ModelRegistry, specs: ModelSpec[]): void;
|
|
261
262
|
declare function resolveModel(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): ModelSpec | undefined;
|
|
262
263
|
declare function listModels(registry: ModelRegistry, provider?: ProviderName): ModelSpec[];
|
|
264
|
+
declare function isUsableModelSpec(spec: ModelSpec | undefined): boolean;
|
|
263
265
|
declare function resolveProviderModelId(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): string | undefined;
|
|
266
|
+
declare function supportsFastMode(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): boolean;
|
|
264
267
|
declare function applyModelMetadata(registry: ModelRegistry, index: ModelMetadataIndex): ModelRegistry;
|
|
265
268
|
|
|
266
269
|
type CompactionConfig = {
|
|
@@ -376,6 +379,7 @@ type SessionHeader = {
|
|
|
376
379
|
provider?: string;
|
|
377
380
|
name?: string;
|
|
378
381
|
reasoning?: string;
|
|
382
|
+
fast?: boolean;
|
|
379
383
|
};
|
|
380
384
|
prompts?: {
|
|
381
385
|
system?: string;
|
|
@@ -452,6 +456,7 @@ type LlmRequestRecord = {
|
|
|
452
456
|
provider?: string;
|
|
453
457
|
name?: string;
|
|
454
458
|
reasoning?: string;
|
|
459
|
+
fast?: boolean;
|
|
455
460
|
};
|
|
456
461
|
input: {
|
|
457
462
|
messages: BaseMessage[];
|
|
@@ -625,7 +630,10 @@ interface StoragePathService {
|
|
|
625
630
|
}
|
|
626
631
|
|
|
627
632
|
declare const PROVIDER_NAME$2: "anthropic";
|
|
628
|
-
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming
|
|
633
|
+
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
|
|
634
|
+
speed?: "standard" | "fast" | null;
|
|
635
|
+
betas?: string[];
|
|
636
|
+
};
|
|
629
637
|
type AnthropicInvokeOptions = Partial<Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream">>;
|
|
630
638
|
type ChatAnthropicOptions = {
|
|
631
639
|
client?: Anthropic;
|
|
@@ -633,6 +641,7 @@ type ChatAnthropicOptions = {
|
|
|
633
641
|
model?: string;
|
|
634
642
|
maxTokens?: number;
|
|
635
643
|
invokeOptions?: AnthropicInvokeOptions;
|
|
644
|
+
fastMode?: boolean;
|
|
636
645
|
reasoningLevelRequested?: "low" | "medium" | "high" | "xhigh";
|
|
637
646
|
reasoningLevelApplied?: "low" | "medium" | "high" | "xhigh";
|
|
638
647
|
reasoningFallbackApplied?: boolean;
|
|
@@ -644,6 +653,7 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, Ant
|
|
|
644
653
|
private readonly client;
|
|
645
654
|
private readonly defaultMaxTokens;
|
|
646
655
|
private readonly defaultInvokeOptions;
|
|
656
|
+
private readonly fastMode;
|
|
647
657
|
private readonly reasoningLevelMeta;
|
|
648
658
|
private debugInvokeSeq;
|
|
649
659
|
private lastDebugRequestPayload;
|
|
@@ -673,6 +683,7 @@ type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
|
673
683
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
674
684
|
reasoningEffort?: ReasoningEffort;
|
|
675
685
|
textVerbosity?: OpenAITextVerbosity;
|
|
686
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
676
687
|
};
|
|
677
688
|
type OpenAIReasoningLevel = "low" | "medium" | "high" | "xhigh";
|
|
678
689
|
|
|
@@ -686,6 +697,7 @@ type ChatOpenAIOptions = {
|
|
|
686
697
|
reasoningLevelApplied?: OpenAIReasoningLevel;
|
|
687
698
|
reasoningFallbackApplied?: boolean;
|
|
688
699
|
textVerbosity?: OpenAITextVerbosity;
|
|
700
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
689
701
|
websocketMode?: OpenAiWebsocketMode;
|
|
690
702
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
691
703
|
createResponsesWs?: (client: OpenAI, options?: ConstructorParameters<typeof ResponsesWS>[1]) => OpenAiResponsesWsLike;
|
|
@@ -700,6 +712,7 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
700
712
|
private readonly defaultReasoningEffort?;
|
|
701
713
|
private readonly reasoningLevelMeta;
|
|
702
714
|
private readonly defaultTextVerbosity?;
|
|
715
|
+
private readonly defaultServiceTier?;
|
|
703
716
|
private readonly websocketMode;
|
|
704
717
|
private readonly websocketApiVersion;
|
|
705
718
|
private readonly wsTransport;
|
|
@@ -731,6 +744,8 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
731
744
|
private nextDebugInvokeSeq;
|
|
732
745
|
private debugRequestIfEnabled;
|
|
733
746
|
private debugResponseIfEnabled;
|
|
747
|
+
private debugEmptyCompletionIfEnabled;
|
|
748
|
+
private getHttpStreamDebugObserver;
|
|
734
749
|
}
|
|
735
750
|
|
|
736
751
|
declare const PROVIDER_NAME: "openrouter";
|
|
@@ -788,4 +803,4 @@ declare class TaskComplete extends Error {
|
|
|
788
803
|
constructor(finalMessage?: string);
|
|
789
804
|
}
|
|
790
805
|
|
|
791
|
-
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, resolveProviderModelId, stringifyContent, stringifyContentParts };
|
|
806
|
+
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, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|
package/dist/index.d.ts
CHANGED
|
@@ -250,6 +250,7 @@ type ModelSpec = {
|
|
|
250
250
|
supportsTools?: boolean;
|
|
251
251
|
supportsVision?: boolean;
|
|
252
252
|
supportsReasoning?: boolean;
|
|
253
|
+
supportsFast?: boolean;
|
|
253
254
|
supportsJsonSchema?: boolean;
|
|
254
255
|
};
|
|
255
256
|
type ModelRegistry = {
|
|
@@ -260,7 +261,9 @@ declare function createModelRegistry(specs: ModelSpec[]): ModelRegistry;
|
|
|
260
261
|
declare function registerModels(registry: ModelRegistry, specs: ModelSpec[]): void;
|
|
261
262
|
declare function resolveModel(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): ModelSpec | undefined;
|
|
262
263
|
declare function listModels(registry: ModelRegistry, provider?: ProviderName): ModelSpec[];
|
|
264
|
+
declare function isUsableModelSpec(spec: ModelSpec | undefined): boolean;
|
|
263
265
|
declare function resolveProviderModelId(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): string | undefined;
|
|
266
|
+
declare function supportsFastMode(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): boolean;
|
|
264
267
|
declare function applyModelMetadata(registry: ModelRegistry, index: ModelMetadataIndex): ModelRegistry;
|
|
265
268
|
|
|
266
269
|
type CompactionConfig = {
|
|
@@ -376,6 +379,7 @@ type SessionHeader = {
|
|
|
376
379
|
provider?: string;
|
|
377
380
|
name?: string;
|
|
378
381
|
reasoning?: string;
|
|
382
|
+
fast?: boolean;
|
|
379
383
|
};
|
|
380
384
|
prompts?: {
|
|
381
385
|
system?: string;
|
|
@@ -452,6 +456,7 @@ type LlmRequestRecord = {
|
|
|
452
456
|
provider?: string;
|
|
453
457
|
name?: string;
|
|
454
458
|
reasoning?: string;
|
|
459
|
+
fast?: boolean;
|
|
455
460
|
};
|
|
456
461
|
input: {
|
|
457
462
|
messages: BaseMessage[];
|
|
@@ -625,7 +630,10 @@ interface StoragePathService {
|
|
|
625
630
|
}
|
|
626
631
|
|
|
627
632
|
declare const PROVIDER_NAME$2: "anthropic";
|
|
628
|
-
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming
|
|
633
|
+
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
|
|
634
|
+
speed?: "standard" | "fast" | null;
|
|
635
|
+
betas?: string[];
|
|
636
|
+
};
|
|
629
637
|
type AnthropicInvokeOptions = Partial<Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream">>;
|
|
630
638
|
type ChatAnthropicOptions = {
|
|
631
639
|
client?: Anthropic;
|
|
@@ -633,6 +641,7 @@ type ChatAnthropicOptions = {
|
|
|
633
641
|
model?: string;
|
|
634
642
|
maxTokens?: number;
|
|
635
643
|
invokeOptions?: AnthropicInvokeOptions;
|
|
644
|
+
fastMode?: boolean;
|
|
636
645
|
reasoningLevelRequested?: "low" | "medium" | "high" | "xhigh";
|
|
637
646
|
reasoningLevelApplied?: "low" | "medium" | "high" | "xhigh";
|
|
638
647
|
reasoningFallbackApplied?: boolean;
|
|
@@ -644,6 +653,7 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, Ant
|
|
|
644
653
|
private readonly client;
|
|
645
654
|
private readonly defaultMaxTokens;
|
|
646
655
|
private readonly defaultInvokeOptions;
|
|
656
|
+
private readonly fastMode;
|
|
647
657
|
private readonly reasoningLevelMeta;
|
|
648
658
|
private debugInvokeSeq;
|
|
649
659
|
private lastDebugRequestPayload;
|
|
@@ -673,6 +683,7 @@ type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
|
673
683
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
674
684
|
reasoningEffort?: ReasoningEffort;
|
|
675
685
|
textVerbosity?: OpenAITextVerbosity;
|
|
686
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
676
687
|
};
|
|
677
688
|
type OpenAIReasoningLevel = "low" | "medium" | "high" | "xhigh";
|
|
678
689
|
|
|
@@ -686,6 +697,7 @@ type ChatOpenAIOptions = {
|
|
|
686
697
|
reasoningLevelApplied?: OpenAIReasoningLevel;
|
|
687
698
|
reasoningFallbackApplied?: boolean;
|
|
688
699
|
textVerbosity?: OpenAITextVerbosity;
|
|
700
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
689
701
|
websocketMode?: OpenAiWebsocketMode;
|
|
690
702
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
691
703
|
createResponsesWs?: (client: OpenAI, options?: ConstructorParameters<typeof ResponsesWS>[1]) => OpenAiResponsesWsLike;
|
|
@@ -700,6 +712,7 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
700
712
|
private readonly defaultReasoningEffort?;
|
|
701
713
|
private readonly reasoningLevelMeta;
|
|
702
714
|
private readonly defaultTextVerbosity?;
|
|
715
|
+
private readonly defaultServiceTier?;
|
|
703
716
|
private readonly websocketMode;
|
|
704
717
|
private readonly websocketApiVersion;
|
|
705
718
|
private readonly wsTransport;
|
|
@@ -731,6 +744,8 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
731
744
|
private nextDebugInvokeSeq;
|
|
732
745
|
private debugRequestIfEnabled;
|
|
733
746
|
private debugResponseIfEnabled;
|
|
747
|
+
private debugEmptyCompletionIfEnabled;
|
|
748
|
+
private getHttpStreamDebugObserver;
|
|
734
749
|
}
|
|
735
750
|
|
|
736
751
|
declare const PROVIDER_NAME: "openrouter";
|
|
@@ -788,4 +803,4 @@ declare class TaskComplete extends Error {
|
|
|
788
803
|
constructor(finalMessage?: string);
|
|
789
804
|
}
|
|
790
805
|
|
|
791
|
-
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, resolveProviderModelId, stringifyContent, stringifyContentParts };
|
|
806
|
+
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, isUsableModelSpec, listModels, registerModels, resolveModel, resolveProviderModelId, stringifyContent, stringifyContentParts, supportsFastMode };
|