claude_code_sdk_rust/internal/
session_store_validation.rs1use crate::error::{ClaudeSDKError, Result};
2use crate::types::ClaudeAgentOptions;
3
4pub fn validate_session_store_options(options: &ClaudeAgentOptions) -> Result<()> {
5 if options.can_use_tool.is_some() && options.permission_prompt_tool_name.is_some() {
6 return Err(ClaudeSDKError::Other(
7 "can_use_tool callback cannot be used with permission_prompt_tool_name. \
8 Please use one or the other."
9 .to_string(),
10 ));
11 }
12
13 let Some(store) = &options.session_store else {
14 return Ok(());
15 };
16
17 if options.continue_conversation && options.resume.is_none() && !store.supports_list_sessions()
18 {
19 return Err(ClaudeSDKError::Other(
20 "continue_conversation with session_store requires the store to implement list_sessions()"
21 .to_string(),
22 ));
23 }
24
25 if options.enable_file_checkpointing {
26 return Err(ClaudeSDKError::Other(
27 "session_store cannot be combined with enable_file_checkpointing \
28 (checkpoints are local-disk only and would diverge from the mirrored transcript)"
29 .to_string(),
30 ));
31 }
32
33 Ok(())
34}