This commit is contained in:
Eva Ho 2025-12-17 16:16:53 -05:00
parent e76abac24e
commit cf7e5e88bc
2 changed files with 15 additions and 15 deletions

View File

@ -95,15 +95,15 @@ const (
) )
type Server struct { type Server struct {
Logger *slog.Logger Logger *slog.Logger
Restart func() Restart func()
Token string Token string
Store *store.Store Store *store.Store
ToolRegistry *tools.Registry ToolRegistry *tools.Registry
Tools bool // if true, the server will use single-turn tools to fulfill the user's request Tools bool // if true, the server will use single-turn tools to fulfill the user's request
WebSearch bool // if true, the server will use single-turn browser tool to fulfill the user's request WebSearch bool // if true, the server will use single-turn browser tool to fulfill the user's request
Agent bool // if true, the server will use multi-turn tools to fulfill the user's request Agent bool // if true, the server will use multi-turn tools to fulfill the user's request
WorkingDir string // Working directory for all agent operations WorkingDir string // Working directory for all agent operations
// Dev is true if the server is running in development mode // Dev is true if the server is running in development mode
Dev bool Dev bool

View File

@ -61,7 +61,7 @@ func (u *Updater) checkForUpdate(ctx context.Context) (bool, UpdateResponse) {
currentVersion := version.GetVersion() currentVersion := version.GetVersion()
query.Add("version", currentVersion) query.Add("version", currentVersion)
query.Add("ts", strconv.FormatInt(time.Now().Unix(), 10)) query.Add("ts", strconv.FormatInt(time.Now().Unix(), 10))
slog.Debug("checking for update", "current_version", currentVersion, "os", runtime.GOOS, "arch", runtime.GOARCH) slog.Debug("checking for update", "current_version", currentVersion, "os", runtime.GOOS, "arch", runtime.GOARCH)
// The original macOS app used to use the device ID // The original macOS app used to use the device ID
@ -264,7 +264,7 @@ func (u *Updater) StartBackgroundUpdaterChecker(ctx context.Context, cb func(str
time.Sleep(UpdateCheckInterval) time.Sleep(UpdateCheckInterval)
continue continue
} }
if !settings.AutoUpdateEnabled { if !settings.AutoUpdateEnabled {
// When auto-update is disabled, don't check or download anything // When auto-update is disabled, don't check or download anything
slog.Debug("auto-update disabled, skipping check") slog.Debug("auto-update disabled, skipping check")
@ -304,7 +304,7 @@ func (u *Updater) CheckForUpdate(ctx context.Context) (bool, string, error) {
func (u *Updater) DownloadUpdate(ctx context.Context, updateVersion string) error { func (u *Updater) DownloadUpdate(ctx context.Context, updateVersion string) error {
// First check for update to get the actual download URL // First check for update to get the actual download URL
available, updateResp := u.checkForUpdate(ctx) available, updateResp := u.checkForUpdate(ctx)
if !available { if !available {
return fmt.Errorf("no update available") return fmt.Errorf("no update available")
} }
@ -312,13 +312,13 @@ func (u *Updater) DownloadUpdate(ctx context.Context, updateVersion string) erro
slog.Error("version mismatch", "requested", updateVersion, "available", updateResp.UpdateVersion) slog.Error("version mismatch", "requested", updateVersion, "available", updateResp.UpdateVersion)
return fmt.Errorf("version mismatch: requested %s, available %s", updateVersion, updateResp.UpdateVersion) return fmt.Errorf("version mismatch: requested %s, available %s", updateVersion, updateResp.UpdateVersion)
} }
slog.Info("downloading update", "version", updateVersion) slog.Info("downloading update", "version", updateVersion)
err := u.DownloadNewRelease(ctx, updateResp) err := u.DownloadNewRelease(ctx, updateResp)
if err != nil { if err != nil {
return err return err
} }
slog.Info("update downloaded successfully", "version", updateVersion) slog.Info("update downloaded successfully", "version", updateVersion)
return nil return nil
} }
@ -327,7 +327,7 @@ func (u *Updater) InstallAndRestart() error {
if !UpdateDownloaded { if !UpdateDownloaded {
return fmt.Errorf("no update downloaded") return fmt.Errorf("no update downloaded")
} }
slog.Info("installing update and restarting") slog.Info("installing update and restarting")
return DoUpgrade(true) return DoUpgrade(true)
} }