@openclaw/ai 2026.10.10-beta.5 → 2026.11.1
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/{anthropic-B54Ts1tV.mjs → anthropic-Do60LsIj.mjs} +2 -2
- package/dist/{anthropic-stream-reducer-C__ByTq1.mjs → anthropic-stream-reducer-UI5_Ta6I.mjs} +1 -1
- package/dist/{assistant-output-DbgdWAhJ.mjs → assistant-output-BdFoDBYQ.mjs} +1 -1
- package/dist/{azure-openai-responses-DHzTwi-y.mjs → azure-openai-responses-DojP0OrF.mjs} +2 -2
- package/dist/{google-CZ6uGVkV.mjs → google-D0QA9Xum.mjs} +1 -1
- package/dist/{google-interactions-1XAHjAQo.mjs → google-interactions-B7mZhG4e.mjs} +87 -26
- package/dist/{google-provider-stream-DlhaCvCf.mjs → google-provider-stream-C43bhKMi.mjs} +12 -7
- package/dist/{google-shared-Cif7nve-.mjs → google-shared-B-jv5dQ9.mjs} +2 -1
- package/dist/{google-vertex-BZTcYnWU.mjs → google-vertex-sjKMbIUP.mjs} +1 -1
- package/dist/google-video-slots-D8tPH8wX.mjs +29 -0
- package/dist/internal/anthropic.d.mts +2 -2
- package/dist/internal/anthropic.mjs +3 -3
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai.d.mts +2 -2
- package/dist/internal/openai.mjs +5 -5
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +75 -1
- package/dist/{mistral-C_ImzxlK.mjs → mistral-CXSRuQbO.mjs} +1 -1
- package/dist/{openai-chatgpt-responses-BHkSHjkO.mjs → openai-chatgpt-responses-C97WXCjm.mjs} +3 -3
- package/dist/{openai-completions-CB-wfbsI.mjs → openai-completions-BXUVMZXy.mjs} +1 -1
- package/dist/{openai-completions-transport-CqomHW1O.mjs → openai-completions-transport-BVV8L-MO.mjs} +4 -4
- package/dist/{openai-responses-compaction-replay-C-yvB5g5.d.mts → openai-responses-compaction-replay-DUBbsfku.d.mts} +1 -1
- package/dist/{openai-responses-contracts-D-VwWWjx.d.mts → openai-responses-contracts-gnl6ZRs1.d.mts} +6 -0
- package/dist/{openai-responses-request-lifecycle-DQDyzE6F.mjs → openai-responses-request-lifecycle-CsBFQkiW.mjs} +16 -2
- package/dist/{openai-responses-shared-CNfHudFg.mjs → openai-responses-shared-CD3Sd1NC.mjs} +1 -1
- package/dist/{openai-responses-Cp2QPq7K.mjs → openai-responses-ytmKcG9V.mjs} +3 -3
- package/dist/{provider-transport-turn-state-B11rmZpv.mjs → provider-transport-turn-state-Dm6Qh366.mjs} +1 -1
- package/dist/{provider-types-ODq57rG_.d.mts → provider-types-CWl4VXvE.d.mts} +3 -1
- package/dist/provider-types.d.mts +2 -2
- package/dist/provider-types.mjs +2 -1
- package/dist/providers.mjs +9 -9
- package/dist/retry-after-BrmTv0jL.d.mts +25 -0
- package/dist/transports.d.mts +13 -4
- package/dist/transports.mjs +7 -6
- package/package.json +1 -1
- package/dist/retry-after-sw-XX8aC.d.mts +0 -15
|
@@ -3,13 +3,13 @@ import { w as supportsClaudeAdaptiveThinking } from "./src-CyA0zJnt.mjs";
|
|
|
3
3
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
4
4
|
import { T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, a as resolveAiTransportHeaderSentinels, b as prepareClaudeNoPrefillRequestContext, r as getAiTransportHost } from "./host-rCxf5Tjd.mjs";
|
|
5
5
|
import { s as streamFragmentError } from "./transport-utils-CcCAuFVS.mjs";
|
|
6
|
-
import { F as supportsAnthropicServerSideFallback, H as isAnthropicOAuthApiKey, O as isDirectAnthropicModel, U as omitFoundryBearerCredentialHeaders, W as usesFoundryBearerAuth, d as applyAnthropicThinkingOptions, l as buildAnthropicRequest, t as consumeAnthropicStream, u as prepareAnthropicRequest, x as suppressAnthropicCompaction, y as isAnthropicReplayRejection } from "./anthropic-stream-reducer-
|
|
6
|
+
import { F as supportsAnthropicServerSideFallback, H as isAnthropicOAuthApiKey, O as isDirectAnthropicModel, U as omitFoundryBearerCredentialHeaders, W as usesFoundryBearerAuth, d as applyAnthropicThinkingOptions, l as buildAnthropicRequest, t as consumeAnthropicStream, u as prepareAnthropicRequest, x as suppressAnthropicCompaction, y as isAnthropicReplayRejection } from "./anthropic-stream-reducer-UI5_Ta6I.mjs";
|
|
7
7
|
import { i as resolveCacheRetention, n as resolveCloudflareBaseUrl, r as buildCopilotDynamicHeaders } from "./cloudflare-Dttf8jKq.mjs";
|
|
8
8
|
import { n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-BdJJbzZk.mjs";
|
|
9
9
|
import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
10
10
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
11
11
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
12
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
12
|
+
import { t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
13
13
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
14
14
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
15
15
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
package/dist/{anthropic-stream-reducer-C__ByTq1.mjs → anthropic-stream-reducer-UI5_Ta6I.mjs}
RENAMED
|
@@ -14,7 +14,7 @@ import { S as splitSystemPromptCacheBoundary, T as stripSystemPromptRelocatableB
|
|
|
14
14
|
import { C as parseJsonObjectPreservingUnsafeIntegers, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, b as transportAbortError, d as iterateModelStream, i as copyProviderAcceptanceObserver, l as finalizeTerminalToolCallArguments, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
15
15
|
import { t as parsePositiveInteger } from "./positive-integer-Bb4Evc7L.mjs";
|
|
16
16
|
import { n as isProviderReplayContext, r as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-BC23HyZo.mjs";
|
|
17
|
-
import { n as transformProviderMessages } from "./assistant-output-
|
|
17
|
+
import { n as transformProviderMessages } from "./assistant-output-BdFoDBYQ.mjs";
|
|
18
18
|
import { a as reconcileAnthropicToolChoice, i as projectAnthropicTools, n as normalizeAnthropicToolChoice, o as resolveOriginalAnthropicToolName, s as toClaudeCodeToolName, t as normalizeAnthropicToolCallId } from "./anthropic-tool-projection-DA_KeluM.mjs";
|
|
19
19
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
20
20
|
//#region packages/ai/src/providers/anthropic-auth-headers.ts
|
|
@@ -26,7 +26,7 @@ function transformProviderMessages(messages, model, normalizeToolCallId) {
|
|
|
26
26
|
};
|
|
27
27
|
return transformMessages(messages.map((message) => {
|
|
28
28
|
if (message.role !== "user" || !Array.isArray(message.content)) return message;
|
|
29
|
-
return Object.assign({}, message, { content: projectUserMediaForTransport(message.content, model.input.includes("image"), model.api === "openai-completions" && model.input.includes("video")) });
|
|
29
|
+
return Object.assign({}, message, { content: projectUserMediaForTransport(message.content, model.input.includes("image"), (model.api === "openai-completions" || model.api === "google-interactions") && model.input.includes("video")) });
|
|
30
30
|
}), target, normalizeToolCallId);
|
|
31
31
|
}
|
|
32
32
|
//#endregion
|
|
@@ -2,8 +2,8 @@ import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
|
2
2
|
import { r as getAiTransportHost } from "./host-rCxf5Tjd.mjs";
|
|
3
3
|
import { n as buildBaseOptions } from "./simple-options-BdJJbzZk.mjs";
|
|
4
4
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
5
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
6
|
-
import { F as convertProviderResponsesMessages, Lt as resolvePromptCacheKey, Rt as withOpenAIErrorResponseHook, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-
|
|
5
|
+
import { t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
6
|
+
import { F as convertProviderResponsesMessages, Lt as resolvePromptCacheKey, Rt as withOpenAIErrorResponseHook, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
7
7
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
8
8
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
|
9
9
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
@@ -2,7 +2,7 @@ import { r as getAiTransportHost } from "./host-rCxf5Tjd.mjs";
|
|
|
2
2
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
3
3
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
4
4
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
|
5
|
-
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-
|
|
5
|
+
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-C43bhKMi.mjs";
|
|
6
6
|
import { GoogleGenAI } from "@google/genai";
|
|
7
7
|
//#region packages/ai/src/providers/google.ts
|
|
8
8
|
const { stream: streamGoogle, streamSimple: streamSimpleGoogle } = createGoogleGenerateContentStreams("google-generative-ai", (model, options) => {
|
|
@@ -5,12 +5,14 @@ import { s as streamFragmentError } from "./transport-utils-CcCAuFVS.mjs";
|
|
|
5
5
|
import { t as buildGuardedModelFetch } from "./host-policy-Ci1cKluf.mjs";
|
|
6
6
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
7
7
|
import { n as buildBaseOptions, w as stripSystemPromptCacheBoundary } from "./simple-options-BdJJbzZk.mjs";
|
|
8
|
-
import { b as transportAbortError, c as failTransportStream, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, m as notifyProviderHttpResponse, w as parseJsonPreservingUnsafeIntegers } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
8
|
+
import { b as transportAbortError, c as failTransportStream, f as mergeTransportHeaders, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, m as notifyProviderHttpResponse, w as parseJsonPreservingUnsafeIntegers } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
9
9
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
10
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
11
|
-
import { n as
|
|
10
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
11
|
+
import { n as createGoogleVideoPlaceholder, r as materializeGoogleVideoSlots, t as GOOGLE_VIDEO_SLOT_OMISSION } from "./google-video-slots-D8tPH8wX.mjs";
|
|
12
|
+
import { PROVIDER_CONTEXT_HANDOFF, PROVIDER_MODEL_INPUT, resolveProviderContext } from "./provider-types.mjs";
|
|
13
|
+
import { n as buildGoogleInteractionsSimpleThinking } from "./google-shared-B-jv5dQ9.mjs";
|
|
12
14
|
//#region packages/ai/package.json
|
|
13
|
-
var version = "2026.
|
|
15
|
+
var version = "2026.11.1";
|
|
14
16
|
//#endregion
|
|
15
17
|
//#region packages/ai/src/providers/google-interactions-request.ts
|
|
16
18
|
const DEFAULT_GOOGLE_API_BASE_URL = "https://generativelanguage.googleapis.com";
|
|
@@ -32,7 +34,7 @@ function resolveGoogleApiClientHeaders(params) {
|
|
|
32
34
|
"x-goog-api-client": `openclaw/${resolvePackageVersion()}`
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
function convertMessages(model, context) {
|
|
37
|
+
function convertMessages(model, context, videoSlots) {
|
|
36
38
|
const steps = [];
|
|
37
39
|
const messages = transformProviderMessages(context.messages, model);
|
|
38
40
|
for (const message of messages) {
|
|
@@ -41,13 +43,20 @@ function convertMessages(model, context) {
|
|
|
41
43
|
const content = (typeof sourceContent === "string" ? [{
|
|
42
44
|
type: "text",
|
|
43
45
|
text: sourceContent
|
|
44
|
-
}] : sourceContent).map((item) =>
|
|
45
|
-
type
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
}] : sourceContent).map((item) => {
|
|
47
|
+
if (item.type === "text") return {
|
|
48
|
+
type: "text",
|
|
49
|
+
text: sanitizeSurrogates(item.text) || " "
|
|
50
|
+
};
|
|
51
|
+
if (item.type === "video") return createGoogleVideoPlaceholder(item, videoSlots, {
|
|
52
|
+
type: "text",
|
|
53
|
+
text: GOOGLE_VIDEO_SLOT_OMISSION
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
type: "image",
|
|
57
|
+
mime_type: item.mimeType,
|
|
58
|
+
data: item.data
|
|
59
|
+
};
|
|
51
60
|
});
|
|
52
61
|
steps.push({
|
|
53
62
|
type: "user_input",
|
|
@@ -122,12 +131,20 @@ function convertMessages(model, context) {
|
|
|
122
131
|
}
|
|
123
132
|
return steps;
|
|
124
133
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
if (
|
|
128
|
-
if (
|
|
134
|
+
/** Maps the shared tool-choice vocabulary (as GenerateContent does) to Interactions. */
|
|
135
|
+
function normalizeGoogleInteractionsToolChoice(choice) {
|
|
136
|
+
if (choice === "auto" || choice === "none" || choice === "any") return choice;
|
|
137
|
+
if (choice === "required") return "any";
|
|
138
|
+
const name = asRecord(asRecord(choice).function).name;
|
|
139
|
+
return asRecord(choice).type === "function" && typeof name === "string" && name ? { allowed_tools: {
|
|
140
|
+
mode: "any",
|
|
141
|
+
tools: [name]
|
|
142
|
+
} } : void 0;
|
|
143
|
+
}
|
|
144
|
+
function buildGoogleInteractionsParams(model, context, options = {}, videoSlots) {
|
|
129
145
|
const generationConfig = {};
|
|
130
146
|
if (options.temperature !== void 0) generationConfig.temperature = options.temperature;
|
|
147
|
+
if (options.topP !== void 0) generationConfig.top_p = options.topP;
|
|
131
148
|
if (options.maxTokens !== void 0) generationConfig.max_output_tokens = options.maxTokens;
|
|
132
149
|
if (options.stop && options.stop.length > 0) generationConfig.stop_sequences = options.stop;
|
|
133
150
|
if (options.thinking) {
|
|
@@ -144,7 +161,10 @@ function buildGoogleInteractionsParams(model, context, options = {}) {
|
|
|
144
161
|
}));
|
|
145
162
|
return {
|
|
146
163
|
model: model.id,
|
|
147
|
-
input: convertMessages(
|
|
164
|
+
input: convertMessages({
|
|
165
|
+
...model,
|
|
166
|
+
input: options[PROVIDER_MODEL_INPUT] ?? model.input
|
|
167
|
+
}, context, videoSlots),
|
|
148
168
|
...context.systemPrompt ? { system_instruction: sanitizeSurrogates(stripSystemPromptCacheBoundary(context.systemPrompt)) } : {},
|
|
149
169
|
...tools && tools.length > 0 ? { tools } : {},
|
|
150
170
|
...Object.keys(generationConfig).length > 0 ? { generation_config: generationConfig } : {},
|
|
@@ -183,12 +203,44 @@ async function runGoogleInteractionsLifecycle(params) {
|
|
|
183
203
|
const unresolvedApiKey = resolveGoogleInteractionsApiKey(model, options);
|
|
184
204
|
const apiKey = host.resolveSecretSentinel(unresolvedApiKey);
|
|
185
205
|
if (!apiKey.trim()) throw new Error(`No API key for provider: ${model.provider}`);
|
|
186
|
-
|
|
206
|
+
const providerContext = (options?.[PROVIDER_MODEL_INPUT] ?? model.input).includes("video") ? await resolveProviderContext(context, options) : context;
|
|
207
|
+
const videoSlots = /* @__PURE__ */ new Map();
|
|
208
|
+
let body = buildGoogleInteractionsParams(model, providerContext, options, videoSlots);
|
|
187
209
|
const nextBody = await options?.onPayload?.(body, model);
|
|
188
210
|
if (nextBody !== void 0) {
|
|
189
211
|
if (!isGoogleInteractionsRequestBody(nextBody)) throw new Error("Google Interactions onPayload returned an invalid request body");
|
|
190
212
|
body = nextBody;
|
|
191
213
|
}
|
|
214
|
+
const optionRecord = asRecord(options);
|
|
215
|
+
const metadata = asRecord(optionRecord.videoMetadata ?? optionRecord.video_metadata);
|
|
216
|
+
const processing = {};
|
|
217
|
+
for (const [camel, snake] of [
|
|
218
|
+
["startOffset", "start_offset"],
|
|
219
|
+
["endOffset", "end_offset"],
|
|
220
|
+
["fps", "fps"]
|
|
221
|
+
]) {
|
|
222
|
+
const value = metadata[camel] ?? metadata[snake];
|
|
223
|
+
if (value !== void 0) processing[snake] = value;
|
|
224
|
+
}
|
|
225
|
+
materializeGoogleVideoSlots(body, videoSlots, (slot, video) => {
|
|
226
|
+
Object.assign(slot, {
|
|
227
|
+
type: "video",
|
|
228
|
+
mime_type: video.mimeType,
|
|
229
|
+
data: video.data,
|
|
230
|
+
...Object.keys(processing).length > 0 ? { processing: {
|
|
231
|
+
type: "static",
|
|
232
|
+
...processing
|
|
233
|
+
} } : {}
|
|
234
|
+
});
|
|
235
|
+
}, (part) => {
|
|
236
|
+
if (part.type === "video") {
|
|
237
|
+
Object.keys(part).forEach((key) => Reflect.deleteProperty(part, key));
|
|
238
|
+
Object.assign(part, {
|
|
239
|
+
type: "text",
|
|
240
|
+
text: GOOGLE_VIDEO_SLOT_OMISSION
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
});
|
|
192
244
|
let baseUrl = (model.baseUrl || "https://generativelanguage.googleapis.com/v1beta").trim().replace(/\/+$/, "");
|
|
193
245
|
if (/^https:\/\/generativelanguage\.googleapis\.com$/i.test(baseUrl)) baseUrl = "https://generativelanguage.googleapis.com/v1beta";
|
|
194
246
|
const url = `${baseUrl}/interactions?alt=sse`;
|
|
@@ -197,14 +249,14 @@ async function runGoogleInteractionsLifecycle(params) {
|
|
|
197
249
|
api: "google-generative-ai",
|
|
198
250
|
model
|
|
199
251
|
});
|
|
200
|
-
const headers = resolveAiTransportHeaderSentinels({
|
|
252
|
+
const headers = resolveAiTransportHeaderSentinels(mergeTransportHeaders({
|
|
201
253
|
"Content-Type": "application/json",
|
|
202
|
-
"
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}) ?? {
|
|
254
|
+
...apiKey.trimStart().startsWith("{") && Object.keys({
|
|
255
|
+
...model.headers,
|
|
256
|
+
...options?.headers
|
|
257
|
+
}).some((name) => name.toLowerCase() === "authorization") ? {} : { "x-goog-api-key": apiKey },
|
|
258
|
+
"Api-Revision": "2026-05-20"
|
|
259
|
+
}, googleClientHeaders, model.headers, options?.headers)) ?? {
|
|
208
260
|
"Content-Type": "application/json",
|
|
209
261
|
"x-goog-api-key": apiKey
|
|
210
262
|
};
|
|
@@ -508,9 +560,18 @@ const streamSimpleGoogleInteractions = (model, context, options) => {
|
|
|
508
560
|
const apiKey = resolveGoogleInteractionsApiKey(model, options);
|
|
509
561
|
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
510
562
|
const base = buildBaseOptions(model, options, apiKey);
|
|
563
|
+
const providerOptions = options;
|
|
564
|
+
const record = asRecord(options);
|
|
565
|
+
const toolChoice = normalizeGoogleInteractionsToolChoice(record.toolChoice);
|
|
566
|
+
const videoMetadata = record.videoMetadata ?? record.video_metadata;
|
|
511
567
|
return streamGoogleInteractions(model, context, {
|
|
512
568
|
...base,
|
|
513
|
-
|
|
569
|
+
...typeof record.topP === "number" ? { topP: record.topP } : {},
|
|
570
|
+
[PROVIDER_MODEL_INPUT]: providerOptions?.[PROVIDER_MODEL_INPUT],
|
|
571
|
+
[PROVIDER_CONTEXT_HANDOFF]: providerOptions?.[PROVIDER_CONTEXT_HANDOFF],
|
|
572
|
+
thinking: buildGoogleInteractionsSimpleThinking(model, options),
|
|
573
|
+
...toolChoice ? { toolChoice } : {},
|
|
574
|
+
...videoMetadata !== void 0 ? { videoMetadata } : {}
|
|
514
575
|
});
|
|
515
576
|
};
|
|
516
577
|
//#endregion
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
|
+
import { a as asRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
3
|
import { a as resolveAiTransportHeaderSentinels } from "./host-rCxf5Tjd.mjs";
|
|
3
4
|
import { n as buildManagedModelFetch } from "./host-policy-Ci1cKluf.mjs";
|
|
4
5
|
import { n as buildBaseOptions } from "./simple-options-BdJJbzZk.mjs";
|
|
5
6
|
import { f as mergeTransportHeaders } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
6
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
7
|
-
import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-
|
|
7
|
+
import { t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
8
|
+
import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-B-jv5dQ9.mjs";
|
|
8
9
|
import { ResourceScope } from "@google/genai";
|
|
9
10
|
//#region packages/ai/src/providers/google-http-options.ts
|
|
10
11
|
function buildGoogleHttpOptions(model, optionsHeaders, profile) {
|
|
@@ -22,7 +23,7 @@ function buildGoogleHttpOptions(model, optionsHeaders, profile) {
|
|
|
22
23
|
} else if (model.baseUrl) {
|
|
23
24
|
httpOptions.baseUrl = model.baseUrl;
|
|
24
25
|
httpOptions.apiVersion = "";
|
|
25
|
-
}
|
|
26
|
+
} else httpOptions.apiVersion = "v1beta";
|
|
26
27
|
if (model.headers || optionsHeaders) httpOptions.headers = resolveAiTransportHeaderSentinels(profile === "vertex" ? {
|
|
27
28
|
...model.headers,
|
|
28
29
|
...optionsHeaders
|
|
@@ -48,10 +49,14 @@ function createGoogleGenerateContentStreams(api, createClient, resolveSimpleApiK
|
|
|
48
49
|
};
|
|
49
50
|
return {
|
|
50
51
|
stream,
|
|
51
|
-
streamSimple: (model, context, options) =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
streamSimple: (model, context, options) => {
|
|
53
|
+
const topP = asRecord(options).topP;
|
|
54
|
+
return stream(model, context, {
|
|
55
|
+
...buildBaseOptions(model, options, resolveSimpleApiKey?.(model, options)),
|
|
56
|
+
...typeof topP === "number" ? { topP } : {},
|
|
57
|
+
thinking: buildGoogleSimpleThinking(model, options)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
55
60
|
};
|
|
56
61
|
}
|
|
57
62
|
//#endregion
|
|
@@ -2,7 +2,7 @@ import { k as clampThinkingLevel } from "./host-rCxf5Tjd.mjs";
|
|
|
2
2
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
3
3
|
import { w as stripSystemPromptCacheBoundary } from "./simple-options-BdJJbzZk.mjs";
|
|
4
4
|
import { b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
5
|
-
import { n as transformProviderMessages } from "./assistant-output-
|
|
5
|
+
import { n as transformProviderMessages } from "./assistant-output-BdFoDBYQ.mjs";
|
|
6
6
|
import { isGoogleGemini3ProModel, isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
|
|
7
7
|
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-B-svbJuN.mjs";
|
|
8
8
|
import { FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
@@ -54,6 +54,7 @@ function buildGoogleGenerateContentParams(model, context, options = {}) {
|
|
|
54
54
|
const contents = convertMessages(model, context);
|
|
55
55
|
const config = {
|
|
56
56
|
...options.temperature !== void 0 && { temperature: options.temperature },
|
|
57
|
+
...options.topP !== void 0 && { topP: options.topP },
|
|
57
58
|
...options.maxTokens !== void 0 && { maxOutputTokens: options.maxTokens },
|
|
58
59
|
...options.stop !== void 0 && options.stop.length > 0 && { stopSequences: options.stop },
|
|
59
60
|
...context.systemPrompt && { systemInstruction: sanitizeSurrogates(stripSystemPromptCacheBoundary(context.systemPrompt)) },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as normalizeOptionalString } from "./string-coerce-Cj8sqWHx.mjs";
|
|
2
2
|
import { r as getAiTransportHost } from "./host-rCxf5Tjd.mjs";
|
|
3
|
-
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-
|
|
3
|
+
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-C43bhKMi.mjs";
|
|
4
4
|
import { GoogleGenAI } from "@google/genai";
|
|
5
5
|
//#region packages/ai/src/providers/google-vertex.ts
|
|
6
6
|
const API_VERSION = "v1";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { i as asOptionalRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
+
//#region packages/ai/src/providers/google-video-slots.ts
|
|
3
|
+
const GOOGLE_VIDEO_SLOT_OMISSION = "(video omitted: native video slot unavailable)";
|
|
4
|
+
function createGoogleVideoPlaceholder(video, slots, placeholder) {
|
|
5
|
+
slots?.set(placeholder, video);
|
|
6
|
+
return placeholder;
|
|
7
|
+
}
|
|
8
|
+
/** Only original slot identities may recover private bytes after mutable payload hooks. */
|
|
9
|
+
function materializeGoogleVideoSlots(payload, slots, materialize, omitInjected) {
|
|
10
|
+
const visit = (value) => {
|
|
11
|
+
if (Array.isArray(value)) {
|
|
12
|
+
value.forEach(visit);
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const part = asOptionalRecord(value);
|
|
16
|
+
if (!part) return;
|
|
17
|
+
const video = slots.get(part);
|
|
18
|
+
if (video) {
|
|
19
|
+
Object.keys(part).forEach((key) => Reflect.deleteProperty(part, key));
|
|
20
|
+
materialize(part, video);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
omitInjected(part);
|
|
24
|
+
Object.values(part).forEach(visit);
|
|
25
|
+
};
|
|
26
|
+
visit(payload);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { createGoogleVideoPlaceholder as n, materializeGoogleVideoSlots as r, GOOGLE_VIDEO_SLOT_OMISSION as t };
|
|
@@ -3,7 +3,7 @@ import { $ as StopReason, Et as AssistantMessageDiagnostic, Q as SimpleStreamOpt
|
|
|
3
3
|
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-Bo8GzTGX.mjs";
|
|
4
4
|
import "../types-CBJthzJX.mjs";
|
|
5
5
|
import { a as prepareAnthropicInputSchema, c as resolveOriginalAnthropicToolName, i as normalizeAnthropicToolChoice, l as toClaudeCodeToolName, n as AnthropicToolProjection, o as projectAnthropicTools, r as normalizeAnthropicToolCallId, s as reconcileAnthropicToolChoice, t as AnthropicProjectedToolChoice } from "../anthropic-tool-projection-JTvMo4KG.mjs";
|
|
6
|
-
import { p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-rqCq9sT_.mjs";
|
|
6
|
+
import { a as buildAnthropicSystemBlocks, p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-rqCq9sT_.mjs";
|
|
7
7
|
//#region packages/ai/src/providers/anthropic.d.ts
|
|
8
8
|
type AnthropicCompactionOptions = AnthropicOptions & {
|
|
9
9
|
authProfileId?: string;
|
|
@@ -184,4 +184,4 @@ export declare function applyAnthropicMessageStartUsage(target: Usage, payload:
|
|
|
184
184
|
/** Keep billing and context distinct; omitted usage preserves the last snapshot. */
|
|
185
185
|
export declare function applyAnthropicMessageDeltaUsage(target: Usage, usage: AnthropicUsagePayload | undefined, messageStartPromptUsage: AnthropicPromptUsageSnapshot | undefined): void;
|
|
186
186
|
//#endregion
|
|
187
|
-
export { type AnthropicEffort, type AnthropicOptions, AnthropicProjectedToolChoice, type AnthropicThinkingDisplay, AnthropicToolProjection, bindsClaudeThinkingPrefix, isDirectAnthropicModel, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, prepareAnthropicInputSchema, projectAnthropicTools, reconcileAnthropicToolChoice, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicServerCompactionPlan, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveOriginalAnthropicToolName, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName };
|
|
187
|
+
export { type AnthropicEffort, type AnthropicOptions, AnthropicProjectedToolChoice, type AnthropicThinkingDisplay, AnthropicToolProjection, bindsClaudeThinkingPrefix, buildAnthropicSystemBlocks, isDirectAnthropicModel, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, prepareAnthropicInputSchema, projectAnthropicTools, reconcileAnthropicToolChoice, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicServerCompactionPlan, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveOriginalAnthropicToolName, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { D as supportsClaudeNativeMaxEffort, O as supportsClaudeNativeXhighEffort, S as resolveClaudeSonnet5ModelIdentity, _ as resolveClaudeMythos5ModelIdentity, b as resolveClaudeOpus5ModelIdentity, d as requiresClaudeBetweenToolsThinking, f as requiresClaudeDefaultSampling, g as resolveClaudeModelIdentity, h as resolveClaudeHaiku55ModelIdentity, m as resolveClaudeFable5ModelIdentity, p as requiresClaudeMandatoryAdaptiveThinking, u as bindsClaudeThinkingPrefix, v as resolveClaudeNativeThinkingLevelMap, w as supportsClaudeAdaptiveThinking, x as resolveClaudeSonnet55ModelIdentity, y as resolveClaudeOpus55ModelIdentity } from "../src-CyA0zJnt.mjs";
|
|
2
2
|
import { C as resolveModelBoundThinkingReplayMode, S as resolveAnthropicThinkingEffort, T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, b as prepareClaudeNoPrefillRequestContext, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "../host-rCxf5Tjd.mjs";
|
|
3
|
-
import { B as readAnthropicFallbackBoundary, H as isAnthropicOAuthApiKey, I as ANTHROPIC_SERVER_SIDE_FALLBACKS, L as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, O as isDirectAnthropicModel, P as resolveAnthropicServerCompactionPlan, R as CLAUDE_OPUS_FALLBACK_MODEL_COST, U as omitFoundryBearerCredentialHeaders, V as resolveAnthropicFallbackServingModelCost, W as usesFoundryBearerAuth, _ as logAnthropicThinkingDrops, a as readAnthropicPromptUsageSnapshot, c as applyAnthropicRefusal, g as findActiveAnthropicToolTurnAssistantIndex, h as applyAnthropicThinkingBindingControls, i as readAnthropicCacheWriteUsage, m as ANTHROPIC_OMITTED_REASONING_TEXT, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as readAnthropicInputTransformations, z as applyAnthropicFallbackBoundary } from "../anthropic-stream-reducer-
|
|
3
|
+
import { B as readAnthropicFallbackBoundary, E as buildAnthropicSystemBlocks, H as isAnthropicOAuthApiKey, I as ANTHROPIC_SERVER_SIDE_FALLBACKS, L as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, O as isDirectAnthropicModel, P as resolveAnthropicServerCompactionPlan, R as CLAUDE_OPUS_FALLBACK_MODEL_COST, U as omitFoundryBearerCredentialHeaders, V as resolveAnthropicFallbackServingModelCost, W as usesFoundryBearerAuth, _ as logAnthropicThinkingDrops, a as readAnthropicPromptUsageSnapshot, c as applyAnthropicRefusal, g as findActiveAnthropicToolTurnAssistantIndex, h as applyAnthropicThinkingBindingControls, i as readAnthropicCacheWriteUsage, m as ANTHROPIC_OMITTED_REASONING_TEXT, n as applyAnthropicMessageDeltaUsage, o as readAnthropicUsageTokenCount, r as applyAnthropicMessageStartUsage, s as readLastAnthropicIterationUsage, v as readAnthropicInputTransformations, z as applyAnthropicFallbackBoundary } from "../anthropic-stream-reducer-UI5_Ta6I.mjs";
|
|
4
4
|
import { a as reconcileAnthropicToolChoice, i as projectAnthropicTools, n as normalizeAnthropicToolChoice, o as resolveOriginalAnthropicToolName, r as prepareAnthropicInputSchema, s as toClaudeCodeToolName, t as normalizeAnthropicToolCallId } from "../anthropic-tool-projection-DA_KeluM.mjs";
|
|
5
|
-
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-
|
|
6
|
-
export { ANTHROPIC_CLAUDE_CODE_VERSION, ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicMessageDeltaUsage, applyAnthropicMessageStartUsage, applyAnthropicRefusal, applyAnthropicThinkingBindingControls, applyClaudeRequestContract, bindsClaudeThinkingPrefix, buildAnthropicClaudeCodeIdentity, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, isAnthropicOAuthApiKey, isDirectAnthropicModel, logAnthropicThinkingDrops, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareAnthropicInputSchema, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
|
|
5
|
+
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-Do60LsIj.mjs";
|
|
6
|
+
export { ANTHROPIC_CLAUDE_CODE_VERSION, ANTHROPIC_OMITTED_REASONING_TEXT, ANTHROPIC_SERVER_SIDE_FALLBACKS, ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, CLAUDE_OPUS_FALLBACK_MODEL_COST, applyAnthropicFallbackBoundary, applyAnthropicMessageDeltaUsage, applyAnthropicMessageStartUsage, applyAnthropicRefusal, applyAnthropicThinkingBindingControls, applyClaudeRequestContract, bindsClaudeThinkingPrefix, buildAnthropicClaudeCodeIdentity, buildAnthropicSystemBlocks, defaultsClaudeAdaptiveThinking, findActiveAnthropicToolTurnAssistantIndex, isAnthropicOAuthApiKey, isDirectAnthropicModel, logAnthropicThinkingDrops, mapAnthropicStopReason, normalizeAnthropicToolCallId, normalizeAnthropicToolChoice, omitFoundryBearerCredentialHeaders, prepareAnthropicInputSchema, prepareClaudeNoPrefillRequestContext, projectAnthropicTools, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as readOpenAIResponsesCompactionWindow, t as OPENAI_RESPONSES_APIS, u as OpenAIResponsesCompactionOutput } from "../openai-responses-contracts-
|
|
1
|
+
import { d as readOpenAIResponsesCompactionWindow, t as OPENAI_RESPONSES_APIS, u as OpenAIResponsesCompactionOutput } from "../openai-responses-contracts-gnl6ZRs1.mjs";
|
|
2
2
|
import { a as resolveOpenAIResponsesPayloadPolicy, o as resolveOpenAIResponsesRequestContextTokens, r as normalizeOpenAIServiceTier, s as resolveOpenAIResponsesServerCompactionPlan, t as OpenAIServiceTier } from "../openai-responses-payload-policy-BzM52TTH.mjs";
|
|
3
3
|
//#region packages/ai/src/transports/openai-responses-endpoint.d.ts
|
|
4
4
|
export declare function supportsNativeOpenAIResponsesEndpoint(params: {
|
|
@@ -3,10 +3,10 @@ import { $ as StopReason, Q as SimpleStreamOptions, d as Context, k as Model, tt
|
|
|
3
3
|
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as reconcileOpenAIResponsesToolChoice, a as BaseOpenAIStreamOptions, b as applyOpenAICompletionsToolReasoning, c as OpenAICompletionsOptions, f as reasoningTagTextPolicy, g as reconcileOpenAICompletionsToolChoice, h as projectOpenAITools, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, m as OpenAIToolProjection, o as CodeModeToolSurfaceObservation, p as OpenAICompletionsToolChoice, u as codeModeToolSurfaceObserver, v as OpenAIApiReasoningEffort, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel, y as OpenAIReasoningEffort } from "../provider-options-Bo8GzTGX.mjs";
|
|
4
4
|
import "../types-CBJthzJX.mjs";
|
|
5
5
|
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-CBvb2eld.mjs";
|
|
6
|
-
import { c as responsesPromptObserver, f as OpenAIRequestReasoningEffort, l as responsesServiceTierObserver, o as ResponsesPromptObservation, s as ResponsesServiceTierObservation } from "../openai-responses-contracts-
|
|
6
|
+
import { c as responsesPromptObserver, f as OpenAIRequestReasoningEffort, l as responsesServiceTierObserver, o as ResponsesPromptObservation, s as ResponsesServiceTierObservation } from "../openai-responses-contracts-gnl6ZRs1.mjs";
|
|
7
7
|
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-DgjD-UL5.mjs";
|
|
8
8
|
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-CpVjkqn-.mjs";
|
|
9
|
-
import "../openai-responses-compaction-replay-
|
|
9
|
+
import "../openai-responses-compaction-replay-DUBbsfku.mjs";
|
|
10
10
|
import { n as modelRequestBodyState, t as encodedModelRequestBodyStream } from "../model-request-body-BD5vy4rP.mjs";
|
|
11
11
|
import { ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
|
|
12
12
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|
package/dist/internal/openai.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resol
|
|
|
2
2
|
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-h8vXRiaH.mjs";
|
|
3
3
|
import { _ as resolveResponsesTerminalStopReason, g as readResponsesReasoningTokens, h as mapResponsesTerminalUsage, m as isResponsesOutputLimitToolCallError } from "../diagnostics-Cv7cW3pS.mjs";
|
|
4
4
|
import { a as encodedModelRequestBodyStream, g as reasoningTagTextPolicy, m as codeModeToolSurfaceObserver, o as modelRequestBodyState } from "../simple-options-BdJJbzZk.mjs";
|
|
5
|
-
import { a as hasResponsesWebSearchTool, s as convertMessages } from "../openai-completions-transport-
|
|
6
|
-
import { Ct as reconcileOpenAIResponsesToolChoice, N as bindResponsesInputMessage, St as reconcileOpenAICompletionsToolChoice, _ as isResponsesTextContentPartType, d as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, f as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, g as isAzureResponsesTextDeltaEventType, h as isAzureResponsesTextDeltaEvent, l as createResponsesToolCallTracker, m as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, p as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, u as readResponsesToolCallItemIdentity, v as isResponsesTextDeltaEventType, xt as projectOpenAITools, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-
|
|
5
|
+
import { a as hasResponsesWebSearchTool, s as convertMessages } from "../openai-completions-transport-BVV8L-MO.mjs";
|
|
6
|
+
import { Ct as reconcileOpenAIResponsesToolChoice, N as bindResponsesInputMessage, St as reconcileOpenAICompletionsToolChoice, _ as isResponsesTextContentPartType, d as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, f as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, g as isAzureResponsesTextDeltaEventType, h as isAzureResponsesTextDeltaEvent, l as createResponsesToolCallTracker, m as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, p as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, u as readResponsesToolCallItemIdentity, v as isResponsesTextDeltaEventType, xt as projectOpenAITools, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-CD3Sd1NC.mjs";
|
|
7
7
|
import { t as mapOpenAIStopReason } from "../openai-stop-reason-8s70vDXj.mjs";
|
|
8
8
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
9
|
-
import { n as responsesRequestLifecycle, t as independentResponsesRequest } from "../openai-responses-request-lifecycle-
|
|
10
|
-
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-
|
|
11
|
-
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-
|
|
9
|
+
import { n as responsesRequestLifecycle, t as independentResponsesRequest } from "../openai-responses-request-lifecycle-CsBFQkiW.mjs";
|
|
10
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-BXUVMZXy.mjs";
|
|
11
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-ytmKcG9V.mjs";
|
|
12
12
|
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, applyOpenAICompletionsToolReasoning, bindResponsesInputMessage, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, encodedModelRequestBodyStream, hasResponsesWebSearchTool, independentResponsesRequest, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, modelRequestBodyState, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesRequestLifecycle, responsesServiceTierObserver, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
export { parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs };
|
|
1
|
+
import { a as parseRetryAfterHeadersSeconds, i as parseRetryAfterErrorSeconds, n as parseGoogleRetryDelaySeconds, o as parseRetryAfterHttpDateMs, r as parseHttpDateInstant, s as parseRetryAfterTextSeconds, t as RETRY_AFTER_TEXT_RE } from "../retry-after-BrmTv0jL.mjs";
|
|
2
|
+
export { RETRY_AFTER_TEXT_RE, parseGoogleRetryDelaySeconds, parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs, parseRetryAfterTextSeconds };
|
|
@@ -110,6 +110,80 @@ function parseRetryAfterErrorSeconds(error, nowMs = Date.now()) {
|
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
function maxDefined(...values) {
|
|
114
|
+
let floor;
|
|
115
|
+
for (const value of values) if (value !== void 0) floor = Math.max(floor ?? 0, value);
|
|
116
|
+
return floor;
|
|
117
|
+
}
|
|
118
|
+
/** Provider prose such as "Please try again in 6s", "retry in 32s" or "Retry-After: 7". */
|
|
119
|
+
const RETRY_AFTER_TEXT_RE = /\b(?:retry[- ]after\b\s*:?\s*(?:in\b\s*)?|(?:please\s+)?(?:try again|retry) in\s+)([^\r\n;]+)/i;
|
|
120
|
+
const RETRY_TEXT_NUMBER_RE = /^(\d+(?:\.\d+)?|Infinity)\s*([a-z]+)?\b/i;
|
|
121
|
+
const MS_PER_SECOND = 1e3;
|
|
122
|
+
const RETRY_TEXT_UNIT_MS = new Map([
|
|
123
|
+
["milliseconds millisecond msecs msec ms", 1],
|
|
124
|
+
["seconds second secs sec s", MS_PER_SECOND],
|
|
125
|
+
["minutes minute mins min m", 60 * MS_PER_SECOND],
|
|
126
|
+
["hours hour hrs hr h", 3600 * MS_PER_SECOND],
|
|
127
|
+
["days day d", 86400 * MS_PER_SECOND]
|
|
128
|
+
].flatMap(([aliases, milliseconds]) => aliases.split(" ").map((alias) => [alias, milliseconds])));
|
|
129
|
+
/** Seconds named by a captured retry-text value: a number with an optional time unit, or an HTTP-date. */
|
|
130
|
+
function parseRetryAfterTextSeconds(valueText, nowMs = Date.now()) {
|
|
131
|
+
const secondsMatch = RETRY_TEXT_NUMBER_RE.exec(valueText);
|
|
132
|
+
if (secondsMatch?.[1]) {
|
|
133
|
+
const value = /^infinity$/i.test(secondsMatch[1]) ? Infinity : Number(secondsMatch[1]);
|
|
134
|
+
if (Number.isNaN(value) || value < 0) return;
|
|
135
|
+
const unitMilliseconds = RETRY_TEXT_UNIT_MS.get(secondsMatch[2]?.toLowerCase() ?? "s");
|
|
136
|
+
if (unitMilliseconds === void 0) return;
|
|
137
|
+
return unitMilliseconds === 1 ? value / MS_PER_SECOND : value * (unitMilliseconds / MS_PER_SECOND);
|
|
138
|
+
}
|
|
139
|
+
const retryAtMs = parseRetryAfterHttpDateMs(valueText, nowMs);
|
|
140
|
+
return retryAtMs === void 0 ? void 0 : Math.max(0, (retryAtMs - nowMs) / MS_PER_SECOND);
|
|
141
|
+
}
|
|
142
|
+
const GOOGLE_RETRY_DELAY_TEXT_RE = /"retryDelay"\s*:\s*"(\d+(?:\.\d{1,9})?)s"/g;
|
|
143
|
+
const GOOGLE_RETRY_DELAY_VALUE_RE = /^(\d+(?:\.\d{1,9})?)s$/;
|
|
144
|
+
const GOOGLE_RETRY_INFO_TYPE = "type.googleapis.com/google.rpc.RetryInfo";
|
|
145
|
+
const MAX_GOOGLE_ERROR_DETAILS = 16;
|
|
146
|
+
function googleRetryDelayTextSeconds(text) {
|
|
147
|
+
let floor;
|
|
148
|
+
for (const match of text.matchAll(GOOGLE_RETRY_DELAY_TEXT_RE)) floor = maxDefined(floor, Number(match[1]));
|
|
149
|
+
return floor;
|
|
150
|
+
}
|
|
151
|
+
function googleStatusRetryDelaySeconds(status) {
|
|
152
|
+
if (typeof status === "string") return googleRetryDelayTextSeconds(status);
|
|
153
|
+
const details = ownDataValue(status, "details");
|
|
154
|
+
if (!Array.isArray(details)) return;
|
|
155
|
+
let floor;
|
|
156
|
+
for (let index = 0; index < Math.min(details.length, MAX_GOOGLE_ERROR_DETAILS); index += 1) {
|
|
157
|
+
const detail = ownDataValue(details, String(index));
|
|
158
|
+
if (ownDataValue(detail, "@type") !== GOOGLE_RETRY_INFO_TYPE) continue;
|
|
159
|
+
const delay = ownDataValue(detail, "retryDelay");
|
|
160
|
+
const match = typeof delay === "string" ? GOOGLE_RETRY_DELAY_VALUE_RE.exec(delay) : null;
|
|
161
|
+
floor = maxDefined(floor, match?.[1] ? Number(match[1]) : void 0);
|
|
162
|
+
}
|
|
163
|
+
return floor;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Reads google.rpc.RetryInfo delays from raw error text or a google.rpc.Status-shaped body
|
|
167
|
+
* in any key order, with a fixed number of descriptor reads and no getters. Pass the
|
|
168
|
+
* untruncated body: Gemini puts RetryInfo after its QuotaFailure details.
|
|
169
|
+
*/
|
|
170
|
+
function parseGoogleRetryDelaySeconds(value) {
|
|
171
|
+
try {
|
|
172
|
+
if (typeof value === "string") return googleRetryDelayTextSeconds(value);
|
|
173
|
+
const response = ownDataValue(value, "response");
|
|
174
|
+
return maxDefined(...[
|
|
175
|
+
value,
|
|
176
|
+
ownDataValue(value, "error"),
|
|
177
|
+
ownDataValue(value, "message"),
|
|
178
|
+
ownDataValue(value, "errorBody"),
|
|
179
|
+
ownDataValue(value, "body"),
|
|
180
|
+
ownDataValue(response, "body"),
|
|
181
|
+
ownDataValue(response, "data")
|
|
182
|
+
].flatMap((candidate) => [googleStatusRetryDelaySeconds(candidate), typeof candidate === "string" ? void 0 : googleStatusRetryDelaySeconds(ownDataValue(candidate, "error"))]));
|
|
183
|
+
} catch {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
113
187
|
/** Round leap seconds forward for Retry-After so an unrepresentable instant cannot retry early. */
|
|
114
188
|
function parseRetryAfterHttpDateMs(value, nowMs = Date.now()) {
|
|
115
189
|
return parseHttpDateInstant(value, nowMs)?.timestampMs;
|
|
@@ -172,4 +246,4 @@ function parseHttpDateCalendarMs(components) {
|
|
|
172
246
|
return seconds === 60 ? timestamp + 1e3 : timestamp;
|
|
173
247
|
}
|
|
174
248
|
//#endregion
|
|
175
|
-
export { parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs };
|
|
249
|
+
export { RETRY_AFTER_TEXT_RE, parseGoogleRetryDelaySeconds, parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs, parseRetryAfterTextSeconds };
|
|
@@ -4,7 +4,7 @@ import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
|
4
4
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-D_MeCQFI.mjs";
|
|
5
5
|
import { f as extractToolResultText, l as describeToolResultMediaPlaceholder, n as buildBaseOptions, p as formatToolResultText, r as clampMaxTokensToModel, w as stripSystemPromptCacheBoundary } from "./simple-options-BdJJbzZk.mjs";
|
|
6
6
|
import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
7
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
7
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
8
8
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
9
9
|
import { t as boundResponseBody } from "./streaming-byte-guard-DBXr1XYn.mjs";
|
|
10
10
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|
package/dist/{openai-chatgpt-responses-BHkSHjkO.mjs → openai-chatgpt-responses-C97WXCjm.mjs}
RENAMED
|
@@ -14,10 +14,10 @@ import { c as resolveOpenAIResponsesTextFormat } from "./openai-completions-comp
|
|
|
14
14
|
import { n as buildManagedModelFetch } from "./host-policy-Ci1cKluf.mjs";
|
|
15
15
|
import { n as buildBaseOptions, w as stripSystemPromptCacheBoundary } from "./simple-options-BdJJbzZk.mjs";
|
|
16
16
|
import { S as withProviderResponseHook, b as transportAbortError, h as notifyProviderStreamOpened, n as assignTransportErrorDetails } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
17
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
18
|
-
import { Dt as createOpenAIResponseHook, E as ResponsesStreamFailure, Et as createOpenAIProviderAcceptanceHook, F as convertProviderResponsesMessages, Ot as createResponseModelTracker, S as isInvalidEncryptedContentError, T as resolveNextResponsesEncryptedContentAttempt, _t as resolveOpenAIRequestReasoning, b as commitResponsesEncryptedContentAttempt, i as convertResponsesToolPayload, j as recordResponsesContextUsage, n as applyResponsesServiceTierPricing, o as readOpenAIMisalignmentReview, ot as suppressOpenAIResponsesCompaction, rt as buildOpenAIResponsesReasoningReplayMetadata, s as processResponsesStream, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-
|
|
17
|
+
import { t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
18
|
+
import { Dt as createOpenAIResponseHook, E as ResponsesStreamFailure, Et as createOpenAIProviderAcceptanceHook, F as convertProviderResponsesMessages, Ot as createResponseModelTracker, S as isInvalidEncryptedContentError, T as resolveNextResponsesEncryptedContentAttempt, _t as resolveOpenAIRequestReasoning, b as commitResponsesEncryptedContentAttempt, i as convertResponsesToolPayload, j as recordResponsesContextUsage, n as applyResponsesServiceTierPricing, o as readOpenAIMisalignmentReview, ot as suppressOpenAIResponsesCompaction, rt as buildOpenAIResponsesReasoningReplayMetadata, s as processResponsesStream, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
19
19
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-D_TfJHRJ.mjs";
|
|
20
|
-
import { a as createResponsesV2CompactionCollector, i as createResponsesPromptEgressObserver, n as responsesRequestLifecycle, o as claimResponsesCompactRequest, r as withResponsesRequestAcceptance, s as copyResponsesCompactRequest, t as independentResponsesRequest } from "./openai-responses-request-lifecycle-
|
|
20
|
+
import { a as createResponsesV2CompactionCollector, i as createResponsesPromptEgressObserver, n as responsesRequestLifecycle, o as claimResponsesCompactRequest, r as withResponsesRequestAcceptance, s as copyResponsesCompactRequest, t as independentResponsesRequest } from "./openai-responses-request-lifecycle-CsBFQkiW.mjs";
|
|
21
21
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
|
22
22
|
import { n as resolveOpenAICodexAccountId } from "./openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
23
23
|
//#region packages/ai/src/providers/openai-chatgpt-responses-events.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { n as __exportAll } from "./reasoning-tag-text-partitioner-DzlRubwU.mjs";
|
|
2
2
|
import { k as clampThinkingLevel } from "./host-rCxf5Tjd.mjs";
|
|
3
3
|
import { n as buildBaseOptions } from "./simple-options-BdJJbzZk.mjs";
|
|
4
|
-
import { n as streamOpenAICompletionsRequest, s as convertMessages } from "./openai-completions-transport-
|
|
4
|
+
import { n as streamOpenAICompletionsRequest, s as convertMessages } from "./openai-completions-transport-BVV8L-MO.mjs";
|
|
5
5
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
|
6
6
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
7
7
|
var openai_completions_exports = /* @__PURE__ */ __exportAll({
|
package/dist/{openai-completions-transport-CqomHW1O.mjs → openai-completions-transport-BVV8L-MO.mjs}
RENAMED
|
@@ -22,20 +22,20 @@ import { A as shortHash, E as createToolArgumentPreviewSchedule, M as racePromis
|
|
|
22
22
|
import { C as redactIdentifier, w as sha256Hex } from "./tool-schema-json-projection-Cvq69Ajp.mjs";
|
|
23
23
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
24
24
|
import { n as isProviderReplayContext, r as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-BC23HyZo.mjs";
|
|
25
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
25
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
26
26
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
27
27
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
28
28
|
import { isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
|
|
29
29
|
import "./types.mjs";
|
|
30
|
-
import { $ as isConfigurationUpdate, A as summarizeResponsesPayload, At as isOpenAICompletionsThinkingEnabled, B as recordResponsesInputReplay, C as readResponsesRecoveryEvent, Ct as reconcileOpenAIResponsesToolChoice, D as logResponsesFailedNoDetails, E as ResponsesStreamFailure, Et as createOpenAIProviderAcceptanceHook, Ft as readOpenAICompletionsReasoningBatch, G as responsesContinuationPrefixFingerprint, H as claimOpenAIResponsesHttpContinuation, I as convertResponsesMessages, It as resolveOpenAIClientBaseUrl, K as responsesContinuationRequestFingerprint, Lt as resolvePromptCacheKey, Mt as measureUtf8AppendBytes, Nt as parseOpenAICompletionsUsage, O as safeDebugValue, Ot as createResponseModelTracker, P as buildResponsesInputMessage, Pt as readOpenAICompletionsContentDeltas, Rt as withOpenAIErrorResponseHook, S as isInvalidEncryptedContentError, St as reconcileOpenAICompletionsToolChoice, T as resolveNextResponsesEncryptedContentAttempt, Tt as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, U as recordResponsesContinuationState, V as responsesInputFingerprint, W as resolveResponsesContinuationRequest, _t as resolveOpenAIRequestReasoning, a as prepareResponsesTools, bt as prepareOpenAITools, c as observeResponsesStream, ct as buildOpenAIClientHeaders, dt as enforceCodeModeResponsesToolSurface, et as replayResponsesReasoningUpdates, gt as resolveOpenAIStrictToolFlagWithDiagnostics, ht as resolveCodeModeResponsesVisibleToolNames, j as recordResponsesContextUsage, jt as log, k as summarizeOpenAITransportError, kt as detachPartialSnapshot, lt as buildOpenAISdkClientOptions, n as applyResponsesServiceTierPricing, ot as suppressOpenAIResponsesCompaction, pt as getCompat, rt as buildOpenAIResponsesReasoningReplayMetadata, s as processResponsesStream, st as assertCodeModeResponsesToolSurface, tt as supportsResponsesReasoningUpdate, ut as buildOpenAISdkRequestOptions, vt as resolveOpenAISimpleReasoningEffort, w as resolveAzureOpenAIApiVersion, wt as toOpenAIResponsesToolChoice, x as createResponsesStreamWithRecovery, xt as projectOpenAITools, z as readResponsesInputReplayState } from "./openai-responses-shared-
|
|
31
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders, r as resolveProviderTransportTurnState, t as filterProviderTurnHeadersForExplicitOpencodeSession } from "./provider-transport-turn-state-
|
|
30
|
+
import { $ as isConfigurationUpdate, A as summarizeResponsesPayload, At as isOpenAICompletionsThinkingEnabled, B as recordResponsesInputReplay, C as readResponsesRecoveryEvent, Ct as reconcileOpenAIResponsesToolChoice, D as logResponsesFailedNoDetails, E as ResponsesStreamFailure, Et as createOpenAIProviderAcceptanceHook, Ft as readOpenAICompletionsReasoningBatch, G as responsesContinuationPrefixFingerprint, H as claimOpenAIResponsesHttpContinuation, I as convertResponsesMessages, It as resolveOpenAIClientBaseUrl, K as responsesContinuationRequestFingerprint, Lt as resolvePromptCacheKey, Mt as measureUtf8AppendBytes, Nt as parseOpenAICompletionsUsage, O as safeDebugValue, Ot as createResponseModelTracker, P as buildResponsesInputMessage, Pt as readOpenAICompletionsContentDeltas, Rt as withOpenAIErrorResponseHook, S as isInvalidEncryptedContentError, St as reconcileOpenAICompletionsToolChoice, T as resolveNextResponsesEncryptedContentAttempt, Tt as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, U as recordResponsesContinuationState, V as responsesInputFingerprint, W as resolveResponsesContinuationRequest, _t as resolveOpenAIRequestReasoning, a as prepareResponsesTools, bt as prepareOpenAITools, c as observeResponsesStream, ct as buildOpenAIClientHeaders, dt as enforceCodeModeResponsesToolSurface, et as replayResponsesReasoningUpdates, gt as resolveOpenAIStrictToolFlagWithDiagnostics, ht as resolveCodeModeResponsesVisibleToolNames, j as recordResponsesContextUsage, jt as log, k as summarizeOpenAITransportError, kt as detachPartialSnapshot, lt as buildOpenAISdkClientOptions, n as applyResponsesServiceTierPricing, ot as suppressOpenAIResponsesCompaction, pt as getCompat, rt as buildOpenAIResponsesReasoningReplayMetadata, s as processResponsesStream, st as assertCodeModeResponsesToolSurface, tt as supportsResponsesReasoningUpdate, ut as buildOpenAISdkRequestOptions, vt as resolveOpenAISimpleReasoningEffort, w as resolveAzureOpenAIApiVersion, wt as toOpenAIResponsesToolChoice, x as createResponsesStreamWithRecovery, xt as projectOpenAITools, z as readResponsesInputReplayState } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
31
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders, r as resolveProviderTransportTurnState, t as filterProviderTurnHeadersForExplicitOpencodeSession } from "./provider-transport-turn-state-Dm6Qh366.mjs";
|
|
32
32
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-D_TfJHRJ.mjs";
|
|
33
33
|
import { t as boundResponseBody } from "./streaming-byte-guard-DBXr1XYn.mjs";
|
|
34
34
|
import { b as prepareOpenAIFunctionTool, f as normalizeToolSchema, p as withPreparedToolSchemaNormalization, r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-CGhEl7ao.mjs";
|
|
35
35
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|
|
36
36
|
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
37
37
|
import { a as isOpenAIResponsesCompactionOutput, c as applyOpenAIResponsesPayloadPolicy, d as resolveOpenAIResponsesPayloadPolicy, i as getOpenAIResponsesCompactionOutputError, n as supportsNativeOpenAIResponsesEndpoint, r as createBoundedOpenAIResponsesCompactionFetch, s as sanitizeResponsesImagePayload, t as isOfficialOpenAIResponsesBaseUrl } from "./openai-responses-endpoint-JbBT8IDv.mjs";
|
|
38
|
-
import { a as createResponsesV2CompactionCollector, i as createResponsesPromptEgressObserver, n as responsesRequestLifecycle, o as claimResponsesCompactRequest, r as withResponsesRequestAcceptance, t as independentResponsesRequest } from "./openai-responses-request-lifecycle-
|
|
38
|
+
import { a as createResponsesV2CompactionCollector, i as createResponsesPromptEgressObserver, n as responsesRequestLifecycle, o as claimResponsesCompactRequest, r as withResponsesRequestAcceptance, t as independentResponsesRequest } from "./openai-responses-request-lifecycle-CsBFQkiW.mjs";
|
|
39
39
|
import { randomUUID } from "node:crypto";
|
|
40
40
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
41
41
|
import { ResponsesWS } from "openai/resources/responses/ws.js";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./index-DSprYWaz.mjs";
|
|
2
2
|
import { a as AssistantMessage, k as Model } from "./types-CVYzKrMl.mjs";
|
|
3
3
|
import "./provider-options-Bo8GzTGX.mjs";
|
|
4
|
-
import { i as ReplayableResponseCompactionItem, r as OpenAIResponsesReasoningReplayMetadata, u as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-
|
|
4
|
+
import { i as ReplayableResponseCompactionItem, r as OpenAIResponsesReasoningReplayMetadata, u as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-gnl6ZRs1.mjs";
|
|
5
5
|
import "openai/resources/responses/responses.js";
|
|
6
6
|
//#region packages/ai/src/transports/openai-responses-compaction-replay.d.ts
|
|
7
7
|
declare function captureOpenAIResponsesCompaction(output: Pick<AssistantMessage, "providerReplay">, item: ReplayableResponseCompactionItem, boundary: number | "retained-users", model: Model, captureMetadata?: OpenAIResponsesReasoningReplayMetadata, compactedOutput?: OpenAIResponsesCompactionOutput, outputTokens?: number): void;
|
package/dist/{openai-responses-contracts-D-VwWWjx.d.mts → openai-responses-contracts-gnl6ZRs1.d.mts}
RENAMED
|
@@ -53,6 +53,12 @@ type ResponsesPromptObservation = {
|
|
|
53
53
|
expectedChars: number;
|
|
54
54
|
observedChars: number;
|
|
55
55
|
matchesAssembledPrompt: boolean;
|
|
56
|
+
model?: string;
|
|
57
|
+
reasoningEffort?: string;
|
|
58
|
+
sessionsSpawn?: {
|
|
59
|
+
strict?: boolean;
|
|
60
|
+
categoryRequired: boolean;
|
|
61
|
+
};
|
|
56
62
|
};
|
|
57
63
|
type ResponsesPromptObserver = (observation: ResponsesPromptObservation) => void;
|
|
58
64
|
declare const responsesPromptObserver: {
|
|
@@ -5,7 +5,7 @@ import "./transport-utils-CcCAuFVS.mjs";
|
|
|
5
5
|
import { w as stripSystemPromptCacheBoundary } from "./simple-options-BdJJbzZk.mjs";
|
|
6
6
|
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
7
7
|
import { w as sha256Hex } from "./tool-schema-json-projection-Cvq69Ajp.mjs";
|
|
8
|
-
import { rt as buildOpenAIResponsesReasoningReplayMetadata } from "./openai-responses-shared-
|
|
8
|
+
import { rt as buildOpenAIResponsesReasoningReplayMetadata } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
9
9
|
import { a as isOpenAIResponsesCompactionOutput, s as sanitizeResponsesImagePayload } from "./openai-responses-endpoint-JbBT8IDv.mjs";
|
|
10
10
|
//#region packages/ai/src/transports/openai-responses-compact-request.ts
|
|
11
11
|
const COMPACT_REQUEST = Symbol("openaiResponsesCompactRequest");
|
|
@@ -169,6 +169,16 @@ function retainV2Users(input) {
|
|
|
169
169
|
}
|
|
170
170
|
//#endregion
|
|
171
171
|
//#region packages/ai/src/transports/openai-responses-prompt-observer-internal.ts
|
|
172
|
+
function readSessionsSpawnSchema(tools) {
|
|
173
|
+
if (!Array.isArray(tools)) return;
|
|
174
|
+
const tool = tools.find((candidate) => isRecord(candidate) && candidate.name === "sessions_spawn");
|
|
175
|
+
if (!isRecord(tool)) return;
|
|
176
|
+
const parameters = isRecord(tool.parameters) ? tool.parameters : void 0;
|
|
177
|
+
return {
|
|
178
|
+
...typeof tool.strict === "boolean" ? { strict: tool.strict } : {},
|
|
179
|
+
categoryRequired: Array.isArray(parameters?.required) && parameters.required.includes("category")
|
|
180
|
+
};
|
|
181
|
+
}
|
|
172
182
|
function readFinalResponsesPrompt(request) {
|
|
173
183
|
if (typeof request.instructions === "string") return ["instructions", request.instructions];
|
|
174
184
|
const message = (Array.isArray(request.input) ? request.input : []).find((item) => {
|
|
@@ -186,12 +196,16 @@ function createResponsesPromptEgressObserver(options, assembledPrompt) {
|
|
|
186
196
|
const expectedPrompt = sanitizeTransportPayloadText(stripSystemPromptCacheBoundary(assembledPrompt ?? ""));
|
|
187
197
|
return (request, metadata) => {
|
|
188
198
|
const [promptSource, observedPrompt] = readFinalResponsesPrompt(request);
|
|
199
|
+
const sessionsSpawn = readSessionsSpawnSchema(request.tools);
|
|
189
200
|
observer({
|
|
190
201
|
...metadata,
|
|
191
202
|
promptSource,
|
|
192
203
|
expectedChars: expectedPrompt.length,
|
|
193
204
|
observedChars: observedPrompt.length,
|
|
194
|
-
matchesAssembledPrompt: promptSource !== "missing" && observedPrompt === expectedPrompt
|
|
205
|
+
matchesAssembledPrompt: promptSource !== "missing" && observedPrompt === expectedPrompt,
|
|
206
|
+
...typeof request.model === "string" ? { model: request.model } : {},
|
|
207
|
+
...typeof request.reasoning?.effort === "string" ? { reasoningEffort: request.reasoning.effort } : {},
|
|
208
|
+
...sessionsSpawn ? { sessionsSpawn } : {}
|
|
195
209
|
});
|
|
196
210
|
};
|
|
197
211
|
}
|
|
@@ -19,7 +19,7 @@ import { d as extractToolResultBlockText, f as extractToolResultText, h as prepa
|
|
|
19
19
|
import { A as shortHash, C as parseJsonObjectPreservingUnsafeIntegers, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, S as withProviderResponseHook, b as transportAbortError, c as failTransportStream, d as iterateModelStream, g as parseTerminalToolCallArguments, m as notifyProviderHttpResponse, t as IncompleteToolCallError, u as finalizeTransportStream, v as sanitizeTransportPayloadText } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
20
20
|
import { C as redactIdentifier, n as prepareRuntimeToolInputSchema, r as projectRuntimeToolInputSchema, w as sha256Hex } from "./tool-schema-json-projection-Cvq69Ajp.mjs";
|
|
21
21
|
import { n as isProviderReplayContext, r as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-BC23HyZo.mjs";
|
|
22
|
-
import { n as transformProviderMessages } from "./assistant-output-
|
|
22
|
+
import { n as transformProviderMessages } from "./assistant-output-BdFoDBYQ.mjs";
|
|
23
23
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
24
24
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
25
25
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-D_TfJHRJ.mjs";
|
|
@@ -5,9 +5,9 @@ import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat
|
|
|
5
5
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-Dttf8jKq.mjs";
|
|
6
6
|
import { n as buildBaseOptions } from "./simple-options-BdJJbzZk.mjs";
|
|
7
7
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
8
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
9
|
-
import { F as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-
|
|
10
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-
|
|
8
|
+
import { t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
9
|
+
import { F as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams, vt as resolveOpenAISimpleReasoningEffort } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
10
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-Dm6Qh366.mjs";
|
|
11
11
|
import { t as requireApiKey } from "./required-api-key-D088S4Cd.mjs";
|
|
12
12
|
//#region packages/ai/src/providers/openai-responses.ts
|
|
13
13
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { r as getAiTransportHost } from "./host-rCxf5Tjd.mjs";
|
|
2
2
|
import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-Dttf8jKq.mjs";
|
|
3
3
|
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
|
|
4
|
-
import { It as resolveOpenAIClientBaseUrl, Rt as withOpenAIErrorResponseHook } from "./openai-responses-shared-
|
|
4
|
+
import { It as resolveOpenAIClientBaseUrl, Rt as withOpenAIErrorResponseHook } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import OpenAI from "openai";
|
|
7
7
|
//#region packages/ai/src/providers/openai-provider-client.ts
|
|
@@ -3,6 +3,7 @@ import { a as AssistantMessage, d as Context, dt as ToolResultMessage, k as Mode
|
|
|
3
3
|
import "./types-CBJthzJX.mjs";
|
|
4
4
|
//#region packages/ai/src/provider-types.d.ts
|
|
5
5
|
declare const PROVIDER_CONTEXT_HANDOFF: unique symbol;
|
|
6
|
+
declare const PROVIDER_MODEL_INPUT: unique symbol;
|
|
6
7
|
type VideoContent = Omit<ImageContent, "type"> & {
|
|
7
8
|
type: "video";
|
|
8
9
|
};
|
|
@@ -21,9 +22,10 @@ type ProviderModel<TApi extends Api = Api> = Omit<Model<TApi>, "input"> & {
|
|
|
21
22
|
type ProviderContextHandoff = () => Promise<ProviderContext>;
|
|
22
23
|
type ProviderStreamOptions = StreamOptions & {
|
|
23
24
|
[PROVIDER_CONTEXT_HANDOFF]?: ProviderContextHandoff;
|
|
25
|
+
[PROVIDER_MODEL_INPUT]?: ProviderModel["input"];
|
|
24
26
|
};
|
|
25
27
|
type ProviderStreamFunction<TApi extends Api = Api, TOptions extends StreamOptions = ProviderStreamOptions> = (model: ProviderModel<TApi>, context: ProviderContext, options?: TOptions) => AssistantMessageEventStreamContract;
|
|
26
28
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
27
29
|
declare function resolveProviderContext(context: Context | ProviderContext, options?: ProviderStreamOptions): Promise<ProviderContext>;
|
|
28
30
|
//#endregion
|
|
29
|
-
export {
|
|
31
|
+
export { ProviderContext as a, ProviderModel as c, ProviderUserMessage as d, VideoContent as f, PROVIDER_MODEL_INPUT as i, ProviderStreamFunction as l, ModelInputContent as n, ProviderContextHandoff as o, resolveProviderContext as p, PROVIDER_CONTEXT_HANDOFF as r, ProviderMessage as s, MediaContent as t, ProviderStreamOptions as u };
|
|
@@ -2,5 +2,5 @@ import { A as supportsClaudeInHistorySystemMessages, C as resolveClaudeOpus55Mod
|
|
|
2
2
|
import { $ as StopReason, A as ModelCostConfig, At as extractDiagnosticError, B as ProviderImagesOptions, C as KnownApi, Ct as readRuntimeContextMetadata, D as MaybePromise, Dt as DiagnosticErrorInfo, E as MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, Et as AssistantMessageDiagnostic, F as OpenRouterRouting, G as RUNTIME_CONTEXT_CUSTOM_TYPE, H as ProviderResponse, I as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, J as RUNTIME_CONTEXT_HEADER, K as RUNTIME_CONTEXT_END_MARKER, L as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, M as ModelThinkingLevel, Mt as isProviderRefusalAssistantError, N as OpenAICompletionsCompat, Ot as appendAssistantMessageDiagnostic, P as OpenAIResponsesCompat, Q as SimpleStreamOptions, R as PricingTier, S as ImagesStopReason, St as labelRuntimeContextText, T as KnownImagesProvider, Tt as setRuntimeContextRetention, V as ProviderReplayState, W as RUNTIME_CONTEXT_BEGIN_MARKER, X as RawPricingTier, Y as RawModelCostConfig, Z as RuntimeContextMessage, _ as ImagesInputContent, _t as escapeRuntimeContextFooter, a as AssistantMessage, at as ThinkingBudgets, b as ImagesOutputContent, bt as isRuntimeContextMessage, c as AssistantMessageEventStreamLike, ct as ThinkingLevelMap, dt as ToolResultMessage, et as StreamFn, f as DEFAULT_MISSING_TOOL_RESULT_TEXT, ft as Transport, g as ImagesFunction, gt as VercelGatewayRouting, h as ImagesContext, ht as ValidateToolArgumentsFn, i as AssistantImages, it as TextSignatureV1, j as ModelCostRates, jt as formatThrownValue, kt as createAssistantMessageDiagnostic, l as CacheRetention, lt as Tool, m as ImagesApi, mt as UserMessage, n as Api, nt as StreamOptions, o as AssistantMessageEvent, ot as ThinkingContent, p as ImageContent, pt as Usage, q as RUNTIME_CONTEXT_FOOTER, r as AssistantDeliveryTtsFacts, rt as TextContent, s as AssistantMessageEventStreamContract, st as ThinkingLevel, t as AnthropicMessagesCompat, u as CompleteSimpleFn, ut as ToolCall, v as ImagesModel, vt as hasLegacyRuntimeContextEnvelope, w as KnownImagesApi, wt as runtimeContextContentToText, x as ImagesProvider, xt as labelRuntimeContextContent, y as ImagesOptions, yt as hasRuntimeContextMarker, z as Provider } from "./types-CVYzKrMl.mjs";
|
|
3
3
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-CzpE1g_o.mjs";
|
|
4
4
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-BQ5u20Ru.mjs";
|
|
5
|
-
import { a as
|
|
6
|
-
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, type validateToolArguments, type validateToolCall };
|
|
5
|
+
import { a as ProviderContext, c as ProviderModel, d as ProviderUserMessage, f as VideoContent, i as PROVIDER_MODEL_INPUT, l as ProviderStreamFunction, n as ModelInputContent, o as ProviderContextHandoff, p as resolveProviderContext, r as PROVIDER_CONTEXT_HANDOFF, s as ProviderMessage, t as MediaContent, u as ProviderStreamOptions } from "./provider-types-CWl4VXvE.mjs";
|
|
6
|
+
export { type AnthropicMessagesCompat, type Api, type AssistantDeliveryTtsFacts, type AssistantImages, type AssistantMessage, type AssistantMessageDiagnostic, type AssistantMessageEvent, type AssistantMessageEventStream, type AssistantMessageEventStreamContract, type AssistantMessageEventStreamLike, type CLAUDE_FABLE_5_THINKING_PROFILE, type CLAUDE_HAIKU_55_THINKING_PROFILE, type CLAUDE_OPUS_55_THINKING_PROFILE, type CLAUDE_OPUS_5_THINKING_PROFILE, type CLAUDE_SONNET_55_THINKING_PROFILE, type CLAUDE_SONNET_5_THINKING_PROFILE, type CacheRetention, type CompleteSimpleFn, type ProviderContext as Context, ProviderContext, type DEFAULT_MISSING_TOOL_RESULT_TEXT, type DiagnosticErrorInfo, type EventStream, type ImageContent, type ImagesApi, type ImagesContext, type ImagesFunction, type ImagesInputContent, type ImagesModel, type ImagesOptions, type ImagesOutputContent, type ImagesProvider, type ImagesStopReason, type KnownApi, type KnownImagesApi, type KnownImagesProvider, type MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, type MaybePromise, MediaContent, type ProviderMessage as Message, ProviderMessage, type ProviderModel as Model, ProviderModel, type ModelCostConfig, type ModelCostRates, ModelInputContent, type ModelThinkingLevel, type OpenAICompletionsCompat, type OpenAIResponsesCompat, type OpenRouterRouting, PROVIDER_CONTEXT_HANDOFF, type PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_MODEL_INPUT, type PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, type PricingTier, type Provider, ProviderContextHandoff, type ProviderImagesOptions, type ProviderRefusalReview, type ProviderReplayState, type ProviderResponse, ProviderStreamFunction, type ProviderStreamFunction as StreamFunction, ProviderStreamOptions, ProviderUserMessage, type RUNTIME_CONTEXT_BEGIN_MARKER, type RUNTIME_CONTEXT_CUSTOM_TYPE, type RUNTIME_CONTEXT_END_MARKER, type RUNTIME_CONTEXT_FOOTER, type RUNTIME_CONTEXT_HEADER, type RawModelCostConfig, type RawPricingTier, type RuntimeContextMessage, type SimpleStreamOptions, type StopReason, type StreamFn, type StreamOptions, type TextContent, type TextSignatureV1, type ThinkingBudgets, type ThinkingContent, type ThinkingLevel, type ThinkingLevelMap, type Tool, type ToolCall, type ToolResultMessage, type Transport, type Usage, type UserMessage, type ValidateToolArgumentsFn, type VercelGatewayRouting, VideoContent, type appendAssistantMessageDiagnostic, type appendTextDeltaToAssistantMessage, type bindsClaudeThinkingPrefix, type calculateUsageCost, type createAssistantMessageDiagnostic, type createAssistantMessageEventStream, type escapeRuntimeContextFooter, type extractDiagnosticError, type formatThrownValue, type hasLegacyRuntimeContextEnvelope, type hasRuntimeContextMarker, type isProviderRefusalAssistantError, type isRuntimeContextMessage, type labelRuntimeContextContent, type labelRuntimeContextText, type normalizeModelCostConfig, type normalizeResolvedPricing, type readProviderRefusalReview, type readRuntimeContextMetadata, type requiresClaudeBetweenToolsThinking, type requiresClaudeDefaultSampling, type requiresClaudeMandatoryAdaptiveThinking, type resolveClaudeFable5ModelIdentity, type resolveClaudeHaiku55ModelIdentity, type resolveClaudeModelIdentity, type resolveClaudeMythos5ModelIdentity, type resolveClaudeNativeThinkingLevelMap, type resolveClaudeOpus55ModelIdentity, type resolveClaudeOpus5ModelIdentity, type resolveClaudeSonnet55ModelIdentity, type resolveClaudeSonnet5ModelIdentity, resolveProviderContext, type runtimeContextContentToText, type setRuntimeContextRetention, type supportsClaude1MContext, type supportsClaudeAdaptiveThinking, type supportsClaudeFastMode, type supportsClaudeInHistorySystemMessages, type supportsClaudeNativeMaxEffort, type supportsClaudeNativeXhighEffort, type supportsClaudeServerCompaction, type validateToolArguments, type validateToolCall };
|
package/dist/provider-types.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
//#region packages/ai/src/provider-types.ts
|
|
2
2
|
const PROVIDER_CONTEXT_HANDOFF = Symbol("providerContextHandoff");
|
|
3
|
+
const PROVIDER_MODEL_INPUT = Symbol("providerModelInput");
|
|
3
4
|
/** Resolves provider-only context without widening the canonical call contract. */
|
|
4
5
|
async function resolveProviderContext(context, options) {
|
|
5
6
|
return options?.[PROVIDER_CONTEXT_HANDOFF]?.() ?? context;
|
|
6
7
|
}
|
|
7
8
|
//#endregion
|
|
8
|
-
export { PROVIDER_CONTEXT_HANDOFF, resolveProviderContext };
|
|
9
|
+
export { PROVIDER_CONTEXT_HANDOFF, PROVIDER_MODEL_INPUT, resolveProviderContext };
|
package/dist/providers.mjs
CHANGED
|
@@ -50,39 +50,39 @@ function createLazyRegistration(api, importModule, select) {
|
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
52
|
const registerBuiltIns = [
|
|
53
|
-
createLazyRegistration("anthropic-messages", () => import("./anthropic-
|
|
53
|
+
createLazyRegistration("anthropic-messages", () => import("./anthropic-Do60LsIj.mjs").then((n) => n.t), (module) => ({
|
|
54
54
|
stream: module.streamAnthropic,
|
|
55
55
|
streamSimple: module.streamSimpleAnthropic
|
|
56
56
|
})),
|
|
57
|
-
createLazyRegistration("openai-completions", () => import("./openai-completions-
|
|
57
|
+
createLazyRegistration("openai-completions", () => import("./openai-completions-BXUVMZXy.mjs").then((n) => n.t), (module) => ({
|
|
58
58
|
stream: module.streamOpenAICompletions,
|
|
59
59
|
streamSimple: module.streamSimpleOpenAICompletions
|
|
60
60
|
})),
|
|
61
|
-
createLazyRegistration("mistral-conversations", () => import("./mistral-
|
|
61
|
+
createLazyRegistration("mistral-conversations", () => import("./mistral-CXSRuQbO.mjs"), (module) => ({
|
|
62
62
|
stream: module.streamMistral,
|
|
63
63
|
streamSimple: module.streamSimpleMistral
|
|
64
64
|
})),
|
|
65
|
-
createLazyRegistration("openai-responses", () => import("./openai-responses-
|
|
65
|
+
createLazyRegistration("openai-responses", () => import("./openai-responses-ytmKcG9V.mjs").then((n) => n.t), (module) => ({
|
|
66
66
|
stream: module.streamOpenAIResponses,
|
|
67
67
|
streamSimple: module.streamSimpleOpenAIResponses
|
|
68
68
|
})),
|
|
69
|
-
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-
|
|
69
|
+
createLazyRegistration("azure-openai-responses", () => import("./azure-openai-responses-DojP0OrF.mjs"), (module) => ({
|
|
70
70
|
stream: module.streamAzureOpenAIResponses,
|
|
71
71
|
streamSimple: module.streamSimpleAzureOpenAIResponses
|
|
72
72
|
})),
|
|
73
|
-
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-
|
|
73
|
+
createLazyRegistration("openai-chatgpt-responses", () => import("./openai-chatgpt-responses-C97WXCjm.mjs"), (module) => ({
|
|
74
74
|
stream: module.streamOpenAICodexResponses,
|
|
75
75
|
streamSimple: module.streamSimpleOpenAICodexResponses
|
|
76
76
|
})),
|
|
77
|
-
createLazyRegistration("google-generative-ai", () => import("./google-
|
|
77
|
+
createLazyRegistration("google-generative-ai", () => import("./google-D0QA9Xum.mjs"), (module) => ({
|
|
78
78
|
stream: module.streamGoogle,
|
|
79
79
|
streamSimple: module.streamSimpleGoogle
|
|
80
80
|
})),
|
|
81
|
-
createLazyRegistration("google-interactions", () => import("./google-interactions-
|
|
81
|
+
createLazyRegistration("google-interactions", () => import("./google-interactions-B7mZhG4e.mjs"), (module) => ({
|
|
82
82
|
stream: module.streamGoogleInteractions,
|
|
83
83
|
streamSimple: module.streamSimpleGoogleInteractions
|
|
84
84
|
})),
|
|
85
|
-
createLazyRegistration("google-vertex", () => import("./google-vertex-
|
|
85
|
+
createLazyRegistration("google-vertex", () => import("./google-vertex-sjKMbIUP.mjs"), (module) => ({
|
|
86
86
|
stream: module.streamGoogleVertex,
|
|
87
87
|
streamSimple: module.streamSimpleGoogleVertex
|
|
88
88
|
}))
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region packages/ai/src/internal/retry-after.d.ts
|
|
2
|
+
type HttpDateInstant = {
|
|
3
|
+
timestampMs: number;
|
|
4
|
+
leapSecond: boolean;
|
|
5
|
+
};
|
|
6
|
+
/** Reads only retry timing metadata, without invoking provider getters or serialization hooks. */
|
|
7
|
+
declare function parseRetryAfterHeadersSeconds(headers: unknown, nowMs?: number, status?: number): number | undefined;
|
|
8
|
+
/** SDK errors carry native response headers separately from their error body. */
|
|
9
|
+
declare function parseRetryAfterErrorSeconds(error: unknown, nowMs?: number): number | undefined;
|
|
10
|
+
/** Provider prose such as "Please try again in 6s", "retry in 32s" or "Retry-After: 7". */
|
|
11
|
+
declare const RETRY_AFTER_TEXT_RE: RegExp;
|
|
12
|
+
/** Seconds named by a captured retry-text value: a number with an optional time unit, or an HTTP-date. */
|
|
13
|
+
declare function parseRetryAfterTextSeconds(valueText: string, nowMs?: number): number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Reads google.rpc.RetryInfo delays from raw error text or a google.rpc.Status-shaped body
|
|
16
|
+
* in any key order, with a fixed number of descriptor reads and no getters. Pass the
|
|
17
|
+
* untruncated body: Gemini puts RetryInfo after its QuotaFailure details.
|
|
18
|
+
*/
|
|
19
|
+
declare function parseGoogleRetryDelaySeconds(value: unknown): number | undefined;
|
|
20
|
+
/** Round leap seconds forward for Retry-After so an unrepresentable instant cannot retry early. */
|
|
21
|
+
declare function parseRetryAfterHttpDateMs(value: string, nowMs?: number): number | undefined;
|
|
22
|
+
/** Parse all three HTTP-date forms while retaining leap-second ordering. */
|
|
23
|
+
declare function parseHttpDateInstant(value: string, nowMs?: number): HttpDateInstant | undefined;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { parseRetryAfterHeadersSeconds as a, parseRetryAfterErrorSeconds as i, parseGoogleRetryDelaySeconds as n, parseRetryAfterHttpDateMs as o, parseHttpDateInstant as r, parseRetryAfterTextSeconds as s, RETRY_AFTER_TEXT_RE as t };
|
package/dist/transports.d.mts
CHANGED
|
@@ -6,12 +6,12 @@ import { a as BaseOpenAIStreamOptions, c as OpenAICompletionsOptions, l as OpenA
|
|
|
6
6
|
import "./types-CBJthzJX.mjs";
|
|
7
7
|
import { a as buildAnthropicSystemBlocks, c as logAnthropicContextEdits, d as resolveAnthropicPayloadPolicy, f as resolveAnthropicRequestBetaHeader, i as applyAnthropicRequestCacheControl, l as resolveAnthropicCacheOptions, m as supportsAnthropicServerSideFallback, n as applyAnthropicEphemeralCacheControlMarkers, o as isAnthropicServerToolClearingEnabled, p as resolveAnthropicServerCompactionPlan, r as applyAnthropicPayloadPolicyToParams, s as isDirectAnthropicModel, t as applyAnthropicContextManagementToRequest, u as resolveAnthropicEphemeralCacheControl } from "./anthropic-payload-policy-rqCq9sT_.mjs";
|
|
8
8
|
import { a as resolveOpenAICompletionsCompat, i as isOpenAICodexResponsesModel, n as detectOpenAICompletionsCompat, o as resolveOpenAIPromptCacheKeySupport, r as isNativeOpenAIEndpoint, s as usesNativeOpenAICodexResponsesBackend, t as ResolvedOpenAICompletionsCompat } from "./openai-completions-compat-CBvb2eld.mjs";
|
|
9
|
-
import { a as ReplayableResponseReasoningItem, n as OpenAIResponsesOptions, r as OpenAIResponsesReasoningReplayMetadata, u as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-
|
|
9
|
+
import { a as ReplayableResponseReasoningItem, n as OpenAIResponsesOptions, r as OpenAIResponsesReasoningReplayMetadata, u as OpenAIResponsesCompactionOutput } from "./openai-responses-contracts-gnl6ZRs1.mjs";
|
|
10
10
|
import { a as resolveOpenAIResponsesPayloadPolicy, i as resolveOpenAIResponsesCompactEndpointPlan, n as applyOpenAIResponsesPayloadPolicy, o as resolveOpenAIResponsesRequestContextTokens, r as normalizeOpenAIServiceTier, s as resolveOpenAIResponsesServerCompactionPlan, t as OpenAIServiceTier } from "./openai-responses-payload-policy-BzM52TTH.mjs";
|
|
11
|
-
import { n as captureOpenAIResponsesCompaction, t as CompactionReplayRefreshRequiredError } from "./openai-responses-compaction-replay-
|
|
11
|
+
import { n as captureOpenAIResponsesCompaction, t as CompactionReplayRefreshRequiredError } from "./openai-responses-compaction-replay-DUBbsfku.mjs";
|
|
12
12
|
import { C as withProviderAcceptanceObserver, S as transportAbortError, _ as notifyProviderStreamOpened, a as coerceTransportToolCallArguments, b as sanitizeTransportPayloadText, c as createModelStreamCooperativeScheduler, d as finalizeTerminalToolCallArguments, f as finalizeTransportStream, g as notifyProviderHttpResponse, h as notifyProviderHttpMetadata, i as assignTransportErrorDetails, l as createWritableTransportEventStream, m as mergeTransportHeaders, n as ProviderAcceptance, o as copyProviderAcceptanceObserver, p as iterateModelStream, r as WritableTransportStream, s as createEmptyTransportUsage, t as IncompleteToolCallError, u as failTransportStream, v as parseTerminalToolCallArguments, w as withProviderResponseHook, x as throwIfModelStreamAborted, y as sanitizeNonEmptyTransportPayloadText } from "./transport-stream-shared-8ru8eX4s.mjs";
|
|
13
13
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-Cwcjv_fx.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { a as ProviderContext, c as ProviderModel, f as VideoContent } from "./provider-types-CWl4VXvE.mjs";
|
|
15
15
|
import { a as resolveModelPayloadDebugMode, i as emitModelTransportError, n as formatModelTransportDebugUrl, o as resolveModelSseDebugMode, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./model-transport-url-BrsjjdjR.mjs";
|
|
16
16
|
import OpenAI from "openai";
|
|
17
17
|
import { Part } from "@google/genai";
|
|
@@ -450,4 +450,13 @@ export declare function convertGoogleTools(tools: Tool[]): {
|
|
|
450
450
|
functionDeclarations: Record<string, unknown>[];
|
|
451
451
|
}[] | undefined;
|
|
452
452
|
//#endregion
|
|
453
|
-
|
|
453
|
+
//#region packages/ai/src/providers/google-video-slots.d.ts
|
|
454
|
+
export declare const GOOGLE_VIDEO_SLOT_OMISSION = "(video omitted: native video slot unavailable)";
|
|
455
|
+
type GoogleVideoSlots = Map<Record<string, unknown>, VideoContent>;
|
|
456
|
+
export declare function createGoogleVideoPlaceholder<T extends {
|
|
457
|
+
text: string;
|
|
458
|
+
}>(video: VideoContent, slots: GoogleVideoSlots | undefined, placeholder: T): T;
|
|
459
|
+
/** Only original slot identities may recover private bytes after mutable payload hooks. */
|
|
460
|
+
export declare function materializeGoogleVideoSlots(payload: unknown, slots: GoogleVideoSlots, materialize: (slot: Record<string, unknown>, video: VideoContent) => void, omitInjected: (part: Record<string, unknown>) => void): void;
|
|
461
|
+
//#endregion
|
|
462
|
+
export { CompactionReplayRefreshRequiredError, type CompactionReplayRejection, type GoogleStreamChunk, type GoogleVideoSlots, IncompleteToolCallError, type OpenAICompletionsOptions, type OpenAIResponsesCompactionRejection, OpenAIServiceTier, ProviderAcceptance, ResolvedOpenAICompletionsCompat, WritableTransportStream, applyAnthropicContextManagementToRequest, applyAnthropicEphemeralCacheControlMarkers, applyAnthropicPayloadPolicyToParams, applyAnthropicRequestCacheControl, applyOpenAIResponsesPayloadPolicy, assignTransportErrorDetails, buildAnthropicSystemBlocks, createTransportAwareStreamFnForModel as buildTransportAwareSimpleStreamFn, captureOpenAIResponsesCompaction, coerceTransportToolCallArguments, copyProviderAcceptanceObserver, createSupportedTransportStreamFn as createBoundaryAwareStreamFnForModel, createSupportedTransportStreamFn as createOpenClawTransportStreamFnForModel, createEmptyTransportUsage, createModelStreamCooperativeScheduler, createWritableTransportEventStream, detectOpenAICompletionsCompat, emitModelTransportDebug, emitModelTransportError, failTransportStream, finalizeTerminalToolCallArguments, finalizeTransportStream, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, isAnthropicServerToolClearingEnabled, isDirectAnthropicModel, isNativeOpenAIEndpoint, isOpenAICodexResponsesModel, iterateModelStream, logAnthropicContextEdits, mergeTransportHeaders, normalizeOpenAIServiceTier, notifyProviderHttpMetadata, notifyProviderHttpResponse, notifyProviderStreamOpened, parseTerminalToolCallArguments, resolveAnthropicCacheOptions, resolveAnthropicEphemeralCacheControl, resolveAnthropicPayloadPolicy, resolveAnthropicRequestBetaHeader, resolveAnthropicServerCompactionPlan, resolveModelPayloadDebugMode, resolveModelSseDebugMode, resolveOpenAICompletionsCompat, resolveOpenAIPromptCacheKeySupport, resolveOpenAIResponsesCompactEndpointPlan, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesRequestContextTokens, resolveOpenAIResponsesServerCompactionPlan, sanitizeNonEmptyTransportPayloadText, sanitizeTransportPayloadText, sortPromptCacheToolsByName as sortTransportToolsByName, supportsAnthropicServerSideFallback, throwIfModelStreamAborted, transportAbortError, usesNativeOpenAICodexResponsesBackend, withProviderAcceptanceObserver, withProviderResponseHook };
|
package/dist/transports.mjs
CHANGED
|
@@ -8,18 +8,19 @@ import { a as resolveModelPayloadDebugMode, i as emitModelTransportError, n as f
|
|
|
8
8
|
import { i as readResponseTextSnippet, o as resolveModelHeaderSentinels, r as isCodeModeModelVisibleToolName, s as streamFragmentError, t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./transport-utils-CcCAuFVS.mjs";
|
|
9
9
|
import { a as resolveOpenAIPromptCacheKeySupport, i as resolveOpenAICompletionsCompat, n as isNativeOpenAIEndpoint, o as usesNativeOpenAICodexResponsesBackend, r as isOpenAICodexResponsesModel, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-CJ0OXZgi.mjs";
|
|
10
10
|
import { t as buildGuardedModelFetch } from "./host-policy-Ci1cKluf.mjs";
|
|
11
|
-
import { A as resolveAnthropicCacheOptions, C as applyAnthropicEphemeralCacheControlMarkers, D as isAnthropicServerToolClearingEnabled, E as buildAnthropicSystemBlocks, F as supportsAnthropicServerSideFallback, H as isAnthropicOAuthApiKey, M as resolveAnthropicPayloadPolicy, N as resolveAnthropicRequestBetaHeader, O as isDirectAnthropicModel, P as resolveAnthropicServerCompactionPlan, S as applyAnthropicContextManagementToRequest, T as applyAnthropicRequestCacheControl, U as omitFoundryBearerCredentialHeaders, W as usesFoundryBearerAuth, b as resolveNewestAnthropicCompaction, f as resolveAnthropicTransportOptions, j as resolveAnthropicEphemeralCacheControl, k as logAnthropicContextEdits, l as buildAnthropicRequest, p as resolveCompletionTokenReservation, t as consumeAnthropicStream, u as prepareAnthropicRequest, w as applyAnthropicPayloadPolicyToParams, x as suppressAnthropicCompaction, y as isAnthropicReplayRejection } from "./anthropic-stream-reducer-
|
|
11
|
+
import { A as resolveAnthropicCacheOptions, C as applyAnthropicEphemeralCacheControlMarkers, D as isAnthropicServerToolClearingEnabled, E as buildAnthropicSystemBlocks, F as supportsAnthropicServerSideFallback, H as isAnthropicOAuthApiKey, M as resolveAnthropicPayloadPolicy, N as resolveAnthropicRequestBetaHeader, O as isDirectAnthropicModel, P as resolveAnthropicServerCompactionPlan, S as applyAnthropicContextManagementToRequest, T as applyAnthropicRequestCacheControl, U as omitFoundryBearerCredentialHeaders, W as usesFoundryBearerAuth, b as resolveNewestAnthropicCompaction, f as resolveAnthropicTransportOptions, j as resolveAnthropicEphemeralCacheControl, k as logAnthropicContextEdits, l as buildAnthropicRequest, p as resolveCompletionTokenReservation, t as consumeAnthropicStream, u as prepareAnthropicRequest, w as applyAnthropicPayloadPolicyToParams, x as suppressAnthropicCompaction, y as isAnthropicReplayRejection } from "./anthropic-stream-reducer-UI5_Ta6I.mjs";
|
|
12
12
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-D_MeCQFI.mjs";
|
|
13
13
|
import { C as parseJsonObjectPreservingUnsafeIntegers, S as withProviderResponseHook, T as quoteUnsafeIntegerLiterals, _ as sanitizeNonEmptyTransportPayloadText, a as createEmptyTransportUsage, b as transportAbortError, c as failTransportStream, d as iterateModelStream, f as mergeTransportHeaders, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, i as copyProviderAcceptanceObserver, j as createAbortError$1, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, o as createModelStreamCooperativeScheduler, p as notifyProviderHttpMetadata, r as coerceTransportToolCallArguments, s as createWritableTransportEventStream, t as IncompleteToolCallError, u as finalizeTransportStream, v as sanitizeTransportPayloadText, w as parseJsonPreservingUnsafeIntegers, x as withProviderAcceptanceObserver, y as throwIfModelStreamAborted } from "./transport-stream-shared-DdnJGEj0.mjs";
|
|
14
14
|
import { n as getEnvApiKey } from "./env-api-keys-Xd8dm_aV.mjs";
|
|
15
15
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
16
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
16
|
+
import { t as createAssistantOutput } from "./assistant-output-BdFoDBYQ.mjs";
|
|
17
17
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
18
|
-
import { c as flattenCompletionMessagesToStringContent, d as hasOpenAICompatibleConversationTurn, f as canonicalizeMaxTokensParam, i as createOpenAIResponsesTransportStreamFn, l as stripCompletionMessagesToRoleContent, m as createDeepSeekTextFilter, o as buildOpenAICompletionsParams, p as resolveMaxTokensParam, r as createAzureOpenAIResponsesTransportStreamFn, t as createOpenAICompletionsTransportStreamFn, u as applyCompletionsAnthropicCacheControl } from "./openai-completions-transport-
|
|
18
|
+
import { c as flattenCompletionMessagesToStringContent, d as hasOpenAICompatibleConversationTurn, f as canonicalizeMaxTokensParam, i as createOpenAIResponsesTransportStreamFn, l as stripCompletionMessagesToRoleContent, m as createDeepSeekTextFilter, o as buildOpenAICompletionsParams, p as resolveMaxTokensParam, r as createAzureOpenAIResponsesTransportStreamFn, t as createOpenAICompletionsTransportStreamFn, u as applyCompletionsAnthropicCacheControl } from "./openai-completions-transport-BVV8L-MO.mjs";
|
|
19
19
|
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-B-svbJuN.mjs";
|
|
20
|
-
import { At as isOpenAICompletionsThinkingEnabled, Dt as createOpenAIResponseHook, Et as createOpenAIProviderAcceptanceHook, Ft as readOpenAICompletionsReasoningBatch, It as resolveOpenAIClientBaseUrl, J as OPENAI_RESPONSES_FUNCTION_CALL_ITEM_ID_RE, L as normalizeOpenAIResponsesReasoningReplayItem, Lt as resolvePromptCacheKey, M as resolveResponsesContextUsageBoundary, Mt as measureUtf8AppendBytes, Nt as parseOpenAICompletionsUsage, Ot as createResponseModelTracker, Pt as readOpenAICompletionsContentDeltas, Q as splitOpenAIFunctionCallPairing, R as resolveReplayableResponsesMessageId, Rt as withOpenAIErrorResponseHook, Tt as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, X as normalizeOpenAIResponsesFunctionCallId, Y as OPENAI_RESPONSES_ID_MAX_LENGTH, Z as shouldNormalizeOpenAIResponsesToolCallId, at as resolveNewestOpenAIResponsesCompactionReplay, ct as buildOpenAIClientHeaders, dt as enforceCodeModeResponsesToolSurface, ft as filterCodeModePayloadTools, gt as resolveOpenAIStrictToolFlagWithDiagnostics, ht as resolveCodeModeResponsesVisibleToolNames, it as captureOpenAIResponsesCompaction, jt as log, kt as detachPartialSnapshot, lt as buildOpenAISdkClientOptions, mt as readCodeModePayloadToolName, nt as CompactionReplayRefreshRequiredError, pt as getCompat, q as OPENAI_RESPONSES_CALL_ID_RE, st as assertCodeModeResponsesToolSurface, ut as buildOpenAISdkRequestOptions, yt as resolveOpenAIReasoningEffortMap } from "./openai-responses-shared-
|
|
20
|
+
import { At as isOpenAICompletionsThinkingEnabled, Dt as createOpenAIResponseHook, Et as createOpenAIProviderAcceptanceHook, Ft as readOpenAICompletionsReasoningBatch, It as resolveOpenAIClientBaseUrl, J as OPENAI_RESPONSES_FUNCTION_CALL_ITEM_ID_RE, L as normalizeOpenAIResponsesReasoningReplayItem, Lt as resolvePromptCacheKey, M as resolveResponsesContextUsageBoundary, Mt as measureUtf8AppendBytes, Nt as parseOpenAICompletionsUsage, Ot as createResponseModelTracker, Pt as readOpenAICompletionsContentDeltas, Q as splitOpenAIFunctionCallPairing, R as resolveReplayableResponsesMessageId, Rt as withOpenAIErrorResponseHook, Tt as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, X as normalizeOpenAIResponsesFunctionCallId, Y as OPENAI_RESPONSES_ID_MAX_LENGTH, Z as shouldNormalizeOpenAIResponsesToolCallId, at as resolveNewestOpenAIResponsesCompactionReplay, ct as buildOpenAIClientHeaders, dt as enforceCodeModeResponsesToolSurface, ft as filterCodeModePayloadTools, gt as resolveOpenAIStrictToolFlagWithDiagnostics, ht as resolveCodeModeResponsesVisibleToolNames, it as captureOpenAIResponsesCompaction, jt as log, kt as detachPartialSnapshot, lt as buildOpenAISdkClientOptions, mt as readCodeModePayloadToolName, nt as CompactionReplayRefreshRequiredError, pt as getCompat, q as OPENAI_RESPONSES_CALL_ID_RE, st as assertCodeModeResponsesToolSurface, ut as buildOpenAISdkRequestOptions, yt as resolveOpenAIReasoningEffortMap } from "./openai-responses-shared-CD3Sd1NC.mjs";
|
|
21
21
|
import { c as applyOpenAIResponsesPayloadPolicy, d as resolveOpenAIResponsesPayloadPolicy, f as resolveOpenAIResponsesRequestContextTokens, l as normalizeOpenAIServiceTier, p as resolveOpenAIResponsesServerCompactionPlan, s as sanitizeResponsesImagePayload, u as resolveOpenAIResponsesCompactEndpointPlan } from "./openai-responses-endpoint-JbBT8IDv.mjs";
|
|
22
|
-
import { c as requestPreparedOpenAIResponsesCompaction } from "./openai-responses-request-lifecycle-
|
|
22
|
+
import { c as requestPreparedOpenAIResponsesCompaction } from "./openai-responses-request-lifecycle-CsBFQkiW.mjs";
|
|
23
|
+
import { n as createGoogleVideoPlaceholder, r as materializeGoogleVideoSlots, t as GOOGLE_VIDEO_SLOT_OMISSION } from "./google-video-slots-D8tPH8wX.mjs";
|
|
23
24
|
import { randomUUID } from "node:crypto";
|
|
24
25
|
//#region packages/ai/src/transports/anthropic-transport-stream.ts
|
|
25
26
|
const ANTHROPIC_MESSAGES_ERROR_BODY_MAX_BYTES = 8192;
|
|
@@ -698,4 +699,4 @@ function prepareModelForSimpleCompletion(params) {
|
|
|
698
699
|
return wrap(model);
|
|
699
700
|
}
|
|
700
701
|
//#endregion
|
|
701
|
-
export { CompactionReplayRefreshRequiredError, GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, IncompleteToolCallError, MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, OPENAI_RESPONSES_CALL_ID_RE, OPENAI_RESPONSES_FUNCTION_CALL_ITEM_ID_RE, OPENAI_RESPONSES_ID_MAX_LENGTH, applyAnthropicContextManagementToRequest, applyAnthropicEphemeralCacheControlMarkers, applyAnthropicPayloadPolicyToParams, applyAnthropicRequestCacheControl, applyCompletionsAnthropicCacheControl, applyOpenAIResponsesPayloadPolicy, assertCodeModeResponsesToolSurface, assignTransportErrorDetails, buildAnthropicSystemBlocks, buildOpenAIClientHeaders, buildOpenAICompletionsParams, buildOpenAISdkClientOptions, buildOpenAISdkRequestOptions, createTransportAwareStreamFnForModel as buildTransportAwareSimpleStreamFn, createTransportAwareStreamFnForModel, canonicalizeMaxTokensParam, captureOpenAIResponsesCompaction, coerceTransportToolCallArguments, consumeGoogleGenerateContentStream, convertGoogleTools, copyProviderAcceptanceObserver, createAnthropicMessagesTransportStreamFn, createAzureOpenAIResponsesTransportStreamFn, createSupportedTransportStreamFn as createBoundaryAwareStreamFnForModel, createSupportedTransportStreamFn as createOpenClawTransportStreamFnForModel, createDeepSeekTextFilter, createEmptyTransportUsage, createModelStreamCooperativeScheduler, createOpenAICompletionsTransportStreamFn, createOpenAIProviderAcceptanceHook, createOpenAIResponseHook, createOpenAIResponsesTransportStreamFn, createResponseModelTracker, createWritableTransportEventStream, detachPartialSnapshot, detectOpenAICompletionsCompat, emitModelTransportDebug, emitModelTransportError, enforceCodeModeResponsesToolSurface, failTransportStream, filterCodeModePayloadTools, finalizeTerminalToolCallArguments, finalizeTransportStream, flattenCompletionMessagesToStringContent, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, getCompat, googleFlashSupportsMinimalThinking, hasOpenAICompatibleConversationTurn, isAnthropicServerToolClearingEnabled, isCodeModeModelVisibleToolName, isCompactionReplayCheckpoint, isDirectAnthropicModel, isNativeOpenAIEndpoint, isOpenAICodexResponsesModel, isOpenAICompletionsThinkingEnabled, iterateModelStream, log, logAnthropicContextEdits, measureUtf8AppendBytes, mergeTransportHeaders, normalizeCodexResponsesBaseUrlForOpenAISdk, normalizeOpenAIResponsesFunctionCallId, normalizeOpenAIResponsesReasoningReplayItem, normalizeOpenAIServiceTier, notifyProviderHttpMetadata, notifyProviderHttpResponse, notifyProviderStreamOpened, parseJsonObjectPreservingUnsafeIntegers, parseJsonPreservingUnsafeIntegers, parseOpenAICompletionsUsage, parseTerminalToolCallArguments, prepareHeadersForSimpleCompletion, prepareModelForSimpleCompletion, prepareTransportAwareSimpleModel, preserveCompactionReplayWindow, projectGoogleMessages, quoteUnsafeIntegerLiterals, readCodeModePayloadToolName, readOpenAICompletionsContentDeltas, readOpenAICompletionsReasoningBatch, replaceCompactionReplayOwnerContent, requestPreparedOpenAIResponsesCompaction, requiresCompactionReplayRefresh, requiresGoogleToolCallId, resolveAnthropicCacheOptions, resolveAnthropicEphemeralCacheControl, resolveAnthropicMessagesUrl, resolveAnthropicPayloadPolicy, resolveAnthropicRequestBetaHeader, resolveAnthropicServerCompactionPlan, resolveCodeModeResponsesVisibleToolNames, resolveCompactionReplayEligibility, resolveCompactionReplayPressure, resolveCompletionTokenReservation, resolveMaxTokensParam, resolveModelPayloadDebugMode, resolveModelSseDebugMode, resolveOpenAIClientBaseUrl, resolveOpenAICompletionsCompat, resolveOpenAIPromptCacheKeySupport, resolveOpenAIReasoningEffortMap, resolveOpenAIResponsesCompactEndpointPlan, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesRequestContextTokens, resolveOpenAIResponsesServerCompactionPlan, resolveOpenAIStrictToolFlagWithDiagnostics, resolvePromptCacheKey, resolveReplayableResponsesMessageId, resolveTransportAwareSimpleApi, sanitizeNonEmptyTransportPayloadText, sanitizeResponsesImagePayload, sanitizeTransportPayloadText, shouldNormalizeOpenAIResponsesToolCallId, sortPromptCacheToolsByName as sortTransportToolsByName, splitOpenAIFunctionCallPairing, stripCompactionReplayCheckpoint, stripCompactionReplayCheckpointInPlace, stripCompletionMessagesToRoleContent, supportsAnthropicServerSideFallback, throwIfModelStreamAborted, transportAbortError, usesNativeOpenAICodexResponsesBackend, withOpenAIErrorResponseHook, withProviderAcceptanceObserver, withProviderResponseHook };
|
|
702
|
+
export { CompactionReplayRefreshRequiredError, GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, GOOGLE_VIDEO_SLOT_OMISSION, IncompleteToolCallError, MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, OPENAI_RESPONSES_CALL_ID_RE, OPENAI_RESPONSES_FUNCTION_CALL_ITEM_ID_RE, OPENAI_RESPONSES_ID_MAX_LENGTH, applyAnthropicContextManagementToRequest, applyAnthropicEphemeralCacheControlMarkers, applyAnthropicPayloadPolicyToParams, applyAnthropicRequestCacheControl, applyCompletionsAnthropicCacheControl, applyOpenAIResponsesPayloadPolicy, assertCodeModeResponsesToolSurface, assignTransportErrorDetails, buildAnthropicSystemBlocks, buildOpenAIClientHeaders, buildOpenAICompletionsParams, buildOpenAISdkClientOptions, buildOpenAISdkRequestOptions, createTransportAwareStreamFnForModel as buildTransportAwareSimpleStreamFn, createTransportAwareStreamFnForModel, canonicalizeMaxTokensParam, captureOpenAIResponsesCompaction, coerceTransportToolCallArguments, consumeGoogleGenerateContentStream, convertGoogleTools, copyProviderAcceptanceObserver, createAnthropicMessagesTransportStreamFn, createAzureOpenAIResponsesTransportStreamFn, createSupportedTransportStreamFn as createBoundaryAwareStreamFnForModel, createSupportedTransportStreamFn as createOpenClawTransportStreamFnForModel, createDeepSeekTextFilter, createEmptyTransportUsage, createGoogleVideoPlaceholder, createModelStreamCooperativeScheduler, createOpenAICompletionsTransportStreamFn, createOpenAIProviderAcceptanceHook, createOpenAIResponseHook, createOpenAIResponsesTransportStreamFn, createResponseModelTracker, createWritableTransportEventStream, detachPartialSnapshot, detectOpenAICompletionsCompat, emitModelTransportDebug, emitModelTransportError, enforceCodeModeResponsesToolSurface, failTransportStream, filterCodeModePayloadTools, finalizeTerminalToolCallArguments, finalizeTransportStream, flattenCompletionMessagesToStringContent, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, getCompat, googleFlashSupportsMinimalThinking, hasOpenAICompatibleConversationTurn, isAnthropicServerToolClearingEnabled, isCodeModeModelVisibleToolName, isCompactionReplayCheckpoint, isDirectAnthropicModel, isNativeOpenAIEndpoint, isOpenAICodexResponsesModel, isOpenAICompletionsThinkingEnabled, iterateModelStream, log, logAnthropicContextEdits, materializeGoogleVideoSlots, measureUtf8AppendBytes, mergeTransportHeaders, normalizeCodexResponsesBaseUrlForOpenAISdk, normalizeOpenAIResponsesFunctionCallId, normalizeOpenAIResponsesReasoningReplayItem, normalizeOpenAIServiceTier, notifyProviderHttpMetadata, notifyProviderHttpResponse, notifyProviderStreamOpened, parseJsonObjectPreservingUnsafeIntegers, parseJsonPreservingUnsafeIntegers, parseOpenAICompletionsUsage, parseTerminalToolCallArguments, prepareHeadersForSimpleCompletion, prepareModelForSimpleCompletion, prepareTransportAwareSimpleModel, preserveCompactionReplayWindow, projectGoogleMessages, quoteUnsafeIntegerLiterals, readCodeModePayloadToolName, readOpenAICompletionsContentDeltas, readOpenAICompletionsReasoningBatch, replaceCompactionReplayOwnerContent, requestPreparedOpenAIResponsesCompaction, requiresCompactionReplayRefresh, requiresGoogleToolCallId, resolveAnthropicCacheOptions, resolveAnthropicEphemeralCacheControl, resolveAnthropicMessagesUrl, resolveAnthropicPayloadPolicy, resolveAnthropicRequestBetaHeader, resolveAnthropicServerCompactionPlan, resolveCodeModeResponsesVisibleToolNames, resolveCompactionReplayEligibility, resolveCompactionReplayPressure, resolveCompletionTokenReservation, resolveMaxTokensParam, resolveModelPayloadDebugMode, resolveModelSseDebugMode, resolveOpenAIClientBaseUrl, resolveOpenAICompletionsCompat, resolveOpenAIPromptCacheKeySupport, resolveOpenAIReasoningEffortMap, resolveOpenAIResponsesCompactEndpointPlan, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesRequestContextTokens, resolveOpenAIResponsesServerCompactionPlan, resolveOpenAIStrictToolFlagWithDiagnostics, resolvePromptCacheKey, resolveReplayableResponsesMessageId, resolveTransportAwareSimpleApi, sanitizeNonEmptyTransportPayloadText, sanitizeResponsesImagePayload, sanitizeTransportPayloadText, shouldNormalizeOpenAIResponsesToolCallId, sortPromptCacheToolsByName as sortTransportToolsByName, splitOpenAIFunctionCallPairing, stripCompactionReplayCheckpoint, stripCompactionReplayCheckpointInPlace, stripCompletionMessagesToRoleContent, supportsAnthropicServerSideFallback, throwIfModelStreamAborted, transportAbortError, usesNativeOpenAICodexResponsesBackend, withOpenAIErrorResponseHook, withProviderAcceptanceObserver, withProviderResponseHook };
|
package/package.json
CHANGED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
//#region packages/ai/src/internal/retry-after.d.ts
|
|
2
|
-
type HttpDateInstant = {
|
|
3
|
-
timestampMs: number;
|
|
4
|
-
leapSecond: boolean;
|
|
5
|
-
};
|
|
6
|
-
/** Reads only retry timing metadata, without invoking provider getters or serialization hooks. */
|
|
7
|
-
declare function parseRetryAfterHeadersSeconds(headers: unknown, nowMs?: number, status?: number): number | undefined;
|
|
8
|
-
/** SDK errors carry native response headers separately from their error body. */
|
|
9
|
-
declare function parseRetryAfterErrorSeconds(error: unknown, nowMs?: number): number | undefined;
|
|
10
|
-
/** Round leap seconds forward for Retry-After so an unrepresentable instant cannot retry early. */
|
|
11
|
-
declare function parseRetryAfterHttpDateMs(value: string, nowMs?: number): number | undefined;
|
|
12
|
-
/** Parse all three HTTP-date forms while retaining leap-second ordering. */
|
|
13
|
-
declare function parseHttpDateInstant(value: string, nowMs?: number): HttpDateInstant | undefined;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { parseRetryAfterHttpDateMs as i, parseRetryAfterErrorSeconds as n, parseRetryAfterHeadersSeconds as r, parseHttpDateInstant as t };
|