chore(vendor): import pi 1.3.0
Imported as a linear vendor commit so forge rebases do not replay the upstream root tree. git-subtree-dir: third_party/pi git-subtree-split: 71023aec1546d6d677a65669c5665c0927ce0dd0
This commit is contained in:
1 parent
719370c8f7
commit
6081e3e325
1743 files changed
+205459
-131704
No files matched your search
+20
-1
@@ -3,6 +3,7 @@ import { InMemoryCredentialStore } from "../src/auth/credential-store.ts";
|
||||
import { anthropicOAuth } from "../src/auth/oauth/anthropic.ts";
|
||||
import { githubCopilotOAuth } from "../src/auth/oauth/github-copilot.ts";
|
||||
import { kimiCodingOAuth } from "../src/auth/oauth/kimi-coding.ts";
|
||||
import { openaiChatGPTOAuth } from "../src/auth/oauth/openai-chatgpt.ts";
|
||||
import { openaiCodexOAuth } from "../src/auth/oauth/openai-codex.ts";
|
||||
import { openRouterOAuth } from "../src/auth/oauth/openrouter.ts";
|
||||
import { xaiOAuth } from "../src/auth/oauth/xai.ts";
|
||||
@@ -10,6 +11,7 @@ import { createModels } from "../src/models.ts";
|
||||
import * as extensionOAuthCompatibility from "../src/oauth.ts";
|
||||
import { anthropicProvider } from "../src/providers/anthropic.ts";
|
||||
import { githubCopilotProvider } from "../src/providers/github-copilot.ts";
|
||||
import { openaiProvider } from "../src/providers/openai.ts";
|
||||
|
||||
const neverAbortedSignal = new AbortController().signal;
|
||||
|
||||
@@ -28,7 +30,14 @@ describe.sequential("OAuthAuth adapters", () => {
|
||||
});
|
||||
|
||||
it("identifies only subscription-backed OAuth flows as subscriptions", () => {
|
||||
for (const oauth of [anthropicOAuth, openaiCodexOAuth, githubCopilotOAuth, kimiCodingOAuth, xaiOAuth]) {
|
||||
for (const oauth of [
|
||||
anthropicOAuth,
|
||||
openaiChatGPTOAuth,
|
||||
openaiCodexOAuth,
|
||||
githubCopilotOAuth,
|
||||
kimiCodingOAuth,
|
||||
xaiOAuth,
|
||||
]) {
|
||||
expect(oauth.isSubscription).toBe(true);
|
||||
}
|
||||
expect(openRouterOAuth.isSubscription).not.toBe(true);
|
||||
@@ -39,6 +48,16 @@ describe.sequential("OAuthAuth adapters", () => {
|
||||
expect(auth).toEqual({ apiKey: "token" });
|
||||
});
|
||||
|
||||
it("OpenAI exposes ChatGPT OAuth alongside API-key auth", () => {
|
||||
const provider = openaiProvider();
|
||||
expect(provider.auth.apiKey).toBeDefined();
|
||||
expect(provider.auth.oauth).toMatchObject({
|
||||
name: "OpenAI (ChatGPT subscription)",
|
||||
isSubscription: true,
|
||||
loginLabel: "Sign in with ChatGPT",
|
||||
});
|
||||
});
|
||||
|
||||
it("openai-codex toAuth derives the api key from the access token", async () => {
|
||||
const auth = await openaiCodexOAuth.toAuth({ type: "oauth", access: "token", refresh: "r", expires: 0 });
|
||||
expect(auth).toEqual({ apiKey: "token" });
|
||||
|
||||
Reference in new issue
Block a user