UNPKG

@webdevtoday/grok-cli

Version:

A sophisticated CLI tool for interacting with xAI Grok 4, featuring conversation history, file reference, custom commands, memory system, and genetic development workflows

164 lines 4.02 kB
/** * Enhanced Permission System for Grok CLI * Provides interactive prompts, persistence, and fine-grained control */ import type { PermissionManager, GrokConfig } from '../types'; export interface PermissionDecision { toolName: string; decision: 'allow' | 'deny' | 'always' | 'never'; timestamp: Date; params?: Record<string, unknown>; reason?: string; } export interface PermissionRule { toolPattern: string; paramPatterns?: Record<string, string>; decision: 'allow' | 'deny'; scope: 'session' | 'project' | 'global'; expires?: Date; reason?: string; } export interface PermissionAuditEntry { timestamp: Date; toolName: string; params: Record<string, unknown>; decision: 'allow' | 'deny'; mode: string; reason: string; user: string; sessionId: string; } /** * Enhanced Permission Manager with interactive prompts and persistence */ export declare class EnhancedPermissionManager implements PermissionManager { private config; private sessionDecisions; private persistentRules; private auditLog; private cwd; constructor(config: GrokConfig, cwd?: string); /** * Check if a tool has permission to execute */ checkToolPermission(toolName: string, params: Record<string, unknown>): boolean; /** * Request permission with interactive prompt */ requestPermission(toolName: string, params: Record<string, unknown>): Promise<boolean>; /** * Show interactive permission prompt */ private askUserPermission; /** * Show planned execution without executing */ private showPlannedExecution; /** * Display parameters with formatting and security assessment */ private displayParameters; /** * Show detailed information about the tool and operation */ private showDetailedInformation; /** * Record session-level permission decision */ private recordSessionDecision; /** * Create persistent permission rule */ private createPersistentRule; /** * Load persistent rules from disk */ private loadPersistentRules; /** * Save persistent rules to disk */ private savePersistentRules; /** * Find matching persistent rule */ private findMatchingRule; /** * Check if string matches a pattern (supports basic wildcards) */ private matchesPattern; /** * Generate session key for caching decisions */ private generateSessionKey; /** * Assess risk level of tool execution */ private assessRisk; /** * Get reasons for risk assessment */ private getRiskReasons; /** * Assess parameter sensitivity */ private assessParameterSensitivity; /** * Format parameter value for display */ private formatParameterValue; /** * Format sensitivity level */ private formatSensitivity; /** * Format risk level with colors */ private formatRiskLevel; /** * Get tool description */ private getToolDescription; /** * Get tool capabilities */ private getToolCapabilities; /** * Predict tool behavior */ private predictToolBehavior; /** * Analyze parameter */ private analyzeParameter; /** * Find similar previous decisions */ private findSimilarDecisions; /** * Record audit entry */ private auditDecision; /** * Get audit log */ getAuditLog(): PermissionAuditEntry[]; /** * Get permission statistics */ getPermissionStats(): { totalDecisions: number; allowedCount: number; deniedCount: number; ruleCount: number; sessionDecisions: number; }; /** * Clear session decisions */ clearSessionDecisions(): void; /** * Get time ago string */ private getTimeAgo; } //# sourceMappingURL=permissions.d.ts.map