@xiaoso/dsh-tool-plus 0.1.0-beta.2 → 0.1.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +122 -0
- package/README.md +3 -2
- package/THIRD_PARTY_NOTICES.md +4 -35
- package/lib/abort-B7izMMna.mjs +51 -0
- package/lib/amazon-bedrock-D-shAr1X.mjs +917 -0
- package/lib/anthropic-BWsZFzU8.mjs +262 -0
- package/lib/anthropic-CMT1Qj1t.mjs +3115 -0
- package/lib/api-key-login-CpzSezsi.mjs +157 -0
- package/lib/aws-credentials-8Mgn5MAy.mjs +867 -0
- package/lib/azure-openai-responses-CNkHiLUh.mjs +274 -0
- package/lib/bun-shim.mjs +172 -7
- package/lib/bundled-references-CSuBco5p.mjs +55 -0
- package/lib/callback-server-BEFNf-jf.mjs +398 -0
- package/lib/client.js +110 -40
- package/lib/cursor-BIQfBC6V.mjs +135 -0
- package/lib/cursor-DNk6eXDd.mjs +5470 -0
- package/lib/cursor-MjSm74IJ.mjs +273 -0
- package/lib/device-code-OI_tQcmc.mjs +51 -0
- package/lib/devin-CldyPD8K.mjs +95 -0
- package/lib/devin-CzRpTUOA.mjs +114 -0
- package/lib/devin-DXOeNyU7.mjs +542 -0
- package/lib/error-B3bevhrs.mjs +1449 -0
- package/lib/event-stream-BDPi64mK.mjs +151 -0
- package/lib/github-copilot-4GaMtQmg.mjs +208 -0
- package/lib/github-copilot-B2HGSIJK.mjs +104 -0
- package/lib/gitlab-duo-akICyfeD.mjs +155 -0
- package/lib/gitlab-duo-workflow-CSEgYk3N.mjs +91 -0
- package/lib/google-antigravity-Dlkdhahq.mjs +198 -0
- package/lib/google-auth-DhqpOYrX.mjs +232 -0
- package/lib/google-gemini-cli-BG_LRdIV.mjs +850 -0
- package/lib/google-gemini-cli-zJhiOcND.mjs +211 -0
- package/lib/google-oauth-shared-CwNWYdmR.mjs +147 -0
- package/lib/google-shared-DzhCb9b0.mjs +760 -0
- package/lib/google-vertex-kscbkyRb.mjs +99 -0
- package/lib/google-zyDOG9x7.mjs +30 -0
- package/lib/identity-DnB63pS7.mjs +219 -0
- package/lib/idle-iterator-C6XbWcuB.mjs +366 -0
- package/lib/index.mjs +2865 -2745
- package/lib/kimi-DMVI-zrZ.mjs +236 -0
- package/lib/markit-M0jhziqU.mjs +1417 -0
- package/lib/minimax-code-BK-3eBbz.mjs +53 -0
- package/lib/models-CfT4coYT.mjs +104660 -0
- package/lib/ollama-BQMGPxtV.mjs +589 -0
- package/lib/openai-codex-CQL_kvYL.mjs +255 -0
- package/lib/openai-codex-responses-Cz-2qpC7.mjs +3144 -0
- package/lib/openai-completions-i8doczAk.mjs +1360 -0
- package/lib/openai-reasoning-fallback-DGVVLgd1.mjs +286 -0
- package/lib/openai-responses-DTkBiiy-.mjs +867 -0
- package/lib/opencode-DaJjcUbf.mjs +38 -0
- package/lib/perplexity-9b-RQ0mV.mjs +194 -0
- package/lib/proxy-ZtUcl6r5.mjs +190 -0
- package/lib/scrapers-CL-WgdU1.mjs +9198 -0
- package/lib/scrapers-CipyKyCH.mjs +9198 -0
- package/lib/scrapers-DGfrYhtw.mjs +9198 -0
- package/lib/scrapers-DSUPYoUF.mjs +9198 -0
- package/lib/scrapers-DZ2GXmp7.mjs +9198 -0
- package/lib/src-DTid0g4K.mjs +5001 -0
- package/lib/stream-C_RAoxJC.mjs +10236 -0
- package/lib/stream-markup-healing-2toHXWXM.mjs +491 -0
- package/lib/types/client/locales.d.ts +1 -1
- package/lib/types/config/fields.d.ts +1 -1
- package/lib/types/config/settings.d.ts +16 -2
- package/lib/types/tools/omp/sdk.d.ts +6 -0
- package/lib/types/tools/omp/tools/fetch.d.ts +2 -0
- package/lib/types/tools/omp/tools/read.d.ts +2 -8
- package/lib/types/tools/omp/utils/image-loading.d.ts +10 -36
- package/lib/types/tools/read/adapter/index.d.ts +4 -1
- package/lib/types/tools/read-image/index.d.ts +4 -0
- package/lib/types/tools/shared/bun-shim.d.ts +35 -3
- package/lib/types/tools/shared/image-bridge.d.ts +98 -0
- package/lib/types/tools/shared/omp-prompt.d.ts +4 -2
- package/lib/utils-2Wq2eATG.mjs +8119 -0
- package/lib/utils-BnX8O3vi.mjs +12303 -0
- package/lib/utils-CE8N8P4Q.mjs +12315 -0
- package/lib/utils-C_MrQ_0z.mjs +12301 -0
- package/lib/utils-D0Z1fyoO.mjs +12299 -0
- package/lib/utils-DppGHXQB.mjs +51 -0
- package/lib/utils-W8WdSBpX.mjs +12315 -0
- package/lib/vision-guard-BDD4OrKo.mjs +92 -0
- package/lib/wafer-DRU0EjZX.mjs +17 -0
- package/lib/xai-oauth-DPHDXKD7.mjs +446 -0
- package/lib/xiaomi-Dd87KSg5.mjs +157 -0
- package/lib/zai-CFeOt-53.mjs +203 -0
- package/lib/zip-D6QXpvaJ.mjs +1316 -0
- package/package.json +14 -10
- package/presets/package.json +1 -1
- package/presets/tool-plus-ptc/preset.yml +1 -1
- package/presets/tool-plus-standard/preset.yml +1 -1
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { installBunShim as __installBunShim } from "./bun-shim.mjs";
|
|
2
|
+
__installBunShim();
|
|
3
|
+
import { o as readSseJson } from "./src-DTid0g4K.mjs";
|
|
4
|
+
import { B as OpenAIHttpError, G as fetchWithRetry, W as extractHttpStatusFromError, s as ProviderResponseError } from "./error-B3bevhrs.mjs";
|
|
5
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/utils/openai-http.ts
|
|
6
|
+
/**
|
|
7
|
+
* JSON-POST → SSE transport for OpenAI-wire streaming endpoints (chat
|
|
8
|
+
* completions, responses, azure responses). Replaces the `openai` SDK client:
|
|
9
|
+
*
|
|
10
|
+
* - Retries: `fetchWithRetry` (Retry-After/quota-hint aware; 5xx/408/429 and
|
|
11
|
+
* transient network errors). Default 6 total attempts — parity with the
|
|
12
|
+
* SDK's former `maxRetries: 5`.
|
|
13
|
+
* - SSE decode: `readSseJson` (spec-compliant framing, `[DONE]`-aware).
|
|
14
|
+
* `onSseEvent` observers now receive real wire frames instead of events
|
|
15
|
+
* re-synthesized from decoded SDK objects.
|
|
16
|
+
* - Errors: {@link OpenAIHttpError} exposes `status`/`headers`/`code`
|
|
17
|
+
* structurally (ProviderHttpError contract — `extractHttpStatusFromError`,
|
|
18
|
+
* retry-after extraction, copilot transient classification) and carries the
|
|
19
|
+
* captured response body for the strict-tools fallback and the responses
|
|
20
|
+
* chain-state detectors, which regex over `error.message`.
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* Total attempts (initial + retries). Parity with the removed SDK clients'
|
|
24
|
+
* `maxRetries: 5`, i.e. 6 requests. Callers arming a first-event watchdog
|
|
25
|
+
* stay bounded: the watchdog aborts the request `signal`, which
|
|
26
|
+
* `fetchWithRetry` races on every attempt and every backoff sleep, so
|
|
27
|
+
* transient 408/429/5xx retries can never extend the caller's deadline.
|
|
28
|
+
*/
|
|
29
|
+
const DEFAULT_MAX_ATTEMPTS = 6;
|
|
30
|
+
/** Bound the `Error.message` allocation for proxy HTML error pages and the like. */
|
|
31
|
+
const MAX_DETAIL_CHARS = 4096;
|
|
32
|
+
/**
|
|
33
|
+
* POST a JSON body and stream back decoded SSE events.
|
|
34
|
+
*
|
|
35
|
+
* Throws {@link OpenAIHttpError} on a non-2xx terminal response. Aborts on
|
|
36
|
+
* `signal` propagate from `fetchWithRetry`/`readSseJson`; callers own the
|
|
37
|
+
* watchdog timers and abort-reason bookkeeping.
|
|
38
|
+
*/
|
|
39
|
+
async function postOpenAIStream(init) {
|
|
40
|
+
const response = await fetchWithRetry(init.url, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "application/json",
|
|
44
|
+
Accept: "text/event-stream",
|
|
45
|
+
...init.headers
|
|
46
|
+
},
|
|
47
|
+
body: JSON.stringify(init.body),
|
|
48
|
+
signal: init.signal,
|
|
49
|
+
fetch: init.fetch,
|
|
50
|
+
maxAttempts: DEFAULT_MAX_ATTEMPTS,
|
|
51
|
+
timeout: false
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) throw await captureOpenAIHttpError(response);
|
|
54
|
+
if (!response.body) throw new ProviderResponseError(`OpenAI stream response has no body (status ${response.status})`, { kind: "envelope" });
|
|
55
|
+
return {
|
|
56
|
+
events: readSseJson(response.body, init.signal, init.onSseEvent),
|
|
57
|
+
response,
|
|
58
|
+
requestId: response.headers.get("x-request-id")
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Decode a non-2xx response into an {@link OpenAIHttpError} without consuming it twice. */
|
|
62
|
+
async function captureOpenAIHttpError(response) {
|
|
63
|
+
let bodyText;
|
|
64
|
+
let bodyJson;
|
|
65
|
+
try {
|
|
66
|
+
bodyText = await response.text();
|
|
67
|
+
if (bodyText.trim().length > 0) try {
|
|
68
|
+
bodyJson = JSON.parse(bodyText);
|
|
69
|
+
} catch {}
|
|
70
|
+
else bodyText = void 0;
|
|
71
|
+
} catch {}
|
|
72
|
+
const captured = {
|
|
73
|
+
status: response.status,
|
|
74
|
+
headers: response.headers,
|
|
75
|
+
bodyText,
|
|
76
|
+
bodyJson
|
|
77
|
+
};
|
|
78
|
+
const { detail, code } = OpenAIHttpError.parseEnvelope(bodyJson, bodyText);
|
|
79
|
+
const message = detail ? `${response.status} ${detail.length > MAX_DETAIL_CHARS ? detail.slice(0, MAX_DETAIL_CHARS) : detail}` : `${response.status} status code (no body)`;
|
|
80
|
+
return new OpenAIHttpError(message, captured, code);
|
|
81
|
+
}
|
|
82
|
+
//#endregion
|
|
83
|
+
//#region node_modules/.pnpm/@oh-my-pi+pi-ai@17.3.5/node_modules/@oh-my-pi/pi-ai/src/providers/openai-reasoning-fallback.ts
|
|
84
|
+
const ENABLED_REASONING_VALUES = [
|
|
85
|
+
"minimal",
|
|
86
|
+
"low",
|
|
87
|
+
"medium",
|
|
88
|
+
"high",
|
|
89
|
+
"xhigh",
|
|
90
|
+
"max"
|
|
91
|
+
];
|
|
92
|
+
const KNOWN_REASONING_VALUE = {
|
|
93
|
+
none: true,
|
|
94
|
+
minimal: true,
|
|
95
|
+
low: true,
|
|
96
|
+
medium: true,
|
|
97
|
+
high: true,
|
|
98
|
+
xhigh: true,
|
|
99
|
+
max: true
|
|
100
|
+
};
|
|
101
|
+
const REASONING_VALUE_RANK = {
|
|
102
|
+
minimal: 0,
|
|
103
|
+
low: 1,
|
|
104
|
+
medium: 2,
|
|
105
|
+
high: 3,
|
|
106
|
+
xhigh: 4,
|
|
107
|
+
max: 5
|
|
108
|
+
};
|
|
109
|
+
/** @internal */
|
|
110
|
+
function createOpenAIReasoningEffortFallbackState() {
|
|
111
|
+
return { reasoningEffortFallbacks: /* @__PURE__ */ new Map() };
|
|
112
|
+
}
|
|
113
|
+
/** @internal */
|
|
114
|
+
function clearOpenAIReasoningEffortFallbackState(state) {
|
|
115
|
+
state.reasoningEffortFallbacks.clear();
|
|
116
|
+
}
|
|
117
|
+
/** @internal */
|
|
118
|
+
function getOpenAIReasoningEffortFallback(state, key) {
|
|
119
|
+
return state?.reasoningEffortFallbacks.get(key);
|
|
120
|
+
}
|
|
121
|
+
/** @internal */
|
|
122
|
+
function rememberOpenAIReasoningEffortFallback(state, key, fallback) {
|
|
123
|
+
state?.reasoningEffortFallbacks.set(key, fallback);
|
|
124
|
+
}
|
|
125
|
+
/** @internal */
|
|
126
|
+
function createOpenAIReasoningEffortFallbackKey(endpoint, baseUrl, wireModelId) {
|
|
127
|
+
return `${endpoint}:${baseUrl ?? ""}:${wireModelId ?? ""}`;
|
|
128
|
+
}
|
|
129
|
+
function isRecord(value) {
|
|
130
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
131
|
+
}
|
|
132
|
+
/** @internal */
|
|
133
|
+
function readOpenAIReasoningEffort(params) {
|
|
134
|
+
if (!isRecord(params)) return void 0;
|
|
135
|
+
if (typeof params.reasoning_effort === "string") return params.reasoning_effort;
|
|
136
|
+
const reasoning = params.reasoning;
|
|
137
|
+
return isRecord(reasoning) && typeof reasoning.effort === "string" ? reasoning.effort : void 0;
|
|
138
|
+
}
|
|
139
|
+
function deleteReasoningEffort(reasoning, parent) {
|
|
140
|
+
if (typeof reasoning.effort !== "string") return false;
|
|
141
|
+
delete reasoning.effort;
|
|
142
|
+
for (const key in reasoning) if (key !== "effort") return true;
|
|
143
|
+
delete parent.reasoning;
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
/** @internal */
|
|
147
|
+
function applyOpenAIReasoningEffortFallback(params, fallback) {
|
|
148
|
+
if (!isRecord(params)) return false;
|
|
149
|
+
let changed = false;
|
|
150
|
+
if (typeof params.reasoning_effort === "string") {
|
|
151
|
+
if (fallback === null) delete params.reasoning_effort;
|
|
152
|
+
else params.reasoning_effort = fallback;
|
|
153
|
+
changed = true;
|
|
154
|
+
}
|
|
155
|
+
const reasoning = params.reasoning;
|
|
156
|
+
if (isRecord(reasoning) && typeof reasoning.effort === "string") {
|
|
157
|
+
if (fallback === null) changed = deleteReasoningEffort(reasoning, params) || changed;
|
|
158
|
+
else {
|
|
159
|
+
reasoning.effort = fallback;
|
|
160
|
+
changed = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return changed;
|
|
164
|
+
}
|
|
165
|
+
function capturedStringField(captured, field) {
|
|
166
|
+
const body = isRecord(captured?.bodyJson) ? captured.bodyJson : void 0;
|
|
167
|
+
const error = isRecord(body?.error) ? body.error : void 0;
|
|
168
|
+
if (typeof error?.[field] === "string") return error[field];
|
|
169
|
+
return typeof body?.[field] === "string" ? body[field] : void 0;
|
|
170
|
+
}
|
|
171
|
+
function collectMessageParts(error, captured) {
|
|
172
|
+
return [
|
|
173
|
+
error instanceof Error ? error.message : void 0,
|
|
174
|
+
capturedStringField(captured, "message"),
|
|
175
|
+
capturedStringField(captured, "param"),
|
|
176
|
+
capturedStringField(captured, "code"),
|
|
177
|
+
capturedStringField(captured, "type"),
|
|
178
|
+
captured?.bodyText
|
|
179
|
+
].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n");
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Text that identifies a 400 as being about the reasoning-effort field.
|
|
183
|
+
* OpenAI-compatible gateways (cliproxy, …) never name the field — they reject
|
|
184
|
+
* the value alone with `level "none" not supported, valid levels: low, …` — so
|
|
185
|
+
* the allowed-level phrasing counts as a mention too.
|
|
186
|
+
*/
|
|
187
|
+
const REASONING_EFFORT_FIELD_PATTERN = /reasoning[_. ]effort|reasoning value|(?:valid|supported|allowed) levels?/i;
|
|
188
|
+
function mentionsReasoningEffort(error, captured) {
|
|
189
|
+
const param = capturedStringField(captured, "param");
|
|
190
|
+
const code = capturedStringField(captured, "code");
|
|
191
|
+
const type = capturedStringField(captured, "type");
|
|
192
|
+
const message = collectMessageParts(error, captured);
|
|
193
|
+
return REASONING_EFFORT_FIELD_PATTERN.test(param ?? "") || REASONING_EFFORT_FIELD_PATTERN.test(code ?? "") || REASONING_EFFORT_FIELD_PATTERN.test(type ?? "") || REASONING_EFFORT_FIELD_PATTERN.test(message);
|
|
194
|
+
}
|
|
195
|
+
function isInvalidReasoningEffortError(error, captured, currentEffort) {
|
|
196
|
+
const status = extractHttpStatusFromError(error) ?? captured?.status;
|
|
197
|
+
if (status !== 400 && status !== 422) return false;
|
|
198
|
+
if (!mentionsReasoningEffort(error, captured)) return false;
|
|
199
|
+
const message = collectMessageParts(error, captured);
|
|
200
|
+
if (/reasoning[_ ]content/i.test(message) && !REASONING_EFFORT_FIELD_PATTERN.test(message)) return false;
|
|
201
|
+
if (/invalid[^\n]*(?:reasoning[_. ]effort|reasoning value)/i.test(message)) return true;
|
|
202
|
+
if (/(?:reasoning[_. ]effort|reasoning value)[^\n]*(?:invalid|unsupported|not supported|must be|expected)/i.test(message)) return true;
|
|
203
|
+
if (/(?:unsupported|not supported)[^\n]*(?:reasoning[_. ]effort|reasoning value)/i.test(message)) return true;
|
|
204
|
+
const quoted = `["'\`]${escapeRegExp(currentEffort)}["'\`]`;
|
|
205
|
+
return new RegExp(`(?:invalid|unsupported|not supported)[^\\n]*${quoted}`, "i").test(message) || new RegExp(`${quoted}[^\\n]*(?:invalid|unsupported|not supported)`, "i").test(message);
|
|
206
|
+
}
|
|
207
|
+
function escapeRegExp(value) {
|
|
208
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
209
|
+
}
|
|
210
|
+
function parseKnownReasoningValues(text) {
|
|
211
|
+
const values = /* @__PURE__ */ new Set();
|
|
212
|
+
const quotedPattern = /["'`](none|minimal|low|medium|high|xhigh|max)["'`]/gi;
|
|
213
|
+
let quotedMatch = quotedPattern.exec(text);
|
|
214
|
+
while (quotedMatch !== null) {
|
|
215
|
+
values.add(quotedMatch[1].toLowerCase());
|
|
216
|
+
quotedMatch = quotedPattern.exec(text);
|
|
217
|
+
}
|
|
218
|
+
const allowedMatch = /(?:must be|one of|allowed values?|supported values?(?: are)?|expected|(?:valid|supported|allowed) levels?(?: are)?)[^.\n]+/i.exec(text);
|
|
219
|
+
if (allowedMatch) {
|
|
220
|
+
const allowedText = allowedMatch[0];
|
|
221
|
+
const barePattern = /\b(none|minimal|low|medium|high|xhigh|max)\b/gi;
|
|
222
|
+
let bareMatch = barePattern.exec(allowedText);
|
|
223
|
+
while (bareMatch !== null) {
|
|
224
|
+
values.add(bareMatch[1].toLowerCase());
|
|
225
|
+
bareMatch = barePattern.exec(allowedText);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return values;
|
|
229
|
+
}
|
|
230
|
+
function parseAllowedReasoningValues(message, currentEffort) {
|
|
231
|
+
const values = parseKnownReasoningValues(message);
|
|
232
|
+
const hasAllowedCue = /must be|one of|allowed values?|supported values?|expected|(?:valid|supported|allowed) levels?/i.test(message);
|
|
233
|
+
values.delete(currentEffort.toLowerCase());
|
|
234
|
+
if (!hasAllowedCue && values.size === 0) return void 0;
|
|
235
|
+
return values;
|
|
236
|
+
}
|
|
237
|
+
function orderedEnabledAllowedValues(allowed) {
|
|
238
|
+
return ENABLED_REASONING_VALUES.filter((value) => allowed.has(value));
|
|
239
|
+
}
|
|
240
|
+
function lowestEnabledAllowedValue(allowed) {
|
|
241
|
+
for (const value of ENABLED_REASONING_VALUES) if (allowed.has(value)) return value;
|
|
242
|
+
}
|
|
243
|
+
function nearestEnabledReasoningFallback(currentEffort, allowed) {
|
|
244
|
+
const current = currentEffort.toLowerCase();
|
|
245
|
+
const allowedEnabled = orderedEnabledAllowedValues(allowed);
|
|
246
|
+
if (allowedEnabled.length === 0) return void 0;
|
|
247
|
+
if (current === "minimal" && allowedEnabled.includes("low")) return "low";
|
|
248
|
+
if (current === "xhigh" && allowedEnabled.includes("max")) return "max";
|
|
249
|
+
if (current === "xhigh" && allowedEnabled.includes("high")) return "high";
|
|
250
|
+
if (current === "max" && allowedEnabled.includes("xhigh")) return "xhigh";
|
|
251
|
+
const currentRank = REASONING_VALUE_RANK[current];
|
|
252
|
+
if (currentRank === void 0) return void 0;
|
|
253
|
+
let best;
|
|
254
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
255
|
+
let bestRank = Number.NEGATIVE_INFINITY;
|
|
256
|
+
for (const candidate of allowedEnabled) {
|
|
257
|
+
if (candidate === current) continue;
|
|
258
|
+
const candidateRank = REASONING_VALUE_RANK[candidate];
|
|
259
|
+
if (candidateRank === void 0) continue;
|
|
260
|
+
const distance = Math.abs(candidateRank - currentRank);
|
|
261
|
+
if (distance < bestDistance || distance === bestDistance && candidateRank > bestRank) {
|
|
262
|
+
best = candidate;
|
|
263
|
+
bestDistance = distance;
|
|
264
|
+
bestRank = candidateRank;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return best;
|
|
268
|
+
}
|
|
269
|
+
/** @internal */
|
|
270
|
+
function resolveOpenAIReasoningEffortFallback(error, captured, params, options) {
|
|
271
|
+
const currentEffort = readOpenAIReasoningEffort(params);
|
|
272
|
+
if (!currentEffort || !KNOWN_REASONING_VALUE[currentEffort.toLowerCase()]) return void 0;
|
|
273
|
+
if (!isInvalidReasoningEffortError(error, captured, currentEffort)) return void 0;
|
|
274
|
+
const allowed = parseAllowedReasoningValues(collectMessageParts(error, captured), currentEffort);
|
|
275
|
+
const normalizedCurrent = currentEffort.toLowerCase();
|
|
276
|
+
if (allowed === void 0) return null;
|
|
277
|
+
if (options?.explicitDisable) {
|
|
278
|
+
if (normalizedCurrent !== "none" && allowed.has("none")) return "none";
|
|
279
|
+
const fallback = lowestEnabledAllowedValue(allowed);
|
|
280
|
+
return fallback && fallback !== normalizedCurrent ? fallback : null;
|
|
281
|
+
}
|
|
282
|
+
if (normalizedCurrent === "none") return null;
|
|
283
|
+
return nearestEnabledReasoningFallback(normalizedCurrent, allowed) ?? null;
|
|
284
|
+
}
|
|
285
|
+
//#endregion
|
|
286
|
+
export { getOpenAIReasoningEffortFallback as a, postOpenAIStream as c, createOpenAIReasoningEffortFallbackState as i, clearOpenAIReasoningEffortFallbackState as n, rememberOpenAIReasoningEffortFallback as o, createOpenAIReasoningEffortFallbackKey as r, resolveOpenAIReasoningEffortFallback as s, applyOpenAIReasoningEffortFallback as t };
|