@victor-software-house/pi-acp 0.1.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 +198 -0
- package/dist/index.mjs +1579 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +73 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Victor Software House
|
|
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
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# pi-acp
|
|
2
|
+
|
|
3
|
+
ACP ([Agent Client Protocol](https://agentclientprotocol.com/get-started/introduction)) adapter for [`pi`](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent) coding agent.
|
|
4
|
+
|
|
5
|
+
`pi-acp` embeds pi directly via the `@mariozechner/pi-coding-agent` SDK and exposes it as an ACP agent over stdio. Each ACP session owns one in-process `AgentSession`.
|
|
6
|
+
|
|
7
|
+
## Status
|
|
8
|
+
|
|
9
|
+
Active development. ACP compliance is improving steadily. Development is centered around [Zed](https://zed.dev) editor support; other ACP clients may have varying levels of compatibility.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Streams assistant output as ACP `agent_message_chunk`
|
|
14
|
+
- Streams thinking output as ACP `agent_thought_chunk`
|
|
15
|
+
- Maps pi tool execution to ACP `tool_call` / `tool_call_update`
|
|
16
|
+
- Tool call locations surfaced for follow-along features in clients like Zed
|
|
17
|
+
- For `edit`, emits ACP structured diffs (`oldText`/`newText`) with inferred line numbers
|
|
18
|
+
- Tool kinds: `read`, `edit`, `execute` (bash), `other`
|
|
19
|
+
- Session configuration via ACP `configOptions`
|
|
20
|
+
- Model selector (category: `model`)
|
|
21
|
+
- Thinking level selector (category: `thought_level`)
|
|
22
|
+
- Also advertises `modes` and `models` for backward compatibility
|
|
23
|
+
- `session/set_config_option` for changing model or thinking level
|
|
24
|
+
- `config_option_update` emitted when configuration changes
|
|
25
|
+
- Session persistence and history
|
|
26
|
+
- pi manages sessions in `~/.pi/agent/sessions/...`
|
|
27
|
+
- `session/list` uses pi's `SessionManager` directly
|
|
28
|
+
- `session/load` replays full conversation history
|
|
29
|
+
- Sessions can be resumed in both `pi` CLI and ACP clients
|
|
30
|
+
- Slash commands
|
|
31
|
+
- File-based prompt templates from `~/.pi/agent/prompts/` and `<cwd>/.pi/prompts/`
|
|
32
|
+
- Extension commands from pi extensions
|
|
33
|
+
- Skill commands (appear as `/skill:skill-name`)
|
|
34
|
+
- Built-in adapter commands (see below)
|
|
35
|
+
- Authentication via Terminal Auth (ACP Registry support)
|
|
36
|
+
- Startup info block with pi version and context (configurable via `quietStartup` setting)
|
|
37
|
+
|
|
38
|
+
## Prerequisites
|
|
39
|
+
|
|
40
|
+
- Node.js 20+
|
|
41
|
+
- `pi` installed globally: `npm install -g @mariozechner/pi-coding-agent`
|
|
42
|
+
- Configure `pi` for your model providers/API keys
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
### ACP Registry (Zed)
|
|
47
|
+
|
|
48
|
+
Launch the registry with `zed: acp registry` and select `pi ACP`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
"agent_servers": {
|
|
52
|
+
"pi-acp": {
|
|
53
|
+
"type": "registry"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### npx (no global install)
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
"agent_servers": {
|
|
62
|
+
"pi": {
|
|
63
|
+
"type": "custom",
|
|
64
|
+
"command": "npx",
|
|
65
|
+
"args": ["-y", "@victor-software-house/pi-acp"],
|
|
66
|
+
"env": {}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Global install
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install -g @victor-software-house/pi-acp
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
"agent_servers": {
|
|
79
|
+
"pi": {
|
|
80
|
+
"type": "custom",
|
|
81
|
+
"command": "pi-acp",
|
|
82
|
+
"args": [],
|
|
83
|
+
"env": {}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### From source
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
bun install
|
|
92
|
+
bun run build
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
"agent_servers": {
|
|
97
|
+
"pi": {
|
|
98
|
+
"type": "custom",
|
|
99
|
+
"command": "node",
|
|
100
|
+
"args": ["/path/to/pi-acp/dist/index.js"],
|
|
101
|
+
"env": {}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Built-in commands
|
|
107
|
+
|
|
108
|
+
- `/compact [instructions...]` -- compact session context
|
|
109
|
+
- `/autocompact on|off|toggle` -- toggle automatic compaction
|
|
110
|
+
- `/export` -- export session to HTML
|
|
111
|
+
- `/session` -- show session stats (tokens, messages, cost)
|
|
112
|
+
- `/name <name>` -- set session display name
|
|
113
|
+
- `/steering all|one-at-a-time` -- set steering message delivery mode
|
|
114
|
+
- `/follow-up all|one-at-a-time` -- set follow-up message delivery mode
|
|
115
|
+
- `/changelog` -- show pi changelog
|
|
116
|
+
|
|
117
|
+
## Authentication
|
|
118
|
+
|
|
119
|
+
Terminal Auth for the [ACP Registry](https://agentclientprotocol.com/get-started/registry):
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
pi-acp --terminal-login
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Zed shows an Authenticate banner that launches this automatically.
|
|
126
|
+
|
|
127
|
+
## Development
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
bun install
|
|
131
|
+
bun run dev # run from src
|
|
132
|
+
bun run build # tsup -> dist/index.js
|
|
133
|
+
bun run typecheck # tsc --noEmit
|
|
134
|
+
bun run lint # biome + oxlint
|
|
135
|
+
bun test # 26 tests
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Project layout:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
src/
|
|
142
|
+
index.ts # stdio entry point
|
|
143
|
+
env.d.ts # ProcessEnv augmentation
|
|
144
|
+
acp/
|
|
145
|
+
agent.ts # PiAcpAgent (ACP Agent interface)
|
|
146
|
+
session.ts # PiAcpSession (wraps AgentSession, translates events)
|
|
147
|
+
auth.ts # AuthMethod builder
|
|
148
|
+
auth-required.ts # auth error detection
|
|
149
|
+
pi-settings.ts # settings reader (Zod schema)
|
|
150
|
+
translate/
|
|
151
|
+
pi-messages.ts # pi message text extraction
|
|
152
|
+
pi-tools.ts # pi tool result text extraction (Zod schema)
|
|
153
|
+
prompt.ts # ACP ContentBlock -> pi message
|
|
154
|
+
pi-auth/
|
|
155
|
+
status.ts # auth detection (Zod schema)
|
|
156
|
+
test/
|
|
157
|
+
helpers/fakes.ts # test doubles
|
|
158
|
+
unit/ # unit tests
|
|
159
|
+
component/ # integration tests
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Limitations
|
|
163
|
+
|
|
164
|
+
### MUST-level gaps
|
|
165
|
+
|
|
166
|
+
- **MCP servers** -- accepted in `session/new` and `session/load` params but not wired through to pi. ACP requires agents to connect to all provided MCP servers. This is the main compliance gap.
|
|
167
|
+
|
|
168
|
+
### SHOULD-level gaps
|
|
169
|
+
|
|
170
|
+
- **`session/request_permission`** -- pi does not request permission from ACP clients before tool execution.
|
|
171
|
+
|
|
172
|
+
### Not implemented (MAY / client capabilities)
|
|
173
|
+
|
|
174
|
+
- **`session_info_update`** -- partially implemented (emitted by `/name` command); not emitted automatically for other metadata changes.
|
|
175
|
+
- **`agent_plan`** -- plan updates not emitted before tool execution.
|
|
176
|
+
- **ACP filesystem delegation** (`fs/read_text_file`, `fs/write_text_file`) -- pi reads/writes locally. Not advertised.
|
|
177
|
+
- **ACP terminal delegation** (`terminal/*`) -- pi executes commands locally. Not advertised.
|
|
178
|
+
|
|
179
|
+
### Design decisions
|
|
180
|
+
|
|
181
|
+
- pi does not have real session modes (ask/architect/code). The `modes` field exposes thinking levels for backward compatibility with clients that do not support `configOptions`.
|
|
182
|
+
- `configOptions` is the preferred configuration mechanism. Zed uses it exclusively when present.
|
|
183
|
+
|
|
184
|
+
See [TODO.md](TODO.md) for full gap inventory and [ROADMAP.md](ROADMAP.md) for priorities.
|
|
185
|
+
|
|
186
|
+
## Release
|
|
187
|
+
|
|
188
|
+
Releases are automated via [semantic-release](https://semantic-release.gitbook.io/) on pushes to `main`. The pipeline runs typecheck, lint, tests, and `npm pack --dry-run` before publishing. npm trusted publishing (OIDC) is used -- no long-lived npm tokens.
|
|
189
|
+
|
|
190
|
+
Commit messages must follow [Conventional Commits](https://www.conventionalcommits.org/). Commitlint enforces this locally via lefthook and in CI.
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
MIT (see [LICENSE](LICENSE)).
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
Inspired by [svkozak/pi-acp](https://github.com/svkozak/pi-acp).
|