237 Commits

Author SHA1 Message Date
Adrian Cole
0336666a73 fix(acp): return JSON-RPC error for fs/read_text_file on missing files (#2849)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-12-13 23:30:11 +08:00
XuJiawei
42028811e4 refine: replace vim.fn.system with vim.system (#2863) 2025-12-13 18:58:10 +08:00
yetone
159b452426 chore: replace replace_in_file references with str_replace (#2811) 2025-10-31 02:08:53 +08:00
Alan
4286ac963a fix(utils): ensure empty tool properties encode as JSON object (#2803)
When tools have no parameters, llm_tool_param_fields_to_json_schema
returns an empty Lua table {}. vim.json.encode serializes empty tables
as JSON arrays [] instead of objects {}, causing Anthropic API to reject
requests with "tools.N.custom.input_schema.properties: Input should be
a valid dictionary" error.

Solution: Use vim.empty_dict() for empty properties to ensure correct
JSON object {} serialization instead of array [].

Tested with Claude Sonnet 4.5 - tools now work correctly without
schema validation errors.
2025-10-30 13:21:47 +08:00
yetone
b95e27b5a6 feat: supports OpenAI Response API and copilot's gpt-5-codex model (#2802)
* fix: upgrade vscode version

* feat: support openai response api

* refactor: refine todos tools

* fix: trim suffix empty lines
2025-10-30 02:18:48 +08:00
yetone
fb28520067 Refine buffer updates and tool call metadata (#2784) 2025-10-20 13:58:34 +08:00
yetone
0971d8f421 fix: stabilize ACP streaming updates (#2776) 2025-10-16 21:28:45 +08:00
yetone
487972386e feat: support acp slash commands (#2775) 2025-10-16 19:05:57 +08:00
Dmitry Torokhov
4fc83dc308 cleanup: use vim.uv instead of vim.loop everywhere (#2762) 2025-10-15 18:44:40 +08:00
Dmitry Torokhov
b08dc79088 refactor(promptLogger): move highlight definition into promptLogger code
Separate managing of a sign (">") placement for the input buffer and
defining a highlight for prompt logger and move the latter into
PromptLogger.init().
2025-10-11 16:39:52 -07:00
brook hong
ed89d0a1cd feat: filter prompt history by user input (#2734) 2025-09-29 21:15:25 +08:00
Carlos Gomes
56951378f1 feat: include hidden files when scanning directories (#2700) 2025-09-11 21:44:14 +08:00
yetone
10e0312ec4 feat: request permission button group (#2685) 2025-09-04 15:35:40 +08:00
yetone
4ac4c8ed3f feat(ui): expand tool use message (#2684) 2025-09-04 00:17:32 +08:00
yetone
7c4f88606c fix: full view width (#2662) 2025-08-31 23:02:42 +08:00
brook hong
604fdcc4b1 feat: add project root option in commands Ask/Chat/ChatNew (#2659) 2025-08-31 22:10:29 +08:00
yetone
bcbe0347d8 feat: supports full view in multi-window mode (#2660) 2025-08-31 21:33:57 +08:00
yetone
ff116a5673 feat: add full_view_ask api (#2658) 2025-08-31 19:17:20 +08:00
brook hong
47877c7e8b fix: bedrock exception could be found at end of a stream (#2654) 2025-08-31 19:11:04 +08:00
yetone
5e0aa7e5c0 feat: support acp (#2649) 2025-08-31 07:41:19 +08:00
brook hong
9008fc4f41 feat: add project_root in AskOptions so that project root can be specified from api (#2652) 2025-08-30 18:07:59 +08:00
brook hong
f70c4b8b88 fix: use common files to find project root (#2651) 2025-08-29 21:10:08 +08:00
brook hong
ce2c9ea5a2 fix: reset cache for project root if buf name changed (#2638) 2025-08-25 10:30:00 +08:00
忍野ペンギン
8a2ed691c0 fix: handle is already closing (#2613)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-08-24 16:21:55 +08:00
brook hong
c1ccb7867a fix: remove trailing spaces each line when editing files (#2612) 2025-08-16 14:16:38 +08:00
Dmitry Torokhov
638d237b75 refactor(utils): make prepend_line_numbers() more efficient and idiomatic
Between Utils.prepend_line_number() and its only caller, there is a lot
of conversions from list to string to list and back to string. Simplify
all of this by making it accept and return a list of strings, which
avoids unnecessary splitting and joining.

The implementation was updated to use vim.iter():map() and
string.format() for better performance and to align with the idiomatic
functional style used elsewhere in the project.

The name of the function has also been tweaked and is now
"prepend_line_numbers()" to better reflect that it operates on a list of
strings.

The caller has been updated to match the new function signature.
2025-08-12 15:14:37 +08:00
Dmitry Torokhov
76fe3f615a refactor(utils): switch debounce() and throttle() to use vim.defer_fn()
vim.defer_fn() does exactly what half of Utils.debounce() and
Utils.throttle() code does, so use it.

While at it add function annotations.
2025-08-12 15:14:37 +08:00
brook hong
6f28f132e5 fix: failed to write correct entry into prompt log file at very begin… (#2581) 2025-08-05 15:19:35 +08:00
brook hong
66cfbb4c19 fix: re-implement prompt logger (#2574)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-03 21:34:38 +08:00
yetone
03f0456d30 fix: add nil check for message before sending notifications 2025-08-02 23:38:21 +08:00
yetone
b225094dca fix: breaklines within the content (#2567) 2025-08-02 12:56:20 +08:00
yetone
8c5b3f9706 fix: duplicated replace blocks in diff (#2549) 2025-07-30 22:16:56 +08:00
yetone
0a2143586a fix: incorrect json in tool_use example (#2541) 2025-07-28 11:03:01 +08:00
yetone
8bc149ccd8 fix: react prompts (#2537) 2025-07-26 16:06:56 +08:00
Amaury Cannesson
bd69ae14f6 fix(utils): fix gsub in trim_line_numbers() (#2528) 2025-07-24 17:47:10 +08:00
yetone
f199625ee4 fix: diff format in k2 v2 (#2524) 2025-07-24 14:31:03 +08:00
doodleEsc
faa3945428 feat: implement user-defined text shortcuts (#2512)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-07-23 11:54:59 +08:00
yetone
c65604837c fix: diff format (#2510) 2025-07-22 20:38:57 +08:00
yetone
0490927061 fix: edit_file is an edit tool 2025-07-21 11:14:19 +08:00
Dmitry Torokhov
2335ea3d15 refactor(history): reduce computational complexity when handling history
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.
2025-07-18 22:36:21 -07:00
yetone
adbd296ba6 feat: integrated morph 2025-07-16 18:34:52 +08:00
Dmitry Torokhov
966eef743b refactor(history): move message rendering into history module
Move code related to converting history messages into UI representation
from utils into history/render.lua for better code organization and
clean up the implementation.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
06d9d8cec3 refactor(utils): remove history_messages_to_messages() function
Utils.history_messages_to_messages() is not used anywhere, remove it.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
d7c48075a5 refactor(history): move code collecting pending tools to history
Code dealing with scanning history messages and extracting some data or
state belongs to avante/history/ so move it there. Along with the move
update the implementation to make use of get_tool_use_data() and
get_tool_result_data() helpers to simplify it.

Also rename the function to History.get_pending_tools() to better
reflect its purpose: "uncalled" means something that was done without
request, unsolicited, not something that has not completed yet.
2025-07-16 12:49:15 +08:00
Dmitry Torokhov
34907fc1cd refactor(history): start moving history-related code into avante/history
The utils module has grown too big and contains unrelated functionality.
Start moving code related to managing history messages comprising chat
history into lua/avante/history module to keep the code more manageable.
2025-07-16 12:49:15 +08:00
yetone
127a12a878 fix: trim escapes for write_to_file tool (#2455) 2025-07-16 12:04:22 +08:00
yetone
154e5f578f feat: add timeout for bash tool (#2451) 2025-07-15 20:46:15 +08:00
Dmitry Torokhov
d3dde0c5ff refactor(utils): simplify and annotate count_lines() (#2446) 2025-07-15 16:42:30 +08:00
yetone
b8bb0fd969 refactor: llm tool parameters (#2449) 2025-07-15 16:40:25 +08:00
Arnon Keereena
a78af4ce99 Fix bugs where the file picker windows disappear on @file mentions (#2442)
Co-authored-by: Arnon Keereena <arnon.keereena@accenture.com>
2025-07-14 10:08:55 +08:00