in lua/llm/utils.lua [65:77]
function M.insert_at(dst, at, src)
at = math.max(1, math.min(at, #dst + 1))
local before = string.sub(dst, 1, at - 1)
local after = string.sub(dst, at)
local result = before .. src
if not M.ends_with(src, after) then
result = result .. after
end
return result
end