feat: update Codex services and UI components for enhanced model management

- Bumped version numbers for @automaker/server and @automaker/ui to 0.9.0 in package-lock.json.
- Introduced CodexAppServerService and CodexModelCacheService to manage communication with the Codex CLI's app-server and cache model data.
- Updated CodexUsageService to utilize app-server for fetching usage data.
- Enhanced Codex routes to support fetching available models and integrated model caching.
- Improved UI components to dynamically load and display Codex models, including error handling and loading states.
- Added new API methods for fetching Codex models and integrated them into the app store for state management.

These changes improve the overall functionality and user experience of the Codex integration, ensuring efficient model management and data retrieval.
This commit is contained in:
Shirone
2026-01-10 14:33:55 +01:00
parent eb94e4de72
commit 99b05d35a2
16 changed files with 981 additions and 409 deletions

View File

@@ -0,0 +1,94 @@
/**
* Codex App-Server JSON-RPC Types
*
* Type definitions for communicating with Codex CLI's app-server via JSON-RPC protocol.
* These types match the response structures from the `codex app-server` command.
*/
/**
* Response from model/list JSON-RPC method
* Returns list of available Codex models for the authenticated user
*/
export interface AppServerModelResponse {
data: AppServerModel[];
nextCursor: string | null;
}
export interface AppServerModel {
id: string;
model: string;
displayName: string;
description: string;
supportedReasoningEfforts: AppServerReasoningEffort[];
defaultReasoningEffort: string;
isDefault: boolean;
}
export interface AppServerReasoningEffort {
reasoningEffort: string;
description: string;
}
/**
* Response from account/read JSON-RPC method
* Returns current authentication state and account information
*/
export interface AppServerAccountResponse {
account: AppServerAccount | null;
requiresOpenaiAuth: boolean;
}
export interface AppServerAccount {
type: 'apiKey' | 'chatgpt';
email?: string;
planType?: string;
}
/**
* Response from account/rateLimits/read JSON-RPC method
* Returns rate limit information for the current user
*/
export interface AppServerRateLimitsResponse {
rateLimits: AppServerRateLimits;
}
export interface AppServerRateLimits {
primary: AppServerRateLimitWindow | null;
secondary: AppServerRateLimitWindow | null;
credits?: AppServerCredits;
planType?: string;
}
export interface AppServerRateLimitWindow {
usedPercent: number;
windowDurationMins: number;
resetsAt: number;
}
export interface AppServerCredits {
hasCredits: boolean;
unlimited: boolean;
balance: string;
}
/**
* Generic JSON-RPC request structure
*/
export interface JsonRpcRequest {
method: string;
id: number;
params?: unknown;
}
/**
* Generic JSON-RPC response structure
*/
export interface JsonRpcResponse<T = unknown> {
id: number;
result?: T;
error?: {
code: number;
message: string;
data?: unknown;
};
}

View File

@@ -30,6 +30,21 @@ export type {
} from './codex.js';
export * from './codex-models.js';
// Codex App-Server JSON-RPC types
export type {
AppServerModelResponse,
AppServerModel,
AppServerReasoningEffort,
AppServerAccountResponse,
AppServerAccount,
AppServerRateLimitsResponse,
AppServerRateLimits,
AppServerRateLimitWindow,
AppServerCredits,
JsonRpcRequest,
JsonRpcResponse,
} from './codex-app-server.js';
// Feature types
export type {
Feature,