1b9d9d0851
Move bundled models, model cache/manager, thinking metadata, effort helpers, provider descriptors/discovery, wire constants, and model identity utilities into the new @oh-my-pi/pi-catalog package. Update pi-ai to keep provider runtime/auth concerns, move catalog provider metadata into CATALOG_PROVIDERS, and migrate coding-agent, agent, stats, docs, and tests to import catalog values from pi-catalog. Split coding-agent model registry helpers into discovery, roles, and models config modules while preserving registry orchestration. BREAKING CHANGE: @oh-my-pi/pi-ai no longer exports catalog subpaths such as /models, /model-cache, /model-manager, /model-thinking, /effort, /provider-models*, discovery helpers, and provider wire constants; use the matching @oh-my-pi/pi-catalog subpaths instead.
32 lines
1.2 KiB
TypeScript
32 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "bun:test";
|
|
import {
|
|
getGitHubCopilotBaseUrl,
|
|
normalizeGitHubCopilotEnterpriseDomain,
|
|
parseGitHubCopilotApiKey,
|
|
} from "@oh-my-pi/pi-catalog/wire/github-copilot";
|
|
|
|
describe("GitHub Copilot OAuth helpers", () => {
|
|
it("treats github.com as the public Copilot host", () => {
|
|
expect(normalizeGitHubCopilotEnterpriseDomain("github.com")).toBeUndefined();
|
|
expect(normalizeGitHubCopilotEnterpriseDomain("https://api.github.com")).toBeUndefined();
|
|
expect(getGitHubCopilotBaseUrl("github.com")).toBe("https://api.githubcopilot.com");
|
|
});
|
|
|
|
it("maps enterprise domains to the Copilot enterprise host", () => {
|
|
expect(normalizeGitHubCopilotEnterpriseDomain("https://ghe.example.com")).toBe("ghe.example.com");
|
|
expect(getGitHubCopilotBaseUrl("ghe.example.com")).toBe("https://copilot-api.ghe.example.com");
|
|
expect(getGitHubCopilotBaseUrl("copilot-api.ghe.example.com")).toBe("https://copilot-api.ghe.example.com");
|
|
});
|
|
|
|
it("parses structured Copilot api keys", () => {
|
|
expect(
|
|
parseGitHubCopilotApiKey(
|
|
JSON.stringify({ token: "ghu_test_token", enterpriseUrl: "https://ghe.example.com" }),
|
|
),
|
|
).toEqual({
|
|
accessToken: "ghu_test_token",
|
|
enterpriseUrl: "ghe.example.com",
|
|
});
|
|
});
|
|
});
|