/** * GLM CLI Types * Common type definitions for CLI and API */ /** * Configuration for the GLM API client */ export interface GlmConfig { apiKey: string; apiModel: string; baseUrl: string; maxRetries: number; retryDelays: number[]; timeout: number; maxTokens: number; } /** * Message in GLM conversation */ export interface GlmMessage { role: 'system' | 'user' | 'assistant'; content: string; } /** * Request payload for GLM API */ export interface GlmApiRequest { model: string; messages: GlmMessage[]; temperature?: number; max_tokens?: number; stream?: boolean; } /** * Response from GLM API (non-streaming) */ export interface GlmApiResponse { id: string; object: string; created: number; model: string; choices: GlmChoice[]; usage?: GlmUsage; } /** * Single choice in GLM response */ export interface GlmChoice { index: number; message: GlmMessage; finish_reason: string; } /** * Token usage statistics */ export interface GlmUsage { prompt_tokens: number; completion_tokens: number; total_tokens: number; } /** * Streaming chunk from GLM API */ export interface GlmStreamChunk { id: string; object: string; created: number; model: string; choices: GlmStreamChoice[]; } /** * Single choice in streaming chunk */ export interface GlmStreamChoice { index: number; delta: { role?: string; content?: string; }; finish_reason: string | null; } /** * Retry options for API calls */ export interface RetryOptions { maxRetries: number; delays: number[]; shouldRetry?: (error: Error) => boolean; } /** * Options for generate command */ export interface GenerateOptions { prompt: string; output?: string; profile?: string; noQuality?: boolean; execute?: boolean; language?: string; force?: boolean; dryRun?: boolean; maxTokens?: number; } /** * Security violation found in generated code */ export interface SecurityViolation { pattern: string; reason: string; line: number; code: string; } /** * Result of security check on generated code */ export interface SecurityCheckResult { safe: boolean; violations: SecurityViolation[]; } /** * Result of code execution */ export interface ExecuteResult { exitCode: number; stdout: string; stderr: string; } /** * Task types that profiles can handle */ export type TaskType = 'frontend' | 'backend' | 'api' | 'database' | 'scraping' | 'utility' | 'testing' | 'devops' | 'general'; /** * Applicability rules for a profile */ export interface ProfileApplicability { keywords: string[]; languages: string[]; taskTypes: TaskType[]; excludePatterns?: string[]; } /** * Agent profile metadata */ export interface AgentProfile { id: string; name: string; description: string; version: string; tags: string[]; applicability: ProfileApplicability; } /** * Loaded profile with instructions content */ export interface LoadedProfile extends AgentProfile { instructions: string; path: string; } /** * Profile registry for caching loaded profiles */ export interface ProfileRegistry { profiles: Map; lastUpdated: Date; } /** * Profile summary (without full instructions) */ export interface ProfileSummary { id: string; name: string; description: string; tags: string[]; taskTypes: TaskType[]; } /** * API plan tiers with rate limits */ export type ApiPlan = 'lite' | 'pro' | 'max'; /** * Plan limits (prompts per 5 hours) */ export interface PlanLimit { promptsPer5Hours: number; concurrency: number; }