(event: &Value, event_cwd: Option<&Path>, location_provenance: &str)
| 1124 | } |
| 1125 | |
| 1126 | fn session_metadata(event: &Value, event_cwd: Option<&Path>, location_provenance: &str) -> Value { |
| 1127 | let mut metadata = serde_json::Map::new(); |
| 1128 | metadata.insert( |
| 1129 | "source".to_string(), |
| 1130 | Value::String("cursor_transcript".to_string()), |
| 1131 | ); |
| 1132 | metadata.insert( |
| 1133 | "conversation_id".to_string(), |
| 1134 | event.get("conversation_id").cloned().unwrap_or(Value::Null), |
| 1135 | ); |
| 1136 | metadata.insert( |
| 1137 | "hook_event_name".to_string(), |
| 1138 | event.get("hook_event_name").cloned().unwrap_or(Value::Null), |
| 1139 | ); |
| 1140 | metadata.insert( |
| 1141 | "cursor_version".to_string(), |
| 1142 | event.get("cursor_version").cloned().unwrap_or(Value::Null), |
| 1143 | ); |
| 1144 | if let Some(roots) = event.get("workspace_roots") { |
| 1145 | metadata.insert("workspace_roots".to_string(), roots.clone()); |
| 1146 | } |
| 1147 | append_location_metadata( |
| 1148 | &mut metadata, |
| 1149 | CURSOR_EVENT_LOCATION_KEYS, |
| 1150 | TranscriptLocation::new(event_cwd, location_provenance), |
| 1151 | ); |
| 1152 | Value::Object(metadata) |
| 1153 | } |
| 1154 | |
| 1155 | fn message_metadata( |
| 1156 | record: &Value, |
no test coverage detected