core: type agent timestamps

This commit is contained in:
a.tolmachev
2026-04-19 07:11:55 +00:00
parent dddbbac745
commit 8d1f5284ba
9 changed files with 134 additions and 79 deletions
+15 -15
View File
@@ -2684,7 +2684,7 @@ impl AdminService {
)));
}
let now = now_string()?;
let now = OffsetDateTime::now_utc();
let agent_id = AgentId::new(new_prefixed_id("agent"));
let agent = Agent {
id: agent_id.clone(),
@@ -2695,8 +2695,8 @@ impl AdminService {
status: AgentStatus::Draft,
current_draft_version: 1,
latest_published_version: None,
created_at: now.clone(),
updated_at: now.clone(),
created_at: now,
updated_at: now,
published_at: None,
};
let version = AgentVersion {
@@ -2752,7 +2752,7 @@ impl AdminService {
)));
}
let updated_at = now_string()?;
let updated_at = OffsetDateTime::now_utc();
self.registry
.update_agent_summary(
workspace_id,
@@ -2767,7 +2767,7 @@ impl AdminService {
Ok(AgentMutationResult {
agent_id: agent_id.as_str().to_owned(),
workspace_id: workspace_id.as_str().to_owned(),
updated_at,
updated_at: format_timestamp(updated_at),
})
}
@@ -2790,7 +2790,7 @@ impl AdminService {
Ok(AgentMutationResult {
agent_id: agent_id.as_str().to_owned(),
workspace_id: workspace_id.as_str().to_owned(),
updated_at: existing.updated_at,
updated_at: format_timestamp(existing.updated_at),
})
}
@@ -2840,7 +2840,7 @@ impl AdminService {
agent_id: &AgentId,
version: u32,
) -> Result<PublishAgentResponse, ApiError> {
let published_at = now_string()?;
let published_at = OffsetDateTime::now_utc();
self.registry
.publish_agent(PublishAgentRequest {
workspace_id,
@@ -2856,7 +2856,7 @@ impl AdminService {
agent_id: agent_id.as_str().to_owned(),
workspace_id: workspace_id.as_str().to_owned(),
published_version: version,
published_at,
published_at: format_timestamp(published_at),
})
}
@@ -2867,7 +2867,7 @@ impl AdminService {
agent_id: &AgentId,
) -> Result<AgentMutationResult, ApiError> {
self.ensure_workspace_exists(workspace_id).await?;
let updated_at = now_string()?;
let updated_at = OffsetDateTime::now_utc();
self.registry
.unpublish_agent(workspace_id, agent_id, &updated_at)
.await?;
@@ -2876,7 +2876,7 @@ impl AdminService {
Ok(AgentMutationResult {
agent_id: agent_id.as_str().to_owned(),
workspace_id: workspace_id.as_str().to_owned(),
updated_at,
updated_at: format_timestamp(updated_at),
})
}
@@ -2887,7 +2887,7 @@ impl AdminService {
agent_id: &AgentId,
) -> Result<AgentMutationResult, ApiError> {
self.ensure_workspace_exists(workspace_id).await?;
let updated_at = now_string()?;
let updated_at = OffsetDateTime::now_utc();
self.registry
.archive_agent(workspace_id, agent_id, &updated_at)
.await?;
@@ -2896,7 +2896,7 @@ impl AdminService {
Ok(AgentMutationResult {
agent_id: agent_id.as_str().to_owned(),
workspace_id: workspace_id.as_str().to_owned(),
updated_at,
updated_at: format_timestamp(updated_at),
})
}
@@ -4946,9 +4946,9 @@ fn map_agent_summary_view(summary: AgentSummary) -> AgentSummaryView {
status: summary.status,
current_draft_version: summary.current_draft_version,
latest_published_version: summary.latest_published_version,
created_at: summary.created_at,
updated_at: summary.updated_at,
published_at: summary.published_at,
created_at: format_timestamp(summary.created_at),
updated_at: format_timestamp(summary.updated_at),
published_at: summary.published_at.map(format_timestamp),
operation_count: 0,
operation_ids: Vec::new(),
key_count: 0,