copilot-api-plus 1.2.54 → 1.2.56

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/main.js CHANGED
@@ -2316,6 +2316,20 @@ async function tryDowngradeReasoningEffort(errMsg, retryContext, accountId) {
2316
2316
  return null;
2317
2317
  }
2318
2318
  }
2319
+ /** Strip reasoning params and retry when tools + reasoning_effort conflict. */
2320
+ async function tryStripReasoningForTools(errMsg, retryContext, accountId) {
2321
+ if (!errMsg.includes("Function tools") || !errMsg.includes("reasoning_effort")) return null;
2322
+ reasoningWithToolsUnsupported.add(retryContext.payload.model);
2323
+ consola.debug(`Model "${retryContext.payload.model}" does not support tools + reasoning_effort — stripped for future requests`);
2324
+ const stripped = { ...retryContext.payload };
2325
+ delete stripped.reasoning_effort;
2326
+ delete stripped.thinking_budget;
2327
+ try {
2328
+ return await doFetch(stripped, retryContext.tokenSource, accountId);
2329
+ } catch {
2330
+ return null;
2331
+ }
2332
+ }
2319
2333
  /**
2320
2334
  * Whether a 400 error is caused by the request itself (model unavailable,
2321
2335
  * invalid params, etc.) rather than the account. These should NOT trigger
@@ -2356,6 +2370,8 @@ async function handleMultiAccountHttpError(error, account, retryContext) {
2356
2370
  if (error.response.status === 400) {
2357
2371
  const downgraded = await tryDowngradeReasoningEffort(error.message, retryContext, account.id);
2358
2372
  if (downgraded !== null) return downgraded;
2373
+ const toolsConflict = await tryStripReasoningForTools(error.message, retryContext, account.id);
2374
+ if (toolsConflict !== null) return toolsConflict;
2359
2375
  if (isNonAccountError(error.message)) {
2360
2376
  error.__nonAccountError = true;
2361
2377
  return null;