(
&self,
path: &Path,
prev: StoredCursor,
project_root: &Path,
_max_new_bytes: Option<u64>,
)
| 88 | } |
| 89 | |
| 90 | fn parse_new( |
| 91 | &self, |
| 92 | path: &Path, |
| 93 | prev: StoredCursor, |
| 94 | project_root: &Path, |
| 95 | _max_new_bytes: Option<u64>, |
| 96 | ) -> Option<ParsedTranscript> { |
| 97 | let location_cwd = transcript_location_path(path, &self.workspace_storage_dir)?; |
| 98 | if !path_belongs_to_project(&location_cwd, project_root) { |
| 99 | return None; |
| 100 | } |
| 101 | |
| 102 | let changed = read_changed_file(path, prev)?; |
| 103 | let value: Value = match serde_json::from_str(&changed.contents) { |
| 104 | Ok(value) => value, |
| 105 | Err(_) => { |
| 106 | return Some(empty_changed_transcript( |
| 107 | path, |
| 108 | project_root, |
| 109 | Some(&location_cwd), |
| 110 | changed.new_cursor, |
| 111 | )); |
| 112 | } |
| 113 | }; |
| 114 | if value.get("executions").and_then(Value::as_array).is_some() { |
| 115 | return Some(empty_changed_transcript( |
| 116 | path, |
| 117 | project_root, |
| 118 | Some(&location_cwd), |
| 119 | changed.new_cursor, |
| 120 | )); |
| 121 | } |
| 122 | |
| 123 | let session_id = session_id_from_transcript(path, &value); |
| 124 | let model = model_from_transcript(&value); |
| 125 | let messages = |
| 126 | messages_from_transcript(&value, &session_id, path, model.as_deref(), &location_cwd); |
| 127 | if messages.is_empty() { |
| 128 | return Some(empty_changed_transcript( |
| 129 | path, |
| 130 | project_root, |
| 131 | Some(&location_cwd), |
| 132 | changed.new_cursor, |
| 133 | )); |
| 134 | } |
| 135 | |
| 136 | let project = project_root.to_string_lossy().to_string(); |
| 137 | let draft = SessionDraft { |
| 138 | session_id: session_id.clone(), |
| 139 | project_key: project.clone(), |
| 140 | project_path: project, |
| 141 | title: title_from_messages(&messages), |
| 142 | metadata_json: serde_json::to_string(&session_metadata(Some(&location_cwd))).ok(), |
| 143 | parent_session_id: None, |
| 144 | is_subagent: false, |
| 145 | agent_id: None, |
| 146 | parent_tool_use_id: None, |
| 147 | }; |
no test coverage detected