app.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. // Package app wires together services, coordinates agents, and manages
  2. // application lifecycle.
  3. package app
  4. import (
  5. "context"
  6. "database/sql"
  7. "errors"
  8. "fmt"
  9. "io"
  10. "log/slog"
  11. "os"
  12. "strings"
  13. "sync"
  14. "time"
  15. tea "charm.land/bubbletea/v2"
  16. "charm.land/catwalk/pkg/catwalk"
  17. "charm.land/fantasy"
  18. "charm.land/lipgloss/v2"
  19. "github.com/charmbracelet/crush/internal/agent"
  20. "github.com/charmbracelet/crush/internal/agent/notify"
  21. "github.com/charmbracelet/crush/internal/agent/tools/mcp"
  22. "github.com/charmbracelet/crush/internal/config"
  23. "github.com/charmbracelet/crush/internal/db"
  24. "github.com/charmbracelet/crush/internal/event"
  25. "github.com/charmbracelet/crush/internal/filetracker"
  26. "github.com/charmbracelet/crush/internal/format"
  27. "github.com/charmbracelet/crush/internal/history"
  28. "github.com/charmbracelet/crush/internal/log"
  29. "github.com/charmbracelet/crush/internal/lsp"
  30. "github.com/charmbracelet/crush/internal/message"
  31. "github.com/charmbracelet/crush/internal/permission"
  32. "github.com/charmbracelet/crush/internal/pubsub"
  33. "github.com/charmbracelet/crush/internal/session"
  34. "github.com/charmbracelet/crush/internal/shell"
  35. "github.com/charmbracelet/crush/internal/ui/anim"
  36. "github.com/charmbracelet/crush/internal/ui/styles"
  37. "github.com/charmbracelet/crush/internal/update"
  38. "github.com/charmbracelet/crush/internal/version"
  39. "github.com/charmbracelet/x/ansi"
  40. "github.com/charmbracelet/x/exp/charmtone"
  41. "github.com/charmbracelet/x/term"
  42. )
  43. // UpdateAvailableMsg is sent when a new version is available.
  44. type UpdateAvailableMsg struct {
  45. CurrentVersion string
  46. LatestVersion string
  47. IsDevelopment bool
  48. }
  49. type App struct {
  50. Sessions session.Service
  51. Messages message.Service
  52. History history.Service
  53. Permissions permission.Service
  54. FileTracker filetracker.Service
  55. AgentCoordinator agent.Coordinator
  56. LSPManager *lsp.Manager
  57. config *config.ConfigStore
  58. serviceEventsWG *sync.WaitGroup
  59. eventsCtx context.Context
  60. events chan tea.Msg
  61. tuiWG *sync.WaitGroup
  62. // global context and cleanup functions
  63. globalCtx context.Context
  64. cleanupFuncs []func(context.Context) error
  65. agentNotifications *pubsub.Broker[notify.Notification]
  66. }
  67. // New initializes a new application instance.
  68. func New(ctx context.Context, conn *sql.DB, store *config.ConfigStore) (*App, error) {
  69. q := db.New(conn)
  70. sessions := session.NewService(q, conn)
  71. messages := message.NewService(q)
  72. files := history.NewService(q, conn)
  73. cfg := store.Config()
  74. skipPermissionsRequests := cfg.Permissions != nil && cfg.Permissions.SkipRequests
  75. var allowedTools []string
  76. if cfg.Permissions != nil && cfg.Permissions.AllowedTools != nil {
  77. allowedTools = cfg.Permissions.AllowedTools
  78. }
  79. app := &App{
  80. Sessions: sessions,
  81. Messages: messages,
  82. History: files,
  83. Permissions: permission.NewPermissionService(store.WorkingDir(), skipPermissionsRequests, allowedTools),
  84. FileTracker: filetracker.NewService(q),
  85. LSPManager: lsp.NewManager(store),
  86. globalCtx: ctx,
  87. config: store,
  88. events: make(chan tea.Msg, 100),
  89. serviceEventsWG: &sync.WaitGroup{},
  90. tuiWG: &sync.WaitGroup{},
  91. agentNotifications: pubsub.NewBroker[notify.Notification](),
  92. }
  93. app.setupEvents()
  94. // Check for updates in the background.
  95. go app.checkForUpdates(ctx)
  96. go mcp.Initialize(ctx, app.Permissions, store)
  97. // cleanup database upon app shutdown
  98. app.cleanupFuncs = append(
  99. app.cleanupFuncs,
  100. func(context.Context) error { return conn.Close() },
  101. func(ctx context.Context) error { return mcp.Close(ctx) },
  102. )
  103. // TODO: remove the concept of agent config, most likely.
  104. if !cfg.IsConfigured() {
  105. slog.Warn("No agent configuration found")
  106. return app, nil
  107. }
  108. if err := app.InitCoderAgent(ctx); err != nil {
  109. return nil, fmt.Errorf("failed to initialize coder agent: %w", err)
  110. }
  111. // Set up callback for LSP state updates.
  112. app.LSPManager.SetCallback(func(name string, client *lsp.Client) {
  113. if client == nil {
  114. updateLSPState(name, lsp.StateUnstarted, nil, nil, 0)
  115. return
  116. }
  117. client.SetDiagnosticsCallback(updateLSPDiagnostics)
  118. updateLSPState(name, client.GetServerState(), nil, client, 0)
  119. })
  120. go app.LSPManager.TrackConfigured()
  121. return app, nil
  122. }
  123. // Config returns the pure-data configuration.
  124. func (app *App) Config() *config.Config {
  125. return app.config.Config()
  126. }
  127. // Store returns the config store.
  128. func (app *App) Store() *config.ConfigStore {
  129. return app.config
  130. }
  131. // AgentNotifications returns the broker for agent notification events.
  132. func (app *App) AgentNotifications() *pubsub.Broker[notify.Notification] {
  133. return app.agentNotifications
  134. }
  135. // resolveSession resolves which session to use for a non-interactive run
  136. // If continueSessionID is set, it looks up that session by ID
  137. // If useLast is set, it returns the most recently updated top-level session
  138. // Otherwise, it creates a new session
  139. func (app *App) resolveSession(ctx context.Context, continueSessionID string, useLast bool) (session.Session, error) {
  140. switch {
  141. case continueSessionID != "":
  142. if app.Sessions.IsAgentToolSession(continueSessionID) {
  143. return session.Session{}, fmt.Errorf("cannot continue an agent tool session: %s", continueSessionID)
  144. }
  145. sess, err := app.Sessions.Get(ctx, continueSessionID)
  146. if err != nil {
  147. return session.Session{}, fmt.Errorf("session not found: %s", continueSessionID)
  148. }
  149. if sess.ParentSessionID != "" {
  150. return session.Session{}, fmt.Errorf("cannot continue a child session: %s", continueSessionID)
  151. }
  152. return sess, nil
  153. case useLast:
  154. sess, err := app.Sessions.GetLast(ctx)
  155. if err != nil {
  156. return session.Session{}, fmt.Errorf("no sessions found to continue")
  157. }
  158. return sess, nil
  159. default:
  160. return app.Sessions.Create(ctx, agent.DefaultSessionName)
  161. }
  162. }
  163. // RunNonInteractive runs the application in non-interactive mode with the
  164. // given prompt, printing to stdout.
  165. func (app *App) RunNonInteractive(ctx context.Context, output io.Writer, prompt, largeModel, smallModel string, hideSpinner bool, continueSessionID string, useLast bool) error {
  166. slog.Info("Running in non-interactive mode")
  167. ctx, cancel := context.WithCancel(ctx)
  168. defer cancel()
  169. if largeModel != "" || smallModel != "" {
  170. if err := app.overrideModelsForNonInteractive(ctx, largeModel, smallModel); err != nil {
  171. return fmt.Errorf("failed to override models: %w", err)
  172. }
  173. }
  174. var (
  175. spinner *format.Spinner
  176. stdoutTTY bool
  177. stderrTTY bool
  178. stdinTTY bool
  179. progress bool
  180. )
  181. if f, ok := output.(*os.File); ok {
  182. stdoutTTY = term.IsTerminal(f.Fd())
  183. }
  184. stderrTTY = term.IsTerminal(os.Stderr.Fd())
  185. stdinTTY = term.IsTerminal(os.Stdin.Fd())
  186. progress = app.config.Config().Options.Progress == nil || *app.config.Config().Options.Progress
  187. if !hideSpinner && stderrTTY {
  188. t := styles.DefaultStyles()
  189. // Detect background color to set the appropriate color for the
  190. // spinner's 'Generating...' text. Without this, that text would be
  191. // unreadable in light terminals.
  192. hasDarkBG := true
  193. if f, ok := output.(*os.File); ok && stdinTTY && stdoutTTY {
  194. hasDarkBG = lipgloss.HasDarkBackground(os.Stdin, f)
  195. }
  196. defaultFG := lipgloss.LightDark(hasDarkBG)(charmtone.Pepper, t.FgBase)
  197. spinner = format.NewSpinner(ctx, cancel, anim.Settings{
  198. Size: 10,
  199. Label: "Generating",
  200. LabelColor: defaultFG,
  201. GradColorA: t.Primary,
  202. GradColorB: t.Secondary,
  203. CycleColors: true,
  204. })
  205. spinner.Start()
  206. }
  207. // Helper function to stop spinner once.
  208. stopSpinner := func() {
  209. if !hideSpinner && spinner != nil {
  210. spinner.Stop()
  211. spinner = nil
  212. }
  213. }
  214. // Wait for MCP initialization to complete before reading MCP tools.
  215. if err := mcp.WaitForInit(ctx); err != nil {
  216. return fmt.Errorf("failed to wait for MCP initialization: %w", err)
  217. }
  218. // force update of agent models before running so mcp tools are loaded
  219. app.AgentCoordinator.UpdateModels(ctx)
  220. defer stopSpinner()
  221. sess, err := app.resolveSession(ctx, continueSessionID, useLast)
  222. if err != nil {
  223. return fmt.Errorf("failed to create session for non-interactive mode: %w", err)
  224. }
  225. if continueSessionID != "" || useLast {
  226. slog.Info("Continuing session for non-interactive run", "session_id", sess.ID)
  227. } else {
  228. slog.Info("Created session for non-interactive run", "session_id", sess.ID)
  229. }
  230. // Automatically approve all permission requests for this non-interactive
  231. // session.
  232. app.Permissions.AutoApproveSession(sess.ID)
  233. type response struct {
  234. result *fantasy.AgentResult
  235. err error
  236. }
  237. done := make(chan response, 1)
  238. go func(ctx context.Context, sessionID, prompt string) {
  239. result, err := app.AgentCoordinator.Run(ctx, sess.ID, prompt)
  240. if err != nil {
  241. done <- response{
  242. err: fmt.Errorf("failed to start agent processing stream: %w", err),
  243. }
  244. return
  245. }
  246. done <- response{
  247. result: result,
  248. }
  249. }(ctx, sess.ID, prompt)
  250. messageEvents := app.Messages.Subscribe(ctx)
  251. messageReadBytes := make(map[string]int)
  252. var printed bool
  253. defer func() {
  254. if progress && stderrTTY {
  255. _, _ = fmt.Fprintf(os.Stderr, ansi.ResetProgressBar)
  256. }
  257. // Always print a newline at the end. If output is a TTY this will
  258. // prevent the prompt from overwriting the last line of output.
  259. _, _ = fmt.Fprintln(output)
  260. }()
  261. for {
  262. if progress && stderrTTY {
  263. // HACK: Reinitialize the terminal progress bar on every iteration
  264. // so it doesn't get hidden by the terminal due to inactivity.
  265. _, _ = fmt.Fprintf(os.Stderr, ansi.SetIndeterminateProgressBar)
  266. }
  267. select {
  268. case result := <-done:
  269. stopSpinner()
  270. if result.err != nil {
  271. if errors.Is(result.err, context.Canceled) || errors.Is(result.err, agent.ErrRequestCancelled) {
  272. slog.Debug("Non-interactive: agent processing cancelled", "session_id", sess.ID)
  273. return nil
  274. }
  275. return fmt.Errorf("agent processing failed: %w", result.err)
  276. }
  277. return nil
  278. case event := <-messageEvents:
  279. msg := event.Payload
  280. if msg.SessionID == sess.ID && msg.Role == message.Assistant && len(msg.Parts) > 0 {
  281. stopSpinner()
  282. content := msg.Content().String()
  283. readBytes := messageReadBytes[msg.ID]
  284. if len(content) < readBytes {
  285. slog.Error("Non-interactive: message content is shorter than read bytes", "message_length", len(content), "read_bytes", readBytes)
  286. return fmt.Errorf("message content is shorter than read bytes: %d < %d", len(content), readBytes)
  287. }
  288. part := content[readBytes:]
  289. // Trim leading whitespace. Sometimes the LLM includes leading
  290. // formatting and intentation, which we don't want here.
  291. if readBytes == 0 {
  292. part = strings.TrimLeft(part, " \t")
  293. }
  294. // Ignore initial whitespace-only messages.
  295. if printed || strings.TrimSpace(part) != "" {
  296. printed = true
  297. fmt.Fprint(output, part)
  298. }
  299. messageReadBytes[msg.ID] = len(content)
  300. }
  301. case <-ctx.Done():
  302. stopSpinner()
  303. return ctx.Err()
  304. }
  305. }
  306. }
  307. func (app *App) UpdateAgentModel(ctx context.Context) error {
  308. if app.AgentCoordinator == nil {
  309. return fmt.Errorf("agent configuration is missing")
  310. }
  311. return app.AgentCoordinator.UpdateModels(ctx)
  312. }
  313. // overrideModelsForNonInteractive parses the model strings and temporarily
  314. // overrides the model configurations, then rebuilds the agent.
  315. // Format: "model-name" (searches all providers) or "provider/model-name".
  316. // Model matching is case-insensitive.
  317. // If largeModel is provided but smallModel is not, the small model defaults to
  318. // the provider's default small model.
  319. func (app *App) overrideModelsForNonInteractive(ctx context.Context, largeModel, smallModel string) error {
  320. providers := app.config.Config().Providers.Copy()
  321. largeMatches, smallMatches, err := findModels(providers, largeModel, smallModel)
  322. if err != nil {
  323. return err
  324. }
  325. var largeProviderID string
  326. // Override large model.
  327. if largeModel != "" {
  328. found, err := validateMatches(largeMatches, largeModel, "large")
  329. if err != nil {
  330. return err
  331. }
  332. largeProviderID = found.provider
  333. slog.Info("Overriding large model for non-interactive run", "provider", found.provider, "model", found.modelID)
  334. app.config.Config().Models[config.SelectedModelTypeLarge] = config.SelectedModel{
  335. Provider: found.provider,
  336. Model: found.modelID,
  337. }
  338. }
  339. // Override small model.
  340. switch {
  341. case smallModel != "":
  342. found, err := validateMatches(smallMatches, smallModel, "small")
  343. if err != nil {
  344. return err
  345. }
  346. slog.Info("Overriding small model for non-interactive run", "provider", found.provider, "model", found.modelID)
  347. app.config.Config().Models[config.SelectedModelTypeSmall] = config.SelectedModel{
  348. Provider: found.provider,
  349. Model: found.modelID,
  350. }
  351. case largeModel != "":
  352. // No small model specified, but large model was - use provider's default.
  353. smallCfg := app.GetDefaultSmallModel(largeProviderID)
  354. app.config.Config().Models[config.SelectedModelTypeSmall] = smallCfg
  355. }
  356. return app.AgentCoordinator.UpdateModels(ctx)
  357. }
  358. // GetDefaultSmallModel returns the default small model for the given
  359. // provider. Falls back to the large model if no default is found.
  360. func (app *App) GetDefaultSmallModel(providerID string) config.SelectedModel {
  361. cfg := app.config.Config()
  362. largeModelCfg := cfg.Models[config.SelectedModelTypeLarge]
  363. // Find the provider in the known providers list to get its default small model.
  364. knownProviders, _ := config.Providers(cfg)
  365. var knownProvider *catwalk.Provider
  366. for _, p := range knownProviders {
  367. if string(p.ID) == providerID {
  368. knownProvider = &p
  369. break
  370. }
  371. }
  372. // For unknown/local providers, use the large model as small.
  373. if knownProvider == nil {
  374. slog.Warn("Using large model as small model for unknown provider", "provider", providerID, "model", largeModelCfg.Model)
  375. return largeModelCfg
  376. }
  377. defaultSmallModelID := knownProvider.DefaultSmallModelID
  378. model := cfg.GetModel(providerID, defaultSmallModelID)
  379. if model == nil {
  380. slog.Warn("Default small model not found, using large model", "provider", providerID, "model", largeModelCfg.Model)
  381. return largeModelCfg
  382. }
  383. slog.Info("Using provider default small model", "provider", providerID, "model", defaultSmallModelID)
  384. return config.SelectedModel{
  385. Provider: providerID,
  386. Model: defaultSmallModelID,
  387. MaxTokens: model.DefaultMaxTokens,
  388. ReasoningEffort: model.DefaultReasoningEffort,
  389. }
  390. }
  391. func (app *App) setupEvents() {
  392. ctx, cancel := context.WithCancel(app.globalCtx)
  393. app.eventsCtx = ctx
  394. setupSubscriber(ctx, app.serviceEventsWG, "sessions", app.Sessions.Subscribe, app.events)
  395. setupSubscriber(ctx, app.serviceEventsWG, "messages", app.Messages.Subscribe, app.events)
  396. setupSubscriber(ctx, app.serviceEventsWG, "permissions", app.Permissions.Subscribe, app.events)
  397. setupSubscriber(ctx, app.serviceEventsWG, "permissions-notifications", app.Permissions.SubscribeNotifications, app.events)
  398. setupSubscriber(ctx, app.serviceEventsWG, "history", app.History.Subscribe, app.events)
  399. setupSubscriber(ctx, app.serviceEventsWG, "agent-notifications", app.agentNotifications.Subscribe, app.events)
  400. setupSubscriber(ctx, app.serviceEventsWG, "mcp", mcp.SubscribeEvents, app.events)
  401. setupSubscriber(ctx, app.serviceEventsWG, "lsp", SubscribeLSPEvents, app.events)
  402. cleanupFunc := func(context.Context) error {
  403. cancel()
  404. app.serviceEventsWG.Wait()
  405. return nil
  406. }
  407. app.cleanupFuncs = append(app.cleanupFuncs, cleanupFunc)
  408. }
  409. const subscriberSendTimeout = 2 * time.Second
  410. func setupSubscriber[T any](
  411. ctx context.Context,
  412. wg *sync.WaitGroup,
  413. name string,
  414. subscriber func(context.Context) <-chan pubsub.Event[T],
  415. outputCh chan<- tea.Msg,
  416. ) {
  417. wg.Go(func() {
  418. subCh := subscriber(ctx)
  419. sendTimer := time.NewTimer(0)
  420. <-sendTimer.C
  421. defer sendTimer.Stop()
  422. for {
  423. select {
  424. case event, ok := <-subCh:
  425. if !ok {
  426. slog.Debug("Subscription channel closed", "name", name)
  427. return
  428. }
  429. var msg tea.Msg = event
  430. if !sendTimer.Stop() {
  431. select {
  432. case <-sendTimer.C:
  433. default:
  434. }
  435. }
  436. sendTimer.Reset(subscriberSendTimeout)
  437. select {
  438. case outputCh <- msg:
  439. case <-sendTimer.C:
  440. slog.Debug("Message dropped due to slow consumer", "name", name)
  441. case <-ctx.Done():
  442. slog.Debug("Subscription cancelled", "name", name)
  443. return
  444. }
  445. case <-ctx.Done():
  446. slog.Debug("Subscription cancelled", "name", name)
  447. return
  448. }
  449. }
  450. })
  451. }
  452. func (app *App) InitCoderAgent(ctx context.Context) error {
  453. coderAgentCfg := app.config.Config().Agents[config.AgentCoder]
  454. if coderAgentCfg.ID == "" {
  455. return fmt.Errorf("coder agent configuration is missing")
  456. }
  457. var err error
  458. app.AgentCoordinator, err = agent.NewCoordinator(
  459. ctx,
  460. app.config,
  461. app.Sessions,
  462. app.Messages,
  463. app.Permissions,
  464. app.History,
  465. app.FileTracker,
  466. app.LSPManager,
  467. app.agentNotifications,
  468. )
  469. if err != nil {
  470. slog.Error("Failed to create coder agent", "err", err)
  471. return err
  472. }
  473. return nil
  474. }
  475. // Subscribe sends events to the TUI as tea.Msgs.
  476. func (app *App) Subscribe(program *tea.Program) {
  477. defer log.RecoverPanic("app.Subscribe", func() {
  478. slog.Info("TUI subscription panic: attempting graceful shutdown")
  479. program.Quit()
  480. })
  481. app.tuiWG.Add(1)
  482. tuiCtx, tuiCancel := context.WithCancel(app.globalCtx)
  483. app.cleanupFuncs = append(app.cleanupFuncs, func(context.Context) error {
  484. slog.Debug("Cancelling TUI message handler")
  485. tuiCancel()
  486. app.tuiWG.Wait()
  487. return nil
  488. })
  489. defer app.tuiWG.Done()
  490. for {
  491. select {
  492. case <-tuiCtx.Done():
  493. slog.Debug("TUI message handler shutting down")
  494. return
  495. case msg, ok := <-app.events:
  496. if !ok {
  497. slog.Debug("TUI message channel closed")
  498. return
  499. }
  500. program.Send(msg)
  501. }
  502. }
  503. }
  504. // Shutdown performs a graceful shutdown of the application.
  505. func (app *App) Shutdown() {
  506. start := time.Now()
  507. defer func() { slog.Debug("Shutdown took " + time.Since(start).String()) }()
  508. // First, cancel all agents and wait for them to finish. This must complete
  509. // before closing the DB so agents can finish writing their state.
  510. if app.AgentCoordinator != nil {
  511. app.AgentCoordinator.CancelAll()
  512. }
  513. // Now run remaining cleanup tasks in parallel.
  514. var wg sync.WaitGroup
  515. // Shared shutdown context for all timeout-bounded cleanup.
  516. shutdownCtx, cancel := context.WithTimeout(context.WithoutCancel(app.globalCtx), 5*time.Second)
  517. defer cancel()
  518. // Send exit event
  519. wg.Go(func() {
  520. event.AppExited()
  521. })
  522. // Kill all background shells.
  523. wg.Go(func() {
  524. shell.GetBackgroundShellManager().KillAll(shutdownCtx)
  525. })
  526. // Shutdown all LSP clients.
  527. wg.Go(func() {
  528. app.LSPManager.KillAll(shutdownCtx)
  529. })
  530. // Call all cleanup functions.
  531. for _, cleanup := range app.cleanupFuncs {
  532. if cleanup != nil {
  533. wg.Go(func() {
  534. if err := cleanup(shutdownCtx); err != nil {
  535. slog.Error("Failed to cleanup app properly on shutdown", "error", err)
  536. }
  537. })
  538. }
  539. }
  540. wg.Wait()
  541. }
  542. // checkForUpdates checks for available updates.
  543. func (app *App) checkForUpdates(ctx context.Context) {
  544. checkCtx, cancel := context.WithTimeout(ctx, 30*time.Second)
  545. defer cancel()
  546. info, err := update.Check(checkCtx, version.Version, update.Default)
  547. if err != nil || !info.Available() {
  548. return
  549. }
  550. app.events <- UpdateAvailableMsg{
  551. CurrentVersion: info.Current,
  552. LatestVersion: info.Latest,
  553. IsDevelopment: info.IsDevelopment(),
  554. }
  555. }