capy-acp 0.0.0-stage → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +184 -2
- package/dist/agent.js +468 -0
- package/dist/agent.js.map +1 -0
- package/dist/bin.js +74 -0
- package/dist/bin.js.map +1 -0
- package/dist/capy/client.js +174 -0
- package/dist/capy/client.js.map +1 -0
- package/dist/capy/events.js +140 -0
- package/dist/capy/events.js.map +1 -0
- package/dist/changes.js +218 -0
- package/dist/changes.js.map +1 -0
- package/dist/config.js +41 -0
- package/dist/config.js.map +1 -0
- package/dist/doctor.js +102 -0
- package/dist/doctor.js.map +1 -0
- package/dist/pricing.js +60 -0
- package/dist/pricing.js.map +1 -0
- package/dist/problems.js +108 -0
- package/dist/problems.js.map +1 -0
- package/dist/prompt.js +101 -0
- package/dist/prompt.js.map +1 -0
- package/dist/setup.js +92 -0
- package/dist/setup.js.map +1 -0
- package/dist/sse.js +95 -0
- package/dist/sse.js.map +1 -0
- package/dist/store.js +85 -0
- package/dist/store.js.map +1 -0
- package/dist/translate.js +309 -0
- package/dist/translate.js.map +1 -0
- package/dist/turn.js +319 -0
- package/dist/turn.js.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/workspace.js +164 -0
- package/dist/workspace.js.map +1 -0
- package/package.json +48 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yaz Caleb
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,185 @@
|
|
|
1
|
-
|
|
1
|
+
<img src="assets/icon.svg" width="64" height="64" alt="">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# capy-acp
|
|
4
|
+
|
|
5
|
+
capy-acp runs [Capy](https://capy.ai) coding-agent threads from an [Agent Client Protocol](https://agentclientprotocol.com)
|
|
6
|
+
(ACP) client, such as T3 Code. Each ACP session is a Capy thread on the Capy device of this machine. The agent works in the
|
|
7
|
+
folder that you open, with your tools. Device threads use no Capy machine time. The model runs on your connected subscription,
|
|
8
|
+
unless you select a model that Capy bills to credits.
|
|
9
|
+
|
|
10
|
+
capy-acp is an independent project. Capy did not make it. Read [Limitations](#limitations) and [Tests](#tests) before you use
|
|
11
|
+
it.
|
|
12
|
+
|
|
13
|
+
## What the client shows
|
|
14
|
+
|
|
15
|
+
- The reply from Capy, streamed as Capy writes it.
|
|
16
|
+
- One item for each Capy tool call. The title gives the tools and the time, for example `bash, write (1.2 s)`.
|
|
17
|
+
- A diff of each file that a tool call changed, for example `Edited README.md and scripts/greet.sh`. The Capy stream does not
|
|
18
|
+
give paths or contents. The adapter reads the changes with git (read only), in your folder or in the Capy worktree of the
|
|
19
|
+
thread. It looks when a tool call starts and when it ends. Edits that you made before the prompt do not count. A change that
|
|
20
|
+
occurs while no Capy tool call can write, for example your own edit between two calls, gets its own item:
|
|
21
|
+
`Edited notes.md outside a Capy tool call`.
|
|
22
|
+
- Images, audio and other files that you attach. They go to Capy with the message, and Capy models see attached images.
|
|
23
|
+
- Files that Capy attaches to a reply, as links. A file that Capy made on this machine links to its local path. Other files link
|
|
24
|
+
to a Capy download URL, which expires.
|
|
25
|
+
- Capy subagents, as items that show their status: pending, running, completed or failed.
|
|
26
|
+
- The models of your Capy account. A model that Capy bills to credits shows its price, for example
|
|
27
|
+
`Inkling 2 Small · $0.30/$1.00 per 1M`, or `Particle-1 · free`. After a turn that used Capy credits, a notice gives the
|
|
28
|
+
amount.
|
|
29
|
+
|
|
30
|
+
The adapter also does these things:
|
|
31
|
+
|
|
32
|
+
- Cancel stops the Capy thread. The call that the cancel stopped shows as failed, and calls that finished before it show as
|
|
33
|
+
completed. A follow-up message continues the same thread.
|
|
34
|
+
- Sessions stay available after a restart. `session/load` replays the thread transcript, and `session/resume` connects again
|
|
35
|
+
without a replay. `session/list` lists the saved sessions. The next prompt continues the same Capy thread.
|
|
36
|
+
- If the connection drops, the adapter connects again and continues from the last event. It shows each event one time.
|
|
37
|
+
- If the setup has a problem, the reply tells you how to fix it. Examples are a key that Capy rejects, a folder that is not
|
|
38
|
+
linked, or a repository that is not in a Capy project. (Without a key, the client shows the agent as signed out.) Fix the problem and send the message again. You do not need a new session or a
|
|
39
|
+
restart.
|
|
40
|
+
|
|
41
|
+
## Permissions
|
|
42
|
+
|
|
43
|
+
Capy runs commands and edits files without approval, as it does in the Capy app. **capy-acp never asks your ACP client for
|
|
44
|
+
permission.** Approval prompts and read-only modes in the client have no effect. To control Capy, write instructions in the
|
|
45
|
+
message or in `AGENTS.md`, or change the Capy settings. The Capy docs say that Capy opens a pull request only when you ask.
|
|
46
|
+
|
|
47
|
+
## Requirements
|
|
48
|
+
|
|
49
|
+
- Node 22 or later.
|
|
50
|
+
- A Capy device on this machine. Sign in to the Capy desktop app, or run the headless `capy dock`.
|
|
51
|
+
- A clone of a GitHub repository that is in a Capy project. Any git remote of the clone can name the repository.
|
|
52
|
+
- The folder of that clone, linked to this device. Only the device can link a folder, so the Capy website cannot do it:
|
|
53
|
+
- Desktop app: open the project in Settings, then Projects (`capy://app/settings/projects/<project id>` opens it), set it
|
|
54
|
+
up on this computer, and choose the folder. Scan a folder also works.
|
|
55
|
+
- `capy dock`: stop the dock, run `capy dock dirs add <path>`, and start the dock again. Stopping the dock stops the Capy
|
|
56
|
+
threads that run on this computer.
|
|
57
|
+
|
|
58
|
+
If Capy links another clone of the same repository on this computer, the first reply names that folder.
|
|
59
|
+
- A Capy API key. Create one in the Capy app under Settings, then API. To save it, run `npx -y capy-acp --setup`. The command
|
|
60
|
+
checks the key with Capy and writes it to `~/.config/capy-acp/api-key` with mode 0600. It also reads the key from a pipe,
|
|
61
|
+
for scripts: `capy-acp --setup < key-file`. You can also set `CAPY_API_KEY`.
|
|
62
|
+
|
|
63
|
+
## Setup
|
|
64
|
+
|
|
65
|
+
In **T3 Code**:
|
|
66
|
+
|
|
67
|
+
1. Open Settings, then Providers, then Add provider.
|
|
68
|
+
2. Select Show more, then **Local ACP command**.
|
|
69
|
+
3. Set the command to `npx` with the arguments `-y capy-acp`. To use a checkout, set the command to `node` with the path to
|
|
70
|
+
`dist/bin.js`.
|
|
71
|
+
4. Open a linked folder as the project.
|
|
72
|
+
5. Select the Capy provider.
|
|
73
|
+
|
|
74
|
+
In **other ACP clients**, set the agent command to `npx -y capy-acp`. Set the working directory of the session to the linked
|
|
75
|
+
folder. The tests used only T3 Code as a client.
|
|
76
|
+
|
|
77
|
+
capy-acp announces `capy-acp --setup` as a terminal auth method. A client that supports terminal auth can run the setup for
|
|
78
|
+
you. Until a key is saved, `session/new` fails with `auth_required`, so T3 Code shows the agent as signed out and offers
|
|
79
|
+
the setup.
|
|
80
|
+
|
|
81
|
+
To give the key in T3 Code instead, add `CAPY_API_KEY` to the environment of the provider instance. In
|
|
82
|
+
`~/.t3/userdata/settings.json`, the instance takes `environment: [{ "name": "CAPY_API_KEY", "value": "…", "sensitive": true }]`.
|
|
83
|
+
The other [settings](#settings) go in the same list.
|
|
84
|
+
|
|
85
|
+
### Install without npx
|
|
86
|
+
|
|
87
|
+
`npx -y capy-acp` downloads the newest version when its cache is empty. To pin a version, install it in a folder of its own and
|
|
88
|
+
run that copy:
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
npm install --prefix ~/.local/opt/capy-acp capy-acp@0.2.0
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Then set the command to `node` with the argument `~/.local/opt/capy-acp/node_modules/capy-acp/dist/bin.js`, as an absolute
|
|
95
|
+
path. Use the absolute path of `node` too if your editor does not start from a login shell. A version manager such as fnm can
|
|
96
|
+
give `which node` a path that changes in each shell, so use the path of the installed Node version instead.
|
|
97
|
+
|
|
98
|
+
On **Windows**, T3 Code starts the command without a shell and refuses `.cmd` files such as `npx.cmd`. Set the command to the
|
|
99
|
+
absolute path of `node.exe`, with the absolute path of `dist\bin.js` as the argument.
|
|
100
|
+
|
|
101
|
+
## Settings
|
|
102
|
+
|
|
103
|
+
| Variable | Default | Effect |
|
|
104
|
+
| --- | --- | --- |
|
|
105
|
+
| `CAPY_API_KEY` | (unset) | The Capy API key. The adapter reads it for each request, so a new key needs no restart |
|
|
106
|
+
| `CAPY_API_KEY_FILE` | `~/.config/capy-acp/api-key` | The file with the key, if `CAPY_API_KEY` is not set |
|
|
107
|
+
| `CAPY_ACP_PRICING_URL` | `https://docs.capy.ai/models-and-pricing.md` | The page with the model price table. An empty value turns the prices off |
|
|
108
|
+
| `CAPY_ACP_MODEL` | `anthropic/claude-opus-5-5` | The first model of a session. The model picker lists all models of your Capy account and labels the models that Capy bills to credits |
|
|
109
|
+
| `CAPY_ACP_REASONING` | `high` | The first reasoning level. If a model does not offer this level, the adapter uses the last level that the model lists |
|
|
110
|
+
| `CAPY_ACP_WORKSPACE` | `linked` | `linked`: Capy edits the folder that you opened. `worktree`: each session gets a new Capy worktree, in the worktree folder of Capy (`~/.capy/worktrees` by default). The diffs show the files there |
|
|
111
|
+
| `CAPY_ACP_ALLOW_WORKTREE_FALLBACK` | off | For a clone that is not linked, use a worktree of a linked folder of the same repository |
|
|
112
|
+
| `CAPY_ACP_WAITING_LIMIT_MS` | `600000` | The time that a prompt stays open while Capy waits for a background command |
|
|
113
|
+
| `CAPY_ACP_FORWARD_HOST_INSTRUCTIONS` | off | Send the host instructions from T3 Code to Capy. Without this setting, the adapter sends only the request of the user |
|
|
114
|
+
| `CAPY_DEVICE_ID` | from the desktop app or `capy dock` | The device to use, if the machine has a device in more than one organization |
|
|
115
|
+
| `CAPY_DESKTOP_CONFIG_DIR` | `~/.config/Capy` (Linux), `~/Library/Application Support/Capy` (macOS), `%APPDATA%\Capy` (Windows) | The folder of the desktop app file `device-ids.json` |
|
|
116
|
+
| `CAPY_HOME` | `~/.capy` | The folder of `worktrees`, `device/workspaces.json` (the linked folders) and, for `capy dock`, `dock/status.json` |
|
|
117
|
+
| `CAPY_ACP_STATE_DIR` | `~/.local/state/capy-acp/sessions` | The saved sessions: one small JSON file for each session, with ids, the stream cursor and the model. No credentials |
|
|
118
|
+
| `CAPY_ACP_ATTACHMENTS_DIR` | `~/.cache/capy-acp/attachments` | The folder for files from the *first* prompt of a thread (see below) |
|
|
119
|
+
|
|
120
|
+
### Attachments on a new thread
|
|
121
|
+
|
|
122
|
+
The Capy call that creates a thread accepts only text. A file in a second message can arrive after a fast model already
|
|
123
|
+
answered. For this reason, the adapter saves the files of the first prompt on this machine, readable only by you. The message
|
|
124
|
+
gives their paths, and the device agent reads them on this machine. Follow-up messages attach files with the Capy upload API.
|
|
125
|
+
|
|
126
|
+
## Limitations
|
|
127
|
+
|
|
128
|
+
The first four come from Capy. [docs/capy-api-notes.md](docs/capy-api-notes.md) lists the API changes that would remove the
|
|
129
|
+
first three.
|
|
130
|
+
|
|
131
|
+
- **Tool items show tool names and times, but no commands or output.** The Capy stream does not give them. The diffs show the
|
|
132
|
+
file changes.
|
|
133
|
+
- **The client shows no reasoning, plan or token usage.** The Capy stream does not give them.
|
|
134
|
+
- **The adapter reads the device id from a local Capy file.** The Capy API cannot list devices. The file is `device-ids.json`
|
|
135
|
+
of the desktop app, or `~/.capy/dock/status.json` of `capy dock`. The adapter never writes it. If a Capy update moves it,
|
|
136
|
+
setup fails, and the reply names the file. Set `CAPY_DEVICE_ID` to continue.
|
|
137
|
+
- **Capy works only with repositories on GitHub.com.**
|
|
138
|
+
- **If you edit a file while a Capy tool call that can write runs, the diffs show your edit as part of that call.** The adapter
|
|
139
|
+
sees only the files, not the process that changed them.
|
|
140
|
+
|
|
141
|
+
## Tests
|
|
142
|
+
|
|
143
|
+
| Platform | Capy | Client | Checks |
|
|
144
|
+
| --- | --- | --- | --- |
|
|
145
|
+
| Linux x64, Node 22 to 26 | Desktop app 0.6.0 | T3 Code 0.1.12, ACP test client | All the items in [What the client shows](#what-the-client-shows), and restarts |
|
|
146
|
+
| macOS 26 arm64, Node 26 | `capy dock` 0.7.2 | ACP test client | Prompts, cancel, a dropped stream, a delivered file, a subagent |
|
|
147
|
+
| Windows Server 2022 x64, Node 24 | `capy dock` 0.7.2 | ACP test client | The macOS checks, and diffs in linked mode and worktree mode |
|
|
148
|
+
|
|
149
|
+
CI runs the unit tests on Linux. The unit tests also pass on macOS and Windows. These cases had no test:
|
|
150
|
+
|
|
151
|
+
- T3 Code on macOS or Windows.
|
|
152
|
+
- The desktop app on macOS or Windows. The adapter finds its files in the folders that the code of the app sets.
|
|
153
|
+
- A subagent on a new cloud machine.
|
|
154
|
+
|
|
155
|
+
## Troubleshooting
|
|
156
|
+
|
|
157
|
+
Run `npx -y capy-acp --doctor` in the project folder. It checks Node, the API key, the device and the folder, and prints a
|
|
158
|
+
fix for each problem. It also says if npm has a newer capy-acp. The adapter writes its log to stderr. These are common first replies:
|
|
159
|
+
|
|
160
|
+
| Reply | Fix |
|
|
161
|
+
| --- | --- |
|
|
162
|
+
| T3 Code shows the agent as signed out | Run `npx -y capy-acp --setup`, or set `CAPY_API_KEY` |
|
|
163
|
+
| **Start Capy on this computer** | Sign in to the Capy desktop app, or run `capy dock`. The reply lists each file that capy-acp read. Or set `CAPY_DEVICE_ID`, and `CAPY_DESKTOP_CONFIG_DIR` or `CAPY_HOME` |
|
|
164
|
+
| **Open a repository to use Capy**, or **Add the GitHub remote** | Open the folder of a clone. One of its remotes must name the GitHub repository |
|
|
165
|
+
| **Add owner/repo to a Capy project** | Add the repository to a Capy project |
|
|
166
|
+
| **Link this folder to Capy** | Link the folder as the reply tells you. Then send the message again |
|
|
167
|
+
| **Use the folder that Capy links for owner/repo** | Open the folder that the reply names, link this folder instead, or set `CAPY_ACP_ALLOW_WORKTREE_FALLBACK=1` |
|
|
168
|
+
| `Capy has not started on this message yet` | Make sure that the Capy desktop app or `capy dock` runs and is signed in. The message stays in the thread queue |
|
|
169
|
+
|
|
170
|
+
## Development
|
|
171
|
+
|
|
172
|
+
```sh
|
|
173
|
+
pnpm install
|
|
174
|
+
pnpm typecheck && pnpm test && pnpm build
|
|
175
|
+
node spike/acp-client.ts <folder> "<prompt>" ["<follow-up>"] [--cancel-after-ms N] [--between "<command>"] \
|
|
176
|
+
[--image N:<file>] [--load <sessionId> | --resume <sessionId>]
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The tests replay recorded Capy streams from `fixtures/`. They operate the agent over a real ACP connection with a fake Capy
|
|
180
|
+
client. [`docs/design.md`](docs/design.md) explains how the adapter works around the Capy API, and
|
|
181
|
+
[`docs/capy-api-notes.md`](docs/capy-api-notes.md) is the feedback for Capy: ranked asks, with evidence from the recordings.
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
[MIT](LICENSE)
|