feat(backend): add claude runtime, anthropic OAuth auth kind, and profile→runtime derivation

This commit is contained in:
Gabriel Brown
2026-07-11 10:42:48 -04:00
parent 76886621b5
commit 70396feccc
5 changed files with 81 additions and 4 deletions
+23
View File
@@ -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'];
};