mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-02 12:19:35 +00:00
feat(cliproxy): add composite variant type definitions
- Add CompositeVariantConfig, CompositeTierConfig interfaces - Add CLIPROXY_SUPPORTED_PROVIDERS const array - Extend ExecutorConfig with composite fields (isComposite, compositeTiers, compositeDefaultTier) - Update variants record type to accept composite configs - Export CLIProxyVariantConfig from types barrel Refs #506
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
* Types for CLIProxyAPI binary management and execution
|
* Types for CLIProxyAPI binary management and execution
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { CompositeTierConfig } from '../config/unified-config-types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Supported operating systems
|
* Supported operating systems
|
||||||
*/
|
*/
|
||||||
@@ -181,6 +183,16 @@ export interface ExecutorConfig {
|
|||||||
pollInterval: number;
|
pollInterval: number;
|
||||||
/** Custom settings path for user-defined CLIProxy variants */
|
/** Custom settings path for user-defined CLIProxy variants */
|
||||||
customSettingsPath?: string;
|
customSettingsPath?: string;
|
||||||
|
/** Composite variant: true when mixing providers per tier */
|
||||||
|
isComposite?: boolean;
|
||||||
|
/** Composite variant: per-tier provider+model mappings */
|
||||||
|
compositeTiers?: {
|
||||||
|
opus: CompositeTierConfig;
|
||||||
|
sonnet: CompositeTierConfig;
|
||||||
|
haiku: CompositeTierConfig;
|
||||||
|
};
|
||||||
|
/** Composite variant: which tier is the default */
|
||||||
|
compositeDefaultTier?: 'opus' | 'sonnet' | 'haiku';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,6 +21,21 @@
|
|||||||
*/
|
*/
|
||||||
export const UNIFIED_CONFIG_VERSION = 8;
|
export const UNIFIED_CONFIG_VERSION = 8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supported CLIProxy providers.
|
||||||
|
* Includes all OAuth-based providers supported by CLIProxyAPI.
|
||||||
|
*/
|
||||||
|
export const CLIPROXY_SUPPORTED_PROVIDERS = [
|
||||||
|
'gemini',
|
||||||
|
'codex',
|
||||||
|
'agy',
|
||||||
|
'qwen',
|
||||||
|
'iflow',
|
||||||
|
'kiro',
|
||||||
|
'ghcp',
|
||||||
|
'claude',
|
||||||
|
] as const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Account configuration (formerly in profiles.json).
|
* Account configuration (formerly in profiles.json).
|
||||||
* Represents an isolated Claude instance via CLAUDE_CONFIG_DIR.
|
* Represents an isolated Claude instance via CLAUDE_CONFIG_DIR.
|
||||||
@@ -72,6 +87,43 @@ export interface CLIProxyVariantConfig {
|
|||||||
auth?: CLIProxyAuthConfig;
|
auth?: CLIProxyAuthConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Per-tier provider+model mapping for composite variants.
|
||||||
|
*/
|
||||||
|
export interface CompositeTierConfig {
|
||||||
|
/** Provider for this tier */
|
||||||
|
provider: 'gemini' | 'codex' | 'agy' | 'qwen' | 'iflow' | 'kiro' | 'ghcp' | 'claude';
|
||||||
|
/** Model ID to use for this tier */
|
||||||
|
model: string;
|
||||||
|
/** Account nickname (optional, references oauth_accounts) */
|
||||||
|
account?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Composite variant configuration.
|
||||||
|
* Mixes different providers per Claude tier (opus, sonnet, haiku) in a single profile.
|
||||||
|
* Uses CLIProxyAPI root endpoints (/v1/messages) for model-based routing
|
||||||
|
* instead of provider-specific endpoints (/api/provider/{provider}).
|
||||||
|
*/
|
||||||
|
export interface CompositeVariantConfig {
|
||||||
|
/** Discriminator for composite type */
|
||||||
|
type: 'composite';
|
||||||
|
/** Which tier ANTHROPIC_MODEL equals (default must be one of the three) */
|
||||||
|
default_tier: 'opus' | 'sonnet' | 'haiku';
|
||||||
|
/** Per-tier provider+model mapping */
|
||||||
|
tiers: {
|
||||||
|
opus: CompositeTierConfig;
|
||||||
|
sonnet: CompositeTierConfig;
|
||||||
|
haiku: CompositeTierConfig;
|
||||||
|
};
|
||||||
|
/** Path to settings file */
|
||||||
|
settings?: string;
|
||||||
|
/** Shared port for the composite profile */
|
||||||
|
port?: number;
|
||||||
|
/** Per-variant auth override (optional) */
|
||||||
|
auth?: CLIProxyAuthConfig;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CLIProxy authentication configuration.
|
* CLIProxy authentication configuration.
|
||||||
* Allows customization of API key and management secret for CLIProxyAPI.
|
* Allows customization of API key and management secret for CLIProxyAPI.
|
||||||
@@ -122,8 +174,8 @@ export interface CLIProxyConfig {
|
|||||||
oauth_accounts: OAuthAccounts;
|
oauth_accounts: OAuthAccounts;
|
||||||
/** Built-in providers (read-only, for reference) */
|
/** Built-in providers (read-only, for reference) */
|
||||||
providers: readonly string[];
|
providers: readonly string[];
|
||||||
/** User-defined provider variants */
|
/** User-defined provider variants (single-provider or composite) */
|
||||||
variants: Record<string, CLIProxyVariantConfig>;
|
variants: Record<string, CLIProxyVariantConfig | CompositeVariantConfig>;
|
||||||
/** Logging configuration (disabled by default) */
|
/** Logging configuration (disabled by default) */
|
||||||
logging?: CLIProxyLoggingConfig;
|
logging?: CLIProxyLoggingConfig;
|
||||||
/** Kiro: disable incognito browser mode (use normal browser to save credentials) */
|
/** Kiro: disable incognito browser mode (use normal browser to save credentials) */
|
||||||
@@ -672,7 +724,7 @@ export function createEmptyUnifiedConfig(): UnifiedConfig {
|
|||||||
cliproxy: {
|
cliproxy: {
|
||||||
backend: 'plus',
|
backend: 'plus',
|
||||||
oauth_accounts: {},
|
oauth_accounts: {},
|
||||||
providers: ['gemini', 'codex', 'agy', 'qwen', 'iflow', 'kiro', 'ghcp'],
|
providers: [...CLIPROXY_SUPPORTED_PROVIDERS],
|
||||||
variants: {},
|
variants: {},
|
||||||
logging: {
|
logging: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ export type {
|
|||||||
EnvValue,
|
EnvValue,
|
||||||
ProfileMetadata,
|
ProfileMetadata,
|
||||||
ProfilesRegistry,
|
ProfilesRegistry,
|
||||||
|
CLIProxyVariantConfig,
|
||||||
CLIProxyVariantsConfig,
|
CLIProxyVariantsConfig,
|
||||||
} from './config';
|
} from './config';
|
||||||
export { isConfig, isSettings } from './config';
|
export { isConfig, isSettings } from './config';
|
||||||
|
|||||||
Reference in New Issue
Block a user