/** * Claude Agent Client * * Handles business logic for tool approvals and hook callbacks. * * @module agents/claude/protocol/client */ import type { IProtocolClient } from './protocol-peer.js'; import type { ControlRequest, ControlResponse } from '../types/control.js'; import type { IApprovalService } from '../../types/agent-executor.js'; /** * Claude Agent Client * * Implements the approval logic for Claude Code tool usage. * Integrates with IApprovalService for approval decisions and handles * hook callbacks for tracking tool usage IDs. * * @example Without approval service (auto-approve) * ```typescript * const client = new ClaudeAgentClient(); * // All tools will be auto-approved * ``` * * @example With approval service * ```typescript * const approvalService: IApprovalService = { * async requestApproval(request) { * // Show UI or apply rules * return { status: 'approved' }; * } * }; * * const client = new ClaudeAgentClient(approvalService); * ``` */ export declare class ClaudeAgentClient implements IProtocolClient { private approvalService?; private toolUseIdMap; /** * Create a new ClaudeAgentClient * * @param approvalService - Optional approval service for tool approvals. * If not provided, all tools will be auto-approved. */ constructor(approvalService?: IApprovalService); /** * Set the approval service * * @param service - Approval service to use for tool approvals */ setApprovalService(service: IApprovalService | undefined): void; /** * Handle a control request from Claude CLI * * Routes to appropriate handler based on request type. * * @param request - Control request (can_use_tool or hook_callback) * @param requestId - Request ID for response matching * @returns Control response (success or error) */ handleControlRequest(request: ControlRequest, requestId: string): Promise; /** * Handle hook callback request * * For PreToolUse hooks, stores the tool_use_id for later matching * with can_use_tool requests. * * @param request - Hook callback request * @param requestId - Request ID * @returns Hook output with 'ask' permission decision */ private handleHookCallback; /** * Handle can_use_tool request * * Delegates approval decision to IApprovalService if set, otherwise auto-approves. * Handles ExitPlanMode special case by switching to bypass permissions. * * @param request - Can use tool request * @param requestId - Request ID * @returns Permission result (allow or deny) */ private handleCanUseTool; /** * Convert ApprovalDecision to PermissionResult * * Maps the generic approval decision to Claude-specific permission result. * * @param decision - Approval decision from service * @returns Permission result for Claude CLI */ private convertApprovalDecision; } //# sourceMappingURL=client.d.ts.map