activeContextSize returns the context window the packer should aim at: the live server-reported value for the active profile if known, else the on-disk ContextSize, else defaultPackFallback, so cloud profiles before their first response (and any missing/zero value) still get a sensible budget.
()
| 315 | m.promptHistory = loadPromptHistory(cfg.Dir) |
| 316 | return m |
| 317 | } |
| 318 | |
| 319 | // activeContextSize returns the context window the packer should aim at: the |
| 320 | // live server-reported value for the active profile if known, else the on-disk |
| 321 | // ContextSize, else defaultPackFallback, so cloud profiles before their first |
| 322 | // response (and any missing/zero value) still get a sensible budget. |
| 323 | func (m *Model) activeContextSize() int { |
| 324 | if v, ok := m.liveContextSize[m.cfg.Active]; ok && v > 0 { |
| 325 | return v |
| 326 | } |
| 327 | if v := m.cfg.ActiveProfile().ContextSize; v > 0 { |
| 328 | return v |