@openclaw/ai 2026.9.4 → 2026.9.6
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 +1 -1
- package/dist/{anthropic-C4Qu4H0Z.mjs → anthropic-DZQ_7gD1.mjs} +37 -38
- package/dist/{anthropic-payload-policy-BZ8umAbk.d.mts → anthropic-payload-policy-DyfwikYJ.d.mts} +4 -4
- package/dist/{anthropic-stream-reducer-CILWF7JD.mjs → anthropic-stream-reducer-D6ZI1wwj.mjs} +70 -50
- package/dist/{api-registry-ByUwIR0e.d.mts → api-registry-C2T3lTV7.d.mts} +2 -2
- package/dist/{assistant-output-tLt4H-iQ.mjs → assistant-output-DM1JBNs1.mjs} +1 -1
- package/dist/{azure-openai-responses-BAlqlKKc.mjs → azure-openai-responses-DS86GYzq.mjs} +6 -9
- package/dist/{base64-D-su8YVo.mjs → base64-CPmadnUf.mjs} +12 -12
- package/dist/credential-redaction-BKv49aiv.d.mts +24 -0
- package/dist/{diagnostics-QuErwCIl.mjs → diagnostics-CH8j2wIG.mjs} +139 -7
- package/dist/{diagnostics-CPeq9F7y.mjs → diagnostics-DzrF1h4J.mjs} +18 -1
- package/dist/diagnostics.d.mts +11 -24
- package/dist/diagnostics.mjs +4 -4
- package/dist/event-stream-C0nsgbj2.d.mts +1 -0
- package/dist/{event-stream-Bt5Y4Pav.d.mts → event-stream-CjnIZZst.d.mts} +1 -1
- package/dist/event-stream.d.mts +2 -2
- package/dist/expect-lbe3Hgrh.mjs +8 -0
- package/dist/{google-DPBAOaOW.mjs → google-BZJFjhuC.mjs} +6 -9
- package/dist/{google-messages-6JkpHrhJ.mjs → google-messages-DB7GKkDk.mjs} +3 -3
- package/dist/{google-shared-BvBeW9aq.mjs → google-shared-Bok4I6zB.mjs} +13 -13
- package/dist/{google-vertex-k-TMCAYD.mjs → google-vertex-3eVNR2qW.mjs} +5 -8
- package/dist/{host-4atIX-2V.d.mts → host-DH-Z-LDb.d.mts} +5 -3
- package/dist/{host-policy-Zcg_cNz8.mjs → host-policy-DZO3oPPk.mjs} +1 -1
- package/dist/{host-B8YfDGd4.mjs → host-yTvBrYM2.mjs} +63 -31
- package/dist/{index-DdD3qerf.d.mts → index-C25RT6bP.d.mts} +37 -14
- package/dist/index.d.mts +7 -8
- package/dist/index.mjs +5 -6
- package/dist/internal/anthropic.d.mts +13 -10
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-completions-compat.d.mts +2 -0
- package/dist/internal/openai-completions-compat.mjs +2 -0
- 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 +24 -53
- package/dist/internal/openai.mjs +12 -9
- package/dist/internal/runtime.d.mts +6 -8
- package/dist/internal/runtime.mjs +6 -10
- package/dist/internal/shared.d.mts +7 -5
- package/dist/internal/shared.mjs +4 -3
- package/dist/internal/tool-schema.d.mts +4 -4
- package/dist/internal/tool-schema.mjs +2 -2
- package/dist/{mistral-CxUZ1jUb.mjs → mistral-C_13dVBn.mjs} +9 -13
- package/dist/{model-transport-url-DKocrEsb.d.mts → model-transport-url-C5f59L3Y.d.mts} +1 -1
- package/dist/{openai-chatgpt-responses-CgO6kZfo.mjs → openai-chatgpt-responses-sTxPl4zM.mjs} +150 -83
- package/dist/{openai-completions-yJuk7eis.mjs → openai-completions-BO6D_hrB.mjs} +11 -12
- package/dist/{openai-prompt-cache-Bds-n_9Q.mjs → openai-completions-compat-CUollwl6.mjs} +5 -50
- package/dist/{openai-completions-compat-eHgh5UPE.d.mts → openai-completions-compat-DfJG1wSO.d.mts} +4 -4
- package/dist/{openai-completions-stream-Da2vvl-S.mjs → openai-completions-stream-BpuJ0ZOA.mjs} +117 -106
- package/dist/{openai-prompt-cache-B4eYo2-I.d.mts → openai-prompt-cache-C4RHdN4n.d.mts} +2 -2
- package/dist/openai-prompt-cache-CjV_2IRI.mjs +46 -0
- package/dist/{openai-provider-client-S2gCrM2Z.mjs → openai-provider-client-BP8J1aeg.mjs} +2 -2
- package/dist/openai-reasoning-effort-ash8dPrd.mjs +243 -0
- package/dist/{openai-responses-DaYwH05E.mjs → openai-responses-BJ_IEoMU.mjs} +8 -12
- package/dist/{openai-responses-compaction-window-CIhBAkkq.mjs → openai-responses-compaction-window-BiNCT0bS.mjs} +20 -62
- package/dist/{openai-responses-contracts-BjBAqAg_.d.mts → openai-responses-contracts-B1ENJFpI.d.mts} +9 -5
- package/dist/openai-responses-contracts-DWrfMODE.mjs +81 -0
- package/dist/{openai-responses-payload-policy-rLRPsSmB.d.mts → openai-responses-payload-policy-C7GsA1y0.d.mts} +5 -3
- package/dist/openai-responses-prompt-observer-internal-DPHWgbBH.mjs +198 -0
- package/dist/openai-responses-request-lifecycle-DFuyO1pQ.mjs +36 -0
- package/dist/{openai-responses-shared-B8RdBPCv.mjs → openai-responses-shared-DvSqtJ6_.mjs} +859 -581
- package/dist/openai-responses-terminal-usage-BNFbvY9f.d.mts +47 -0
- package/dist/{openai-tool-schema-CzjyYXun.mjs → openai-tool-schema-D4BMcj2D.mjs} +262 -162
- package/dist/{openai-transport-params-9aPuV5YY.mjs → openai-transport-params-DZKOTSfH.mjs} +157 -47
- package/dist/{positive-integer-41zhOdcV.mjs → positive-integer-BiUxrd71.mjs} +1 -1
- package/dist/{provider-error-BA-v_tKd.mjs → provider-error-CRhW7lkJ.mjs} +139 -44
- package/dist/{provider-error-CzNw4BWX.d.mts → provider-error-xumb1V3F.d.mts} +3 -1
- package/dist/{provider-options-Ceqv1OKk.d.mts → provider-options-DZYq53lj.d.mts} +12 -7
- package/dist/{provider-replay-context-CJ_YvcEW.mjs → provider-replay-context-DPr3w20a.mjs} +1 -1
- package/dist/{provider-transcript-transform-V5YzU9zh.mjs → provider-transcript-transform-BTocjCRs.mjs} +1 -1
- package/dist/{provider-transport-turn-state-D5EXOFL2.mjs → provider-transport-turn-state-lrXEFkYr.mjs} +1 -1
- package/dist/{provider-types-CVjKjsuq.d.mts → provider-types-w1rEqrGP.d.mts} +3 -3
- package/dist/provider-types.d.mts +6 -7
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{reasoning-tag-text-partitioner-BcR5pztD.mjs → reasoning-tag-text-partitioner-Di38crhI.mjs} +167 -40
- package/dist/{simple-options-BQbb4yQL.mjs → simple-options-np1XPuhm.mjs} +5 -3
- package/dist/{usage-cost-BNWbbXav.mjs → src-DwGYYyZp.mjs} +18 -11
- package/dist/{stream-first-event-timeout-2hfrquuz.mjs → stream-first-event-timeout-BeptfRL6.mjs} +1 -1
- package/dist/{string-normalization-CmLIasuf.mjs → string-normalization-J9ZiLfGO.mjs} +13 -1
- package/dist/tool-schema-json-projection-CD9c_fK8.mjs +134 -0
- package/dist/{transport-stream-shared-zHll9BxO.mjs → transport-stream-shared-B5RioB_Q.mjs} +16 -24
- package/dist/{transport-stream-shared-DNvmoWnv.d.mts → transport-stream-shared-B7Z9oCYg.d.mts} +5 -5
- package/dist/{transport-utils-zrYjICLZ.mjs → transport-utils-03Qi0CN2.mjs} +3 -3
- package/dist/transports.d.mts +27 -13
- package/dist/transports.mjs +168 -462
- package/dist/types-DTvddOfm.d.mts +1 -0
- package/dist/{types-Ntv5z2g2.d.mts → types-qZFbaDbK.d.mts} +49 -3
- package/dist/types.d.mts +6 -7
- package/dist/types.mjs +4 -5
- package/dist/{validation-B0t_G2H6.d.mts → validation-DhQhmt6t.d.mts} +1 -1
- package/dist/{validation-BDzVDnTs.mjs → validation-Dw7cb6BV.mjs} +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +11 -6
- package/dist/diagnostics-DnPnOui6.d.mts +0 -29
- package/dist/event-stream-C3WGFsum.d.mts +0 -1
- package/dist/openai-responses-contracts-DDOHA62Y.mjs +0 -245
- package/dist/openai-responses-prompt-observer-internal-f8J7wpsk.mjs +0 -32
- package/dist/src-DDmEryvj.mjs +0 -2
- package/dist/tool-schema-json-projection-ClptDdAO.mjs +0 -82
- package/dist/types-DlfwzH3T.d.mts +0 -1
package/dist/internal/openai.mjs
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import { n as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import {
|
|
1
|
+
import { a as normalizeOpenAIReasoningEffort, c as resolveOpenAIReasoningEffortMapping, d as supportsOpenAITemperature, i as isOpenAIGpt6Model, l as resolveOpenAISupportedReasoningEfforts, n as isOpenAIGpt55Model, o as resolveOpenAIModelReasoningEfforts, r as isOpenAIGpt56Model, s as resolveOpenAIReasoningEffortForModel, t as isOpenAIGpt54MiniModel, u as supportsOpenAIReasoningEffort } from "../openai-reasoning-effort-ash8dPrd.mjs";
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-CjV_2IRI.mjs";
|
|
3
|
+
import { g as resolveResponsesTerminalStopReason, h as readResponsesReasoningTokens, m as mapResponsesTerminalUsage, p as isResponsesOutputLimitToolCallError } from "../diagnostics-CH8j2wIG.mjs";
|
|
4
|
+
import { a as codeModeToolSurfaceObserver, o as reasoningTagTextPolicy } from "../simple-options-np1XPuhm.mjs";
|
|
5
|
+
import { f as projectOpenAITools, m as reconcileOpenAIResponsesToolChoice, p as reconcileOpenAICompletionsToolChoice } from "../openai-transport-params-DZKOTSfH.mjs";
|
|
6
|
+
import { a as convertMessages } from "../openai-completions-stream-BpuJ0ZOA.mjs";
|
|
7
|
+
import { h as responsesPromptObserver } from "../openai-responses-contracts-DWrfMODE.mjs";
|
|
6
8
|
import { t as mapOpenAIStopReason } from "../openai-stop-reason-Drnn_6Qj.mjs";
|
|
7
|
-
import {
|
|
9
|
+
import { _ as isAzureResponsesTextDeltaEvent, b as isResponsesTextDeltaEventType, d as createResponsesToolCallTracker, f as readResponsesToolCallItemIdentity, g as OPENAI_RESPONSES_OUTPUT_TEXT_DELTA_EVENT_TYPE, h as OPENAI_RESPONSES_OUTPUT_TEXT_CONTENT_PART_TYPE, m as AZURE_RESPONSES_TEXT_DELTA_EVENT_TYPE, p as AZURE_RESPONSES_TEXT_CONTENT_PART_TYPE, v as isAzureResponsesTextDeltaEventType, x as resolveResponsesMessageSnapshotCollapse, y as isResponsesTextContentPartType } from "../openai-responses-shared-DvSqtJ6_.mjs";
|
|
8
10
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-C7K7QfUE.mjs";
|
|
9
|
-
import {
|
|
10
|
-
import { n as
|
|
11
|
-
|
|
11
|
+
import { t as responsesRequestLifecycle } from "../openai-responses-request-lifecycle-DFuyO1pQ.mjs";
|
|
12
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-BO6D_hrB.mjs";
|
|
13
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-BJ_IEoMU.mjs";
|
|
14
|
+
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, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, isAzureResponsesTextDeltaEvent, isAzureResponsesTextDeltaEventType, isOpenAICompatibleAzureResponsesBaseUrl, isOpenAIGpt54MiniModel, isOpenAIGpt55Model, isOpenAIGpt56Model, isOpenAIGpt6Model, isResponsesOutputLimitToolCallError, isResponsesTextContentPartType, isResponsesTextDeltaEventType, isTraditionalAzureOpenAIHost, mapOpenAIStopReason, mapResponsesTerminalUsage, normalizeOpenAIReasoningEffort, parseAzureDeploymentNameMap, projectOpenAITools, readResponsesReasoningTokens, readResponsesToolCallItemIdentity, reasoningTagTextPolicy, reconcileOpenAICompletionsToolChoice, reconcileOpenAIResponsesToolChoice, resolveAzureDeploymentNameFromMap, resolveOpenAIModelReasoningEfforts, resolveOpenAIPromptCacheParams, resolveOpenAIReasoningEffortForModel, resolveOpenAIReasoningEffortMapping, resolveOpenAISupportedReasoningEfforts, resolveResponsesMessageSnapshotCollapse, resolveResponsesTerminalStopReason, responsesPromptObserver, responsesRequestLifecycle, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import "../index-
|
|
2
|
-
import { G as SimpleStreamOptions, H as ProviderStreamOptions, O as Model, Y as StreamOptions, a as AssistantMessage, d as Context, j as ModelThinkingLevel, n as Api, ot as Usage, s as AssistantMessageEventStreamContract } from "../types-
|
|
3
|
-
import { i as getEventStreamCompletion } from "../event-stream-
|
|
4
|
-
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-
|
|
5
|
-
import "../types-
|
|
1
|
+
import "../index-C25RT6bP.mjs";
|
|
2
|
+
import { G as SimpleStreamOptions, H as ProviderStreamOptions, O as Model, Y as StreamOptions, a as AssistantMessage, d as Context, j as ModelThinkingLevel, n as Api, ot as Usage, s as AssistantMessageEventStreamContract } from "../types-qZFbaDbK.mjs";
|
|
3
|
+
import { i as getEventStreamCompletion } from "../event-stream-CjnIZZst.mjs";
|
|
4
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-C2T3lTV7.mjs";
|
|
5
|
+
import "../types-DTvddOfm.mjs";
|
|
6
6
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
7
|
-
import { _ as parseTerminalToolCallArguments } from "../transport-stream-shared-
|
|
7
|
+
import { _ as parseTerminalToolCallArguments } from "../transport-stream-shared-B7Z9oCYg.mjs";
|
|
8
8
|
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
9
9
|
export declare const defaultApiRegistry: {
|
|
10
10
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
@@ -134,8 +134,6 @@ export declare function decodeOpenAICodexJwtPayload(token: string): OpenAICodexJ
|
|
|
134
134
|
export declare function resolveOpenAICodexAccountId(token: string): string | null;
|
|
135
135
|
//#endregion
|
|
136
136
|
//#region packages/ai/src/utils/overflow.d.ts
|
|
137
|
-
/** Detects DS4-style raw token-count context overflow errors. */
|
|
138
|
-
export declare function isConfiguredContextSizeOverflowError(errorMessage: string): boolean;
|
|
139
137
|
declare const CONTEXT_OVERFLOW_PATTERN_SCOPES: {
|
|
140
138
|
readonly "assistant-error": RegExp[];
|
|
141
139
|
readonly "failover-explicit": RegExp[];
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { a as isProviderRefusalAssistantError } from "../diagnostics-
|
|
1
|
+
import { a as isProviderRefusalAssistantError } from "../diagnostics-DzrF1h4J.mjs";
|
|
2
2
|
import { a as getEventStreamCompletion } from "../event-stream-D8PARQfL.mjs";
|
|
3
3
|
import { n as createApiRegistry, t as createLlmRuntime } from "../stream-CREqxHgU.mjs";
|
|
4
|
-
import { A as
|
|
4
|
+
import { A as headersToRecord, F as modelsAreEqual, M as calculateCost, N as clampThinkingLevel, P as getSupportedThinkingLevels, j as applyProviderReportedUsageCost, v as sanitizeSurrogates } from "../host-yTvBrYM2.mjs";
|
|
5
5
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-bktO00EJ.mjs";
|
|
6
|
-
import { D as repairJson, E as parseStreamingJson, O as
|
|
6
|
+
import { D as repairJson, E as parseStreamingJson, O as shortHash, T as parseJsonWithRepair, h as parseTerminalToolCallArguments, w as createToolArgumentPreviewSchedule } from "../transport-stream-shared-B5RioB_Q.mjs";
|
|
7
7
|
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
|
|
8
8
|
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-BjtkplhG.mjs";
|
|
9
|
-
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-
|
|
10
|
-
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-
|
|
9
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, n as createFirstStreamEventTimeoutError, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "../stream-first-event-timeout-BeptfRL6.mjs";
|
|
10
|
+
import { t as createReasoningTagTextPartitioner } from "../reasoning-tag-text-partitioner-Di38crhI.mjs";
|
|
11
11
|
import { t as createSseByteGuard } from "../streaming-byte-guard-CC-HMn_u.mjs";
|
|
12
12
|
import { n as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-CkR4WWy1.mjs";
|
|
13
13
|
import { n as resolveOpenAICodexAccountId, t as decodeOpenAICodexJwtPayload } from "../openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
@@ -35,10 +35,6 @@ const { stream, complete, streamSimple, completeSimple } = defaultLlmRuntime;
|
|
|
35
35
|
//#endregion
|
|
36
36
|
//#region packages/ai/src/utils/overflow.ts
|
|
37
37
|
const CONFIGURED_CONTEXT_SIZE_OVERFLOW_RE = /prompt has [\d,]+ tokens?, but the configured context size is [\d,]+ tokens?/i;
|
|
38
|
-
/** Detects DS4-style raw token-count context overflow errors. */
|
|
39
|
-
function isConfiguredContextSizeOverflowError(errorMessage) {
|
|
40
|
-
return CONFIGURED_CONTEXT_SIZE_OVERFLOW_RE.test(errorMessage);
|
|
41
|
-
}
|
|
42
38
|
const CONTEXT_OVERFLOW_PATTERN_SCOPES = {
|
|
43
39
|
"assistant-error": [
|
|
44
40
|
/prompt is too long/i,
|
|
@@ -199,4 +195,4 @@ function isContextOverflow(message, contextWindow) {
|
|
|
199
195
|
return false;
|
|
200
196
|
}
|
|
201
197
|
//#endregion
|
|
202
|
-
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord,
|
|
198
|
+
export { applyProviderReportedUsageCost, calculateCost, clampThinkingLevel, cleanupSessionResources, clearApiProviders, complete, completeSimple, createDeferredEventBuffer, createFirstStreamEventAbortController, createFirstStreamEventTimeoutError, createReasoningTagTextPartitioner, createSseByteGuard, createToolArgumentPreviewSchedule, decodeOpenAICodexJwtPayload, defaultApiRegistry, defaultLlmRuntime, findEnvKeys, getApiProvider, getApiProviders, getEnvApiKey, getEventStreamCompletion, getFirstStreamEventTimeoutHandler, getFirstStreamEventTimeoutMs, getSupportedThinkingLevels, headersToRecord, isContextOverflow, matchesContextOverflowMessage, modelsAreEqual, notifyLlmRequestActivity, onLlmRequestActivity, parseJsonWithRepair, parseStreamingJson, parseTerminalToolCallArguments, registerSessionResourceCleanup, repairJson, resolveOpenAICodexAccountId, sanitizeSurrogates, shortHash, stream, streamSimple, withFirstStreamEventTimeout };
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { D as Message, G as SimpleStreamOptions, O as Model, Q as ThinkingBudgets, Y as StreamOptions, a as AssistantMessage, et as ThinkingLevel, n as Api } from "../types-
|
|
2
|
-
import { a as readAssistantThinkingAppend } from "../event-stream-
|
|
3
|
-
import "../types-
|
|
1
|
+
import { D as Message, G as SimpleStreamOptions, O as Model, Q as ThinkingBudgets, Y as StreamOptions, a as AssistantMessage, et as ThinkingLevel, n as Api } from "../types-qZFbaDbK.mjs";
|
|
2
|
+
import { a as readAssistantThinkingAppend } from "../event-stream-CjnIZZst.mjs";
|
|
3
|
+
import "../types-DTvddOfm.mjs";
|
|
4
4
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-BZiVbGwK.mjs";
|
|
5
|
+
import { i as projectProviderError } from "../provider-error-xumb1V3F.mjs";
|
|
6
|
+
import { n as createDiagnosticRecord } from "../credential-redaction-BKv49aiv.mjs";
|
|
5
7
|
import { n as normalizeStructuredPromptSection, r as sortPromptCacheToolsByName, t as normalizePromptCapabilityIds } from "../prompt-cache-stability-Cwcjv_fx.mjs";
|
|
6
8
|
//#region packages/ai/src/providers/simple-options.d.ts
|
|
7
9
|
type FirstEventStreamOptions = {
|
|
8
10
|
firstEventTimeoutMs?: number;
|
|
9
11
|
onFirstEventTimeout?: (reason: Error) => void;
|
|
10
12
|
};
|
|
11
|
-
export declare function buildBaseOptions(model: Model, options?: SimpleStreamOptions, apiKey?: string): StreamOptions & FirstEventStreamOptions
|
|
13
|
+
export declare function buildBaseOptions(model: Model, options?: SimpleStreamOptions, apiKey?: string): StreamOptions & FirstEventStreamOptions & Pick<SimpleStreamOptions, "serviceTier">;
|
|
12
14
|
export declare function clampMaxTokensToModel(model: Model, requestedMaxTokens: number): number;
|
|
13
15
|
export declare function clampMaxTokensToModel(model: Model, requestedMaxTokens: number | undefined): number | undefined;
|
|
14
16
|
export declare function clampReasoning(effort: ThinkingLevel): Exclude<ThinkingLevel, "xhigh">;
|
|
@@ -111,4 +113,4 @@ export declare function projectCopilotRequestFacts(messages: readonly {
|
|
|
111
113
|
hasImages: boolean;
|
|
112
114
|
};
|
|
113
115
|
//#endregion
|
|
114
|
-
export { normalizePromptCapabilityIds, normalizeStructuredPromptSection, readAssistantThinkingAppend, sanitizeSurrogates, sortPromptCacheToolsByName };
|
|
116
|
+
export { createDiagnosticRecord, normalizePromptCapabilityIds, normalizeStructuredPromptSection, projectProviderError, readAssistantThinkingAppend, sanitizeSurrogates, sortPromptCacheToolsByName };
|
package/dist/internal/shared.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { o as readAssistantThinkingAppend } from "../event-stream-D8PARQfL.mjs";
|
|
2
|
-
import { _ as isImageWithMediaPayload, a as FAILED_ASSISTANT_REPLAY_TEXT, c as isReasoningOnlyLengthAssistantTurn, d as describeToolResultMediaPlaceholder, f as describeUnsupportedToolResultMedia, g as hasMediaPayload, h as formatToolResultText, i as transformMessages, l as isStreamErrorFallbackContent, m as extractToolResultText, o as STREAM_ERROR_FALLBACK_TEXT, p as extractToolResultBlockText, s as hasOnlyAssistantReasoningContent, u as resolveFailedAssistantReplay, v as sanitizeSurrogates } from "../host-
|
|
3
|
-
import {
|
|
2
|
+
import { _ as isImageWithMediaPayload, a as FAILED_ASSISTANT_REPLAY_TEXT, c as isReasoningOnlyLengthAssistantTurn, d as describeToolResultMediaPlaceholder, f as describeUnsupportedToolResultMedia, g as hasMediaPayload, h as formatToolResultText, i as transformMessages, l as isStreamErrorFallbackContent, m as extractToolResultText, o as STREAM_ERROR_FALLBACK_TEXT, p as extractToolResultBlockText, s as hasOnlyAssistantReasoningContent, u as resolveFailedAssistantReplay, v as sanitizeSurrogates } from "../host-yTvBrYM2.mjs";
|
|
3
|
+
import { n as projectProviderError, r as createDiagnosticRecord } from "../provider-error-CRhW7lkJ.mjs";
|
|
4
|
+
import { _ as normalizeStructuredPromptSection, c as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, d as prependSystemPromptAdditionAfterCacheBoundary, f as splitSystemPromptCacheBoundary, g as normalizePromptCapabilityIds, h as stripSystemPromptRelocatableBoundary, i as clampReasoning, l as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, m as stripSystemPromptCacheBoundary, n as buildBaseOptions, p as splitSystemPromptRelocatableBoundary, r as clampMaxTokensToModel, s as SYSTEM_PROMPT_CACHE_BOUNDARY, t as adjustMaxTokensForThinking, u as ensureSystemPromptCacheBoundary, v as sortPromptCacheToolsByName } from "../simple-options-np1XPuhm.mjs";
|
|
4
5
|
import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-BTEBMeOv.mjs";
|
|
5
6
|
//#region packages/ai/src/utils/tls-certificate-errors.ts
|
|
6
7
|
const HOSTNAME_MISMATCH_CODES = /* @__PURE__ */ new Set(["ERR_TLS_CERT_ALTNAME_INVALID", "HOSTNAME_MISMATCH"]);
|
|
@@ -94,4 +95,4 @@ function inspectTlsCertificateError(error) {
|
|
|
94
95
|
return inspectTlsCertificateErrorInternal(error, /* @__PURE__ */ new Set(), 0);
|
|
95
96
|
}
|
|
96
97
|
//#endregion
|
|
97
|
-
export { FAILED_ASSISTANT_REPLAY_TEXT, STREAM_ERROR_FALLBACK_TEXT, SYSTEM_PROMPT_CACHE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToModel, clampReasoning, describeToolResultMediaPlaceholder, describeUnsupportedToolResultMedia, ensureSystemPromptCacheBoundary, extractToolResultBlockText, extractToolResultText, formatToolResultText, hasMediaPayload, hasOnlyAssistantReasoningContent, inspectTlsCertificateError, isImageWithMediaPayload, isReasoningOnlyLengthAssistantTurn, isStreamErrorFallbackContent, normalizePromptCapabilityIds, normalizeStructuredPromptSection, prependSystemPromptAdditionAfterCacheBoundary, projectCopilotRequestFacts, readAssistantThinkingAppend, resolveFailedAssistantReplay, sanitizeSurrogates, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, splitSystemPromptRelocatableBoundary, stripSystemPromptCacheBoundary, stripSystemPromptRelocatableBoundary, transformMessages };
|
|
98
|
+
export { FAILED_ASSISTANT_REPLAY_TEXT, STREAM_ERROR_FALLBACK_TEXT, SYSTEM_PROMPT_CACHE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, adjustMaxTokensForThinking, buildBaseOptions, clampMaxTokensToModel, clampReasoning, createDiagnosticRecord, describeToolResultMediaPlaceholder, describeUnsupportedToolResultMedia, ensureSystemPromptCacheBoundary, extractToolResultBlockText, extractToolResultText, formatToolResultText, hasMediaPayload, hasOnlyAssistantReasoningContent, inspectTlsCertificateError, isImageWithMediaPayload, isReasoningOnlyLengthAssistantTurn, isStreamErrorFallbackContent, normalizePromptCapabilityIds, normalizeStructuredPromptSection, prependSystemPromptAdditionAfterCacheBoundary, projectCopilotRequestFacts, projectProviderError, readAssistantThinkingAppend, resolveFailedAssistantReplay, sanitizeSurrogates, sortPromptCacheToolsByName, splitSystemPromptCacheBoundary, splitSystemPromptRelocatableBoundary, stripSystemPromptCacheBoundary, stripSystemPromptRelocatableBoundary, transformMessages };
|
|
@@ -44,20 +44,20 @@ export declare function cleanSchemaForLlamacppGbnf(schema: unknown): unknown;
|
|
|
44
44
|
export declare function findLlamacppGbnfSchemaViolations(schema: unknown, path: string): string[];
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region packages/ai/src/providers/schema-keyword-strip.d.ts
|
|
47
|
-
/**
|
|
47
|
+
/** Remove schema keywords unsupported by a target provider/tool surface. */
|
|
48
48
|
export declare function stripUnsupportedSchemaKeywords(schema: unknown, unsupportedKeywords: ReadonlySet<string>): unknown;
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region packages/ai/src/providers/tool-schema-json-projection.d.ts
|
|
51
51
|
/** JSON-safe schema value used when projecting runtime tool parameters. */
|
|
52
|
-
|
|
52
|
+
type RuntimeToolInputSchemaJson = null | boolean | number | string | RuntimeToolInputSchemaJson[] | {
|
|
53
53
|
[key: string]: RuntimeToolInputSchemaJson;
|
|
54
54
|
};
|
|
55
55
|
/** Projected runtime tool schema plus validation violations. */
|
|
56
|
-
|
|
56
|
+
type RuntimeToolInputSchemaProjection = {
|
|
57
57
|
readonly schema: RuntimeToolInputSchemaJson;
|
|
58
58
|
readonly violations: readonly string[];
|
|
59
59
|
};
|
|
60
60
|
/** Projects one runtime tool input schema to JSON and reports runtime incompatibilities. */
|
|
61
61
|
export declare function projectRuntimeToolInputSchema(schema: unknown, path?: string): RuntimeToolInputSchemaProjection;
|
|
62
62
|
//#endregion
|
|
63
|
-
export { findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, resolveOpenAIProjectedToolsStrictToolFlag };
|
|
63
|
+
export { type RuntimeToolInputSchemaJson, type RuntimeToolInputSchemaProjection, findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, resolveOpenAIProjectedToolsStrictToolFlag };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { _ as
|
|
1
|
+
import { n as projectRuntimeToolInputSchema } from "../tool-schema-json-projection-CD9c_fK8.mjs";
|
|
2
|
+
import { _ as GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, a as resolveOpenAIProjectedToolsStrictToolFlag, c as extractToolSchemaModelCompat, d as shouldOmitEmptyArrayItems, g as findLlamacppGbnfSchemaViolations, h as cleanSchemaForLlamacppGbnf, i as normalizeStrictOpenAIJsonSchema, l as normalizeToolParameterSchema, m as LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, n as isStrictOpenAIJsonSchemaCompatible, o as findOpenAIStrictSchemaViolations, p as stripUnsupportedSchemaKeywords, r as normalizeOpenAIStrictToolParameters, s as normalizeOpenAIStrictCompatSchema, t as findOpenAIStrictToolProjectionDiagnostics, u as resolveUnsupportedToolSchemaKeywords, v as cleanSchemaForGemini } from "../openai-tool-schema-D4BMcj2D.mjs";
|
|
3
3
|
export { GEMINI_UNSUPPORTED_SCHEMA_KEYWORDS, LLAMACPP_GBNF_MAX_REPETITION_THRESHOLD, cleanSchemaForGemini, cleanSchemaForLlamacppGbnf, extractToolSchemaModelCompat, findLlamacppGbnfSchemaViolations, findOpenAIStrictSchemaViolations, findOpenAIStrictToolProjectionDiagnostics, isStrictOpenAIJsonSchemaCompatible, normalizeOpenAIStrictCompatSchema, normalizeOpenAIStrictToolParameters, normalizeStrictOpenAIJsonSchema, normalizeToolParameterSchema, projectRuntimeToolInputSchema, resolveOpenAIProjectedToolsStrictToolFlag, resolveUnsupportedToolSchemaKeywords, shouldOmitEmptyArrayItems, stripUnsupportedSchemaKeywords };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { r as appendAssistantThinking, t as AssistantMessageEventStream } from "./event-stream-D8PARQfL.mjs";
|
|
2
|
-
import { M as clampThinkingLevel, _ as isImageWithMediaPayload, d as describeToolResultMediaPlaceholder, h as formatToolResultText,
|
|
3
|
-
import { m as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, v as sortPromptCacheToolsByName } from "./simple-options-
|
|
2
|
+
import { M as calculateCost, N as clampThinkingLevel, _ as isImageWithMediaPayload, d as describeToolResultMediaPlaceholder, h as formatToolResultText, m as extractToolResultText, n as getAiTransportHost, v as sanitizeSurrogates } from "./host-yTvBrYM2.mjs";
|
|
3
|
+
import { m as stripSystemPromptCacheBoundary, n as buildBaseOptions, r as clampMaxTokensToModel, v as sortPromptCacheToolsByName } from "./simple-options-np1XPuhm.mjs";
|
|
4
4
|
import { n as getEnvApiKey } from "./env-api-keys-bktO00EJ.mjs";
|
|
5
|
-
import { E as parseStreamingJson,
|
|
5
|
+
import { E as parseStreamingJson, O as shortHash, c as finalizeTerminalToolCallArguments, n as assignTransportErrorDetails, p as notifyProviderHttpResponse, v as transportAbortError, w as createToolArgumentPreviewSchedule } from "./transport-stream-shared-B5RioB_Q.mjs";
|
|
6
6
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-BjtkplhG.mjs";
|
|
7
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
8
|
-
import { t as transformProviderMessages } from "./provider-transcript-transform-
|
|
7
|
+
import { t as createAssistantOutput } from "./assistant-output-DM1JBNs1.mjs";
|
|
8
|
+
import { t as transformProviderMessages } from "./provider-transcript-transform-BTocjCRs.mjs";
|
|
9
9
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-Drnn_6Qj.mjs";
|
|
10
10
|
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
|
11
11
|
import { randomUUID } from "node:crypto";
|
|
12
12
|
import { HTTPClient } from "@mistralai/mistralai/lib/http";
|
|
13
|
+
import { ReasoningEffort$inboundSchema } from "@mistralai/mistralai/models/components/reasoningeffort.js";
|
|
13
14
|
import { Chat } from "@mistralai/mistralai/sdk/chat";
|
|
14
15
|
//#region packages/ai/src/providers/mistral.ts
|
|
15
16
|
const MISTRAL_TOOL_CALL_ID_LENGTH = 9;
|
|
@@ -143,10 +144,11 @@ const streamSimpleMistral = (model, context, options) => {
|
|
|
143
144
|
const clampedReasoning = options?.reasoning ? clampThinkingLevel(model, options.reasoning) : void 0;
|
|
144
145
|
const reasoning = clampedReasoning === "off" ? void 0 : clampedReasoning;
|
|
145
146
|
const shouldUseReasoning = model.reasoning && reasoning !== void 0;
|
|
147
|
+
const supportsReasoningEffort = usesReasoningEffort(model);
|
|
146
148
|
return streamMistral(model, context, {
|
|
147
149
|
...base,
|
|
148
|
-
promptMode: shouldUseReasoning &&
|
|
149
|
-
reasoningEffort: shouldUseReasoning &&
|
|
150
|
+
promptMode: shouldUseReasoning && !supportsReasoningEffort ? "reasoning" : void 0,
|
|
151
|
+
reasoningEffort: shouldUseReasoning && supportsReasoningEffort ? ReasoningEffort$inboundSchema.parse(model.thinkingLevelMap?.[reasoning] ?? (reasoning === "minimal" ? "none" : "high")) : void 0
|
|
150
152
|
});
|
|
151
153
|
};
|
|
152
154
|
function createMistralToolCallIdNormalizer() {
|
|
@@ -628,12 +630,6 @@ function toChatMessages(messages, supportsImages) {
|
|
|
628
630
|
function usesReasoningEffort(model) {
|
|
629
631
|
return model.id === "mistral-small-2603" || model.id === "mistral-small-latest" || model.id === "mistral-medium-3-5";
|
|
630
632
|
}
|
|
631
|
-
function usesPromptModeReasoning(model) {
|
|
632
|
-
return model.reasoning && !usesReasoningEffort(model);
|
|
633
|
-
}
|
|
634
|
-
function mapReasoningEffort(model, level) {
|
|
635
|
-
return model.thinkingLevelMap?.[level] ?? "high";
|
|
636
|
-
}
|
|
637
633
|
function mapToolChoice(choice, convertedToolNames) {
|
|
638
634
|
if (!choice) return;
|
|
639
635
|
if (convertedToolNames && convertedToolNames.size === 0) {
|
|
@@ -12,7 +12,7 @@ type ModelSseDebugMode = "off" | "events" | "peek";
|
|
|
12
12
|
declare function resolveModelPayloadDebugMode(env?: ModelTransportDebugEnv): ModelPayloadDebugMode;
|
|
13
13
|
/** Resolves SSE stream debug verbosity from `OPENCLAW_DEBUG_SSE`. */
|
|
14
14
|
declare function resolveModelSseDebugMode(env?: ModelTransportDebugEnv): ModelSseDebugMode;
|
|
15
|
-
/** Emits
|
|
15
|
+
/** Emits transport diagnostics at debug, promoted to info by explicit debug flags. */
|
|
16
16
|
declare function emitModelTransportDebug(log: SubsystemLogger, message: string): void;
|
|
17
17
|
//#endregion
|
|
18
18
|
//#region packages/ai/src/transports/model-transport-url.d.ts
|