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:
Jack Wright
2025-09-30 02:19:06 -07:00
committed by GitHub
parent 1947025ad3
commit 4c0493440b
3 changed files with 11 additions and 4 deletions

View File

@@ -258,6 +258,10 @@ M._defaults = {
ACP_PERMISSION_MODE = "bypassPermissions",
},
},
["goose"] = {
command = "goose",
args = { "acp" },
},
},
---To add support for custom provider, follow the format below
---See https://github.com/yetone/avante.nvim/wiki#custom-providers for more details

View File

@@ -455,7 +455,7 @@ function ACPClient:_send_request(method, params, callback)
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
self.debug_log_file:write("request: " .. data .. string.rep("=", 100) .. "\n")
self.debug_log_file:flush()
@@ -492,7 +492,7 @@ function ACPClient:_send_notification(method, params)
params = params or {},
}
local data = vim.json.encode(message) .. "\n"
local data = vim.json.encode(message)
if self.debug_log_file then
self.debug_log_file:write("notification: " .. data .. string.rep("=", 100) .. "\n")
self.debug_log_file:flush()
@@ -507,7 +507,7 @@ end
function ACPClient:_send_result(id, 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
self.debug_log_file:write("request: " .. data .. string.rep("=", 100) .. "\n")
self.debug_log_file:flush()
@@ -524,7 +524,7 @@ function ACPClient:_send_error(id, message, code)
code = code or self.ERROR_CODES.TRANSPORT_ERROR
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)
end

View File

@@ -1132,6 +1132,9 @@ function M._stream_acp(opts)
})
acp_client = ACPClient:new(acp_config)
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
end
local session_id = opts.acp_session_id