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
use Cow;
use ;
use crateerror;
/// An inner error from a [`FunctionInventionRecursiveChunk`](super::FunctionInventionRecursiveChunk).
///
/// Always carries `function_invention_index` identifying which wrapped
/// non-recursive `FunctionInventionChunk` produced the error (matches
/// [`FunctionInventionChunk::index`](super::FunctionInventionChunk::index)).
///
/// The optional `agent_completion_index` disambiguates the failure site:
///
/// - `None` → the wrapped invention's own top-level `.error` (the invention
/// itself failed).
/// - `Some(N)` → an inner error from agent completion `N` inside the
/// wrapped invention (one of the items the non-recursive invention's
/// own `inner_errors()` would have yielded).
///
/// Wire shape:
/// ```json
/// { "function_invention_index": 0, "error": { } }
/// { "function_invention_index": 0, "agent_completion_index": 2, "error": { } }
/// ```
///
/// `agent_completion_index` is omitted on the wire when `None`,
/// matching the chunk-format conventions in the rest of the SDK.
///
/// The recursive chunk has no top-level `.error` field of its own,
/// so there is nothing to exclude at this level.