copilot-api-plus 1.4.0 → 1.4.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/main.js +20 -8
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -3206,6 +3206,10 @@ function sanitizeForCopilotBackend(payload) {
|
|
|
3206
3206
|
delete extended.context_management;
|
|
3207
3207
|
}
|
|
3208
3208
|
sanitizeOutputConfigFormat(extended.output_config?.format);
|
|
3209
|
+
if (payload.effort !== void 0) {
|
|
3210
|
+
consola.debug("Stripping effort field (unsupported by Copilot backend)");
|
|
3211
|
+
delete payload.effort;
|
|
3212
|
+
}
|
|
3209
3213
|
}
|
|
3210
3214
|
function sanitizeOutputConfigFormat(format) {
|
|
3211
3215
|
if (!isRecord(format) || format.type !== "json_schema") return;
|
|
@@ -3240,19 +3244,24 @@ function normalizeAdaptiveThinkingForCopilot(payload) {
|
|
|
3240
3244
|
}
|
|
3241
3245
|
/**
|
|
3242
3246
|
* If the client did not specify a `thinking` field, inject the maximum
|
|
3243
|
-
* thinking
|
|
3247
|
+
* thinking depth the model supports — pulled from Copilot's `/models`
|
|
3244
3248
|
* capabilities. Mutates in place.
|
|
3245
3249
|
*
|
|
3246
|
-
* - Models with `adaptive_thinking: true` (
|
|
3247
|
-
*
|
|
3248
|
-
*
|
|
3249
|
-
*
|
|
3250
|
+
* - Models with `adaptive_thinking: true` (Claude Opus 4.7,
|
|
3251
|
+
* Sonnet 4.6, etc.) get `{ type: "adaptive", budget_tokens: max }`.
|
|
3252
|
+
* Per Anthropic 2026 docs, `effort` is the recommended control
|
|
3253
|
+
* for thinking depth on adaptive models — but Copilot's `/v1/messages`
|
|
3254
|
+
* mirror rejects the top-level `effort` field with a 400. The
|
|
3255
|
+
* `budget_tokens` hint on adaptive thinking is documented as still
|
|
3256
|
+
* accepted, and serves as a softer nudge that keeps the model from
|
|
3257
|
+
* skipping thinking entirely on simple prompts.
|
|
3250
3258
|
* - Other thinking-capable models get
|
|
3251
3259
|
* `{ type: "enabled", budget_tokens: max_thinking_budget }`.
|
|
3252
3260
|
* - Models without thinking capability are left untouched.
|
|
3253
3261
|
*
|
|
3254
3262
|
* Skipped if the client already specified `thinking` (any value) — we
|
|
3255
|
-
* always defer to explicit client intent.
|
|
3263
|
+
* always defer to explicit client intent. Also skipped when the runtime
|
|
3264
|
+
* `state.maxThinking` kill switch is off.
|
|
3256
3265
|
*/
|
|
3257
3266
|
function injectMaxThinkingBudget(payload) {
|
|
3258
3267
|
if (!state.maxThinking) return;
|
|
@@ -3262,8 +3271,11 @@ function injectMaxThinkingBudget(payload) {
|
|
|
3262
3271
|
const maxBudget = supports.max_thinking_budget;
|
|
3263
3272
|
if (!maxBudget || maxBudget <= 0) return;
|
|
3264
3273
|
if (supports.adaptive_thinking === true) {
|
|
3265
|
-
payload.thinking = {
|
|
3266
|
-
|
|
3274
|
+
payload.thinking = {
|
|
3275
|
+
type: "adaptive",
|
|
3276
|
+
budget_tokens: maxBudget
|
|
3277
|
+
};
|
|
3278
|
+
consola.debug(`Injected adaptive thinking budget=${maxBudget} for ${payload.model} (no client preference)`);
|
|
3267
3279
|
return;
|
|
3268
3280
|
}
|
|
3269
3281
|
payload.thinking = {
|