@openclaw/ai 2026.10.5-beta.1 → 2026.10.5-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-BAHKgWam.mjs → anthropic-BalhAzs-.mjs} +7 -7
- package/dist/{anthropic-stream-reducer-g6w1YVii.mjs → anthropic-stream-reducer-DkKeXXx4.mjs} +8 -8
- package/dist/{assistant-output-CUEeSotf.mjs → assistant-output-BuhRpLeD.mjs} +2 -2
- package/dist/{assistant-text-phase-BrV8KdFO.mjs → assistant-text-phase-Bn1hbvK9.mjs} +1 -1
- package/dist/{azure-openai-responses-C7qBuR23.mjs → azure-openai-responses-DfT9Ndd8.mjs} +4 -4
- package/dist/{google-interactions-tjAb1mc5.mjs → google-interactions-9SSqsJg9.mjs} +6 -6
- package/dist/{google-messages-C-RZzloH.mjs → google-messages-DsB7fmoQ.mjs} +4 -3
- package/dist/{google-provider-stream-CMImyxbX.mjs → google-provider-stream-CcEI2-MC.mjs} +6 -6
- package/dist/{google-Boz2QcpK.mjs → google-sYI2wnY6.mjs} +2 -2
- package/dist/{google-shared-OyAtMTZv.mjs → google-shared-zGR0QUyS.mjs} +5 -5
- package/dist/{google-vertex-hCxTJea7.mjs → google-vertex-Dw_abY1w.mjs} +2 -2
- package/dist/{host-JWXZWa-c.mjs → host-Bf3NjYNj.mjs} +1 -1
- package/dist/{host-policy-q4Azym9F.mjs → host-policy-BzZluO6_.mjs} +1 -1
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai.mjs +7 -7
- package/dist/internal/runtime.mjs +4 -4
- package/dist/internal/shared.mjs +3 -3
- package/dist/{mistral-DUveP4hF.mjs → mistral-dCDCR5ur.mjs} +4 -4
- package/dist/{openai-chatgpt-responses-OCwckGhY.mjs → openai-chatgpt-responses-BHI3uCcA.mjs} +13 -12
- package/dist/{openai-completions-DOltBUe9.mjs → openai-completions-CrVgnFrV.mjs} +3 -3
- package/dist/{openai-completions-compat-pg1q4uNG.mjs → openai-completions-compat-CYX18uDk.mjs} +1 -1
- package/dist/{openai-completions-transport-OMrn7gnZ.mjs → openai-completions-transport-Dy4CZo9Q.mjs} +48 -34
- package/dist/{openai-prompt-cache-Cr2xKVrS.mjs → openai-prompt-cache-r93BJhjm.mjs} +1 -1
- package/dist/{openai-responses-BSBJUA19.mjs → openai-responses-D5oiAUOG.mjs} +6 -6
- package/dist/{openai-responses-request-lifecycle-D2IFiI0-.mjs → openai-responses-request-lifecycle-NSIJo9jY.mjs} +2 -2
- package/dist/{openai-responses-shared-DVGhq5xF.mjs → openai-responses-shared-D-aDYAkJ.mjs} +10 -10
- package/dist/{provider-transport-turn-state-LuCaTsSO.mjs → provider-transport-turn-state-BOpxgm-J.mjs} +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-0-Rsezog.mjs → reasoning-tag-text-partitioner-CpOy9-IQ.mjs} +361 -223
- package/dist/{simple-options-BARFAzk9.mjs → simple-options-BAu4B54D.mjs} +2 -2
- package/dist/{src-C_wfIUmV.mjs → src-C44MKrW5.mjs} +1 -1
- package/dist/{stream-DwrETW0_.mjs → stream-Dd8DwRFL.mjs} +1 -1
- package/dist/{text-signature-B_MB6U_9.mjs → text-signature-Drb4Erb8.mjs} +2 -2
- package/dist/{transport-stream-shared-DH08b7Il.mjs → transport-stream-shared-CWGOuLcA.mjs} +1 -1
- package/dist/transports.mjs +12 -12
- package/dist/types.mjs +2 -2
- package/dist/{validation-opC2pjk9.mjs → validation-ZX_sPVV0.mjs} +1 -6
- package/dist/validation.mjs +1 -1
- package/package.json +3 -3
package/dist/{openai-completions-transport-OMrn7gnZ.mjs → openai-completions-transport-Dy4CZo9Q.mjs}
RENAMED
|
@@ -3,36 +3,36 @@ import { r as appendAssistantThinking } from "./event-stream-X2gmsUWv.mjs";
|
|
|
3
3
|
import { i as asOptionalRecord, o as isRecord, r as asOptionalObjectRecord } from "./record-coerce-CNDovvft.mjs";
|
|
4
4
|
import { s as readNonEmptyStringPreservingWhitespace, t as hasNonEmptyString } from "./string-coerce-CtgOVOSv.mjs";
|
|
5
5
|
import { n as asNonNegativeFiniteNumber, r as asPositiveFiniteNumber } from "./number-coercion-C3hztWoY.mjs";
|
|
6
|
-
import { N as isImageWithMediaPayload, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-
|
|
6
|
+
import { N as isImageWithMediaPayload, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
|
|
7
7
|
import { M as resolveOpenAIThinkingApi, S as isOpenAIGpt6Model, _ as isResponsesServiceTierRejection, b as isOpenAIGpt55Model, d as OpenAIResponsesWebSocketSafeRetryError, g as responsesServiceTierObserver, k as supportsOpenAITemperature, l as OpenAIResponsesWebSocketPostDispatchError, m as parseOpenAIResponsesWebSocketServerError, r as OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS, t as AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS, u as OpenAIResponsesWebSocketPreDispatchError, v as nextResponsesServiceTier, x as isOpenAIGpt56Model, y as isOpenAIGpt54MiniModel } from "./openai-responses-contracts-DlKMMTxK.mjs";
|
|
8
8
|
import { r as uniqueStrings } from "./string-normalization-I3ux50s9.mjs";
|
|
9
9
|
import { n as getSessionResourceOwnerId, r as registerSessionResourceCleanup } from "./session-resources-D1wgDQ8C.mjs";
|
|
10
10
|
import { c as stableStringify, s as truncateUtf16Safe } from "./provider-error-CF9GWCs2.mjs";
|
|
11
|
-
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
11
|
+
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-r93BJhjm.mjs";
|
|
12
12
|
import { d as hasOnlyResponsesFunctionTools, i as emitModelTransportError, r as emitModelTransportDebug, t as formatModelTransportDebugBaseUrl } from "./diagnostics-tQasYct1.mjs";
|
|
13
|
-
import { f as supportsModelTools, i as providerReplayContextMatches, n as buildProviderReplayContext, o as estimateStringChars, r as isProviderReplayContext } from "./text-signature-
|
|
14
|
-
import { c as resolveOpenAIResponsesTextFormat, i as resolveOpenAICompletionsCompat, l as shouldOmitOllamaCompatResponseFormat, n as isNativeOpenAIEndpoint, o as usesNativeOpenAICodexResponsesBackend, r as isOpenAICodexResponsesModel, s as resolveOpenAICompletionsResponseFormat, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
15
|
-
import { i as resolveProviderEndpoint, t as buildGuardedModelFetch } from "./host-policy-
|
|
13
|
+
import { f as supportsModelTools, i as providerReplayContextMatches, n as buildProviderReplayContext, o as estimateStringChars, r as isProviderReplayContext } from "./text-signature-Drb4Erb8.mjs";
|
|
14
|
+
import { c as resolveOpenAIResponsesTextFormat, i as resolveOpenAICompletionsCompat, l as shouldOmitOllamaCompatResponseFormat, n as isNativeOpenAIEndpoint, o as usesNativeOpenAICodexResponsesBackend, r as isOpenAICodexResponsesModel, s as resolveOpenAICompletionsResponseFormat, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-CYX18uDk.mjs";
|
|
15
|
+
import { i as resolveProviderEndpoint, t as buildGuardedModelFetch } from "./host-policy-BzZluO6_.mjs";
|
|
16
16
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
|
|
17
|
-
import { E as createToolArgumentPreviewSchedule, M as racePromiseWithAbortSignal, O as parseStreamingJson, P as sanitizeSurrogates, S as withProviderResponseHook, b as transportAbortError, c as failTransportStream, d as iterateModelStream, h as notifyProviderStreamOpened, l as finalizeTerminalToolCallArguments, s as createWritableTransportEventStream, u as finalizeTransportStream, v as sanitizeTransportPayloadText, y as throwIfModelStreamAborted } from "./transport-stream-shared-
|
|
18
|
-
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, S as splitSystemPromptRelocatableBoundary, d as describeToolResultMediaPlaceholder, l as codeModeToolSurfaceObserver, m as extractToolResultText, s as prepareModelRequestBody, u as reasoningTagTextPolicy, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-
|
|
19
|
-
import { $ as replayResponsesReasoningUpdates, A as summarizeResponsesPayload, At as measureUtf8AppendBytes, B as responsesInputFingerprint, C as readResponsesRecoveryEvent, Ct as toOpenAIResponsesToolChoice, D as logResponsesFailedNoDetails, Dt as createResponseModelTracker, E as ResponsesStreamFailure, Ft as resolvePromptCacheKey, G as responsesContinuationRequestFingerprint, H as recordResponsesContinuationState, I as convertResponsesMessages, It as redactIdentifier, Lt as sha256Hex, Mt as readOpenAICompletionsContentDeltas, Nt as readOpenAICompletionsReasoningBatch, O as safeDebugValue, Ot as isOpenAICompletionsThinkingEnabled, P as buildResponsesInputMessage, Pt as resolveOpenAIClientBaseUrl, Q as isConfigurationUpdate, R as readResponsesInputReplayState, S as isInvalidEncryptedContentError, St as reconcileOpenAIResponsesToolChoice, T as resolveNextResponsesEncryptedContentAttempt, Tt as createOpenAIProviderAcceptanceHook, U as resolveResponsesContinuationRequest, V as claimOpenAIResponsesHttpContinuation, W as responsesContinuationPrefixFingerprint, _t as resolveOpenAISimpleReasoningEffort, a as prepareResponsesTools, at as suppressOpenAIResponsesCompaction, bt as projectOpenAITools, c as observeResponsesStream, ct as buildOpenAISdkClientOptions, et as supportsResponsesReasoningUpdate, ft as getCompat, gt as resolveOpenAIRequestReasoning, ht as resolveOpenAIStrictToolFlagWithDiagnostics, j as recordResponsesContextUsage, jt as parseOpenAICompletionsUsage, k as summarizeOpenAITransportError, kt as log, lt as buildOpenAISdkRequestOptions, mt as resolveCodeModeResponsesVisibleToolNames, n as applyResponsesServiceTierPricing, nt as buildOpenAIResponsesReasoningReplayMetadata, ot as assertCodeModeResponsesToolSurface, s as processResponsesStream, st as buildOpenAIClientHeaders, ut as enforceCodeModeResponsesToolSurface, w as resolveAzureOpenAIApiVersion, wt as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, x as createResponsesStreamWithRecovery, xt as reconcileOpenAICompletionsToolChoice, yt as prepareOpenAITools, z as recordResponsesInputReplay } from "./openai-responses-shared-
|
|
17
|
+
import { E as createToolArgumentPreviewSchedule, M as racePromiseWithAbortSignal, O as parseStreamingJson, P as sanitizeSurrogates, S as withProviderResponseHook, b as transportAbortError, c as failTransportStream, d as iterateModelStream, h as notifyProviderStreamOpened, l as finalizeTerminalToolCallArguments, s as createWritableTransportEventStream, u as finalizeTransportStream, v as sanitizeTransportPayloadText, y as throwIfModelStreamAborted } from "./transport-stream-shared-CWGOuLcA.mjs";
|
|
18
|
+
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, S as splitSystemPromptRelocatableBoundary, d as describeToolResultMediaPlaceholder, l as codeModeToolSurfaceObserver, m as extractToolResultText, s as prepareModelRequestBody, u as reasoningTagTextPolicy, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-BAu4B54D.mjs";
|
|
19
|
+
import { $ as replayResponsesReasoningUpdates, A as summarizeResponsesPayload, At as measureUtf8AppendBytes, B as responsesInputFingerprint, C as readResponsesRecoveryEvent, Ct as toOpenAIResponsesToolChoice, D as logResponsesFailedNoDetails, Dt as createResponseModelTracker, E as ResponsesStreamFailure, Ft as resolvePromptCacheKey, G as responsesContinuationRequestFingerprint, H as recordResponsesContinuationState, I as convertResponsesMessages, It as redactIdentifier, Lt as sha256Hex, Mt as readOpenAICompletionsContentDeltas, Nt as readOpenAICompletionsReasoningBatch, O as safeDebugValue, Ot as isOpenAICompletionsThinkingEnabled, P as buildResponsesInputMessage, Pt as resolveOpenAIClientBaseUrl, Q as isConfigurationUpdate, R as readResponsesInputReplayState, S as isInvalidEncryptedContentError, St as reconcileOpenAIResponsesToolChoice, T as resolveNextResponsesEncryptedContentAttempt, Tt as createOpenAIProviderAcceptanceHook, U as resolveResponsesContinuationRequest, V as claimOpenAIResponsesHttpContinuation, W as responsesContinuationPrefixFingerprint, _t as resolveOpenAISimpleReasoningEffort, a as prepareResponsesTools, at as suppressOpenAIResponsesCompaction, bt as projectOpenAITools, c as observeResponsesStream, ct as buildOpenAISdkClientOptions, et as supportsResponsesReasoningUpdate, ft as getCompat, gt as resolveOpenAIRequestReasoning, ht as resolveOpenAIStrictToolFlagWithDiagnostics, j as recordResponsesContextUsage, jt as parseOpenAICompletionsUsage, k as summarizeOpenAITransportError, kt as log, lt as buildOpenAISdkRequestOptions, mt as resolveCodeModeResponsesVisibleToolNames, n as applyResponsesServiceTierPricing, nt as buildOpenAIResponsesReasoningReplayMetadata, ot as assertCodeModeResponsesToolSurface, s as processResponsesStream, st as buildOpenAIClientHeaders, ut as enforceCodeModeResponsesToolSurface, w as resolveAzureOpenAIApiVersion, wt as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, x as createResponsesStreamWithRecovery, xt as reconcileOpenAICompletionsToolChoice, yt as prepareOpenAITools, z as recordResponsesInputReplay } from "./openai-responses-shared-D-aDYAkJ.mjs";
|
|
20
20
|
import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
|
|
21
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
22
|
-
import { a as tagUnresolvedTextAsCommentary, i as tagPendingCommentaryText, n as rememberPendingCommentaryTags, r as tagInterruptedTextPhases, t as clearPendingCommentaryText } from "./assistant-text-phase-
|
|
21
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
|
|
22
|
+
import { a as tagUnresolvedTextAsCommentary, i as tagPendingCommentaryText, n as rememberPendingCommentaryTags, r as tagInterruptedTextPhases, t as clearPendingCommentaryText } from "./assistant-text-phase-Bn1hbvK9.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 "./types.mjs";
|
|
26
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders, r as resolveProviderTransportTurnState, t as filterProviderTurnHeadersForExplicitOpencodeSession } from "./provider-transport-turn-state-
|
|
26
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders, r as resolveProviderTransportTurnState, t as filterProviderTurnHeadersForExplicitOpencodeSession } from "./provider-transport-turn-state-BOpxgm-J.mjs";
|
|
27
27
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-Dc42hKv6.mjs";
|
|
28
28
|
import { t as boundResponseBody } from "./streaming-byte-guard-DBXr1XYn.mjs";
|
|
29
29
|
import { f as withPreparedToolSchemaNormalization, r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-DDPXsvJP.mjs";
|
|
30
30
|
import { isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
|
|
31
31
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|
|
32
|
-
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-
|
|
32
|
+
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-CpOy9-IQ.mjs";
|
|
33
33
|
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
34
34
|
import { i as isOpenAIResponsesCompactionOutput, l as resolveOpenAIResponsesPayloadPolicy, n as supportsNativeOpenAIResponsesEndpoint, o as sanitizeResponsesImagePayload, r as createBoundedOpenAIResponsesCompactionFetch, s as applyOpenAIResponsesPayloadPolicy, t as isOfficialOpenAIResponsesBaseUrl } from "./openai-responses-endpoint-CinGh4VZ.mjs";
|
|
35
|
-
import { n as withResponsesRequestAcceptance, r as createResponsesPromptEgressObserver, t as responsesRequestLifecycle } from "./openai-responses-request-lifecycle-
|
|
35
|
+
import { n as withResponsesRequestAcceptance, r as createResponsesPromptEgressObserver, t as responsesRequestLifecycle } from "./openai-responses-request-lifecycle-NSIJo9jY.mjs";
|
|
36
36
|
import { randomUUID } from "node:crypto";
|
|
37
37
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
38
38
|
import { ResponsesWS } from "openai/resources/responses/ws.js";
|
|
@@ -41,7 +41,13 @@ const DEEPSEEK_DSML_MARKERS = [
|
|
|
41
41
|
"|",
|
|
42
42
|
"|",
|
|
43
43
|
"||"
|
|
44
|
-
].
|
|
44
|
+
].flatMap((bar) => [`${bar}DSML${bar}`, `${bar}DSML${bar} `]);
|
|
45
|
+
const DEEPSEEK_DSML_TOOL_OPEN_TOKENS = DEEPSEEK_DSML_MARKERS.flatMap((marker) => [
|
|
46
|
+
"calls",
|
|
47
|
+
"tool_calls",
|
|
48
|
+
"tool_call",
|
|
49
|
+
"function_calls"
|
|
50
|
+
].map((kind) => `<${marker}${kind}>`));
|
|
45
51
|
const DEEPSEEK_DSML_MARKER_PATTERN = `(${DEEPSEEK_DSML_MARKERS.map((marker) => marker.replaceAll("|", "\\|")).join("|")})`;
|
|
46
52
|
function findEarliestDsmlToken(text, tokens, fromIndex = 0) {
|
|
47
53
|
let best = null;
|
|
@@ -69,13 +75,7 @@ function longestDsmlTokenPrefixSuffixLength(text, tokens, maxTokenLength) {
|
|
|
69
75
|
* Removes provider-emitted DSML tool markup while buffering split tag prefixes
|
|
70
76
|
* across streamed chunks.
|
|
71
77
|
*/
|
|
72
|
-
const
|
|
73
|
-
"tool_use_error",
|
|
74
|
-
"tool_calls",
|
|
75
|
-
"tool_call",
|
|
76
|
-
"function_calls"
|
|
77
|
-
];
|
|
78
|
-
const DSML_OPEN_TOKENS = DEEPSEEK_DSML_MARKERS.flatMap((marker) => DSML_KINDS.map((kind) => `<${marker}${kind}>`));
|
|
78
|
+
const DSML_OPEN_TOKENS = [...DEEPSEEK_DSML_TOOL_OPEN_TOKENS, ...DEEPSEEK_DSML_MARKERS.map((marker) => `<${marker}tool_use_error>`)];
|
|
79
79
|
const MAX_OPEN_TOKEN_LEN = Math.max(...DSML_OPEN_TOKENS.map((token) => token.length));
|
|
80
80
|
/** Create an incremental text filter that strips DeepSeek DSML tool blocks. */
|
|
81
81
|
function createDeepSeekTextFilter() {
|
|
@@ -1086,12 +1086,6 @@ function buildOpenAICompletionsRequest(model, context, options, policy) {
|
|
|
1086
1086
|
}
|
|
1087
1087
|
//#endregion
|
|
1088
1088
|
//#region packages/ai/src/transports/openai-completions-dsml.ts
|
|
1089
|
-
const DEEPSEEK_DSML_TOOL_KINDS = [
|
|
1090
|
-
"tool_calls",
|
|
1091
|
-
"tool_call",
|
|
1092
|
-
"function_calls"
|
|
1093
|
-
];
|
|
1094
|
-
const DEEPSEEK_DSML_TOOL_OPEN_TOKENS = DEEPSEEK_DSML_MARKERS.flatMap((marker) => DEEPSEEK_DSML_TOOL_KINDS.map((kind) => `<${marker}${kind}>`));
|
|
1095
1089
|
const DEEPSEEK_DSML_INVOKE_OPEN_PREFIXES = DEEPSEEK_DSML_MARKERS.map((marker) => `<${marker}invoke`);
|
|
1096
1090
|
const DEEPSEEK_DSML_INVOKE_OPEN_TAG = new RegExp(`^<${DEEPSEEK_DSML_MARKER_PATTERN}invoke\\b[^<>]*>$`);
|
|
1097
1091
|
const DEEPSEEK_DSML_TOOL_MAX_OPEN_TOKEN_LEN = Math.max(...DEEPSEEK_DSML_TOOL_OPEN_TOKENS.map((token) => token.length));
|
|
@@ -1450,9 +1444,9 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1450
1444
|
const openAIModel = model;
|
|
1451
1445
|
const compat = getCompat(openAIModel);
|
|
1452
1446
|
const visibleReasoningDetailTypes = new Set(compat.visibleReasoningDetailTypes);
|
|
1453
|
-
const shouldFilterDeepSeekDsmlText =
|
|
1447
|
+
const shouldFilterDeepSeekDsmlText = compat.thinkingFormat === "deepseek";
|
|
1454
1448
|
const deepSeekTextFilter = shouldFilterDeepSeekDsmlText ? createDeepSeekTextFilter() : null;
|
|
1455
|
-
const deepSeekToolCallRecoverer = shouldFilterDeepSeekDsmlText ? createDsmlRecoverer() : null;
|
|
1449
|
+
const deepSeekToolCallRecoverer = !directMode && shouldFilterDeepSeekDsmlText ? createDsmlRecoverer() : null;
|
|
1456
1450
|
const gemmaToolCallRecoverer = !directMode && /gemma-?4/i.test(model.id) ? createGemmaToolCallRecoverer() : null;
|
|
1457
1451
|
const reasoningTagTextPartitioner = createReasoningTagTextPartitioner();
|
|
1458
1452
|
if (options?.strictReasoningTags) reasoningTagTextPartitioner.markStrict();
|
|
@@ -1628,8 +1622,8 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1628
1622
|
text: ""
|
|
1629
1623
|
});
|
|
1630
1624
|
};
|
|
1631
|
-
const flushReasoningTagTextPartitioner = () => {
|
|
1632
|
-
const recoverUnclosed = output.stopReason !== "length" && output.stopReason !== "error" && output.stopReason !== "aborted";
|
|
1625
|
+
const flushReasoningTagTextPartitioner = (allowRecovery = true) => {
|
|
1626
|
+
const recoverUnclosed = allowRecovery && output.stopReason !== "length" && output.stopReason !== "error" && output.stopReason !== "aborted";
|
|
1633
1627
|
for (const delta of reasoningTagTextPartitioner.flush({ recoverUnclosed })) appendPartitionedVisibleDelta(delta);
|
|
1634
1628
|
};
|
|
1635
1629
|
const flushGemmaToolCallRecoverer = (allowRecovery = true) => {
|
|
@@ -1664,6 +1658,12 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1664
1658
|
hint: "The provider may be stalled while parsing the tool payload; retry with a smaller tool surface or enable OPENCLAW_DEBUG_MODEL_PAYLOAD=tools to inspect exposed tools."
|
|
1665
1659
|
});
|
|
1666
1660
|
const events = directMode ? guardedStream : iterateModelStream(guardedStream, options?.signal);
|
|
1661
|
+
const maxUsageTokens = {
|
|
1662
|
+
prompt: 0,
|
|
1663
|
+
completion: 0,
|
|
1664
|
+
total: 0,
|
|
1665
|
+
reasoning: 0
|
|
1666
|
+
};
|
|
1667
1667
|
for await (const rawChunk of events) {
|
|
1668
1668
|
throwIfModelStreamAborted(options?.signal);
|
|
1669
1669
|
chunkPushedEvent = false;
|
|
@@ -1673,10 +1673,24 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1673
1673
|
if (typeof chunk.model === "string" && chunk.model.length > 0 && chunk.model !== model.id) output.responseModel ||= chunk.model;
|
|
1674
1674
|
const choice = Array.isArray(chunk.choices) ? chunk.choices[0] : void 0;
|
|
1675
1675
|
const usage = chunk.usage || choice?.usage;
|
|
1676
|
-
|
|
1676
|
+
let hasUsageProgress = false;
|
|
1677
|
+
let hasReasoningUsageActivity = false;
|
|
1678
|
+
for (const [counter, reported] of [
|
|
1679
|
+
["prompt", usage?.prompt_tokens],
|
|
1680
|
+
["completion", usage?.completion_tokens],
|
|
1681
|
+
["total", usage?.total_tokens],
|
|
1682
|
+
["reasoning", usage?.completion_tokens_details?.reasoning_tokens]
|
|
1683
|
+
]) {
|
|
1684
|
+
const tokens = asPositiveFiniteNumber(reported) ?? 0;
|
|
1685
|
+
if (tokens > maxUsageTokens[counter]) {
|
|
1686
|
+
maxUsageTokens[counter] = tokens;
|
|
1687
|
+
hasUsageProgress = true;
|
|
1688
|
+
hasReasoningUsageActivity ||= counter === "reasoning";
|
|
1689
|
+
}
|
|
1690
|
+
}
|
|
1677
1691
|
if (usage) output.usage = parseOpenAICompletionsUsage(usage, model, { includeReasoningTokens: !directMode });
|
|
1678
1692
|
const rawChoiceDelta = choice?.delta ?? choice?.message;
|
|
1679
|
-
notifyLlmRequestActivity(options?.signal, Boolean(
|
|
1693
|
+
notifyLlmRequestActivity(options?.signal, Boolean(hasUsageProgress || choice?.finish_reason || rawChoiceDelta && (rawChoiceDelta.tool_calls?.length || hasOpenAICompletionsDeltaContent(rawChoiceDelta))));
|
|
1680
1694
|
if (!choice) {
|
|
1681
1695
|
emitReasoningUsageActivity(hasReasoningUsageActivity);
|
|
1682
1696
|
continue;
|
|
@@ -1722,7 +1736,7 @@ async function processCompletionsStream(responseStream, output, model, stream, o
|
|
|
1722
1736
|
if (toolCallDeltas.length > 0) {
|
|
1723
1737
|
flushGemmaToolCallRecoverer(false);
|
|
1724
1738
|
sawNativeToolCallDelta = true;
|
|
1725
|
-
flushReasoningTagTextPartitioner();
|
|
1739
|
+
flushReasoningTagTextPartitioner(false);
|
|
1726
1740
|
rememberPendingCommentaryTags(provisionalCommentaryTags, tagPendingCommentaryText(output.content));
|
|
1727
1741
|
for (const toolCall of toolCallDeltas) {
|
|
1728
1742
|
const streamIndex = typeof toolCall.index === "number" ? toolCall.index : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-
|
|
1
|
+
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-CYX18uDk.mjs";
|
|
2
2
|
//#region packages/normalization-core/src/code-points.ts
|
|
3
3
|
/** Truncates to a nonnegative code-point budget; grapheme clusters may be split. */
|
|
4
4
|
function truncateCodePoints(text, maxCodePoints) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
4
|
-
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-r93BJhjm.mjs";
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-CYX18uDk.mjs";
|
|
5
5
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
|
|
6
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
7
|
-
import { F as convertProviderResponsesMessages, _t as resolveOpenAISimpleReasoningEffort, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
6
|
+
import { n as buildBaseOptions } from "./simple-options-BAu4B54D.mjs";
|
|
7
|
+
import { F as convertProviderResponsesMessages, _t as resolveOpenAISimpleReasoningEffort, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-D-aDYAkJ.mjs";
|
|
8
8
|
import { n as getEnvApiKey } from "./env-api-keys-CrxwdylR.mjs";
|
|
9
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
10
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-
|
|
9
|
+
import { t as createAssistantOutput } from "./assistant-output-BuhRpLeD.mjs";
|
|
10
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-BOpxgm-J.mjs";
|
|
11
11
|
import { t as requireApiKey } from "./required-api-key-CFJvcFy_.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 { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
2
|
import { h as responsesPromptObserver } from "./openai-responses-contracts-DlKMMTxK.mjs";
|
|
3
|
-
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-
|
|
4
|
-
import { C as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
3
|
+
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-CWGOuLcA.mjs";
|
|
4
|
+
import { C as stripSystemPromptCacheBoundary } from "./simple-options-BAu4B54D.mjs";
|
|
5
5
|
//#region packages/ai/src/transports/openai-responses-prompt-observer-internal.ts
|
|
6
6
|
function readFinalResponsesPrompt(request) {
|
|
7
7
|
if (typeof request.instructions === "string") return ["instructions", request.instructions];
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import "./src-
|
|
1
|
+
import "./src-C44MKrW5.mjs";
|
|
2
2
|
import { _ as runtimeContextContentToText, f as hasRuntimeContextMarker, p as isRuntimeContextMessage } from "./types-CQc6JNG4.mjs";
|
|
3
3
|
import { o as readProviderRefusalReview, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
4
4
|
import { r as appendAssistantThinking } from "./event-stream-X2gmsUWv.mjs";
|
|
5
5
|
import { o as isRecord, r as asOptionalObjectRecord } from "./record-coerce-CNDovvft.mjs";
|
|
6
6
|
import { a as normalizeOptionalString, c as readStringValue, n as normalizeLowercaseStringOrEmpty, o as normalizeStringifiedOptionalString } from "./string-coerce-CtgOVOSv.mjs";
|
|
7
7
|
import { t as asFiniteNumber } from "./number-coercion-C3hztWoY.mjs";
|
|
8
|
-
import { D as applyProviderReportedUsageCost, E as headersToRecord, N as isImageWithMediaPayload, O as calculateCost, a as resolveAiTransportHeaderSentinels, k as clampThinkingLevel, r as getAiTransportHost } from "./host-
|
|
8
|
+
import { D as applyProviderReportedUsageCost, E as headersToRecord, N as isImageWithMediaPayload, O as calculateCost, a as resolveAiTransportHeaderSentinels, k as clampThinkingLevel, r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
|
|
9
9
|
import { A as MODEL_CATALOG_THINKING_LEVELS, C as normalizeOpenAIReasoningEffort, E as resolveOpenAIReasoningEffortMapping, M as resolveOpenAIThinkingApi, O as supportsOpenAIReasoningEffort, T as resolveOpenAIReasoningEffortForModel, _ as isResponsesServiceTierRejection, a as OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE, c as OPENAI_RESPONSES_RETAINED_COMPACTION_REPLAY_TYPE, f as RESPONSE_FAILED_NO_DETAILS_MESSAGE, g as responsesServiceTierObserver, i as OPENAI_RESPONSES_APIS, k as supportsOpenAITemperature, o as OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY, p as isPreviousResponseRejection, s as OPENAI_RESPONSES_REASONING_REPLAY_META_KEY, v as nextResponsesServiceTier, w as resolveOpenAIModelReasoningEfforts } from "./openai-responses-contracts-DlKMMTxK.mjs";
|
|
10
10
|
import { n as getSessionResourceOwnerId, r as registerSessionResourceCleanup } from "./session-resources-D1wgDQ8C.mjs";
|
|
11
11
|
import { c as stableStringify, s as truncateUtf16Safe } from "./provider-error-CF9GWCs2.mjs";
|
|
12
|
-
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-
|
|
12
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-r93BJhjm.mjs";
|
|
13
13
|
import { _ as resolveResponsesTerminalStopReason, a as resolveModelPayloadDebugMode, d as hasOnlyResponsesFunctionTools, f as isResponsesProviderTool, g as readResponsesReasoningTokens, h as mapResponsesTerminalUsage, o as resolveModelSseDebugMode, r as emitModelTransportDebug, u as ResponsesOutputIdentityError } from "./diagnostics-tQasYct1.mjs";
|
|
14
|
-
import { i as providerReplayContextMatches, l as redactSensitiveText, n as buildProviderReplayContext, r as isProviderReplayContext, s as isCodeModeModelVisibleToolName, t as encodeTextSignatureV1 } from "./text-signature-
|
|
15
|
-
import { c as resolveOpenAIResponsesTextFormat, i as resolveOpenAICompletionsCompat, o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-
|
|
16
|
-
import { r as resolveModelRequestTimeoutMs } from "./host-policy-
|
|
17
|
-
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-
|
|
18
|
-
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText, s as prepareModelRequestBody } from "./simple-options-
|
|
19
|
-
import { n as transformProviderMessages } from "./assistant-output-
|
|
14
|
+
import { i as providerReplayContextMatches, l as redactSensitiveText, n as buildProviderReplayContext, r as isProviderReplayContext, s as isCodeModeModelVisibleToolName, t as encodeTextSignatureV1 } from "./text-signature-Drb4Erb8.mjs";
|
|
15
|
+
import { c as resolveOpenAIResponsesTextFormat, i as resolveOpenAICompletionsCompat, o as usesNativeOpenAICodexResponsesBackend } from "./openai-completions-compat-CYX18uDk.mjs";
|
|
16
|
+
import { r as resolveModelRequestTimeoutMs } from "./host-policy-BzZluO6_.mjs";
|
|
17
|
+
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-CWGOuLcA.mjs";
|
|
18
|
+
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, m as extractToolResultText, s as prepareModelRequestBody } from "./simple-options-BAu4B54D.mjs";
|
|
19
|
+
import { n as transformProviderMessages } from "./assistant-output-BuhRpLeD.mjs";
|
|
20
20
|
import { n as projectRuntimeToolInputSchema, t as prepareRuntimeToolInputSchema } from "./tool-schema-json-projection-B8sG1I9v.mjs";
|
|
21
21
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
22
22
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
@@ -1596,7 +1596,7 @@ function convertResponsesMessagesWithStyle(model, context, allowedToolCallProvid
|
|
|
1596
1596
|
messages.push(msg);
|
|
1597
1597
|
continue;
|
|
1598
1598
|
}
|
|
1599
|
-
if (isRuntimeContextMessage(msg)) messages.push(buildResponsesInputMessage(resolveResponsesInstructionRole(model), [{
|
|
1599
|
+
if (inHistorySystemUpdates && isRuntimeContextMessage(msg)) messages.push(buildResponsesInputMessage(resolveResponsesInstructionRole(model), [{
|
|
1600
1600
|
type: "input_text",
|
|
1601
1601
|
text: sanitizeTransportPayloadText(runtimeContextContentToText(msg.content))
|
|
1602
1602
|
}]));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-Bf3NjYNj.mjs";
|
|
2
2
|
import { n as resolveCloudflareBaseUrl, t as isCloudflareProvider } from "./cloudflare-5qSGvIUH.mjs";
|
|
3
|
-
import { Pt as resolveOpenAIClientBaseUrl } from "./openai-responses-shared-
|
|
3
|
+
import { Pt as resolveOpenAIClientBaseUrl } from "./openai-responses-shared-D-aDYAkJ.mjs";
|
|
4
4
|
import { n as resolveOpencodeSessionHeaders, t as hasOpencodeSessionHeader } from "./session-affinity-DA4WHv1h.mjs";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
6
6
|
import OpenAI from "openai";
|
package/dist/providers.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
2
|
import { n as projectProviderError } from "./provider-error-CF9GWCs2.mjs";
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "./openai-prompt-cache-r93BJhjm.mjs";
|
|
4
4
|
import { t as createZeroUsage } from "./usage-CJH5D6Ea.mjs";
|
|
5
5
|
//#region packages/ai/src/providers/register-builtins.ts
|
|
6
6
|
/** Source id used for built-in API provider registrations. */
|
|
@@ -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-BalhAzs-.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-CrVgnFrV.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-dCDCR5ur.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-D5oiAUOG.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-DfT9Ndd8.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-BHI3uCcA.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-sYI2wnY6.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-9SSqsJg9.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-Dw_abY1w.mjs"), (module) => ({
|
|
86
86
|
stream: module.streamGoogleVertex,
|
|
87
87
|
streamSimple: module.streamSimpleGoogleVertex
|
|
88
88
|
}))
|