@codelia/core 0.1.65 → 0.1.67
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 +162 -43
- package/dist/index.d.cts +22 -3
- package/dist/index.d.ts +22 -3
- package/dist/index.js +159 -42
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -47,12 +47,14 @@ __export(index_exports, {
|
|
|
47
47
|
createModelRegistry: () => createModelRegistry,
|
|
48
48
|
defineTool: () => defineTool,
|
|
49
49
|
getDefaultSystemPromptPath: () => getDefaultSystemPromptPath,
|
|
50
|
+
isUsableModelSpec: () => isUsableModelSpec,
|
|
50
51
|
listModels: () => listModels,
|
|
51
52
|
registerModels: () => registerModels,
|
|
52
53
|
resolveModel: () => resolveModel,
|
|
53
54
|
resolveProviderModelId: () => resolveProviderModelId,
|
|
54
55
|
stringifyContent: () => stringifyContent,
|
|
55
|
-
stringifyContentParts: () => stringifyContentParts
|
|
56
|
+
stringifyContentParts: () => stringifyContentParts,
|
|
57
|
+
supportsFastMode: () => supportsFastMode
|
|
56
58
|
});
|
|
57
59
|
module.exports = __toCommonJS(index_exports);
|
|
58
60
|
|
|
@@ -60,7 +62,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
60
62
|
var import_config = require("@codelia/config");
|
|
61
63
|
|
|
62
64
|
// src/models/openai.ts
|
|
63
|
-
var OPENAI_DEFAULT_MODEL = "gpt-5.
|
|
65
|
+
var OPENAI_DEFAULT_MODEL = "gpt-5.5";
|
|
64
66
|
var OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
65
67
|
var GPT_5_4_CAPPED_INPUT_TOKENS = 272e3;
|
|
66
68
|
var OPENAI_MODELS = [
|
|
@@ -69,12 +71,34 @@ var OPENAI_MODELS = [
|
|
|
69
71
|
provider: "openai",
|
|
70
72
|
aliases: ["default"]
|
|
71
73
|
},
|
|
74
|
+
{
|
|
75
|
+
id: "gpt-5.5",
|
|
76
|
+
provider: "openai",
|
|
77
|
+
contextWindow: 105e4,
|
|
78
|
+
maxInputTokens: 27e4,
|
|
79
|
+
maxOutputTokens: 13e4,
|
|
80
|
+
supportsFast: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "gpt-5.5-1M",
|
|
84
|
+
provider: "openai",
|
|
85
|
+
providerModelId: "gpt-5.5",
|
|
86
|
+
aliases: ["gpt-5.5-1m", "gpt-5.5-full"],
|
|
87
|
+
contextWindow: 105e4,
|
|
88
|
+
maxInputTokens: 92e4,
|
|
89
|
+
maxOutputTokens: 13e4
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
id: "gpt-5.5-pro",
|
|
93
|
+
provider: "openai"
|
|
94
|
+
},
|
|
72
95
|
{
|
|
73
96
|
id: "gpt-5.4",
|
|
74
97
|
provider: "openai",
|
|
75
98
|
contextWindow: 105e4,
|
|
76
99
|
maxInputTokens: GPT_5_4_CAPPED_INPUT_TOKENS,
|
|
77
|
-
maxOutputTokens: 128e3
|
|
100
|
+
maxOutputTokens: 128e3,
|
|
101
|
+
supportsFast: true
|
|
78
102
|
},
|
|
79
103
|
{
|
|
80
104
|
id: "gpt-5.4-1M",
|
|
@@ -85,6 +109,50 @@ var OPENAI_MODELS = [
|
|
|
85
109
|
maxInputTokens: 942e3,
|
|
86
110
|
maxOutputTokens: 128e3
|
|
87
111
|
},
|
|
112
|
+
{
|
|
113
|
+
id: "gpt-5.4-pro",
|
|
114
|
+
provider: "openai",
|
|
115
|
+
contextWindow: 105e4,
|
|
116
|
+
maxInputTokens: 922e3,
|
|
117
|
+
maxOutputTokens: 128e3
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
id: "gpt-5.4-pro-2026-03-05",
|
|
121
|
+
provider: "openai",
|
|
122
|
+
contextWindow: 105e4,
|
|
123
|
+
maxInputTokens: 922e3,
|
|
124
|
+
maxOutputTokens: 128e3
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: "gpt-5.4-mini",
|
|
128
|
+
provider: "openai",
|
|
129
|
+
contextWindow: 4e5,
|
|
130
|
+
maxInputTokens: 272e3,
|
|
131
|
+
maxOutputTokens: 128e3,
|
|
132
|
+
supportsFast: true
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "gpt-5.4-mini-2026-03-17",
|
|
136
|
+
provider: "openai",
|
|
137
|
+
contextWindow: 4e5,
|
|
138
|
+
maxInputTokens: 272e3,
|
|
139
|
+
maxOutputTokens: 128e3,
|
|
140
|
+
supportsFast: true
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
id: "gpt-5.4-nano",
|
|
144
|
+
provider: "openai",
|
|
145
|
+
contextWindow: 4e5,
|
|
146
|
+
maxInputTokens: 272e3,
|
|
147
|
+
maxOutputTokens: 128e3
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
id: "gpt-5.4-nano-2026-03-17",
|
|
151
|
+
provider: "openai",
|
|
152
|
+
contextWindow: 4e5,
|
|
153
|
+
maxInputTokens: 272e3,
|
|
154
|
+
maxOutputTokens: 128e3
|
|
155
|
+
},
|
|
88
156
|
{
|
|
89
157
|
id: "gpt-5.3-codex",
|
|
90
158
|
provider: "openai"
|
|
@@ -96,11 +164,13 @@ var OPENAI_MODELS = [
|
|
|
96
164
|
},
|
|
97
165
|
{
|
|
98
166
|
id: "gpt-5.2-2025-12-11",
|
|
99
|
-
provider: "openai"
|
|
167
|
+
provider: "openai",
|
|
168
|
+
supportsFast: true
|
|
100
169
|
},
|
|
101
170
|
{
|
|
102
171
|
id: "gpt-5.2",
|
|
103
|
-
provider: "openai"
|
|
172
|
+
provider: "openai",
|
|
173
|
+
supportsFast: true
|
|
104
174
|
},
|
|
105
175
|
{
|
|
106
176
|
id: "gpt-5.2-pro",
|
|
@@ -112,23 +182,28 @@ var OPENAI_MODELS = [
|
|
|
112
182
|
},
|
|
113
183
|
{
|
|
114
184
|
id: "gpt-5.1",
|
|
115
|
-
provider: "openai"
|
|
185
|
+
provider: "openai",
|
|
186
|
+
supportsFast: true
|
|
116
187
|
},
|
|
117
188
|
{
|
|
118
189
|
id: "gpt-5.1-2025-11-13",
|
|
119
|
-
provider: "openai"
|
|
190
|
+
provider: "openai",
|
|
191
|
+
supportsFast: true
|
|
120
192
|
},
|
|
121
193
|
{
|
|
122
194
|
id: "gpt-5",
|
|
123
|
-
provider: "openai"
|
|
195
|
+
provider: "openai",
|
|
196
|
+
supportsFast: true
|
|
124
197
|
},
|
|
125
198
|
{
|
|
126
199
|
id: "gpt-5-mini",
|
|
127
|
-
provider: "openai"
|
|
200
|
+
provider: "openai",
|
|
201
|
+
supportsFast: true
|
|
128
202
|
},
|
|
129
203
|
{
|
|
130
204
|
id: "gpt-5-mini-2025-08-07",
|
|
131
|
-
provider: "openai"
|
|
205
|
+
provider: "openai",
|
|
206
|
+
supportsFast: true
|
|
132
207
|
},
|
|
133
208
|
{
|
|
134
209
|
id: "gpt-5-nano",
|
|
@@ -140,7 +215,8 @@ var OPENAI_MODELS = [
|
|
|
140
215
|
},
|
|
141
216
|
{
|
|
142
217
|
id: "gpt-5.1-codex",
|
|
143
|
-
provider: "openai"
|
|
218
|
+
provider: "openai",
|
|
219
|
+
supportsFast: true
|
|
144
220
|
},
|
|
145
221
|
{
|
|
146
222
|
id: "gpt-5.1-codex-max",
|
|
@@ -152,7 +228,8 @@ var OPENAI_MODELS = [
|
|
|
152
228
|
},
|
|
153
229
|
{
|
|
154
230
|
id: "gpt-5-codex",
|
|
155
|
-
provider: "openai"
|
|
231
|
+
provider: "openai",
|
|
232
|
+
supportsFast: true
|
|
156
233
|
},
|
|
157
234
|
{
|
|
158
235
|
id: "gpt-5-codex-mini",
|
|
@@ -268,9 +345,18 @@ var ANTHROPIC_MODELS = [
|
|
|
268
345
|
provider: "anthropic",
|
|
269
346
|
aliases: ["default"]
|
|
270
347
|
},
|
|
348
|
+
{
|
|
349
|
+
id: "claude-opus-4-7",
|
|
350
|
+
provider: "anthropic",
|
|
351
|
+
contextWindow: 1e6,
|
|
352
|
+
maxInputTokens: 1e6,
|
|
353
|
+
maxOutputTokens: 128e3,
|
|
354
|
+
supportsFast: true
|
|
355
|
+
},
|
|
271
356
|
{
|
|
272
357
|
id: "claude-opus-4-6",
|
|
273
|
-
provider: "anthropic"
|
|
358
|
+
provider: "anthropic",
|
|
359
|
+
supportsFast: true
|
|
274
360
|
},
|
|
275
361
|
{
|
|
276
362
|
id: "claude-opus-4-5",
|
|
@@ -365,10 +451,18 @@ function listModels(registry, provider) {
|
|
|
365
451
|
const all = Object.values(registry.modelsById);
|
|
366
452
|
return provider ? all.filter((model) => model.provider === provider) : all;
|
|
367
453
|
}
|
|
454
|
+
var isPositiveFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
455
|
+
function isUsableModelSpec(spec) {
|
|
456
|
+
return isPositiveFiniteNumber(spec?.maxInputTokens) || isPositiveFiniteNumber(spec?.contextWindow);
|
|
457
|
+
}
|
|
368
458
|
function resolveProviderModelId(registry, idOrAlias, provider) {
|
|
369
459
|
const spec = resolveModel(registry, idOrAlias, provider);
|
|
370
460
|
return spec ? spec.providerModelId ?? spec.id : void 0;
|
|
371
461
|
}
|
|
462
|
+
function supportsFastMode(registry, idOrAlias, provider) {
|
|
463
|
+
const spec = resolveModel(registry, idOrAlias, provider);
|
|
464
|
+
return spec?.supportsFast === true;
|
|
465
|
+
}
|
|
372
466
|
function cloneAliases(aliasesByProvider) {
|
|
373
467
|
return {
|
|
374
468
|
openai: { ...aliasesByProvider.openai },
|
|
@@ -391,13 +485,12 @@ function applyModelMetadata(registry, index) {
|
|
|
391
485
|
const fullId = `${provider}/${modelId}`;
|
|
392
486
|
const spec = resolveModel(next, fullId, provider) ?? resolveModel(next, modelId, provider);
|
|
393
487
|
if (!spec) continue;
|
|
394
|
-
const limits = entry.limits;
|
|
395
|
-
if (!limits) continue;
|
|
396
488
|
next.modelsById[spec.id] = {
|
|
397
489
|
...spec,
|
|
398
|
-
contextWindow: spec.contextWindow ?? limits
|
|
399
|
-
maxInputTokens: spec.maxInputTokens ?? limits
|
|
400
|
-
maxOutputTokens: spec.maxOutputTokens ?? limits
|
|
490
|
+
contextWindow: spec.contextWindow ?? entry.limits?.contextWindow,
|
|
491
|
+
maxInputTokens: spec.maxInputTokens ?? entry.limits?.inputTokens,
|
|
492
|
+
maxOutputTokens: spec.maxOutputTokens ?? entry.limits?.outputTokens,
|
|
493
|
+
supportsFast: spec.supportsFast ?? entry.capabilities?.supportsFast
|
|
401
494
|
};
|
|
402
495
|
}
|
|
403
496
|
}
|
|
@@ -1391,14 +1484,16 @@ var Agent = class {
|
|
|
1391
1484
|
}
|
|
1392
1485
|
this.history.enqueueUserMessage(message);
|
|
1393
1486
|
let iterations = 0;
|
|
1487
|
+
const runTools = [...this.tools, ...options.tools ?? []];
|
|
1488
|
+
const runToolChoice = options.toolChoice ?? this.toolChoice;
|
|
1394
1489
|
while (iterations < this.maxIterations) {
|
|
1395
1490
|
iterations++;
|
|
1396
1491
|
throwIfAborted(signal);
|
|
1397
1492
|
await this.trimToolOutputs();
|
|
1398
1493
|
throwIfAborted(signal);
|
|
1399
1494
|
const invokeInput = this.history.prepareInvokeInput({
|
|
1400
|
-
tools: [...
|
|
1401
|
-
toolChoice:
|
|
1495
|
+
tools: [...runTools.map((t) => t.definition), ...this.hostedTools],
|
|
1496
|
+
toolChoice: runToolChoice
|
|
1402
1497
|
});
|
|
1403
1498
|
const invokeContext = this.buildInvokeContext(session);
|
|
1404
1499
|
const seq = this.recordLlmRequest(session, invokeInput, invokeContext);
|
|
@@ -1514,7 +1609,11 @@ var Agent = class {
|
|
|
1514
1609
|
const startTime = Date.now();
|
|
1515
1610
|
try {
|
|
1516
1611
|
throwIfAborted(signal);
|
|
1517
|
-
const execution = await this.executeToolCall(
|
|
1612
|
+
const execution = await this.executeToolCall(
|
|
1613
|
+
toolCall,
|
|
1614
|
+
runTools,
|
|
1615
|
+
signal
|
|
1616
|
+
);
|
|
1518
1617
|
const rawOutput = stringifyContent(execution.message.content, {
|
|
1519
1618
|
mode: "display"
|
|
1520
1619
|
});
|
|
@@ -1655,9 +1754,9 @@ ${assistantTexts.join("\n").trim()}`;
|
|
|
1655
1754
|
return "[Max Iterations Reached]\n\nSummary unavailable due to an internal error.";
|
|
1656
1755
|
}
|
|
1657
1756
|
}
|
|
1658
|
-
async executeToolCall(toolCall, signal) {
|
|
1757
|
+
async executeToolCall(toolCall, tools, signal) {
|
|
1659
1758
|
const toolName = toolCall.function.name;
|
|
1660
|
-
const tool =
|
|
1759
|
+
const tool = tools.find((t) => t.name === toolName);
|
|
1661
1760
|
if (!tool) {
|
|
1662
1761
|
return {
|
|
1663
1762
|
message: {
|
|
@@ -2292,12 +2391,14 @@ var DEFAULT_CLIENT_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
|
2292
2391
|
var DEFAULT_PROMPT_CACHE_CONTROL = {
|
|
2293
2392
|
type: "ephemeral"
|
|
2294
2393
|
};
|
|
2394
|
+
var FAST_MODE_BETA = "fast-mode-2026-02-01";
|
|
2295
2395
|
var ChatAnthropic = class {
|
|
2296
2396
|
provider = PROVIDER_NAME;
|
|
2297
2397
|
model;
|
|
2298
2398
|
client;
|
|
2299
2399
|
defaultMaxTokens;
|
|
2300
2400
|
defaultInvokeOptions;
|
|
2401
|
+
fastMode;
|
|
2301
2402
|
reasoningLevelMeta;
|
|
2302
2403
|
debugInvokeSeq = 0;
|
|
2303
2404
|
lastDebugRequestPayload = null;
|
|
@@ -2309,6 +2410,7 @@ var ChatAnthropic = class {
|
|
|
2309
2410
|
this.model = options.model ?? DEFAULT_MODEL;
|
|
2310
2411
|
this.defaultMaxTokens = options.maxTokens ?? DEFAULT_MAX_TOKENS;
|
|
2311
2412
|
this.defaultInvokeOptions = { ...options.invokeOptions ?? {} };
|
|
2413
|
+
this.fastMode = options.fastMode === true;
|
|
2312
2414
|
this.reasoningLevelMeta = {
|
|
2313
2415
|
requested: options.reasoningLevelRequested,
|
|
2314
2416
|
applied: options.reasoningLevelApplied,
|
|
@@ -2346,14 +2448,17 @@ var ChatAnthropic = class {
|
|
|
2346
2448
|
if (request.cache_control === void 0) {
|
|
2347
2449
|
request.cache_control = DEFAULT_PROMPT_CACHE_CONTROL;
|
|
2348
2450
|
}
|
|
2451
|
+
if (this.fastMode) {
|
|
2452
|
+
request.speed = "fast";
|
|
2453
|
+
request.betas = [...request.betas ?? [], FAST_MODE_BETA];
|
|
2454
|
+
}
|
|
2349
2455
|
const debugSeq = this.nextDebugInvokeSeq();
|
|
2350
2456
|
await this.debugRequestIfEnabled(request, debugSeq);
|
|
2351
|
-
const
|
|
2457
|
+
const requestOptions = signal ? { signal } : void 0;
|
|
2458
|
+
const response = this.fastMode ? await this.client.beta.messages.create(
|
|
2352
2459
|
request,
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
} : void 0
|
|
2356
|
-
);
|
|
2460
|
+
requestOptions
|
|
2461
|
+
) : await this.client.messages.create(request, requestOptions);
|
|
2357
2462
|
await this.debugResponseIfEnabled(response, debugSeq);
|
|
2358
2463
|
return toChatInvokeCompletion(response, {
|
|
2359
2464
|
reasoning_requested: this.reasoningLevelMeta.requested,
|
|
@@ -2671,7 +2776,11 @@ var OpenAiResponseAccumulator = class {
|
|
|
2671
2776
|
break;
|
|
2672
2777
|
}
|
|
2673
2778
|
case "response.content_part.added": {
|
|
2674
|
-
this.addContentPart(
|
|
2779
|
+
this.addContentPart(
|
|
2780
|
+
event.output_index,
|
|
2781
|
+
event.content_index,
|
|
2782
|
+
event.part
|
|
2783
|
+
);
|
|
2675
2784
|
break;
|
|
2676
2785
|
}
|
|
2677
2786
|
case "response.output_text.delta": {
|
|
@@ -2683,7 +2792,11 @@ var OpenAiResponseAccumulator = class {
|
|
|
2683
2792
|
break;
|
|
2684
2793
|
}
|
|
2685
2794
|
case "response.output_text.done": {
|
|
2686
|
-
this.setMessageText(
|
|
2795
|
+
this.setMessageText(
|
|
2796
|
+
event.output_index,
|
|
2797
|
+
event.content_index,
|
|
2798
|
+
event.text
|
|
2799
|
+
);
|
|
2687
2800
|
break;
|
|
2688
2801
|
}
|
|
2689
2802
|
case "response.refusal.delta": {
|
|
@@ -2822,13 +2935,17 @@ var OpenAiResponseAccumulator = class {
|
|
|
2822
2935
|
}
|
|
2823
2936
|
if (output.type === "message" && part.type !== "reasoning_text") {
|
|
2824
2937
|
ensureArrayIndex(output.content, contentIndex);
|
|
2825
|
-
output.content[contentIndex] = cloneValue(
|
|
2938
|
+
output.content[contentIndex] = cloneValue(
|
|
2939
|
+
part
|
|
2940
|
+
);
|
|
2826
2941
|
return;
|
|
2827
2942
|
}
|
|
2828
2943
|
if (output.type === "reasoning" && part.type === "reasoning_text") {
|
|
2829
2944
|
const content = output.content ?? [];
|
|
2830
2945
|
ensureArrayIndex(content, contentIndex);
|
|
2831
|
-
content[contentIndex] = cloneValue(
|
|
2946
|
+
content[contentIndex] = cloneValue(
|
|
2947
|
+
part
|
|
2948
|
+
);
|
|
2832
2949
|
output.content = content;
|
|
2833
2950
|
}
|
|
2834
2951
|
}
|
|
@@ -2991,9 +3108,7 @@ var OpenAiResponseAccumulator = class {
|
|
|
2991
3108
|
}
|
|
2992
3109
|
loggedUnhandledResponseEventTypes.add(event.type);
|
|
2993
3110
|
const payload = getResponseStreamEventDebugPayload(event);
|
|
2994
|
-
console.error(
|
|
2995
|
-
`[openai.stream.unhandled] ${safeJsonStringify(payload)}`
|
|
2996
|
-
);
|
|
3111
|
+
console.error(`[openai.stream.unhandled] ${safeJsonStringify(payload)}`);
|
|
2997
3112
|
}
|
|
2998
3113
|
};
|
|
2999
3114
|
|
|
@@ -3608,9 +3723,7 @@ var OpenAiWsTransport = class {
|
|
|
3608
3723
|
if (settled || !terminalCompletedWithoutUsage) {
|
|
3609
3724
|
return;
|
|
3610
3725
|
}
|
|
3611
|
-
resolveOnce(
|
|
3612
|
-
accumulator.buildResponse(terminalCompletedWithoutUsage)
|
|
3613
|
-
);
|
|
3726
|
+
resolveOnce(accumulator.buildResponse(terminalCompletedWithoutUsage));
|
|
3614
3727
|
}, WS_TERMINAL_DONE_GRACE_MS);
|
|
3615
3728
|
};
|
|
3616
3729
|
const resetResponseTimeout = () => {
|
|
@@ -3650,9 +3763,7 @@ var OpenAiWsTransport = class {
|
|
|
3650
3763
|
}
|
|
3651
3764
|
if (type === "response.done" && terminalCompletedWithoutUsage) {
|
|
3652
3765
|
clearDoneGraceTimer();
|
|
3653
|
-
resolveOnce(
|
|
3654
|
-
accumulator.buildResponse(terminalCompletedWithoutUsage)
|
|
3655
|
-
);
|
|
3766
|
+
resolveOnce(accumulator.buildResponse(terminalCompletedWithoutUsage));
|
|
3656
3767
|
return;
|
|
3657
3768
|
}
|
|
3658
3769
|
rejectOnce(
|
|
@@ -4188,6 +4299,7 @@ var ChatOpenAI = class {
|
|
|
4188
4299
|
defaultReasoningEffort;
|
|
4189
4300
|
reasoningLevelMeta;
|
|
4190
4301
|
defaultTextVerbosity;
|
|
4302
|
+
defaultServiceTier;
|
|
4191
4303
|
websocketMode;
|
|
4192
4304
|
websocketApiVersion;
|
|
4193
4305
|
wsTransport;
|
|
@@ -4207,6 +4319,7 @@ var ChatOpenAI = class {
|
|
|
4207
4319
|
fallbackApplied: options.reasoningFallbackApplied
|
|
4208
4320
|
};
|
|
4209
4321
|
this.defaultTextVerbosity = options.textVerbosity;
|
|
4322
|
+
this.defaultServiceTier = options.serviceTier;
|
|
4210
4323
|
this.websocketMode = options.websocketMode ?? "off";
|
|
4211
4324
|
this.websocketApiVersion = options.websocketApiVersion ?? "v2";
|
|
4212
4325
|
this.wsTransport = new OpenAiWsTransport({
|
|
@@ -4230,7 +4343,7 @@ var ChatOpenAI = class {
|
|
|
4230
4343
|
const instructions = extractInstructions(messages);
|
|
4231
4344
|
const tools = toResponsesTools(toolDefs);
|
|
4232
4345
|
const tool_choice = toResponsesToolChoice(toolChoice);
|
|
4233
|
-
const { reasoningEffort, textVerbosity, ...rest } = options ?? {};
|
|
4346
|
+
const { reasoningEffort, textVerbosity, serviceTier, ...rest } = options ?? {};
|
|
4234
4347
|
const request = {
|
|
4235
4348
|
model: model ?? this.providerModel,
|
|
4236
4349
|
input: inputItems,
|
|
@@ -4262,6 +4375,10 @@ var ChatOpenAI = class {
|
|
|
4262
4375
|
verbosity
|
|
4263
4376
|
};
|
|
4264
4377
|
}
|
|
4378
|
+
const resolvedServiceTier = serviceTier ?? this.defaultServiceTier;
|
|
4379
|
+
if (resolvedServiceTier) {
|
|
4380
|
+
request.service_tier = resolvedServiceTier;
|
|
4381
|
+
}
|
|
4265
4382
|
if (context?.sessionKey && !request.prompt_cache_key) {
|
|
4266
4383
|
request.prompt_cache_key = context.sessionKey;
|
|
4267
4384
|
}
|
|
@@ -5520,10 +5637,12 @@ function defineTool(toolOptions) {
|
|
|
5520
5637
|
createModelRegistry,
|
|
5521
5638
|
defineTool,
|
|
5522
5639
|
getDefaultSystemPromptPath,
|
|
5640
|
+
isUsableModelSpec,
|
|
5523
5641
|
listModels,
|
|
5524
5642
|
registerModels,
|
|
5525
5643
|
resolveModel,
|
|
5526
5644
|
resolveProviderModelId,
|
|
5527
5645
|
stringifyContent,
|
|
5528
|
-
stringifyContentParts
|
|
5646
|
+
stringifyContentParts,
|
|
5647
|
+
supportsFastMode
|
|
5529
5648
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -197,6 +197,9 @@ type ModelLimits = {
|
|
|
197
197
|
inputTokens?: number;
|
|
198
198
|
outputTokens?: number;
|
|
199
199
|
};
|
|
200
|
+
type ModelCapabilities = {
|
|
201
|
+
supportsFast?: boolean;
|
|
202
|
+
};
|
|
200
203
|
type ModelEntry = {
|
|
201
204
|
provider: string;
|
|
202
205
|
modelId: string;
|
|
@@ -204,6 +207,7 @@ type ModelEntry = {
|
|
|
204
207
|
lastUpdated?: string;
|
|
205
208
|
cost?: ModelCost;
|
|
206
209
|
limits?: ModelLimits;
|
|
210
|
+
capabilities?: ModelCapabilities;
|
|
207
211
|
};
|
|
208
212
|
type ModelMetadataIndex = {
|
|
209
213
|
models: Record<string, Record<string, ModelEntry>>;
|
|
@@ -250,6 +254,7 @@ type ModelSpec = {
|
|
|
250
254
|
supportsTools?: boolean;
|
|
251
255
|
supportsVision?: boolean;
|
|
252
256
|
supportsReasoning?: boolean;
|
|
257
|
+
supportsFast?: boolean;
|
|
253
258
|
supportsJsonSchema?: boolean;
|
|
254
259
|
};
|
|
255
260
|
type ModelRegistry = {
|
|
@@ -260,7 +265,9 @@ declare function createModelRegistry(specs: ModelSpec[]): ModelRegistry;
|
|
|
260
265
|
declare function registerModels(registry: ModelRegistry, specs: ModelSpec[]): void;
|
|
261
266
|
declare function resolveModel(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): ModelSpec | undefined;
|
|
262
267
|
declare function listModels(registry: ModelRegistry, provider?: ProviderName): ModelSpec[];
|
|
268
|
+
declare function isUsableModelSpec(spec: ModelSpec | undefined): boolean;
|
|
263
269
|
declare function resolveProviderModelId(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): string | undefined;
|
|
270
|
+
declare function supportsFastMode(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): boolean;
|
|
264
271
|
declare function applyModelMetadata(registry: ModelRegistry, index: ModelMetadataIndex): ModelRegistry;
|
|
265
272
|
|
|
266
273
|
type CompactionConfig = {
|
|
@@ -376,6 +383,7 @@ type SessionHeader = {
|
|
|
376
383
|
provider?: string;
|
|
377
384
|
name?: string;
|
|
378
385
|
reasoning?: string;
|
|
386
|
+
fast?: boolean;
|
|
379
387
|
};
|
|
380
388
|
prompts?: {
|
|
381
389
|
system?: string;
|
|
@@ -452,6 +460,7 @@ type LlmRequestRecord = {
|
|
|
452
460
|
provider?: string;
|
|
453
461
|
name?: string;
|
|
454
462
|
reasoning?: string;
|
|
463
|
+
fast?: boolean;
|
|
455
464
|
};
|
|
456
465
|
input: {
|
|
457
466
|
messages: BaseMessage[];
|
|
@@ -540,6 +549,8 @@ type AgentRunOptions = {
|
|
|
540
549
|
session?: AgentSession;
|
|
541
550
|
signal?: AbortSignal;
|
|
542
551
|
forceCompaction?: boolean;
|
|
552
|
+
tools?: Tool[];
|
|
553
|
+
toolChoice?: ToolChoice;
|
|
543
554
|
};
|
|
544
555
|
type AgentOptions = {
|
|
545
556
|
llm: BaseChatModel;
|
|
@@ -625,7 +636,10 @@ interface StoragePathService {
|
|
|
625
636
|
}
|
|
626
637
|
|
|
627
638
|
declare const PROVIDER_NAME$2: "anthropic";
|
|
628
|
-
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming
|
|
639
|
+
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
|
|
640
|
+
speed?: "standard" | "fast" | null;
|
|
641
|
+
betas?: string[];
|
|
642
|
+
};
|
|
629
643
|
type AnthropicInvokeOptions = Partial<Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream">>;
|
|
630
644
|
type ChatAnthropicOptions = {
|
|
631
645
|
client?: Anthropic;
|
|
@@ -633,6 +647,7 @@ type ChatAnthropicOptions = {
|
|
|
633
647
|
model?: string;
|
|
634
648
|
maxTokens?: number;
|
|
635
649
|
invokeOptions?: AnthropicInvokeOptions;
|
|
650
|
+
fastMode?: boolean;
|
|
636
651
|
reasoningLevelRequested?: "low" | "medium" | "high" | "xhigh";
|
|
637
652
|
reasoningLevelApplied?: "low" | "medium" | "high" | "xhigh";
|
|
638
653
|
reasoningFallbackApplied?: boolean;
|
|
@@ -644,6 +659,7 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, Ant
|
|
|
644
659
|
private readonly client;
|
|
645
660
|
private readonly defaultMaxTokens;
|
|
646
661
|
private readonly defaultInvokeOptions;
|
|
662
|
+
private readonly fastMode;
|
|
647
663
|
private readonly reasoningLevelMeta;
|
|
648
664
|
private debugInvokeSeq;
|
|
649
665
|
private lastDebugRequestPayload;
|
|
@@ -673,6 +689,7 @@ type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
|
673
689
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
674
690
|
reasoningEffort?: ReasoningEffort;
|
|
675
691
|
textVerbosity?: OpenAITextVerbosity;
|
|
692
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
676
693
|
};
|
|
677
694
|
type OpenAIReasoningLevel = "low" | "medium" | "high" | "xhigh";
|
|
678
695
|
|
|
@@ -686,6 +703,7 @@ type ChatOpenAIOptions = {
|
|
|
686
703
|
reasoningLevelApplied?: OpenAIReasoningLevel;
|
|
687
704
|
reasoningFallbackApplied?: boolean;
|
|
688
705
|
textVerbosity?: OpenAITextVerbosity;
|
|
706
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
689
707
|
websocketMode?: OpenAiWebsocketMode;
|
|
690
708
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
691
709
|
createResponsesWs?: (client: OpenAI, options?: ConstructorParameters<typeof ResponsesWS>[1]) => OpenAiResponsesWsLike;
|
|
@@ -700,6 +718,7 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
700
718
|
private readonly defaultReasoningEffort?;
|
|
701
719
|
private readonly reasoningLevelMeta;
|
|
702
720
|
private readonly defaultTextVerbosity?;
|
|
721
|
+
private readonly defaultServiceTier?;
|
|
703
722
|
private readonly websocketMode;
|
|
704
723
|
private readonly websocketApiVersion;
|
|
705
724
|
private readonly wsTransport;
|
|
@@ -775,7 +794,7 @@ declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
|
775
794
|
|
|
776
795
|
declare const GOOGLE_MODELS: ModelSpec[];
|
|
777
796
|
|
|
778
|
-
declare const OPENAI_DEFAULT_MODEL = "gpt-5.
|
|
797
|
+
declare const OPENAI_DEFAULT_MODEL = "gpt-5.5";
|
|
779
798
|
declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
780
799
|
declare const OPENAI_MODELS: ModelSpec[];
|
|
781
800
|
|
|
@@ -790,4 +809,4 @@ declare class TaskComplete extends Error {
|
|
|
790
809
|
constructor(finalMessage?: string);
|
|
791
810
|
}
|
|
792
811
|
|
|
793
|
-
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 };
|
|
812
|
+
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -197,6 +197,9 @@ type ModelLimits = {
|
|
|
197
197
|
inputTokens?: number;
|
|
198
198
|
outputTokens?: number;
|
|
199
199
|
};
|
|
200
|
+
type ModelCapabilities = {
|
|
201
|
+
supportsFast?: boolean;
|
|
202
|
+
};
|
|
200
203
|
type ModelEntry = {
|
|
201
204
|
provider: string;
|
|
202
205
|
modelId: string;
|
|
@@ -204,6 +207,7 @@ type ModelEntry = {
|
|
|
204
207
|
lastUpdated?: string;
|
|
205
208
|
cost?: ModelCost;
|
|
206
209
|
limits?: ModelLimits;
|
|
210
|
+
capabilities?: ModelCapabilities;
|
|
207
211
|
};
|
|
208
212
|
type ModelMetadataIndex = {
|
|
209
213
|
models: Record<string, Record<string, ModelEntry>>;
|
|
@@ -250,6 +254,7 @@ type ModelSpec = {
|
|
|
250
254
|
supportsTools?: boolean;
|
|
251
255
|
supportsVision?: boolean;
|
|
252
256
|
supportsReasoning?: boolean;
|
|
257
|
+
supportsFast?: boolean;
|
|
253
258
|
supportsJsonSchema?: boolean;
|
|
254
259
|
};
|
|
255
260
|
type ModelRegistry = {
|
|
@@ -260,7 +265,9 @@ declare function createModelRegistry(specs: ModelSpec[]): ModelRegistry;
|
|
|
260
265
|
declare function registerModels(registry: ModelRegistry, specs: ModelSpec[]): void;
|
|
261
266
|
declare function resolveModel(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): ModelSpec | undefined;
|
|
262
267
|
declare function listModels(registry: ModelRegistry, provider?: ProviderName): ModelSpec[];
|
|
268
|
+
declare function isUsableModelSpec(spec: ModelSpec | undefined): boolean;
|
|
263
269
|
declare function resolveProviderModelId(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): string | undefined;
|
|
270
|
+
declare function supportsFastMode(registry: ModelRegistry, idOrAlias: string, provider?: ProviderName): boolean;
|
|
264
271
|
declare function applyModelMetadata(registry: ModelRegistry, index: ModelMetadataIndex): ModelRegistry;
|
|
265
272
|
|
|
266
273
|
type CompactionConfig = {
|
|
@@ -376,6 +383,7 @@ type SessionHeader = {
|
|
|
376
383
|
provider?: string;
|
|
377
384
|
name?: string;
|
|
378
385
|
reasoning?: string;
|
|
386
|
+
fast?: boolean;
|
|
379
387
|
};
|
|
380
388
|
prompts?: {
|
|
381
389
|
system?: string;
|
|
@@ -452,6 +460,7 @@ type LlmRequestRecord = {
|
|
|
452
460
|
provider?: string;
|
|
453
461
|
name?: string;
|
|
454
462
|
reasoning?: string;
|
|
463
|
+
fast?: boolean;
|
|
455
464
|
};
|
|
456
465
|
input: {
|
|
457
466
|
messages: BaseMessage[];
|
|
@@ -540,6 +549,8 @@ type AgentRunOptions = {
|
|
|
540
549
|
session?: AgentSession;
|
|
541
550
|
signal?: AbortSignal;
|
|
542
551
|
forceCompaction?: boolean;
|
|
552
|
+
tools?: Tool[];
|
|
553
|
+
toolChoice?: ToolChoice;
|
|
543
554
|
};
|
|
544
555
|
type AgentOptions = {
|
|
545
556
|
llm: BaseChatModel;
|
|
@@ -625,7 +636,10 @@ interface StoragePathService {
|
|
|
625
636
|
}
|
|
626
637
|
|
|
627
638
|
declare const PROVIDER_NAME$2: "anthropic";
|
|
628
|
-
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming
|
|
639
|
+
type AnthropicMessageCreateParams = MessageCreateParamsNonStreaming & {
|
|
640
|
+
speed?: "standard" | "fast" | null;
|
|
641
|
+
betas?: string[];
|
|
642
|
+
};
|
|
629
643
|
type AnthropicInvokeOptions = Partial<Omit<AnthropicMessageCreateParams, "model" | "messages" | "tools" | "tool_choice" | "system" | "stream">>;
|
|
630
644
|
type ChatAnthropicOptions = {
|
|
631
645
|
client?: Anthropic;
|
|
@@ -633,6 +647,7 @@ type ChatAnthropicOptions = {
|
|
|
633
647
|
model?: string;
|
|
634
648
|
maxTokens?: number;
|
|
635
649
|
invokeOptions?: AnthropicInvokeOptions;
|
|
650
|
+
fastMode?: boolean;
|
|
636
651
|
reasoningLevelRequested?: "low" | "medium" | "high" | "xhigh";
|
|
637
652
|
reasoningLevelApplied?: "low" | "medium" | "high" | "xhigh";
|
|
638
653
|
reasoningFallbackApplied?: boolean;
|
|
@@ -644,6 +659,7 @@ declare class ChatAnthropic implements BaseChatModel<typeof PROVIDER_NAME$2, Ant
|
|
|
644
659
|
private readonly client;
|
|
645
660
|
private readonly defaultMaxTokens;
|
|
646
661
|
private readonly defaultInvokeOptions;
|
|
662
|
+
private readonly fastMode;
|
|
647
663
|
private readonly reasoningLevelMeta;
|
|
648
664
|
private debugInvokeSeq;
|
|
649
665
|
private lastDebugRequestPayload;
|
|
@@ -673,6 +689,7 @@ type OpenAITextVerbosity = Exclude<ResponseTextConfig["verbosity"], null>;
|
|
|
673
689
|
type OpenAIInvokeOptions = Omit<ResponseCreateParamsBase, "model" | "input" | "tools" | "tool_choice" | "stream"> & {
|
|
674
690
|
reasoningEffort?: ReasoningEffort;
|
|
675
691
|
textVerbosity?: OpenAITextVerbosity;
|
|
692
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
676
693
|
};
|
|
677
694
|
type OpenAIReasoningLevel = "low" | "medium" | "high" | "xhigh";
|
|
678
695
|
|
|
@@ -686,6 +703,7 @@ type ChatOpenAIOptions = {
|
|
|
686
703
|
reasoningLevelApplied?: OpenAIReasoningLevel;
|
|
687
704
|
reasoningFallbackApplied?: boolean;
|
|
688
705
|
textVerbosity?: OpenAITextVerbosity;
|
|
706
|
+
serviceTier?: ResponseCreateParamsBase["service_tier"];
|
|
689
707
|
websocketMode?: OpenAiWebsocketMode;
|
|
690
708
|
websocketApiVersion?: OpenAiWebsocketApiVersion;
|
|
691
709
|
createResponsesWs?: (client: OpenAI, options?: ConstructorParameters<typeof ResponsesWS>[1]) => OpenAiResponsesWsLike;
|
|
@@ -700,6 +718,7 @@ declare class ChatOpenAI implements BaseChatModel<typeof PROVIDER_NAME$1, OpenAI
|
|
|
700
718
|
private readonly defaultReasoningEffort?;
|
|
701
719
|
private readonly reasoningLevelMeta;
|
|
702
720
|
private readonly defaultTextVerbosity?;
|
|
721
|
+
private readonly defaultServiceTier?;
|
|
703
722
|
private readonly websocketMode;
|
|
704
723
|
private readonly websocketApiVersion;
|
|
705
724
|
private readonly wsTransport;
|
|
@@ -775,7 +794,7 @@ declare const ANTHROPIC_MODELS: ModelSpec[];
|
|
|
775
794
|
|
|
776
795
|
declare const GOOGLE_MODELS: ModelSpec[];
|
|
777
796
|
|
|
778
|
-
declare const OPENAI_DEFAULT_MODEL = "gpt-5.
|
|
797
|
+
declare const OPENAI_DEFAULT_MODEL = "gpt-5.5";
|
|
779
798
|
declare const OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
780
799
|
declare const OPENAI_MODELS: ModelSpec[];
|
|
781
800
|
|
|
@@ -790,4 +809,4 @@ declare class TaskComplete extends Error {
|
|
|
790
809
|
constructor(finalMessage?: string);
|
|
791
810
|
}
|
|
792
811
|
|
|
793
|
-
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 };
|
|
812
|
+
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 };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { configRegistry } from "@codelia/config";
|
|
3
3
|
|
|
4
4
|
// src/models/openai.ts
|
|
5
|
-
var OPENAI_DEFAULT_MODEL = "gpt-5.
|
|
5
|
+
var OPENAI_DEFAULT_MODEL = "gpt-5.5";
|
|
6
6
|
var OPENAI_DEFAULT_REASONING_EFFORT = "medium";
|
|
7
7
|
var GPT_5_4_CAPPED_INPUT_TOKENS = 272e3;
|
|
8
8
|
var OPENAI_MODELS = [
|
|
@@ -11,12 +11,34 @@ var OPENAI_MODELS = [
|
|
|
11
11
|
provider: "openai",
|
|
12
12
|
aliases: ["default"]
|
|
13
13
|
},
|
|
14
|
+
{
|
|
15
|
+
id: "gpt-5.5",
|
|
16
|
+
provider: "openai",
|
|
17
|
+
contextWindow: 105e4,
|
|
18
|
+
maxInputTokens: 27e4,
|
|
19
|
+
maxOutputTokens: 13e4,
|
|
20
|
+
supportsFast: true
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "gpt-5.5-1M",
|
|
24
|
+
provider: "openai",
|
|
25
|
+
providerModelId: "gpt-5.5",
|
|
26
|
+
aliases: ["gpt-5.5-1m", "gpt-5.5-full"],
|
|
27
|
+
contextWindow: 105e4,
|
|
28
|
+
maxInputTokens: 92e4,
|
|
29
|
+
maxOutputTokens: 13e4
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "gpt-5.5-pro",
|
|
33
|
+
provider: "openai"
|
|
34
|
+
},
|
|
14
35
|
{
|
|
15
36
|
id: "gpt-5.4",
|
|
16
37
|
provider: "openai",
|
|
17
38
|
contextWindow: 105e4,
|
|
18
39
|
maxInputTokens: GPT_5_4_CAPPED_INPUT_TOKENS,
|
|
19
|
-
maxOutputTokens: 128e3
|
|
40
|
+
maxOutputTokens: 128e3,
|
|
41
|
+
supportsFast: true
|
|
20
42
|
},
|
|
21
43
|
{
|
|
22
44
|
id: "gpt-5.4-1M",
|
|
@@ -27,6 +49,50 @@ var OPENAI_MODELS = [
|
|
|
27
49
|
maxInputTokens: 942e3,
|
|
28
50
|
maxOutputTokens: 128e3
|
|
29
51
|
},
|
|
52
|
+
{
|
|
53
|
+
id: "gpt-5.4-pro",
|
|
54
|
+
provider: "openai",
|
|
55
|
+
contextWindow: 105e4,
|
|
56
|
+
maxInputTokens: 922e3,
|
|
57
|
+
maxOutputTokens: 128e3
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "gpt-5.4-pro-2026-03-05",
|
|
61
|
+
provider: "openai",
|
|
62
|
+
contextWindow: 105e4,
|
|
63
|
+
maxInputTokens: 922e3,
|
|
64
|
+
maxOutputTokens: 128e3
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
id: "gpt-5.4-mini",
|
|
68
|
+
provider: "openai",
|
|
69
|
+
contextWindow: 4e5,
|
|
70
|
+
maxInputTokens: 272e3,
|
|
71
|
+
maxOutputTokens: 128e3,
|
|
72
|
+
supportsFast: true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: "gpt-5.4-mini-2026-03-17",
|
|
76
|
+
provider: "openai",
|
|
77
|
+
contextWindow: 4e5,
|
|
78
|
+
maxInputTokens: 272e3,
|
|
79
|
+
maxOutputTokens: 128e3,
|
|
80
|
+
supportsFast: true
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "gpt-5.4-nano",
|
|
84
|
+
provider: "openai",
|
|
85
|
+
contextWindow: 4e5,
|
|
86
|
+
maxInputTokens: 272e3,
|
|
87
|
+
maxOutputTokens: 128e3
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: "gpt-5.4-nano-2026-03-17",
|
|
91
|
+
provider: "openai",
|
|
92
|
+
contextWindow: 4e5,
|
|
93
|
+
maxInputTokens: 272e3,
|
|
94
|
+
maxOutputTokens: 128e3
|
|
95
|
+
},
|
|
30
96
|
{
|
|
31
97
|
id: "gpt-5.3-codex",
|
|
32
98
|
provider: "openai"
|
|
@@ -38,11 +104,13 @@ var OPENAI_MODELS = [
|
|
|
38
104
|
},
|
|
39
105
|
{
|
|
40
106
|
id: "gpt-5.2-2025-12-11",
|
|
41
|
-
provider: "openai"
|
|
107
|
+
provider: "openai",
|
|
108
|
+
supportsFast: true
|
|
42
109
|
},
|
|
43
110
|
{
|
|
44
111
|
id: "gpt-5.2",
|
|
45
|
-
provider: "openai"
|
|
112
|
+
provider: "openai",
|
|
113
|
+
supportsFast: true
|
|
46
114
|
},
|
|
47
115
|
{
|
|
48
116
|
id: "gpt-5.2-pro",
|
|
@@ -54,23 +122,28 @@ var OPENAI_MODELS = [
|
|
|
54
122
|
},
|
|
55
123
|
{
|
|
56
124
|
id: "gpt-5.1",
|
|
57
|
-
provider: "openai"
|
|
125
|
+
provider: "openai",
|
|
126
|
+
supportsFast: true
|
|
58
127
|
},
|
|
59
128
|
{
|
|
60
129
|
id: "gpt-5.1-2025-11-13",
|
|
61
|
-
provider: "openai"
|
|
130
|
+
provider: "openai",
|
|
131
|
+
supportsFast: true
|
|
62
132
|
},
|
|
63
133
|
{
|
|
64
134
|
id: "gpt-5",
|
|
65
|
-
provider: "openai"
|
|
135
|
+
provider: "openai",
|
|
136
|
+
supportsFast: true
|
|
66
137
|
},
|
|
67
138
|
{
|
|
68
139
|
id: "gpt-5-mini",
|
|
69
|
-
provider: "openai"
|
|
140
|
+
provider: "openai",
|
|
141
|
+
supportsFast: true
|
|
70
142
|
},
|
|
71
143
|
{
|
|
72
144
|
id: "gpt-5-mini-2025-08-07",
|
|
73
|
-
provider: "openai"
|
|
145
|
+
provider: "openai",
|
|
146
|
+
supportsFast: true
|
|
74
147
|
},
|
|
75
148
|
{
|
|
76
149
|
id: "gpt-5-nano",
|
|
@@ -82,7 +155,8 @@ var OPENAI_MODELS = [
|
|
|
82
155
|
},
|
|
83
156
|
{
|
|
84
157
|
id: "gpt-5.1-codex",
|
|
85
|
-
provider: "openai"
|
|
158
|
+
provider: "openai",
|
|
159
|
+
supportsFast: true
|
|
86
160
|
},
|
|
87
161
|
{
|
|
88
162
|
id: "gpt-5.1-codex-max",
|
|
@@ -94,7 +168,8 @@ var OPENAI_MODELS = [
|
|
|
94
168
|
},
|
|
95
169
|
{
|
|
96
170
|
id: "gpt-5-codex",
|
|
97
|
-
provider: "openai"
|
|
171
|
+
provider: "openai",
|
|
172
|
+
supportsFast: true
|
|
98
173
|
},
|
|
99
174
|
{
|
|
100
175
|
id: "gpt-5-codex-mini",
|
|
@@ -210,9 +285,18 @@ var ANTHROPIC_MODELS = [
|
|
|
210
285
|
provider: "anthropic",
|
|
211
286
|
aliases: ["default"]
|
|
212
287
|
},
|
|
288
|
+
{
|
|
289
|
+
id: "claude-opus-4-7",
|
|
290
|
+
provider: "anthropic",
|
|
291
|
+
contextWindow: 1e6,
|
|
292
|
+
maxInputTokens: 1e6,
|
|
293
|
+
maxOutputTokens: 128e3,
|
|
294
|
+
supportsFast: true
|
|
295
|
+
},
|
|
213
296
|
{
|
|
214
297
|
id: "claude-opus-4-6",
|
|
215
|
-
provider: "anthropic"
|
|
298
|
+
provider: "anthropic",
|
|
299
|
+
supportsFast: true
|
|
216
300
|
},
|
|
217
301
|
{
|
|
218
302
|
id: "claude-opus-4-5",
|
|
@@ -307,10 +391,18 @@ function listModels(registry, provider) {
|
|
|
307
391
|
const all = Object.values(registry.modelsById);
|
|
308
392
|
return provider ? all.filter((model) => model.provider === provider) : all;
|
|
309
393
|
}
|
|
394
|
+
var isPositiveFiniteNumber = (value) => typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
395
|
+
function isUsableModelSpec(spec) {
|
|
396
|
+
return isPositiveFiniteNumber(spec?.maxInputTokens) || isPositiveFiniteNumber(spec?.contextWindow);
|
|
397
|
+
}
|
|
310
398
|
function resolveProviderModelId(registry, idOrAlias, provider) {
|
|
311
399
|
const spec = resolveModel(registry, idOrAlias, provider);
|
|
312
400
|
return spec ? spec.providerModelId ?? spec.id : void 0;
|
|
313
401
|
}
|
|
402
|
+
function supportsFastMode(registry, idOrAlias, provider) {
|
|
403
|
+
const spec = resolveModel(registry, idOrAlias, provider);
|
|
404
|
+
return spec?.supportsFast === true;
|
|
405
|
+
}
|
|
314
406
|
function cloneAliases(aliasesByProvider) {
|
|
315
407
|
return {
|
|
316
408
|
openai: { ...aliasesByProvider.openai },
|
|
@@ -333,13 +425,12 @@ function applyModelMetadata(registry, index) {
|
|
|
333
425
|
const fullId = `${provider}/${modelId}`;
|
|
334
426
|
const spec = resolveModel(next, fullId, provider) ?? resolveModel(next, modelId, provider);
|
|
335
427
|
if (!spec) continue;
|
|
336
|
-
const limits = entry.limits;
|
|
337
|
-
if (!limits) continue;
|
|
338
428
|
next.modelsById[spec.id] = {
|
|
339
429
|
...spec,
|
|
340
|
-
contextWindow: spec.contextWindow ?? limits
|
|
341
|
-
maxInputTokens: spec.maxInputTokens ?? limits
|
|
342
|
-
maxOutputTokens: spec.maxOutputTokens ?? limits
|
|
430
|
+
contextWindow: spec.contextWindow ?? entry.limits?.contextWindow,
|
|
431
|
+
maxInputTokens: spec.maxInputTokens ?? entry.limits?.inputTokens,
|
|
432
|
+
maxOutputTokens: spec.maxOutputTokens ?? entry.limits?.outputTokens,
|
|
433
|
+
supportsFast: spec.supportsFast ?? entry.capabilities?.supportsFast
|
|
343
434
|
};
|
|
344
435
|
}
|
|
345
436
|
}
|
|
@@ -1333,14 +1424,16 @@ var Agent = class {
|
|
|
1333
1424
|
}
|
|
1334
1425
|
this.history.enqueueUserMessage(message);
|
|
1335
1426
|
let iterations = 0;
|
|
1427
|
+
const runTools = [...this.tools, ...options.tools ?? []];
|
|
1428
|
+
const runToolChoice = options.toolChoice ?? this.toolChoice;
|
|
1336
1429
|
while (iterations < this.maxIterations) {
|
|
1337
1430
|
iterations++;
|
|
1338
1431
|
throwIfAborted(signal);
|
|
1339
1432
|
await this.trimToolOutputs();
|
|
1340
1433
|
throwIfAborted(signal);
|
|
1341
1434
|
const invokeInput = this.history.prepareInvokeInput({
|
|
1342
|
-
tools: [...
|
|
1343
|
-
toolChoice:
|
|
1435
|
+
tools: [...runTools.map((t) => t.definition), ...this.hostedTools],
|
|
1436
|
+
toolChoice: runToolChoice
|
|
1344
1437
|
});
|
|
1345
1438
|
const invokeContext = this.buildInvokeContext(session);
|
|
1346
1439
|
const seq = this.recordLlmRequest(session, invokeInput, invokeContext);
|
|
@@ -1456,7 +1549,11 @@ var Agent = class {
|
|
|
1456
1549
|
const startTime = Date.now();
|
|
1457
1550
|
try {
|
|
1458
1551
|
throwIfAborted(signal);
|
|
1459
|
-
const execution = await this.executeToolCall(
|
|
1552
|
+
const execution = await this.executeToolCall(
|
|
1553
|
+
toolCall,
|
|
1554
|
+
runTools,
|
|
1555
|
+
signal
|
|
1556
|
+
);
|
|
1460
1557
|
const rawOutput = stringifyContent(execution.message.content, {
|
|
1461
1558
|
mode: "display"
|
|
1462
1559
|
});
|
|
@@ -1597,9 +1694,9 @@ ${assistantTexts.join("\n").trim()}`;
|
|
|
1597
1694
|
return "[Max Iterations Reached]\n\nSummary unavailable due to an internal error.";
|
|
1598
1695
|
}
|
|
1599
1696
|
}
|
|
1600
|
-
async executeToolCall(toolCall, signal) {
|
|
1697
|
+
async executeToolCall(toolCall, tools, signal) {
|
|
1601
1698
|
const toolName = toolCall.function.name;
|
|
1602
|
-
const tool =
|
|
1699
|
+
const tool = tools.find((t) => t.name === toolName);
|
|
1603
1700
|
if (!tool) {
|
|
1604
1701
|
return {
|
|
1605
1702
|
message: {
|
|
@@ -2234,12 +2331,14 @@ var DEFAULT_CLIENT_TIMEOUT_MS = 20 * 60 * 1e3;
|
|
|
2234
2331
|
var DEFAULT_PROMPT_CACHE_CONTROL = {
|
|
2235
2332
|
type: "ephemeral"
|
|
2236
2333
|
};
|
|
2334
|
+
var FAST_MODE_BETA = "fast-mode-2026-02-01";
|
|
2237
2335
|
var ChatAnthropic = class {
|
|
2238
2336
|
provider = PROVIDER_NAME;
|
|
2239
2337
|
model;
|
|
2240
2338
|
client;
|
|
2241
2339
|
defaultMaxTokens;
|
|
2242
2340
|
defaultInvokeOptions;
|
|
2341
|
+
fastMode;
|
|
2243
2342
|
reasoningLevelMeta;
|
|
2244
2343
|
debugInvokeSeq = 0;
|
|
2245
2344
|
lastDebugRequestPayload = null;
|
|
@@ -2251,6 +2350,7 @@ var ChatAnthropic = class {
|
|
|
2251
2350
|
this.model = options.model ?? DEFAULT_MODEL;
|
|
2252
2351
|
this.defaultMaxTokens = options.maxTokens ?? DEFAULT_MAX_TOKENS;
|
|
2253
2352
|
this.defaultInvokeOptions = { ...options.invokeOptions ?? {} };
|
|
2353
|
+
this.fastMode = options.fastMode === true;
|
|
2254
2354
|
this.reasoningLevelMeta = {
|
|
2255
2355
|
requested: options.reasoningLevelRequested,
|
|
2256
2356
|
applied: options.reasoningLevelApplied,
|
|
@@ -2288,14 +2388,17 @@ var ChatAnthropic = class {
|
|
|
2288
2388
|
if (request.cache_control === void 0) {
|
|
2289
2389
|
request.cache_control = DEFAULT_PROMPT_CACHE_CONTROL;
|
|
2290
2390
|
}
|
|
2391
|
+
if (this.fastMode) {
|
|
2392
|
+
request.speed = "fast";
|
|
2393
|
+
request.betas = [...request.betas ?? [], FAST_MODE_BETA];
|
|
2394
|
+
}
|
|
2291
2395
|
const debugSeq = this.nextDebugInvokeSeq();
|
|
2292
2396
|
await this.debugRequestIfEnabled(request, debugSeq);
|
|
2293
|
-
const
|
|
2397
|
+
const requestOptions = signal ? { signal } : void 0;
|
|
2398
|
+
const response = this.fastMode ? await this.client.beta.messages.create(
|
|
2294
2399
|
request,
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
} : void 0
|
|
2298
|
-
);
|
|
2400
|
+
requestOptions
|
|
2401
|
+
) : await this.client.messages.create(request, requestOptions);
|
|
2299
2402
|
await this.debugResponseIfEnabled(response, debugSeq);
|
|
2300
2403
|
return toChatInvokeCompletion(response, {
|
|
2301
2404
|
reasoning_requested: this.reasoningLevelMeta.requested,
|
|
@@ -2613,7 +2716,11 @@ var OpenAiResponseAccumulator = class {
|
|
|
2613
2716
|
break;
|
|
2614
2717
|
}
|
|
2615
2718
|
case "response.content_part.added": {
|
|
2616
|
-
this.addContentPart(
|
|
2719
|
+
this.addContentPart(
|
|
2720
|
+
event.output_index,
|
|
2721
|
+
event.content_index,
|
|
2722
|
+
event.part
|
|
2723
|
+
);
|
|
2617
2724
|
break;
|
|
2618
2725
|
}
|
|
2619
2726
|
case "response.output_text.delta": {
|
|
@@ -2625,7 +2732,11 @@ var OpenAiResponseAccumulator = class {
|
|
|
2625
2732
|
break;
|
|
2626
2733
|
}
|
|
2627
2734
|
case "response.output_text.done": {
|
|
2628
|
-
this.setMessageText(
|
|
2735
|
+
this.setMessageText(
|
|
2736
|
+
event.output_index,
|
|
2737
|
+
event.content_index,
|
|
2738
|
+
event.text
|
|
2739
|
+
);
|
|
2629
2740
|
break;
|
|
2630
2741
|
}
|
|
2631
2742
|
case "response.refusal.delta": {
|
|
@@ -2764,13 +2875,17 @@ var OpenAiResponseAccumulator = class {
|
|
|
2764
2875
|
}
|
|
2765
2876
|
if (output.type === "message" && part.type !== "reasoning_text") {
|
|
2766
2877
|
ensureArrayIndex(output.content, contentIndex);
|
|
2767
|
-
output.content[contentIndex] = cloneValue(
|
|
2878
|
+
output.content[contentIndex] = cloneValue(
|
|
2879
|
+
part
|
|
2880
|
+
);
|
|
2768
2881
|
return;
|
|
2769
2882
|
}
|
|
2770
2883
|
if (output.type === "reasoning" && part.type === "reasoning_text") {
|
|
2771
2884
|
const content = output.content ?? [];
|
|
2772
2885
|
ensureArrayIndex(content, contentIndex);
|
|
2773
|
-
content[contentIndex] = cloneValue(
|
|
2886
|
+
content[contentIndex] = cloneValue(
|
|
2887
|
+
part
|
|
2888
|
+
);
|
|
2774
2889
|
output.content = content;
|
|
2775
2890
|
}
|
|
2776
2891
|
}
|
|
@@ -2933,9 +3048,7 @@ var OpenAiResponseAccumulator = class {
|
|
|
2933
3048
|
}
|
|
2934
3049
|
loggedUnhandledResponseEventTypes.add(event.type);
|
|
2935
3050
|
const payload = getResponseStreamEventDebugPayload(event);
|
|
2936
|
-
console.error(
|
|
2937
|
-
`[openai.stream.unhandled] ${safeJsonStringify(payload)}`
|
|
2938
|
-
);
|
|
3051
|
+
console.error(`[openai.stream.unhandled] ${safeJsonStringify(payload)}`);
|
|
2939
3052
|
}
|
|
2940
3053
|
};
|
|
2941
3054
|
|
|
@@ -3550,9 +3663,7 @@ var OpenAiWsTransport = class {
|
|
|
3550
3663
|
if (settled || !terminalCompletedWithoutUsage) {
|
|
3551
3664
|
return;
|
|
3552
3665
|
}
|
|
3553
|
-
resolveOnce(
|
|
3554
|
-
accumulator.buildResponse(terminalCompletedWithoutUsage)
|
|
3555
|
-
);
|
|
3666
|
+
resolveOnce(accumulator.buildResponse(terminalCompletedWithoutUsage));
|
|
3556
3667
|
}, WS_TERMINAL_DONE_GRACE_MS);
|
|
3557
3668
|
};
|
|
3558
3669
|
const resetResponseTimeout = () => {
|
|
@@ -3592,9 +3703,7 @@ var OpenAiWsTransport = class {
|
|
|
3592
3703
|
}
|
|
3593
3704
|
if (type === "response.done" && terminalCompletedWithoutUsage) {
|
|
3594
3705
|
clearDoneGraceTimer();
|
|
3595
|
-
resolveOnce(
|
|
3596
|
-
accumulator.buildResponse(terminalCompletedWithoutUsage)
|
|
3597
|
-
);
|
|
3706
|
+
resolveOnce(accumulator.buildResponse(terminalCompletedWithoutUsage));
|
|
3598
3707
|
return;
|
|
3599
3708
|
}
|
|
3600
3709
|
rejectOnce(
|
|
@@ -4130,6 +4239,7 @@ var ChatOpenAI = class {
|
|
|
4130
4239
|
defaultReasoningEffort;
|
|
4131
4240
|
reasoningLevelMeta;
|
|
4132
4241
|
defaultTextVerbosity;
|
|
4242
|
+
defaultServiceTier;
|
|
4133
4243
|
websocketMode;
|
|
4134
4244
|
websocketApiVersion;
|
|
4135
4245
|
wsTransport;
|
|
@@ -4149,6 +4259,7 @@ var ChatOpenAI = class {
|
|
|
4149
4259
|
fallbackApplied: options.reasoningFallbackApplied
|
|
4150
4260
|
};
|
|
4151
4261
|
this.defaultTextVerbosity = options.textVerbosity;
|
|
4262
|
+
this.defaultServiceTier = options.serviceTier;
|
|
4152
4263
|
this.websocketMode = options.websocketMode ?? "off";
|
|
4153
4264
|
this.websocketApiVersion = options.websocketApiVersion ?? "v2";
|
|
4154
4265
|
this.wsTransport = new OpenAiWsTransport({
|
|
@@ -4172,7 +4283,7 @@ var ChatOpenAI = class {
|
|
|
4172
4283
|
const instructions = extractInstructions(messages);
|
|
4173
4284
|
const tools = toResponsesTools(toolDefs);
|
|
4174
4285
|
const tool_choice = toResponsesToolChoice(toolChoice);
|
|
4175
|
-
const { reasoningEffort, textVerbosity, ...rest } = options ?? {};
|
|
4286
|
+
const { reasoningEffort, textVerbosity, serviceTier, ...rest } = options ?? {};
|
|
4176
4287
|
const request = {
|
|
4177
4288
|
model: model ?? this.providerModel,
|
|
4178
4289
|
input: inputItems,
|
|
@@ -4204,6 +4315,10 @@ var ChatOpenAI = class {
|
|
|
4204
4315
|
verbosity
|
|
4205
4316
|
};
|
|
4206
4317
|
}
|
|
4318
|
+
const resolvedServiceTier = serviceTier ?? this.defaultServiceTier;
|
|
4319
|
+
if (resolvedServiceTier) {
|
|
4320
|
+
request.service_tier = resolvedServiceTier;
|
|
4321
|
+
}
|
|
4207
4322
|
if (context?.sessionKey && !request.prompt_cache_key) {
|
|
4208
4323
|
request.prompt_cache_key = context.sessionKey;
|
|
4209
4324
|
}
|
|
@@ -5460,10 +5575,12 @@ export {
|
|
|
5460
5575
|
createModelRegistry,
|
|
5461
5576
|
defineTool,
|
|
5462
5577
|
getDefaultSystemPromptPath,
|
|
5578
|
+
isUsableModelSpec,
|
|
5463
5579
|
listModels,
|
|
5464
5580
|
registerModels,
|
|
5465
5581
|
resolveModel,
|
|
5466
5582
|
resolveProviderModelId,
|
|
5467
5583
|
stringifyContent,
|
|
5468
|
-
stringifyContentParts
|
|
5584
|
+
stringifyContentParts,
|
|
5585
|
+
supportsFastMode
|
|
5469
5586
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codelia/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.67",
|
|
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.67",
|
|
29
|
+
"@codelia/shared-types": "0.1.67",
|
|
30
30
|
"@google-cloud/vertexai": "^1.10.0",
|
|
31
31
|
"@google/genai": "^1.43.0",
|
|
32
32
|
"json-schema": "^0.4.0",
|