@codelia/core 0.1.40 → 0.1.42
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 +24 -4
- package/dist/index.d.cts +6 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.js +23 -4
- package/package.json +3 -3
- package/prompts/system.md +5 -1
package/dist/index.cjs
CHANGED
|
@@ -50,6 +50,7 @@ __export(index_exports, {
|
|
|
50
50
|
listModels: () => listModels,
|
|
51
51
|
registerModels: () => registerModels,
|
|
52
52
|
resolveModel: () => resolveModel,
|
|
53
|
+
resolveProviderModelId: () => resolveProviderModelId,
|
|
53
54
|
stringifyContent: () => stringifyContent,
|
|
54
55
|
stringifyContentParts: () => stringifyContentParts
|
|
55
56
|
});
|
|
@@ -61,6 +62,7 @@ var import_config = require("@codelia/config");
|
|
|
61
62
|
// src/models/openai.ts
|
|
62
63
|
var OPENAI_DEFAULT_MODEL = "gpt-5.3-codex";
|
|
63
64
|
var OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
65
|
+
var GPT_5_4_CAPPED_INPUT_TOKENS = 272e3;
|
|
64
66
|
var OPENAI_MODELS = [
|
|
65
67
|
{
|
|
66
68
|
id: OPENAI_DEFAULT_MODEL,
|
|
@@ -71,6 +73,15 @@ var OPENAI_MODELS = [
|
|
|
71
73
|
id: "gpt-5.4",
|
|
72
74
|
provider: "openai",
|
|
73
75
|
contextWindow: 105e4,
|
|
76
|
+
maxInputTokens: GPT_5_4_CAPPED_INPUT_TOKENS,
|
|
77
|
+
maxOutputTokens: 128e3
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: "gpt-5.4-1M",
|
|
81
|
+
provider: "openai",
|
|
82
|
+
providerModelId: "gpt-5.4",
|
|
83
|
+
aliases: ["gpt-5.4-1m", "gpt-5.4-full"],
|
|
84
|
+
contextWindow: 105e4,
|
|
74
85
|
maxInputTokens: 942e3,
|
|
75
86
|
maxOutputTokens: 128e3
|
|
76
87
|
},
|
|
@@ -349,6 +360,10 @@ function listModels(registry, provider) {
|
|
|
349
360
|
const all = Object.values(registry.modelsById);
|
|
350
361
|
return provider ? all.filter((model) => model.provider === provider) : all;
|
|
351
362
|
}
|
|
363
|
+
function resolveProviderModelId(registry, idOrAlias, provider) {
|
|
364
|
+
const spec = resolveModel(registry, idOrAlias, provider);
|
|
365
|
+
return spec ? spec.providerModelId ?? spec.id : void 0;
|
|
366
|
+
}
|
|
352
367
|
function cloneAliases(aliasesByProvider) {
|
|
353
368
|
return {
|
|
354
369
|
openai: { ...aliasesByProvider.openai },
|
|
@@ -907,7 +922,7 @@ var ToolOutputCacheService = class {
|
|
|
907
922
|
llm.provider,
|
|
908
923
|
llm.model
|
|
909
924
|
);
|
|
910
|
-
const contextLimit = modelSpec?.
|
|
925
|
+
const contextLimit = modelSpec?.maxInputTokens ?? modelSpec?.contextWindow ?? null;
|
|
911
926
|
if (!contextLimit || contextLimit <= 0) {
|
|
912
927
|
return MAX_CONTEXT_BUDGET;
|
|
913
928
|
}
|
|
@@ -2808,7 +2823,8 @@ function toResponsesToolChoice(choice) {
|
|
|
2808
2823
|
}
|
|
2809
2824
|
function toChatInvokeCompletion2(response, meta) {
|
|
2810
2825
|
const usage = response.usage ? {
|
|
2811
|
-
model: response.model,
|
|
2826
|
+
model: meta?.selected_model ?? response.model,
|
|
2827
|
+
provider_model: response.model,
|
|
2812
2828
|
input_tokens: response.usage.input_tokens,
|
|
2813
2829
|
input_cached_tokens: response.usage.input_tokens_details?.cached_tokens,
|
|
2814
2830
|
output_tokens: response.usage.output_tokens,
|
|
@@ -3670,6 +3686,7 @@ var WS_REUSE_MAX_IDLE_MS = 3e4;
|
|
|
3670
3686
|
var ChatOpenAI = class {
|
|
3671
3687
|
provider = PROVIDER_NAME2;
|
|
3672
3688
|
model;
|
|
3689
|
+
providerModel;
|
|
3673
3690
|
client;
|
|
3674
3691
|
defaultReasoningEffort;
|
|
3675
3692
|
reasoningLevelMeta;
|
|
@@ -3685,6 +3702,7 @@ var ChatOpenAI = class {
|
|
|
3685
3702
|
constructor(options = {}) {
|
|
3686
3703
|
this.client = options.client ?? new import_openai3.default(options.clientOptions);
|
|
3687
3704
|
this.model = options.model ?? DEFAULT_MODEL2;
|
|
3705
|
+
this.providerModel = options.providerModel ?? this.model;
|
|
3688
3706
|
this.defaultReasoningEffort = options.reasoningEffort ?? DEFAULT_REASONING_EFFORT;
|
|
3689
3707
|
this.reasoningLevelMeta = {
|
|
3690
3708
|
requested: options.reasoningLevelRequested,
|
|
@@ -3717,7 +3735,7 @@ var ChatOpenAI = class {
|
|
|
3717
3735
|
const tool_choice = toResponsesToolChoice(toolChoice);
|
|
3718
3736
|
const { reasoningEffort, textVerbosity, ...rest } = options ?? {};
|
|
3719
3737
|
const request = {
|
|
3720
|
-
model: model ?? this.
|
|
3738
|
+
model: model ?? this.providerModel,
|
|
3721
3739
|
input: inputItems,
|
|
3722
3740
|
...rest,
|
|
3723
3741
|
...tools ? { tools } : {},
|
|
@@ -3754,7 +3772,7 @@ var ChatOpenAI = class {
|
|
|
3754
3772
|
const sessionIdHeader = getSessionIdHeaderValue(request.prompt_cache_key);
|
|
3755
3773
|
const debugSeq = this.nextDebugInvokeSeq();
|
|
3756
3774
|
const requestMeta = {
|
|
3757
|
-
model: String(request.model ?? this.
|
|
3775
|
+
model: String(request.model ?? this.providerModel),
|
|
3758
3776
|
instructionsHash: (0, import_node_crypto2.createHash)("sha256").update(String(request.instructions ?? "")).digest("hex").slice(0, 12),
|
|
3759
3777
|
toolsHash: (0, import_node_crypto2.createHash)("sha256").update(safeJsonStringify(request.tools ?? [])).digest("hex").slice(0, 12)
|
|
3760
3778
|
};
|
|
@@ -3772,6 +3790,7 @@ var ChatOpenAI = class {
|
|
|
3772
3790
|
transportResult.transport
|
|
3773
3791
|
);
|
|
3774
3792
|
return toChatInvokeCompletion2(transportResult.response, {
|
|
3793
|
+
selected_model: model ?? this.model,
|
|
3775
3794
|
transport: transportResult.transport,
|
|
3776
3795
|
websocket_mode: this.websocketMode,
|
|
3777
3796
|
fallback_used: transportResult.fallbackUsed,
|
|
@@ -4974,6 +4993,7 @@ function defineTool(toolOptions) {
|
|
|
4974
4993
|
listModels,
|
|
4975
4994
|
registerModels,
|
|
4976
4995
|
resolveModel,
|
|
4996
|
+
resolveProviderModelId,
|
|
4977
4997
|
stringifyContent,
|
|
4978
4998
|
stringifyContentParts
|
|
4979
4999
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -139,6 +139,7 @@ type BaseMessage = UserMessage | SystemMessage | AssistantMessage | ToolMessage
|
|
|
139
139
|
|
|
140
140
|
type ChatInvokeUsage = {
|
|
141
141
|
model: string;
|
|
142
|
+
provider_model?: string | null;
|
|
142
143
|
input_tokens: number;
|
|
143
144
|
input_cached_tokens?: number | null;
|
|
144
145
|
input_cache_creation_tokens?: number | null;
|
|
@@ -241,6 +242,7 @@ interface BaseChatModel<P extends ProviderName = ProviderName, O = unknown> {
|
|
|
241
242
|
type ModelSpec = {
|
|
242
243
|
id: string;
|
|
243
244
|
provider: ProviderName;
|
|
245
|
+
providerModelId?: string;
|
|
244
246
|
aliases?: string[];
|
|
245
247
|
contextWindow?: number;
|
|
246
248
|
maxInputTokens?: number;
|
|
@@ -258,6 +260,7 @@ declare function createModelRegistry(specs: ModelSpec[]): ModelRegistry;
|
|
|
258
260
|
declare function registerModels(registry: ModelRegistry, specs: ModelSpec[]): void;
|
|
259
261
|
declare function resolveModel(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): ModelSpec | undefined;
|
|
260
262
|
declare function listModels(registry: ModelRegistry, provider?: ProviderName): ModelSpec[];
|
|
263
|
+
declare function resolveProviderModelId(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): string | undefined;
|
|
261
264
|
declare function applyModelMetadata(registry: ModelRegistry, index: ModelMetadataIndex): ModelRegistry;
|
|
262
265
|
|
|
263
266
|
type CompactionConfig = {
|
|
@@ -677,6 +680,7 @@ type ChatOpenAIOptions = {
|
|
|
677
680
|
client?: OpenAI;
|
|
678
681
|
clientOptions?: ClientOptions;
|
|
679
682
|
model?: string;
|
|
683
|
+
providerModel?: string;
|
|
680
684
|
reasoningEffort?: ReasoningEffort;
|
|
681
685
|
reasoningLevelRequested?: OpenAIReasoningLevel;
|
|
682
686
|
reasoningLevelApplied?: OpenAIReasoningLevel;
|
|
@@ -691,6 +695,7 @@ type ChatOpenAIOptions = {
|
|
|
691
695
|
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAIInvokeOptions> {
|
|
692
696
|
readonly provider: typeof PROVIDER_NAME$1;
|
|
693
697
|
readonly model: string;
|
|
698
|
+
private readonly providerModel;
|
|
694
699
|
private readonly client;
|
|
695
700
|
private readonly defaultReasoningEffort?;
|
|
696
701
|
private readonly reasoningLevelMeta;
|
|
@@ -783,4 +788,4 @@ declare class TaskComplete extends Error {
|
|
|
783
788
|
constructor(finalMessage?: string);
|
|
784
789
|
}
|
|
785
790
|
|
|
786
|
-
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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -139,6 +139,7 @@ type BaseMessage = UserMessage | SystemMessage | AssistantMessage | ToolMessage
|
|
|
139
139
|
|
|
140
140
|
type ChatInvokeUsage = {
|
|
141
141
|
model: string;
|
|
142
|
+
provider_model?: string | null;
|
|
142
143
|
input_tokens: number;
|
|
143
144
|
input_cached_tokens?: number | null;
|
|
144
145
|
input_cache_creation_tokens?: number | null;
|
|
@@ -241,6 +242,7 @@ interface BaseChatModel<P extends ProviderName = ProviderName, O = unknown> {
|
|
|
241
242
|
type ModelSpec = {
|
|
242
243
|
id: string;
|
|
243
244
|
provider: ProviderName;
|
|
245
|
+
providerModelId?: string;
|
|
244
246
|
aliases?: string[];
|
|
245
247
|
contextWindow?: number;
|
|
246
248
|
maxInputTokens?: number;
|
|
@@ -258,6 +260,7 @@ declare function createModelRegistry(specs: ModelSpec[]): ModelRegistry;
|
|
|
258
260
|
declare function registerModels(registry: ModelRegistry, specs: ModelSpec[]): void;
|
|
259
261
|
declare function resolveModel(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): ModelSpec | undefined;
|
|
260
262
|
declare function listModels(registry: ModelRegistry, provider?: ProviderName): ModelSpec[];
|
|
263
|
+
declare function resolveProviderModelId(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): string | undefined;
|
|
261
264
|
declare function applyModelMetadata(registry: ModelRegistry, index: ModelMetadataIndex): ModelRegistry;
|
|
262
265
|
|
|
263
266
|
type CompactionConfig = {
|
|
@@ -677,6 +680,7 @@ type ChatOpenAIOptions = {
|
|
|
677
680
|
client?: OpenAI;
|
|
678
681
|
clientOptions?: ClientOptions;
|
|
679
682
|
model?: string;
|
|
683
|
+
providerModel?: string;
|
|
680
684
|
reasoningEffort?: ReasoningEffort;
|
|
681
685
|
reasoningLevelRequested?: OpenAIReasoningLevel;
|
|
682
686
|
reasoningLevelApplied?: OpenAIReasoningLevel;
|
|
@@ -691,6 +695,7 @@ type ChatOpenAIOptions = {
|
|
|
691
695
|
declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAIInvokeOptions> {
|
|
692
696
|
readonly provider: typeof PROVIDER_NAME$1;
|
|
693
697
|
readonly model: string;
|
|
698
|
+
private readonly providerModel;
|
|
694
699
|
private readonly client;
|
|
695
700
|
private readonly defaultReasoningEffort?;
|
|
696
701
|
private readonly reasoningLevelMeta;
|
|
@@ -783,4 +788,4 @@ declare class TaskComplete extends Error {
|
|
|
783
788
|
constructor(finalMessage?: string);
|
|
784
789
|
}
|
|
785
790
|
|
|
786
|
-
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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ import { configRegistry } from "@codelia/config";
|
|
|
4
4
|
// src/models/openai.ts
|
|
5
5
|
var OPENAI_DEFAULT_MODEL = "gpt-5.3-codex";
|
|
6
6
|
var OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
7
|
+
var GPT_5_4_CAPPED_INPUT_TOKENS = 272e3;
|
|
7
8
|
var OPENAI_MODELS = [
|
|
8
9
|
{
|
|
9
10
|
id: OPENAI_DEFAULT_MODEL,
|
|
@@ -14,6 +15,15 @@ var OPENAI_MODELS = [
|
|
|
14
15
|
id: "gpt-5.4",
|
|
15
16
|
provider: "openai",
|
|
16
17
|
contextWindow: 105e4,
|
|
18
|
+
maxInputTokens: GPT_5_4_CAPPED_INPUT_TOKENS,
|
|
19
|
+
maxOutputTokens: 128e3
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "gpt-5.4-1M",
|
|
23
|
+
provider: "openai",
|
|
24
|
+
providerModelId: "gpt-5.4",
|
|
25
|
+
aliases: ["gpt-5.4-1m", "gpt-5.4-full"],
|
|
26
|
+
contextWindow: 105e4,
|
|
17
27
|
maxInputTokens: 942e3,
|
|
18
28
|
maxOutputTokens: 128e3
|
|
19
29
|
},
|
|
@@ -292,6 +302,10 @@ function listModels(registry, provider) {
|
|
|
292
302
|
const all = Object.values(registry.modelsById);
|
|
293
303
|
return provider ? all.filter((model) => model.provider === provider) : all;
|
|
294
304
|
}
|
|
305
|
+
function resolveProviderModelId(registry, idOrAlias, provider) {
|
|
306
|
+
const spec = resolveModel(registry, idOrAlias, provider);
|
|
307
|
+
return spec ? spec.providerModelId ?? spec.id : void 0;
|
|
308
|
+
}
|
|
295
309
|
function cloneAliases(aliasesByProvider) {
|
|
296
310
|
return {
|
|
297
311
|
openai: { ...aliasesByProvider.openai },
|
|
@@ -850,7 +864,7 @@ var ToolOutputCacheService = class {
|
|
|
850
864
|
llm.provider,
|
|
851
865
|
llm.model
|
|
852
866
|
);
|
|
853
|
-
const contextLimit = modelSpec?.
|
|
867
|
+
const contextLimit = modelSpec?.maxInputTokens ?? modelSpec?.contextWindow ?? null;
|
|
854
868
|
if (!contextLimit || contextLimit <= 0) {
|
|
855
869
|
return MAX_CONTEXT_BUDGET;
|
|
856
870
|
}
|
|
@@ -2751,7 +2765,8 @@ function toResponsesToolChoice(choice) {
|
|
|
2751
2765
|
}
|
|
2752
2766
|
function toChatInvokeCompletion2(response, meta) {
|
|
2753
2767
|
const usage = response.usage ? {
|
|
2754
|
-
model: response.model,
|
|
2768
|
+
model: meta?.selected_model ?? response.model,
|
|
2769
|
+
provider_model: response.model,
|
|
2755
2770
|
input_tokens: response.usage.input_tokens,
|
|
2756
2771
|
input_cached_tokens: response.usage.input_tokens_details?.cached_tokens,
|
|
2757
2772
|
output_tokens: response.usage.output_tokens,
|
|
@@ -3613,6 +3628,7 @@ var WS_REUSE_MAX_IDLE_MS = 3e4;
|
|
|
3613
3628
|
var ChatOpenAI = class {
|
|
3614
3629
|
provider = PROVIDER_NAME2;
|
|
3615
3630
|
model;
|
|
3631
|
+
providerModel;
|
|
3616
3632
|
client;
|
|
3617
3633
|
defaultReasoningEffort;
|
|
3618
3634
|
reasoningLevelMeta;
|
|
@@ -3628,6 +3644,7 @@ var ChatOpenAI = class {
|
|
|
3628
3644
|
constructor(options = {}) {
|
|
3629
3645
|
this.client = options.client ?? new OpenAI(options.clientOptions);
|
|
3630
3646
|
this.model = options.model ?? DEFAULT_MODEL2;
|
|
3647
|
+
this.providerModel = options.providerModel ?? this.model;
|
|
3631
3648
|
this.defaultReasoningEffort = options.reasoningEffort ?? DEFAULT_REASONING_EFFORT;
|
|
3632
3649
|
this.reasoningLevelMeta = {
|
|
3633
3650
|
requested: options.reasoningLevelRequested,
|
|
@@ -3660,7 +3677,7 @@ var ChatOpenAI = class {
|
|
|
3660
3677
|
const tool_choice = toResponsesToolChoice(toolChoice);
|
|
3661
3678
|
const { reasoningEffort, textVerbosity, ...rest } = options ?? {};
|
|
3662
3679
|
const request = {
|
|
3663
|
-
model: model ?? this.
|
|
3680
|
+
model: model ?? this.providerModel,
|
|
3664
3681
|
input: inputItems,
|
|
3665
3682
|
...rest,
|
|
3666
3683
|
...tools ? { tools } : {},
|
|
@@ -3697,7 +3714,7 @@ var ChatOpenAI = class {
|
|
|
3697
3714
|
const sessionIdHeader = getSessionIdHeaderValue(request.prompt_cache_key);
|
|
3698
3715
|
const debugSeq = this.nextDebugInvokeSeq();
|
|
3699
3716
|
const requestMeta = {
|
|
3700
|
-
model: String(request.model ?? this.
|
|
3717
|
+
model: String(request.model ?? this.providerModel),
|
|
3701
3718
|
instructionsHash: createHash2("sha256").update(String(request.instructions ?? "")).digest("hex").slice(0, 12),
|
|
3702
3719
|
toolsHash: createHash2("sha256").update(safeJsonStringify(request.tools ?? [])).digest("hex").slice(0, 12)
|
|
3703
3720
|
};
|
|
@@ -3715,6 +3732,7 @@ var ChatOpenAI = class {
|
|
|
3715
3732
|
transportResult.transport
|
|
3716
3733
|
);
|
|
3717
3734
|
return toChatInvokeCompletion2(transportResult.response, {
|
|
3735
|
+
selected_model: model ?? this.model,
|
|
3718
3736
|
transport: transportResult.transport,
|
|
3719
3737
|
websocket_mode: this.websocketMode,
|
|
3720
3738
|
fallback_used: transportResult.fallbackUsed,
|
|
@@ -4915,6 +4933,7 @@ export {
|
|
|
4915
4933
|
listModels,
|
|
4916
4934
|
registerModels,
|
|
4917
4935
|
resolveModel,
|
|
4936
|
+
resolveProviderModelId,
|
|
4918
4937
|
stringifyContent,
|
|
4919
4938
|
stringifyContentParts
|
|
4920
4939
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.42",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
28
|
-
"@codelia/config": "0.1.
|
|
29
|
-
"@codelia/shared-types": "0.1.
|
|
28
|
+
"@codelia/config": "0.1.42",
|
|
29
|
+
"@codelia/shared-types": "0.1.42",
|
|
30
30
|
"@google-cloud/vertexai": "^1.10.0",
|
|
31
31
|
"@google/genai": "^1.43.0",
|
|
32
32
|
"json-schema": "^0.4.0",
|
package/prompts/system.md
CHANGED
|
@@ -66,7 +66,11 @@ Assume:
|
|
|
66
66
|
- Before changing code: inspect the current behavior (read files, search, reproduce when feasible).
|
|
67
67
|
- Before executing non-trivial work: think through a short plan and sequence risky steps first.
|
|
68
68
|
- If you changed executable code or behavior-affecting config, you MUST run at least one smallest relevant automated check before finishing (e.g., targeted test, typecheck, lint).
|
|
69
|
-
-
|
|
69
|
+
- Do not stop at the first unavailable check. If the task's success criterion can still be probed through other reasonable local checks, keep going and run them.
|
|
70
|
+
- Do not fake, bypass, or game verification; satisfy the real task requirements without verifier-specific hacks.
|
|
71
|
+
- If further verification depends on user-only confirmation, access the user has but you do not, or an inherently human judgment, say what remains unverified and ask how they want to proceed.
|
|
72
|
+
- If required checks truly cannot be run after reasonable attempts, you MUST explicitly mark the result as `UNVERIFIED`, give the reason, and provide the exact next command to run.
|
|
73
|
+
- Do not claim the task is complete when the required artifact/output/behavior has not been checked directly or with the closest feasible proxy.
|
|
70
74
|
- After changes: run focused verification that fits the repository/tooling (e.g. typecheck, lint, targeted tests).
|
|
71
75
|
- If asked to commit: only include intended files and use a descriptive commit message. Do not amend unless asked.
|
|
72
76
|
|