mirror of
https://github.com/tiennm99/ccs.git
synced 2026-07-17 00:16:46 +00:00
refactor(types): add generic types and consolidate ExecutionResult
- add OperationResult<T> for success/failure patterns - add ComponentStatus for CLI tool statuses - add ValidationResult for validation patterns - remove duplicate ExecutionResult, re-export from executor/types
This commit is contained in:
+2
-13
@@ -34,19 +34,8 @@ export interface DelegationSessionsRegistry {
|
||||
lastSessionId?: string; // Most recent session ID
|
||||
}
|
||||
|
||||
/**
|
||||
* Execution result
|
||||
*/
|
||||
export interface ExecutionResult {
|
||||
exitCode: number;
|
||||
duration: number; // Seconds
|
||||
workingDir: string;
|
||||
sessionId: string;
|
||||
profile: string;
|
||||
model?: string; // Model name from settings
|
||||
cost?: number; // Estimated cost (if available)
|
||||
turns: number;
|
||||
}
|
||||
// Re-export ExecutionResult from canonical location for backward compatibility
|
||||
export type { ExecutionResult } from '../delegation/executor/types';
|
||||
|
||||
/**
|
||||
* Real-time output event
|
||||
|
||||
@@ -42,6 +42,36 @@ export interface TerminalInfo {
|
||||
*/
|
||||
export type Result<T, E = Error> = { ok: true; value: T } | { ok: false; error: E };
|
||||
|
||||
/**
|
||||
* Generic operation result for success/failure patterns
|
||||
* Use this instead of defining new *Result interfaces
|
||||
*/
|
||||
export interface OperationResult<T = void> {
|
||||
success: boolean;
|
||||
message?: string;
|
||||
error?: string;
|
||||
data?: T;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic component/tool status
|
||||
* Used for CLI tools, services, etc.
|
||||
*/
|
||||
export interface ComponentStatus {
|
||||
installed: boolean;
|
||||
path?: string;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generic validation result
|
||||
* Standardized on 'valid' property name
|
||||
*/
|
||||
export interface ValidationResult {
|
||||
valid: boolean;
|
||||
errors?: string[];
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// UI TYPES (Phase 1: CLI UI/UX Enhancement)
|
||||
// =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user