feat: add scoped task source tracing and SDK examples

This commit is contained in:
2026-09-17 22:40:42 +08:00
parent 7641423f9d
commit 2b8213a4f7
26 changed files with 760 additions and 9 deletions

View File

@@ -32,6 +32,13 @@ func historyQuery(r *http.Request, paged bool) (service.HistoryPageInput, error)
return in, nil
}
func registerHistory(mux *http.ServeMux, s *service.Service) {
mux.HandleFunc("GET /v1/tasks/{task}/source", wrap(func(r *http.Request, t auth.Token) (any, int, error) {
if _, err := historyQuery(r, false); err != nil {
return nil, 0, err
}
out, err := s.GetTaskSource(r.Context(), t, core.ID(r.PathValue("task")))
return out, 200, err
}))
mux.HandleFunc("GET /v1/tasks/{task}/operations", wrap(func(r *http.Request, t auth.Token) (any, int, error) {
in, err := historyQuery(r, true)
if err != nil {