/** * Package Approval Manager * * Manages runtime package approvals with scoped expiration. * Approvals are stored in-memory only - no persistent security holes. * * Uses MCP elicitation if available, falls back to native OS dialogs. * * Approval Scopes: * - "operation": Approve for single code execution only * - "session": Approve until server restarts * - "hour": Approve for 1 hour * - "day": Approve for 24 hours */ export declare const BUILTIN_PACKAGES: Set; export declare const BLOCKED_PACKAGES: Set; export type ApprovalScope = 'operation' | 'session' | 'hour' | 'day'; /** * Elicitation function type - same pattern as NetworkPolicy * Takes title/message/options, returns selected option string or null */ export type PackageElicitationFunction = (params: { title: string; message: string; options: string[]; }) => Promise; /** * Extract require() calls from code string */ export declare function extractRequiredPackages(code: string): string[]; export interface PackageAnalysis { whitelisted: string[]; needsApproval: string[]; blocked: string[]; } /** * Package Approval Manager - singleton for session-scoped approvals */ export declare class PackageApprovalManager { private approvals; private elicitationFunction?; /** * Set elicitation function for MCP-based prompts * If not set, falls back to native OS dialogs */ setElicitationFunction(fn: PackageElicitationFunction): void; /** * Analyze code for package requirements */ analyzeCode(code: string): PackageAnalysis; /** * Check if a package is currently approved */ isApproved(packageName: string): boolean; /** * Grant approval for a package with specified scope */ approve(packageName: string, scope: ApprovalScope): void; /** * Grant approvals for multiple packages */ approveAll(packages: string[], scope: ApprovalScope): void; /** * Clear operation-scoped approvals (call after each code execution) */ clearOperationApprovals(): void; /** * Get all currently approved packages (for debugging) */ getApprovedPackages(): string[]; /** * Revoke approval for a package */ revoke(packageName: string): void; /** * Clear all approvals */ clearAll(): void; /** * Get combined whitelist (built-in + approved) */ getEffectiveWhitelist(): string[]; /** * Request approval for packages from user * Uses MCP elicitation if available, falls back to native OS dialog * * @returns The approval scope if approved, null if denied */ requestApproval(packages: string[]): Promise; } export declare function getPackageApprovalManager(): PackageApprovalManager; /** * Format user-friendly message for package approval request */ export declare function formatApprovalRequest(packages: string[]): string; /** * Get approval scope options for elicitation */ export declare function getApprovalOptions(): { label: string; value: ApprovalScope; }[]; //# sourceMappingURL=package-approval.d.ts.map