intellicrack.core.tool_progress
Progress a running tool call reports, carried from the tool back to the operator.
The orchestrator runs each tool call with a reporter bound for that call. Whatever carries out the call – a server’s tool, reached
through the MCP tool source – picks the reporter up with current_progress_reporter() when the call starts, and reports through it
for as long as the call runs, even from another task. The orchestrator turns each report into a ToolProgress for the call and
hands it to the UI, which shows it beside the running call.
RunningToolCalls runs each call as a task of its own, which is what lets the operator cancel one call while the turn goes on.
- type ToolProgressReporter = Callable[[float, float | None, str | None], None]
Reports how far a call has got, its total if known, and a message.
- class ToolProgress[source]
Bases:
objectHow far one running tool call has got.
- Variables:
- property fraction: float | None
How much of the total is done.
- Returns:
A value from 0 to 1, or
Nonewhen the total is unknown.- Return type:
float | None
- current_progress_reporter()[source]
Find the reporter bound for the tool call running in this context.
- Returns:
The reporter, or
Noneoutside a tool call.- Return type:
ToolProgressReporter | None
- reporting_progress(reporter)[source]
Bind a reporter for the tool call that runs inside the block.
- Parameters:
reporter (ToolProgressReporter) – Receives the call’s progress.
- Yields:
None – Control passes to the block.
- Return type:
Generator[None]
- exception ToolCallCancelledError[source]
Bases:
ExceptionRaised for a tool call the operator cancelled on its own.
- class RunningToolCalls[source]
Bases:
objectThe tool calls running now, which the operator can cancel one at a time.
Each call runs as its own task with a progress reporter bound, so the operator can stop one call and let the turn go on, and see how far each one has got meanwhile. Everything here runs on the orchestrator’s loop.
- set_progress_callback(callback)[source]
Choose who receives running calls’ progress.
- Parameters:
callback (Callable[[ToolProgress], None] | None) – Receives each report, or
Noneto stop reporting.- Return type:
None
- async run(call_id, work)[source]
Run one call as a task of its own, with its progress reported.
- Parameters:
call_id (str) – The call.
work (Callable[[], Awaitable[_T]]) – Carries the call out.
- Returns:
What the call returned.
- Return type:
_T
- Raises:
ToolCallCancelledError – If the operator cancelled this call.
CancelledError – If whoever awaits the call was cancelled, which cancels the call with it.