Also record repo relative file path

Michael Sloan created

Change summary

crates/cloud_llm_client/src/cloud_llm_client.rs | 8 +++++++-
crates/zeta/src/zeta.rs                         | 6 ++++--
2 files changed, 11 insertions(+), 3 deletions(-)

Detailed changes

crates/cloud_llm_client/src/cloud_llm_client.rs 🔗

@@ -156,6 +156,9 @@ pub struct PredictEditsBody {
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct PredictEditsGitInfo {
+    /// Path within the repository that contains the input excerpt.
+    #[serde(skip_serializing_if = "Option::is_none", default)]
+    pub input_path: Option<String>,
     /// SHA of git HEAD commit at time of prediction.
     #[serde(skip_serializing_if = "Option::is_none", default)]
     pub head_sha: Option<String>,
@@ -165,13 +168,16 @@ pub struct PredictEditsGitInfo {
     /// URL of the remote called `upstream`.
     #[serde(skip_serializing_if = "Option::is_none", default)]
     pub remote_upstream_url: Option<String>,
+    /// Recently active files that may be within this repository.
     #[serde(skip_serializing_if = "Option::is_none", default)]
     pub recent_files: Option<Vec<PredictEditsRecentFile>>,
 }
 
 #[derive(Debug, Clone, Serialize, Deserialize)]
 pub struct PredictEditsRecentFile {
-    pub repo_path: String,
+    /// Path to a file within the repository.
+    pub path: String,
+    /// Milliseconds between the editor for this file being active and the request time.
     pub active_to_now_ms: u32,
 }
 

crates/zeta/src/zeta.rs 🔗

@@ -1146,8 +1146,9 @@ and then another
         }
 
         let git_store = project.git_store().read(cx);
-        let (repository, _repo_path) =
+        let (repository, repo_path) =
             git_store.repository_and_path_for_project_path(&project_path, cx)?;
+        let repo_path_str = repo_path.to_str()?;
 
         let repository = repository.read(cx);
         let head_sha = repository
@@ -1163,6 +1164,7 @@ and then another
         let recent_files = self.recent_files(&buffer_snapshotted_at, repository, cx);
 
         Some(PredictEditsGitInfo {
+            input_path: Some(repo_path_str.to_string()),
             head_sha,
             remote_origin_url,
             remote_upstream_url,
@@ -1231,7 +1233,7 @@ and then another
                     continue;
                 };
                 results.push(PredictEditsRecentFile {
-                    repo_path: repo_path_str.to_string(),
+                    path: repo_path_str.to_string(),
                     active_to_now_ms,
                 });
             } else {