1212local vc_config = require (" vectorcode.config" )
1313local check_cli_wrap = vc_config .check_cli_wrap
1414local notify_opts = vc_config .notify_opts
15+ local logger = vc_config .logger
1516
1617local tool_result_source = " VectorCodeToolResult"
1718
@@ -33,13 +34,16 @@ local function initialise_runner(use_lsp)
3334 end
3435 if job_runner == nil then
3536 job_runner = require (" vectorcode.jobrunner.cmd" )
37+ logger .info (" Using cmd runner for CodeCompanion tool." )
3638 if use_lsp then
3739 vim .schedule_wrap (vim .notify )(
3840 " Failed to initialise the LSP runner. Falling back to cmd runner." ,
3941 vim .log .levels .WARN ,
4042 notify_opts
4143 )
4244 end
45+ else
46+ logger .info (" Using LSP runner for CodeCompanion tool." )
4347 end
4448 end
4549end
@@ -63,6 +67,7 @@ local make_tool = check_cli_wrap(function(opts)
6367 ls_on_start = false ,
6468 no_duplicate = true ,
6569 }, opts or {})
70+ logger .info (" Creating CodeCompanion tool with the following args:\n " , opts )
6671 local capping_message = " "
6772 if opts .max_num > 0 then
6873 capping_message = (" - Request for at most %d documents" ):format (opts .max_num )
@@ -76,6 +81,7 @@ local make_tool = check_cli_wrap(function(opts)
7681 --- @param input table
7782 --- @return nil |{ status : string , msg : string }
7883 function (agent , action , input , cb )
84+ logger .info (" CodeCompanion tool called with the following arguments:\n " , action )
7985 initialise_runner (opts .use_lsp )
8086 assert (job_runner ~= nil )
8187 assert (
@@ -122,7 +128,10 @@ local make_tool = check_cli_wrap(function(opts)
122128 vim .list_extend (args , existing_files )
123129 end
124130 end
125-
131+ logger .info (
132+ " CodeCompanion query tool called the runner with the following args: " ,
133+ args
134+ )
126135 job_runner .run_async (args , function (result , error )
127136 vim .schedule (function ()
128137 if opts .auto_submit [action .command ] then
@@ -301,6 +310,12 @@ Remember:
301310 --- @param cmd table
302311 --- @param stderr table | string
303312 error = function (agent , cmd , stderr )
313+ logger .error (
314+ (" CodeCompanion tool with command %s thrown with the following error: %s" ):format (
315+ vim .inspect (cmd ),
316+ vim .inspect (stderr )
317+ )
318+ )
304319 stderr = flatten_table_to_string (stderr )
305320 agent .chat :add_message ({
306321 role = " user" ,
@@ -315,6 +330,12 @@ Remember:
315330 --- @param stdout table
316331 success = function (agent , cmd , stdout )
317332 stdout = stdout [1 ]
333+ logger .info (
334+ (" CodeCompanion tool with command %s finished with the following results: %s" ):format (
335+ vim .inspect (cmd ),
336+ vim .inspect (stdout )
337+ )
338+ )
318339 if cmd .command == " query" then
319340 agent .chat .ui :unlock_buf ()
320341 for i , file in pairs (stdout ) do
0 commit comments