feat(#1216): add cron run history (#1226)

This commit is contained in:
m57 authored and GitHub committed 2026-09-22 14:57:42 +03:00
1 parent a78b20bc99
commit 2e6ae95fe0
8 files changed
+517 -2

No files matched your search

@@ -0,0 +1,37 @@
package com.m57.hermescontrol.data.model
import kotlinx.serialization.Serializable
@Serializable
data class CronRunHistoryResponse(
val runs: List<CronRun> = emptyList(),
val limit: Int = 20,
)
/**
* One Hermes Agent cron execution.
*
* The backend exposes cron runs using the same enriched row shape as
* `/api/sessions`, then annotates each row with its owning profile and
* active/archive state. Only [id] is required; older backend rows can omit any
* of the enrichment fields without making the whole history unusable.
*/
@Serializable
data class CronRun(
val id: String,
val source: String? = null,
val model: String? = null,
val title: String? = null,
val started_at: Double? = null,
val ended_at: Double? = null,
val last_active: Double? = null,
val is_active: Boolean = false,
val archived: Boolean = false,
val message_count: Int? = null,
val tool_call_count: Int? = null,
val input_tokens: Int? = null,
val output_tokens: Int? = null,
val preview: String? = null,
val parent_session_id: String? = null,
val profile: String? = null,
)
@@ -21,6 +21,7 @@ import com.m57.hermescontrol.data.model.CreateWebhookRequest
import com.m57.hermescontrol.data.model.CredentialPoolResponse
import com.m57.hermescontrol.data.model.CronBlueprintListResponse
import com.m57.hermescontrol.data.model.CronJob
import com.m57.hermescontrol.data.model.CronRunHistoryResponse
import com.m57.hermescontrol.data.model.CuratorResponse
import com.m57.hermescontrol.data.model.DebugShareResponse
import com.m57.hermescontrol.data.model.DeleteWebhookResponse
@@ -339,6 +340,12 @@ interface HermesApiService : KanbanApiService {
@GET("api/cron/jobs")
suspend fun getCronJobs(): Response<List<CronJob>>
@GET("api/cron/jobs/{id}/runs")
suspend fun getCronJobRuns(
@Path("id") id: String,
@Query("limit") limit: Int = 20,
): Response<CronRunHistoryResponse>
@POST("api/cron/jobs/{id}/pause")
suspend fun pauseCronJob(
@Path("id") id: String,