zeph_config/session.rs
1// SPDX-FileCopyrightText: 2026 Andrei G <bug-ops>
2// SPDX-License-Identifier: MIT OR Apache-2.0
3
4//! Session-scoped user experience settings (#3064).
5//!
6//! Configures behaviours that shape the user's experience per session, such as
7//! showing a recap of the previous conversation on resume.
8
9use serde::{Deserialize, Serialize};
10
11/// Top-level `[session]` config block.
12#[derive(Debug, Clone, Default, Deserialize, Serialize)]
13#[serde(default)]
14pub struct SessionConfig {
15 /// Recap-on-resume settings.
16 pub recap: RecapConfig,
17}
18
19/// `[session.recap]` — controls the session recap feature (#3064).
20///
21/// A recap summarises the previous conversation in a few sentences and is
22/// shown to the user when they resume a session that has a persisted digest.
23///
24/// # Example
25///
26/// ```toml
27/// [session.recap]
28/// on_resume = true
29/// max_tokens = 200
30/// provider = ""
31/// max_input_messages = 20
32/// ```
33#[derive(Debug, Clone, Deserialize, Serialize)]
34#[serde(default)]
35pub struct RecapConfig {
36 /// Show a recap of the previous session when resuming a conversation.
37 ///
38 /// When `true` and a persisted digest exists for the conversation, the
39 /// agent emits a brief recap before accepting the first user message.
40 /// Default: `true`.
41 pub on_resume: bool,
42
43 /// Maximum tokens for the recap text.
44 ///
45 /// Limits the length of the generated or cached recap. Default: `200`.
46 pub max_tokens: usize,
47
48 /// Provider name from `[[llm.providers]]` for recap LLM calls.
49 ///
50 /// An empty string falls back to the primary provider. Default: `""`.
51 pub provider: String,
52
53 /// Maximum recent messages included when generating a fresh recap.
54 ///
55 /// Used only when no cached digest is available (fresh-generation path).
56 /// Default: `20`.
57 pub max_input_messages: usize,
58}
59
60impl Default for RecapConfig {
61 fn default() -> Self {
62 Self {
63 on_resume: true,
64 max_tokens: 200,
65 provider: String::new(),
66 max_input_messages: 20,
67 }
68 }
69}