copilot-api-plus 1.4.0 → 1.4.1
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 +13 -9
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3240,32 +3240,36 @@ function normalizeAdaptiveThinkingForCopilot(payload) {
|
|
|
3240
3240
|
}
|
|
3241
3241
|
/**
|
|
3242
3242
|
* If the client did not specify a `thinking` field, inject the maximum
|
|
3243
|
-
* thinking
|
|
3243
|
+
* thinking depth the model supports — pulled from Copilot's `/models`
|
|
3244
3244
|
* capabilities. Mutates in place.
|
|
3245
3245
|
*
|
|
3246
|
-
* - Models with `adaptive_thinking: true` (
|
|
3247
|
-
*
|
|
3248
|
-
*
|
|
3249
|
-
*
|
|
3246
|
+
* - Models with `adaptive_thinking: true` (Claude Opus 4.7,
|
|
3247
|
+
* Sonnet 4.6, etc.) get `{ type: "adaptive" }` plus a top-level
|
|
3248
|
+
* `effort: "max"` (or `"xhigh"` for Opus 4.7 long-horizon work).
|
|
3249
|
+
* This matches Anthropic's 2026 API: manual `budget_tokens` on
|
|
3250
|
+
* Opus 4.7 returns 400, and `effort` is the documented control
|
|
3251
|
+
* for thinking depth on adaptive models.
|
|
3250
3252
|
* - Other thinking-capable models get
|
|
3251
3253
|
* `{ type: "enabled", budget_tokens: max_thinking_budget }`.
|
|
3252
3254
|
* - Models without thinking capability are left untouched.
|
|
3253
3255
|
*
|
|
3254
3256
|
* Skipped if the client already specified `thinking` (any value) — we
|
|
3255
|
-
* always defer to explicit client intent.
|
|
3257
|
+
* always defer to explicit client intent. Also skipped when the runtime
|
|
3258
|
+
* `state.maxThinking` kill switch is off.
|
|
3256
3259
|
*/
|
|
3257
3260
|
function injectMaxThinkingBudget(payload) {
|
|
3258
3261
|
if (!state.maxThinking) return;
|
|
3259
3262
|
if (payload.thinking !== void 0) return;
|
|
3260
3263
|
const supports = findModel(payload.model)?.capabilities.supports;
|
|
3261
3264
|
if (!supports) return;
|
|
3262
|
-
const maxBudget = supports.max_thinking_budget;
|
|
3263
|
-
if (!maxBudget || maxBudget <= 0) return;
|
|
3264
3265
|
if (supports.adaptive_thinking === true) {
|
|
3265
3266
|
payload.thinking = { type: "adaptive" };
|
|
3266
|
-
|
|
3267
|
+
if (payload.effort === void 0) payload.effort = "max";
|
|
3268
|
+
consola.debug(`Injected adaptive thinking + effort=${payload.effort} for ${payload.model} (no client preference)`);
|
|
3267
3269
|
return;
|
|
3268
3270
|
}
|
|
3271
|
+
const maxBudget = supports.max_thinking_budget;
|
|
3272
|
+
if (!maxBudget || maxBudget <= 0) return;
|
|
3269
3273
|
payload.thinking = {
|
|
3270
3274
|
type: "enabled",
|
|
3271
3275
|
budget_tokens: maxBudget
|