fix: recover run runtime state and logs

This commit is contained in:
npc0-hue
2026-08-07 12:01:26 +08:00
parent 3818fa0344
commit b789925ae5
23 changed files with 297 additions and 78 deletions
+24
View File
@@ -53,6 +53,22 @@ type LogStreamCursorResponse struct {
LatestSeq uint64 `json:"latestSeq"`
}
type RunLogStreamProgressRequest struct {
RunEndpointID string `json:"runEndpointId"`
SessionToken string `json:"sessionToken"`
ServerInstanceID string `json:"serverInstanceId"`
LogStreamID string `json:"logStreamId"`
}
type RunLogStreamProgressResponse struct {
Accepted bool `json:"accepted"`
RunEndpointID string `json:"runEndpointId"`
ServerInstanceID string `json:"serverInstanceId"`
LogStreamID string `json:"logStreamId"`
LatestSeq uint64 `json:"latestSeq"`
ServerTime time.Time `json:"serverTime"`
}
type LogStreamEventResponse struct {
ServerInstanceID string `json:"serverInstanceId"`
StreamID string `json:"streamId"`
@@ -92,6 +108,10 @@ func (request LogStreamCursorRequest) ToDomain() domain.LogStreamCursorQuery {
}
}
func (request RunLogStreamProgressRequest) ToDomain() domain.RunLogStreamProgress {
return domain.RunLogStreamProgress{RunEndpointID: request.RunEndpointID, SessionToken: request.SessionToken, ServerInstanceID: request.ServerInstanceID, LogStreamID: request.LogStreamID}
}
func LogBatchIngestFromDomain(result domain.LogBatchIngestResult) LogBatchIngestResponse {
return LogBatchIngestResponse{
Accepted: result.Accepted,
@@ -114,6 +134,10 @@ func LogStreamCursorFromDomain(result domain.LogStreamCursorResult) LogStreamCur
}
}
func RunLogStreamProgressFromDomain(result domain.RunLogStreamProgressResult) RunLogStreamProgressResponse {
return RunLogStreamProgressResponse{Accepted: result.Accepted, RunEndpointID: result.RunEndpointID, ServerInstanceID: result.ServerInstanceID, LogStreamID: result.LogStreamID, LatestSeq: result.LatestSeq, ServerTime: result.ServerTime}
}
func LogStreamEventFromDomain(event domain.LogStreamEvent) LogStreamEventResponse {
event = domain.CopyLogStreamEvent(event)
return LogStreamEventResponse{