@openacp/cli 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/README.md ADDED
@@ -0,0 +1,286 @@
1
+ # OpenACP
2
+
3
+ Self-hosted bridge that lets you interact with AI coding agents (Claude Code, Codex, etc.) from messaging platforms (Telegram, Discord, etc.) via the [Agent Client Protocol (ACP)](https://agentclientprotocol.org/).
4
+
5
+ **One message, any channel, any agent.**
6
+
7
+ ## How It Works
8
+
9
+ ```
10
+ You (Telegram / Discord / ...)
11
+
12
+
13
+ OpenACP (ChannelAdapter)
14
+
15
+
16
+ ACP Protocol (JSON-RPC over stdio)
17
+
18
+
19
+ AI Agent subprocess (Claude Code, Codex, ...)
20
+ ```
21
+
22
+ You send a message in Telegram → OpenACP forwards it to an AI coding agent via ACP → agent responds with text, code, tool calls → OpenACP streams the response back to your chat.
23
+
24
+ ## Features
25
+
26
+ - **Multi-agent** — Switch between Claude Code, Codex, or any ACP-compatible agent
27
+ - **Telegram integration** — Forum topics per session, real-time streaming, inline permission buttons
28
+ - **Session management** — Multiple parallel sessions, prompt queue, auto-naming
29
+ - **Assistant topic** — AI-powered help bot that guides you through creating sessions
30
+ - **Notification topic** — Aggregated notifications with deep links
31
+ - **Workspace management** — Named workspaces or custom paths
32
+ - **Self-hosted** — Your keys, your data, your machine
33
+
34
+ ## Quick Start
35
+
36
+ ### Prerequisites
37
+
38
+ - Node.js >= 20
39
+ - pnpm
40
+ - A Telegram bot token (from [@BotFather](https://t.me/BotFather))
41
+ - A Telegram Supergroup with **Forum/Topics enabled**
42
+ - At least one ACP agent installed (e.g., `claude-agent-acp`)
43
+
44
+ ### Install
45
+
46
+ ```bash
47
+ npx openacp
48
+ ```
49
+
50
+ Or install globally:
51
+
52
+ ```bash
53
+ npm install -g openacp
54
+ openacp
55
+ ```
56
+
57
+ On first run, OpenACP creates `~/.openacp/config.json` with defaults.
58
+
59
+ ### Configure
60
+
61
+ Run once to generate the default config:
62
+
63
+ ```bash
64
+ openacp
65
+ ```
66
+
67
+ Edit `~/.openacp/config.json`:
68
+
69
+ ```json
70
+ {
71
+ "channels": {
72
+ "telegram": {
73
+ "enabled": true,
74
+ "botToken": "YOUR_BOT_TOKEN",
75
+ "chatId": -100YOUR_CHAT_ID
76
+ }
77
+ },
78
+ "agents": {
79
+ "claude": {
80
+ "command": "claude-agent-acp",
81
+ "args": []
82
+ }
83
+ },
84
+ "defaultAgent": "claude"
85
+ }
86
+ ```
87
+
88
+ ### Setup Telegram
89
+
90
+ 1. Create a Supergroup in Telegram
91
+ 2. Enable **Topics** in group settings
92
+ 3. Add your bot as **admin** with **Manage Topics** permission
93
+ 4. Get the chat ID (use [@raw_data_bot](https://t.me/raw_data_bot) or similar)
94
+
95
+ ### Run
96
+
97
+ ```bash
98
+ openacp
99
+ ```
100
+
101
+ Or without global install:
102
+
103
+ ```bash
104
+ npx openacp
105
+ ```
106
+
107
+ OpenACP will auto-create two topics in your group:
108
+ - **📋 Notifications** — aggregated alerts with deep links
109
+ - **🤖 Assistant** — AI helper for managing sessions
110
+
111
+ ## Usage
112
+
113
+ ### Commands
114
+
115
+ | Command | Description |
116
+ |---------|-------------|
117
+ | `/new [agent] [workspace]` | Create a new session |
118
+ | `/new_chat` | New session, same agent & workspace |
119
+ | `/cancel` | Cancel current session |
120
+ | `/status` | Show session or system status |
121
+ | `/agents` | List available agents |
122
+ | `/help` | Show help |
123
+
124
+ ### Examples
125
+
126
+ ```
127
+ /new claude my-app → New session with Claude in ~/openacp-workspace/my-app/
128
+ /new codex api-server → New session with Codex in ~/openacp-workspace/api-server/
129
+ /new claude ~/code/project → New session with absolute path
130
+ /new → New session with default agent and workspace
131
+ ```
132
+
133
+ ### Session Flow
134
+
135
+ 1. Type `/new claude my-project` — bot creates a new topic
136
+ 2. Send your coding request in the topic
137
+ 3. Agent responds with streaming text, tool calls, and code
138
+ 4. When agent needs permission (run command, edit file) → inline buttons appear
139
+ 5. Click Allow/Deny → agent continues
140
+ 6. `/cancel` to stop, or start a new topic with `/new`
141
+
142
+ ## Configuration
143
+
144
+ Config file: `~/.openacp/config.json`
145
+
146
+ ```json
147
+ {
148
+ "channels": {
149
+ "telegram": {
150
+ "enabled": true,
151
+ "botToken": "...",
152
+ "chatId": -1001234567890,
153
+ "notificationTopicId": null,
154
+ "assistantTopicId": null
155
+ }
156
+ },
157
+ "agents": {
158
+ "claude": {
159
+ "command": "claude-agent-acp",
160
+ "args": [],
161
+ "env": {}
162
+ },
163
+ "codex": {
164
+ "command": "codex",
165
+ "args": ["--acp"],
166
+ "env": {}
167
+ }
168
+ },
169
+ "defaultAgent": "claude",
170
+ "workspace": {
171
+ "baseDir": "~/openacp-workspace"
172
+ },
173
+ "security": {
174
+ "allowedUserIds": [],
175
+ "maxConcurrentSessions": 5,
176
+ "sessionTimeoutMinutes": 60
177
+ }
178
+ }
179
+ ```
180
+
181
+ ### Environment Variables
182
+
183
+ | Variable | Overrides |
184
+ |----------|-----------|
185
+ | `OPENACP_CONFIG_PATH` | Config file location |
186
+ | `OPENACP_TELEGRAM_BOT_TOKEN` | `channels.telegram.botToken` |
187
+ | `OPENACP_TELEGRAM_CHAT_ID` | `channels.telegram.chatId` |
188
+ | `OPENACP_DEFAULT_AGENT` | `defaultAgent` |
189
+ | `OPENACP_DEBUG` | Enable debug logging (set to `1`) |
190
+
191
+ ## Plugins
192
+
193
+ Install additional adapters:
194
+
195
+ ```bash
196
+ npx openacp install @openacp/adapter-discord
197
+ npx openacp plugins # list installed
198
+ npx openacp uninstall @openacp/adapter-discord # remove
199
+ ```
200
+
201
+ Configure in `~/.openacp/config.json`:
202
+
203
+ ```json
204
+ {
205
+ "channels": {
206
+ "discord": {
207
+ "enabled": true,
208
+ "adapter": "@openacp/adapter-discord",
209
+ "botToken": "..."
210
+ }
211
+ }
212
+ }
213
+ ```
214
+
215
+ ## Project Structure
216
+
217
+ ```
218
+ openacp/
219
+ packages/
220
+ core/ → @openacp/core
221
+ src/
222
+ main.ts → Entry point
223
+ core.ts → OpenACPCore orchestrator
224
+ config.ts → ConfigManager + Zod validation
225
+ session.ts → Session (prompt queue, auto-name)
226
+ agent-instance.ts → ACP SDK integration
227
+ channel.ts → ChannelAdapter abstract class
228
+ types.ts → Shared types
229
+ adapters/
230
+ telegram/ → @openacp/adapter-telegram
231
+ src/
232
+ adapter.ts → TelegramAdapter
233
+ streaming.ts → Real-time message streaming
234
+ commands.ts → Bot commands
235
+ permissions.ts → Permission inline buttons
236
+ assistant.ts → AI assistant topic
237
+ formatting.ts → Markdown → Telegram HTML
238
+ topics.ts → Forum topic management
239
+ ```
240
+
241
+ ## Roadmap
242
+
243
+ - **Phase 1** ✅ Core + Telegram + ACP agents
244
+ - **Phase 2** — Web UI, CLI, Discord adapter, tunnel/file viewer
245
+ - **Phase 3** — Agent skills as commands, session persistence
246
+ - **Phase 4** — Voice control, file sharing
247
+ - **Phase 5** — WhatsApp, agent chaining, plugin marketplace
248
+
249
+ See [docs/specs/01-roadmap.md](docs/specs/01-roadmap.md) for details.
250
+
251
+ ## Adding a Channel Adapter
252
+
253
+ Extend `ChannelAdapter` from `@openacp/core`:
254
+
255
+ ```typescript
256
+ import { ChannelAdapter } from '@openacp/core'
257
+
258
+ class MyAdapter extends ChannelAdapter {
259
+ async start() { /* connect to platform */ }
260
+ async stop() { /* disconnect */ }
261
+ async sendMessage(sessionId, content) { /* send to user */ }
262
+ async sendPermissionRequest(sessionId, request) { /* show buttons */ }
263
+ async sendNotification(notification) { /* notify user */ }
264
+ async createSessionThread(sessionId, name) { /* create thread */ }
265
+ async renameSessionThread(sessionId, name) { /* rename thread */ }
266
+ }
267
+ ```
268
+
269
+ ## Development
270
+
271
+ ```bash
272
+ git clone https://github.com/nicepkg/OpenACP.git
273
+ cd OpenACP
274
+ pnpm install
275
+ pnpm build
276
+ ```
277
+
278
+ Run locally:
279
+
280
+ ```bash
281
+ node packages/core/dist/main.js
282
+ ```
283
+
284
+ ## License
285
+
286
+ AGPL-3.0