Add Goose as an ACP provider (#2730)
Co-authored-by: Jack Wright <jack.wright@nike.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
@@ -258,6 +258,10 @@ M._defaults = {
|
|||||||
ACP_PERMISSION_MODE = "bypassPermissions",
|
ACP_PERMISSION_MODE = "bypassPermissions",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
["goose"] = {
|
||||||
|
command = "goose",
|
||||||
|
args = { "acp" },
|
||||||
|
},
|
||||||
},
|
},
|
||||||
---To add support for custom provider, follow the format below
|
---To add support for custom provider, follow the format below
|
||||||
---See https://github.com/yetone/avante.nvim/wiki#custom-providers for more details
|
---See https://github.com/yetone/avante.nvim/wiki#custom-providers for more details
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ function ACPClient:_send_request(method, params, callback)
|
|||||||
|
|
||||||
if callback then self.callbacks[id] = callback end
|
if callback then self.callbacks[id] = callback end
|
||||||
|
|
||||||
local data = vim.json.encode(message) .. "\n"
|
local data = vim.json.encode(message)
|
||||||
if self.debug_log_file then
|
if self.debug_log_file then
|
||||||
self.debug_log_file:write("request: " .. data .. string.rep("=", 100) .. "\n")
|
self.debug_log_file:write("request: " .. data .. string.rep("=", 100) .. "\n")
|
||||||
self.debug_log_file:flush()
|
self.debug_log_file:flush()
|
||||||
@@ -492,7 +492,7 @@ function ACPClient:_send_notification(method, params)
|
|||||||
params = params or {},
|
params = params or {},
|
||||||
}
|
}
|
||||||
|
|
||||||
local data = vim.json.encode(message) .. "\n"
|
local data = vim.json.encode(message)
|
||||||
if self.debug_log_file then
|
if self.debug_log_file then
|
||||||
self.debug_log_file:write("notification: " .. data .. string.rep("=", 100) .. "\n")
|
self.debug_log_file:write("notification: " .. data .. string.rep("=", 100) .. "\n")
|
||||||
self.debug_log_file:flush()
|
self.debug_log_file:flush()
|
||||||
@@ -507,7 +507,7 @@ end
|
|||||||
function ACPClient:_send_result(id, result)
|
function ACPClient:_send_result(id, result)
|
||||||
local message = { jsonrpc = "2.0", id = id, result = result }
|
local message = { jsonrpc = "2.0", id = id, result = result }
|
||||||
|
|
||||||
local data = vim.json.encode(message) .. "\n"
|
local data = vim.json.encode(message)
|
||||||
if self.debug_log_file then
|
if self.debug_log_file then
|
||||||
self.debug_log_file:write("request: " .. data .. string.rep("=", 100) .. "\n")
|
self.debug_log_file:write("request: " .. data .. string.rep("=", 100) .. "\n")
|
||||||
self.debug_log_file:flush()
|
self.debug_log_file:flush()
|
||||||
@@ -524,7 +524,7 @@ function ACPClient:_send_error(id, message, code)
|
|||||||
code = code or self.ERROR_CODES.TRANSPORT_ERROR
|
code = code or self.ERROR_CODES.TRANSPORT_ERROR
|
||||||
local msg = { jsonrpc = "2.0", id = id, error = { code = code, message = message } }
|
local msg = { jsonrpc = "2.0", id = id, error = { code = code, message = message } }
|
||||||
|
|
||||||
local data = vim.json.encode(msg) .. "\n"
|
local data = vim.json.encode(msg)
|
||||||
self.transport:send(data)
|
self.transport:send(data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1132,6 +1132,9 @@ function M._stream_acp(opts)
|
|||||||
})
|
})
|
||||||
acp_client = ACPClient:new(acp_config)
|
acp_client = ACPClient:new(acp_config)
|
||||||
acp_client:connect()
|
acp_client:connect()
|
||||||
|
-- If we create a new client and it does not support sesion loading,
|
||||||
|
-- remove the old session
|
||||||
|
if not acp_client.agent_capabilities.loadSession then opts.acp_session_id = nil end
|
||||||
if opts.on_save_acp_client then opts.on_save_acp_client(acp_client) end
|
if opts.on_save_acp_client then opts.on_save_acp_client(acp_client) end
|
||||||
end
|
end
|
||||||
local session_id = opts.acp_session_id
|
local session_id = opts.acp_session_id
|
||||||
|
|||||||
Reference in New Issue
Block a user