1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! [`ToolCtx`]: the per-attempt context a tool's
//! [`call`](crate::ToolHandler::call) receives.
/// What the runtime hands a tool for one execution attempt.
///
/// This type is kept deliberately small. The only thing a handler clearly
/// needs is the idempotency key for the current
/// attempt: an [`Idempotent`](salvor_core::Effect::Idempotent) tool uses it so
/// that a retried attempt reuses the same key and the provider collapses the
/// duplicate into one effect. Everything else a tool might want (recorded
/// clock, randomness, model calls) belongs to `RunCtx` in the orchestration
/// layer, not to a single tool call, so it stays out of here.
///
/// The type is designed for additive growth. Fields are private and reached
/// through accessors, so run identity, the current sequence number, or a
/// tracing span can be added later without breaking a tool's `call` signature.
///
/// It is constructed by the runtime, not by tools. The runtime builds
/// one `ToolCtx` per dispatch from the idempotency key the replay cursor
/// carries for that tool call; tests construct it directly.