Skip to content

Commit 10c7f00

Browse files
authored
refactor(github-copilot): narrow runtime facade (#120544)
* refactor(github-copilot): narrow runtime facade * style(github-copilot): format runtime exports
1 parent 97b564e commit 10c7f00

2 files changed

Lines changed: 4 additions & 30 deletions

File tree

‎extensions/github-copilot/index.test.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { afterAll, afterEach, describe, expect, it, vi } from "vitest";
2222
import { runGitHubCopilotDeviceFlow } from "./login.js";
2323

2424
const mocks = vi.hoisted(() => ({
25-
githubCopilotLoginCommand: vi.fn(),
2625
fetchWithSsrFGuard: vi.fn<typeof fetchWithSsrFGuard>(async (params) => ({
2726
response: await fetch(params.url, params.init),
2827
finalUrl: params.url,
@@ -50,7 +49,6 @@ vi.mock("./register.runtime.js", () => ({
5049
DEFAULT_COPILOT_API_BASE_URL: "https://api.githubcopilot.test",
5150
resolveCopilotRuntimeAuth: mocks.resolveCopilotRuntimeAuth,
5251
resolveCopilotStarterModel: mocks.resolveCopilotStarterModel,
53-
githubCopilotLoginCommand: mocks.githubCopilotLoginCommand,
5452
fetchCopilotUsage: vi.fn(),
5553
}));
5654

@@ -663,7 +661,6 @@ describe("github-copilot plugin", () => {
663661
message: "GitHub Copilot auth already exists. Re-run login?",
664662
initialValue: false,
665663
});
666-
expect(mocks.githubCopilotLoginCommand).not.toHaveBeenCalled();
667664
expect(result).toEqual({
668665
profiles: [
669666
{
@@ -1012,7 +1009,6 @@ describe("github-copilot plugin", () => {
10121009
message: "GitHub Copilot auth already exists. Re-run login?",
10131010
initialValue: false,
10141011
});
1015-
expect(mocks.githubCopilotLoginCommand).not.toHaveBeenCalled();
10161012
if (!result) {
10171013
throw new Error("Expected GitHub Copilot auth result");
10181014
}
@@ -1287,7 +1283,6 @@ describe("github-copilot plugin", () => {
12871283
message: "GitHub Copilot auth already exists. Re-run login?",
12881284
initialValue: false,
12891285
});
1290-
expect(mocks.githubCopilotLoginCommand).not.toHaveBeenCalled();
12911286
expect(result.profiles[0]?.credential).toEqual({
12921287
type: "token",
12931288
provider: "github-copilot",
Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
// Github Copilot plugin module implements register behavior.
2-
import {
3-
coerceSecretRef,
4-
ensureAuthProfileStore,
5-
listProfilesForProvider,
6-
} from "openclaw/plugin-sdk/provider-auth";
7-
import { githubCopilotLoginCommand } from "./login.js";
8-
import { PROVIDER_ID, resolveCopilotForwardCompatModel } from "./models.js";
9-
import { DEFAULT_COPILOT_API_BASE_URL, resolveCopilotRuntimeAuth } from "./runtime-auth.js";
10-
import { resolveCopilotStarterModel } from "./starter-model.js";
11-
import { wrapCopilotAnthropicStream, wrapCopilotProviderStream } from "./stream.js";
12-
import { fetchCopilotUsage } from "./usage.js";
2+
export { DEFAULT_COPILOT_API_BASE_URL } from "./runtime-auth.js";
3+
export { resolveCopilotRuntimeAuth } from "./runtime-auth.js";
134

14-
export {
15-
coerceSecretRef,
16-
DEFAULT_COPILOT_API_BASE_URL,
17-
ensureAuthProfileStore,
18-
fetchCopilotUsage,
19-
githubCopilotLoginCommand,
20-
listProfilesForProvider,
21-
PROVIDER_ID,
22-
resolveCopilotRuntimeAuth,
23-
resolveCopilotStarterModel,
24-
resolveCopilotForwardCompatModel,
25-
wrapCopilotAnthropicStream,
26-
wrapCopilotProviderStream,
27-
};
5+
export { resolveCopilotStarterModel } from "./starter-model.js";
6+
export { fetchCopilotUsage } from "./usage.js";

0 commit comments

Comments
 (0)