-
Notifications
You must be signed in to change notification settings - Fork 1.8k
feat(providers/qoder): add native Qoder provider backed by qodercli #1107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kanmars
wants to merge
17
commits into
siteboon:main
Choose a base branch
from
kanmars:feature/qoder-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f72bf12
feat(providers): add native Qoder provider backed by qodercli
7733bdc
fix(providers/qoder): skip MODEL header row and dedupe session_created
ee998bf
fix(providers/qoder): resume existing session instead of recreating b…
1e4c90b
feat(ui): use real Qoder brand icon for provider logo
fe388b8
fix(providers/qoder): unify cwd encoding with shared encodeQoderCwd
5f3037c
feat(settings/qoder): add Qoder permissions panel and wire tools sett…
9e6a756
fix(settings/qoder): align permissions panel with real qodercli behavior
abb0c24
refactor(shared): centralize qoder transcript path, jsonl and file he…
a35cf0b
fix(providers/qoder): parse --list-models rows by shape, not by exclu…
f198c4f
fix(providers/qoder): validate session ids, order argv safely, read s…
4e9fd40
perf(providers/qoder): stream transcripts and memoize the model catalog
aef3882
refactor(qoder): drop dead code, surface Skills, finish the zh transl…
206e9df
test(providers/qoder): pin argv ordering, session normalization, and …
517f0b5
feat(providers/qoder): support image attachments in runtime and sessions
6cbf378
fix(providers/qoder): address code review findings
5af52b1
fix(providers/qoder): address coderabbitai CR findings
9a79098
fix(providers/qoder): address remaining coderabbitai CR findings
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
64 changes: 64 additions & 0 deletions
64
server/modules/providers/list/qoder/qoder-auth.provider.ts
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { readFile } from 'node:fs/promises'; | ||
| import path from 'node:path'; | ||
|
|
||
| import spawn from 'cross-spawn'; | ||
|
|
||
| import type { IProviderAuth } from '@/shared/interfaces.js'; | ||
| import type { ProviderAuthStatus } from '@/shared/types.js'; | ||
| import { fileExists, getQoderHome } from '@/shared/utils.js'; | ||
|
|
||
| /** | ||
| * Qoder persists its auth state as an encrypted blob under `~/.qoder/.auth/user` | ||
| * (600 perms). Presence of the file means the CLI has completed at least one | ||
| * `qodercli login` and can issue authenticated requests. The blob itself is | ||
| * opaque to the server, so only existence is checked. | ||
| */ | ||
| const QODER_AUTH_FILE = '.auth/user'; | ||
|
|
||
| export class QoderProviderAuth implements IProviderAuth { | ||
| /** | ||
| * Checks whether the Qoder CLI is available to the server process. | ||
| */ | ||
| private checkInstalled(): boolean { | ||
| try { | ||
| const result = spawn.sync('qodercli', ['--version'], { stdio: 'ignore', timeout: 5000 }); | ||
| return !result.error && result.status === 0; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Returns Qoder CLI installation and credential status. | ||
| */ | ||
| async getStatus(): Promise<ProviderAuthStatus> { | ||
| const installed = this.checkInstalled(); | ||
| const authenticated = await this.checkCredentials(); | ||
|
|
||
| return { | ||
| installed, | ||
| provider: 'qoder', | ||
| authenticated, | ||
| email: authenticated ? 'qoder credentials' : null, | ||
| method: authenticated ? 'credentials_file' : null, | ||
| error: authenticated ? undefined : 'Not authenticated', | ||
| }; | ||
| } | ||
|
|
||
| /** | ||
| * Reads Qoder's auth blob and reports whether a login exists. | ||
| */ | ||
| private async checkCredentials(): Promise<boolean> { | ||
| try { | ||
| const authPath = path.join(getQoderHome(), QODER_AUTH_FILE); | ||
| if (!(await fileExists(authPath))) { | ||
| return false; | ||
| } | ||
|
|
||
| const content = await readFile(authPath, 'utf8'); | ||
| return content.trim().length > 0; | ||
| } catch { | ||
| return false; | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.