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
47
48
49
50
51
52
53
54
55
//! Text tool-call parsing: the reverse-direction wire format used by the
//! agent loop to read tool invocations back out of a model response.
//!
//! Exposes `parse_text_tool_calls_with_tools` + `parse_bare_calls_in_body`
//! and the `TextToolParseResult` shape; everything else is a local helper
//! (ident parser, TS literal parser, heredoc skipper, native-JSON fallback).
pub use parse_bare_calls_in_body;
pub use parse_native_json_tool_calls;
pub use ident_length;
pub use parse_text_tool_calls_with_tools;
/// Result of parsing a prose-interleaved TS tool-call stream.
///
/// The scanner walks the model's text once and splits it into three
/// streams for the caller:
/// - `calls`: the parsed structured tool calls.
/// - `errors`: diagnostics for malformed call attempts.
/// - `prose`: the original text with every successfully-parsed call
/// expression removed, whitespace around the hole collapsed. This is
/// what should be shown as "the agent's answer" and replayed back into
/// conversation history — tool calls are structured data, not narration.
pub