From a2a3f59e1d6b20920ed7b9ef13a04e31d61a4937 Mon Sep 17 00:00:00 2001
From: Askhz <1361267452@qq.com>
Date: Mon, 20 Apr 2026 16:00:52 +0800
Subject: [PATCH 1/4] =?UTF-8?q?refactor:=20=E7=B2=BE=E7=AE=80=E7=99=BB?=
=?UTF-8?q?=E5=BD=95=E9=80=89=E9=A1=B9=EF=BC=8C=E4=BF=9D=E7=95=99=204=20?=
=?UTF-8?q?=E4=B8=AA=E4=B8=BB=E8=A6=81=E7=99=BB=E5=BD=95=E6=96=B9=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/ConsoleOAuthFlow.tsx | 49 -----------------------------
1 file changed, 49 deletions(-)
diff --git a/src/components/ConsoleOAuthFlow.tsx b/src/components/ConsoleOAuthFlow.tsx
index 73ba8d0a5..0ded245d3 100644
--- a/src/components/ConsoleOAuthFlow.tsx
+++ b/src/components/ConsoleOAuthFlow.tsx
@@ -477,43 +477,6 @@ function OAuthStatusMessage({
),
value: 'gemini_api',
},
- {
- label: (
-
- Claude account with subscription · Pro, Max, Team, or Enterprise
- {process.env.USER_TYPE === 'ant' && (
-
- {'\n'}
- [ANT-ONLY]{' '}
-
- Please use this option unless you need to login to a special org for accessing sensitive
- data (e.g. customer data, HIPI data) with the Console option
-
-
- )}
- {'\n'}
-
- ),
- value: 'claudeai',
- },
- {
- label: (
-
- Anthropic Console account · API usage billing
- {'\n'}
-
- ),
- value: 'console',
- },
- {
- label: (
-
- 3rd-party platform · Amazon Bedrock, Microsoft Foundry, or Vertex AI
- {'\n'}
-
- ),
- value: 'platform',
- },
]}
onChange={value => {
if (value === 'costrict') {
@@ -616,18 +579,6 @@ function OAuthStatusMessage({
opusModel: process.env.GEMINI_DEFAULT_OPUS_MODEL ?? '',
activeField: 'base_url',
});
- } else if (value === 'platform') {
- logEvent('tengu_oauth_platform_selected', {});
- setOAuthStatus({ state: 'platform_setup' });
- } else {
- setOAuthStatus({ state: 'ready_to_start' });
- if (value === 'claudeai') {
- logEvent('tengu_oauth_claudeai_selected', {});
- setLoginWithClaudeAi(true);
- } else {
- logEvent('tengu_oauth_console_selected', {});
- setLoginWithClaudeAi(false);
- }
}
}}
/>
From d7bcf65968bb1f632bf9ee157c0fe4e3f0e250da Mon Sep 17 00:00:00 2001
From: Askhz <1361267452@qq.com>
Date: Mon, 20 Apr 2026 20:40:59 +0800
Subject: [PATCH 2/4] feat: restore CoStrict login option in interactive login
- Added CoStrict option to the login Select component
- Implemented complete OAuth flow with browser opening and token polling
- Added costrict_waiting and costrict_model_select OAuth states
- Fixed TypeScript errors in fetch.ts and index.ts
The CoStrict login option was previously removed during login simplification.
This commit restores the full functionality including model selection after login.
---
src/components/ConsoleOAuthFlow.tsx | 142 +++++++++++++++++++++++++++-
src/costrict/provider/fetch.ts | 39 ++++----
src/costrict/provider/index.ts | 7 +-
3 files changed, 164 insertions(+), 24 deletions(-)
diff --git a/src/components/ConsoleOAuthFlow.tsx b/src/components/ConsoleOAuthFlow.tsx
index b4da18737..512230293 100644
--- a/src/components/ConsoleOAuthFlow.tsx
+++ b/src/components/ConsoleOAuthFlow.tsx
@@ -16,6 +16,7 @@ import { getSettings_DEPRECATED, updateSettingsForSource } from '../utils/settin
import { Select } from './CustomSelect/select.js'
import { Spinner } from './Spinner.js'
import TextInput from './TextInput.js'
+import { useSetAppState } from '../state/AppState.js'
import { fi } from 'zod/v4/locales'
type Props = {
@@ -28,6 +29,14 @@ type Props = {
type OAuthStatus =
| { state: 'idle' } // Initial state, waiting to select login method
| { state: 'platform_setup' } // Show platform setup info (Bedrock/Vertex/Foundry)
+ | {
+ state: 'costrict_waiting'
+ url: string
+ } // CoStrict OAuth: browser opened, waiting for user to login
+ | {
+ state: 'costrict_model_select'
+ models: Array<{ id: string; name?: string }>
+ } // CoStrict: login done, select a model
| {
state: 'custom_platform'
baseUrl: string
@@ -94,6 +103,7 @@ export function ConsoleOAuthFlow({
}
return { state: 'idle' }
})
+ const setAppState = useSetAppState()
const [pastedCode, setPastedCode] = useState('')
const [cursorOffset, setCursorOffset] = useState(0)
@@ -438,6 +448,7 @@ function OAuthStatusMessage({
setLoginWithClaudeAi,
onDone,
}: OAuthStatusMessageProps): React.ReactNode {
+ const setAppState = useSetAppState()
switch (oauthStatus.state) {
case 'idle':
return (
@@ -453,6 +464,16 @@ function OAuthStatusMessage({