@openclaw/ai 2026.8.1-beta.1 → 2026.8.1-beta.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-CE-7SkF6.mjs → anthropic-B6dLpq5L.mjs} +37 -22
- package/dist/{src-QkygScBs.mjs → anthropic-JsNA5KCu.mjs} +0 -1
- package/dist/{anthropic-usage-Ma4iX6uG.mjs → anthropic-compaction-replay-8lJNKXOE.mjs} +225 -102
- package/dist/anthropic-payload-policy-CiEuQS72.d.mts +49 -0
- package/dist/{api-registry-EpJoVwM1.d.mts → api-registry-k3zTz0cV.d.mts} +1 -1
- package/dist/{azure-openai-responses-Cc_kasye.mjs → azure-openai-responses-mxIOtUnn.mjs} +23 -29
- package/dist/diagnostics.d.mts +24 -1
- package/dist/diagnostics.mjs +2 -1
- package/dist/{event-stream-DRmDMRHH.d.mts → event-stream-BP6AWT8j.d.mts} +3 -1
- package/dist/{event-stream-CEV9t6da.mjs → event-stream-uSMZJ3FA.mjs} +16 -3
- package/dist/event-stream.d.mts +1 -1
- package/dist/event-stream.mjs +1 -1
- package/dist/{google-CGQu21aw.mjs → google-C7h2QzDX.mjs} +4 -4
- package/dist/{google-shared-Cq2UKx1l.mjs → google-shared-B0Qr9OR7.mjs} +9 -18
- package/dist/google-thinking-level-C-V3tecN.mjs +9 -0
- package/dist/{google-vertex-CusxWzvE.mjs → google-vertex-Bhc3TjDl.mjs} +5 -4
- package/dist/{llm-request-activity-BjtkplhG.mjs → headers-DdOQtGuU.mjs} +9 -1
- package/dist/{host-Bl7Kgddo.mjs → host-DTqNc7ad.mjs} +227 -168
- package/dist/{host-Dn4_SZI2.d.mts → host-vWgMMhiJ.d.mts} +9 -4
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +7 -5
- package/dist/internal/anthropic.d.mts +13 -5
- package/dist/internal/anthropic.mjs +5 -5
- package/dist/internal/openai-responses-payload-policy.d.mts +3 -0
- package/dist/internal/openai-responses-payload-policy.mjs +3 -0
- package/dist/internal/openai.d.mts +6 -6
- package/dist/internal/openai.mjs +8 -7
- package/dist/internal/runtime.d.mts +17 -5
- package/dist/internal/runtime.mjs +85 -73
- package/dist/internal/shared.d.mts +1 -6
- package/dist/internal/shared.mjs +3 -4
- package/dist/{json-parse-BvXNt1-7.mjs → json-parse-CDnesDM_.mjs} +4 -6
- package/dist/{mistral-Dx6VzNjf.mjs → mistral-CEWoQI_g.mjs} +26 -45
- package/dist/{number-coercion-1Miyb5MO.mjs → number-coercion-H9qHik3g.mjs} +7 -2
- package/dist/openai-chatgpt-jwt-KWcgd0d_.mjs +19 -0
- package/dist/{openai-chatgpt-responses-SC9m0FSf.mjs → openai-chatgpt-responses-CrPmqERt.mjs} +225 -144
- package/dist/{openai-completions-BaIpl93j.mjs → openai-completions-BPnt4Sml.mjs} +28 -43
- package/dist/openai-completions-compat-Dt3dcawL.d.mts +43 -0
- package/dist/{openai-responses-Bdx3V_Yu.mjs → openai-responses-DhIKtOup.mjs} +17 -24
- package/dist/openai-responses-contracts-CyfIkQi5.mjs +253 -0
- package/dist/openai-responses-contracts-XpZJxrRG.d.mts +68 -0
- package/dist/openai-responses-payload-policy-BDxV-W0c.mjs +206 -0
- package/dist/openai-responses-payload-policy-BSs371VM.d.mts +40 -0
- package/dist/{openai-responses-prompt-observer-internal-DDZPxRfr.mjs → openai-responses-prompt-observer-internal-DgNTYnRY.mjs} +3 -3
- package/dist/{openai-responses-stream-internal-Bl8YyVtF.mjs → openai-responses-shared-DXIt3iY5.mjs} +1211 -908
- package/dist/{openai-reasoning-compat-DKebnIBL.mjs → openai-stop-reason-BkFkqqK0.mjs} +198 -172
- package/dist/{openai-transport-shared-Cipt7egQ.mjs → openai-tool-projection-CY04OcvQ.mjs} +151 -128
- package/dist/provider-error-BUwEnjXq.mjs +429 -0
- package/dist/provider-error-CzNw4BWX.d.mts +12 -0
- package/dist/{provider-options-C5kYML7i.d.mts → provider-options-B96RdNpH.d.mts} +9 -3
- package/dist/provider-transcript-transform-ePx-Bbfr.mjs +155 -0
- package/dist/provider-types.d.mts +31 -0
- package/dist/provider-types.mjs +8 -0
- package/dist/providers.d.mts +1 -1
- package/dist/providers.mjs +17 -19
- package/dist/{reasoning-tag-text-partitioner-CGDyLWUR.mjs → reasoning-tag-text-partitioner-rnPwX2pg.mjs} +14 -8
- package/dist/record-coerce-DdXsgUd_.mjs +23 -0
- package/dist/{model-utils-Dau5dlgm.mjs → sanitize-unicode-BYqrYtC_.mjs} +28 -2
- package/dist/session-resources-CkR4WWy1.mjs +21 -0
- package/dist/simple-options-D58D5Kvw.mjs +117 -0
- package/dist/src-D2H6yKkH.mjs +2 -0
- package/dist/{stream-first-event-timeout-BIBomOGq.mjs → stream-first-event-timeout-MK28puvq.mjs} +2 -2
- package/dist/string-coerce-fsri9iCu.mjs +34 -0
- package/dist/{tool-schema-json-projection-B1b-XCn5.mjs → tool-schema-json-projection-q5d7QX5c.mjs} +5 -7
- package/dist/transport-utils-DJqkxbhC.mjs +138 -0
- package/dist/transports.d.mts +135 -178
- package/dist/transports.mjs +1732 -1294
- package/dist/types-BDdaOVi2.mjs +6 -0
- package/dist/{types-CH7ReIcU.d.mts → types-BHNrPS1l.d.mts} +19 -1
- package/dist/types.d.mts +4 -4
- package/dist/types.mjs +6 -4
- package/dist/utf16-slice-CvGodqok.mjs +29 -0
- package/dist/{validation-DAa_yFOM.mjs → validation-B61OhAio.mjs} +6 -6
- package/dist/{validation-CcPcuEbR.d.mts → validation-DT9SrFn3.d.mts} +1 -1
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -1
- package/package.json +15 -1
- package/dist/headers-B_e4-1J0.mjs +0 -9
- package/dist/openai-chatgpt-jwt-DhAAzLkj.mjs +0 -39
- package/dist/openai-responses-contracts-BBKBfAqR.d.mts +0 -116
- package/dist/openai-responses-shared-CCyMvg7M.mjs +0 -403
- package/dist/provider-error-DI0Ts28U.mjs +0 -47
- package/dist/sanitize-unicode-DT5o51ur.mjs +0 -26
- package/dist/tool-result-text-Dvkp2Dus.mjs +0 -274
- package/dist/transform-messages-DfjpNXNQ.mjs +0 -2
- package/dist/transport-stream-shared-CPNv7A3r.mjs +0 -297
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
+
import { i as clampThinkingLevel } from "./sanitize-unicode-BYqrYtC_.mjs";
|
|
4
|
+
import { n as getAiTransportHost } from "./host-DTqNc7ad.mjs";
|
|
5
|
+
import { n as projectProviderError } from "./provider-error-BUwEnjXq.mjs";
|
|
5
6
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
6
7
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
7
|
-
import { c as
|
|
8
|
-
import { a as
|
|
9
|
-
import { n as parseStreamingJson } from "./json-parse-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { t as
|
|
14
|
-
import {
|
|
15
|
-
import { t as headersToRecord } from "./headers-B_e4-1J0.mjs";
|
|
16
|
-
import { t as formatProviderError } from "./provider-error-DI0Ts28U.mjs";
|
|
8
|
+
import { c as splitSystemPromptCacheBoundary, f as sortPromptCacheToolsByName, n as buildBaseOptions } from "./simple-options-D58D5Kvw.mjs";
|
|
9
|
+
import { a as createOpenAICompletionsToolCallDeltaNormalizer, c as resolveOpenAICompletionsCompat, d as clearPendingCommentaryText, f as rememberPendingCommentaryTags, i as hasToolCallHistory, l as resolveOpenAICompletionsResponseFormat, n as resolveOpenAIReasoningEffortMap, o as finalizeOpenAICompletionsToolCalls, p as tagPendingCommentaryText, r as convertMessages, t as mapOpenAIStopReason, u as shouldOmitOllamaCompatResponseFormat } from "./openai-stop-reason-BkFkqqK0.mjs";
|
|
10
|
+
import { n as parseStreamingJson } from "./json-parse-CDnesDM_.mjs";
|
|
11
|
+
import { n as notifyLlmRequestActivity } from "./headers-DdOQtGuU.mjs";
|
|
12
|
+
import { f as transportAbortError, p as withProviderResponseHook } from "./provider-transcript-transform-ePx-Bbfr.mjs";
|
|
13
|
+
import { d as readOpenAICompletionsContentDeltas, n as reconcileOpenAICompletionsToolChoice, o as createOpenAIResponseHook, s as isOpenAICompletionsThinkingEnabled, t as projectOpenAITools, u as parseOpenAICompletionsUsage } from "./openai-tool-projection-CY04OcvQ.mjs";
|
|
14
|
+
import { a as withFirstStreamEventTimeout, i as getFirstStreamEventTimeoutMs, r as getFirstStreamEventTimeoutHandler, t as createFirstStreamEventAbortController } from "./stream-first-event-timeout-MK28puvq.mjs";
|
|
15
|
+
import { t as createReasoningTagTextPartitioner } from "./reasoning-tag-text-partitioner-rnPwX2pg.mjs";
|
|
17
16
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, r as isCloudflareProvider, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
18
17
|
import OpenAI from "openai";
|
|
19
18
|
//#region packages/ai/src/providers/openai-completions.ts
|
|
@@ -22,20 +21,6 @@ var openai_completions_exports = /* @__PURE__ */ __exportAll({
|
|
|
22
21
|
streamOpenAICompletions: () => streamOpenAICompletions,
|
|
23
22
|
streamSimpleOpenAICompletions: () => streamSimpleOpenAICompletions
|
|
24
23
|
});
|
|
25
|
-
/**
|
|
26
|
-
* Check if conversation messages contain tool calls or tool results.
|
|
27
|
-
* This is needed because Anthropic (via proxy) requires the tools param
|
|
28
|
-
* to be present when messages include tool_calls or tool role messages.
|
|
29
|
-
*/
|
|
30
|
-
function hasToolHistory(messages) {
|
|
31
|
-
for (const msg of messages) {
|
|
32
|
-
if (msg.role === "toolResult") return true;
|
|
33
|
-
if (msg.role === "assistant") {
|
|
34
|
-
if (Array.isArray(msg.content) && msg.content.some((block) => block.type === "toolCall")) return true;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return false;
|
|
38
|
-
}
|
|
39
24
|
function isEncryptedReasoningDetail(detail) {
|
|
40
25
|
if (typeof detail !== "object" || detail === null) return false;
|
|
41
26
|
const candidate = detail;
|
|
@@ -85,13 +70,15 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
85
70
|
maxRetries: options?.maxRetries ?? 0
|
|
86
71
|
};
|
|
87
72
|
const { data: openaiStream, response } = await client.chat.completions.create(params, requestOptions).withResponse();
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
73
|
+
const hookedOpenAIStream = withProviderResponseHook({
|
|
74
|
+
stream: openaiStream,
|
|
75
|
+
signal: firstEventAbort.signal,
|
|
76
|
+
abort: firstEventAbort.abort,
|
|
77
|
+
hook: createOpenAIResponseHook(options?.onResponse, response, model),
|
|
78
|
+
onReady: () => stream.push({
|
|
79
|
+
type: "start",
|
|
80
|
+
partial: output
|
|
81
|
+
})
|
|
95
82
|
});
|
|
96
83
|
let textBlock = null;
|
|
97
84
|
let thinkingBlock = null;
|
|
@@ -239,7 +226,7 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
239
226
|
const flushPartitionedContent = () => {
|
|
240
227
|
for (const delta of reasoningTagTextPartitioner.flush()) if (delta.kind === "text") appendTextDelta(delta.text);
|
|
241
228
|
};
|
|
242
|
-
const guardedOpenaiStream = withFirstStreamEventTimeout(
|
|
229
|
+
const guardedOpenaiStream = withFirstStreamEventTimeout(hookedOpenAIStream, {
|
|
243
230
|
provider: model.provider,
|
|
244
231
|
api: model.api,
|
|
245
232
|
model: model.id,
|
|
@@ -355,19 +342,17 @@ const streamOpenAICompletions = (model, context, options) => {
|
|
|
355
342
|
});
|
|
356
343
|
stream.end();
|
|
357
344
|
} catch (error) {
|
|
358
|
-
|
|
345
|
+
const terminal = projectProviderError(error, options?.signal);
|
|
346
|
+
Object.assign(output, terminal);
|
|
359
347
|
finalizeOpenAICompletionsToolCalls(output, { allowSilentToolCallPromotion: false });
|
|
360
348
|
for (const block of output.content) {
|
|
361
349
|
delete block.index;
|
|
362
350
|
delete block.partialArgs;
|
|
363
351
|
delete block.streamIndex;
|
|
364
352
|
}
|
|
365
|
-
output.errorMessage = formatProviderError(error);
|
|
366
|
-
const rawMetadata = error?.error?.metadata?.raw;
|
|
367
|
-
if (rawMetadata && !output.errorMessage.includes(rawMetadata)) output.errorMessage += `\n${rawMetadata}`;
|
|
368
353
|
stream.push({
|
|
369
354
|
type: "error",
|
|
370
|
-
reason:
|
|
355
|
+
reason: terminal.stopReason,
|
|
371
356
|
error: output
|
|
372
357
|
});
|
|
373
358
|
stream.end();
|
|
@@ -458,9 +443,9 @@ function buildParams(model, context, options, compat = resolveOpenAICompletionsC
|
|
|
458
443
|
const converted = convertTools(context.tools, compat);
|
|
459
444
|
toolProjection = converted.projection;
|
|
460
445
|
if (converted.tools.length > 0) params.tools = converted.tools;
|
|
461
|
-
else if (
|
|
446
|
+
else if (hasToolCallHistory(context.messages)) params.tools = [];
|
|
462
447
|
if (compat.zaiToolStream && converted.tools.length > 0) params.tool_stream = true;
|
|
463
|
-
} else if (
|
|
448
|
+
} else if (hasToolCallHistory(context.messages)) params.tools = [];
|
|
464
449
|
if (cacheControl) applyAnthropicCacheControl(messages, params.tools, cacheControl, cacheOptOutIndexes);
|
|
465
450
|
if (options?.toolChoice) {
|
|
466
451
|
const toolChoice = reconcileOpenAICompletionsToolChoice(options.toolChoice, toolProjection ?? projectOpenAITools([]));
|
|
@@ -596,7 +581,7 @@ function convertTools(tools, compat) {
|
|
|
596
581
|
const projection = projectOpenAITools(tools);
|
|
597
582
|
return {
|
|
598
583
|
projection,
|
|
599
|
-
tools: projection.tools.map((tool) => ({
|
|
584
|
+
tools: sortPromptCacheToolsByName(projection.tools).map((tool) => ({
|
|
600
585
|
type: "function",
|
|
601
586
|
function: {
|
|
602
587
|
name: tool.name,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { E as Model, O as OpenAICompletionsCompat } from "./types-BHNrPS1l.mjs";
|
|
2
|
+
import { a as AiProviderRequestPolicyInput, i as AiProviderRequestCapabilities } from "./host-vWgMMhiJ.mjs";
|
|
3
|
+
|
|
4
|
+
//#region packages/ai/src/transports/openai-completions-compat.d.ts
|
|
5
|
+
type ProviderRequestCapabilities = AiProviderRequestCapabilities;
|
|
6
|
+
type OpenAICompletionsSessionAffinity = "none" | "openai" | "openrouter";
|
|
7
|
+
type OpenAICompletionsCompatDefaults = {
|
|
8
|
+
supportsStore: boolean;
|
|
9
|
+
supportsDeveloperRole: boolean;
|
|
10
|
+
supportsReasoningEffort: boolean;
|
|
11
|
+
supportsUsageInStreaming: boolean;
|
|
12
|
+
maxTokensField: "max_completion_tokens" | "max_tokens";
|
|
13
|
+
thinkingFormat: "openai" | "openrouter" | "deepseek" | "together" | "zai";
|
|
14
|
+
visibleReasoningDetailTypes: string[];
|
|
15
|
+
supportsStrictMode: boolean;
|
|
16
|
+
supportsJsonSchemaResponseFormat: boolean;
|
|
17
|
+
requiresReasoningContentOnAssistantMessages: boolean;
|
|
18
|
+
requiresNonEmptyUserOrAssistantMessage: boolean;
|
|
19
|
+
cacheControlFormat?: OpenAICompletionsCompat["cacheControlFormat"];
|
|
20
|
+
sessionAffinityFormat: Exclude<OpenAICompletionsSessionAffinity, "none">;
|
|
21
|
+
supportsLongCacheRetention: boolean;
|
|
22
|
+
};
|
|
23
|
+
type DetectedOpenAICompletionsCompat = {
|
|
24
|
+
capabilities: ProviderRequestCapabilities;
|
|
25
|
+
defaults: OpenAICompletionsCompatDefaults;
|
|
26
|
+
};
|
|
27
|
+
type ResolvedOpenAICompletionsCompat = Omit<Required<OpenAICompletionsCompat>, "cacheControlFormat" | "openRouterRouting" | "sendSessionAffinityHeaders"> & {
|
|
28
|
+
cacheControlFormat?: OpenAICompletionsCompat["cacheControlFormat"];
|
|
29
|
+
openRouterRouting?: OpenAICompletionsCompat["openRouterRouting"];
|
|
30
|
+
sessionAffinity: OpenAICompletionsSessionAffinity;
|
|
31
|
+
visibleReasoningDetailTypes: string[];
|
|
32
|
+
requiresNonEmptyUserOrAssistantMessage: boolean;
|
|
33
|
+
};
|
|
34
|
+
/** Detects endpoint capabilities and defaults for an OpenAI-completions model. */
|
|
35
|
+
declare function detectOpenAICompletionsCompat(model: Pick<Model<"openai-completions">, "provider" | "baseUrl" | "id"> & {
|
|
36
|
+
compat?: {
|
|
37
|
+
supportsStore?: boolean;
|
|
38
|
+
} | null;
|
|
39
|
+
}, resolveCapabilities?: (input: AiProviderRequestPolicyInput) => ProviderRequestCapabilities): DetectedOpenAICompletionsCompat;
|
|
40
|
+
/** Applies explicit model overrides once on top of the canonical transport defaults. */
|
|
41
|
+
declare function resolveOpenAICompletionsCompat(model: Model<"openai-completions">, resolveCapabilities?: (input: AiProviderRequestPolicyInput) => ProviderRequestCapabilities): ResolvedOpenAICompletionsCompat;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { detectOpenAICompletionsCompat as n, resolveOpenAICompletionsCompat as r, ResolvedOpenAICompletionsCompat as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { n as getEnvApiKey, r as __exportAll } from "./env-api-keys-DrgeBuva.mjs";
|
|
2
|
-
import { t as AssistantMessageEventStream } from "./event-stream-
|
|
3
|
-
import { n as getAiTransportHost } from "./host-
|
|
2
|
+
import { t as AssistantMessageEventStream } from "./event-stream-uSMZJ3FA.mjs";
|
|
3
|
+
import { n as getAiTransportHost } from "./host-DTqNc7ad.mjs";
|
|
4
|
+
import { S as supportsOpenAITemperature } from "./openai-responses-contracts-CyfIkQi5.mjs";
|
|
4
5
|
import { n as clampOpenAIPromptCacheKey } from "./openai-prompt-cache-mZTCdRPo.mjs";
|
|
5
6
|
import { t as resolveCacheRetention } from "./cache-retention-0x979a5V.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
7
|
+
import { n as buildBaseOptions } from "./simple-options-D58D5Kvw.mjs";
|
|
8
|
+
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, n as applyResponsesServiceTierPricing, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-DXIt3iY5.mjs";
|
|
8
9
|
import { i as resolveCloudflareBaseUrl, n as hasCopilotVisionInput, r as isCloudflareProvider, t as buildCopilotDynamicHeaders } from "./github-copilot-headers-NCJtz9i0.mjs";
|
|
9
|
-
import { a as resolveResponsesReasoningEffort, i as createResponsesAssistantOutput, n as applyResponsesServiceTierPricing, o as runResponsesStreamLifecycle, r as convertResponsesMessages, t as applyCommonResponsesParams } from "./openai-responses-shared-CCyMvg7M.mjs";
|
|
10
10
|
import OpenAI from "openai";
|
|
11
11
|
//#region packages/ai/src/providers/openai-responses.ts
|
|
12
12
|
var openai_responses_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -23,19 +23,6 @@ function getCompat(model) {
|
|
|
23
23
|
function getPromptCacheRetention(compat, cacheRetention) {
|
|
24
24
|
return cacheRetention === "long" && compat.supportsLongCacheRetention ? "24h" : void 0;
|
|
25
25
|
}
|
|
26
|
-
function formatOpenAIResponsesError(error) {
|
|
27
|
-
if (error instanceof Error) {
|
|
28
|
-
const status = error.status;
|
|
29
|
-
const statusCode = typeof status === "number" ? status : void 0;
|
|
30
|
-
if (statusCode !== void 0) return `OpenAI API error (${statusCode}): ${error.message}`;
|
|
31
|
-
return error.message;
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
return JSON.stringify(error);
|
|
35
|
-
} catch {
|
|
36
|
-
return String(error);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
26
|
/**
|
|
40
27
|
* Generate function for OpenAI Responses API
|
|
41
28
|
*/
|
|
@@ -51,12 +38,11 @@ const streamOpenAIResponses = (model, context, options) => {
|
|
|
51
38
|
const cacheSessionId = resolveCacheRetention(options?.cacheRetention) === "none" ? void 0 : options?.sessionId;
|
|
52
39
|
return createClient(model, context, apiKey, options?.headers, cacheSessionId);
|
|
53
40
|
},
|
|
54
|
-
buildParams: () => buildParams(model, context, options),
|
|
41
|
+
buildParams: (_requestModel, replayMode) => buildParams(model, context, options, replayMode),
|
|
55
42
|
processStreamOptions: {
|
|
56
43
|
serviceTier: options?.serviceTier,
|
|
57
44
|
applyServiceTierPricing: (usage, serviceTier) => applyResponsesServiceTierPricing(usage, serviceTier, model)
|
|
58
|
-
}
|
|
59
|
-
formatError: formatOpenAIResponsesError
|
|
45
|
+
}
|
|
60
46
|
});
|
|
61
47
|
return stream;
|
|
62
48
|
};
|
|
@@ -64,10 +50,12 @@ const streamSimpleOpenAIResponses = (model, context, options) => {
|
|
|
64
50
|
const apiKey = options?.apiKey || getEnvApiKey(model.provider);
|
|
65
51
|
if (!apiKey) throw new Error(`No API key for provider: ${model.provider}`);
|
|
66
52
|
const base = buildBaseOptions(model, options, apiKey);
|
|
53
|
+
const replayOptions = options;
|
|
67
54
|
return streamOpenAIResponses(model, context, {
|
|
68
55
|
...base,
|
|
56
|
+
authProfileId: replayOptions?.authProfileId,
|
|
69
57
|
reasoningEffort: resolveResponsesReasoningEffort(model, options?.reasoning),
|
|
70
|
-
replayResponsesItemIds:
|
|
58
|
+
replayResponsesItemIds: replayOptions?.replayResponsesItemIds
|
|
71
59
|
});
|
|
72
60
|
};
|
|
73
61
|
function createClient(model, context, apiKey, optionsHeaders, sessionId) {
|
|
@@ -100,8 +88,13 @@ function createClient(model, context, apiKey, optionsHeaders, sessionId) {
|
|
|
100
88
|
fetch: getAiTransportHost().buildModelFetch(model)
|
|
101
89
|
});
|
|
102
90
|
}
|
|
103
|
-
function buildParams(model, context, options) {
|
|
104
|
-
const messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {
|
|
91
|
+
function buildParams(model, context, options, replayMode = "checkpoint") {
|
|
92
|
+
const messages = convertResponsesMessages(model, context, OPENAI_TOOL_CALL_PROVIDERS, {
|
|
93
|
+
replayResponsesItemIds: options?.replayResponsesItemIds ?? false,
|
|
94
|
+
sessionId: options?.sessionId,
|
|
95
|
+
authProfileId: options?.authProfileId,
|
|
96
|
+
replayMode
|
|
97
|
+
});
|
|
105
98
|
const cacheRetention = resolveCacheRetention(options?.cacheRetention);
|
|
106
99
|
const compat = getCompat(model);
|
|
107
100
|
const params = {
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { n as PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE, t as PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE } from "./types-BDdaOVi2.mjs";
|
|
2
|
+
import "./src-D2H6yKkH.mjs";
|
|
3
|
+
import { a as normalizeOptionalString, n as normalizeLowercaseStringOrEmpty } from "./string-coerce-fsri9iCu.mjs";
|
|
4
|
+
import { a as isRecord } from "./record-coerce-DdXsgUd_.mjs";
|
|
5
|
+
//#region packages/normalization-core/src/string-normalization.ts
|
|
6
|
+
/** Coerces entries to strings, trims them, and drops empty results. */
|
|
7
|
+
function normalizeStringEntries(list) {
|
|
8
|
+
return (list ?? []).map((entry) => normalizeOptionalString(String(entry)) ?? "").filter(Boolean);
|
|
9
|
+
}
|
|
10
|
+
/** Returns first-seen unique values while preserving insertion order. */
|
|
11
|
+
function uniqueValues(values) {
|
|
12
|
+
return [...new Set(values)];
|
|
13
|
+
}
|
|
14
|
+
/** Returns first-seen unique strings while preserving insertion order. */
|
|
15
|
+
function uniqueStrings(values) {
|
|
16
|
+
return uniqueValues(values);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region packages/ai/src/providers/openai-reasoning-effort.ts
|
|
20
|
+
/**
|
|
21
|
+
* OpenAI-compatible reasoning-effort normalization. Different GPT families
|
|
22
|
+
* expose different accepted effort enums, so callers map requested values here
|
|
23
|
+
* before constructing provider payloads.
|
|
24
|
+
*/
|
|
25
|
+
const GPT_5_REASONING_EFFORTS = [
|
|
26
|
+
"minimal",
|
|
27
|
+
"low",
|
|
28
|
+
"medium",
|
|
29
|
+
"high"
|
|
30
|
+
];
|
|
31
|
+
const GPT_51_REASONING_EFFORTS = [
|
|
32
|
+
"none",
|
|
33
|
+
"low",
|
|
34
|
+
"medium",
|
|
35
|
+
"high"
|
|
36
|
+
];
|
|
37
|
+
const GPT_52_REASONING_EFFORTS = [
|
|
38
|
+
"none",
|
|
39
|
+
"low",
|
|
40
|
+
"medium",
|
|
41
|
+
"high",
|
|
42
|
+
"xhigh"
|
|
43
|
+
];
|
|
44
|
+
const GPT_56_REASONING_EFFORTS = [
|
|
45
|
+
"none",
|
|
46
|
+
"low",
|
|
47
|
+
"medium",
|
|
48
|
+
"high",
|
|
49
|
+
"xhigh",
|
|
50
|
+
"max"
|
|
51
|
+
];
|
|
52
|
+
const GPT_CODEX_REASONING_EFFORTS = [
|
|
53
|
+
"low",
|
|
54
|
+
"medium",
|
|
55
|
+
"high",
|
|
56
|
+
"xhigh"
|
|
57
|
+
];
|
|
58
|
+
const GPT_PRO_REASONING_EFFORTS = [
|
|
59
|
+
"medium",
|
|
60
|
+
"high",
|
|
61
|
+
"xhigh"
|
|
62
|
+
];
|
|
63
|
+
const GPT_5_PRO_REASONING_EFFORTS = ["high"];
|
|
64
|
+
const GPT_51_CODEX_MAX_REASONING_EFFORTS = [
|
|
65
|
+
"none",
|
|
66
|
+
"medium",
|
|
67
|
+
"high",
|
|
68
|
+
"xhigh"
|
|
69
|
+
];
|
|
70
|
+
const GPT_51_CODEX_MINI_REASONING_EFFORTS = ["medium"];
|
|
71
|
+
const GENERIC_REASONING_EFFORTS = [
|
|
72
|
+
"low",
|
|
73
|
+
"medium",
|
|
74
|
+
"high"
|
|
75
|
+
];
|
|
76
|
+
const CANONICAL_REASONING_EFFORTS = /* @__PURE__ */ new Set([
|
|
77
|
+
"none",
|
|
78
|
+
"minimal",
|
|
79
|
+
"low",
|
|
80
|
+
"medium",
|
|
81
|
+
"high",
|
|
82
|
+
"xhigh",
|
|
83
|
+
"max",
|
|
84
|
+
"off"
|
|
85
|
+
]);
|
|
86
|
+
function normalizeModelId(id) {
|
|
87
|
+
return normalizeLowercaseStringOrEmpty(id ?? "").replace(/-\d{4}-\d{2}-\d{2}$/u, "");
|
|
88
|
+
}
|
|
89
|
+
/** Return whether a model is the GPT-5.4 mini family. */
|
|
90
|
+
function isOpenAIGpt54MiniModel(model) {
|
|
91
|
+
const id = normalizeModelId(typeof model.id === "string" ? model.id : void 0);
|
|
92
|
+
return /^gpt-5\.4-mini(?:-|$)/u.test(id);
|
|
93
|
+
}
|
|
94
|
+
/** Return whether a model is the GPT-5.5 family. */
|
|
95
|
+
function isOpenAIGpt55Model(model) {
|
|
96
|
+
const id = normalizeModelId(typeof model.id === "string" ? model.id : void 0);
|
|
97
|
+
const name = normalizeModelId(typeof model.name === "string" ? model.name : void 0);
|
|
98
|
+
return /^gpt-5\.5(?:-|$)/u.test(id) || /^gpt-5\.5(?:\s|\(|-|$)/u.test(name);
|
|
99
|
+
}
|
|
100
|
+
/** Return whether a model is the GPT-5.6 family. */
|
|
101
|
+
function isOpenAIGpt56Model(model) {
|
|
102
|
+
const id = normalizeModelId(typeof model.id === "string" ? model.id : void 0);
|
|
103
|
+
const name = normalizeModelId(typeof model.name === "string" ? model.name : void 0);
|
|
104
|
+
return /^gpt-5\.6(?:-|$)/u.test(id) || /^gpt-5\.6(?:\s|\(|-|$)/u.test(name);
|
|
105
|
+
}
|
|
106
|
+
/** Normalize user-facing reasoning effort names to API effort names. */
|
|
107
|
+
function normalizeOpenAIReasoningEffort(effort) {
|
|
108
|
+
const trimmed = effort.trim();
|
|
109
|
+
const folded = trimmed.toLowerCase();
|
|
110
|
+
return CANONICAL_REASONING_EFFORTS.has(folded) ? folded : trimmed;
|
|
111
|
+
}
|
|
112
|
+
function readCompatReasoningEfforts(compat) {
|
|
113
|
+
if (!compat || typeof compat !== "object") return;
|
|
114
|
+
if (compat.supportsReasoningEffort === false) return [];
|
|
115
|
+
const raw = compat.supportedReasoningEfforts;
|
|
116
|
+
if (!Array.isArray(raw)) return;
|
|
117
|
+
const supported = uniqueStrings(normalizeStringEntries(raw.filter((value) => typeof value === "string")));
|
|
118
|
+
return supported.length > 0 ? supported : void 0;
|
|
119
|
+
}
|
|
120
|
+
function isDisabledReasoningEffort(effort) {
|
|
121
|
+
return effort === "none" || effort === "off";
|
|
122
|
+
}
|
|
123
|
+
/** Resolve the reasoning efforts accepted by a specific OpenAI-compatible model. */
|
|
124
|
+
function resolveOpenAISupportedReasoningEfforts(model) {
|
|
125
|
+
const compatEfforts = readCompatReasoningEfforts(model.compat);
|
|
126
|
+
if (compatEfforts) return compatEfforts;
|
|
127
|
+
const id = normalizeModelId(typeof model.id === "string" ? model.id : void 0);
|
|
128
|
+
if (/^gpt-5\.6(?:-|$)/u.test(id)) return GPT_56_REASONING_EFFORTS;
|
|
129
|
+
if (id === "gpt-5.1-codex-mini") return GPT_51_CODEX_MINI_REASONING_EFFORTS;
|
|
130
|
+
if (id === "gpt-5.1-codex-max") return GPT_51_CODEX_MAX_REASONING_EFFORTS;
|
|
131
|
+
if (/^gpt-5(?:\.\d+)?-codex(?:-|$)/u.test(id)) return GPT_CODEX_REASONING_EFFORTS;
|
|
132
|
+
if (id === "gpt-5-pro") return GPT_5_PRO_REASONING_EFFORTS;
|
|
133
|
+
if (/^gpt-5\.[2-9](?:\.\d+)?-pro(?:-|$)/u.test(id)) return GPT_PRO_REASONING_EFFORTS;
|
|
134
|
+
if (/^gpt-5\.[2-9](?:\.\d+)?(?:-|$)/u.test(id)) return GPT_52_REASONING_EFFORTS;
|
|
135
|
+
if (/^gpt-5\.1(?:-|$)/u.test(id)) return GPT_51_REASONING_EFFORTS;
|
|
136
|
+
if (/^gpt-5(?:-|$)/u.test(id)) return GPT_5_REASONING_EFFORTS;
|
|
137
|
+
return GENERIC_REASONING_EFFORTS;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Return whether a model accepts the temperature parameter. The GPT-5.6
|
|
141
|
+
* family rejects it with a 400; catalog compat can override per model.
|
|
142
|
+
*/
|
|
143
|
+
function supportsOpenAITemperature(model) {
|
|
144
|
+
const compat = model.compat;
|
|
145
|
+
if (compat && typeof compat === "object") {
|
|
146
|
+
const declared = compat.supportsTemperature;
|
|
147
|
+
if (typeof declared === "boolean") return declared;
|
|
148
|
+
}
|
|
149
|
+
const id = normalizeModelId(typeof model.id === "string" ? model.id : void 0);
|
|
150
|
+
return !/^gpt-5\.6(?:-|$)/u.test(id);
|
|
151
|
+
}
|
|
152
|
+
/** Return whether a model accepts a requested reasoning effort. */
|
|
153
|
+
function supportsOpenAIReasoningEffort(model, effort) {
|
|
154
|
+
return resolveOpenAISupportedReasoningEfforts(model).includes(normalizeOpenAIReasoningEffort(effort));
|
|
155
|
+
}
|
|
156
|
+
/** Resolve a requested reasoning effort to the closest value supported by the model. */
|
|
157
|
+
function resolveOpenAIReasoningEffortForModel(params) {
|
|
158
|
+
const requested = normalizeOpenAIReasoningEffort(params.effort);
|
|
159
|
+
const mapped = params.fallbackMap?.[requested] ?? (params.fallbackMap && CANONICAL_REASONING_EFFORTS.has(requested) ? Object.entries(params.fallbackMap).find(([effort]) => normalizeOpenAIReasoningEffort(effort) === requested)?.[1] : void 0);
|
|
160
|
+
const normalized = mapped === void 0 ? requested : mapped.trim();
|
|
161
|
+
const supported = resolveOpenAISupportedReasoningEfforts(params.model);
|
|
162
|
+
if (supported.includes(normalized)) return normalized;
|
|
163
|
+
if (requested === "off" && supported.includes("none")) return "none";
|
|
164
|
+
if (isDisabledReasoningEffort(requested) || isDisabledReasoningEffort(normalized)) return;
|
|
165
|
+
if (requested === "minimal" && supported.includes("low")) return "low";
|
|
166
|
+
if ((requested === "minimal" || requested === "low") && supported.includes("medium")) return "medium";
|
|
167
|
+
if (requested === "xhigh" && supported.includes("high")) return "high";
|
|
168
|
+
if (requested === "max" && supported.includes("xhigh")) return "xhigh";
|
|
169
|
+
return supported.find((effort) => !isDisabledReasoningEffort(normalizeOpenAIReasoningEffort(effort)));
|
|
170
|
+
}
|
|
171
|
+
//#endregion
|
|
172
|
+
//#region packages/ai/src/transports/openai-responses-contracts.ts
|
|
173
|
+
const DEFAULT_AZURE_OPENAI_API_VERSION = "preview";
|
|
174
|
+
const OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS = "Follow the user request.";
|
|
175
|
+
const AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS = 3e4;
|
|
176
|
+
const RESPONSE_FAILED_NO_DETAILS_MESSAGE = "Unknown error (no error details in response)";
|
|
177
|
+
const OPENAI_RESPONSES_REASONING_REPLAY_META_KEY = "__openclaw_replay";
|
|
178
|
+
const OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY = "openclawReasoningReplay";
|
|
179
|
+
const OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE = "openai-responses-compaction";
|
|
180
|
+
const OPENAI_RESPONSES_APIS = /* @__PURE__ */ new Set([
|
|
181
|
+
"openai-responses",
|
|
182
|
+
"azure-openai-responses",
|
|
183
|
+
"openai-chatgpt-responses",
|
|
184
|
+
"openclaw-openai-responses-transport",
|
|
185
|
+
"openclaw-openai-chatgpt-responses-transport",
|
|
186
|
+
"openclaw-azure-openai-responses-transport"
|
|
187
|
+
]);
|
|
188
|
+
var OpenAIResponsesWebSocketResponseFailedError = class extends Error {
|
|
189
|
+
constructor(hasOutput) {
|
|
190
|
+
super("OpenAI Responses WebSocket returned response.failed");
|
|
191
|
+
this.name = "OpenAIResponsesWebSocketResponseFailedError";
|
|
192
|
+
this.code = hasOutput ? PROVIDER_FAILURE_WITH_OUTPUT_ERROR_CODE : PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var OpenAIResponsesWebSocketPreDispatchError = class extends Error {
|
|
196
|
+
constructor(cause) {
|
|
197
|
+
super("OpenAI Responses WebSocket failed before request dispatch", { cause });
|
|
198
|
+
this.name = "OpenAIResponsesWebSocketPreDispatchError";
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
var OpenAIResponsesWebSocketPostDispatchError = class extends Error {
|
|
202
|
+
constructor(cause) {
|
|
203
|
+
super("OpenAI Responses WebSocket failed after request dispatch; outcome is unknown", { cause });
|
|
204
|
+
this.code = PROVIDER_POST_DISPATCH_AMBIGUITY_ERROR_CODE;
|
|
205
|
+
this.name = "OpenAIResponsesWebSocketPostDispatchError";
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
var OpenAIResponsesWebSocketServerError = class extends Error {
|
|
209
|
+
constructor(code, status, param, message, cause) {
|
|
210
|
+
super(message, { cause });
|
|
211
|
+
this.code = code;
|
|
212
|
+
this.status = status;
|
|
213
|
+
this.param = param;
|
|
214
|
+
this.name = "OpenAIResponsesWebSocketServerError";
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
var OpenAIResponsesWebSocketSafeRetryError = class extends OpenAIResponsesWebSocketServerError {};
|
|
218
|
+
function readWebSocketServerError(value) {
|
|
219
|
+
if (!isRecord(value) || value.type !== "error") return;
|
|
220
|
+
const details = isRecord(value.error) ? value.error : value;
|
|
221
|
+
if (typeof details.code !== "string" || typeof details.message !== "string") return;
|
|
222
|
+
const rawStatus = value.status ?? value.status_code;
|
|
223
|
+
return {
|
|
224
|
+
code: details.code,
|
|
225
|
+
message: details.message,
|
|
226
|
+
param: typeof details.param === "string" ? details.param : null,
|
|
227
|
+
status: typeof rawStatus === "number" ? rawStatus : void 0
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
function parseOpenAIResponsesWebSocketServerError(cause) {
|
|
231
|
+
if (!isRecord(cause)) return;
|
|
232
|
+
let details = readWebSocketServerError(cause.error) ?? readWebSocketServerError(cause);
|
|
233
|
+
if (!details && typeof cause.message === "string") try {
|
|
234
|
+
details = readWebSocketServerError(JSON.parse(cause.message));
|
|
235
|
+
} catch {}
|
|
236
|
+
if (!details) return;
|
|
237
|
+
return new (details.code === "previous_response_not_found" || details.code === "websocket_connection_limit_reached" || details.code === "invalid_encrypted_content" || details.code === "thinking_signature_invalid" ? OpenAIResponsesWebSocketSafeRetryError : OpenAIResponsesWebSocketServerError)(details.code, details.status, details.param, details.message, cause);
|
|
238
|
+
}
|
|
239
|
+
const PROMPT_OBSERVER = Symbol("openaiResponsesPromptObserver");
|
|
240
|
+
const responsesPromptObserver = {
|
|
241
|
+
set(options, observer) {
|
|
242
|
+
Reflect.set(options, PROMPT_OBSERVER, observer);
|
|
243
|
+
},
|
|
244
|
+
get(options) {
|
|
245
|
+
return Reflect.get(options, PROMPT_OBSERVER);
|
|
246
|
+
},
|
|
247
|
+
copy(source, target) {
|
|
248
|
+
const observer = source && responsesPromptObserver.get(source);
|
|
249
|
+
if (observer) responsesPromptObserver.set(target, observer);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
//#endregion
|
|
253
|
+
export { normalizeStringEntries as C, supportsOpenAITemperature as S, uniqueValues as T, isOpenAIGpt56Model as _, OPENAI_RESPONSES_COMPACTION_REPLAY_TYPE as a, resolveOpenAISupportedReasoningEfforts as b, OpenAIResponsesWebSocketPostDispatchError as c, OpenAIResponsesWebSocketSafeRetryError as d, RESPONSE_FAILED_NO_DETAILS_MESSAGE as f, isOpenAIGpt55Model as g, isOpenAIGpt54MiniModel as h, OPENAI_RESPONSES_APIS as i, OpenAIResponsesWebSocketPreDispatchError as l, responsesPromptObserver as m, DEFAULT_AZURE_OPENAI_API_VERSION as n, OPENAI_RESPONSES_REASONING_REPLAY_BLOCK_META_KEY as o, parseOpenAIResponsesWebSocketServerError as p, OPENAI_CODEX_RESPONSES_DEFAULT_INSTRUCTIONS as r, OPENAI_RESPONSES_REASONING_REPLAY_META_KEY as s, AZURE_RESPONSES_FIRST_EVENT_TIMEOUT_MS as t, OpenAIResponsesWebSocketResponseFailedError as u, normalizeOpenAIReasoningEffort as v, uniqueStrings as w, supportsOpenAIReasoningEffort as x, resolveOpenAIReasoningEffortForModel as y };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { n as Api } from "./types-BHNrPS1l.mjs";
|
|
2
|
+
import { f as OpenAIApiReasoningEffort, i as BaseOpenAIStreamOptions, p as OpenAIReasoningEffort } from "./provider-options-B96RdNpH.mjs";
|
|
3
|
+
import { FunctionTool, ResponseCompactionItem, ResponseCreateParamsStreaming, ResponseInput } from "openai/resources/responses/responses.js";
|
|
4
|
+
|
|
5
|
+
//#region packages/ai/src/transports/openai-responses-contracts.d.ts
|
|
6
|
+
declare const OPENAI_RESPONSES_APIS: ReadonlySet<Api>;
|
|
7
|
+
type ReplayableResponseCompactionItem = Omit<ResponseCompactionItem, "id"> & {
|
|
8
|
+
id?: string;
|
|
9
|
+
};
|
|
10
|
+
type OpenAIResponsesReasoningReplayMetadata = {
|
|
11
|
+
v: 1;
|
|
12
|
+
source: "openai-responses";
|
|
13
|
+
provider: string;
|
|
14
|
+
api: Api;
|
|
15
|
+
model: string;
|
|
16
|
+
baseUrlHash?: string;
|
|
17
|
+
sessionHash?: string;
|
|
18
|
+
authProfileHash?: string;
|
|
19
|
+
};
|
|
20
|
+
type OpenAIResponsesOptions = BaseOpenAIStreamOptions & {
|
|
21
|
+
reasoning?: OpenAIReasoningEffort;
|
|
22
|
+
reasoningEffort?: OpenAIReasoningEffort;
|
|
23
|
+
reasoningSummary?: "auto" | "detailed" | "concise" | null;
|
|
24
|
+
replayResponsesItemIds?: boolean;
|
|
25
|
+
serviceTier?: ResponseCreateParamsStreaming["service_tier"];
|
|
26
|
+
toolChoice?: ResponseCreateParamsStreaming["tool_choice"];
|
|
27
|
+
};
|
|
28
|
+
type ResponsesPromptObservation = {
|
|
29
|
+
egress: "responses-sdk" | "responses-websocket" | "native-codex-websocket" | "native-codex-sse";
|
|
30
|
+
payloadVariant: "initial" | "reasoning-stripped" | "compaction-stripped" | "continuation-rejected";
|
|
31
|
+
promptSource: "instructions" | "input.developer" | "input.system" | "missing";
|
|
32
|
+
expectedChars: number;
|
|
33
|
+
observedChars: number;
|
|
34
|
+
matchesAssembledPrompt: boolean;
|
|
35
|
+
};
|
|
36
|
+
type ResponsesPromptObserver = (observation: ResponsesPromptObservation) => void;
|
|
37
|
+
declare const responsesPromptObserver: {
|
|
38
|
+
set(options: object, observer: ResponsesPromptObserver): void;
|
|
39
|
+
get(options: object): ResponsesPromptObserver | undefined;
|
|
40
|
+
copy(source: object | undefined, target: object): void;
|
|
41
|
+
};
|
|
42
|
+
type OpenAIResponsesRequestParams = {
|
|
43
|
+
model: string;
|
|
44
|
+
input: ResponseInput;
|
|
45
|
+
stream: true;
|
|
46
|
+
instructions?: string;
|
|
47
|
+
prompt_cache_key?: string;
|
|
48
|
+
prompt_cache_retention?: "24h";
|
|
49
|
+
metadata?: Record<string, string>;
|
|
50
|
+
previous_response_id?: string;
|
|
51
|
+
store?: boolean;
|
|
52
|
+
max_output_tokens?: number;
|
|
53
|
+
temperature?: number;
|
|
54
|
+
top_p?: number;
|
|
55
|
+
text?: ResponseCreateParamsStreaming["text"];
|
|
56
|
+
service_tier?: ResponseCreateParamsStreaming["service_tier"];
|
|
57
|
+
tools?: FunctionTool[];
|
|
58
|
+
tool_choice?: ResponseCreateParamsStreaming["tool_choice"];
|
|
59
|
+
reasoning?: {
|
|
60
|
+
effort: OpenAIApiReasoningEffort;
|
|
61
|
+
} | {
|
|
62
|
+
effort: OpenAIApiReasoningEffort;
|
|
63
|
+
summary: NonNullable<OpenAIResponsesOptions["reasoningSummary"]>;
|
|
64
|
+
};
|
|
65
|
+
include?: string[];
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { ReplayableResponseCompactionItem as a, OpenAIResponsesRequestParams as i, OpenAIResponsesOptions as n, ResponsesPromptObservation as o, OpenAIResponsesReasoningReplayMetadata as r, responsesPromptObserver as s, OPENAI_RESPONSES_APIS as t };
|