MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / dispatch_message_metadata

Function dispatch_message_metadata

src/sessions/cursor.rs:1182–1207  ·  view source on GitHub ↗
(
    record: &Value,
    tool_use_id: Option<&str>,
    event_cwd: Option<&Path>,
    location_provenance: &str,
)

Source from the content-addressed store, hash-verified

1180}
1181
1182fn dispatch_message_metadata(
1183 record: &Value,
1184 tool_use_id: Option<&str>,
1185 event_cwd: Option<&Path>,
1186 location_provenance: &str,
1187) -> Value {
1188 let mut metadata = serde_json::Map::new();
1189 metadata.insert(
1190 "source".to_string(),
1191 Value::String("cursor_transcript".to_string()),
1192 );
1193 metadata.insert(
1194 "raw_type".to_string(),
1195 record.get("type").cloned().unwrap_or(Value::Null),
1196 );
1197 metadata.insert(
1198 "tool_use_id".to_string(),
1199 tool_use_id.map_or(Value::Null, |id| Value::String(id.to_string())),
1200 );
1201 append_location_metadata(
1202 &mut metadata,
1203 CURSOR_EVENT_LOCATION_KEYS,
1204 TranscriptLocation::new(event_cwd, location_provenance),
1205 );
1206 Value::Object(metadata)
1207}

Callers 1

event_dispatch_messagesFunction · 0.85

Calls 2

append_location_metadataFunction · 0.85
insertMethod · 0.80

Tested by

no test coverage detected