mj_controller/import/
types.rs1use super::*;
2
3#[derive(Debug, Clone, PartialEq, Eq)]
4pub enum ClaudeSessionSelection {
5 NativeSessionId(String),
6 Latest,
7}
8
9pub type CodexSessionSelection = ClaudeSessionSelection;
10pub type KimiSessionSelection = ClaudeSessionSelection;
11pub type GrokSessionSelection = ClaudeSessionSelection;
12
13#[derive(Debug, Clone)]
14pub struct LocatedClaudeSession {
15 pub native_session_id: String,
16 pub jsonl_path: PathBuf,
17 pub modified_at: SystemTime,
18 pub title: String,
19 pub cwd: PathBuf,
20 pub git_branch: String,
21 pub size_bytes: u64,
22}
23
24#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub enum CodexHistoryMode {
26 Legacy,
27 Paginated,
28}
29
30pub(super) const CHAT_HISTORY: &str = "chat_history.jsonl";
32
33pub const CODEX_LEGACY_IMPORT_ISSUE: &str = "Legacy Codex history cannot be imported. Run codex migrate-rollouts --apply, then try \
36 the import again.";
37
38impl CodexHistoryMode {
39 pub fn import_issue(self) -> Option<&'static str> {
40 match self {
41 Self::Legacy => Some(CODEX_LEGACY_IMPORT_ISSUE),
42 Self::Paginated => None,
43 }
44 }
45}
46
47#[derive(Debug, Clone)]
48pub struct LocatedCodexSession {
49 pub native_session_id: String,
50 pub jsonl_path: PathBuf,
51 pub modified_at: SystemTime,
52 pub title: String,
53 pub cwd: PathBuf,
54 pub git_branch: String,
55 pub size_bytes: u64,
56 pub history_mode: CodexHistoryMode,
57 pub natively_archived: bool,
60}
61
62#[derive(Debug, Clone)]
63pub struct LocatedKimiSession {
64 pub native_session_id: String,
65 pub session_path: PathBuf,
66 pub modified_at: SystemTime,
67 pub title: String,
68 pub cwd: PathBuf,
69 pub git_branch: String,
70 pub size_bytes: u64,
71}
72
73pub type LocatedGrokSession = LocatedKimiSession;
75
76#[derive(Debug, Clone)]
77pub struct SessionScanProgress<T> {
78 pub scanned: usize,
79 pub total: usize,
80 pub session: Option<T>,
81}
82
83#[derive(Debug)]
84pub(super) struct FileScanCandidate {
85 pub(super) path: PathBuf,
86 pub(super) modified_at: SystemTime,
87 pub(super) size_bytes: u64,
88}
89
90#[derive(Debug)]
91pub(super) struct KimiScanCandidate {
92 pub(super) native_session_id: String,
93 pub(super) session_path: PathBuf,
94 pub(super) modified_at: SystemTime,
95 pub(super) title: String,
96 pub(super) cwd: PathBuf,
97}
98
99#[derive(Debug, Clone)]
100pub(super) struct CodexSessionMetadata {
101 pub(super) id: String,
102 pub(super) cwd: PathBuf,
103 pub(super) git_branch: String,
104 pub(super) history_mode: CodexHistoryMode,
105}
106
107#[derive(Debug, Clone, PartialEq, Eq)]
108pub struct ClaudeTranscript {
109 pub cwd: PathBuf,
110 pub edited_paths: Vec<PathBuf>,
112 pub events: Vec<SequencedEvent>,
113}
114
115pub type CodexTranscript = ClaudeTranscript;
116pub type KimiTranscript = ClaudeTranscript;
117pub type GrokTranscript = ClaudeTranscript;
118
119#[derive(Debug, Clone, PartialEq, Eq)]
120pub enum BundleResolution {
121 Existing(String),
122 Synthesized {
124 id: String,
125 bundle: ProjectBundle,
126 },
127}
128
129#[derive(Debug, Clone, PartialEq, Eq)]
130pub struct SessionEditTargets {
131 pub git_roots: Vec<PathBuf>,
132 pub scratch_git_roots: Vec<PathBuf>,
135 pub non_git_dirs: Vec<PathBuf>,
136}
137
138#[derive(Debug, Clone, PartialEq, Eq)]
139pub struct ImportSafetyIssues {
140 pub dirty_git_roots: Vec<(PathBuf, String)>,
141 pub omitted_non_git_dirs: Vec<PathBuf>,
142 pub scratch_git_roots: Vec<PathBuf>,
143 pub has_untracked_files: bool,
144}