MCPcopy Index your code
hub / github.com/docker/docker-agent / preCompactSourceFor

Function preCompactSourceFor

pkg/runtime/runtime.go:1886–1897  ·  view source on GitHub ↗

preCompactSourceFor maps the canonical compaction reason ([compactionReasonThreshold] / [compactionReasonOverflow] / [compactionReasonManual]) onto the [hooks.Input.Source] string surfaced by the pre_compact hook ("auto" / "overflow" / "manual"). Unknown reasons fall through unchanged so future, mor

(reason string)

Source from the content-addressed store, hash-verified

1884// reasons (e.g. "tool_overflow") can be forwarded verbatim without
1885// touching this map.
1886func preCompactSourceFor(reason string) string {
1887 switch reason {
1888 case compactionReasonThreshold:
1889 return "auto"
1890 case compactionReasonOverflow:
1891 return "overflow"
1892 case compactionReasonManual:
1893 return "manual"
1894 default:
1895 return reason
1896 }
1897}
1898
1899// joinPrompts concatenates two non-empty prompt fragments with a blank
1900// line, returning whichever is non-empty when the other isn't. Used by

Callers 1

compactWithReasonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected