@openclaw/ai 2026.8.2 → 2026.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-compaction-replay-CKCDrZJv.mjs → anthropic-compaction-replay-OMJZ0uyo.mjs} +5 -5
- package/dist/{anthropic-DTGZ4VMY.mjs → anthropic-hk7F7ptG.mjs} +16 -13
- package/dist/{anthropic-payload-policy-BTzmNC14.d.mts → anthropic-payload-policy-DBT1itQ-.d.mts} +2 -2
- package/dist/{api-registry-BbUHEKER.d.mts → api-registry-Cs6HGNqY.d.mts} +2 -2
- package/dist/{azure-openai-responses-BmqaDXM1.mjs → azure-openai-responses-CN4Fy5zV.mjs} +6 -4
- package/dist/{diagnostics-COpOtRwq.mjs → diagnostics-CPeq9F7y.mjs} +5 -1
- package/dist/{diagnostics-BaTA9eVl.d.mts → diagnostics-DnPnOui6.d.mts} +5 -1
- package/dist/diagnostics-KhXK-QJI.mjs +136 -0
- package/dist/diagnostics.d.mts +7 -2
- package/dist/diagnostics.mjs +4 -3
- package/dist/event-stream-DeDhbCc5.d.mts +1 -0
- package/dist/{event-stream-DcvAPSBe.d.mts → event-stream-vK_7r3bj.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/{google-CqjVZMwo.mjs → google-CC-nrwXg.mjs} +2 -2
- package/dist/{google-shared-Bnqni5j3.mjs → google-shared-CjPY0hZM.mjs} +2 -2
- package/dist/{google-vertex-D_WREEJi.mjs → google-vertex-DCr0pyzQ.mjs} +2 -2
- package/dist/{host-DKFUAmCn.d.mts → host-BztR4tQj.d.mts} +3 -3
- package/dist/{index-CefaUGSS.d.mts → index-AfaxKT8w.d.mts} +5 -5
- package/dist/index.d.mts +8 -8
- package/dist/index.mjs +2 -2
- package/dist/internal/anthropic.d.mts +8 -8
- package/dist/internal/anthropic.mjs +2 -2
- package/dist/internal/openai-responses-payload-policy.d.mts +1 -1
- package/dist/internal/openai.d.mts +5 -5
- package/dist/internal/openai.mjs +6 -6
- package/dist/internal/runtime.d.mts +5 -5
- package/dist/internal/runtime.mjs +6 -4
- package/dist/internal/shared.d.mts +2 -2
- package/dist/internal/shared.mjs +93 -2
- package/dist/{mistral-C24jVd6f.mjs → mistral-B7etBd_H.mjs} +5 -6
- package/dist/{openai-chatgpt-responses-Czum0oXz.mjs → openai-chatgpt-responses-BAJ4gq3i.mjs} +51 -111
- package/dist/{openai-completions-BfFwac6f.mjs → openai-completions-D0QZ0AyB.mjs} +9 -10
- package/dist/{openai-completions-compat-SZhi0Lf4.d.mts → openai-completions-compat-4IjSBpr6.d.mts} +5 -5
- package/dist/{openai-completions-stream-DGOvau4J.mjs → openai-completions-stream-DZjwK8vp.mjs} +14 -11
- package/dist/{openai-responses-BAryVEJM.mjs → openai-responses-BEUlxfDu.mjs} +4 -3
- package/dist/{openai-responses-contracts-BthRXano.d.mts → openai-responses-contracts-bPzSN_Ba.d.mts} +3 -3
- package/dist/{openai-responses-prompt-observer-internal--R0kZLOZ.mjs → openai-responses-prompt-observer-internal-C7x4IK7r.mjs} +3 -17
- package/dist/{openai-responses-shared-CxgdGBvm.mjs → openai-responses-shared-DiAdpNAM.mjs} +82 -89
- package/dist/{openai-tool-schema-CSMh5e9O.mjs → openai-tool-schema-BMiHFH36.mjs} +1 -1
- package/dist/{provider-error-BI8kIViN.mjs → provider-error-B6EGq6gg.mjs} +1 -0
- package/dist/{provider-options-DJd_9euj.d.mts → provider-options-CxFPtvh7.d.mts} +2 -2
- package/dist/provider-types.d.mts +7 -7
- package/dist/providers.d.mts +1 -1
- package/dist/providers.mjs +9 -9
- package/dist/{reasoning-tag-text-partitioner-BsUX44Tq.mjs → reasoning-tag-text-partitioner-C-4uedDb.mjs} +63 -57
- package/dist/{simple-options-rdOPzr7Z.mjs → simple-options-0PLDyJ-d.mjs} +1 -2
- package/dist/{transport-stream-shared-BbG7PThh.d.mts → transport-stream-shared-BrvFTkoO.d.mts} +5 -5
- package/dist/{transport-stream-shared-D8nQWCUo.mjs → transport-stream-shared-CytPVLIg.mjs} +17 -4
- package/dist/transports.d.mts +11 -11
- package/dist/transports.mjs +26 -30
- package/dist/types-B5EFUmXs.d.mts +1 -0
- package/dist/{types-Beemor2E.d.mts → types-DbrhszyQ.d.mts} +3 -6
- package/dist/types.d.mts +7 -7
- package/dist/types.mjs +2 -2
- package/dist/{validation-CC6s7Smp.d.mts → validation-BOwtcl9X.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/package.json +1 -1
- package/dist/event-stream-pXT3FI6X.d.mts +0 -1
- package/dist/tls-certificate-errors-DXSpluKI.mjs +0 -93
- package/dist/types-COdhCX0U.d.mts +0 -1
package/dist/transports.mjs
CHANGED
|
@@ -2,28 +2,29 @@ import { g as supportsClaudeAdaptiveThinking, m as resolveClaudeSonnet5ModelIden
|
|
|
2
2
|
import { c as normalizeLowercaseStringOrEmpty, o as isRecord, s as hasNonEmptyString } from "./utf16-slice-qz3nsy87.mjs";
|
|
3
3
|
import { r as calculateCost } from "./sanitize-unicode-S6binQG-.mjs";
|
|
4
4
|
import { S as usesClaudeStreamingRefusalContract, _ as prepareClaudeNoPrefillRequestContext, a as describeToolResultMediaPlaceholder, c as extractToolResultText, d as isImageWithMediaPayload, f as ANTHROPIC_CLAUDE_CODE_BILLING_SYSTEM_BLOCK, g as mapAnthropicStopReason, h as defaultsClaudeAdaptiveThinking, m as applyClaudeRequestContract, n as getAiTransportHost, p as ANTHROPIC_CLAUDE_CODE_VERSION, r as resolveAiTransportHeaderSentinels, s as extractToolResultBlockText, v as requiresClaudeAdaptiveThinking, x as usesClaudeFable5MessagesContract, y as resolveAnthropicThinkingEffort } from "./host-BIaiBURL.mjs";
|
|
5
|
-
import { i as stableStringify } from "./provider-error-
|
|
6
|
-
import {
|
|
5
|
+
import { i as stableStringify } from "./provider-error-B6EGq6gg.mjs";
|
|
6
|
+
import { r as toErrorObject } from "./diagnostics-KhXK-QJI.mjs";
|
|
7
7
|
import { a as asNonNegativeFiniteNumber } from "./base64-CEFBpSkN.mjs";
|
|
8
8
|
import { n as uniqueStrings } from "./string-normalization--fwJ4S2q.mjs";
|
|
9
|
-
import { A as applyAnthropicCacheControlToMessages, C as applyAnthropicFallbackBoundary, D as createAnthropicInlineImageBudget, E as applyAnthropicRefusal, F as resolveAnthropicServerCompactionPlan, I as isAnthropicOAuthApiKey, L as omitFoundryBearerCredentialHeaders, M as applyAnthropicPayloadPolicyToParams, N as resolveAnthropicEphemeralCacheControl, O as normalizeAnthropicInlineContent, P as resolveAnthropicPayloadPolicy, R as usesFoundryBearerAuth, T as resolveAnthropicFallbackServingModelCost, _ as toClaudeCodeToolName, a as suppressAnthropicCompaction, b as ANTHROPIC_SERVER_SIDE_FALLBACKS, f as normalizeAnthropicToolCallId, g as resolveOriginalAnthropicToolName, h as reconcileAnthropicToolChoice, i as resolveNewestAnthropicCompaction, j as applyAnthropicEphemeralCacheControlMarkers, k as resolveAnthropicImageMediaType, m as projectAnthropicTools, n as createCompactionCapture, o as applyAnthropicMessageDeltaUsage, p as normalizeAnthropicToolChoice, r as isAnthropicReplayRejection, s as applyAnthropicMessageStartUsage, t as buildAnthropicReplayPlan, v as ANTHROPIC_OMITTED_REASONING_TEXT, w as readAnthropicFallbackBoundary, x as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, y as findActiveAnthropicToolTurnAssistantIndex } from "./anthropic-compaction-replay-
|
|
9
|
+
import { A as applyAnthropicCacheControlToMessages, C as applyAnthropicFallbackBoundary, D as createAnthropicInlineImageBudget, E as applyAnthropicRefusal, F as resolveAnthropicServerCompactionPlan, I as isAnthropicOAuthApiKey, L as omitFoundryBearerCredentialHeaders, M as applyAnthropicPayloadPolicyToParams, N as resolveAnthropicEphemeralCacheControl, O as normalizeAnthropicInlineContent, P as resolveAnthropicPayloadPolicy, R as usesFoundryBearerAuth, T as resolveAnthropicFallbackServingModelCost, _ as toClaudeCodeToolName, a as suppressAnthropicCompaction, b as ANTHROPIC_SERVER_SIDE_FALLBACKS, f as normalizeAnthropicToolCallId, g as resolveOriginalAnthropicToolName, h as reconcileAnthropicToolChoice, i as resolveNewestAnthropicCompaction, j as applyAnthropicEphemeralCacheControlMarkers, k as resolveAnthropicImageMediaType, m as projectAnthropicTools, n as createCompactionCapture, o as applyAnthropicMessageDeltaUsage, p as normalizeAnthropicToolChoice, r as isAnthropicReplayRejection, s as applyAnthropicMessageStartUsage, t as buildAnthropicReplayPlan, v as ANTHROPIC_OMITTED_REASONING_TEXT, w as readAnthropicFallbackBoundary, x as ANTHROPIC_SERVER_SIDE_FALLBACK_BETA, y as findActiveAnthropicToolTurnAssistantIndex } from "./anthropic-compaction-replay-OMJZ0uyo.mjs";
|
|
10
10
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
11
|
-
import { a as codeModeToolSurfaceObserver, d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, o as reasoningTagTextPolicy, t as adjustMaxTokensForThinking } from "./simple-options-
|
|
11
|
+
import { a as codeModeToolSurfaceObserver, d as stripSystemPromptCacheBoundary, m as sortPromptCacheToolsByName, o as reasoningTagTextPolicy, t as adjustMaxTokensForThinking } from "./simple-options-0PLDyJ-d.mjs";
|
|
12
12
|
import { a as resolveProviderEndpoint, c as transformTransportMessages, i as resolveOpenAIStrictToolSetting, n as buildGuardedModelFetch } from "./tool-schema-json-projection-BtZiml7r.mjs";
|
|
13
13
|
import { a as isGoogleGemini3FlashModel, c as parseRetryAfterSeconds, f as resolveModelHeaderSentinels$1, i as isCodeModeModelVisibleToolName, l as readResponseTextSnippet, m as supportsModelTools, n as createAbortError$1, o as isGoogleGemini3ProModel, p as sha256Hex, r as estimateStringChars, t as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, u as redactIdentifier } from "./transport-utils-CtuS1Upe.mjs";
|
|
14
14
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
15
|
-
import { S as quoteUnsafeIntegerLiterals, _ as transportAbortError, a as createWritableTransportEventStream, b as parseJsonObjectPreservingUnsafeIntegers, c as finalizeTransportStream, d as notifyProviderHttpMetadata, f as notifyProviderHttpResponse, g as sanitizeTransportPayloadText, h as sanitizeNonEmptyTransportPayloadText, i as createEmptyTransportUsage, l as mergeTransportHeaders, m as parseTerminalToolCallArguments, n as coerceTransportToolCallArguments, o as failTransportStream, p as notifyProviderStreamOpened, r as copyProviderAcceptanceObserver, s as finalizeTerminalToolCallArguments, t as assignTransportErrorDetails, u as mergeTransportMetadata, v as withProviderAcceptanceObserver, x as parseJsonPreservingUnsafeIntegers, y as withProviderResponseHook } from "./transport-stream-shared-
|
|
16
|
-
import { C as createDeepSeekTextFilter, E as tagUnresolvedTextAsCommentary, S as shouldOmitOllamaCompatResponseFormat, T as tagPendingCommentaryText, _ as hasToolCallHistory, a as buildOpenAISdkClientOptions, b as resolveOpenAICompletionsCompat, c as filterCodeModePayloadTools, d as readCodeModePayloadToolName, f as resolveCodeModeResponsesVisibleToolNames, g as convertMessages, h as resolveOpenAIReasoningEffortMap, i as buildOpenAIClientHeaders, l as getCompat, m as usesNativeOpenAICodexResponsesBackend, n as shouldEmitOpenAICompletionsReasoning, o as buildOpenAISdkRequestOptions, p as resolveOpenAIStrictToolFlagWithDiagnostics, r as assertCodeModeResponsesToolSurface, s as enforceCodeModeResponsesToolSurface, t as processCompletionsStream, u as isOpenAICodexResponsesModel, v as finalizeOpenAICompletionsToolCalls, x as resolveOpenAICompletionsResponseFormat, y as detectOpenAICompletionsCompat } from "./openai-completions-stream-
|
|
15
|
+
import { S as quoteUnsafeIntegerLiterals, _ as transportAbortError, a as createWritableTransportEventStream, b as parseJsonObjectPreservingUnsafeIntegers, c as finalizeTransportStream, d as notifyProviderHttpMetadata, f as notifyProviderHttpResponse, g as sanitizeTransportPayloadText, h as sanitizeNonEmptyTransportPayloadText, i as createEmptyTransportUsage, l as mergeTransportHeaders, m as parseTerminalToolCallArguments, n as coerceTransportToolCallArguments, o as failTransportStream, p as notifyProviderStreamOpened, r as copyProviderAcceptanceObserver, s as finalizeTerminalToolCallArguments, t as assignTransportErrorDetails, u as mergeTransportMetadata, v as withProviderAcceptanceObserver, x as parseJsonPreservingUnsafeIntegers, y as withProviderResponseHook } from "./transport-stream-shared-CytPVLIg.mjs";
|
|
16
|
+
import { C as createDeepSeekTextFilter, E as tagUnresolvedTextAsCommentary, S as shouldOmitOllamaCompatResponseFormat, T as tagPendingCommentaryText, _ as hasToolCallHistory, a as buildOpenAISdkClientOptions, b as resolveOpenAICompletionsCompat, c as filterCodeModePayloadTools, d as readCodeModePayloadToolName, f as resolveCodeModeResponsesVisibleToolNames, g as convertMessages, h as resolveOpenAIReasoningEffortMap, i as buildOpenAIClientHeaders, l as getCompat, m as usesNativeOpenAICodexResponsesBackend, n as shouldEmitOpenAICompletionsReasoning, o as buildOpenAISdkRequestOptions, p as resolveOpenAIStrictToolFlagWithDiagnostics, r as assertCodeModeResponsesToolSurface, s as enforceCodeModeResponsesToolSurface, t as processCompletionsStream, u as isOpenAICodexResponsesModel, v as finalizeOpenAICompletionsToolCalls, x as resolveOpenAICompletionsResponseFormat, y as detectOpenAICompletionsCompat } from "./openai-completions-stream-DZjwK8vp.mjs";
|
|
17
17
|
import { t as createDeferredEventBuffer } from "./deferred-event-buffer-DAvyP7qA.mjs";
|
|
18
18
|
import { r as parseStreamingJson, t as createToolArgumentPreviewSchedule } from "./json-parse-BuAJEbdW.mjs";
|
|
19
19
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
20
20
|
import { t as googleFlashSupportsMinimalThinking } from "./google-thinking-level-C-V3tecN.mjs";
|
|
21
|
-
import { B as buildResponsesInputMessage, C as summarizeResponsesTools, G as captureOpenAIResponsesCompaction, H as createOpenAIResponsesAssistantOutput, I as createResponsesStreamWithEncryptedContentRetry, J as resolveReplayableResponsesMessageId, K as resolveNewestOpenAIResponsesCompactionReplay, L as isInvalidEncryptedContentError, R as resolveAzureOpenAIApiVersion, S as summarizeResponsesPayload, U as CompactionReplayRefreshRequiredError, V as convertResponsesMessages, W as buildOpenAIResponsesReasoningReplayMetadata, X as resolveModelPayloadDebugMode, Y as emitModelTransportDebug, Z as resolveModelSseDebugMode, _ as safeDebugValue, b as summarizeOpenAITransportError, c as processResponsesStream, f as observeResponsesStream, g as normalizeResponsesFailedEvent, h as logResponsesFailedNoDetails, m as buildResponsesFailedNoDetailsObservation, n as applyResponsesServiceTierPricing, p as ResponsesStreamFailure, q as suppressOpenAIResponsesCompaction, v as stringifyRedactedEvent, x as summarizeResponsesFailedNoDetailsObservation, y as stringifyRedactedPayload, z as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-
|
|
22
|
-
import { A as readOpenAICompletionsReasoningBatch, C as createOpenAIProviderAcceptanceHook, D as measureUtf8AppendBytes, E as log, M as resolvePromptCacheKey, N as throwIfModelStreamAborted, O as parseOpenAICompletionsUsage, S as createModelStreamCooperativeScheduler, T as isOpenAICompletionsThinkingEnabled, b as reconcileOpenAIResponsesToolChoice, j as resolveOpenAIClientBaseUrl, k as readOpenAICompletionsContentDeltas, r as normalizeOpenAIStrictToolParameters, v as projectOpenAITools, w as createOpenAIResponseHook, x as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, y as reconcileOpenAICompletionsToolChoice } from "./openai-tool-schema-
|
|
21
|
+
import { B as buildResponsesInputMessage, C as summarizeResponsesTools, G as captureOpenAIResponsesCompaction, H as createOpenAIResponsesAssistantOutput, I as createResponsesStreamWithEncryptedContentRetry, J as resolveReplayableResponsesMessageId, K as resolveNewestOpenAIResponsesCompactionReplay, L as isInvalidEncryptedContentError, R as resolveAzureOpenAIApiVersion, S as summarizeResponsesPayload, U as CompactionReplayRefreshRequiredError, V as convertResponsesMessages, W as buildOpenAIResponsesReasoningReplayMetadata, X as resolveModelPayloadDebugMode, Y as emitModelTransportDebug, Z as resolveModelSseDebugMode, _ as safeDebugValue, b as summarizeOpenAITransportError, c as processResponsesStream, f as observeResponsesStream, g as normalizeResponsesFailedEvent, h as logResponsesFailedNoDetails, m as buildResponsesFailedNoDetailsObservation, n as applyResponsesServiceTierPricing, p as ResponsesStreamFailure, q as suppressOpenAIResponsesCompaction, v as stringifyRedactedEvent, x as summarizeResponsesFailedNoDetailsObservation, y as stringifyRedactedPayload, z as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-DiAdpNAM.mjs";
|
|
22
|
+
import { A as readOpenAICompletionsReasoningBatch, C as createOpenAIProviderAcceptanceHook, D as measureUtf8AppendBytes, E as log, M as resolvePromptCacheKey, N as throwIfModelStreamAborted, O as parseOpenAICompletionsUsage, S as createModelStreamCooperativeScheduler, T as isOpenAICompletionsThinkingEnabled, b as reconcileOpenAIResponsesToolChoice, j as resolveOpenAIClientBaseUrl, k as readOpenAICompletionsContentDeltas, r as normalizeOpenAIStrictToolParameters, v as projectOpenAITools, w as createOpenAIResponseHook, x as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, y as reconcileOpenAICompletionsToolChoice } from "./openai-tool-schema-BMiHFH36.mjs";
|
|
23
23
|
import { i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-DcNjoFQE.mjs";
|
|
24
24
|
import { C as isOpenAIGpt54MiniModel, D as resolveOpenAIReasoningEffortForModel, E as normalizeOpenAIReasoningEffort, T as isOpenAIGpt56Model, _ as OpenAIResponsesWebSocketPostDispatchError, a as applyOpenAIResponsesPayloadPolicy, c as resolveOpenAIResponsesServerCompactionPlan, d as OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS, f as OPENAI_RESPONSES_APIS, i as sanitizeResponsesImagePayload, l as AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS, n as isOpenAIResponsesCompactionOutput, o as resolveOpenAIResponsesCompactEndpointPlan, s as resolveOpenAIResponsesPayloadPolicy, t as createBoundedOpenAIResponsesCompactionFetch, v as OpenAIResponsesWebSocketPreDispatchError, w as isOpenAIGpt55Model, x as parseOpenAIResponsesWebSocketServerError, y as OpenAIResponsesWebSocketSafeRetryError } from "./openai-responses-compaction-window-DO7yV7az.mjs";
|
|
25
25
|
import { i as resolveAzureDeploymentNameFromMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "./azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
26
26
|
import { n as registerSessionResourceCleanup } from "./session-resources-CkR4WWy1.mjs";
|
|
27
|
+
import { t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-C7x4IK7r.mjs";
|
|
27
28
|
import { randomUUID } from "node:crypto";
|
|
28
29
|
import OpenAI, { AzureOpenAI } from "openai";
|
|
29
30
|
import { ResponsesWS } from "openai/resources/responses/ws.js";
|
|
@@ -1134,17 +1135,17 @@ function createAnthropicMessagesTransportStreamFn() {
|
|
|
1134
1135
|
output
|
|
1135
1136
|
});
|
|
1136
1137
|
} catch (error) {
|
|
1137
|
-
if (refusalBuffer) {
|
|
1138
|
-
refusalBuffer.discard();
|
|
1139
|
-
output.content = [];
|
|
1140
|
-
} else output.content = output.content.filter((block) => block.type !== "toolCall");
|
|
1141
|
-
if (usedCompactionReplay && isAnthropicReplayRejection(error)) suppressAnthropicCompaction(output, model, options);
|
|
1142
1138
|
failTransportStream({
|
|
1143
1139
|
stream,
|
|
1144
1140
|
output,
|
|
1145
1141
|
signal: options?.signal,
|
|
1146
1142
|
error,
|
|
1147
1143
|
cleanup: () => {
|
|
1144
|
+
if (refusalBuffer) {
|
|
1145
|
+
refusalBuffer.discard();
|
|
1146
|
+
output.content = [];
|
|
1147
|
+
} else output.content = output.content.filter((block) => block.type !== "toolCall");
|
|
1148
|
+
if (usedCompactionReplay && isAnthropicReplayRejection(error)) suppressAnthropicCompaction(output, model, options);
|
|
1148
1149
|
for (const block of output.content) delete block.index;
|
|
1149
1150
|
}
|
|
1150
1151
|
});
|
|
@@ -1834,10 +1835,7 @@ function createOpenAICompletionsTransportStreamFn() {
|
|
|
1834
1835
|
if (getCompat(model).requiresNonEmptyUserOrAssistantMessage) assertOpenAICompletionsPayloadHasConversationTurn(params, model);
|
|
1835
1836
|
const emitReasoning = shouldEmitOpenAICompletionsReasoning(model, options);
|
|
1836
1837
|
firstEventAbort = createFirstStreamEventAbortController(options?.signal);
|
|
1837
|
-
const { data: responseStream, response } = await client.chat.completions.create(params, buildOpenAISdkRequestOptions(model, firstEventAbort.signal, {
|
|
1838
|
-
timeoutMs: options?.timeoutMs,
|
|
1839
|
-
maxRetries: options?.maxRetries
|
|
1840
|
-
})).withResponse();
|
|
1838
|
+
const { data: responseStream, response } = await client.chat.completions.create(params, buildOpenAISdkRequestOptions(model, firstEventAbort.signal, { timeoutMs: options?.timeoutMs })).withResponse();
|
|
1841
1839
|
const hookedResponseStream = withProviderResponseHook({
|
|
1842
1840
|
stream: responseStream,
|
|
1843
1841
|
signal: firstEventAbort.signal,
|
|
@@ -1926,7 +1924,7 @@ function jsonValuesEqual(left, right) {
|
|
|
1926
1924
|
return stableStringify(JSON.parse(JSON.stringify(left))) === stableStringify(JSON.parse(JSON.stringify(right)));
|
|
1927
1925
|
}
|
|
1928
1926
|
function requestWithoutInput(request) {
|
|
1929
|
-
const { input: _input, previous_response_id: _previousResponseId, instructions: _instructions, ...rest } = request;
|
|
1927
|
+
const { input: _input, previous_response_id: _previousResponseId, instructions: _instructions, tools: _tools, ...rest } = request;
|
|
1930
1928
|
if (!isRecord(rest.metadata)) return rest;
|
|
1931
1929
|
const metadata = Object.fromEntries(Object.entries(rest.metadata).filter(([key]) => key !== "openclaw_turn_id" && key !== "openclaw_turn_attempt"));
|
|
1932
1930
|
return {
|
|
@@ -1934,12 +1932,16 @@ function requestWithoutInput(request) {
|
|
|
1934
1932
|
metadata
|
|
1935
1933
|
};
|
|
1936
1934
|
}
|
|
1937
|
-
function normalizeAssistantReplayInput(input) {
|
|
1935
|
+
function normalizeAssistantReplayInput(input, fromResponse = false) {
|
|
1938
1936
|
return input.map((item) => {
|
|
1939
1937
|
if (!isRecord(item)) return item;
|
|
1940
1938
|
if (item.type === "reasoning") return { type: "reasoning" };
|
|
1941
1939
|
if (item.type !== "function_call" && !(item.type === "message" && item.role === "assistant")) return item;
|
|
1942
1940
|
const { id: _id, status: _status, ...stableItem } = item;
|
|
1941
|
+
if (fromResponse && item.type === "function_call") {
|
|
1942
|
+
const args = parseJsonObjectPreservingUnsafeIntegers(stableItem.arguments);
|
|
1943
|
+
stableItem.arguments = args ? JSON.stringify(args) : stableItem.arguments;
|
|
1944
|
+
}
|
|
1943
1945
|
if (item.type === "message" && Array.isArray(stableItem.content)) stableItem.content = stableItem.content.map((part) => {
|
|
1944
1946
|
if (!isRecord(part) || part.type !== "output_text") return part;
|
|
1945
1947
|
const { annotations: _annotations, logprobs: _logprobs, ...stablePart } = part;
|
|
@@ -1968,7 +1970,7 @@ function resolveResponsesContinuationRequest(continuation, request) {
|
|
|
1968
1970
|
request,
|
|
1969
1971
|
continuationStatus: "history_shorter"
|
|
1970
1972
|
};
|
|
1971
|
-
if (!jsonValuesEqual(normalizeAssistantReplayInput(currentInput.slice(0, previousInput.length)), normalizeAssistantReplayInput(previousInput)) || !jsonValuesEqual(normalizeAssistantReplayInput(currentInput.slice(previousInput.length, baselineLength)), normalizeAssistantReplayInput(continuation.lastResponseItems))) return {
|
|
1973
|
+
if (!jsonValuesEqual(normalizeAssistantReplayInput(currentInput.slice(0, previousInput.length)), normalizeAssistantReplayInput(previousInput)) || !jsonValuesEqual(normalizeAssistantReplayInput(currentInput.slice(previousInput.length, baselineLength)), normalizeAssistantReplayInput(continuation.lastResponseItems, true))) return {
|
|
1972
1974
|
request,
|
|
1973
1975
|
continuationStatus: "history_changed"
|
|
1974
1976
|
};
|
|
@@ -2530,10 +2532,7 @@ function createOpenAIResponsesClient(model, context, apiKey, optionHeaders, turn
|
|
|
2530
2532
|
async function postOpenAIResponsesCompaction(params) {
|
|
2531
2533
|
const compactInput = typeof params.request.instructions === "string" && params.request.instructions.length > 0 ? [buildOpenAIResponsesCompactSystemMessage(params.model, params.request.instructions), ...params.request.input ?? []] : params.request.input;
|
|
2532
2534
|
const response = await params.client.post("/responses/compact", {
|
|
2533
|
-
...buildOpenAISdkRequestOptions(params.model, params.options?.signal, {
|
|
2534
|
-
timeoutMs: params.options?.timeoutMs,
|
|
2535
|
-
maxRetries: params.options?.maxRetries
|
|
2536
|
-
}),
|
|
2535
|
+
...buildOpenAISdkRequestOptions(params.model, params.options?.signal, { timeoutMs: params.options?.timeoutMs }),
|
|
2537
2536
|
body: {
|
|
2538
2537
|
model: params.request.model,
|
|
2539
2538
|
input: compactInput
|
|
@@ -2642,14 +2641,13 @@ function createResponsesTransportExecutor(config) {
|
|
|
2642
2641
|
firstEventAbort = firstEvent;
|
|
2643
2642
|
const requestOptions = buildOpenAISdkRequestOptions(model, firstEvent.signal, {
|
|
2644
2643
|
stream: config.streamRequest,
|
|
2645
|
-
timeoutMs: options?.timeoutMs
|
|
2646
|
-
maxRetries: options?.maxRetries
|
|
2644
|
+
timeoutMs: options?.timeoutMs
|
|
2647
2645
|
});
|
|
2648
2646
|
const websocketSignal = combineWebSocketTimeoutSignal(firstEvent.signal, model, requestOptions?.timeout);
|
|
2649
2647
|
emitModelTransportDebug(log, `[responses] start provider=${model.provider} api=${model.api} model=${model.id} requestIdHash=${redactIdentifier(options?.requestId, { len: 64 })} baseUrl=${formatModelTransportDebugBaseUrl(model.baseUrl)} timeoutMs=${safeDebugValue(requestOptions?.timeout)} apiKey=${apiKey ? "present" : "missing"} ${summarizeResponsesPayload(params)}`);
|
|
2650
2648
|
let continuationBaseline;
|
|
2651
2649
|
const createSseStream = async (initialRequest = continuationClaim?.request ?? params, initialAttemptKind = "initial", initialRejectedCompaction) => {
|
|
2652
|
-
const { stream: responseStream } = await
|
|
2650
|
+
const { stream: responseStream } = await createResponsesStreamWithEncryptedContentRetry({
|
|
2653
2651
|
client,
|
|
2654
2652
|
request: initialRequest,
|
|
2655
2653
|
requestOptions,
|
|
@@ -2803,7 +2801,6 @@ function createOpenAIResponsesTransportStreamFn() {
|
|
|
2803
2801
|
httpContinuation: true,
|
|
2804
2802
|
createClient: createOpenAIResponsesClient,
|
|
2805
2803
|
buildRequest: buildOpenAIResponsesParams,
|
|
2806
|
-
createResponseStream: createResponsesStreamWithEncryptedContentRetry,
|
|
2807
2804
|
pricingOptions: (options, model) => ({
|
|
2808
2805
|
serviceTier: options?.serviceTier,
|
|
2809
2806
|
applyServiceTierPricing: (usage, serviceTier) => applyResponsesServiceTierPricing(usage, serviceTier, model)
|
|
@@ -2815,8 +2812,7 @@ function createAzureOpenAIResponsesTransportStreamFn() {
|
|
|
2815
2812
|
outputApi: "azure-openai-responses",
|
|
2816
2813
|
firstEventTimeoutMs: AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS,
|
|
2817
2814
|
createClient: createAzureOpenAIClient,
|
|
2818
|
-
buildRequest: (model, context, options, metadata, replayMode) => buildAzureOpenAIResponsesParams(model, context, options, resolveAzureDeploymentName(model), metadata, replayMode)
|
|
2819
|
-
createResponseStream: createResponsesStreamWithEncryptedContentRetry
|
|
2815
|
+
buildRequest: (model, context, options, metadata, replayMode) => buildAzureOpenAIResponsesParams(model, context, options, resolveAzureDeploymentName(model), metadata, replayMode)
|
|
2820
2816
|
});
|
|
2821
2817
|
}
|
|
2822
2818
|
function resolveAzureDeploymentName(model) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index-AfaxKT8w.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as AssistantMessageDiagnostic } from "./diagnostics-
|
|
1
|
+
import { t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
|
|
2
2
|
import { TSchema } from "typebox";
|
|
3
3
|
//#region packages/llm-core/src/types.d.ts
|
|
4
4
|
/** Provider API families with first-class request/stream adapters in OpenClaw. */
|
|
@@ -104,11 +104,6 @@ interface StreamOptions {
|
|
|
104
104
|
* For example, OpenAI and Anthropic SDK clients default to 10 minutes.
|
|
105
105
|
*/
|
|
106
106
|
timeoutMs?: number;
|
|
107
|
-
/**
|
|
108
|
-
* Maximum retry attempts for providers/SDKs that support client-side retries.
|
|
109
|
-
* For example, OpenAI and Anthropic SDK clients default to 2.
|
|
110
|
-
*/
|
|
111
|
-
maxRetries?: number;
|
|
112
107
|
/**
|
|
113
108
|
* Maximum delay in milliseconds to wait for a retry when the server requests a long wait.
|
|
114
109
|
* If the server's requested delay exceeds this value, the request fails immediately
|
|
@@ -469,6 +464,8 @@ interface OpenAICompletionsCompat {
|
|
|
469
464
|
supportsDeveloperRole?: boolean;
|
|
470
465
|
/** Whether the provider supports `reasoning_effort`. Default: auto-detected from URL. */
|
|
471
466
|
supportsReasoningEffort?: boolean;
|
|
467
|
+
/** Per-level reasoning effort overrides, e.g. map "off" to "low" for models that cannot disable thinking. */
|
|
468
|
+
reasoningEffortMap?: Record<string, string>;
|
|
472
469
|
/** Whether the provider supports `stream_options: { include_usage: true }` for token usage in streaming responses. Default: true. */
|
|
473
470
|
supportsUsageInStreaming?: boolean;
|
|
474
471
|
/** Which field to use for max tokens. Default: auto-detected from URL. */
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./index-
|
|
2
|
-
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, t as AssistantMessageDiagnostic } from "./diagnostics-
|
|
3
|
-
import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, E as Message, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, V as ProviderStreamOptions, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, q as StreamFunction, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-
|
|
4
|
-
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-
|
|
5
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
6
|
-
import "./types-
|
|
7
|
-
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
1
|
+
import { _ as supportsClaudeAdaptiveThinking, a as CLAUDE_FABLE_5_THINKING_PROFILE, b as supportsClaudeNativeXhighEffort, c as requiresClaudeDefaultSampling, d as resolveClaudeModelIdentity, f as resolveClaudeMythos5ModelIdentity, g as supportsClaude1MContext, h as resolveClaudeSonnet5ModelIdentity, i as normalizeResolvedPricing, l as requiresClaudeMandatoryAdaptiveThinking, m as resolveClaudeOpus5ModelIdentity, n as calculateUsageCost, o as CLAUDE_OPUS_5_THINKING_PROFILE, p as resolveClaudeNativeThinkingLevelMap, r as normalizeModelCostConfig, s as CLAUDE_SONNET_5_THINKING_PROFILE, u as resolveClaudeFable5ModelIdentity, v as supportsClaudeFastMode, y as supportsClaudeNativeMaxEffort } from "./index-AfaxKT8w.mjs";
|
|
2
|
+
import { a as extractDiagnosticError, i as createAssistantMessageDiagnostic, n as DiagnosticErrorInfo, o as formatThrownValue, r as appendAssistantMessageDiagnostic, s as isProviderRefusalAssistantError, t as AssistantMessageDiagnostic } from "./diagnostics-DnPnOui6.mjs";
|
|
3
|
+
import { $ as ThinkingLevel, A as ModelThinkingLevel, B as ProviderResponse, C as KnownImagesApi, D as Model, E as Message, F as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, G as StopReason, H as RawModelCostConfig, I as PricingTier, J as StreamOptions, K as StreamFn, L as Provider, M as OpenAIResponsesCompat, N as OpenRouterRouting, O as ModelCostConfig, P as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, Q as ThinkingContent, R as ProviderImagesOptions, S as KnownApi, T as MaybePromise, U as RawPricingTier, V as ProviderStreamOptions, W as SimpleStreamOptions, X as TextSignatureV1, Y as TextContent, Z as ThinkingBudgets, _ as ImagesModel, a as AssistantMessage, at as Usage, b as ImagesProvider, c as AssistantMessageEventStreamLike, ct as VercelGatewayRouting, d as Context, et as ThinkingLevelMap, f as ImageContent, g as ImagesInputContent, h as ImagesFunction, i as AssistantImages, it as Transport, j as OpenAICompletionsCompat, k as ModelCostRates, l as CacheRetention, m as ImagesContext, n as Api, nt as ToolCall, o as AssistantMessageEvent, ot as UserMessage, p as ImagesApi, q as StreamFunction, r as AssistantDeliveryTtsFacts, rt as ToolResultMessage, s as AssistantMessageEventStreamContract, st as ValidateToolArgumentsFn, t as AnthropicMessagesCompat, tt as Tool, u as CompleteSimpleFn, v as ImagesOptions, w as KnownImagesProvider, x as ImagesStopReason, y as ImagesOutputContent, z as ProviderReplayState } from "./types-DbrhszyQ.mjs";
|
|
4
|
+
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-vK_7r3bj.mjs";
|
|
5
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-BOwtcl9X.mjs";
|
|
6
|
+
import "./types-B5EFUmXs.mjs";
|
|
7
|
+
export { AnthropicMessagesCompat, Api, AssistantDeliveryTtsFacts, AssistantImages, AssistantMessage, AssistantMessageDiagnostic, AssistantMessageEvent, AssistantMessageEventStream, AssistantMessageEventStreamContract, AssistantMessageEventStreamLike, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, CacheRetention, CompleteSimpleFn, Context, DiagnosticErrorInfo, EventStream, ImageContent, ImagesApi, ImagesContext, ImagesFunction, ImagesInputContent, ImagesModel, ImagesOptions, ImagesOutputContent, ImagesProvider, ImagesStopReason, KnownApi, KnownImagesApi, KnownImagesProvider, MaybePromise, Message, Model, ModelCostConfig, ModelCostRates, ModelThinkingLevel, OpenAICompletionsCompat, OpenAIResponsesCompat, OpenRouterRouting, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, PricingTier, Provider, ProviderImagesOptions, ProviderReplayState, ProviderResponse, ProviderStreamOptions, RawModelCostConfig, RawPricingTier, SimpleStreamOptions, StopReason, StreamFn, StreamFunction, StreamOptions, TextContent, TextSignatureV1, ThinkingBudgets, ThinkingContent, ThinkingLevel, ThinkingLevelMap, Tool, ToolCall, ToolResultMessage, Transport, Usage, UserMessage, ValidateToolArgumentsFn, VercelGatewayRouting, appendAssistantMessageDiagnostic, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
package/dist/types.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as supportsClaudeFastMode, a as CLAUDE_OPUS_5_THINKING_PROFILE, c as requiresClaudeMandatoryAdaptiveThinking, d as resolveClaudeMythos5ModelIdentity, f as resolveClaudeNativeThinkingLevelMap, g as supportsClaudeAdaptiveThinking, h as supportsClaude1MContext, i as CLAUDE_FABLE_5_THINKING_PROFILE, l as resolveClaudeFable5ModelIdentity, m as resolveClaudeSonnet5ModelIdentity, n as normalizeModelCostConfig, o as CLAUDE_SONNET_5_THINKING_PROFILE, p as resolveClaudeOpus5ModelIdentity, r as normalizeResolvedPricing, s as requiresClaudeDefaultSampling, t as calculateUsageCost, u as resolveClaudeModelIdentity, v as supportsClaudeNativeMaxEffort, y as supportsClaudeNativeXhighEffort } from "./src-C8U7lkoa.mjs";
|
|
2
2
|
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
3
|
-
import { i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-
|
|
3
|
+
import { a as isProviderRefusalAssistantError, i as formatThrownValue, n as createAssistantMessageDiagnostic, r as extractDiagnosticError, t as appendAssistantMessageDiagnostic } from "./diagnostics-CPeq9F7y.mjs";
|
|
4
4
|
import { n as EventStream, r as createAssistantMessageEventStream, t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
5
5
|
import { n as validateToolCall, t as validateToolArguments } from "./validation-CJZtym2g.mjs";
|
|
6
|
-
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
6
|
+
export { AssistantMessageEventStream, CLAUDE_FABLE_5_THINKING_PROFILE, CLAUDE_OPUS_5_THINKING_PROFILE, CLAUDE_SONNET_5_THINKING_PROFILE, EventStream, PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE, PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, appendAssistantMessageDiagnostic, calculateUsageCost, createAssistantMessageDiagnostic, createAssistantMessageEventStream, extractDiagnosticError, formatThrownValue, isProviderRefusalAssistantError, normalizeModelCostConfig, normalizeResolvedPricing, requiresClaudeDefaultSampling, requiresClaudeMandatoryAdaptiveThinking, resolveClaudeFable5ModelIdentity, resolveClaudeModelIdentity, resolveClaudeMythos5ModelIdentity, resolveClaudeNativeThinkingLevelMap, resolveClaudeOpus5ModelIdentity, resolveClaudeSonnet5ModelIdentity, supportsClaude1MContext, supportsClaudeAdaptiveThinking, supportsClaudeFastMode, supportsClaudeNativeMaxEffort, supportsClaudeNativeXhighEffort, validateToolArguments, validateToolCall };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nt as ToolCall, tt as Tool } from "./types-
|
|
1
|
+
import { nt as ToolCall, tt as Tool } from "./types-DbrhszyQ.mjs";
|
|
2
2
|
//#region packages/llm-core/src/validation.d.ts
|
|
3
3
|
/** Finds the target tool and validates/coerces a model-emitted tool call. */
|
|
4
4
|
declare function validateToolCall(tools: Tool[], toolCall: ToolCall): unknown;
|
package/dist/validation.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as validateToolCall, t as validateToolArguments } from "./validation-
|
|
1
|
+
import { n as validateToolCall, t as validateToolArguments } from "./validation-BOwtcl9X.mjs";
|
|
2
2
|
export { validateToolArguments, validateToolCall };
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./event-stream-DcvAPSBe.mjs";
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
//#region packages/ai/src/utils/tls-certificate-errors.ts
|
|
2
|
-
const HOSTNAME_MISMATCH_CODES = /* @__PURE__ */ new Set(["ERR_TLS_CERT_ALTNAME_INVALID", "HOSTNAME_MISMATCH"]);
|
|
3
|
-
const CERTIFICATE_INVALID_CODES = /* @__PURE__ */ new Set([
|
|
4
|
-
"CERT_CHAIN_TOO_LONG",
|
|
5
|
-
"CERT_HAS_EXPIRED",
|
|
6
|
-
"CERT_NOT_YET_VALID",
|
|
7
|
-
"CERT_REJECTED",
|
|
8
|
-
"CERT_REVOKED",
|
|
9
|
-
"CERT_SIGNATURE_FAILURE",
|
|
10
|
-
"CERT_UNTRUSTED",
|
|
11
|
-
"CRL_HAS_EXPIRED",
|
|
12
|
-
"CRL_NOT_YET_VALID",
|
|
13
|
-
"CRL_SIGNATURE_FAILURE",
|
|
14
|
-
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
15
|
-
"ERROR_IN_CERT_NOT_AFTER_FIELD",
|
|
16
|
-
"ERROR_IN_CERT_NOT_BEFORE_FIELD",
|
|
17
|
-
"ERROR_IN_CRL_LAST_UPDATE_FIELD",
|
|
18
|
-
"ERROR_IN_CRL_NEXT_UPDATE_FIELD",
|
|
19
|
-
"INVALID_CA",
|
|
20
|
-
"INVALID_PURPOSE",
|
|
21
|
-
"PATH_LENGTH_EXCEEDED",
|
|
22
|
-
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
23
|
-
"UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY",
|
|
24
|
-
"UNABLE_TO_DECRYPT_CERT_SIGNATURE",
|
|
25
|
-
"UNABLE_TO_DECRYPT_CRL_SIGNATURE",
|
|
26
|
-
"UNABLE_TO_GET_CRL",
|
|
27
|
-
"UNABLE_TO_GET_ISSUER_CERT",
|
|
28
|
-
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
29
|
-
"UNABLE_TO_VERIFY_LEAF_SIGNATURE"
|
|
30
|
-
]);
|
|
31
|
-
const HOSTNAME_MISMATCH_PATTERNS = [
|
|
32
|
-
/hostname\/ip does not match certificate(?:'s)? altnames/i,
|
|
33
|
-
/hostname mismatch/i,
|
|
34
|
-
/host: .+ is not in the cert(?:ificate)?(?:'s)? altnames/i
|
|
35
|
-
];
|
|
36
|
-
const CERTIFICATE_INVALID_PATTERNS = [
|
|
37
|
-
/certificate has expired/i,
|
|
38
|
-
/certificate is not yet valid/i,
|
|
39
|
-
/self[- ]signed certificate/i,
|
|
40
|
-
/unable to get local issuer certificate/i,
|
|
41
|
-
/unable to verify the first certificate/i
|
|
42
|
-
];
|
|
43
|
-
const MAX_TLS_ERROR_DEPTH = 8;
|
|
44
|
-
function classifyCode(code) {
|
|
45
|
-
if (HOSTNAME_MISMATCH_CODES.has(code)) return "hostname_mismatch";
|
|
46
|
-
return CERTIFICATE_INVALID_CODES.has(code) ? "certificate_invalid" : null;
|
|
47
|
-
}
|
|
48
|
-
function classifyMessage(message) {
|
|
49
|
-
if (HOSTNAME_MISMATCH_PATTERNS.some((pattern) => pattern.test(message))) return "hostname_mismatch";
|
|
50
|
-
return CERTIFICATE_INVALID_PATTERNS.some((pattern) => pattern.test(message)) ? "certificate_invalid" : null;
|
|
51
|
-
}
|
|
52
|
-
function inspectTlsCertificateErrorInternal(error, seen, depth) {
|
|
53
|
-
if (depth > MAX_TLS_ERROR_DEPTH) return null;
|
|
54
|
-
if (typeof error === "string") {
|
|
55
|
-
const kind = classifyMessage(error);
|
|
56
|
-
return kind ? {
|
|
57
|
-
kind,
|
|
58
|
-
message: error
|
|
59
|
-
} : null;
|
|
60
|
-
}
|
|
61
|
-
if (!error || typeof error !== "object" || seen.has(error)) return null;
|
|
62
|
-
seen.add(error);
|
|
63
|
-
const candidate = error;
|
|
64
|
-
const code = typeof candidate.code === "string" ? candidate.code.trim().toUpperCase() : void 0;
|
|
65
|
-
const message = typeof candidate.message === "string" && candidate.message.trim() ? candidate.message : void 0;
|
|
66
|
-
const codeKind = code ? classifyCode(code) : null;
|
|
67
|
-
if (code && codeKind) return {
|
|
68
|
-
kind: codeKind,
|
|
69
|
-
code,
|
|
70
|
-
message: message ?? code
|
|
71
|
-
};
|
|
72
|
-
const nestedErrors = Array.isArray(candidate.errors) ? candidate.errors : [];
|
|
73
|
-
for (const nested of [
|
|
74
|
-
candidate.cause,
|
|
75
|
-
candidate.error,
|
|
76
|
-
...nestedErrors
|
|
77
|
-
]) {
|
|
78
|
-
if (nested === void 0 || nested === error) continue;
|
|
79
|
-
const details = inspectTlsCertificateErrorInternal(nested, seen, depth + 1);
|
|
80
|
-
if (details) return details;
|
|
81
|
-
}
|
|
82
|
-
const messageKind = message ? classifyMessage(message) : null;
|
|
83
|
-
return messageKind && message ? {
|
|
84
|
-
kind: messageKind,
|
|
85
|
-
message
|
|
86
|
-
} : null;
|
|
87
|
-
}
|
|
88
|
-
/** Classify deterministic Node/OpenSSL certificate validation failures. */
|
|
89
|
-
function inspectTlsCertificateError(error) {
|
|
90
|
-
return inspectTlsCertificateErrorInternal(error, /* @__PURE__ */ new Set(), 0);
|
|
91
|
-
}
|
|
92
|
-
//#endregion
|
|
93
|
-
export { inspectTlsCertificateError as t };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "./index-CefaUGSS.mjs";
|