fix(providers): stabilize runtime normalization hooks

This commit is contained in:
Peter Steinberger
2026-04-04 19:33:30 +01:00
parent e06e36d41a
commit ca200eb480
19 changed files with 196 additions and 126 deletions

View File

@@ -1,4 +1,16 @@
import { definePluginEntry, type ProviderAuthContext } from "openclaw/plugin-sdk/plugin-entry";
import {
coerceSecretRef,
DEFAULT_COPILOT_API_BASE_URL,
ensureAuthProfileStore,
fetchCopilotUsage,
githubCopilotLoginCommand,
listProfilesForProvider,
PROVIDER_ID,
resolveCopilotApiToken,
resolveCopilotForwardCompatModel,
wrapCopilotProviderStream,
} from "./register.runtime.js";
const COPILOT_ENV_VARS = ["COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"];
const COPILOT_XHIGH_MODEL_IDS = ["gpt-5.2", "gpt-5.2-codex"] as const;
@@ -15,19 +27,7 @@ export default definePluginEntry({
id: "github-copilot",
name: "GitHub Copilot Provider",
description: "Bundled GitHub Copilot provider plugin",
async register(api) {
const {
coerceSecretRef,
DEFAULT_COPILOT_API_BASE_URL,
ensureAuthProfileStore,
fetchCopilotUsage,
githubCopilotLoginCommand,
listProfilesForProvider,
PROVIDER_ID,
resolveCopilotApiToken,
resolveCopilotForwardCompatModel,
wrapCopilotProviderStream,
} = await import("./register.runtime.js");
register(api) {
function resolveFirstGithubToken(params: { agentDir?: string; env: NodeJS.ProcessEnv }): {
githubToken: string;
hasProfile: boolean;

View File

@@ -1,10 +1,24 @@
export {
import {
coerceSecretRef,
ensureAuthProfileStore,
listProfilesForProvider,
} from "openclaw/plugin-sdk/provider-auth";
export { githubCopilotLoginCommand } from "openclaw/plugin-sdk/provider-auth-login";
export { PROVIDER_ID, resolveCopilotForwardCompatModel } from "./models.js";
export { wrapCopilotAnthropicStream, wrapCopilotProviderStream } from "./stream.js";
export { DEFAULT_COPILOT_API_BASE_URL, resolveCopilotApiToken } from "./token.js";
export { fetchCopilotUsage } from "./usage.js";
import { githubCopilotLoginCommand } from "openclaw/plugin-sdk/provider-auth-login";
import { PROVIDER_ID, resolveCopilotForwardCompatModel } from "./models.js";
import { wrapCopilotAnthropicStream, wrapCopilotProviderStream } from "./stream.js";
import { DEFAULT_COPILOT_API_BASE_URL, resolveCopilotApiToken } from "./token.js";
import { fetchCopilotUsage } from "./usage.js";
export {
coerceSecretRef,
DEFAULT_COPILOT_API_BASE_URL,
ensureAuthProfileStore,
fetchCopilotUsage,
githubCopilotLoginCommand,
listProfilesForProvider,
PROVIDER_ID,
resolveCopilotApiToken,
resolveCopilotForwardCompatModel,
wrapCopilotAnthropicStream,
wrapCopilotProviderStream,
};