manager.cpython-312.pyc•9.25 kB
�
�6�g' � � � d Z ddlZddlZddlmZmZmZmZmZm Z ddl
Zddl
mZm
Z
ddlmZmZmZ ej$ e� Z G d� d� Zy) zTool execution manager.� N)�Dict�List�Any�Optional�Callable�Union)�ThreadPoolExecutor�Future� )�Tool�
ToolResult�ToolRegistryc � � e Zd ZdZdefd�Zdeeegdf ddfd�Z deee
gdf ddfd�Zd eee
f de
fd
�Zdeeee
f dee
fd�Zd
ededdfd�Zd
ededdfd�Zd
ede
ddfd�Zdeeeee
f f fd�Zd
edefd�Zy)�ToolExecutionManagerzKManages tool execution, including parallel execution and progress tracking.�registryc �J � || _ i | _ d| _ d| _ d| _ y)z�Initialize the tool execution manager.
Args:
registry: Tool registry containing available tools
N�
)r �active_executions�progress_callback�result_callback�max_workers)�selfr s �N/Users/agent/claude-code-reverse/python-agent/claude_code/lib/tools/manager.py�__init__zToolExecutionManager.__init__ s+ � � !��
�<>���IM���LP������ �callbackN�returnc � � || _ y)z�Set a callback function for progress updates.
Args:
callback: Function that takes tool_call_id and progress (0-1) as arguments
N)r �r r s r �set_progress_callbackz*ToolExecutionManager.set_progress_callback s � � "*��r c � � || _ y)z�Set a callback function for results.
Args:
callback: Function that takes tool_call_id and ToolResult as arguments
N)r r s r �set_result_callbackz(ToolExecutionManager.set_result_callback'