@openclaw/ai 2026.10.1 → 2026.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{anthropic-BDfXKgF1.mjs → anthropic-C4qygbtf.mjs} +11 -10
- package/dist/{anthropic-payload-policy-BZUAchqb.d.mts → anthropic-payload-policy-DD7vzpxE.d.mts} +5 -2
- package/dist/{anthropic-stream-reducer-DHt9uFWX.mjs → anthropic-stream-reducer-CWyWE21W.mjs} +46 -52
- package/dist/{api-registry-DcEP_o4h.d.mts → api-registry-B3rC2qu3.d.mts} +1 -1
- package/dist/{assistant-output-mJ9cL4Qg.mjs → assistant-output-D5762GPH.mjs} +2 -2
- package/dist/{assistant-text-phase-DAv1BdTm.mjs → assistant-text-phase-DVZOxbuR.mjs} +1 -1
- package/dist/{azure-openai-responses-gn9hMf8x.mjs → azure-openai-responses-DO-Fv8ha.mjs} +5 -5
- package/dist/diagnostics.d.mts +3 -3
- package/dist/{google-CyMz2jF_.mjs → google-B2g_Xn4d.mjs} +6 -6
- package/dist/{google-interactions-DXu4IYGb.mjs → google-interactions-DNXzPPwQ.mjs} +6 -6
- package/dist/{google-messages-Bmheetdg.mjs → google-messages-l7wgIF5I.mjs} +3 -3
- package/dist/{google-shared-DE_ddfsC.mjs → google-shared-V8jogVPq.mjs} +5 -5
- package/dist/{google-vertex-BEW0OQIA.mjs → google-vertex-_khoip47.mjs} +5 -5
- package/dist/{host-BjIYEjwT.d.mts → host-DiPhRjrc.d.mts} +2 -2
- package/dist/{host-policy-CC5H0iRZ.mjs → host-policy-BwhNNGQR.mjs} +1 -1
- package/dist/{host-JpNulOOs.mjs → host-u3o8XiAp.mjs} +1 -1
- package/dist/{index-DJrNQnKw.d.mts → index-D27wAoOr.d.mts} +4 -2
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/internal/anthropic.d.mts +4 -4
- package/dist/internal/anthropic.mjs +4 -4
- package/dist/internal/openai-completions-compat.d.mts +1 -1
- package/dist/internal/openai-completions-compat.mjs +1 -1
- package/dist/internal/openai-responses-payload-policy.d.mts +9 -2
- package/dist/internal/openai-responses-payload-policy.mjs +3 -2
- package/dist/internal/openai.d.mts +8 -8
- package/dist/internal/openai.mjs +7 -7
- package/dist/internal/runtime.d.mts +5 -5
- package/dist/internal/runtime.mjs +3 -3
- package/dist/internal/shared.d.mts +1 -1
- package/dist/internal/shared.mjs +3 -3
- package/dist/internal/tool-schema.mjs +1 -1
- package/dist/{mistral-1Bnbneg1.mjs → mistral-cnoBDSIg.mjs} +4 -4
- package/dist/{openai-chatgpt-responses-CB1JwNFF.mjs → openai-chatgpt-responses-CHdn8YJ_.mjs} +60 -54
- package/dist/{openai-completions-BPadHHKe.mjs → openai-completions-BZfHIaZ7.mjs} +3 -3
- package/dist/{openai-completions-compat-CJ0ktmGy.d.mts → openai-completions-compat-BgPg1BRs.d.mts} +2 -2
- package/dist/{openai-completions-compat-D7hWYB0G.mjs → openai-completions-compat-GMN8A0fm.mjs} +1 -1
- package/dist/{openai-completions-transport-DITBEALX.mjs → openai-completions-transport-CuoQfnKV.mjs} +13 -13
- package/dist/{openai-prompt-cache-Dj8qeOHT.mjs → openai-prompt-cache-BK6E2g4Q.mjs} +1 -1
- package/dist/{openai-prompt-cache-C-Q1Ksfs.d.mts → openai-prompt-cache-CFviG_D4.d.mts} +1 -1
- package/dist/{openai-responses-1_TvcWI3.mjs → openai-responses-BhAZFsL9.mjs} +7 -7
- package/dist/{openai-responses-compaction-replay-BB2SWdsx.d.mts → openai-responses-compaction-replay-BBNo098-.d.mts} +3 -3
- package/dist/{openai-responses-compaction-window-m878aVpU.mjs → openai-responses-compaction-window-tA4QkU0o.mjs} +3 -3
- package/dist/{openai-responses-contracts-sAvdqNjS.d.mts → openai-responses-contracts-D5yVZBp-.d.mts} +3 -3
- package/dist/openai-responses-endpoint-TV0y50fb.mjs +11 -0
- package/dist/{openai-responses-payload-policy-C7GsA1y0.d.mts → openai-responses-payload-policy-s1apQlZZ.d.mts} +4 -2
- package/dist/{openai-responses-prompt-observer-internal-CbH84xIS.mjs → openai-responses-prompt-observer-internal-CefUzh8M.mjs} +2 -2
- package/dist/{openai-responses-shared-TCJRAoMW.mjs → openai-responses-shared-CKNmC3vC.mjs} +11 -11
- package/dist/{openai-responses-terminal-usage-BVvyXZ8u.d.mts → openai-responses-terminal-usage-CempLedn.d.mts} +1 -1
- package/dist/{openai-tool-schema-DYNePiF8.mjs → openai-tool-schema-BIrI0mrA.mjs} +18 -1
- package/dist/{openai-transport-params-ildrm49s.mjs → openai-transport-params-D7JMUPjf.mjs} +7 -7
- package/dist/{provider-options-Dk4PeQV3.d.mts → provider-options-CkieKvNJ.d.mts} +9 -4
- package/dist/{provider-replay-context-ywPKKLjL.mjs → provider-replay-context-CO_Eplnc.mjs} +1 -1
- package/dist/{provider-transport-turn-state-8c_Nj2NS.mjs → provider-transport-turn-state-BX6TfCyW.mjs} +2 -2
- package/dist/{provider-types-De8PRdR0.d.mts → provider-types-v3bmqsfg.d.mts} +2 -2
- package/dist/provider-types.d.mts +3 -3
- package/dist/providers.d.mts +2 -2
- package/dist/providers.mjs +10 -10
- package/dist/{simple-options-wW3117Fu.mjs → simple-options-7QuSKriJ.mjs} +2 -2
- package/dist/{src-DWJq14pn.mjs → src-VWy9E7DZ.mjs} +5 -1
- package/dist/{stream-CElngO8h.mjs → stream-DFaRxi2D.mjs} +1 -1
- package/dist/{text-signature-rOn31nxc.mjs → text-signature-D_vRrx-z.mjs} +2 -2
- package/dist/{transport-stream-shared-C5TAc3U_.mjs → transport-stream-shared-CCR7hSW0.mjs} +1 -1
- package/dist/{transport-stream-shared-CAxkgOSj.d.mts → transport-stream-shared-DW-7-qLR.d.mts} +1 -1
- package/dist/transports.d.mts +13 -13
- package/dist/transports.mjs +170 -172
- package/dist/types-UlNana-2.d.mts +1 -0
- package/dist/types.d.mts +3 -3
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
- package/dist/types-Dlz-8qcy.d.mts +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
1
|
+
import { i as resolveOpenAICompletionsCompat } from "../openai-completions-compat-GMN8A0fm.mjs";
|
|
2
2
|
export { resolveOpenAICompletionsCompat };
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
-
import { l as OpenAIResponsesCompactionOutput, t as OPENAI_RESPONSES_APIS, u as readOpenAIResponsesCompactionWindow } from "../openai-responses-contracts-
|
|
2
|
-
import { i as resolveOpenAIResponsesServerCompactionPlan, r as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-payload-policy-
|
|
1
|
+
import { l as OpenAIResponsesCompactionOutput, t as OPENAI_RESPONSES_APIS, u as readOpenAIResponsesCompactionWindow } from "../openai-responses-contracts-D5yVZBp-.mjs";
|
|
2
|
+
import { i as resolveOpenAIResponsesServerCompactionPlan, r as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-payload-policy-s1apQlZZ.mjs";
|
|
3
|
+
//#region packages/ai/src/transports/openai-responses-endpoint.d.ts
|
|
4
|
+
export declare function supportsNativeOpenAIResponsesEndpoint(params: {
|
|
5
|
+
provider: string;
|
|
6
|
+
api: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
}): boolean;
|
|
9
|
+
//#endregion
|
|
3
10
|
export { OPENAI_RESPONSES_APIS, type OpenAIResponsesCompactionOutput, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesServerCompactionPlan };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { i as OPENAI_RESPONSES_APIS } from "../openai-responses-contracts-BKu8O7l4.mjs";
|
|
2
|
-
import { c as resolveOpenAIResponsesServerCompactionPlan, r as readOpenAIResponsesCompactionWindow, s as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-compaction-window-
|
|
3
|
-
|
|
2
|
+
import { c as resolveOpenAIResponsesServerCompactionPlan, r as readOpenAIResponsesCompactionWindow, s as resolveOpenAIResponsesPayloadPolicy } from "../openai-responses-compaction-window-tA4QkU0o.mjs";
|
|
3
|
+
import { n as supportsNativeOpenAIResponsesEndpoint } from "../openai-responses-endpoint-TV0y50fb.mjs";
|
|
4
|
+
export { OPENAI_RESPONSES_APIS, readOpenAIResponsesCompactionWindow, resolveOpenAIResponsesPayloadPolicy, resolveOpenAIResponsesServerCompactionPlan, supportsNativeOpenAIResponsesEndpoint };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-D27wAoOr.mjs";
|
|
2
2
|
import { $ as StopReason, Q as SimpleStreamOptions, d as Context, k as Model, tt as StreamFunction } from "../types-DvzmWW8J.mjs";
|
|
3
|
-
import { C as
|
|
3
|
+
import { C as supportsOpenAIReasoningEffort, S as resolveOpenAISupportedReasoningEfforts, _ as isOpenAIGpt6Model, a as BaseOpenAIStreamOptions, b as resolveOpenAIReasoningEffortForModel, c as OpenAICompletionsOptions, d as reasoningTagTextPolicy, f as OpenAIApiReasoningEffort, g as isOpenAIGpt56Model, h as isOpenAIGpt55Model, m as isOpenAIGpt54MiniModel, o as CodeModeToolSurfaceObservation, p as OpenAIReasoningEffort, u as codeModeToolSurfaceObserver, v as normalizeOpenAIReasoningEffort, w as supportsOpenAITemperature, x as resolveOpenAIReasoningEffortMapping, y as resolveOpenAIModelReasoningEfforts } from "../provider-options-CkieKvNJ.mjs";
|
|
4
4
|
import { a as reconcileOpenAIResponsesToolChoice, i as reconcileOpenAICompletionsToolChoice, n as OpenAIToolProjection, r as projectOpenAITools, t as OpenAICompletionsToolChoice } from "../openai-tool-projection-793cE3QX.mjs";
|
|
5
|
-
import "../types-
|
|
6
|
-
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-
|
|
7
|
-
import { a as ResponsesPromptObservation, c as responsesServiceTierObserver, d as OpenAIRequestReasoningEffort, o as ResponsesServiceTierObservation, s as responsesPromptObserver } from "../openai-responses-contracts-
|
|
8
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
9
|
-
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-
|
|
10
|
-
import "../openai-responses-compaction-replay-
|
|
5
|
+
import "../types-UlNana-2.mjs";
|
|
6
|
+
import { t as ResolvedOpenAICompletionsCompat } from "../openai-completions-compat-BgPg1BRs.mjs";
|
|
7
|
+
import { a as ResponsesPromptObservation, c as responsesServiceTierObserver, d as OpenAIRequestReasoningEffort, o as ResponsesServiceTierObservation, s as responsesPromptObserver } from "../openai-responses-contracts-D5yVZBp-.mjs";
|
|
8
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-CFviG_D4.mjs";
|
|
9
|
+
import { a as resolveResponsesTerminalStopReason, i as readResponsesReasoningTokens, n as isResponsesOutputLimitToolCallError, r as mapResponsesTerminalUsage, t as ResponsesTerminalUsagePayload } from "../openai-responses-terminal-usage-CempLedn.mjs";
|
|
10
|
+
import "../openai-responses-compaction-replay-BBNo098-.mjs";
|
|
11
11
|
import { ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
|
|
12
12
|
import { ChatCompletionMessageParam } from "openai/resources/chat/completions.js";
|
|
13
13
|
//#region packages/ai/src/providers/azure-deployment-map.d.ts
|
package/dist/internal/openai.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { C as resolveOpenAIReasoningEffortForModel, D as supportsOpenAITemperature, E as supportsOpenAIReasoningEffort, S as resolveOpenAIModelReasoningEfforts, T as resolveOpenAISupportedReasoningEfforts, _ as isOpenAIGpt54MiniModel, b as isOpenAIGpt6Model, g as responsesServiceTierObserver, h as responsesPromptObserver, v as isOpenAIGpt55Model, w as resolveOpenAIReasoningEffortMapping, x as normalizeOpenAIReasoningEffort, y as isOpenAIGpt56Model } from "../openai-responses-contracts-BKu8O7l4.mjs";
|
|
2
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-
|
|
2
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams, t as OPENAI_PROMPT_CACHE_KEY_MAX_LENGTH } from "../openai-prompt-cache-BK6E2g4Q.mjs";
|
|
3
3
|
import { g as resolveResponsesTerminalStopReason, h as readResponsesReasoningTokens, m as mapResponsesTerminalUsage, p as isResponsesOutputLimitToolCallError } from "../diagnostics-Caj-4RBA.mjs";
|
|
4
|
-
import { a as encodedModelRequestBodyStream, c as serializeModelRequestBody, l as codeModeToolSurfaceObserver, o as modelRequestBodyState, u as reasoningTagTextPolicy } from "../simple-options-
|
|
5
|
-
import { f as projectOpenAITools, m as reconcileOpenAIResponsesToolChoice, p as reconcileOpenAICompletionsToolChoice } from "../openai-transport-params-
|
|
6
|
-
import { i as convertMessages } from "../openai-completions-transport-
|
|
4
|
+
import { a as encodedModelRequestBodyStream, c as serializeModelRequestBody, l as codeModeToolSurfaceObserver, o as modelRequestBodyState, u as reasoningTagTextPolicy } from "../simple-options-7QuSKriJ.mjs";
|
|
5
|
+
import { f as projectOpenAITools, m as reconcileOpenAIResponsesToolChoice, p as reconcileOpenAICompletionsToolChoice } from "../openai-transport-params-D7JMUPjf.mjs";
|
|
6
|
+
import { i as convertMessages } from "../openai-completions-transport-CuoQfnKV.mjs";
|
|
7
7
|
import { t as mapOpenAIStopReason } from "../openai-stop-reason-8s70vDXj.mjs";
|
|
8
|
-
import { M as bindResponsesInputMessage, _ 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, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-
|
|
8
|
+
import { M as bindResponsesInputMessage, _ 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, y as resolveResponsesMessageSnapshotCollapse } from "../openai-responses-shared-CKNmC3vC.mjs";
|
|
9
9
|
import { i as resolveAzureDeploymentNameFromMap, n as isTraditionalAzureOpenAIHost, r as parseAzureDeploymentNameMap, t as isOpenAICompatibleAzureResponsesBaseUrl } from "../azure-openai-responses-client-compat-D0dvJMbZ.mjs";
|
|
10
10
|
import { t as hasResponsesWebSearchTool } from "../openai-web-search-tools-Cfu0uLyN.mjs";
|
|
11
11
|
import { t as responsesRequestLifecycle } from "../openai-responses-request-lifecycle-Fsag-IGZ.mjs";
|
|
12
|
-
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-
|
|
13
|
-
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-
|
|
12
|
+
import { n as streamOpenAICompletions, r as streamSimpleOpenAICompletions } from "../openai-completions-BZfHIaZ7.mjs";
|
|
13
|
+
import { n as streamOpenAIResponses, r as streamSimpleOpenAIResponses } from "../openai-responses-BhAZFsL9.mjs";
|
|
14
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, bindResponsesInputMessage, clampOpenAIPromptCacheKey, codeModeToolSurfaceObserver, convertMessages, createResponsesToolCallTracker, encodedModelRequestBodyStream, hasResponsesWebSearchTool, 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, serializeModelRequestBody, streamOpenAICompletions, streamOpenAIResponses, streamSimpleOpenAICompletions, streamSimpleOpenAIResponses, supportsOpenAIReasoningEffort, supportsOpenAITemperature };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../index-
|
|
1
|
+
import "../index-D27wAoOr.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-DvzmWW8J.mjs";
|
|
3
3
|
import { i as getEventStreamCompletion } from "../event-stream-DrRM_90c.mjs";
|
|
4
|
-
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-
|
|
5
|
-
import { m as getDefaultAiTransportHost } from "../host-
|
|
6
|
-
import "../types-
|
|
4
|
+
import { a as RegisteredApiProvider, t as ApiProvider } from "../api-registry-B3rC2qu3.mjs";
|
|
5
|
+
import { m as getDefaultAiTransportHost } from "../host-DiPhRjrc.mjs";
|
|
6
|
+
import "../types-UlNana-2.mjs";
|
|
7
7
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-BR0MUYYD.mjs";
|
|
8
8
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-CjDG6jJx.mjs";
|
|
9
|
-
import { v as parseTerminalToolCallArguments } from "../transport-stream-shared-
|
|
9
|
+
import { v as parseTerminalToolCallArguments } from "../transport-stream-shared-DW-7-qLR.mjs";
|
|
10
10
|
//#region packages/ai/src/internal/default-runtime.d.ts
|
|
11
11
|
export declare const defaultApiRegistry: {
|
|
12
12
|
registerApiProvider: <TApi extends Api, TOptions extends StreamOptions>(provider: ApiProvider<TApi, TOptions>, sourceId?: string) => void;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { a as isProviderRefusalAssistantError } from "../diagnostics-DzrF1h4J.mjs";
|
|
2
2
|
import { o as getEventStreamCompletion } from "../event-stream-C5AbCAaZ.mjs";
|
|
3
|
-
import { r as createApiRegistry, t as createLlmRuntime } from "../stream-
|
|
4
|
-
import { A as getSupportedThinkingLevels, D as applyProviderReportedUsageCost, E as headersToRecord, O as calculateCost, j as modelsAreEqual, k as clampThinkingLevel } from "../host-
|
|
3
|
+
import { r as createApiRegistry, t as createLlmRuntime } from "../stream-DFaRxi2D.mjs";
|
|
4
|
+
import { A as getSupportedThinkingLevels, D as applyProviderReportedUsageCost, E as headersToRecord, O as calculateCost, j as modelsAreEqual, k as clampThinkingLevel } from "../host-u3o8XiAp.mjs";
|
|
5
5
|
import { i as registerSessionResourceCleanupObserver, n as getSessionResourceOwnerId, r as registerSessionResourceCleanup, t as cleanupSessionResources } from "../session-resources-D1wgDQ8C.mjs";
|
|
6
|
-
import { A as shortHash, D as parseJsonWithRepair, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, g as parseTerminalToolCallArguments, k as repairJson } from "../transport-stream-shared-
|
|
6
|
+
import { A as shortHash, D as parseJsonWithRepair, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, g as parseTerminalToolCallArguments, k as repairJson } from "../transport-stream-shared-CCR7hSW0.mjs";
|
|
7
7
|
import { n as getEnvApiKey, t as findEnvKeys } from "../env-api-keys-CyX4VKGO.mjs";
|
|
8
8
|
import { t as createDeferredEventBuffer } from "../deferred-event-buffer-DAvyP7qA.mjs";
|
|
9
9
|
import { n as onLlmRequestActivity, t as notifyLlmRequestActivity } from "../llm-request-activity-D8f_oxHj.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
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-DvzmWW8J.mjs";
|
|
2
2
|
import { a as readAssistantThinkingAppend } from "../event-stream-DrRM_90c.mjs";
|
|
3
|
-
import "../types-
|
|
3
|
+
import "../types-UlNana-2.mjs";
|
|
4
4
|
import { t as sanitizeSurrogates } from "../sanitize-unicode-CjDG6jJx.mjs";
|
|
5
5
|
import { i as projectProviderError } from "../provider-error-xumb1V3F.mjs";
|
|
6
6
|
import { n as createDiagnosticRecord } from "../credential-redaction-BKv49aiv.mjs";
|
package/dist/internal/shared.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { s as readAssistantThinkingAppend } from "../event-stream-C5AbCAaZ.mjs";
|
|
2
|
-
import { M as hasMediaPayload, N 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-
|
|
2
|
+
import { M as hasMediaPayload, N 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-u3o8XiAp.mjs";
|
|
3
3
|
import { n as projectProviderError, r as createDiagnosticRecord } from "../provider-error-DQBE1bUQ.mjs";
|
|
4
|
-
import { P as sanitizeSurrogates } from "../transport-stream-shared-
|
|
5
|
-
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, E as normalizeStructuredPromptSection, S as splitSystemPromptRelocatableBoundary, T as normalizePromptCapabilityIds, _ as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, b as prependSystemPromptAdditionAfterCacheBoundary, d as describeToolResultMediaPlaceholder, f as describeUnsupportedToolResultMedia, g as SYSTEM_PROMPT_CACHE_BOUNDARY, h as formatToolResultText, i as clampReasoning, m as extractToolResultText, n as buildBaseOptions, p as extractToolResultBlockText, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, v as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary, y as ensureSystemPromptCacheBoundary } from "../simple-options-
|
|
4
|
+
import { P as sanitizeSurrogates } from "../transport-stream-shared-CCR7hSW0.mjs";
|
|
5
|
+
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, E as normalizeStructuredPromptSection, S as splitSystemPromptRelocatableBoundary, T as normalizePromptCapabilityIds, _ as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY, b as prependSystemPromptAdditionAfterCacheBoundary, d as describeToolResultMediaPlaceholder, f as describeUnsupportedToolResultMedia, g as SYSTEM_PROMPT_CACHE_BOUNDARY, h as formatToolResultText, i as clampReasoning, m as extractToolResultText, n as buildBaseOptions, p as extractToolResultBlockText, r as clampMaxTokensToModel, t as adjustMaxTokensForThinking, v as SYSTEM_PROMPT_RELOCATABLE_BOUNDARY_END, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary, y as ensureSystemPromptCacheBoundary } from "../simple-options-7QuSKriJ.mjs";
|
|
6
6
|
import { t as projectCopilotRequestFacts } from "../github-copilot-request-facts-DEE6gcB9.mjs";
|
|
7
7
|
//#region packages/ai/src/utils/tls-certificate-errors.ts
|
|
8
8
|
const HOSTNAME_MISMATCH_CODES = /* @__PURE__ */ new Set(["ERR_TLS_CERT_ALTNAME_INVALID", "HOSTNAME_MISMATCH"]);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as projectRuntimeToolInputSchema } from "../tool-schema-json-projection-Ct8SeBeJ.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-
|
|
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-BIrI0mrA.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,8 +1,8 @@
|
|
|
1
1
|
import { r as appendAssistantThinking, t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
|
|
2
|
-
import { N as isImageWithMediaPayload, O as calculateCost, k as clampThinkingLevel, r as getAiTransportHost } from "./host-
|
|
3
|
-
import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-
|
|
4
|
-
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, h as formatToolResultText, m as extractToolResultText, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-
|
|
5
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
2
|
+
import { N as isImageWithMediaPayload, O as calculateCost, k as clampThinkingLevel, r as getAiTransportHost } from "./host-u3o8XiAp.mjs";
|
|
3
|
+
import { A as shortHash, E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, l as finalizeTerminalToolCallArguments, m as notifyProviderHttpResponse, n as assignTransportErrorDetails, u as finalizeTransportStream } from "./transport-stream-shared-CCR7hSW0.mjs";
|
|
4
|
+
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, d as describeToolResultMediaPlaceholder, h as formatToolResultText, m as extractToolResultText, n as buildBaseOptions, r as clampMaxTokensToModel } from "./simple-options-7QuSKriJ.mjs";
|
|
5
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-D5762GPH.mjs";
|
|
6
6
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-D8f_oxHj.mjs";
|
|
7
7
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|
|
8
8
|
import { t as createSseByteGuard } from "./streaming-byte-guard-CC-HMn_u.mjs";
|
package/dist/{openai-chatgpt-responses-CB1JwNFF.mjs → openai-chatgpt-responses-CHdn8YJ_.mjs}
RENAMED
|
@@ -2,23 +2,22 @@ import { i as formatThrownValue, n as createAssistantMessageDiagnostic, t as app
|
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
|
|
3
3
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
4
4
|
import { r as clampPositiveTimerTimeoutMs } from "./number-coercion-V8-BhME4.mjs";
|
|
5
|
-
import { E as headersToRecord, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-
|
|
5
|
+
import { E as headersToRecord, a as resolveAiTransportHeaderSentinels, r as getAiTransportHost } from "./host-u3o8XiAp.mjs";
|
|
6
6
|
import { D as supportsOpenAITemperature, h as responsesPromptObserver } from "./openai-responses-contracts-BKu8O7l4.mjs";
|
|
7
7
|
import { r as registerSessionResourceCleanup } from "./session-resources-D1wgDQ8C.mjs";
|
|
8
|
-
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-
|
|
8
|
+
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-BK6E2g4Q.mjs";
|
|
9
9
|
import { _ as extractErrorCodeOrErrno, o as WEBSOCKET_NON_RETRYABLE_CLOSE_ERROR_CODE, v as toErrorObject } from "./diagnostics-Caj-4RBA.mjs";
|
|
10
|
-
import { n as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./text-signature-
|
|
10
|
+
import { n as MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE } from "./text-signature-D_vRrx-z.mjs";
|
|
11
11
|
import { parseRetryAfterHeadersSeconds } from "./internal/retry-after.mjs";
|
|
12
|
-
import { c as resolveOpenAIResponsesTextFormat } from "./openai-completions-compat-
|
|
13
|
-
import { n as buildManagedModelFetch } from "./host-policy-
|
|
14
|
-
import { S as withProviderResponseHook, b as transportAbortError, h as notifyProviderStreamOpened, n as assignTransportErrorDetails } from "./transport-stream-shared-
|
|
15
|
-
import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-
|
|
16
|
-
import { b as createOpenAIResponseHook, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, x as createResponseModelTracker, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-
|
|
17
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
12
|
+
import { c as resolveOpenAIResponsesTextFormat } from "./openai-completions-compat-GMN8A0fm.mjs";
|
|
13
|
+
import { n as buildManagedModelFetch } from "./host-policy-BwhNNGQR.mjs";
|
|
14
|
+
import { S as withProviderResponseHook, b as transportAbortError, h as notifyProviderStreamOpened, n as assignTransportErrorDetails } from "./transport-stream-shared-CCR7hSW0.mjs";
|
|
15
|
+
import { C as stripSystemPromptCacheBoundary, n as buildBaseOptions } from "./simple-options-7QuSKriJ.mjs";
|
|
16
|
+
import { b as createOpenAIResponseHook, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, x as createResponseModelTracker, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-D7JMUPjf.mjs";
|
|
17
|
+
import { t as createAssistantOutput } from "./assistant-output-D5762GPH.mjs";
|
|
18
18
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-D9ZmL_s9.mjs";
|
|
19
|
-
import { A as recordResponsesContextUsage, J as buildOpenAIResponsesReasoningReplayMetadata, P as convertProviderResponsesMessages, S as isInvalidEncryptedContentError, T as ResponsesStreamFailure, Z as suppressOpenAIResponsesCompaction, b as commitResponsesEncryptedContentAttempt, i as convertResponsesToolPayload, n as applyResponsesServiceTierPricing, o as readOpenAIMisalignmentReview, s as processResponsesStream, w as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-
|
|
20
|
-
import { t as
|
|
21
|
-
import { t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-CbH84xIS.mjs";
|
|
19
|
+
import { A as recordResponsesContextUsage, J as buildOpenAIResponsesReasoningReplayMetadata, P as convertProviderResponsesMessages, S as isInvalidEncryptedContentError, T as ResponsesStreamFailure, Z as suppressOpenAIResponsesCompaction, b as commitResponsesEncryptedContentAttempt, i as convertResponsesToolPayload, n as applyResponsesServiceTierPricing, o as readOpenAIMisalignmentReview, s as processResponsesStream, w as resolveNextResponsesEncryptedContentAttempt } from "./openai-responses-shared-CKNmC3vC.mjs";
|
|
20
|
+
import { t as createResponsesPromptEgressObserver } from "./openai-responses-prompt-observer-internal-CefUzh8M.mjs";
|
|
22
21
|
import { n as withResponsesRequestAcceptance, t as responsesRequestLifecycle } from "./openai-responses-request-lifecycle-Fsag-IGZ.mjs";
|
|
23
22
|
import { t as requireApiKey } from "./required-api-key-D4kn3252.mjs";
|
|
24
23
|
import { n as resolveOpenAICodexAccountId } from "./openai-chatgpt-jwt-KWcgd0d_.mjs";
|
|
@@ -84,7 +83,7 @@ function normalizeCodexStatus(status) {
|
|
|
84
83
|
}
|
|
85
84
|
//#endregion
|
|
86
85
|
//#region packages/ai/src/providers/openai-chatgpt-responses-protocol.ts
|
|
87
|
-
const
|
|
86
|
+
const OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES = 16777216;
|
|
88
87
|
var CodexProtocolError = class extends Error {
|
|
89
88
|
constructor(message, options) {
|
|
90
89
|
super(message);
|
|
@@ -96,44 +95,53 @@ var CodexProtocolError = class extends Error {
|
|
|
96
95
|
async function* parseOpenAIChatGptResponsesSse(response) {
|
|
97
96
|
if (!response.body) return;
|
|
98
97
|
const reader = response.body.getReader();
|
|
99
|
-
const guard = createSseByteGuard(reader, {
|
|
100
|
-
maxBytes: OPENAI_CHATGPT_RESPONSES_SUCCESS_BODY_MAX_BYTES,
|
|
101
|
-
onOverflow: ({ size, maxBytes }) => /* @__PURE__ */ new Error(`OpenAI ChatGPT Responses success body exceeded ${maxBytes} bytes (received ${size})`)
|
|
102
|
-
});
|
|
103
98
|
const decoder = new TextDecoder();
|
|
104
|
-
let buffer =
|
|
99
|
+
let buffer = /* @__PURE__ */ new Uint8Array(1024);
|
|
100
|
+
let size = 0;
|
|
101
|
+
let lineEmpty = true;
|
|
102
|
+
let skipLf = false;
|
|
103
|
+
let cancelReason;
|
|
105
104
|
try {
|
|
106
105
|
while (true) {
|
|
107
|
-
const { done, value } = await
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
event = JSON.parse(data);
|
|
123
|
-
} catch (cause) {
|
|
124
|
-
if (!(cause instanceof SyntaxError)) throw cause;
|
|
125
|
-
throw new CodexProtocolError(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause });
|
|
126
|
-
}
|
|
127
|
-
yield event;
|
|
106
|
+
const { done, value } = await reader.read();
|
|
107
|
+
for (let index = 0; index < (value?.length ?? 0) + (done ? 1 : 0); index++) {
|
|
108
|
+
const byte = value?.[index];
|
|
109
|
+
if (byte !== void 0) {
|
|
110
|
+
const crlf = skipLf && byte === 10;
|
|
111
|
+
skipLf = byte === 13;
|
|
112
|
+
const lineEnding = byte === 10 || byte === 13;
|
|
113
|
+
const boundary = !crlf && lineEnding && lineEmpty;
|
|
114
|
+
lineEmpty = lineEnding;
|
|
115
|
+
if (crlf && size === 0) continue;
|
|
116
|
+
if (size >= OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES) throw new Error(`OpenAI ChatGPT Responses SSE frame exceeded ${OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES} bytes`);
|
|
117
|
+
if (size === buffer.length) {
|
|
118
|
+
const grown = new Uint8Array(Math.min(buffer.length * 2, OPENAI_CHATGPT_RESPONSES_SSE_FRAME_MAX_BYTES));
|
|
119
|
+
grown.set(buffer);
|
|
120
|
+
buffer = grown;
|
|
128
121
|
}
|
|
122
|
+
buffer[size++] = byte;
|
|
123
|
+
if (!boundary) continue;
|
|
129
124
|
}
|
|
125
|
+
const chunk = decoder.decode(buffer.subarray(0, size), { stream: !done });
|
|
126
|
+
size = 0;
|
|
127
|
+
const data = chunk.split(/\r\n|\r|\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).join("\n").trim();
|
|
128
|
+
if (!data || data === "[DONE]") continue;
|
|
129
|
+
let event;
|
|
130
|
+
try {
|
|
131
|
+
event = JSON.parse(data);
|
|
132
|
+
} catch (cause) {
|
|
133
|
+
if (!(cause instanceof SyntaxError)) throw cause;
|
|
134
|
+
throw new CodexProtocolError(MALFORMED_STREAMING_FRAGMENT_ERROR_MESSAGE, { cause });
|
|
135
|
+
}
|
|
136
|
+
yield event;
|
|
130
137
|
}
|
|
131
138
|
if (done) break;
|
|
132
139
|
}
|
|
140
|
+
} catch (error) {
|
|
141
|
+
cancelReason = error;
|
|
142
|
+
throw error;
|
|
133
143
|
} finally {
|
|
134
|
-
|
|
135
|
-
await guard.cancel();
|
|
136
|
-
} catch {}
|
|
144
|
+
reader.cancel(cancelReason).catch(() => void 0);
|
|
137
145
|
try {
|
|
138
146
|
reader.releaseLock();
|
|
139
147
|
} catch {}
|
|
@@ -300,12 +308,6 @@ const WEBSOCKET_MESSAGE_TOO_BIG_CLOSE_CODE = 1009;
|
|
|
300
308
|
const WEBSOCKET_CONNECTION_LIMIT_REACHED_CODE = "websocket_connection_limit_reached";
|
|
301
309
|
const WEBSOCKET_REPLAY_REJECTION = "Codex error: Persisted response contains hosted-tool, compaction, or unverifiable hidden reasoning state that Rustponses cannot replay. Start a new response or use the Python Responses service for this continuation.";
|
|
302
310
|
const OPENAI_CHATGPT_RESPONSES_ERROR_BODY_MAX_BYTES = 16384;
|
|
303
|
-
function buildRequestSignal(baseSignal, timeoutMs) {
|
|
304
|
-
if (timeoutMs === void 0) return baseSignal;
|
|
305
|
-
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
306
|
-
if (!baseSignal) return timeoutSignal;
|
|
307
|
-
return AbortSignal.any([baseSignal, timeoutSignal]);
|
|
308
|
-
}
|
|
309
311
|
function isRequestTimeoutError(error, callerSignal, requestSignal, timeoutMs) {
|
|
310
312
|
if (timeoutMs === void 0 || callerSignal?.aborted || !requestSignal?.aborted) return false;
|
|
311
313
|
if (!(error instanceof Error)) return false;
|
|
@@ -362,7 +364,11 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
362
364
|
const observePromptEgress = createResponsesPromptEgressObserver(options, context.systemPrompt);
|
|
363
365
|
const sessionId = clampOpenAIPromptCacheKey(options?.sessionId);
|
|
364
366
|
requestTimeoutMs = clampPositiveTimerTimeoutMs(options?.timeoutMs);
|
|
365
|
-
requestTimeoutSignal =
|
|
367
|
+
requestTimeoutSignal = options?.signal;
|
|
368
|
+
if (requestTimeoutMs !== void 0) {
|
|
369
|
+
const timeoutSignal = AbortSignal.timeout(requestTimeoutMs);
|
|
370
|
+
requestTimeoutSignal = options?.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
|
|
371
|
+
}
|
|
366
372
|
firstEventAbort = createFirstStreamEventAbortController(requestTimeoutSignal);
|
|
367
373
|
activeSignal = firstEventAbort.signal;
|
|
368
374
|
const requestOptions = activeSignal === options?.signal ? options : {
|
|
@@ -421,14 +427,14 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
421
427
|
retriedWebSocketRejection = false;
|
|
422
428
|
continue;
|
|
423
429
|
}
|
|
424
|
-
const
|
|
425
|
-
const reconnectBeforeStart = connectionLimitBeforeStart || !websocketStarted && dispatch.request?.previous_response_id && error instanceof CodexApiError && error.message === WEBSOCKET_REPLAY_REJECTION;
|
|
430
|
+
const reconnectBeforeStart = !websocketStarted && isWebSocketConnectionLimitReachedError(error) || !websocketStarted && dispatch.request?.previous_response_id && error instanceof CodexApiError && error.message === WEBSOCKET_REPLAY_REJECTION;
|
|
426
431
|
if (!aborted && reconnectBeforeStart && !retriedWebSocketRejection) {
|
|
427
432
|
retriedWebSocketRejection = true;
|
|
428
433
|
continue;
|
|
429
434
|
}
|
|
430
|
-
|
|
431
|
-
|
|
435
|
+
const transportError = isWebSocketConnectionLimitReachedError(error) ? Object.assign(new Error(error.message, { cause: error }), { code: WEBSOCKET_TRANSPORT_ERROR_CODE }) : error;
|
|
436
|
+
if (aborted || isCodexNonTransportError(transportError)) throw transportError;
|
|
437
|
+
appendAssistantMessageDiagnostic(output, createAssistantMessageDiagnostic("provider_transport_failure", transportError, {
|
|
432
438
|
configuredTransport: transport,
|
|
433
439
|
fallbackTransport: transport === "auto" && !websocketStarted ? "sse" : void 0,
|
|
434
440
|
eventsEmitted: websocketStarted,
|
|
@@ -436,7 +442,7 @@ const streamOpenAICodexResponses = (model, context, options) => {
|
|
|
436
442
|
requestBytes: new TextEncoder().encode(JSON.stringify(activeAttempt.request)).byteLength
|
|
437
443
|
}));
|
|
438
444
|
if (transport === "auto" && options?.sessionId) addCodexWebSocketSseFallback(websocketState.sseFallbacks, options.sessionId, websocketAuthority);
|
|
439
|
-
if (websocketStarted || transport !== "auto") throw
|
|
445
|
+
if (websocketStarted || transport !== "auto") throw transportError;
|
|
440
446
|
break;
|
|
441
447
|
}
|
|
442
448
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
|
-
import { k as clampThinkingLevel } from "./host-
|
|
3
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
4
|
-
import { i as convertMessages, n as streamOpenAICompletionsRequest } from "./openai-completions-transport-
|
|
2
|
+
import { k as clampThinkingLevel } from "./host-u3o8XiAp.mjs";
|
|
3
|
+
import { n as buildBaseOptions } from "./simple-options-7QuSKriJ.mjs";
|
|
4
|
+
import { i as convertMessages, n as streamOpenAICompletionsRequest } from "./openai-completions-transport-CuoQfnKV.mjs";
|
|
5
5
|
import { t as requireApiKey } from "./required-api-key-D4kn3252.mjs";
|
|
6
6
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
7
7
|
var openai_completions_exports = /* @__PURE__ */ __exportAll({
|
package/dist/{openai-completions-compat-CJ0ktmGy.d.mts → openai-completions-compat-BgPg1BRs.d.mts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "./index-
|
|
1
|
+
import "./index-D27wAoOr.mjs";
|
|
2
2
|
import { N as OpenAICompletionsCompat, k as Model } from "./types-DvzmWW8J.mjs";
|
|
3
|
-
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-
|
|
3
|
+
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-DiPhRjrc.mjs";
|
|
4
4
|
//#region packages/ai/src/transports/openai-completions-compat.d.ts
|
|
5
5
|
type ProviderRequestCapabilities = AiProviderRequestCapabilities;
|
|
6
6
|
type OpenAICompletionsSessionAffinity = "none" | "openai" | "openrouter";
|
package/dist/{openai-completions-compat-D7hWYB0G.mjs → openai-completions-compat-GMN8A0fm.mjs}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
2
|
-
import { a as resolveProviderRequestCapabilities } from "./host-policy-
|
|
2
|
+
import { a as resolveProviderRequestCapabilities } from "./host-policy-BwhNNGQR.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/openai-response-format.ts
|
|
4
4
|
const JSON_SCHEMA_RESPONSE_FORMAT_NAME = "openclaw_response";
|
|
5
5
|
const OLLAMA_CLOUD_ORIGIN = "https://ollama.com";
|
package/dist/{openai-completions-transport-DITBEALX.mjs → openai-completions-transport-CuoQfnKV.mjs}
RENAMED
|
@@ -3,28 +3,28 @@ import { r as appendAssistantThinking } from "./event-stream-C5AbCAaZ.mjs";
|
|
|
3
3
|
import { o as isRecord } from "./record-coerce-CNDovvft.mjs";
|
|
4
4
|
import { s as readNonEmptyStringPreservingWhitespace, t as hasNonEmptyString } from "./string-coerce-CtgOVOSv.mjs";
|
|
5
5
|
import { n as asNonNegativeFiniteNumber } from "./number-coercion-V8-BhME4.mjs";
|
|
6
|
-
import { N as isImageWithMediaPayload, r as getAiTransportHost } from "./host-
|
|
6
|
+
import { N as isImageWithMediaPayload, r as getAiTransportHost } from "./host-u3o8XiAp.mjs";
|
|
7
7
|
import { _ as isOpenAIGpt54MiniModel, v as isOpenAIGpt55Model, y as isOpenAIGpt56Model } from "./openai-responses-contracts-BKu8O7l4.mjs";
|
|
8
8
|
import { r as uniqueStrings } from "./string-normalization-PN10hf6d.mjs";
|
|
9
9
|
import { o as truncateUtf16Safe } from "./provider-error-DQBE1bUQ.mjs";
|
|
10
|
-
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
10
|
+
import { r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-BK6E2g4Q.mjs";
|
|
11
11
|
import { r as emitModelTransportDebug } from "./diagnostics-Caj-4RBA.mjs";
|
|
12
|
-
import { c as supportsModelTools, r as estimateStringChars } from "./text-signature-
|
|
13
|
-
import { i as resolveOpenAICompletionsCompat, l as shouldOmitOllamaCompatResponseFormat, n as isNativeOpenAIEndpoint, s as resolveOpenAICompletionsResponseFormat, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
14
|
-
import { i as resolveProviderEndpoint, t as buildGuardedModelFetch } from "./host-policy-
|
|
12
|
+
import { c as supportsModelTools, r as estimateStringChars } from "./text-signature-D_vRrx-z.mjs";
|
|
13
|
+
import { i as resolveOpenAICompletionsCompat, l as shouldOmitOllamaCompatResponseFormat, n as isNativeOpenAIEndpoint, s as resolveOpenAICompletionsResponseFormat, t as detectOpenAICompletionsCompat } from "./openai-completions-compat-GMN8A0fm.mjs";
|
|
14
|
+
import { i as resolveProviderEndpoint, t as buildGuardedModelFetch } from "./host-policy-BwhNNGQR.mjs";
|
|
15
15
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
|
|
16
|
-
import { E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, S as withProviderResponseHook, _ as sanitizeNonEmptyTransportPayloadText, b as transportAbortError, c as failTransportStream, d as iterateModelStream, l as finalizeTerminalToolCallArguments, s as createWritableTransportEventStream, u as finalizeTransportStream, y as throwIfModelStreamAborted } from "./transport-stream-shared-
|
|
17
|
-
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, S as splitSystemPromptRelocatableBoundary, d as describeToolResultMediaPlaceholder, l as codeModeToolSurfaceObserver, m as extractToolResultText, s as prepareModelRequestBody, u as reasoningTagTextPolicy, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-
|
|
18
|
-
import { C as log, D as readOpenAICompletionsReasoningBatch, E as readOpenAICompletionsContentDeltas, O as resolveOpenAIClientBaseUrl, S as isOpenAICompletionsThinkingEnabled, T as parseOpenAICompletionsUsage, a as enforceCodeModeResponsesToolSurface, d as prepareOpenAITools, f as projectOpenAITools, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, i as buildOpenAISdkRequestOptions, k as resolvePromptCacheKey, l as resolveCodeModeResponsesVisibleToolNames, n as buildOpenAIClientHeaders, p as reconcileOpenAICompletionsToolChoice, r as buildOpenAISdkClientOptions, s as getCompat, t as assertCodeModeResponsesToolSurface, u as resolveOpenAIStrictToolFlagWithDiagnostics, v as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, w as measureUtf8AppendBytes, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-
|
|
16
|
+
import { E as createToolArgumentPreviewSchedule, O as parseStreamingJson, P as sanitizeSurrogates, S as withProviderResponseHook, _ as sanitizeNonEmptyTransportPayloadText, b as transportAbortError, c as failTransportStream, d as iterateModelStream, l as finalizeTerminalToolCallArguments, s as createWritableTransportEventStream, u as finalizeTransportStream, y as throwIfModelStreamAborted } from "./transport-stream-shared-CCR7hSW0.mjs";
|
|
17
|
+
import { C as stripSystemPromptCacheBoundary, D as sortPromptCacheToolsByName, S as splitSystemPromptRelocatableBoundary, d as describeToolResultMediaPlaceholder, l as codeModeToolSurfaceObserver, m as extractToolResultText, s as prepareModelRequestBody, u as reasoningTagTextPolicy, w as stripSystemPromptRelocatableBoundary, x as splitSystemPromptCacheBoundary } from "./simple-options-7QuSKriJ.mjs";
|
|
18
|
+
import { C as log, D as readOpenAICompletionsReasoningBatch, E as readOpenAICompletionsContentDeltas, O as resolveOpenAIClientBaseUrl, S as isOpenAICompletionsThinkingEnabled, T as parseOpenAICompletionsUsage, a as enforceCodeModeResponsesToolSurface, d as prepareOpenAITools, f as projectOpenAITools, g as resolveOpenAISimpleReasoningEffort, h as resolveOpenAIRequestReasoning, i as buildOpenAISdkRequestOptions, k as resolvePromptCacheKey, l as resolveCodeModeResponsesVisibleToolNames, n as buildOpenAIClientHeaders, p as reconcileOpenAICompletionsToolChoice, r as buildOpenAISdkClientOptions, s as getCompat, t as assertCodeModeResponsesToolSurface, u as resolveOpenAIStrictToolFlagWithDiagnostics, v as GEMINI_THOUGHT_SIGNATURE_VALIDATOR_SKIP, w as measureUtf8AppendBytes, y as createOpenAIProviderAcceptanceHook } from "./openai-transport-params-D7JMUPjf.mjs";
|
|
19
19
|
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
20
|
-
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-
|
|
21
|
-
import { a as tagUnresolvedTextAsCommentary, i as tagPendingCommentaryText, n as rememberPendingCommentaryTags, r as tagInterruptedTextPhases, t as clearPendingCommentaryText } from "./assistant-text-phase-
|
|
20
|
+
import { n as transformProviderMessages, t as createAssistantOutput } from "./assistant-output-D5762GPH.mjs";
|
|
21
|
+
import { a as tagUnresolvedTextAsCommentary, i as tagPendingCommentaryText, n as rememberPendingCommentaryTags, r as tagInterruptedTextPhases, t as clearPendingCommentaryText } from "./assistant-text-phase-DVZOxbuR.mjs";
|
|
22
22
|
import { t as notifyLlmRequestActivity } from "./llm-request-activity-D8f_oxHj.mjs";
|
|
23
23
|
import { n as resolveOpencodeSessionHeaders } from "./session-affinity-DA4WHv1h.mjs";
|
|
24
24
|
import "./types.mjs";
|
|
25
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders, r as resolveProviderTransportTurnState, t as filterProviderTurnHeadersForExplicitOpencodeSession } from "./provider-transport-turn-state-
|
|
25
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders, r as resolveProviderTransportTurnState, t as filterProviderTurnHeadersForExplicitOpencodeSession } from "./provider-transport-turn-state-BX6TfCyW.mjs";
|
|
26
26
|
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-D9ZmL_s9.mjs";
|
|
27
|
-
import { f as withPreparedToolSchemaNormalization, r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-
|
|
27
|
+
import { f as withPreparedToolSchemaNormalization, r as normalizeOpenAIStrictToolParameters } from "./openai-tool-schema-BIrI0mrA.mjs";
|
|
28
28
|
import { isGoogleGemini3ThinkingLevelModel } from "./internal/google-model-family.mjs";
|
|
29
29
|
import { t as mapOpenAIStopReason } from "./openai-stop-reason-8s70vDXj.mjs";
|
|
30
30
|
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-Ju9VpUGl.mjs";
|
|
@@ -519,7 +519,7 @@ function convertMessages(model, context, compat, options = {}) {
|
|
|
519
519
|
});
|
|
520
520
|
if (isRuntimeContextMessage(msg)) {
|
|
521
521
|
params.push({
|
|
522
|
-
role:
|
|
522
|
+
role: compat.supportsDeveloperRole ? "developer" : "user",
|
|
523
523
|
content: sanitizeSurrogates(runtimeContextContentToText(msg.content))
|
|
524
524
|
});
|
|
525
525
|
options.cacheOptOutIndexes?.add(params.length - 1);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-
|
|
1
|
+
import { n as isNativeOpenAIEndpoint } from "./openai-completions-compat-GMN8A0fm.mjs";
|
|
2
2
|
//#region packages/normalization-core/src/code-points.ts
|
|
3
3
|
/** Truncates to a nonnegative code-point budget; grapheme clusters may be split. */
|
|
4
4
|
function truncateCodePoints(text, maxCodePoints) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { N as OpenAICompletionsCompat, k as Model, l as CacheRetention } from "./types-DvzmWW8J.mjs";
|
|
2
|
-
import "./types-
|
|
2
|
+
import "./types-UlNana-2.mjs";
|
|
3
3
|
//#region packages/ai/src/providers/openai-prompt-cache.d.ts
|
|
4
4
|
/** Selects documented lifetime fields shared by Responses and Chat Completions. */
|
|
5
5
|
declare function resolveOpenAIPromptCacheParams(model: Pick<Model, "id" | "provider" | "baseUrl">, cacheRetention: CacheRetention, compat: Required<Pick<OpenAICompletionsCompat, "supportsPromptCacheKey" | "supportsLongCacheRetention">>): {
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-BhDjJH2R.mjs";
|
|
2
2
|
import { t as AssistantMessageEventStream } from "./event-stream-C5AbCAaZ.mjs";
|
|
3
|
-
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-
|
|
4
|
-
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-
|
|
3
|
+
import { n as clampOpenAIPromptCacheKey, r as resolveOpenAIPromptCacheParams } from "./openai-prompt-cache-BK6E2g4Q.mjs";
|
|
4
|
+
import { i as resolveOpenAICompletionsCompat } from "./openai-completions-compat-GMN8A0fm.mjs";
|
|
5
5
|
import { i as resolveCacheRetention, r as buildCopilotDynamicHeaders } from "./cloudflare-5qSGvIUH.mjs";
|
|
6
|
-
import { n as buildBaseOptions } from "./simple-options-
|
|
7
|
-
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-
|
|
6
|
+
import { n as buildBaseOptions } from "./simple-options-7QuSKriJ.mjs";
|
|
7
|
+
import { g as resolveOpenAISimpleReasoningEffort } from "./openai-transport-params-D7JMUPjf.mjs";
|
|
8
8
|
import { n as getEnvApiKey } from "./env-api-keys-CyX4VKGO.mjs";
|
|
9
|
-
import { t as createAssistantOutput } from "./assistant-output-
|
|
10
|
-
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-
|
|
11
|
-
import { P as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-
|
|
9
|
+
import { t as createAssistantOutput } from "./assistant-output-D5762GPH.mjs";
|
|
10
|
+
import { i as createOpenAIProviderClient, n as resolveProviderSimpleCompletionHeaders } from "./provider-transport-turn-state-BX6TfCyW.mjs";
|
|
11
|
+
import { P as convertProviderResponsesMessages, n as applyResponsesServiceTierPricing, r as runResponsesStreamLifecycle, t as applyCommonResponsesParams } from "./openai-responses-shared-CKNmC3vC.mjs";
|
|
12
12
|
import { t as requireApiKey } from "./required-api-key-D4kn3252.mjs";
|
|
13
13
|
//#region packages/ai/src/providers/openai-responses.ts
|
|
14
14
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
1
|
+
import "./index-D27wAoOr.mjs";
|
|
2
2
|
import { a as AssistantMessage, k as Model } from "./types-DvzmWW8J.mjs";
|
|
3
|
-
import "./provider-options-
|
|
4
|
-
import { i as ReplayableResponseCompactionItem, l as OpenAIResponsesCompactionOutput, r as OpenAIResponsesReasoningReplayMetadata } from "./openai-responses-contracts-
|
|
3
|
+
import "./provider-options-CkieKvNJ.mjs";
|
|
4
|
+
import { i as ReplayableResponseCompactionItem, l as OpenAIResponsesCompactionOutput, r as OpenAIResponsesReasoningReplayMetadata } from "./openai-responses-contracts-D5yVZBp-.mjs";
|
|
5
5
|
import "openai/resources/responses/responses.js";
|
|
6
6
|
//#region packages/ai/src/transports/openai-responses-compaction-replay.d.ts
|
|
7
7
|
declare function captureOpenAIResponsesCompaction(output: Pick<AssistantMessage, "providerReplay">, item: ReplayableResponseCompactionItem, boundary: number | "retained-users", model: Model, captureMetadata?: OpenAIResponsesReasoningReplayMetadata, compactedOutput?: OpenAIResponsesCompactionOutput): void;
|
|
@@ -94,13 +94,13 @@ function resolveOpenAIResponsesServerCompactionPlan(model, extraParams) {
|
|
|
94
94
|
threshold: enabled ? parsePositiveInteger(extraParams?.responsesCompactThreshold) ?? resolveOpenAIResponsesCompactThreshold(model) : void 0
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
|
-
/** Resolve the Responses compact-endpoint gate for one route
|
|
98
|
-
function resolveOpenAIResponsesCompactEndpointPlan(model, extraParams,
|
|
97
|
+
/** Resolve the Responses compact-endpoint gate for one route. */
|
|
98
|
+
function resolveOpenAIResponsesCompactEndpointPlan(model, extraParams, _purpose) {
|
|
99
99
|
const configured = extraParams?.responsesCompactEndpoint;
|
|
100
100
|
const provider = typeof model.provider === "string" ? normalizeProviderId(model.provider) : "";
|
|
101
101
|
const api = normalizeOptionalLowercaseString(model.api);
|
|
102
102
|
const endpointClass = resolveOpenAIResponsesEndpointClass(model.baseUrl);
|
|
103
|
-
const enabledByDefault = (provider === "xai" || provider === "x-ai") && endpointClass === "xai-native" ||
|
|
103
|
+
const enabledByDefault = (provider === "xai" || provider === "x-ai") && endpointClass === "xai-native" || provider === "openai" && api === "openai-responses" && endpointClass === "openai-public";
|
|
104
104
|
return { enabled: isOpenAIResponsesApi(api) && configured !== false && (configured === true || enabledByDefault) };
|
|
105
105
|
}
|
|
106
106
|
function stripDisabledOpenAIReasoningPayload(payloadObj) {
|
package/dist/{openai-responses-contracts-sAvdqNjS.d.mts → openai-responses-contracts-D5yVZBp-.d.mts}
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "./index-
|
|
1
|
+
import "./index-D27wAoOr.mjs";
|
|
2
2
|
import { M as ModelThinkingLevel, k as Model, n as Api } from "./types-DvzmWW8J.mjs";
|
|
3
|
-
import { a as BaseOpenAIStreamOptions,
|
|
4
|
-
import "./types-
|
|
3
|
+
import { a as BaseOpenAIStreamOptions, p as OpenAIReasoningEffort } from "./provider-options-CkieKvNJ.mjs";
|
|
4
|
+
import "./types-UlNana-2.mjs";
|
|
5
5
|
import { ResponseCompactionItem, ResponseCreateParamsStreaming, ResponseInputItem } from "openai/resources/responses/responses.js";
|
|
6
6
|
//#region packages/ai/src/providers/openai-request-reasoning.d.ts
|
|
7
7
|
type OpenAIRequestReasoningEffort = ModelThinkingLevel | "none";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region packages/ai/src/transports/openai-responses-endpoint.ts
|
|
2
|
+
function isOfficialOpenAIResponsesBaseUrl(baseUrl) {
|
|
3
|
+
if (!baseUrl) return false;
|
|
4
|
+
const url = URL.parse(baseUrl);
|
|
5
|
+
return url !== null && url.origin === "https://api.openai.com" && url.username === "" && url.password === "" && url.search === "" && url.hash === "" && url.pathname.replace(/\/+$/, "") === "/v1";
|
|
6
|
+
}
|
|
7
|
+
function supportsNativeOpenAIResponsesEndpoint(params) {
|
|
8
|
+
return params.provider.trim().toLowerCase() === "openai" && params.api === "openai-responses" && isOfficialOpenAIResponsesBaseUrl(params.baseUrl);
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { supportsNativeOpenAIResponsesEndpoint as n, isOfficialOpenAIResponsesBaseUrl as t };
|
|
@@ -32,8 +32,10 @@ declare function resolveOpenAIResponsesServerCompactionPlan(model: OpenAIRespons
|
|
|
32
32
|
enabled: boolean;
|
|
33
33
|
threshold: number | undefined;
|
|
34
34
|
};
|
|
35
|
-
/** Resolve the Responses compact-endpoint gate for one route
|
|
36
|
-
declare function resolveOpenAIResponsesCompactEndpointPlan(model: OpenAIResponsesPayloadModel, extraParams?: Record<string, unknown>,
|
|
35
|
+
/** Resolve the Responses compact-endpoint gate for one route. */
|
|
36
|
+
declare function resolveOpenAIResponsesCompactEndpointPlan(model: OpenAIResponsesPayloadModel, extraParams?: Record<string, unknown>,
|
|
37
|
+
/** @deprecated The policy no longer depends on purpose. */
|
|
38
|
+
_purpose?: "manual" | "budget"): {
|
|
37
39
|
enabled: boolean;
|
|
38
40
|
};
|
|
39
41
|
/** Resolve payload mutation policy for one OpenAI Responses-style model endpoint. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { h as responsesPromptObserver } from "./openai-responses-contracts-BKu8O7l4.mjs";
|
|
2
|
-
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-
|
|
3
|
-
import { C as stripSystemPromptCacheBoundary } from "./simple-options-
|
|
2
|
+
import { v as sanitizeTransportPayloadText } from "./transport-stream-shared-CCR7hSW0.mjs";
|
|
3
|
+
import { C as stripSystemPromptCacheBoundary } from "./simple-options-7QuSKriJ.mjs";
|
|
4
4
|
//#region packages/ai/src/transports/openai-responses-prompt-observer-internal.ts
|
|
5
5
|
function readFinalResponsesPrompt(request) {
|
|
6
6
|
if (typeof request.instructions === "string") return ["instructions", request.instructions];
|