Closed
Conversation
feat: add costrict login provider
strictplan
- 品牌名从 Claude Code 改为 CoStrict - 版本号更新为 v4.0.1 - 首页边框、标题、分割线、小人等元素统一改为蓝色 - 简单模式(CondensedLogo)添加蓝色圆角边框 - 小人(Clawd)替换为 CoStrict ASCII art 大字标志 - Feed 标题(Recent activity/What's new)改为蓝色
Contributor
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (28)
📝 WalkthroughWalkthroughThis PR adds comprehensive CoStrict API provider support to Claude Code, including OAuth authentication, token management, model resolution, streaming chat queries, and six new built-in agents designed for a CoStrict-specific development workflow. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ConsoleOAuthFlow
participant AuthModule as auth.ts
participant Browser
participant CoStrictServer as CoStrict Server
participant CredentialsModule as credentials.ts
User->>ConsoleOAuthFlow: Select CoStrict login
ConsoleOAuthFlow->>AuthModule: loginCoStrict()
AuthModule->>AuthModule: generateState()<br/>generateMachineId()
AuthModule->>Browser: openBrowser(loginURL)
Browser->>CoStrictServer: User authenticates
CoStrictServer-->>Browser: Redirect with token
AuthModule->>CoStrictServer: pollLoginToken()
CoStrictServer-->>AuthModule: {access_token, refresh_token}
AuthModule->>CredentialsModule: saveCoStrictCredentials()
CredentialsModule-->>AuthModule: Saved
AuthModule-->>ConsoleOAuthFlow: CoStrictCredentials
ConsoleOAuthFlow->>ConsoleOAuthFlow: Update app state<br/>Set env vars
sequenceDiagram
participant App
participant SetupModule as setup.ts
participant CredentialsModule as credentials.ts
participant TokenModule as token.ts
participant FetchModule as fetch.ts
participant CoStrictAPI as CoStrict API
App->>SetupModule: setup()
SetupModule->>CredentialsModule: loadCoStrictCredentials()
CredentialsModule-->>SetupModule: credentials
SetupModule->>TokenModule: isCoStrictTokenValid(credentials)
alt Token Invalid
SetupModule->>TokenModule: refreshCoStrictToken()
TokenModule->>CoStrictAPI: GET /oidc-auth/api/v1/plugin/login/token
CoStrictAPI-->>TokenModule: {access_token, refresh_token}
TokenModule->>CredentialsModule: saveCoStrictCredentials(updated)
CredentialsModule-->>TokenModule: Saved
end
SetupModule->>FetchModule: createCoStrictFetch()
FetchModule-->>App: Wrapped fetch ready
sequenceDiagram
participant API as claude.ts
participant Provider as queryModelCoStrict()
participant FetchWrapper as createCoStrictFetch()
participant OpenAIClient as OpenAI Client
participant CoStrictAPI as CoStrict API
participant Caller
API->>Provider: queryModelCoStrict(messages, tools, signal...)
Provider->>FetchWrapper: Create wrapped fetch
Provider->>OpenAIClient: new OpenAI({fetch: wrapped})
Provider->>OpenAIClient: client.chat.completions.create({stream: true})
OpenAIClient->>FetchWrapper: fetch(request)
FetchWrapper->>FetchWrapper: Validate/refresh token
FetchWrapper->>CoStrictAPI: POST /chat/completions
CoStrictAPI-->>FetchWrapper: Streaming SSE
FetchWrapper-->>OpenAIClient: Response stream
OpenAIClient-->>Provider: OpenAI stream events
loop Each event
Provider->>Provider: Adapt to Anthropic format
Provider-->>Caller: yield StreamEvent
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by CodeRabbit
Release Notes
New Features
Branding & UI
Chores