Files
openclaw/extensions/github-copilot/provider-policy-api.ts
Rain 110eb787a1 fix(github-copilot): preserve catalog thinking efforts in requests (#107834)
* fix(github-copilot): preserve catalog thinking efforts in requests

Unify discovered and bundled capability mapping with the provider thinking policy. Preserve supported xhigh/max Responses efforts and map minimal to the supported low minimum, while respecting explicit account opt-outs and transport limits.

Fixes #107792

Co-authored-by: Pluviobyte <Pluviobyte@users.noreply.github.com>

* fix(github-copilot): resolve nullable thinking policy transport

Accept the public policy API context and resolve missing transports before enforcing Claude and Gemini effort restrictions. Cover undefined and null API values without changing explicit Responses routes.

* refactor(github-copilot): normalize manifest models as one catalog

Use the canonical batch model provider builder after the single-row helper was removed on main. Preserve model transport and compatibility decoration without a legacy API shim.

* refactor(github-copilot): decorate owned catalog rows in place

Keep the normalized manifest batch as the sole owner of runtime rows and apply transport metadata directly, avoiding redundant row copies.

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
Co-authored-by: Pluviobyte <Pluviobyte@users.noreply.github.com>
2026-08-26 21:09:21 -07:00

27 lines
859 B
TypeScript

// Github Copilot API module exposes the plugin public contract.
import type { ProviderDefaultThinkingPolicyContext } from "openclaw/plugin-sdk/core";
import { resolveCopilotThinkingLevelMap } from "./model-metadata.js";
export function resolveThinkingProfile(context: ProviderDefaultThinkingPolicyContext) {
if (context.provider.trim().toLowerCase() !== "github-copilot") {
return null;
}
const thinkingLevelMap = resolveCopilotThinkingLevelMap(
context.modelId,
context.compat,
context.api,
);
const extendedLevels = (["xhigh", "max"] as const).filter((id) => thinkingLevelMap?.[id]);
return {
levels: [
{ id: "off" as const },
{ id: "minimal" as const },
{ id: "low" as const },
{ id: "medium" as const },
{ id: "high" as const },
...extendedLevels.map((id) => ({ id })),
],
};
}