feat(sagent): record an activity line when a run seals an artifact
ZhenYi committed
Modified lib/sagent/src/services/subscribe.rs lib/sagent/src/services/subscribe.rs +16 −1 View lib/sagent/src/services/subscribe.rs
@@ -157,6 +157,7 @@
157157 if let Some(artifact) = sealed {
158158 let key = artifact.object.key.to_string();
159159 let name = key.rsplit('/').next().unwrap_or(&key).to_string();
160 let size = artifact.size_bytes.min(i64::MAX as u64) as i64;
160161 self.record_artifact(
161162 &txn,
162163 task.id,
@@ -164,10 +165,24 @@
164165 artifact.kind.as_str(),
165166 &name,
166167 None,
167 artifact.size_bytes.min(i64::MAX as u64) as i64,
168 size,
168169 &key,
169170 )
170171 .await?;
172 self.write_event(
173 &txn,
174 task.id,
175 task.collection_id,
176 None,
177 AgentEventType::ArtifactAdded,
178 Some(run_id.as_uuid()),
179 Some(serde_json::json!({
180 "name": name,
181 "kind": artifact.kind.as_str(),
182 "size": size,
183 })),
184 )
185 .await?;
171186 }
172187 txn.commit().await?;
173188 Ok(false)