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)
| 1884 | // reasons (e.g. "tool_overflow") can be forwarded verbatim without |
| 1885 | // touching this map. |
| 1886 | func 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 |