Add persistent Run control stream

This commit is contained in:
npc0-hue
2026-08-26 23:05:40 +08:00
parent 3b4e857ef7
commit ac14f80306
8 changed files with 245 additions and 9 deletions
+20
View File
@@ -2,6 +2,12 @@ package protocol
import "time"
const (
RunControlEventTypeReady = "control.ready"
RunControlEventTypeHeartbeat = "control.heartbeat"
RunControlEventTypeJobChanged = "job.changed"
)
type RunCapacityReport struct {
MaxJobs int `json:"maxJobs"`
RunningJobs int `json:"runningJobs"`
@@ -60,6 +66,20 @@ type RunHeartbeatResponse struct {
ServerTime time.Time `json:"serverTime"`
}
type RunControlStreamRequest struct {
RunEndpointID string `json:"runEndpointId"`
SessionToken string `json:"sessionToken"`
LastEventSeq uint64 `json:"lastEventSeq,omitempty"`
}
type RunControlEvent struct {
RunEndpointID string `json:"runEndpointId"`
Sequence uint64 `json:"sequence"`
Type string `json:"type"`
ServerTime time.Time `json:"serverTime"`
RetrySeconds int `json:"retrySeconds,omitempty"`
}
type RunLifecycleReportRequest struct {
RunEndpointID string `json:"runEndpointId"`
SessionToken string `json:"sessionToken"`