@openclaw/ai 2026.8.1-beta.2 → 2026.8.1-beta.3
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-B6dLpq5L.mjs → anthropic-B8KwTtlb.mjs} +37 -27
- package/dist/{anthropic-SrGtwsJu.d.mts → anthropic-BECQCNdF.d.mts} +0 -2
- package/dist/{anthropic-JsNA5KCu.mjs → anthropic-BQXQudmA.mjs} +0 -1
- package/dist/{anthropic-compaction-replay-8lJNKXOE.mjs → anthropic-compaction-replay-4Zx7-aCr.mjs} +14 -15
- package/dist/{anthropic-payload-policy-CiEuQS72.d.mts → anthropic-payload-policy-CSx7MoKH.d.mts} +2 -1
- package/dist/{api-registry-k3zTz0cV.d.mts → api-registry-DFxSnFqG.d.mts} +1 -1
- package/dist/{azure-openai-responses-mxIOtUnn.mjs → azure-openai-responses-Aa4mVcYG.mjs} +3 -3
- package/dist/diagnostics.mjs +1 -1
- package/dist/event-stream-BVVgDSdq.d.mts +1 -0
- package/dist/{event-stream-BP6AWT8j.d.mts → event-stream-D91-ohD_.d.mts} +1 -1
- package/dist/event-stream.d.mts +1 -1
- package/dist/{google-shared-B0Qr9OR7.mjs → google-shared-M1dl64nz.mjs} +12 -5
- package/dist/{google-vertex-Bhc3TjDl.mjs → google-vertex-DCJHM_a5.mjs} +3 -3
- package/dist/{google-C7h2QzDX.mjs → google-yDRnipeq.mjs} +3 -3
- package/dist/headers-B_e4-1J0.mjs +9 -0
- package/dist/{host-DTqNc7ad.mjs → host-DF_yxOsA.mjs} +40 -29
- package/dist/{host-vWgMMhiJ.d.mts → host-DJq_FGcz.d.mts} +6 -6
- package/dist/index.d.mts +7 -7
- package/dist/index.mjs +2 -2
- package/dist/internal/anthropic.d.mts +11 -5
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +5 -5
- package/dist/internal/openai.mjs +9 -8
- package/dist/internal/runtime.d.mts +4 -2
- package/dist/internal/runtime.mjs +4 -3
- package/dist/internal/shared.d.mts +17 -3
- package/dist/internal/shared.mjs +4 -4
- package/dist/{headers-DdOQtGuU.mjs → llm-request-activity-BjtkplhG.mjs} +1 -9
- package/dist/{mistral-CEWoQI_g.mjs → mistral-D6hRXI7A.mjs} +47 -33
- package/dist/{openai-chatgpt-responses-CrPmqERt.mjs → openai-chatgpt-responses-C339VIfT.mjs} +23 -15
- package/dist/{openai-completions-BPnt4Sml.mjs → openai-completions-D88orSJ9.mjs} +71 -35
- package/dist/{openai-completions-compat-Dt3dcawL.d.mts → openai-completions-compat-B0KTleXp.d.mts} +2 -2
- package/dist/{openai-responses-DhIKtOup.mjs → openai-responses-BXEcr-Tp.mjs} +4 -4
- package/dist/{openai-responses-contracts-XpZJxrRG.d.mts → openai-responses-contracts-CD75pQ0m.d.mts} +2 -2
- package/dist/{openai-responses-contracts-CyfIkQi5.mjs → openai-responses-contracts-DvILoqBk.mjs} +3 -9
- package/dist/{openai-responses-payload-policy-BDxV-W0c.mjs → openai-responses-payload-policy-BDo8CQsx.mjs} +4 -2
- package/dist/{openai-responses-payload-policy-BSs371VM.d.mts → openai-responses-payload-policy-CNGFT9zr.d.mts} +1 -0
- package/dist/{openai-responses-prompt-observer-internal-DgNTYnRY.mjs → openai-responses-prompt-observer-internal-BG-1AsBI.mjs} +2 -3
- package/dist/{openai-responses-shared-DXIt3iY5.mjs → openai-responses-shared-Cvt5MgEm.mjs} +81 -136
- package/dist/{openai-stop-reason-BkFkqqK0.mjs → openai-stop-reason-9OONKyAm.mjs} +47 -31
- package/dist/{openai-tool-projection-CY04OcvQ.mjs → openai-tool-projection-CHGLt03m.mjs} +94 -6
- package/dist/{provider-error-BUwEnjXq.mjs → provider-error-C8mBRJDl.mjs} +19 -24
- package/dist/provider-options-AvldWZt8.mjs +21 -0
- package/dist/{provider-options-B96RdNpH.d.mts → provider-options-Cc5ZQ6Aa.d.mts} +12 -2
- package/dist/provider-transcript-transform--gtf0ZbR.mjs +32 -0
- package/dist/provider-types.d.mts +5 -5
- package/dist/providers.d.mts +1 -1
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-rnPwX2pg.mjs → reasoning-tag-text-partitioner-5ygO2rZc.mjs} +3 -0
- package/dist/{sanitize-unicode-BYqrYtC_.mjs → sanitize-unicode-BP7HLLZn.mjs} +1 -1
- package/dist/simple-options-oqsXB6U3.mjs +450 -0
- package/dist/{tool-schema-json-projection-q5d7QX5c.mjs → tool-schema-json-projection-FEr-jOoZ.mjs} +16 -7
- package/dist/{transport-utils-DJqkxbhC.mjs → transport-utils-Bv0FHkd0.mjs} +1 -1
- package/dist/transports.d.mts +77 -44
- package/dist/transports.mjs +207 -167
- package/dist/{types-BHNrPS1l.d.mts → types-DTAP49HF.d.mts} +17 -2
- package/dist/types.d.mts +5 -5
- package/dist/types.mjs +1 -1
- package/dist/{validation-DT9SrFn3.d.mts → validation-DYNNrU9u.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/package.json +1 -1
- package/dist/provider-transcript-transform-ePx-Bbfr.mjs +0 -155
- package/dist/simple-options-D58D5Kvw.mjs +0 -117
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { i as clampThinkingLevel } from "./sanitize-unicode-
|
|
4
|
-
import { n as getAiTransportHost } from "./host-
|
|
5
|
-
import { n as projectProviderError } from "./provider-error-
|
|
3
|
+
import { i as clampThinkingLevel } from "./sanitize-unicode-BP7HLLZn.mjs";
|
|
4
|
+
import { n as getAiTransportHost } from "./host-DF_yxOsA.mjs";
|
|
5
|
+
import { n as projectProviderError } from "./provider-error-C8mBRJDl.mjs";
|
|
6
6
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
7
7
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { a as createOpenAICompletionsToolCallDeltaNormalizer, c as resolveOpenAICompletionsCompat, d as clearPendingCommentaryText, f as rememberPendingCommentaryTags, i as hasToolCallHistory, l as resolveOpenAICompletionsResponseFormat, n as resolveOpenAIReasoningEffortMap, o as finalizeOpenAICompletionsToolCalls, p as
|
|
8
|
+
import { A as splitSystemPromptCacheBoundary, C as withProviderResponseHook, P as sortPromptCacheToolsByName, n as buildBaseOptions, x as transportAbortError } from "./simple-options-oqsXB6U3.mjs";
|
|
9
|
+
import { a as createOpenAICompletionsToolCallDeltaNormalizer, c as resolveOpenAICompletionsCompat, d as clearPendingCommentaryText, f as rememberPendingCommentaryTags, h as tagUnresolvedTextAsCommentary, i as hasToolCallHistory, l as resolveOpenAICompletionsResponseFormat, m as tagPendingCommentaryText, n as resolveOpenAIReasoningEffortMap, o as finalizeOpenAICompletionsToolCalls, p as tagInterruptedTextPhases, r as convertMessages, t as mapOpenAIStopReason, u as shouldOmitOllamaCompatResponseFormat } from "./openai-stop-reason-9OONKyAm.mjs";
|
|
10
10
|
import { n as parseStreamingJson } from "./json-parse-CDnesDM_.mjs";
|
|
11
|
-
import {
|
|
12
|
-
import { f as
|
|
13
|
-
import { d as readOpenAICompletionsContentDeltas, n as reconcileOpenAICompletionsToolChoice, o as createOpenAIResponseHook, s as isOpenAICompletionsThinkingEnabled, t as projectOpenAITools, u as parseOpenAICompletionsUsage } from "./openai-tool-projection-CY04OcvQ.mjs";
|
|
11
|
+
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
12
|
+
import { c as isOpenAICompletionsThinkingEnabled, d as parseOpenAICompletionsUsage, f as readOpenAICompletionsContentDeltas, n as reconcileOpenAICompletionsToolChoice, o as createOpenAIProviderAcceptanceHook, p as readOpenAICompletionsReasoningBatch, t as projectOpenAITools } from "./openai-tool-projection-CHGLt03m.mjs";
|
|
14
13
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-MK28puvq.mjs";
|
|
15
|
-
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-
|
|
14
|
+
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-5ygO2rZc.mjs";
|
|
16
15
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, r as isCloudflareProvider, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
17
16
|
import OpenAI from "openai";
|
|
18
17
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
@@ -57,6 +56,8 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
57
56
|
try {
|
|
58
57
|
const apiKey = options?.apiKey || getEnvApiKey(model.provider) || "";
|
|
59
58
|
const compat = resolveOpenAICompletionsCompat(model);
|
|
59
|
+
const visibleReasoningDetailTypes = new Set(compat.visibleReasoningDetailTypes);
|
|
60
|
+
const shouldEmitReasoning = Boolean(model.reasoning && options?.reasoningEffort && isOpenAICompletionsThinkingEnabled(options.reasoningEffort));
|
|
60
61
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention);
|
|
61
62
|
const cacheSessionId = cacheRetention === "none" ? void 0 : options?.sessionId;
|
|
62
63
|
const client = createClient(model, context, apiKey, options?.headers, cacheSessionId, compat);
|
|
@@ -74,14 +75,17 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
74
75
|
stream: openaiStream,
|
|
75
76
|
signal: firstEventAbort.signal,
|
|
76
77
|
abort: firstEventAbort.abort,
|
|
77
|
-
hook:
|
|
78
|
+
hook: createOpenAIProviderAcceptanceHook(options, response, model),
|
|
78
79
|
onReady: () => stream.push({
|
|
79
80
|
type: "start",
|
|
80
81
|
partial: output
|
|
81
82
|
})
|
|
82
83
|
});
|
|
83
84
|
let textBlock = null;
|
|
85
|
+
let textBlockSource;
|
|
84
86
|
let thinkingBlock = null;
|
|
87
|
+
let pendingInterruptedTextBlock = null;
|
|
88
|
+
let confirmedInterruptedTextBlock = null;
|
|
85
89
|
let hasFinishReason = false;
|
|
86
90
|
const toolCallBlocksByIndex = /* @__PURE__ */ new Map();
|
|
87
91
|
const toolCallBlocksById = /* @__PURE__ */ new Map();
|
|
@@ -91,6 +95,7 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
91
95
|
const blocks = output.content;
|
|
92
96
|
const finishedBlocks = /* @__PURE__ */ new Set();
|
|
93
97
|
const contentIndices = /* @__PURE__ */ new WeakMap();
|
|
98
|
+
let explicitVisibleTextBlocks;
|
|
94
99
|
const appendBlock = (block) => {
|
|
95
100
|
contentIndices.set(block, blocks.length);
|
|
96
101
|
blocks.push(block);
|
|
@@ -128,12 +133,21 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
128
133
|
partial: output
|
|
129
134
|
});
|
|
130
135
|
};
|
|
131
|
-
const
|
|
136
|
+
const finishTextBlock = () => {
|
|
137
|
+
if (!textBlock) return;
|
|
138
|
+
finishBlock(textBlock);
|
|
139
|
+
textBlock = null;
|
|
140
|
+
textBlockSource = void 0;
|
|
141
|
+
};
|
|
142
|
+
const ensureTextBlock = (source) => {
|
|
143
|
+
if (textBlock && textBlockSource !== source) finishTextBlock();
|
|
132
144
|
if (!textBlock) {
|
|
133
145
|
textBlock = {
|
|
134
146
|
type: "text",
|
|
135
147
|
text: ""
|
|
136
148
|
};
|
|
149
|
+
textBlockSource = source;
|
|
150
|
+
if (source === "reasoning_detail") (explicitVisibleTextBlocks ??= /* @__PURE__ */ new Set()).add(textBlock);
|
|
137
151
|
appendBlock(textBlock);
|
|
138
152
|
stream.push({
|
|
139
153
|
type: "text_start",
|
|
@@ -165,10 +179,14 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
165
179
|
thinkingBlock = null;
|
|
166
180
|
}
|
|
167
181
|
};
|
|
168
|
-
const appendTextDelta = (delta) => {
|
|
182
|
+
const appendTextDelta = (delta, source) => {
|
|
169
183
|
sealNativeReasoningBeforeText();
|
|
170
|
-
const block = ensureTextBlock();
|
|
184
|
+
const block = ensureTextBlock(source);
|
|
171
185
|
block.text += delta;
|
|
186
|
+
if (pendingInterruptedTextBlock && delta.trim()) {
|
|
187
|
+
confirmedInterruptedTextBlock = pendingInterruptedTextBlock;
|
|
188
|
+
pendingInterruptedTextBlock = null;
|
|
189
|
+
}
|
|
172
190
|
stream.push({
|
|
173
191
|
type: "text_delta",
|
|
174
192
|
contentIndex: getContentIndex(block),
|
|
@@ -186,6 +204,15 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
186
204
|
partial: output
|
|
187
205
|
});
|
|
188
206
|
};
|
|
207
|
+
const appendReasoningDeltas = (reasoningDeltas) => {
|
|
208
|
+
for (const reasoningDelta of reasoningDeltas) if (reasoningDelta.kind === "thinking") {
|
|
209
|
+
if (!shouldEmitReasoning) continue;
|
|
210
|
+
finishTextBlock();
|
|
211
|
+
const signature = reasoningDelta.signature;
|
|
212
|
+
const thinkingSignature = model.provider === "opencode-go" && signature === "reasoning" ? "reasoning_content" : signature;
|
|
213
|
+
appendThinkingDelta(thinkingSignature, reasoningDelta.text);
|
|
214
|
+
} else appendTextDelta(reasoningDelta.text, reasoningDelta.source);
|
|
215
|
+
};
|
|
189
216
|
const ensureToolCallBlock = (toolCall) => {
|
|
190
217
|
const streamIndex = typeof toolCall.index === "number" ? toolCall.index : void 0;
|
|
191
218
|
let block = streamIndex !== void 0 ? toolCallBlocksByIndex.get(streamIndex) : void 0;
|
|
@@ -226,6 +253,21 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
226
253
|
const flushPartitionedContent = () => {
|
|
227
254
|
for (const delta of reasoningTagTextPartitioner.flush()) if (delta.kind === "text") appendTextDelta(delta.text);
|
|
228
255
|
};
|
|
256
|
+
const sealTextBeforeReasoning = () => {
|
|
257
|
+
if (!textBlock && !reasoningTagTextPartitioner.hasPending()) return;
|
|
258
|
+
flushPartitionedContent();
|
|
259
|
+
if (!textBlock) return;
|
|
260
|
+
if (textBlockSource !== "reasoning_detail" && textBlock.text.trim()) pendingInterruptedTextBlock = textBlock;
|
|
261
|
+
finishTextBlock();
|
|
262
|
+
};
|
|
263
|
+
const beginReasoning = (hasFollowingVisibleText, forceStrict = false) => {
|
|
264
|
+
if (!output.openclawDelivery?.textPhaseRequiresTerminal) output.openclawDelivery = {
|
|
265
|
+
...output.openclawDelivery,
|
|
266
|
+
textPhaseRequiresTerminal: true
|
|
267
|
+
};
|
|
268
|
+
if (forceStrict || reasoningTagTextPartitioner.hasPending()) reasoningTagTextPartitioner.markStrict();
|
|
269
|
+
if (!hasFollowingVisibleText || !reasoningTagTextPartitioner.hasPendingSyntax()) sealTextBeforeReasoning();
|
|
270
|
+
};
|
|
229
271
|
const guardedOpenaiStream = withFirstStreamEventTimeout(hookedOpenAIStream, {
|
|
230
272
|
provider: model.provider,
|
|
231
273
|
api: model.api,
|
|
@@ -255,30 +297,21 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
255
297
|
const rawChoiceDelta = choice.delta ?? choice.message;
|
|
256
298
|
if (rawChoiceDelta) for (const normalizedDelta of normalizeToolCallDeltas(rawChoiceDelta, choice.finish_reason)) {
|
|
257
299
|
const choiceDelta = normalizedDelta.delta;
|
|
258
|
-
const
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
const value = deltaFields[field];
|
|
268
|
-
if (typeof value === "string" && value.length > 0) {
|
|
269
|
-
foundReasoningField = field;
|
|
270
|
-
break;
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
if (foundReasoningField) reasoningTagTextPartitioner.markStrict();
|
|
274
|
-
if (shouldEmitReasoning && foundReasoningField) {
|
|
275
|
-
const delta = deltaFields[foundReasoningField];
|
|
276
|
-
if (typeof delta === "string" && delta.length > 0) appendThinkingDelta(model.provider === "opencode-go" && foundReasoningField === "reasoning" ? "reasoning_content" : foundReasoningField, delta);
|
|
300
|
+
const reasoningBatch = readOpenAICompletionsReasoningBatch(choiceDelta, visibleReasoningDetailTypes);
|
|
301
|
+
const reasoningDeltas = reasoningBatch.deltas;
|
|
302
|
+
const hasReasoningThinking = reasoningBatch.hasThinking;
|
|
303
|
+
const contentDeltas = readOpenAICompletionsContentDeltas(choiceDelta.content, choiceDelta.refusal, reasoningBatch.mirroredThinking);
|
|
304
|
+
const lastVisibleTextIndex = contentDeltas.findLastIndex((delta) => delta.kind === "text");
|
|
305
|
+
const hasSameChunkVisibleText = reasoningBatch.hasVisibleText || lastVisibleTextIndex !== -1;
|
|
306
|
+
if (hasReasoningThinking) {
|
|
307
|
+
beginReasoning(hasSameChunkVisibleText, true);
|
|
308
|
+
appendReasoningDeltas(reasoningDeltas);
|
|
277
309
|
}
|
|
278
|
-
for (const contentDelta of
|
|
279
|
-
|
|
310
|
+
for (const [contentDeltaIndex, contentDelta] of contentDeltas.entries()) if (contentDelta.kind === "thinking") {
|
|
311
|
+
beginReasoning(contentDeltaIndex < lastVisibleTextIndex);
|
|
280
312
|
if (shouldEmitReasoning) appendThinkingDelta(contentDelta.signature, contentDelta.text);
|
|
281
|
-
} else appendPartitionedContent(contentDelta.text,
|
|
313
|
+
} else appendPartitionedContent(contentDelta.text, hasReasoningThinking);
|
|
314
|
+
if (!hasReasoningThinking) appendReasoningDeltas(reasoningDeltas);
|
|
282
315
|
const toolCallDeltas = normalizedDelta.toolCalls;
|
|
283
316
|
if (toolCallDeltas.length > 0) {
|
|
284
317
|
flushPartitionedContent();
|
|
@@ -332,6 +365,7 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
332
365
|
for (const block of blocks) if (block.type !== "toolCall") finishBlock(block);
|
|
333
366
|
throw new Error(output.errorMessage || (output.stopReason === "aborted" ? "Request was aborted" : "Provider returned an invalid tool call"));
|
|
334
367
|
}
|
|
368
|
+
if (output.stopReason !== "toolUse" && confirmedInterruptedTextBlock) tagInterruptedTextPhases(output.content, confirmedInterruptedTextBlock, explicitVisibleTextBlocks);
|
|
335
369
|
for (const block of blocks) if (block.type !== "toolCall" || output.stopReason === "toolUse") finishBlock(block);
|
|
336
370
|
if (output.stopReason !== "toolUse") clearPendingCommentaryText(provisionalCommentaryTags);
|
|
337
371
|
if (output.stopReason === "toolUse") tagPendingCommentaryText(output.content);
|
|
@@ -345,6 +379,8 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
345
379
|
const terminal = projectProviderError(error, options?.signal);
|
|
346
380
|
Object.assign(output, terminal);
|
|
347
381
|
finalizeOpenAICompletionsToolCalls(output, { allowSilentToolCallPromotion: false });
|
|
382
|
+
clearPendingCommentaryText(provisionalCommentaryTags);
|
|
383
|
+
tagUnresolvedTextAsCommentary(output);
|
|
348
384
|
for (const block of output.content) {
|
|
349
385
|
delete block.index;
|
|
350
386
|
delete block.partialArgs;
|
package/dist/{openai-completions-compat-Dt3dcawL.d.mts → openai-completions-compat-B0KTleXp.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-
|
|
1
|
+
import { D as Model, k as OpenAICompletionsCompat } from "./types-DTAP49HF.mjs";
|
|
2
|
+
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-DJq_FGcz.mjs";
|
|
3
3
|
|
|
4
4
|
//#region packages/ai/src/transports/openai-completions-compat.d.ts
|
|
5
5
|
type ProviderRequestCapabilities = AiProviderRequestCapabilities;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
4
|
-
import { S as supportsOpenAITemperature } from "./openai-responses-contracts-
|
|
3
|
+
import { n as getAiTransportHost } from "./host-DF_yxOsA.mjs";
|
|
4
|
+
import { S as supportsOpenAITemperature } from "./openai-responses-contracts-DvILoqBk.mjs";
|
|
5
5
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
6
6
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
7
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
8
|
-
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, n as applyResponsesServiceTierPricing, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
7
|
+
import { n as buildBaseOptions } from "./simple-options-oqsXB6U3.mjs";
|
|
8
|
+
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, n as applyResponsesServiceTierPricing, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-Cvt5MgEm.mjs";
|
|
9
9
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, r as isCloudflareProvider, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
10
10
|
import OpenAI from "openai";
|
|
11
11
|
//#region packages/ai/src/providers/openai-responses.ts
|
package/dist/{openai-responses-contracts-XpZJxrRG.d.mts → openai-responses-contracts-CD75pQ0m.d.mts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Api } from "./types-
|
|
2
|
-
import {
|
|
1
|
+
import { n as Api } from "./types-DTAP49HF.mjs";
|
|
2
|
+
import { h as OpenAIReasoningEffort, i as BaseOpenAIStreamOptions, m as OpenAIApiReasoningEffort } from "./provider-options-Cc5ZQ6Aa.mjs";
|
|
3
3
|
import { FunctionTool, ResponseCompactionItem, ResponseCreateParamsStreaming, ResponseInput } from "openai/resources/responses/responses.js";
|
|
4
4
|
|
|
5
5
|
//#region packages/ai/src/transports/openai-responses-contracts.d.ts
|
package/dist/{openai-responses-contracts-CyfIkQi5.mjs → openai-responses-contracts-DvILoqBk.mjs}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE
|
|
1
|
+
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
2
2
|
import "./src-D2H6yKkH.mjs";
|
|
3
3
|
import { a as normalizeOptionalString, n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
4
4
|
import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
|
|
@@ -177,6 +177,7 @@ const RESPONSE_FAILED_NO_DETAILS_MESSAGE = "Unknown error (no error details in r
|
|
|
177
177
|
const OPENAI_RESPONSES_REASONING_REPLAY_META_KEY = "__openclaw_replay";
|
|
178
178
|
const OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY = "openclawReasoningReplay";
|
|
179
179
|
const OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE = "openai-responses-compaction";
|
|
180
|
+
const OPENAI_RESPONSES_RETAINED_COMPACTION_REPLAY_TYPE = "openai-responses-retained-compaction";
|
|
180
181
|
const OPENAI_RESPONSES_APIS = /* @__PURE__ */ new Set([
|
|
181
182
|
"openai-responses",
|
|
182
183
|
"azure-openai-responses",
|
|
@@ -185,13 +186,6 @@ const OPENAI_RESPONSES_APIS = /* @__PURE__ */ new Set([
|
|
|
185
186
|
"openclaw-openai-chatgpt-responses-transport",
|
|
186
187
|
"openclaw-azure-openai-responses-transport"
|
|
187
188
|
]);
|
|
188
|
-
var OpenAIResponsesWebSocketResponseFailedError = class extends Error {
|
|
189
|
-
constructor(hasOutput) {
|
|
190
|
-
super("OpenAI Responses WebSocket returned response.failed");
|
|
191
|
-
this.name = "OpenAIResponsesWebSocketResponseFailedError";
|
|
192
|
-
this.code = hasOutput ? PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE : PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE;
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
189
|
var OpenAIResponsesWebSocketPreDispatchError = class extends Error {
|
|
196
190
|
constructor(cause) {
|
|
197
191
|
super("OpenAI Responses WebSocket failed before request dispatch", { cause });
|
|
@@ -250,4 +244,4 @@ const responsesPromptObserver = {
|
|
|
250
244
|
}
|
|
251
245
|
};
|
|
252
246
|
//#endregion
|
|
253
|
-
export { normalizeStringEntries as C, supportsOpenAITemperature as S, uniqueValues as T, isOpenAIGpt56Model as _, OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE as a, resolveOpenAISupportedReasoningEfforts as b,
|
|
247
|
+
export { normalizeStringEntries as C, supportsOpenAITemperature as S, uniqueValues as T, isOpenAIGpt56Model as _, OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE as a, resolveOpenAISupportedReasoningEfforts as b, OPENAI_RESPONSES_RETAINED_COMPACTION_REPLAY_TYPE as c, OpenAIResponsesWebSocketSafeRetryError as d, RESPONSE_FAILED_NO_DETAILS_MESSAGE as f, isOpenAIGpt55Model as g, isOpenAIGpt54MiniModel as h, OPENAI_RESPONSES_APIS as i, OpenAIResponsesWebSocketPostDispatchError as l, responsesPromptObserver as m, DEFAULT_AZURE_OPENAI_API_VERSION as n, OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY as o, parseOpenAIResponsesWebSocketServerError as p, OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS as r, OPENAI_RESPONSES_REASONING_REPLAY_META_KEY as s, AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS as t, OpenAIResponsesWebSocketPreDispatchError as u, normalizeOpenAIReasoningEffort as v, uniqueStrings as w, supportsOpenAIReasoningEffort as x, resolveOpenAIReasoningEffortForModel as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { i as normalizeOptionalLowercaseString, n as normalizeLowercaseStringOrEmpty, s as readStringValue } from "./string-coerce-fsri9iCu.mjs";
|
|
2
2
|
import { s as parseStrictPositiveInteger } from "./number-coercion-H9qHik3g.mjs";
|
|
3
|
-
import { i as OPENAI_RESPONSES_APIS, x as supportsOpenAIReasoningEffort } from "./openai-responses-contracts-
|
|
3
|
+
import { i as OPENAI_RESPONSES_APIS, x as supportsOpenAIReasoningEffort } from "./openai-responses-contracts-DvILoqBk.mjs";
|
|
4
4
|
//#region packages/model-catalog-core/src/provider-id.ts
|
|
5
5
|
function normalizeProviderId(provider) {
|
|
6
6
|
return normalizeLowercaseStringOrEmpty(provider);
|
|
@@ -132,8 +132,10 @@ function parsePositiveInteger(value) {
|
|
|
132
132
|
if (typeof value === "string") return parseStrictPositiveInteger(value);
|
|
133
133
|
}
|
|
134
134
|
function resolveOpenAIResponsesCompactThreshold(model) {
|
|
135
|
+
const contextTokens = parsePositiveInteger(model.contextTokens);
|
|
135
136
|
const contextWindow = parsePositiveInteger(model.contextWindow);
|
|
136
|
-
|
|
137
|
+
const effectiveBudget = contextTokens && contextWindow ? Math.min(contextTokens, contextWindow) : contextTokens || contextWindow;
|
|
138
|
+
if (effectiveBudget) return Math.max(1e3, Math.floor(effectiveBudget * .7));
|
|
137
139
|
return 8e4;
|
|
138
140
|
}
|
|
139
141
|
/** Resolve the server-compaction gate and effective threshold for a Responses route. */
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { m as responsesPromptObserver } from "./openai-responses-contracts-
|
|
2
|
-
import {
|
|
3
|
-
import { d as sanitizeTransportPayloadText } from "./provider-transcript-transform-ePx-Bbfr.mjs";
|
|
1
|
+
import { m as responsesPromptObserver } from "./openai-responses-contracts-DvILoqBk.mjs";
|
|
2
|
+
import { b as sanitizeTransportPayloadText, j as stripSystemPromptCacheBoundary } from "./simple-options-oqsXB6U3.mjs";
|
|
4
3
|
//#region packages/normalization-core/src/error-coercion.ts
|
|
5
4
|
/**
|
|
6
5
|
* Normalizes an unknown thrown value into an Error. Non-Error objects become
|