Skip to main content

codetether_agent/session/
checkpoint.rs

1//! Resumable run checkpoint data persisted beside session metadata.
2
3use chrono::{DateTime, Utc};
4use serde::{Deserialize, Serialize};
5use std::path::PathBuf;
6
7#[path = "checkpoint_assemble.rs"]
8mod checkpoint_assemble;
9#[path = "checkpoint_assistant.rs"]
10mod checkpoint_assistant;
11#[path = "checkpoint_build.rs"]
12mod checkpoint_build;
13#[path = "checkpoint_defaults.rs"]
14mod checkpoint_defaults;
15#[path = "checkpoint_state.rs"]
16mod checkpoint_state;
17#[path = "checkpoint_text.rs"]
18mod checkpoint_text;
19#[path = "checkpoint_tool.rs"]
20mod checkpoint_tool;
21#[path = "checkpoint_update.rs"]
22mod checkpoint_update;
23#[path = "checkpoint_walk.rs"]
24mod checkpoint_walk;
25
26/// A structured checkpoint for a step-budget-exhausted `codetether run`.
27#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
28pub struct RunCheckpoint {
29    pub reason: CheckpointReason,
30    pub original_objective: String,
31    pub max_step_budget: usize,
32    pub session_id: String,
33    pub workspace: Option<PathBuf>,
34    pub message_count: usize,
35    /// Last known browser URL extracted from tool calls in the session.
36    pub current_browser_url: Option<String>,
37    /// Tool call names that completed successfully before checkpoint.
38    pub completed_actions: Vec<String>,
39    /// Errors or blockers encountered before checkpoint.
40    pub blockers: Vec<String>,
41    /// Inferred next action based on the last assistant message.
42    pub next_intended_action: String,
43    pub created_at: DateTime<Utc>,
44}
45
46/// The reason a resumable run checkpoint was created.
47#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
48#[serde(rename_all = "snake_case")]
49pub enum CheckpointReason {
50    /// The run stopped because its configured maximum step budget was reached.
51    MaxStepsExhausted,
52}