MCPcopy Index your code
hub / github.com/codehamr/codehamr / activeContextSize

Method activeContextSize

internal/tui/model.go:317–325  ·  view source on GitHub ↗

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.

()

Source from the content-addressed store, hash-verified

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.
323func (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

Callers 4

NewFunction · 0.95
buildMessagesMethod · 0.95
applyDoneMethod · 0.95

Calls 1

ActiveProfileMethod · 0.80

Tested by 1