feat(backend): add claude runtime, anthropic OAuth auth kind, and profile→runtime derivation
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import type { Doc } from './_generated/dataModel';
|
||||
|
||||
export type AgentRuntimeName = 'codex' | 'opencode' | 'claude';
|
||||
|
||||
// Which runtimes a provider profile can drive.
|
||||
export const runtimesForProfile = (
|
||||
profile: Pick<Doc<'aiProviderProfiles'>, 'provider' | 'authType'>,
|
||||
): AgentRuntimeName[] => {
|
||||
if (
|
||||
profile.provider === 'opencode_openai_login' ||
|
||||
profile.authType === 'opencode_auth_json'
|
||||
) {
|
||||
return ['codex']; // ChatGPT-login snapshot → Codex CLI only
|
||||
}
|
||||
if (profile.provider === 'anthropic') {
|
||||
return profile.authType === 'anthropic_oauth_json'
|
||||
? ['claude']
|
||||
: ['claude', 'opencode'];
|
||||
}
|
||||
if (profile.provider === 'openai') return ['opencode', 'codex'];
|
||||
// Every remaining API-key provider is OpenAI-compatible → OpenCode.
|
||||
return ['opencode'];
|
||||
};
|
||||
Reference in New Issue
Block a user