Files
ccs/src/cliproxy/types.ts
T
7fc281fcec chore: promote beta to main (v5.2.0) (#32)
* fix(cliproxy): use double-dash flags for cliproxyapi auth (#24)

CLIProxyAPI updated from single-dash to double-dash CLI flags.
Changed -login to --login, -codex-login to --codex-login,
-antigravity-login to --antigravity-login, -config to --config,
and -no-browser to --no-browser.

* chore(release): 5.1.1-beta.1 [skip ci]

## [5.1.1-beta.1](https://github.com/kaitranntt/ccs/compare/v5.1.0...v5.1.1-beta.1) (2025-12-01)

### Bug Fixes

* **cliproxy:** use double-dash flags for cliproxyapi auth ([#24](https://github.com/kaitranntt/ccs/issues/24)) ([4c81f28](https://github.com/kaitranntt/ccs/commit/4c81f28f0b67ef92cf74d0f5c13a5943ff0a7f00))

* chore(release): 5.1.1-beta.2 [skip ci]

## [5.1.1-beta.2](https://github.com/kaitranntt/ccs/compare/v5.1.1-beta.1...v5.1.1-beta.2) (2025-12-01)

### Bug Fixes

* **cliproxy:** use double-dash flags for cliproxyapi auth ([9489884](https://github.com/kaitranntt/ccs/commit/94898848ea4533dcfc142e1b6c9bf939ba655537))

* fix(glmt): handle 401 errors and headers-already-sent exception (#30)

- add res.headersSent check before writing error headers
- write error as SSE event when headers already sent (streaming mode)
- add parseUpstreamError() for user-friendly error messages
- return proper HTTP status codes (401, 403, 429, 502, 504)
- clear auth error: check ANTHROPIC_AUTH_TOKEN in config

Fixes #26

* chore(release): 5.1.1-beta.3 [skip ci]

## [5.1.1-beta.3](https://github.com/kaitranntt/ccs/compare/v5.1.1-beta.2...v5.1.1-beta.3) (2025-12-01)

### Bug Fixes

* **glmt:** handle 401 errors and headers-already-sent exception ([#30](https://github.com/kaitranntt/ccs/issues/30)) ([c953382](https://github.com/kaitranntt/ccs/commit/c95338232a37981b95b785b47185ce18d6d94b7a)), closes [#26](https://github.com/kaitranntt/ccs/issues/26)

* chore(release): enable success comments and released labels in semantic-release

* feat(cliproxy): add qwen code oauth provider support (#31)

Add 'qwen' as new CLIProxy OAuth provider with --qwen-login flag.
Support qwen3-coder model with base config at config/base-qwen.settings.json.
Register qwen OAuth endpoints and token prefix handling.
Update help documentation across all CLI entry points.

Implements issue #29

* chore(release): 5.2.0-beta.1 [skip ci]

# [5.2.0-beta.1](https://github.com/kaitranntt/ccs/compare/v5.1.1-beta.3...v5.2.0-beta.1) (2025-12-01)

### Features

* **cliproxy:** add qwen code oauth provider support ([#31](https://github.com/kaitranntt/ccs/issues/31)) ([a3f1e52](https://github.com/kaitranntt/ccs/commit/a3f1e52ac68600ba0806d67aacceb6477ffa3543)), closes [#29](https://github.com/kaitranntt/ccs/issues/29)

* feat(cliproxy): auto-update cliproxyapi to latest release on startup

- add github api integration to fetch latest release version
- check for updates on every startup (cached for 1 hour)
- auto-download newer versions when available
- rename CLIPROXY_VERSION to CLIPROXY_FALLBACK_VERSION (safety net)
- add version tracking (.version file) and caching (.version-cache.json)
- non-blocking: startup continues if update check fails

* chore(release): 5.2.0-beta.2 [skip ci]

# [5.2.0-beta.2](https://github.com/kaitranntt/ccs/compare/v5.2.0-beta.1...v5.2.0-beta.2) (2025-12-01)

### Features

* **cliproxy:** auto-update cliproxyapi to latest release on startup ([8873ccd](https://github.com/kaitranntt/ccs/commit/8873ccd981679e8acff8965accdc22215c6e4aa2))

---------

Co-authored-by: semantic-release-bot <semantic-release-bot@martynus.net>
2025-12-01 04:11:14 -05:00

187 lines
4.2 KiB
TypeScript

/**
* CLIProxy Type Definitions
* Types for CLIProxyAPI binary management and execution
*/
/**
* Supported operating systems
*/
export type SupportedOS = 'darwin' | 'linux' | 'windows';
/**
* Supported CPU architectures
*/
export type SupportedArch = 'amd64' | 'arm64';
/**
* Archive extension based on platform
*/
export type ArchiveExtension = 'tar.gz' | 'zip';
/**
* Platform detection result
*/
export interface PlatformInfo {
/** Operating system (darwin, linux, windows) */
os: SupportedOS;
/** CPU architecture (amd64, arm64) */
arch: SupportedArch;
/** Full binary archive name (e.g., CLIProxyAPI_6.5.27_linux_amd64.tar.gz) */
binaryName: string;
/** Archive extension (tar.gz for Unix, zip for Windows) */
extension: ArchiveExtension;
}
/**
* Binary manager configuration
*/
export interface BinaryManagerConfig {
/** CLIProxyAPI version to download */
version: string;
/** GitHub releases base URL */
releaseUrl: string;
/** Local binary storage path (~/.ccs/bin/) */
binPath: string;
/** Maximum download retry attempts */
maxRetries: number;
/** Enable verbose logging */
verbose: boolean;
}
/**
* Download progress callback
*/
export interface DownloadProgress {
/** Total bytes to download */
total: number;
/** Bytes downloaded so far */
downloaded: number;
/** Download percentage (0-100) */
percentage: number;
}
/**
* Download progress callback function type
*/
export type ProgressCallback = (progress: DownloadProgress) => void;
/**
* Binary info after successful download/verification
*/
export interface BinaryInfo {
/** Full path to executable */
path: string;
/** CLIProxyAPI version */
version: string;
/** Platform info */
platform: PlatformInfo;
/** SHA256 checksum (verified) */
checksum: string;
}
/**
* Checksum verification result
*/
export interface ChecksumResult {
/** Whether checksum matched */
valid: boolean;
/** Expected checksum from checksums.txt */
expected: string;
/** Actual computed checksum */
actual: string;
}
/**
* Download result
*/
export interface DownloadResult {
/** Whether download succeeded */
success: boolean;
/** Path to downloaded file */
filePath?: string;
/** Error message if failed */
error?: string;
/** Number of retries attempted */
retries: number;
}
/**
* Supported CLIProxy providers
* - gemini: Google Gemini via OAuth
* - codex: OpenAI Codex via OAuth
* - agy: Antigravity via OAuth (short name for easy usage)
* - qwen: Qwen Code via OAuth (qwen3-coder)
*/
export type CLIProxyProvider = 'gemini' | 'codex' | 'agy' | 'qwen';
/**
* CLIProxy config.yaml structure (minimal)
*/
export interface CLIProxyConfig {
port: number;
'api-keys': string[];
'auth-dir': string;
debug: boolean;
'gemini-api-key'?: Array<{
'api-key': string;
'base-url'?: string;
}>;
'codex-api-key'?: Array<{
'api-key': string;
'base-url'?: string;
}>;
'openai-compatibility'?: Array<{
name: string;
'base-url': string;
'api-key-entries': Array<{
'api-key': string;
}>;
}>;
}
/**
* Executor configuration
*/
export interface ExecutorConfig {
/** Port for CLIProxyAPI (default: 8317) */
port: number;
/** Timeout for proxy readiness in ms (default: 5000) */
timeout: number;
/** Enable verbose logging */
verbose: boolean;
/** Poll interval for port check in ms (default: 100) */
pollInterval: number;
/** Custom settings path for user-defined CLIProxy variants */
customSettingsPath?: string;
}
/**
* Model mapping for each provider
*/
export interface ProviderModelMapping {
/** Default model for requests */
defaultModel: string;
/** Model for Claude CLI's ANTHROPIC_MODEL */
claudeModel: string;
/** Model for Claude CLI's ANTHROPIC_DEFAULT_OPUS_MODEL */
opusModel?: string;
/** Model for Claude CLI's ANTHROPIC_DEFAULT_SONNET_MODEL */
sonnetModel?: string;
/** Model for Claude CLI's ANTHROPIC_DEFAULT_HAIKU_MODEL */
haikuModel?: string;
}
/**
* Provider configuration
*/
export interface ProviderConfig {
/** Provider name */
name: CLIProxyProvider;
/** Display name for UI */
displayName: string;
/** Model configuration */
models: ProviderModelMapping;
/** Whether OAuth is required */
requiresOAuth: boolean;
}