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
//! Per-turn context helpers for the system prompt: reachability and the
//! last-SQL user-turn hint.
//!
//! Split out of `system_prompt.rs` when that file approached the 250-line
//! hard cap. No behavior change: moved verbatim, re-exported through
//! `system_prompt` so existing call sites keep their paths.
use ContextBlock;
/// Whether this turn can honour what the memory section promises.
///
/// The section tells the model that confirmed facts are already in context and
/// that two named tools are available. Both are only true when the state store
/// opened *and* the privacy gate is open — with either shut, recall never ran
/// and the contract tools are not advertised. Briefing the model anyway would
/// have it look for supplied facts that are not there and call tools it does
/// not have, which is a worse failure than saying nothing.
pub
/// Hint prose for adapting the most recent executed SQL query. Carried on the
/// user turn as a [`ContextBlock`] body (see [`last_sql_hint_block`]) — never in
/// the system prompt, where it would change on every follow-up that ran SQL and
/// forfeit the provider's prefix cache.
/// Label for the last-SQL hint context block, which rides the user turn beside
/// the recall context block.
pub const LAST_SQL_BLOCK_LABEL: &str = "last-sql";
/// Builds the user-turn context block carrying the most recent SQL, so the
/// model can adapt it without the hint polluting the session-stable system
/// prompt. Returns `None` for empty/whitespace SQL. The body is untrusted data
/// rendered into the user turn by `saya_agent::build_messages` (quoted,
/// labelled, escaped) — never the system message.
pub