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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//! Callback type aliases used by the runtime middleware pipeline.
//!
//! The public middleware registration APIs accept boxed or shared closures with
//! the signatures defined in this module. These aliases centralize those
//! signatures so the runtime can compose tool and LLM middleware consistently
//! across bindings.
use Future;
use Pin;
use Arc;
use Stream;
use crateEvent;
use crateLlmRequest;
use crateAnnotatedLlmRequest;
use crateResult;
use crateJson;
/// Sanitize a tool request payload before the runtime records it.
///
/// Tool sanitize callbacks are used only for observability payloads. They can
/// rewrite the JSON arguments recorded on tool-start events without changing
/// the caller-owned request that is passed to the tool implementation.
pub type ToolSanitizeFn = ;
/// Decide whether a tool call is allowed to continue.
///
/// The callback receives the tool name and the current argument payload. It can
/// return `Ok(None)` to allow execution, `Ok(Some(reason))` to reject the call
/// with a guardrail message, or an error to abort evaluation entirely.
pub type ToolConditionalFn = ;
/// Rewrite tool arguments before execution.
///
/// Tool request intercepts run in priority order and can transform the JSON
/// payload that is eventually passed into the tool execution callback.
pub type ToolInterceptFn = ;
/// Continuation type invoked by tool execution intercepts.
///
/// Execution intercepts receive this callable as their `next` continuation and
/// can call it with modified arguments, wrap it, or skip it entirely.
pub type ToolExecutionNextFn =
;
/// Wrap or replace tool execution.
///
/// A tool execution intercept receives the tool name, the current argument
/// payload, and the continuation representing the rest of the chain.
pub type ToolExecutionFn = ;
/// Sanitize an LLM request before the runtime records it.
///
/// LLM request sanitizers affect the serialized request payload emitted on
/// start events. They do not mutate the caller-owned [`LlmRequest`] unless a
/// separate request intercept does so.
pub type LlmSanitizeRequestFn = ;
/// Sanitize an LLM response before the runtime records it.
///
/// These callbacks rewrite the JSON response payload captured on LLM-end
/// events, which is useful for redaction or payload normalization.
pub type LlmSanitizeResponseFn = ;
/// Decide whether an LLM call is allowed to continue.
///
/// The callback receives the current [`LlmRequest`] and can allow execution,
/// reject it with a guardrail reason, or return an error.
pub type LlmConditionalFn = ;
/// Rewrite or annotate an LLM request before execution.
///
/// Request intercepts can transform the wire request, attach or replace a
/// normalized [`AnnotatedLlmRequest`], or both.
pub type LlmRequestInterceptFn = ;
/// Continuation type invoked by non-streaming LLM execution intercepts.
///
/// Execution intercepts use this callable to continue the non-streaming LLM
/// pipeline after applying their own logic.
pub type LlmExecutionNextFn =
;
/// Wrap or replace non-streaming LLM execution.
///
/// A non-streaming execution intercept receives the logical provider name, the
/// current request, and the continuation representing the rest of the chain.
pub type LlmExecutionFn = ;
/// Stream of JSON chunks produced by the managed streaming LLM pipeline.
pub type LlmJsonStream = ;
/// Per-chunk collector used by the streaming LLM runtime.
pub type LlmCollectorFn = ;
/// Finalizer used to synthesize the aggregate streaming response payload.
pub type LlmFinalizerFn = ;
/// Scope-local registry references passed into streaming execution-chain builders.
pub type LlmStreamExecutionRegistryRef<'a> = &'a crateSortedRegistry;
/// Slice of scope-local streaming execution registries.
pub type LlmStreamExecutionRegistryRefs<'a> = &'a ;
/// Continuation type invoked by streaming LLM execution intercepts.
///
/// This callable represents the remainder of the streaming LLM execution chain
/// and resolves to a stream of JSON response chunks.
pub type LlmStreamExecutionNextFn = ;
/// Wrap or replace streaming LLM execution.
///
/// A streaming execution intercept can observe or modify the request before
/// invoking the continuation, and it can also replace the returned stream.
pub type LlmStreamExecutionFn = ;
/// Consume runtime lifecycle events after they are emitted.
///
/// Event subscribers are invoked for scope, tool, LLM, and mark events after
/// the runtime has built the final event payload.
pub type EventSubscriberFn = ;