feat(settings): add OpenAI/Google API key support and unified ModelId type

- Add OpenAI API key storage to store-api-key handler
- Include Google/OpenAI key status in credentials API responses
- Add unified ModelId type for Claude, Codex, Cursor, OpenCode, and dynamic providers
- Update PhaseModelEntry to support all provider model types
This commit is contained in:
DhanushSantosh
2026-01-14 00:49:35 +05:30
parent 690cf1f281
commit fbb3f697e1
8 changed files with 56 additions and 15 deletions

View File

@@ -79,6 +79,7 @@ export {
type ModelAlias,
type CodexModelId,
type AgentModel,
type ModelId,
} from './model.js';
// Event types

View File

@@ -1,6 +1,9 @@
/**
* Model alias mapping for Claude models
*/
import type { CursorModelId } from './cursor-models.js';
import type { OpencodeModelId } from './opencode-models.js';
export const CLAUDE_MODEL_MAP: Record<string, string> = {
haiku: 'claude-haiku-4-5-20251001',
sonnet: 'claude-sonnet-4-5-20250929',
@@ -74,3 +77,26 @@ export type CodexModelId = (typeof CODEX_MODEL_MAP)[keyof typeof CODEX_MODEL_MAP
* Represents available models across providers
*/
export type AgentModel = ModelAlias | CodexModelId;
/**
* Dynamic provider model IDs discovered at runtime (provider/model format)
*/
export type DynamicModelId = `${string}/${string}`;
/**
* Provider-prefixed model IDs used for routing
*/
export type PrefixedCursorModelId = `cursor-${string}`;
export type PrefixedOpencodeModelId = `opencode-${string}`;
/**
* ModelId - Unified model identifier across providers
*/
export type ModelId =
| ModelAlias
| CodexModelId
| CursorModelId
| OpencodeModelId
| DynamicModelId
| PrefixedCursorModelId
| PrefixedOpencodeModelId;

View File

@@ -6,7 +6,7 @@
* (for file I/O via SettingsService) and the UI (for state management and sync).
*/
import type { ModelAlias, AgentModel, CodexModelId } from './model.js';
import type { ModelAlias, ModelId } from './model.js';
import type { CursorModelId } from './cursor-models.js';
import { CURSOR_MODEL_MAP, getAllCursorModelIds } from './cursor-models.js';
import type { OpencodeModelId } from './opencode-models.js';
@@ -114,8 +114,8 @@ const DEFAULT_CODEX_ADDITIONAL_DIRS: string[] = [];
* - Cursor models: Handle thinking internally
*/
export interface PhaseModelEntry {
/** The model to use (Claude alias, Cursor model ID, or Codex model ID) */
model: ModelAlias | CursorModelId | CodexModelId;
/** The model to use (supports Claude, Cursor, Codex, OpenCode, and dynamic provider IDs) */
model: ModelId;
/** Extended thinking level (only applies to Claude models, defaults to 'none') */
thinkingLevel?: ThinkingLevel;
/** Reasoning effort level (only applies to Codex models, defaults to 'none') */