use crate::checkpoint::restore::ResumeContext;
#[derive(Debug, Clone, Default, PartialEq, Eq)]
#[must_use]
pub struct PromptConfig {
pub iteration: Option<u32>,
pub total_iterations: Option<u32>,
pub prompt_md_content: Option<String>,
pub prompt_and_plan: Option<(String, String)>,
pub prompt_plan_and_issues: Option<(String, String, String)>,
pub is_resume: bool,
pub resume_context: Option<ResumeContext>,
}
impl PromptConfig {
#[must_use = "configuration is required for prompt generation"]
pub const fn new() -> Self {
Self {
iteration: None,
total_iterations: None,
prompt_md_content: None,
prompt_and_plan: None,
prompt_plan_and_issues: None,
is_resume: false,
resume_context: None,
}
}
#[must_use = "returns the updated configuration for chaining"]
pub const fn with_iterations(mut self, iteration: u32, total: u32) -> Self {
self.iteration = Some(iteration);
self.total_iterations = Some(total);
self
}
#[must_use = "returns the updated configuration for chaining"]
pub fn with_prompt_md(mut self, content: String) -> Self {
self.prompt_md_content = Some(content);
self
}
#[must_use = "returns the updated configuration for chaining"]
pub fn with_prompt_and_plan(mut self, prompt: String, plan: String) -> Self {
self.prompt_and_plan = Some((prompt, plan));
self
}
pub fn with_prompt_plan_and_issues(
mut self,
prompt: String,
plan: String,
issues: String,
) -> Self {
self.prompt_plan_and_issues = Some((prompt, plan, issues));
self
}
#[must_use = "returns the updated configuration for chaining"]
pub const fn with_resume(mut self, is_resume: bool) -> Self {
self.is_resume = is_resume;
self
}
#[must_use = "returns the updated configuration for chaining"]
pub fn with_resume_context(mut self, context: ResumeContext) -> Self {
self.resume_context = Some(context);
self.is_resume = true;
self
}
}