mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
refactor(github-copilot): narrow runtime facade (#120544)
* refactor(github-copilot): narrow runtime facade * style(github-copilot): format runtime exports
This commit is contained in:
committed by
GitHub
parent
97b564e81c
commit
10c7f005be
@@ -22,7 +22,6 @@ import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { runGitHubCopilotDeviceFlow } from "./login.js";
|
||||
|
||||
const mocks = vi.hoisted(() => ({
|
||||
githubCopilotLoginCommand: vi.fn(),
|
||||
fetchWithSsrFGuard: vi.fn<typeof fetchWithSsrFGuard>(async (params) => ({
|
||||
response: await fetch(params.url, params.init),
|
||||
finalUrl: params.url,
|
||||
@@ -50,7 +49,6 @@ vi.mock("./register.runtime.js", () => ({
|
||||
DEFAULT_COPILOT_API_BASE_URL: "https://api.githubcopilot.test",
|
||||
resolveCopilotRuntimeAuth: mocks.resolveCopilotRuntimeAuth,
|
||||
resolveCopilotStarterModel: mocks.resolveCopilotStarterModel,
|
||||
githubCopilotLoginCommand: mocks.githubCopilotLoginCommand,
|
||||
fetchCopilotUsage: vi.fn(),
|
||||
}));
|
||||
|
||||
@@ -663,7 +661,6 @@ describe("github-copilot plugin", () => {
|
||||
message: "GitHub Copilot auth already exists. Re-run login?",
|
||||
initialValue: false,
|
||||
});
|
||||
expect(mocks.githubCopilotLoginCommand).not.toHaveBeenCalled();
|
||||
expect(result).toEqual({
|
||||
profiles: [
|
||||
{
|
||||
@@ -1012,7 +1009,6 @@ describe("github-copilot plugin", () => {
|
||||
message: "GitHub Copilot auth already exists. Re-run login?",
|
||||
initialValue: false,
|
||||
});
|
||||
expect(mocks.githubCopilotLoginCommand).not.toHaveBeenCalled();
|
||||
if (!result) {
|
||||
throw new Error("Expected GitHub Copilot auth result");
|
||||
}
|
||||
@@ -1287,7 +1283,6 @@ describe("github-copilot plugin", () => {
|
||||
message: "GitHub Copilot auth already exists. Re-run login?",
|
||||
initialValue: false,
|
||||
});
|
||||
expect(mocks.githubCopilotLoginCommand).not.toHaveBeenCalled();
|
||||
expect(result.profiles[0]?.credential).toEqual({
|
||||
type: "token",
|
||||
provider: "github-copilot",
|
||||
|
||||
@@ -1,27 +1,6 @@
|
||||
// Github Copilot plugin module implements register behavior.
|
||||
import {
|
||||
coerceSecretRef,
|
||||
ensureAuthProfileStore,
|
||||
listProfilesForProvider,
|
||||
} from "openclaw/plugin-sdk/provider-auth";
|
||||
import { githubCopilotLoginCommand } from "./login.js";
|
||||
import { PROVIDER_ID, resolveCopilotForwardCompatModel } from "./models.js";
|
||||
import { DEFAULT_COPILOT_API_BASE_URL, resolveCopilotRuntimeAuth } from "./runtime-auth.js";
|
||||
import { resolveCopilotStarterModel } from "./starter-model.js";
|
||||
import { wrapCopilotAnthropicStream, wrapCopilotProviderStream } from "./stream.js";
|
||||
import { fetchCopilotUsage } from "./usage.js";
|
||||
export { DEFAULT_COPILOT_API_BASE_URL } from "./runtime-auth.js";
|
||||
export { resolveCopilotRuntimeAuth } from "./runtime-auth.js";
|
||||
|
||||
export {
|
||||
coerceSecretRef,
|
||||
DEFAULT_COPILOT_API_BASE_URL,
|
||||
ensureAuthProfileStore,
|
||||
fetchCopilotUsage,
|
||||
githubCopilotLoginCommand,
|
||||
listProfilesForProvider,
|
||||
PROVIDER_ID,
|
||||
resolveCopilotRuntimeAuth,
|
||||
resolveCopilotStarterModel,
|
||||
resolveCopilotForwardCompatModel,
|
||||
wrapCopilotAnthropicStream,
|
||||
wrapCopilotProviderStream,
|
||||
};
|
||||
export { resolveCopilotStarterModel } from "./starter-model.js";
|
||||
export { fetchCopilotUsage } from "./usage.js";
|
||||
|
||||
Reference in New Issue
Block a user