@openclaw/ai 2026.10.10 → 2026.11.2
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-CUVqVXTe.mjs} +6 -6
- package/dist/{anthropic-stream-reducer-C__ByTq1.mjs → anthropic-stream-reducer-yWDb5Cct.mjs} +8 -8
- package/dist/{anthropic-tool-projection-DA_KeluM.mjs → anthropic-tool-projection-DZOKfAmL.mjs} +1 -1
- package/dist/{assistant-output-DbgdWAhJ.mjs → assistant-output-BnQm3fov.mjs} +3 -3
- package/dist/{azure-openai-responses-DHzTwi-y.mjs → azure-openai-responses-I97-HnAv.mjs} +4 -4
- package/dist/{diagnostics-Cv7cW3pS.mjs → diagnostics-v7oVEW59.mjs} +17 -1
- package/dist/diagnostics.mjs +1 -1
- package/dist/{google-CZ6uGVkV.mjs → google-Cpi_cLKZ.mjs} +2 -2
- package/dist/{google-interactions-qd4flmND.mjs → google-interactions-BYRQ49MR.mjs} +91 -30
- package/dist/{google-messages-B-svbJuN.mjs → google-messages-DQMgG5yG.mjs} +9 -3
- package/dist/{google-provider-stream-DlhaCvCf.mjs → google-provider-stream-BHd0cST9.mjs} +16 -11
- package/dist/{google-shared-Cif7nve-.mjs → google-shared-vtag8bj5.mjs} +6 -5
- package/dist/{google-vertex-BZTcYnWU.mjs → google-vertex-eKoUnW7N.mjs} +2 -2
- package/dist/google-video-slots-D8tPH8wX.mjs +29 -0
- package/dist/{host-rCxf5Tjd.mjs → host-CWt55nnF.mjs} +12 -8
- package/dist/{host-policy-Ci1cKluf.mjs → host-policy-Dm7PM6AD.mjs} +1 -1
- package/dist/index.mjs +2 -2
- package/dist/internal/anthropic.d.mts +2 -2
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-completions-compat.d.mts +4 -0
- package/dist/internal/openai-completions-compat.mjs +3 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.mjs +9 -9
- package/dist/internal/retry-after.d.mts +2 -2
- package/dist/internal/retry-after.mjs +75 -1
- package/dist/internal/runtime.mjs +3 -3
- package/dist/internal/shared.mjs +2 -2
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{mistral-C_ImzxlK.mjs → mistral-CQ7aoWg2.mjs} +4 -4
- package/dist/{openai-chatgpt-responses-iGYDPbmc.mjs → openai-chatgpt-responses-DgDVhpUI.mjs} +12 -12
- package/dist/{openai-completions-CDy5u1mv.mjs → openai-completions-BdfBhFjx.mjs} +3 -3
- package/dist/{openai-completions-compat-CJ0OXZgi.mjs → openai-completions-compat-bNQXF1y9.mjs} +2 -2
- package/dist/openai-completions-reasoning-replay-BwT1xwRI.mjs +45 -0
- package/dist/{openai-completions-transport-DLrm5EWi.mjs → openai-completions-transport-CnFaKYO-.mjs} +21 -64
- package/dist/{openai-prompt-cache-h8vXRiaH.mjs → openai-prompt-cache-B9AvdoEo.mjs} +1 -1
- package/dist/{openai-responses-Cp2QPq7K.mjs → openai-responses-5KI4v8DN.mjs} +6 -6
- package/dist/{openai-responses-contracts-DCG51Us0.mjs → openai-responses-contracts-B5mGAbR6.mjs} +1 -1
- package/dist/{openai-responses-endpoint-JbBT8IDv.mjs → openai-responses-endpoint-CfKR6N5f.mjs} +1 -1
- package/dist/{openai-responses-request-lifecycle-DuMpdA6y.mjs → openai-responses-request-lifecycle-WKXjj_th.mjs} +7 -7
- package/dist/{openai-responses-shared-CNfHudFg.mjs → openai-responses-shared-iWBHb0Sq.mjs} +48 -17
- package/dist/{openai-tool-schema-CGhEl7ao.mjs → openai-tool-schema-BTEU2xmN.mjs} +2 -2
- package/dist/{provider-replay-context-BC23HyZo.mjs → provider-replay-context-4vxI7p4V.mjs} +1 -1
- package/dist/{provider-transport-turn-state-B11rmZpv.mjs → provider-transport-turn-state-BbaD56A1.mjs} +2 -2
- 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 +10 -10
- package/dist/retry-after-BrmTv0jL.d.mts +25 -0
- package/dist/{simple-options-BdJJbzZk.mjs → simple-options-xJkqrG_E.mjs} +3 -3
- package/dist/{stream-DQqGjhbq.mjs → stream-C4YDqhFj.mjs} +1 -1
- package/dist/{tool-schema-json-projection-Cvq69Ajp.mjs → tool-schema-json-projection-B1sTYwfH.mjs} +1 -1
- package/dist/{transport-stream-shared-DdnJGEj0.mjs → transport-stream-shared-lhgkTOz3.mjs} +2 -2
- package/dist/{transport-utils-CcCAuFVS.mjs → transport-utils-DwOpuTjL.mjs} +2 -2
- package/dist/transports.d.mts +11 -2
- package/dist/transports.mjs +16 -15
- package/package.json +1 -1
- package/dist/retry-after-sw-XX8aC.d.mts +0 -15
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { n as __exportAll } from "./reasoning-tag-text-partitioner-DzlRubwU.mjs";
|
|
2
2
|
import { w as supportsClaudeAdaptiveThinking } from "./src-CyA0zJnt.mjs";
|
|
3
3
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
4
|
-
import { T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, a as resolveAiTransportHeaderSentinels, b as prepareClaudeNoPrefillRequestContext, r as getAiTransportHost } from "./host-
|
|
5
|
-
import { s as streamFragmentError } from "./transport-utils-
|
|
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-
|
|
4
|
+
import { T as usesClaudeStreamingRefusalContract, _ as buildAnthropicClaudeCodeIdentity, a as resolveAiTransportHeaderSentinels, b as prepareClaudeNoPrefillRequestContext, r as getAiTransportHost } from "./host-CWt55nnF.mjs";
|
|
5
|
+
import { s as streamFragmentError } from "./transport-utils-DwOpuTjL.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-yWDb5Cct.mjs";
|
|
7
7
|
import { i as resolveCacheRetention, n as resolveCloudflareBaseUrl, r as buildCopilotDynamicHeaders } from "./cloudflare-Dttf8jKq.mjs";
|
|
8
|
-
import { n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-
|
|
9
|
-
import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-
|
|
8
|
+
import { n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-xJkqrG_E.mjs";
|
|
9
|
+
import { D as parseJsonWithRepair, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-lhgkTOz3.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-BnQm3fov.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-yWDb5Cct.mjs}
RENAMED
|
@@ -4,18 +4,18 @@ import { r as appendAssistantThinking } from "./event-stream-X2gmsUWv.mjs";
|
|
|
4
4
|
import { a as asRecord, o as isRecord, r as asOptionalObjectRecord, s as readStringField } from "./record-coerce-CNDovvft.mjs";
|
|
5
5
|
import { a as normalizeOptionalLowercaseString, i as normalizeNullableString } from "./string-coerce-Cj8sqWHx.mjs";
|
|
6
6
|
import { n as asNonNegativeFiniteNumber } from "./number-coercion-37gmNkuA.mjs";
|
|
7
|
-
import { N as isImageWithMediaPayload, O as calculateCost, S as resolveAnthropicThinkingEffort, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, r as getAiTransportHost, u as STREAM_ERROR_FALLBACK_TEXT, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "./host-
|
|
8
|
-
import "./transport-utils-
|
|
7
|
+
import { N as isImageWithMediaPayload, O as calculateCost, S as resolveAnthropicThinkingEffort, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, r as getAiTransportHost, u as STREAM_ERROR_FALLBACK_TEXT, v as defaultsClaudeAdaptiveThinking, w as usesClaudeFable5MessagesContract, x as requiresClaudeAdaptiveThinking, y as mapAnthropicStopReason } from "./host-CWt55nnF.mjs";
|
|
8
|
+
import "./transport-utils-DwOpuTjL.mjs";
|
|
9
9
|
import { n as estimateBase64DecodedBytes } from "./base64-C8CdcsjU.mjs";
|
|
10
|
-
import { a as resolveProviderRequestCapabilities, i as resolveProviderEndpoint } from "./host-policy-
|
|
10
|
+
import { a as resolveProviderRequestCapabilities, i as resolveProviderEndpoint } from "./host-policy-Dm7PM6AD.mjs";
|
|
11
11
|
import { i as resolveCacheRetention } from "./cloudflare-Dttf8jKq.mjs";
|
|
12
12
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
13
|
-
import { S as splitSystemPromptCacheBoundary, T as stripSystemPromptRelocatableBoundary, d as extractToolResultBlockText, f as extractToolResultText, h as preparedRequestSuffix, l as describeToolResultMediaPlaceholder, t as adjustMaxTokensForThinking, w as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
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-
|
|
13
|
+
import { S as splitSystemPromptCacheBoundary, T as stripSystemPromptRelocatableBoundary, d as extractToolResultBlockText, f as extractToolResultText, h as preparedRequestSuffix, l as describeToolResultMediaPlaceholder, t as adjustMaxTokensForThinking, w as stripSystemPromptCacheBoundary } from "./simple-options-xJkqrG_E.mjs";
|
|
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-lhgkTOz3.mjs";
|
|
15
15
|
import { t as parsePositiveInteger } from "./positive-integer-Bb4Evc7L.mjs";
|
|
16
|
-
import { n as isProviderReplayContext, r as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-
|
|
17
|
-
import { n as transformProviderMessages } from "./assistant-output-
|
|
18
|
-
import { a as reconcileAnthropicToolChoice, i as projectAnthropicTools, n as normalizeAnthropicToolChoice, o as resolveOriginalAnthropicToolName, s as toClaudeCodeToolName, t as normalizeAnthropicToolCallId } from "./anthropic-tool-projection-
|
|
16
|
+
import { n as isProviderReplayContext, r as providerReplayContextMatches, t as buildProviderReplayContext } from "./provider-replay-context-4vxI7p4V.mjs";
|
|
17
|
+
import { n as transformProviderMessages } from "./assistant-output-BnQm3fov.mjs";
|
|
18
|
+
import { a as reconcileAnthropicToolChoice, i as projectAnthropicTools, n as normalizeAnthropicToolChoice, o as resolveOriginalAnthropicToolName, s as toClaudeCodeToolName, t as normalizeAnthropicToolCallId } from "./anthropic-tool-projection-DZOKfAmL.mjs";
|
|
19
19
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
20
20
|
//#region packages/ai/src/providers/anthropic-auth-headers.ts
|
|
21
21
|
/** Inspect resolved credential shape for auth routing without exposing its value. */
|
package/dist/{anthropic-tool-projection-DA_KeluM.mjs → anthropic-tool-projection-DZOKfAmL.mjs}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
2
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-D_MeCQFI.mjs";
|
|
3
|
-
import { _ as SCHEMA_MAP_KEYS, d as inheritToolSchemaTruncation, g as SCHEMA_ARRAY_KEYS, i as publishRuntimeToolInputSchema, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, y as SCHEMA_OBJECT_KEYS } from "./tool-schema-json-projection-
|
|
3
|
+
import { _ as SCHEMA_MAP_KEYS, d as inheritToolSchemaTruncation, g as SCHEMA_ARRAY_KEYS, i as publishRuntimeToolInputSchema, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, y as SCHEMA_OBJECT_KEYS } from "./tool-schema-json-projection-B1sTYwfH.mjs";
|
|
4
4
|
//#region packages/ai/src/providers/anthropic-tool-projection.ts
|
|
5
5
|
const CLAUDE_CODE_TOOL_LOOKUP = new Map([
|
|
6
6
|
"Read",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as transformMessages } from "./host-
|
|
2
|
-
import { a as createEmptyTransportUsage } from "./transport-stream-shared-
|
|
1
|
+
import { c as transformMessages } from "./host-CWt55nnF.mjs";
|
|
2
|
+
import { a as createEmptyTransportUsage } from "./transport-stream-shared-lhgkTOz3.mjs";
|
|
3
3
|
//#region packages/ai/src/provider-transcript-transform.ts
|
|
4
4
|
const IMAGE_OMISSION = "(image omitted: model does not support images)";
|
|
5
5
|
const VIDEO_OMISSION = "(video omitted: provider does not support video input)";
|
|
@@ -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
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
|
-
import { r as getAiTransportHost } from "./host-
|
|
3
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
2
|
+
import { r as getAiTransportHost } from "./host-CWt55nnF.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-xJkqrG_E.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-BnQm3fov.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-iWBHb0Sq.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";
|
|
@@ -167,6 +167,22 @@ function resolveResponsesTerminalStopReason(params) {
|
|
|
167
167
|
//#endregion
|
|
168
168
|
//#region packages/ai/src/transports/openai-responses-stream-errors.ts
|
|
169
169
|
const OUTPUT_IDENTITY_ERROR_CODE = "responses_output_identity_conflict";
|
|
170
|
+
const TOOL_CALL_WHITESPACE = /\s/u;
|
|
171
|
+
var DegenerateToolCallArgumentsError = class extends Error {
|
|
172
|
+
constructor() {
|
|
173
|
+
super("Tool-call argument stream exceeded the consecutive whitespace limit");
|
|
174
|
+
this.code = "degenerate_output";
|
|
175
|
+
this.name = "DegenerateToolCallArgumentsError";
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
function countToolCallTrailingWhitespace(delta, previous = 0) {
|
|
179
|
+
const limit = 32768;
|
|
180
|
+
let tail = 0;
|
|
181
|
+
for (let index = delta.length - 1; index >= 0 && tail < limit && TOOL_CALL_WHITESPACE.test(delta.charAt(index)); index--) tail += 1;
|
|
182
|
+
const count = tail === delta.length ? previous + tail : tail;
|
|
183
|
+
if (count >= limit) throw new DegenerateToolCallArgumentsError();
|
|
184
|
+
return count;
|
|
185
|
+
}
|
|
170
186
|
function outputType(type) {
|
|
171
187
|
return type === "reasoning" || type === "message" || type === "function_call" || type === "compaction" ? type : "other";
|
|
172
188
|
}
|
|
@@ -329,4 +345,4 @@ function formatModelTransportDebugBaseUrl(rawUrl) {
|
|
|
329
345
|
return rawUrl ? formatModelTransportDebugUrl(rawUrl) : "default";
|
|
330
346
|
}
|
|
331
347
|
//#endregion
|
|
332
|
-
export {
|
|
348
|
+
export { mapResponsesTerminalUsage as _, resolveModelPayloadDebugMode as a, extractErrorCodeOrErrno as b, hasRetryableConnectionErrorCode as c, ResponsesOutputIdentityError as d, countToolCallTrailingWhitespace as f, isResponsesOutputLimitToolCallError as g, resolveResponsesOutputIdentityRetry as h, emitModelTransportError as i, isTransientNetworkError as l, isResponsesProviderTool as m, formatModelTransportDebugUrl as n, resolveModelSseDebugMode as o, hasOnlyResponsesFunctionTools as p, emitModelTransportDebug as r, WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE as s, formatModelTransportDebugBaseUrl as t, DegenerateToolCallArgumentsError as u, readResponsesReasoningTokens as v, toErrorObject as x, resolveResponsesTerminalStopReason as y };
|
package/dist/diagnostics.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
2
2
|
import { a as projectDiagnosticValue, t as configureProviderErrorRedactor } from "./provider-error-qtZD2inE.mjs";
|
|
3
|
-
import { c as hasRetryableConnectionErrorCode,
|
|
3
|
+
import { c as hasRetryableConnectionErrorCode, g as isResponsesOutputLimitToolCallError, h as resolveResponsesOutputIdentityRetry, i as emitModelTransportError, l as isTransientNetworkError, n as formatModelTransportDebugUrl, r as emitModelTransportDebug, s as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, t as formatModelTransportDebugBaseUrl } from "./diagnostics-v7oVEW59.mjs";
|
|
4
4
|
export { WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, appendAssistantMessageDiagnostic, configureProviderErrorRedactor, createAssistantMessageDiagnostic, emitModelTransportDebug, emitModelTransportError, extractDiagnosticError, formatModelTransportDebugBaseUrl, formatModelTransportDebugUrl, formatThrownValue, hasRetryableConnectionErrorCode, isProviderRefusalAssistantError, isResponsesOutputLimitToolCallError, isTransientNetworkError, projectDiagnosticValue, readProviderRefusalReview, resolveResponsesOutputIdentityRetry };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-CWt55nnF.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-BHd0cST9.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) => {
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
2
|
import { a as asRecord, i as asOptionalRecord, s as readStringField } from "./record-coerce-CNDovvft.mjs";
|
|
3
|
-
import { O as calculateCost, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-
|
|
4
|
-
import { s as streamFragmentError } from "./transport-utils-
|
|
5
|
-
import { t as buildGuardedModelFetch } from "./host-policy-
|
|
3
|
+
import { O as calculateCost, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-CWt55nnF.mjs";
|
|
4
|
+
import { s as streamFragmentError } from "./transport-utils-DwOpuTjL.mjs";
|
|
5
|
+
import { t as buildGuardedModelFetch } from "./host-policy-Dm7PM6AD.mjs";
|
|
6
6
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
7
|
-
import { n as buildBaseOptions, w as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
8
|
-
import { b as transportAbortError, c as failTransportStream, g as parseTerminalToolCallArguments, h as notifyProviderStreamOpened, m as notifyProviderHttpResponse, w as parseJsonPreservingUnsafeIntegers } from "./transport-stream-shared-
|
|
7
|
+
import { n as buildBaseOptions, w as stripSystemPromptCacheBoundary } from "./simple-options-xJkqrG_E.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-lhgkTOz3.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-BnQm3fov.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-vtag8bj5.mjs";
|
|
12
14
|
//#region packages/ai/package.json
|
|
13
|
-
var version = "2026.
|
|
15
|
+
var version = "2026.11.2";
|
|
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,11 +1,13 @@
|
|
|
1
|
+
import { f as hasRuntimeContextMarker } from "./types-BXd0kI8-.mjs";
|
|
1
2
|
import { r as appendAssistantThinking } from "./event-stream-X2gmsUWv.mjs";
|
|
2
|
-
import { N as isImageWithMediaPayload, O as calculateCost } from "./host-
|
|
3
|
+
import { N as isImageWithMediaPayload, O as calculateCost } from "./host-CWt55nnF.mjs";
|
|
3
4
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
4
5
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-D_MeCQFI.mjs";
|
|
5
|
-
import { f as extractToolResultText, l as describeToolResultMediaPlaceholder } from "./simple-options-
|
|
6
|
-
import { a as createEmptyTransportUsage, b as transportAbortError, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-
|
|
6
|
+
import { f as extractToolResultText, l as describeToolResultMediaPlaceholder } from "./simple-options-xJkqrG_E.mjs";
|
|
7
|
+
import { a as createEmptyTransportUsage, b as transportAbortError, r as coerceTransportToolCallArguments, v as sanitizeTransportPayloadText } from "./transport-stream-shared-lhgkTOz3.mjs";
|
|
7
8
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
8
9
|
import { isGoogleGemini4Model } from "./internal/google-model-family.mjs";
|
|
10
|
+
import "./types.mjs";
|
|
9
11
|
//#region packages/ai/src/transports/google-thinking-level.ts
|
|
10
12
|
/** Reports MINIMAL support for Gemini Flash and Gemini 4 models. */
|
|
11
13
|
function googleFlashSupportsMinimalThinking(modelId) {
|
|
@@ -311,6 +313,10 @@ function projectGoogleMessages(params) {
|
|
|
311
313
|
});
|
|
312
314
|
const visibleParts = managed && !model.input.includes("image") ? parts.filter((part) => !part.inlineData) : parts;
|
|
313
315
|
if (visibleParts.length === 0) visibleParts.push({ text: " " });
|
|
316
|
+
if (hasRuntimeContextMarker(msg)) {
|
|
317
|
+
visibleParts.unshift({ text: "The following is runtime context, not a user request. Do not respond to or acknowledge this context." });
|
|
318
|
+
visibleParts.push({ text: "Use this context to continue responding to the user's request." });
|
|
319
|
+
}
|
|
314
320
|
contents.push({
|
|
315
321
|
role: "user",
|
|
316
322
|
parts: visibleParts
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
|
-
import { a as
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { a as asRecord } from "./record-coerce-CNDovvft.mjs";
|
|
3
|
+
import { a as resolveAiTransportHeaderSentinels } from "./host-CWt55nnF.mjs";
|
|
4
|
+
import { n as buildManagedModelFetch } from "./host-policy-Dm7PM6AD.mjs";
|
|
5
|
+
import { n as buildBaseOptions } from "./simple-options-xJkqrG_E.mjs";
|
|
6
|
+
import { f as mergeTransportHeaders } from "./transport-stream-shared-lhgkTOz3.mjs";
|
|
7
|
+
import { t as createAssistantOutput } from "./assistant-output-BnQm3fov.mjs";
|
|
8
|
+
import { i as runGoogleGenerateContentLifecycle, r as buildGoogleSimpleThinking, t as buildGoogleGenerateContentParams } from "./google-shared-vtag8bj5.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
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { k as clampThinkingLevel } from "./host-
|
|
1
|
+
import { k as clampThinkingLevel } from "./host-CWt55nnF.mjs";
|
|
2
2
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
3
|
-
import { w as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
4
|
-
import { b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened } from "./transport-stream-shared-
|
|
5
|
-
import { n as transformProviderMessages } from "./assistant-output-
|
|
3
|
+
import { w as stripSystemPromptCacheBoundary } from "./simple-options-xJkqrG_E.mjs";
|
|
4
|
+
import { b as transportAbortError, c as failTransportStream, h as notifyProviderStreamOpened } from "./transport-stream-shared-lhgkTOz3.mjs";
|
|
5
|
+
import { n as transformProviderMessages } from "./assistant-output-BnQm3fov.mjs";
|
|
6
6
|
import { isGoogleGemini3ProModel, isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
|
|
7
|
-
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-
|
|
7
|
+
import { a as googleFlashSupportsMinimalThinking, i as consumeGoogleGenerateContentStream, n as projectGoogleMessages, r as requiresGoogleToolCallId, t as convertGoogleTools } from "./google-messages-DQMgG5yG.mjs";
|
|
8
8
|
import { FunctionCallingConfigMode, ThinkingLevel } from "@google/genai";
|
|
9
9
|
//#region packages/ai/src/providers/google-shared.ts
|
|
10
10
|
function convertMessages(model, context) {
|
|
@@ -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
|
-
import { r as getAiTransportHost } from "./host-
|
|
3
|
-
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-
|
|
2
|
+
import { r as getAiTransportHost } from "./host-CWt55nnF.mjs";
|
|
3
|
+
import { n as buildGoogleHttpOptions, t as createGoogleGenerateContentStreams } from "./google-provider-stream-BHd0cST9.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 };
|
|
@@ -2,7 +2,7 @@ import { D as supportsClaudeNativeMaxEffort, O as supportsClaudeNativeXhighEffor
|
|
|
2
2
|
import { t as DEFAULT_MISSING_TOOL_RESULT_TEXT } from "./types-BXd0kI8-.mjs";
|
|
3
3
|
import { i as asOptionalRecord, o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
4
4
|
import { r as normalizeLowercaseStringOrEmpty } from "./string-coerce-Cj8sqWHx.mjs";
|
|
5
|
-
import { E as resolveOpenAIModelReasoningEfforts, F as
|
|
5
|
+
import { E as resolveOpenAIModelReasoningEfforts, F as listMappedModelThinkingLevels, L as resolveOpenAIThinkingApi, P as MODEL_CATALOG_THINKING_LEVELS, i as OPENAI_RESPONSES_APIS } from "./openai-responses-contracts-B5mGAbR6.mjs";
|
|
6
6
|
//#region packages/ai/src/media-payload.ts
|
|
7
7
|
/** Media metadata alone is not an attachment; provider emitters need inline bytes. */
|
|
8
8
|
function hasMediaPayload(block) {
|
|
@@ -372,7 +372,7 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
372
372
|
let pendingToolCalls = [];
|
|
373
373
|
let existingToolResultIds = /* @__PURE__ */ new Set();
|
|
374
374
|
const flushToolCalls = () => {
|
|
375
|
-
for (const call of pendingToolCalls) if (!existingToolResultIds.has(call.id)) result.push({
|
|
375
|
+
for (const { call, timestamp } of pendingToolCalls) if (!existingToolResultIds.has(call.id)) result.push({
|
|
376
376
|
role: "toolResult",
|
|
377
377
|
toolCallId: call.id,
|
|
378
378
|
toolName: call.name,
|
|
@@ -382,7 +382,7 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
382
382
|
}],
|
|
383
383
|
details: { openclawSyntheticMissingToolResult: true },
|
|
384
384
|
isError: true,
|
|
385
|
-
timestamp
|
|
385
|
+
timestamp
|
|
386
386
|
});
|
|
387
387
|
pendingToolCalls = [];
|
|
388
388
|
existingToolResultIds = /* @__PURE__ */ new Set();
|
|
@@ -407,13 +407,17 @@ function transformMessages(messages, model, normalizeToolCallId) {
|
|
|
407
407
|
});
|
|
408
408
|
continue;
|
|
409
409
|
}
|
|
410
|
-
pendingToolCalls = message.content.
|
|
411
|
-
if (block.type !== "toolCall") return
|
|
410
|
+
pendingToolCalls = message.content.flatMap((block) => {
|
|
411
|
+
if (block.type !== "toolCall") return [];
|
|
412
|
+
const pending = {
|
|
413
|
+
call: block,
|
|
414
|
+
timestamp: message.timestamp ?? 0
|
|
415
|
+
};
|
|
412
416
|
if (block.async) {
|
|
413
|
-
pendingAsyncCalls.set(block.id,
|
|
414
|
-
return
|
|
417
|
+
pendingAsyncCalls.set(block.id, pending);
|
|
418
|
+
return [];
|
|
415
419
|
}
|
|
416
|
-
return
|
|
420
|
+
return [pending];
|
|
417
421
|
});
|
|
418
422
|
} else {
|
|
419
423
|
if (!supportsImages && typeof message.content !== "string") message = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as getAiTransportHost } from "./host-
|
|
1
|
+
import { r as getAiTransportHost } from "./host-CWt55nnF.mjs";
|
|
2
2
|
//#region packages/ai/src/transports/host-policy.ts
|
|
3
3
|
function buildGuardedModelFetch(model, timeoutMs, options) {
|
|
4
4
|
const host = getAiTransportHost();
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,6 @@ import { t as appendTextDeltaToAssistantMessage } from "./assistant-message-even
|
|
|
4
4
|
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, o as readProviderRefusalReview, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-DzrF1h4J.mjs";
|
|
5
5
|
import { a as createAssistantMessageEventStream, n as EventStream, t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
6
6
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-9FSkE8T-.mjs";
|
|
7
|
-
import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-
|
|
8
|
-
import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-
|
|
7
|
+
import { n as createNodeLlmRuntime, r as createApiRegistry, t as createLlmRuntime } from "./stream-C4YDqhFj.mjs";
|
|
8
|
+
import { a as resolveAiTransportHeaderSentinels, i as getDefaultAiTransportHost, n as createAiTransportHost, o as runWithAiTransportHost, r as getAiTransportHost, s as supportsScopedAiTransportHosts, t as configureAiTransportHost } from "./host-CWt55nnF.mjs";
|
|
9
9
|
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_HAIKU_55_THINKING_PROFILE, CLAUDE_OPUS_55_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_55_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, DEFAULT_MISSING_TOOL_RESULT_TEXT, EventStream, MALFORMED_TOOL_CALL_ARGUMENTS_ERROR_CODE, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, RUNTIME_CONTEXT_BEGIN_MARKER, RUNTIME_CONTEXT_CUSTOM_TYPE, RUNTIME_CONTEXT_END_MARKER, RUNTIME_CONTEXT_FOOTER, RUNTIME_CONTEXT_HEADER, appendAssistantMessageDiagnostic, appendTextDeltaToAssistantMessage, bindsClaudeThinkingPrefix, calculateUsageCost, configureAiTransportHost, createAiTransportHost, createApiRegistry, createAssistantMessageDiagnostic, createAssistantMessageEventStream, createLlmRuntime, createNodeLlmRuntime, escapeRuntimeContextFooter, extractDiagnosticError, formatThrownValue, getAiTransportHost, getDefaultAiTransportHost, hasLegacyRuntimeContextEnvelope, hasRuntimeContextMarker, isProviderRefusalAssistantError, isRuntimeContextMessage, labelRuntimeContextContent, labelRuntimeContextText, normalizeModelCostConfig, normalizeResolvedPricing, readProviderRefusalReview, readRuntimeContextMetadata, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveAiTransportHeaderSentinels, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, runWithAiTransportHost, runtimeContextContentToText, setRuntimeContextRetention, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeInHistorySystemMessages, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, supportsClaudeServerCompaction, supportsScopedAiTransportHosts, validateToolArguments, validateToolCall };
|
|
@@ -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
|
-
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-
|
|
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-
|
|
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-
|
|
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 };
|
|
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-CWt55nnF.mjs";
|
|
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-yWDb5Cct.mjs";
|
|
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-DZOKfAmL.mjs";
|
|
5
|
+
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-CUVqVXTe.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 };
|