Files
archie/internal/webui/tasks_transcript.go
sam 0a37b551f5
Quality / check (push) Successful in 3m47s
deploy / gate (push) Successful in 4m32s
deploy / archied-image (push) Successful in 2m51s
deploy / agent-image (push) Successful in 10s
deploy / dist-zip (push) Skipped
refactor(webui): extract the tasks resource module (#1778)
2026-11-03 08:06:56 +11:00

32 lines
814 B
Go

package webui
import (
"net/http"
"github.com/samcharles93/archie-core/internal/events"
)
// taskTranscriptView is GET /api/tasks/{id}/transcript: one attempt's agent
// transcript entries, oldest first.
type taskTranscriptView struct {
TaskID int64 `json:"task_id"`
Attempt int `json:"attempt"`
Entries []events.Event `json:"entries"`
}
func (a *tasksAPI) handleTaskTranscript(w http.ResponseWriter, r *http.Request) {
t, attempt, ok := a.taskAttemptTarget(w, r)
if !ok {
return
}
entries, err := a.store.TaskTranscript(r.Context(), t.ID, attempt)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}
if entries == nil {
entries = []events.Event{}
}
writeJSON(w, taskTranscriptView{TaskID: t.ID, Attempt: attempt, Entries: entries})
}