feat(agent): add crash logs and watchdog startup

- Recover panics to disk for diagnostics
- Add 5-minute watchdog task with startup
- Add -ensure flag to start detached agent
- Add script to pull remote folder via API
This commit is contained in:
2026-09-01 20:04:20 +03:00
parent 2ce438852a
commit 36cb847f9e
11 changed files with 458 additions and 8 deletions
+2
View File
@@ -8,6 +8,7 @@ import (
"os"
"sort"
"tea.chunkbyte.com/kato/go-worm/lib/crashlog"
"tea.chunkbyte.com/kato/go-worm/lib/models"
)
@@ -18,6 +19,7 @@ func RecoverHandler(next http.Handler) http.Handler {
defer func() {
if recovered := recover(); recovered != nil {
Log.Printf("panic %s %s: %v", r.Method, r.URL.Path, recovered)
crashlog.RecordPanic(recovered)
WriteError(w, http.StatusInternalServerError, "internal server error")
}
}()