Skip to content

Commit 4e7584d

Browse files
author
Alejandro Claro
committed
feat(adapters): add kilocode ACP adapter
Add a new ACP adapter implementation for Kilo Code at lua/codecompanion/adapters/acp/kilocode.lua. - Registers adapter metadata (name, formatted_name, type, roles). - Enables vision option and sets default command ("kilo acp"). - Adds sensible defaults: empty mcpServers and 20s timeout. - Supplies adapter parameters (protocolVersion, clientCapabilities, clientInfo). - Implements basic handlers: setup, auth (always succeeds), form_messages (delegates to acp.helpers), and noop on_exit.
1 parent 680c445 commit 4e7584d

2 files changed

Lines changed: 78 additions & 0 deletions

File tree

doc/configuration/adapters-acp.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,3 +397,19 @@ You can specify a custom model in your `~/.config/opencode/config.json` file:
397397
}
398398
```
399399

400+
## Setup: Kilo Code
401+
402+
To use [Kilo Code](https://kilo.ai) in CodeCompanion, ensure you've followed
403+
their documentation to
404+
[install](https://kilo.ai/docs/getting-started/installing#cli) and
405+
[configure](https://kilo.ai/docs/getting-started/setup-authentication#cli) it. Then ensure that in your
406+
chat buffer you select the `kilocode` adapter.
407+
408+
You can specify a custom model in your `~/.config/kilo/kilo.json` file:
409+
410+
```json
411+
{
412+
"$schema": "https://kilo.ai/config.json",
413+
"model": "kilo/kilo-auto/free",
414+
}
415+
```
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
local helpers = require("codecompanion.adapters.acp.helpers")
2+
3+
---@class CodeCompanion.ACPAdapter.KiloCode: CodeCompanion.ACPAdapter
4+
return {
5+
name = "kilocode",
6+
formatted_name = "Kilo Code",
7+
type = "acp",
8+
roles = {
9+
llm = "assistant",
10+
user = "user",
11+
},
12+
opts = {
13+
vision = true,
14+
},
15+
commands = {
16+
default = {
17+
"kilo",
18+
"acp",
19+
},
20+
},
21+
defaults = {
22+
mcpServers = {},
23+
timeout = 20000, -- 20 seconds
24+
},
25+
parameters = {
26+
protocolVersion = 1,
27+
clientCapabilities = {
28+
fs = { readTextFile = true, writeTextFile = true },
29+
},
30+
clientInfo = {
31+
name = "CodeCompanion.nvim",
32+
version = "1.0.0",
33+
},
34+
},
35+
handlers = {
36+
---@param self CodeCompanion.ACPAdapter
37+
---@return boolean
38+
setup = function(self)
39+
return true
40+
end,
41+
42+
---@param self CodeCompanion.ACPAdapter
43+
---@return boolean
44+
auth = function(self)
45+
-- Declaring auth a success
46+
return true
47+
end,
48+
49+
---@param self CodeCompanion.ACPAdapter
50+
---@param messages table
51+
---@param capabilities table
52+
---@return table
53+
form_messages = function(self, messages, capabilities)
54+
return helpers.form_messages(self, messages, capabilities)
55+
end,
56+
57+
---@param self CodeCompanion.ACPAdapter
58+
---@param code number
59+
---@return nil
60+
on_exit = function(self, code) end,
61+
},
62+
}

0 commit comments

Comments
 (0)