feat: add CLI config preview API for Codex and Gemini

- Implemented `fetchCodexConfigPreview` and `fetchGeminiConfigPreview` functions in the API layer to retrieve masked configuration files.
- Added new interfaces `CodexConfigPreviewResponse` and `GeminiConfigPreviewResponse` to define the structure of the API responses.
- Created utility functions to read and mask sensitive values from `config.toml` and `auth.json` for Codex, and `settings.json` for Gemini.
- Updated CLI settings routes to handle new preview endpoints.
- Enhanced session content parser to support Claude JSONL format.
- Updated UI components to reflect changes in history page and navigation, including new tabs for observability.
- Localized changes for English and Chinese languages to reflect "CLI History" terminology.
This commit is contained in:
catlog22
2026-02-25 22:37:30 +08:00
parent c92754505a
commit b4d3426e6a
15 changed files with 1137 additions and 163 deletions

View File

@@ -6150,6 +6150,54 @@ export async function getCliSettingsPath(endpointId: string): Promise<{ endpoint
return fetchApi(`/api/cli/settings/${encodeURIComponent(endpointId)}/path`);
}
// ========== CLI Config Preview API ==========
/**
* Codex config preview response
*/
export interface CodexConfigPreviewResponse {
/** Whether preview was successful */
success: boolean;
/** Path to config.toml */
configPath: string;
/** Path to auth.json */
authPath: string;
/** config.toml content with sensitive values masked */
configToml: string | null;
/** auth.json content with API keys masked */
authJson: string | null;
/** Error messages if any files could not be read */
errors?: string[];
}
/**
* Gemini config preview response
*/
export interface GeminiConfigPreviewResponse {
/** Whether preview was successful */
success: boolean;
/** Path to settings.json */
settingsPath: string;
/** settings.json content with sensitive values masked */
settingsJson: string | null;
/** Error messages if file could not be read */
errors?: string[];
}
/**
* Fetch Codex config files preview (config.toml and auth.json)
*/
export async function fetchCodexConfigPreview(): Promise<CodexConfigPreviewResponse> {
return fetchApi('/api/cli/settings/codex/preview');
}
/**
* Fetch Gemini settings file preview (settings.json)
*/
export async function fetchGeminiConfigPreview(): Promise<GeminiConfigPreviewResponse> {
return fetchApi('/api/cli/settings/gemini/preview');
}
// ========== Orchestrator Execution Monitoring API ==========
/**