feat(runtime): add local codex daemon pairing

This commit is contained in:
Jiayuan Zhang 2026-03-24 12:03:14 +08:00
parent c6960d39b9
commit cdfa63af15
36 changed files with 2579 additions and 309 deletions

View file

@ -1,7 +1,8 @@
package main
import (
"fmt"
"context"
"errors"
"log"
"os"
"os/signal"
@ -9,24 +10,18 @@ import (
)
func main() {
serverURL := os.Getenv("MULTICA_SERVER_URL")
if serverURL == "" {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}
serverURL = "ws://localhost:" + port + "/ws"
cfg, err := loadConfig()
if err != nil {
log.Fatal(err)
}
fmt.Println("Multica Daemon starting...")
fmt.Printf("Connecting to server: %s\n", serverURL)
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer stop()
// TODO: Implement daemon connection, heartbeat, and task runner
log.Println("Daemon is running. Press Ctrl+C to stop.")
logger := log.New(os.Stdout, "multica-daemon: ", log.LstdFlags)
d := newDaemon(cfg, logger)
quit := make(chan os.Signal, 1)
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
<-quit
log.Println("Daemon stopped")
if err := d.run(ctx); err != nil && !errors.Is(err, context.Canceled) {
logger.Fatal(err)
}
}