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 reopen \
34 this dialog.";
35
36impl CodexHistoryMode {
37 pub fn import_issue(self) -> Option<&'static str> {
38 match self {
39 Self::Legacy => Some(CODEX_LEGACY_IMPORT_ISSUE),
40 Self::Paginated => None,
41 }
42 }
43}
44
45#[derive(Debug, Clone)]
46pub struct LocatedCodexSession {
47 pub native_session_id: String,
48 pub jsonl_path: PathBuf,
49 pub modified_at: SystemTime,
50 pub title: String,
51 pub cwd: PathBuf,
52 pub git_branch: String,
53 pub size_bytes: u64,
54 pub history_mode: CodexHistoryMode,
55 pub natively_archived: bool,
58}
59
60#[derive(Debug, Clone)]
61pub struct LocatedKimiSession {
62 pub native_session_id: String,
63 pub session_path: PathBuf,
64 pub modified_at: SystemTime,
65 pub title: String,
66 pub cwd: PathBuf,
67 pub git_branch: String,
68 pub size_bytes: u64,
69}
70
71pub type LocatedGrokSession = LocatedKimiSession;
73
74#[derive(Debug, Clone)]
75pub struct SessionScanProgress<T> {
76 pub scanned: usize,
77 pub total: usize,
78 pub session: Option<T>,
79}
80
81#[derive(Debug)]
82pub(super) struct FileScanCandidate {
83 pub(super) path: PathBuf,
84 pub(super) modified_at: SystemTime,
85 pub(super) size_bytes: u64,
86}
87
88#[derive(Debug)]
89pub(super) struct KimiScanCandidate {
90 pub(super) native_session_id: String,
91 pub(super) session_path: PathBuf,
92 pub(super) modified_at: SystemTime,
93 pub(super) title: String,
94 pub(super) cwd: PathBuf,
95}
96
97#[derive(Debug)]
98pub(super) struct CodexSessionMetadata {
99 pub(super) id: String,
100 pub(super) cwd: PathBuf,
101 pub(super) git_branch: String,
102 pub(super) history_mode: CodexHistoryMode,
103}
104
105#[derive(Debug, Clone, PartialEq, Eq)]
106pub struct ClaudeTranscript {
107 pub cwd: PathBuf,
108 pub edited_paths: Vec<PathBuf>,
110 pub events: Vec<SequencedEvent>,
111}
112
113pub type CodexTranscript = ClaudeTranscript;
114pub type KimiTranscript = ClaudeTranscript;
115pub type GrokTranscript = ClaudeTranscript;
116
117#[derive(Debug, Clone, PartialEq, Eq)]
118pub enum BundleResolution {
119 Existing(String),
120 Synthesized {
122 id: String,
123 bundle: ProjectBundle,
124 },
125}
126
127#[derive(Debug, Clone, PartialEq, Eq)]
128pub struct SessionEditTargets {
129 pub git_roots: Vec<PathBuf>,
130 pub scratch_git_roots: Vec<PathBuf>,
133 pub non_git_dirs: Vec<PathBuf>,
134}
135
136#[derive(Debug, Clone, PartialEq, Eq)]
137pub struct ImportSafetyIssues {
138 pub dirty_git_roots: Vec<(PathBuf, String)>,
139 pub omitted_non_git_dirs: Vec<PathBuf>,
140 pub scratch_git_roots: Vec<PathBuf>,
141 pub has_untracked_files: bool,
142}