How a tool call waits for an outside event or a time.
A tool parks by returning {:park, state, opts} from Condukt.Tool.call/2
instead of a result, much as a GenServer callback returns
{:noreply, state, timeout}:
{:park, %{build_id: build.id},
signals: [{MyApp.Signals.CiResult, "ci-" <> context.tool_call_id}],
timeout: :timer.hours(2)}Options:
:signals-{kind, key}pairs to wake on, wherekindis aCondukt.Signalmodule andkeya string. The first one delivered wakes the call.:timeout- milliseconds from now after which the call wakes anyway.:until- aDateTimeafter which the call wakes anyway. Use either:untilor:timeout, not both.
A park needs signals, a deadline, or both, and the tool must implement
Condukt.Tool.wake/3. While a call is parked no tool code runs: the
turn's worker blocks in receive, the tool timeout does not apply, and the
session holds the wait as data. When the call wakes, the session calls
wake/3 with {:signal, {kind, key}, value} or :timeout, and state.
The deadline is stored as wall-clock time rather than as a timer, so it
means the same thing after the session process that armed it is gone. A
running session arms it with Process.send_after/3.
See the Waiting for Events guide.