@openclaw/ai 2026.10.10 → 2026.10.33
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/README.md +9 -1
- package/dist/{anthropic-B54Ts1tV.mjs → anthropic-B58ec88k.mjs} +46 -26
- package/dist/{anthropic-payload-policy-rqCq9sT_.d.mts → anthropic-payload-policy-BCp4dUJR.d.mts} +2 -2
- package/dist/{anthropic-stream-reducer-C__ByTq1.mjs → anthropic-stream-reducer-BTcDHWGM.mjs} +11 -11
- package/dist/{anthropic-tool-projection-DA_KeluM.mjs → anthropic-tool-projection-CrsCkF4k.mjs} +1 -1
- package/dist/{anthropic-tool-projection-JTvMo4KG.d.mts → anthropic-tool-projection-CzSSQzZL.d.mts} +1 -1
- package/dist/{api-registry-gDt0faai.d.mts → api-registry-CkmxPPac.d.mts} +1 -1
- package/dist/{assistant-output-DbgdWAhJ.mjs → assistant-output-Hl3b-ViJ.mjs} +3 -3
- package/dist/{azure-openai-responses-DHzTwi-y.mjs → azure-openai-responses-B0Hi9cAV.mjs} +5 -6
- package/dist/{diagnostics-Cv7cW3pS.mjs → diagnostics-v7oVEW59.mjs} +17 -1
- package/dist/diagnostics.d.mts +3 -3
- package/dist/diagnostics.mjs +1 -1
- package/dist/{google-CZ6uGVkV.mjs → google-DuI8TLy0.mjs} +2 -2
- package/dist/{google-interactions-qd4flmND.mjs → google-interactions-9Jd_049M.mjs} +91 -30
- package/dist/{google-messages-B-svbJuN.mjs → google-messages-BWhsZ167.mjs} +9 -3
- package/dist/{google-provider-stream-DlhaCvCf.mjs → google-provider-stream-DL0bXgX5.mjs} +16 -11
- package/dist/{google-shared-Cif7nve-.mjs → google-shared-DXizMtnG.mjs} +6 -5
- package/dist/{google-vertex-BZTcYnWU.mjs → google-vertex-DnjRWo-M.mjs} +2 -2
- package/dist/google-video-slots-D8tPH8wX.mjs +29 -0
- package/dist/{host-jJOffdlW.d.mts → host-B03VqZdH.d.mts} +2 -2
- package/dist/{host-rCxf5Tjd.mjs → host-CyGba3M8.mjs} +111 -88
- package/dist/{host-policy-Ci1cKluf.mjs → host-policy-CNQztzZm.mjs} +1 -1
- package/dist/{index-DSprYWaz.d.mts → index-B8ODIVmA.d.mts} +15 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +16 -6
- package/dist/internal/anthropic.mjs +6 -6
- package/dist/internal/openai-completions-compat.d.mts +5 -1
- package/dist/internal/openai-completions-compat.mjs +3 -2
- package/dist/internal/openai-responses-payload-policy.d.mts +2 -2
- package/dist/internal/openai-responses-payload-policy.mjs +2 -2
- package/dist/internal/openai.d.mts +8 -8
- 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.d.mts +6 -6
- package/dist/internal/runtime.mjs +4 -4
- package/dist/internal/shared.d.mts +3 -3
- package/dist/internal/shared.mjs +2 -2
- package/dist/internal/tool-schema.d.mts +2 -2
- package/dist/internal/tool-schema.mjs +3 -3
- package/dist/{mistral-C_ImzxlK.mjs → mistral-BgamhpFG.mjs} +4 -4
- package/dist/openai-BfFy1nvf.mjs +20077 -0
- package/dist/{openai-chatgpt-responses-iGYDPbmc.mjs → openai-chatgpt-responses-Biu_I7p4.mjs} +14 -19
- package/dist/{openai-completions-CDy5u1mv.mjs → openai-completions-Cbwde_Dr.mjs} +4 -4
- package/dist/{openai-completions-compat-CJ0OXZgi.mjs → openai-completions-compat-D9KEUevM.mjs} +2 -2
- package/dist/{openai-completions-compat-CBvb2eld.d.mts → openai-completions-compat-DTe2EXPi.d.mts} +2 -2
- package/dist/openai-completions-reasoning-replay-BwT1xwRI.mjs +45 -0
- package/dist/openai-completions-transport-RCOvvBq_.mjs +10874 -0
- package/dist/{openai-prompt-cache-h8vXRiaH.mjs → openai-prompt-cache-CAo-Mah6.mjs} +1 -1
- package/dist/{openai-prompt-cache-DgjD-UL5.d.mts → openai-prompt-cache-k7EPMLa0.d.mts} +1 -1
- package/dist/{openai-responses-Cp2QPq7K.mjs → openai-responses-DOgBvvca.mjs} +7 -8
- package/dist/{openai-responses-compaction-replay-DUBbsfku.d.mts → openai-responses-compaction-replay-DOJaDCUl.d.mts} +3 -3
- package/dist/{openai-responses-contracts-DCG51Us0.mjs → openai-responses-contracts-B5mGAbR6.mjs} +1 -1
- package/dist/{openai-responses-contracts-gnl6ZRs1.d.mts → openai-responses-contracts-DHtim7d_.d.mts} +3 -3
- package/dist/{openai-responses-endpoint-JbBT8IDv.mjs → openai-responses-endpoint-DJwbSy3n.mjs} +4 -2
- package/dist/{openai-responses-payload-policy-BzM52TTH.d.mts → openai-responses-payload-policy-cIaYG5ZQ.d.mts} +1 -0
- package/dist/{openai-responses-request-lifecycle-DuMpdA6y.mjs → openai-responses-request-lifecycle-bJ24Q_OK.mjs} +7 -7
- package/dist/{openai-responses-shared-CNfHudFg.mjs → openai-responses-shared-BDGaQxiw.mjs} +1130 -30
- package/dist/{openai-responses-terminal-usage-CpVjkqn-.d.mts → openai-responses-terminal-usage-BDGDBGuA.d.mts} +1 -1
- package/dist/{openai-tool-schema-CGhEl7ao.mjs → openai-tool-schema-D913am3I.mjs} +4 -3
- package/dist/openai.LICENSE +201 -0
- package/dist/{provider-options-Bo8GzTGX.d.mts → provider-options-DFjnfImJ.d.mts} +8 -2
- package/dist/{provider-replay-context-BC23HyZo.mjs → provider-replay-context-C5uMjBz4.mjs} +3 -4
- package/dist/{provider-transport-turn-state-B11rmZpv.mjs → provider-transport-turn-state-CfUfU9v1.mjs} +3 -3
- package/dist/{provider-types-ODq57rG_.d.mts → provider-types-C-67EZr8.d.mts} +5 -3
- package/dist/provider-types.d.mts +3 -3
- package/dist/provider-types.mjs +2 -1
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-DzlRubwU.mjs → reasoning-tag-text-partitioner-CU9A4Lg8.mjs} +2 -13
- package/dist/retry-after-BrmTv0jL.d.mts +25 -0
- package/dist/rolldown-runtime-B4iAMlE-.mjs +35 -0
- package/dist/{sanitize-unicode-ZqVLLEKC.d.mts → sanitize-unicode-CkejzD2f.d.mts} +1 -1
- package/dist/{simple-options-BdJJbzZk.mjs → simple-options-Bd0STwu7.mjs} +3 -3
- package/dist/{src-CyA0zJnt.mjs → src--qsViR3j.mjs} +60 -12
- package/dist/{stream-DQqGjhbq.mjs → stream-BRecd0FZ.mjs} +1 -1
- package/dist/{tool-schema-json-projection-Cvq69Ajp.mjs → tool-schema-json-projection-DU-FFSa7.mjs} +1 -1
- package/dist/{transport-stream-shared-DdnJGEj0.mjs → transport-stream-shared-C1AtJhZA.mjs} +2 -2
- package/dist/{transport-stream-shared-8ru8eX4s.d.mts → transport-stream-shared-Dhx_37f1.d.mts} +1 -1
- package/dist/{transport-utils-CcCAuFVS.mjs → transport-utils-4xPfuKp2.mjs} +2 -2
- package/dist/transports.d.mts +23 -15
- package/dist/transports.mjs +65 -44
- package/dist/types-BFfXm_Jr.d.mts +1 -0
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +2 -2
- package/dist/ws.LICENSE +20 -0
- package/package.json +1 -1
- package/dist/openai-completions-transport-DLrm5EWi.mjs +0 -3468
- package/dist/retry-after-sw-XX8aC.d.mts +0 -15
- package/dist/types-CBJthzJX.d.mts +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as supportsClaudeAdaptiveThinking, C as resolveClaudeMythos5ModelIdentity, D as resolveClaudeSonnet55ModelIdentity, E as resolveClaudeOpus5ModelIdentity, N as supportsClaudeNativeMaxEffort, O as resolveClaudeSonnet5ModelIdentity, P as supportsClaudeNativeXhighEffort, S as resolveClaudeModelIdentity, T as resolveClaudeOpus55ModelIdentity, _ as requiresClaudeBetweenToolsThinking, b as resolveClaudeFable5ModelIdentity, m as bindsClaudeThinkingPrefix, v as requiresClaudeDefaultSampling, w as resolveClaudeNativeThinkingLevelMap, x as resolveClaudeHaiku55ModelIdentity, y as requiresClaudeMandatoryAdaptiveThinking } from "../index-B8ODIVmA.mjs";
|
|
2
2
|
import { $ as StopReason, Et as AssistantMessageDiagnostic, Q as SimpleStreamOptions, d as Context, k as Model, pt as Usage, tt as StreamFunction } from "../types-CVYzKrMl.mjs";
|
|
3
|
-
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-
|
|
4
|
-
import "../types-
|
|
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-
|
|
6
|
-
import { p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-
|
|
3
|
+
import { i as AnthropicThinkingDisplay, n as AnthropicEffort, r as AnthropicOptions, t as AnthropicContextManagementOptions } from "../provider-options-DFjnfImJ.mjs";
|
|
4
|
+
import "../types-BFfXm_Jr.mjs";
|
|
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-CzSSQzZL.mjs";
|
|
6
|
+
import { a as buildAnthropicSystemBlocks, p as resolveAnthropicServerCompactionPlan, s as isDirectAnthropicModel } from "../anthropic-payload-policy-BCp4dUJR.mjs";
|
|
7
7
|
//#region packages/ai/src/providers/anthropic.d.ts
|
|
8
8
|
type AnthropicCompactionOptions = AnthropicOptions & {
|
|
9
9
|
authProfileId?: string;
|
|
@@ -13,6 +13,7 @@ type AnthropicSimpleStreamOptions = SimpleStreamOptions & AnthropicContextManage
|
|
|
13
13
|
authProfileId?: string;
|
|
14
14
|
toolChoice?: AnthropicCompactionOptions["toolChoice"];
|
|
15
15
|
thinkingDisplay?: AnthropicOptions["thinkingDisplay"];
|
|
16
|
+
onClaudeCodeVersionRequired?: AnthropicOptions["onClaudeCodeVersionRequired"];
|
|
16
17
|
};
|
|
17
18
|
export declare const streamSimpleAnthropic: StreamFunction<"anthropic-messages", AnthropicSimpleStreamOptions>;
|
|
18
19
|
//#endregion
|
|
@@ -29,6 +30,15 @@ export declare function omitFoundryBearerCredentialHeaders(headers?: Record<stri
|
|
|
29
30
|
//#endregion
|
|
30
31
|
//#region packages/ai/src/providers/anthropic-model-contract.d.ts
|
|
31
32
|
export declare const ANTHROPIC_CLAUDE_CODE_VERSION = "2.1.280";
|
|
33
|
+
/**
|
|
34
|
+
* Read the Claude Code version Anthropic requires from a
|
|
35
|
+
* claude_code_version_too_old rejection (SDK APIError or transport error body).
|
|
36
|
+
*/
|
|
37
|
+
export declare function readRequiredClaudeCodeVersion(error: unknown): string | undefined;
|
|
38
|
+
/** Adopt a version Anthropic required; true when it raised the floor and a retry can help. */
|
|
39
|
+
export declare function raiseClaudeCodeVersionFloor(required: string): boolean;
|
|
40
|
+
/** Test seam: forget the learned requirement. */
|
|
41
|
+
export declare function resetLearnedClaudeCodeVersionForTest(): void;
|
|
32
42
|
/** Build OAuth headers and the matching billing identity from one request snapshot. */
|
|
33
43
|
export declare function buildAnthropicClaudeCodeIdentity(betaHeader: string | undefined, ...headerSources: (Record<string, string> | undefined)[]): {
|
|
34
44
|
headers: Record<string, string>;
|
|
@@ -184,4 +194,4 @@ export declare function applyAnthropicMessageStartUsage(target: Usage, payload:
|
|
|
184
194
|
/** Keep billing and context distinct; omitted usage preserves the last snapshot. */
|
|
185
195
|
export declare function applyAnthropicMessageDeltaUsage(target: Usage, usage: AnthropicUsagePayload | undefined, messageStartPromptUsage: AnthropicPromptUsageSnapshot | undefined): void;
|
|
186
196
|
//#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 };
|
|
197
|
+
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
|
-
import {
|
|
2
|
-
import { C as resolveModelBoundThinkingReplayMode, S as
|
|
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 };
|
|
1
|
+
import { A as supportsClaudeNativeXhighEffort, C as resolveClaudeSonnet55ModelIdentity, E as supportsClaudeAdaptiveThinking, S as resolveClaudeOpus5ModelIdentity, _ as resolveClaudeHaiku55ModelIdentity, b as resolveClaudeNativeThinkingLevelMap, g as resolveClaudeFable5ModelIdentity, h as requiresClaudeMandatoryAdaptiveThinking, k as supportsClaudeNativeMaxEffort, m as requiresClaudeDefaultSampling, p as requiresClaudeBetweenToolsThinking, u as bindsClaudeThinkingPrefix, v as resolveClaudeModelIdentity, w as resolveClaudeSonnet5ModelIdentity, x as resolveClaudeOpus55ModelIdentity, y as resolveClaudeMythos5ModelIdentity } from "../src--qsViR3j.mjs";
|
|
2
|
+
import { C as requiresClaudeAdaptiveThinking, D as usesClaudeFable5MessagesContract, E as resolveModelBoundThinkingReplayMode, O as usesClaudeStreamingRefusalContract, S as readRequiredClaudeCodeVersion, T as resolveAnthropicThinkingEffort, _ as buildAnthropicClaudeCodeIdentity, b as prepareClaudeNoPrefillRequestContext, g as applyClaudeRequestContract, h as ANTHROPIC_CLAUDE_CODE_VERSION, v as defaultsClaudeAdaptiveThinking, w as resetLearnedClaudeCodeVersionForTest, x as raiseClaudeCodeVersionFloor, y as mapAnthropicStopReason } from "../host-CyGba3M8.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-BTcDHWGM.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-CrsCkF4k.mjs";
|
|
5
|
+
import { n as streamAnthropic, r as streamSimpleAnthropic } from "../anthropic-B58ec88k.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, raiseClaudeCodeVersionFloor, readAnthropicCacheWriteUsage, readAnthropicFallbackBoundary, readAnthropicInputTransformations, readAnthropicPromptUsageSnapshot, readAnthropicUsageTokenCount, readLastAnthropicIterationUsage, readRequiredClaudeCodeVersion, reconcileAnthropicToolChoice, requiresClaudeAdaptiveThinking, requiresClaudeBetweenToolsThinking, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resetLearnedClaudeCodeVersionForTest, resolveAnthropicFallbackServingModelCost, resolveAnthropicServerCompactionPlan, resolveAnthropicThinkingEffort, resolveClaudeFable5ModelIdentity, resolveClaudeHaiku55ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus55ModelIdentity, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet55ModelIdentity, resolveClaudeSonnet5ModelIdentity, resolveModelBoundThinkingReplayMode, resolveOriginalAnthropicToolName, streamAnthropic, streamSimpleAnthropic, supportsClaudeAdaptiveThinking, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, toClaudeCodeToolName, usesClaudeFable5MessagesContract, usesClaudeStreamingRefusalContract, usesFoundryBearerAuth };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { a as resolveOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
1
|
+
import { a as resolveOpenAICompletionsCompat } from "../openai-completions-compat-DTe2EXPi.mjs";
|
|
2
|
+
//#region packages/ai/src/transports/openai-completions-reasoning-replay.d.ts
|
|
3
|
+
/** Shared by history sanitization and wire replay, including stale model metadata. */
|
|
4
|
+
export declare function requiresReasoningContentReplay(modelId: unknown): boolean;
|
|
5
|
+
//#endregion
|
|
2
6
|
export { resolveOpenAICompletionsCompat };
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
2
|
-
|
|
1
|
+
import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-D9KEUevM.mjs";
|
|
2
|
+
import { t as requiresReasoningContentReplay } from "../openai-completions-reasoning-replay-BwT1xwRI.mjs";
|
|
3
|
+
export { requiresReasoningContentReplay, resolveOpenAICompletionsCompat };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { d as readOpenAIResponsesCompactionWindow, t as OPENAI_RESPONSES_APIS, u as OpenAIResponsesCompactionOutput } from "../openai-responses-contracts-
|
|
2
|
-
import { a as resolveOpenAIResponsesPayloadPolicy, o as resolveOpenAIResponsesRequestContextTokens, r as normalizeOpenAIServiceTier, s as resolveOpenAIResponsesServerCompactionPlan, t as OpenAIServiceTier } from "../openai-responses-payload-policy-
|
|
1
|
+
import { d as readOpenAIResponsesCompactionWindow, t as OPENAI_RESPONSES_APIS, u as OpenAIResponsesCompactionOutput } from "../openai-responses-contracts-DHtim7d_.mjs";
|
|
2
|
+
import { a as resolveOpenAIResponsesPayloadPolicy, o as resolveOpenAIResponsesRequestContextTokens, r as normalizeOpenAIServiceTier, s as resolveOpenAIResponsesServerCompactionPlan, t as OpenAIServiceTier } from "../openai-responses-payload-policy-cIaYG5ZQ.mjs";
|
|
3
3
|
//#region packages/ai/src/transports/openai-responses-endpoint.d.ts
|
|
4
4
|
export declare function supportsNativeOpenAIResponsesEndpoint(params: {
|
|
5
5
|
provider: string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-
|
|
2
|
-
import { d as resolveOpenAIResponsesPayloadPolicy, f as resolveOpenAIResponsesRequestContextTokens, l as normalizeOpenAIServiceTier, n as supportsNativeOpenAIResponsesEndpoint, o as readOpenAIResponsesCompactionWindow, p as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-endpoint-
|
|
1
|
+
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-B5mGAbR6.mjs";
|
|
2
|
+
import { d as resolveOpenAIResponsesPayloadPolicy, f as resolveOpenAIResponsesRequestContextTokens, l as normalizeOpenAIServiceTier, n as supportsNativeOpenAIResponsesEndpoint, o as readOpenAIResponsesCompactionWindow, p as resolveOpenAIResponsesServerCompactionPlan } from "../openai-responses-endpoint-DJwbSy3n.mjs";
|
|
3
3
|
export { OPENAI_RESPONSES_APIS, normalizeOpenAIServiceTier, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesRequestContextTokens, resolveOpenAIResponsesServerCompactionPlan, supportsNativeOpenAIResponsesEndpoint };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-B8ODIVmA.mjs";
|
|
2
2
|
import { $ as StopReason, Q as SimpleStreamOptions, d as Context, k as Model, tt as StreamFunction } from "../types-CVYzKrMl.mjs";
|
|
3
|
-
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as reconcileOpenAIResponsesToolChoice, a as BaseOpenAIStreamOptions, b as applyOpenAICompletionsToolReasoning, c as OpenAICompletionsOptions, f as reasoningTagTextPolicy, g as reconcileOpenAICompletionsToolChoice, h as projectOpenAITools, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, m as OpenAIToolProjection, o as CodeModeToolSurfaceObservation, p as OpenAICompletionsToolChoice, u as codeModeToolSurfaceObserver, v as OpenAIApiReasoningEffort, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel, y as OpenAIReasoningEffort } from "../provider-options-
|
|
4
|
-
import "../types-
|
|
5
|
-
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
6
|
-
import { c as responsesPromptObserver, f as OpenAIRequestReasoningEffort, l as responsesServiceTierObserver, o as ResponsesPromptObservation, s as ResponsesServiceTierObservation } from "../openai-responses-contracts-
|
|
7
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
8
|
-
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-
|
|
9
|
-
import "../openai-responses-compaction-replay-
|
|
3
|
+
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as reconcileOpenAIResponsesToolChoice, a as BaseOpenAIStreamOptions, b as applyOpenAICompletionsToolReasoning, c as OpenAICompletionsOptions, f as reasoningTagTextPolicy, g as reconcileOpenAICompletionsToolChoice, h as projectOpenAITools, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, m as OpenAIToolProjection, o as CodeModeToolSurfaceObservation, p as OpenAICompletionsToolChoice, u as codeModeToolSurfaceObserver, v as OpenAIApiReasoningEffort, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel, y as OpenAIReasoningEffort } from "../provider-options-DFjnfImJ.mjs";
|
|
4
|
+
import "../types-BFfXm_Jr.mjs";
|
|
5
|
+
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-DTe2EXPi.mjs";
|
|
6
|
+
import { c as responsesPromptObserver, f as OpenAIRequestReasoningEffort, l as responsesServiceTierObserver, o as ResponsesPromptObservation, s as ResponsesServiceTierObservation } from "../openai-responses-contracts-DHtim7d_.mjs";
|
|
7
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-k7EPMLa0.mjs";
|
|
8
|
+
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-BDGDBGuA.mjs";
|
|
9
|
+
import "../openai-responses-compaction-replay-DOJaDCUl.mjs";
|
|
10
10
|
import { n as modelRequestBodyState, t as encodedModelRequestBodyStream } from "../model-request-body-BD5vy4rP.mjs";
|
|
11
11
|
import { ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
|
|
12
12
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|
package/dist/internal/openai.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as responsesServiceTierObserver, b as applyOpenAICompletionsToolReasoning, g as responsesPromptObserver, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel } from "../openai-responses-contracts-
|
|
2
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
3
|
-
import { _ as
|
|
4
|
-
import { a as encodedModelRequestBodyStream, g as reasoningTagTextPolicy, m as codeModeToolSurfaceObserver, o as modelRequestBodyState } from "../simple-options-
|
|
5
|
-
import { a as hasResponsesWebSearchTool, s as convertMessages } from "../openai-completions-transport-
|
|
6
|
-
import { Ct as reconcileOpenAIResponsesToolChoice, N as bindResponsesInputMessage, St as reconcileOpenAICompletionsToolChoice, _ as isResponsesTextContentPartType, d as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, f as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, g as isAzureResponsesTextDeltaEventType, h as isAzureResponsesTextDeltaEvent, l as createResponsesToolCallTracker, m as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, p as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, u as readResponsesToolCallItemIdentity, v as isResponsesTextDeltaEventType, xt as projectOpenAITools, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-
|
|
1
|
+
import { A as supportsOpenAIReasoningEffort, C as isOpenAIGpt56Model, D as resolveOpenAIReasoningEffortForModel, E as resolveOpenAIModelReasoningEfforts, O as resolveOpenAIReasoningEffortMapping, S as isOpenAIGpt55Model, T as normalizeOpenAIReasoningEffort, _ as responsesServiceTierObserver, b as applyOpenAICompletionsToolReasoning, g as responsesPromptObserver, j as supportsOpenAITemperature, k as resolveOpenAISupportedReasoningEfforts, w as isOpenAIGpt6Model, x as isOpenAIGpt54MiniModel } from "../openai-responses-contracts-B5mGAbR6.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-CAo-Mah6.mjs";
|
|
3
|
+
import { _ as mapResponsesTerminalUsage, g as isResponsesOutputLimitToolCallError, v as readResponsesReasoningTokens, y as resolveResponsesTerminalStopReason } from "../diagnostics-v7oVEW59.mjs";
|
|
4
|
+
import { a as encodedModelRequestBodyStream, g as reasoningTagTextPolicy, m as codeModeToolSurfaceObserver, o as modelRequestBodyState } from "../simple-options-Bd0STwu7.mjs";
|
|
5
|
+
import { a as hasResponsesWebSearchTool, s as convertMessages } from "../openai-completions-transport-RCOvvBq_.mjs";
|
|
6
|
+
import { Ct as reconcileOpenAIResponsesToolChoice, N as bindResponsesInputMessage, St as reconcileOpenAICompletionsToolChoice, _ as isResponsesTextContentPartType, d as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, f as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, g as isAzureResponsesTextDeltaEventType, h as isAzureResponsesTextDeltaEvent, l as createResponsesToolCallTracker, m as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, p as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, u as readResponsesToolCallItemIdentity, v as isResponsesTextDeltaEventType, xt as projectOpenAITools, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-BDGaQxiw.mjs";
|
|
7
7
|
import { t as mapOpenAIStopReason } from "../openai-stop-reason-8s70vDXj.mjs";
|
|
8
8
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
9
|
-
import { n as responsesRequestLifecycle, t as independentResponsesRequest } from "../openai-responses-request-lifecycle-
|
|
10
|
-
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-
|
|
11
|
-
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-
|
|
9
|
+
import { n as responsesRequestLifecycle, t as independentResponsesRequest } from "../openai-responses-request-lifecycle-bJ24Q_OK.mjs";
|
|
10
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-Cbwde_Dr.mjs";
|
|
11
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-DOgBvvca.mjs";
|
|
12
12
|
export { AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH, OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, applyOpenAICompletionsToolReasoning, bindResponsesInputMessage, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, encodedModelRequestBodyStream, hasResponsesWebSearchTool, independentResponsesRequest, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, modelRequestBodyState, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesRequestLifecycle, responsesServiceTierObserver, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
export { parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs };
|
|
1
|
+
import { a as parseRetryAfterHeadersSeconds, i as parseRetryAfterErrorSeconds, n as parseGoogleRetryDelaySeconds, o as parseRetryAfterHttpDateMs, r as parseHttpDateInstant, s as parseRetryAfterTextSeconds, t as RETRY_AFTER_TEXT_RE } from "../retry-after-BrmTv0jL.mjs";
|
|
2
|
+
export { RETRY_AFTER_TEXT_RE, parseGoogleRetryDelaySeconds, parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs, parseRetryAfterTextSeconds };
|
|
@@ -110,6 +110,80 @@ function parseRetryAfterErrorSeconds(error, nowMs = Date.now()) {
|
|
|
110
110
|
return;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
function maxDefined(...values) {
|
|
114
|
+
let floor;
|
|
115
|
+
for (const value of values) if (value !== void 0) floor = Math.max(floor ?? 0, value);
|
|
116
|
+
return floor;
|
|
117
|
+
}
|
|
118
|
+
/** Provider prose such as "Please try again in 6s", "retry in 32s" or "Retry-After: 7". */
|
|
119
|
+
const RETRY_AFTER_TEXT_RE = /\b(?:retry[- ]after\b\s*:?\s*(?:in\b\s*)?|(?:please\s+)?(?:try again|retry) in\s+)([^\r\n;]+)/i;
|
|
120
|
+
const RETRY_TEXT_NUMBER_RE = /^(\d+(?:\.\d+)?|Infinity)\s*([a-z]+)?\b/i;
|
|
121
|
+
const MS_PER_SECOND = 1e3;
|
|
122
|
+
const RETRY_TEXT_UNIT_MS = new Map([
|
|
123
|
+
["milliseconds millisecond msecs msec ms", 1],
|
|
124
|
+
["seconds second secs sec s", MS_PER_SECOND],
|
|
125
|
+
["minutes minute mins min m", 60 * MS_PER_SECOND],
|
|
126
|
+
["hours hour hrs hr h", 3600 * MS_PER_SECOND],
|
|
127
|
+
["days day d", 86400 * MS_PER_SECOND]
|
|
128
|
+
].flatMap(([aliases, milliseconds]) => aliases.split(" ").map((alias) => [alias, milliseconds])));
|
|
129
|
+
/** Seconds named by a captured retry-text value: a number with an optional time unit, or an HTTP-date. */
|
|
130
|
+
function parseRetryAfterTextSeconds(valueText, nowMs = Date.now()) {
|
|
131
|
+
const secondsMatch = RETRY_TEXT_NUMBER_RE.exec(valueText);
|
|
132
|
+
if (secondsMatch?.[1]) {
|
|
133
|
+
const value = /^infinity$/i.test(secondsMatch[1]) ? Infinity : Number(secondsMatch[1]);
|
|
134
|
+
if (Number.isNaN(value) || value < 0) return;
|
|
135
|
+
const unitMilliseconds = RETRY_TEXT_UNIT_MS.get(secondsMatch[2]?.toLowerCase() ?? "s");
|
|
136
|
+
if (unitMilliseconds === void 0) return;
|
|
137
|
+
return unitMilliseconds === 1 ? value / MS_PER_SECOND : value * (unitMilliseconds / MS_PER_SECOND);
|
|
138
|
+
}
|
|
139
|
+
const retryAtMs = parseRetryAfterHttpDateMs(valueText, nowMs);
|
|
140
|
+
return retryAtMs === void 0 ? void 0 : Math.max(0, (retryAtMs - nowMs) / MS_PER_SECOND);
|
|
141
|
+
}
|
|
142
|
+
const GOOGLE_RETRY_DELAY_TEXT_RE = /"retryDelay"\s*:\s*"(\d+(?:\.\d{1,9})?)s"/g;
|
|
143
|
+
const GOOGLE_RETRY_DELAY_VALUE_RE = /^(\d+(?:\.\d{1,9})?)s$/;
|
|
144
|
+
const GOOGLE_RETRY_INFO_TYPE = "type.googleapis.com/google.rpc.RetryInfo";
|
|
145
|
+
const MAX_GOOGLE_ERROR_DETAILS = 16;
|
|
146
|
+
function googleRetryDelayTextSeconds(text) {
|
|
147
|
+
let floor;
|
|
148
|
+
for (const match of text.matchAll(GOOGLE_RETRY_DELAY_TEXT_RE)) floor = maxDefined(floor, Number(match[1]));
|
|
149
|
+
return floor;
|
|
150
|
+
}
|
|
151
|
+
function googleStatusRetryDelaySeconds(status) {
|
|
152
|
+
if (typeof status === "string") return googleRetryDelayTextSeconds(status);
|
|
153
|
+
const details = ownDataValue(status, "details");
|
|
154
|
+
if (!Array.isArray(details)) return;
|
|
155
|
+
let floor;
|
|
156
|
+
for (let index = 0; index < Math.min(details.length, MAX_GOOGLE_ERROR_DETAILS); index += 1) {
|
|
157
|
+
const detail = ownDataValue(details, String(index));
|
|
158
|
+
if (ownDataValue(detail, "@type") !== GOOGLE_RETRY_INFO_TYPE) continue;
|
|
159
|
+
const delay = ownDataValue(detail, "retryDelay");
|
|
160
|
+
const match = typeof delay === "string" ? GOOGLE_RETRY_DELAY_VALUE_RE.exec(delay) : null;
|
|
161
|
+
floor = maxDefined(floor, match?.[1] ? Number(match[1]) : void 0);
|
|
162
|
+
}
|
|
163
|
+
return floor;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Reads google.rpc.RetryInfo delays from raw error text or a google.rpc.Status-shaped body
|
|
167
|
+
* in any key order, with a fixed number of descriptor reads and no getters. Pass the
|
|
168
|
+
* untruncated body: Gemini puts RetryInfo after its QuotaFailure details.
|
|
169
|
+
*/
|
|
170
|
+
function parseGoogleRetryDelaySeconds(value) {
|
|
171
|
+
try {
|
|
172
|
+
if (typeof value === "string") return googleRetryDelayTextSeconds(value);
|
|
173
|
+
const response = ownDataValue(value, "response");
|
|
174
|
+
return maxDefined(...[
|
|
175
|
+
value,
|
|
176
|
+
ownDataValue(value, "error"),
|
|
177
|
+
ownDataValue(value, "message"),
|
|
178
|
+
ownDataValue(value, "errorBody"),
|
|
179
|
+
ownDataValue(value, "body"),
|
|
180
|
+
ownDataValue(response, "body"),
|
|
181
|
+
ownDataValue(response, "data")
|
|
182
|
+
].flatMap((candidate) => [googleStatusRetryDelaySeconds(candidate), typeof candidate === "string" ? void 0 : googleStatusRetryDelaySeconds(ownDataValue(candidate, "error"))]));
|
|
183
|
+
} catch {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
113
187
|
/** Round leap seconds forward for Retry-After so an unrepresentable instant cannot retry early. */
|
|
114
188
|
function parseRetryAfterHttpDateMs(value, nowMs = Date.now()) {
|
|
115
189
|
return parseHttpDateInstant(value, nowMs)?.timestampMs;
|
|
@@ -172,4 +246,4 @@ function parseHttpDateCalendarMs(components) {
|
|
|
172
246
|
return seconds === 60 ? timestamp + 1e3 : timestamp;
|
|
173
247
|
}
|
|
174
248
|
//#endregion
|
|
175
|
-
export { parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs };
|
|
249
|
+
export { RETRY_AFTER_TEXT_RE, parseGoogleRetryDelaySeconds, parseHttpDateInstant, parseRetryAfterErrorSeconds, parseRetryAfterHeadersSeconds, parseRetryAfterHttpDateMs, parseRetryAfterTextSeconds };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-B8ODIVmA.mjs";
|
|
2
2
|
import { M as ModelThinkingLevel, Q as SimpleStreamOptions, U as ProviderStreamOptions, a as AssistantMessage, d as Context, k as Model, n as Api, nt as StreamOptions, pt as Usage, s as AssistantMessageEventStreamContract } from "../types-CVYzKrMl.mjs";
|
|
3
3
|
import { i as getEventStreamCompletion } from "../event-stream-CzpE1g_o.mjs";
|
|
4
|
-
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-
|
|
5
|
-
import { m as getDefaultAiTransportHost } from "../host-
|
|
6
|
-
import "../types-
|
|
7
|
-
import { n as isContextOverflow, t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
8
|
-
import { v as parseTerminalToolCallArguments } from "../transport-stream-shared-
|
|
4
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-CkmxPPac.mjs";
|
|
5
|
+
import { m as getDefaultAiTransportHost } from "../host-B03VqZdH.mjs";
|
|
6
|
+
import "../types-BFfXm_Jr.mjs";
|
|
7
|
+
import { n as isContextOverflow, t as sanitizeSurrogates } from "../sanitize-unicode-CkejzD2f.mjs";
|
|
8
|
+
import { v as parseTerminalToolCallArguments } from "../transport-stream-shared-Dhx_37f1.mjs";
|
|
9
9
|
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
10
10
|
export declare const defaultApiRegistry: {
|
|
11
11
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-DzlRubwU.mjs";
|
|
2
1
|
import { o as getEventStreamCompletion } from "../event-stream-X2gmsUWv.mjs";
|
|
3
|
-
import { r as createApiRegistry, t as createLlmRuntime } from "../stream-
|
|
4
|
-
import { A as
|
|
2
|
+
import { r as createApiRegistry, t as createLlmRuntime } from "../stream-BRecd0FZ.mjs";
|
|
3
|
+
import { A as applyProviderReportedUsageCost, M as clampThinkingLevel, N as getSupportedThinkingLevels, P as modelsAreEqual, j as calculateCost, k as headersToRecord } from "../host-CyGba3M8.mjs";
|
|
5
4
|
import { n as getSessionResourceOwnerId, r as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-vKvGIE3J.mjs";
|
|
6
5
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-CRGuMONI.mjs";
|
|
7
|
-
import { A as shortHash, D as parseJsonWithRepair, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, g as parseTerminalToolCallArguments, k as repairJson } from "../transport-stream-shared-
|
|
6
|
+
import { A as shortHash, D as parseJsonWithRepair, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, g as parseTerminalToolCallArguments, k as repairJson } from "../transport-stream-shared-C1AtJhZA.mjs";
|
|
8
7
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-Xd8dm_aV.mjs";
|
|
9
8
|
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
|
|
10
9
|
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-CfMuh5cC.mjs";
|
|
11
10
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-D_TfJHRJ.mjs";
|
|
12
11
|
import { n as createSseByteGuard, t as boundResponseBody } from "../streaming-byte-guard-DBXr1XYn.mjs";
|
|
12
|
+
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-CU9A4Lg8.mjs";
|
|
13
13
|
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
14
14
|
import { t as isContextOverflow } from "../overflow-OF3PgPbw.mjs";
|
|
15
15
|
//#region packages/ai/src/internal/default-runtime.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { O as Message, Q as SimpleStreamOptions, a as AssistantMessage, at as ThinkingBudgets, k as Model, n as Api, nt as StreamOptions, st as ThinkingLevel } from "../types-CVYzKrMl.mjs";
|
|
2
2
|
import { a as readAssistantThinkingAppend } from "../event-stream-CzpE1g_o.mjs";
|
|
3
|
-
import { d as preparedRequestSuffix } from "../provider-options-
|
|
4
|
-
import "../types-
|
|
3
|
+
import { d as preparedRequestSuffix } from "../provider-options-DFjnfImJ.mjs";
|
|
4
|
+
import "../types-BFfXm_Jr.mjs";
|
|
5
5
|
import { r as serializeModelRequestBody } from "../model-request-body-BD5vy4rP.mjs";
|
|
6
|
-
import { r as matchesContextOverflowMessage, t as sanitizeSurrogates } from "../sanitize-unicode-
|
|
6
|
+
import { r as matchesContextOverflowMessage, t as sanitizeSurrogates } from "../sanitize-unicode-CkejzD2f.mjs";
|
|
7
7
|
import { i as projectProviderError } from "../provider-error-CnaWYTRY.mjs";
|
|
8
8
|
import { n as createDiagnosticRecord, r as isCredentialFieldName } from "../credential-redaction-XvsPf7Yi.mjs";
|
|
9
9
|
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-Cwcjv_fx.mjs";
|
package/dist/internal/shared.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { s as readAssistantThinkingAppend } from "../event-stream-X2gmsUWv.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { F as hasMediaPayload, I as isImageWithMediaPayload, c as transformMessages, d as hasOnlyAssistantReasoningContent, f as isReasoningOnlyLengthAssistantTurn, l as FAILED_ASSISTANT_REPLAY_TEXT, m as resolveFailedAssistantReplay, p as isStreamErrorFallbackContent, u as STREAM_ERROR_FALLBACK_TEXT } from "../host-CyGba3M8.mjs";
|
|
3
3
|
import { i as isCredentialFieldName, n as projectProviderError, r as createDiagnosticRecord } from "../provider-error-qtZD2inE.mjs";
|
|
4
4
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-CRGuMONI.mjs";
|
|
5
5
|
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-D_MeCQFI.mjs";
|
|
6
|
-
import { C as splitSystemPromptRelocatableBoundary, S as splitSystemPromptCacheBoundary, T as stripSystemPromptRelocatableBoundary, _ as SYSTEM_PROMPT_CACHE_BOUNDARY, b as ensureSystemPromptCacheBoundary, c as serializeModelRequestBody, d as extractToolResultBlockText, f as extractToolResultText, h as preparedRequestSuffix, i as clampReasoning, l as describeToolResultMediaPlaceholder, n as buildBaseOptions, p as formatToolResultText, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, u as describeUnsupportedToolResultMedia, v as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, w as stripSystemPromptCacheBoundary, x as prependSystemPromptAdditionAfterCacheBoundary, y as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END } from "../simple-options-
|
|
6
|
+
import { C as splitSystemPromptRelocatableBoundary, S as splitSystemPromptCacheBoundary, T as stripSystemPromptRelocatableBoundary, _ as SYSTEM_PROMPT_CACHE_BOUNDARY, b as ensureSystemPromptCacheBoundary, c as serializeModelRequestBody, d as extractToolResultBlockText, f as extractToolResultText, h as preparedRequestSuffix, i as clampReasoning, l as describeToolResultMediaPlaceholder, n as buildBaseOptions, p as formatToolResultText, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, u as describeUnsupportedToolResultMedia, v as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, w as stripSystemPromptCacheBoundary, x as prependSystemPromptAdditionAfterCacheBoundary, y as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END } from "../simple-options-Bd0STwu7.mjs";
|
|
7
7
|
import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-F-EmvkpW.mjs";
|
|
8
8
|
import { n as matchesContextOverflowMessage } from "../overflow-OF3PgPbw.mjs";
|
|
9
9
|
//#region packages/ai/src/utils/tls-certificate-errors.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { m as OpenAIToolProjection } from "../provider-options-
|
|
2
|
-
import { a as prepareAnthropicInputSchema } from "../anthropic-tool-projection-
|
|
1
|
+
import { m as OpenAIToolProjection } from "../provider-options-DFjnfImJ.mjs";
|
|
2
|
+
import { a as prepareAnthropicInputSchema } from "../anthropic-tool-projection-CzSSQzZL.mjs";
|
|
3
3
|
import { TSchema } from "typebox";
|
|
4
4
|
//#region packages/ai/src/providers/agent-tools-parameter-schema.d.ts
|
|
5
5
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as SCHEMA_MAP_KEYS, d as inheritToolSchemaTruncation, f as reportToolSchemaTruncation, h as wasToolSchemaTruncated, i as publishRuntimeToolInputSchema, m as truncateToolSchemaDepth, p as toolSchemaChildPosition, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, u as MAX_TOOL_SCHEMA_DEPTH, v as SCHEMA_NESTED_KEYS } from "../tool-schema-json-projection-
|
|
2
|
-
import { r as prepareAnthropicInputSchema } from "../anthropic-tool-projection-
|
|
3
|
-
import { _ as findLlamacppGbnfSchemaViolations, a as resolveOpenAIProjectedToolsStrictToolFlag, b as prepareOpenAIFunctionTool, c as extractToolSchemaModelCompat, d as shouldOmitEmptyArrayItems, g as cleanSchemaForLlamacppGbnf, h as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, i as normalizeStrictOpenAIJsonSchema, l as normalizeToolParameterSchema, m as stripUnsupportedSchemaKeywords, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics, u as resolveUnsupportedToolSchemaKeywords, v as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, y as cleanSchemaForGemini } from "../openai-tool-schema-
|
|
1
|
+
import { _ as SCHEMA_MAP_KEYS, d as inheritToolSchemaTruncation, f as reportToolSchemaTruncation, h as wasToolSchemaTruncated, i as publishRuntimeToolInputSchema, m as truncateToolSchemaDepth, p as toolSchemaChildPosition, r as projectRuntimeToolInputSchema, t as getPublishedRuntimeToolInputSchema, u as MAX_TOOL_SCHEMA_DEPTH, v as SCHEMA_NESTED_KEYS } from "../tool-schema-json-projection-DU-FFSa7.mjs";
|
|
2
|
+
import { r as prepareAnthropicInputSchema } from "../anthropic-tool-projection-CrsCkF4k.mjs";
|
|
3
|
+
import { _ as findLlamacppGbnfSchemaViolations, a as resolveOpenAIProjectedToolsStrictToolFlag, b as prepareOpenAIFunctionTool, c as extractToolSchemaModelCompat, d as shouldOmitEmptyArrayItems, g as cleanSchemaForLlamacppGbnf, h as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, i as normalizeStrictOpenAIJsonSchema, l as normalizeToolParameterSchema, m as stripUnsupportedSchemaKeywords, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics, u as resolveUnsupportedToolSchemaKeywords, v as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, y as cleanSchemaForGemini } from "../openai-tool-schema-D913am3I.mjs";
|
|
4
4
|
export { GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, MAX_TOOL_SCHEMA_DEPTH, SCHEMA_MAP_KEYS, SCHEMA_NESTED_KEYS, cleanSchemaForGemini, cleanSchemaForLlamacppGbnf, extractToolSchemaModelCompat, findLlamacppGbnfSchemaViolations, findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, getPublishedRuntimeToolInputSchema, inheritToolSchemaTruncation, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, prepareAnthropicInputSchema, prepareOpenAIFunctionTool, projectRuntimeToolInputSchema, publishRuntimeToolInputSchema, reportToolSchemaTruncation, resolveOpenAIProjectedToolsStrictToolFlag, resolveUnsupportedToolSchemaKeywords, shouldOmitEmptyArrayItems, stripUnsupportedSchemaKeywords, toolSchemaChildPosition, truncateToolSchemaDepth, wasToolSchemaTruncated };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { r as appendAssistantThinking, t as AssistantMessageEventStream } from "./event-stream-X2gmsUWv.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { I as isImageWithMediaPayload, M as clampThinkingLevel, j as calculateCost, r as getAiTransportHost } from "./host-CyGba3M8.mjs";
|
|
3
3
|
import { t as sanitizeSurrogates } from "./sanitize-unicode-CRGuMONI.mjs";
|
|
4
4
|
import { r as sortPromptCacheToolsByName } from "./prompt-cache-stability-D_MeCQFI.mjs";
|
|
5
|
-
import { f as extractToolResultText, l as describeToolResultMediaPlaceholder, n as buildBaseOptions, p as formatToolResultText, r as clampMaxTokensToModel, w as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
6
|
-
import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-
|
|
7
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
5
|
+
import { f as extractToolResultText, l as describeToolResultMediaPlaceholder, n as buildBaseOptions, p as formatToolResultText, r as clampMaxTokensToModel, w as stripSystemPromptCacheBoundary } from "./simple-options-Bd0STwu7.mjs";
|
|
6
|
+
import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-C1AtJhZA.mjs";
|
|
7
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-Hl3b-ViJ.mjs";
|
|
8
8
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-CfMuh5cC.mjs";
|
|
9
9
|
import { t as boundResponseBody } from "./streaming-byte-guard-DBXr1XYn.mjs";
|
|
10
10
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|