Allow acp_providers to specify an mcp_servers array that gets passed
to create_session. This enables agents to connect to HTTP MCP servers
configured by the client.
- Read mcp_servers from Config.acp_providers[provider]
- Pass to acp_client:create_session for MCP tool support
- Add mock transport tests verifying mcpServers propagation
nvim_del_autocmd was being called in a callback from acp_client, which is a
fast event context where it's not allowed. Wrapping it with vim.schedule()
defers the execution to a safe context.
Signed-off-by: Nayab Sayed <nayabbasha.sayed@microchip.com>
Change the constructor to accept role and a single content item instead
of raw AvanteLLMMessage instance. This will help when we will start
changing message.content from being a string or a list of tables to just
a string or a single table.
- Refactor TODOs handling: move logic to `context_messages` instead of using `template_opts`
- Improve todo message filtering by using more precise tags (`<todos>...</todos>`)
- Append TODOs after history messages
- Remove the TODOs section from `_task-guidelines.avanterules` template
Signed-off-by: doodleEsc <cinuor@gmail.com>
When updating chat history to be used in LLM request there are several
instances where we do O(n^2) operations: scanning all messages to locate
a tool "use" and for each use scan messages again to locate
corresponding "result".
Refactor the code to scan messages once collecting tool uses and results
together, and then do 2nd scan to drop incomplete tool invocations and
refresh "view" and "edit" results with the latest content.
Also reduce number of pre-scan loops (where we discard partially
generated messages or messages that are not interesting or too-old) by
combining them when possible.
This reduces time to scan initial 417 messages on my system (which
result in 576 final messages) from 0.32 to 0.12 seconds.
Rate limit handling seems to be broken: it starts an one-shot timer
with callback that reschedules the timer each second and prints/updates
messages. Simultaneously it schedules a deferred by 1 second function
that cancels the timer and resumes the stream. This results in the timer
executing at most once, and stream resume happening way too early.
Fix this by switching to use repeating timer with first instance
executing immediately. All message handling is moved into the timer
callback. Once countdown is complete the same callback will stop and
destroy the timer and resume the stream.