@4via6/relay 1.0.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/.env.example +50 -0
- package/README.md +253 -0
- package/dist/auth.d.ts +3 -0
- package/dist/auth.js +32 -0
- package/dist/auth.js.map +1 -0
- package/dist/bot.d.ts +2 -0
- package/dist/bot.js +14 -0
- package/dist/bot.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/admin.d.ts +2 -0
- package/dist/commands/admin.js +420 -0
- package/dist/commands/admin.js.map +1 -0
- package/dist/commands/chat.d.ts +2 -0
- package/dist/commands/chat.js +80 -0
- package/dist/commands/chat.js.map +1 -0
- package/dist/commands/files.d.ts +2 -0
- package/dist/commands/files.js +162 -0
- package/dist/commands/files.js.map +1 -0
- package/dist/commands/history.d.ts +2 -0
- package/dist/commands/history.js +152 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/index.d.ts +2 -0
- package/dist/commands/index.js +21 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/mcp.d.ts +2 -0
- package/dist/commands/mcp.js +105 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/media.d.ts +2 -0
- package/dist/commands/media.js +248 -0
- package/dist/commands/media.js.map +1 -0
- package/dist/commands/monitor.d.ts +2 -0
- package/dist/commands/monitor.js +136 -0
- package/dist/commands/monitor.js.map +1 -0
- package/dist/commands/session.d.ts +2 -0
- package/dist/commands/session.js +114 -0
- package/dist/commands/session.js.map +1 -0
- package/dist/commands/shell.d.ts +2 -0
- package/dist/commands/shell.js +90 -0
- package/dist/commands/shell.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +82 -0
- package/dist/index.js.map +1 -0
- package/dist/providers/claude.d.ts +52 -0
- package/dist/providers/claude.js +449 -0
- package/dist/providers/claude.js.map +1 -0
- package/dist/providers/codex.d.ts +45 -0
- package/dist/providers/codex.js +400 -0
- package/dist/providers/codex.js.map +1 -0
- package/dist/providers/index.d.ts +6 -0
- package/dist/providers/index.js +40 -0
- package/dist/providers/index.js.map +1 -0
- package/dist/providers/opencode.d.ts +40 -0
- package/dist/providers/opencode.js +498 -0
- package/dist/providers/opencode.js.map +1 -0
- package/dist/providers/types.d.ts +173 -0
- package/dist/providers/types.js +6 -0
- package/dist/providers/types.js.map +1 -0
- package/dist/session.d.ts +10 -0
- package/dist/session.js +65 -0
- package/dist/session.js.map +1 -0
- package/dist/utils/chunker.d.ts +1 -0
- package/dist/utils/chunker.js +24 -0
- package/dist/utils/chunker.js.map +1 -0
- package/dist/utils/errors.d.ts +12 -0
- package/dist/utils/errors.js +85 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/files.d.ts +15 -0
- package/dist/utils/files.js +81 -0
- package/dist/utils/files.js.map +1 -0
- package/dist/utils/html.d.ts +4 -0
- package/dist/utils/html.js +10 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/media.d.ts +15 -0
- package/dist/utils/media.js +103 -0
- package/dist/utils/media.js.map +1 -0
- package/dist/utils/store.d.ts +15 -0
- package/dist/utils/store.js +44 -0
- package/dist/utils/store.js.map +1 -0
- package/dist/utils/stream.d.ts +21 -0
- package/dist/utils/stream.js +149 -0
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/stt.d.ts +7 -0
- package/dist/utils/stt.js +118 -0
- package/dist/utils/stt.js.map +1 -0
- package/dist/utils/system-prompt.d.ts +5 -0
- package/dist/utils/system-prompt.js +64 -0
- package/dist/utils/system-prompt.js.map +1 -0
- package/dist/utils/timeout.d.ts +2 -0
- package/dist/utils/timeout.js +18 -0
- package/dist/utils/timeout.js.map +1 -0
- package/docs/commands.md +351 -0
- package/docs/configuration.md +160 -0
- package/docs/features.md +443 -0
- package/docs/getting-started.md +102 -0
- package/docs/providers.md +236 -0
- package/docs/troubleshooting.md +287 -0
- package/package.json +54 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
# Provider Setup
|
|
2
|
+
|
|
3
|
+
Relay supports three coding agent backends. Each provider connects the bot to a different AI coding tool. Set `PROVIDER` in your `.env` file to choose one.
|
|
4
|
+
|
|
5
|
+
## OpenCode
|
|
6
|
+
|
|
7
|
+
[OpenCode](https://github.com/opencode-ai/opencode) is the recommended provider with the most complete feature set. It supports all Relay features including file operations, todos, diffs, MCP management, and dynamic model listing.
|
|
8
|
+
|
|
9
|
+
### Installation
|
|
10
|
+
|
|
11
|
+
The OpenCode SDK is included as a core dependency -- no extra installation needed.
|
|
12
|
+
|
|
13
|
+
### Configuration
|
|
14
|
+
|
|
15
|
+
There are two modes of operation:
|
|
16
|
+
|
|
17
|
+
#### Mode 1: Start (recommended)
|
|
18
|
+
|
|
19
|
+
Relay spawns and manages the OpenCode server automatically.
|
|
20
|
+
|
|
21
|
+
```env
|
|
22
|
+
PROVIDER=opencode
|
|
23
|
+
OPENCODE_MODE=start
|
|
24
|
+
OPENCODE_HOSTNAME=127.0.0.1
|
|
25
|
+
OPENCODE_PORT=4096
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
#### Mode 2: Connect
|
|
29
|
+
|
|
30
|
+
Connect to an already-running OpenCode server. Use this when the server is running on a different machine or managed separately.
|
|
31
|
+
|
|
32
|
+
```env
|
|
33
|
+
PROVIDER=opencode
|
|
34
|
+
OPENCODE_MODE=connect
|
|
35
|
+
OPENCODE_URL=http://localhost:4096
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
If you connect to a remote server over HTTP, the bot will show a warning. Use HTTPS for production deployments.
|
|
39
|
+
|
|
40
|
+
### Model Selection
|
|
41
|
+
|
|
42
|
+
OpenCode supports many AI providers and models. Set a default model:
|
|
43
|
+
|
|
44
|
+
```env
|
|
45
|
+
OPENCODE_MODEL=anthropic/claude-sonnet-4-20250514
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or change models at runtime:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
/models -- List all configured models
|
|
52
|
+
/model anthropic/claude-sonnet-4-20250514 -- Switch to a specific model
|
|
53
|
+
/model sonnet -- Partial match
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### OpenCode Configuration
|
|
57
|
+
|
|
58
|
+
OpenCode itself is configured through its own config file (typically `opencode.json` or via environment variables). Refer to the [OpenCode documentation](https://opencode.ai/docs) for:
|
|
59
|
+
|
|
60
|
+
- Adding AI providers (Anthropic, OpenAI, Google, etc.)
|
|
61
|
+
- Configuring MCP servers in the config file
|
|
62
|
+
- Setting up agent modes (build, plan, explore)
|
|
63
|
+
- Tool permissions and security settings
|
|
64
|
+
|
|
65
|
+
### Supported Features
|
|
66
|
+
|
|
67
|
+
All Relay features are supported:
|
|
68
|
+
- Sessions, streaming, file operations
|
|
69
|
+
- Todo lists, diffs, session forking
|
|
70
|
+
- Shell access, custom commands
|
|
71
|
+
- MCP server management
|
|
72
|
+
- Dynamic model listing with capabilities
|
|
73
|
+
- Outbound file attachments (screenshots, generated files)
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Claude Code
|
|
78
|
+
|
|
79
|
+
[Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview) connects to the Anthropic Claude AI with full coding agent capabilities.
|
|
80
|
+
|
|
81
|
+
### Installation
|
|
82
|
+
|
|
83
|
+
Install the Claude Code SDK:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm install @anthropic-ai/claude-code
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Configuration
|
|
90
|
+
|
|
91
|
+
```env
|
|
92
|
+
PROVIDER=claude
|
|
93
|
+
ANTHROPIC_API_KEY=sk-ant-api03-...
|
|
94
|
+
CLAUDE_MODEL=sonnet
|
|
95
|
+
CLAUDE_PERMISSION_MODE=acceptEdits
|
|
96
|
+
CLAUDE_CWD=/path/to/your/project
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### API Key
|
|
100
|
+
|
|
101
|
+
Get your API key from the [Anthropic Console](https://console.anthropic.com/). The key must have access to the Claude Code API.
|
|
102
|
+
|
|
103
|
+
### Models
|
|
104
|
+
|
|
105
|
+
Models are fetched dynamically from the Anthropic API (`GET /v1/models`), so new models are automatically available without a bot update.
|
|
106
|
+
|
|
107
|
+
Use `/models` to see all available models, and `/model <id>` to switch:
|
|
108
|
+
|
|
109
|
+
```
|
|
110
|
+
/models -- List all available Anthropic models
|
|
111
|
+
/model sonnet -- Switch by alias
|
|
112
|
+
/model claude-opus-4-0-20250514 -- Switch by full ID
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Permission Mode
|
|
116
|
+
|
|
117
|
+
The `CLAUDE_PERMISSION_MODE` controls how Claude handles file system operations:
|
|
118
|
+
|
|
119
|
+
- `acceptEdits` -- Automatically accept file edits (recommended for bot use)
|
|
120
|
+
- Other modes may require interactive approval, which won't work in a bot context
|
|
121
|
+
|
|
122
|
+
### Working Directory
|
|
123
|
+
|
|
124
|
+
Set `CLAUDE_CWD` to the project directory you want Claude to work in. Defaults to the directory where Relay is running.
|
|
125
|
+
|
|
126
|
+
### MCP Servers
|
|
127
|
+
|
|
128
|
+
Claude supports MCP servers configured at runtime through the bot:
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
/mcp add memory local npx -y @modelcontextprotocol/server-memory
|
|
132
|
+
/mcp add browser local npx -y @anthropic-ai/mcp-server-puppeteer
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
MCP configs are persisted to `.relay/claude-mcp.json` and automatically restored on restart.
|
|
136
|
+
|
|
137
|
+
### Supported Features
|
|
138
|
+
|
|
139
|
+
| Feature | Status |
|
|
140
|
+
|---------|--------|
|
|
141
|
+
| Chat, streaming | Supported |
|
|
142
|
+
| Sessions | Create, list, delete, fork |
|
|
143
|
+
| Shell access | Via prompt (asks Claude to run commands) |
|
|
144
|
+
| MCP management | Persisted to disk |
|
|
145
|
+
| Model selection | Dynamic (fetched from Anthropic API) |
|
|
146
|
+
| File operations | Via prompt delegation (read, find, search, git status) |
|
|
147
|
+
| Code diffs | Via prompt delegation (git diff) |
|
|
148
|
+
| History | Supported (session message history) |
|
|
149
|
+
| Todos | Not supported |
|
|
150
|
+
| Session sharing | Not supported |
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## OpenAI Codex
|
|
155
|
+
|
|
156
|
+
[OpenAI Codex](https://github.com/openai/codex) provides coding agent capabilities using OpenAI's reasoning models.
|
|
157
|
+
|
|
158
|
+
### Installation
|
|
159
|
+
|
|
160
|
+
Install the Codex SDK:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npm install @openai/codex
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
### Configuration
|
|
167
|
+
|
|
168
|
+
```env
|
|
169
|
+
PROVIDER=codex
|
|
170
|
+
CODEX_API_KEY=sk-...
|
|
171
|
+
CODEX_MODEL=o3
|
|
172
|
+
CODEX_CWD=/path/to/your/project
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
You can use either `CODEX_API_KEY` or `OPENAI_API_KEY`. If both are set, `CODEX_API_KEY` takes priority.
|
|
176
|
+
|
|
177
|
+
### Models
|
|
178
|
+
|
|
179
|
+
Models are fetched dynamically from the OpenAI API (`GET /v1/models`), so new models are automatically available without a bot update.
|
|
180
|
+
|
|
181
|
+
Use `/models` to see all available models, and `/model <id>` to switch:
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
/models -- List all available OpenAI models
|
|
185
|
+
/model o3 -- Switch to o3
|
|
186
|
+
/model o4-mini -- Switch to o4-mini
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Working Directory
|
|
190
|
+
|
|
191
|
+
Set `CODEX_CWD` to the project directory. Defaults to the directory where Relay is running.
|
|
192
|
+
|
|
193
|
+
### Supported Features
|
|
194
|
+
|
|
195
|
+
| Feature | Status |
|
|
196
|
+
|---------|--------|
|
|
197
|
+
| Chat, streaming | Supported |
|
|
198
|
+
| Sessions | Create, list, delete (persisted to disk) |
|
|
199
|
+
| Shell access | Via prompt (asks Codex to run commands) |
|
|
200
|
+
| MCP management | Not supported |
|
|
201
|
+
| Model selection | Dynamic (fetched from OpenAI API) |
|
|
202
|
+
| File operations | Via prompt delegation (read, find, search, git status) |
|
|
203
|
+
| Code diffs | Via prompt delegation (git diff) |
|
|
204
|
+
| Todos | Not supported |
|
|
205
|
+
| Session sharing | Not supported |
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Provider Comparison
|
|
210
|
+
|
|
211
|
+
| Feature | OpenCode | Claude | Codex |
|
|
212
|
+
|---------|----------|--------|-------|
|
|
213
|
+
| Streaming | yes | yes | yes |
|
|
214
|
+
| File output (screenshots) | yes | no | no |
|
|
215
|
+
| MCP management | full API | persisted | no |
|
|
216
|
+
| Model listing | dynamic | dynamic (API) | dynamic (API) |
|
|
217
|
+
| Todo tracking | yes | no | no |
|
|
218
|
+
| Code diffs | yes | via prompt | via prompt |
|
|
219
|
+
| Session forking | yes | yes | no |
|
|
220
|
+
| Revert changes | yes | no | no |
|
|
221
|
+
| File operations | yes | via prompt | via prompt |
|
|
222
|
+
| History | yes | yes | no |
|
|
223
|
+
| Shell commands | native | via prompt | via prompt |
|
|
224
|
+
| Custom commands | yes | no | no |
|
|
225
|
+
| Session sharing | yes | no | no |
|
|
226
|
+
| State persistence | via config | yes | yes |
|
|
227
|
+
|
|
228
|
+
## Switching Providers
|
|
229
|
+
|
|
230
|
+
To switch providers, update the `PROVIDER` variable in `.env` and restart the bot:
|
|
231
|
+
|
|
232
|
+
```env
|
|
233
|
+
PROVIDER=claude # or opencode, codex
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Sessions are provider-specific and not shared between providers. Switching providers starts fresh.
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
Common issues and solutions when running Relay.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Bot won't start
|
|
8
|
+
|
|
9
|
+
### "BOT_TOKEN is required"
|
|
10
|
+
|
|
11
|
+
You haven't set the Telegram bot token. Add it to your `.env` file:
|
|
12
|
+
|
|
13
|
+
```env
|
|
14
|
+
BOT_TOKEN=123456:ABC-DEF...
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Get a token from [@BotFather](https://t.me/BotFather) on Telegram.
|
|
18
|
+
|
|
19
|
+
### "Unknown provider: xyz"
|
|
20
|
+
|
|
21
|
+
The `PROVIDER` value in `.env` is not one of `opencode`, `claude`, or `codex`. Check for typos:
|
|
22
|
+
|
|
23
|
+
```env
|
|
24
|
+
PROVIDER=opencode
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### "Cannot find package '@anthropic-ai/claude-code'"
|
|
28
|
+
|
|
29
|
+
The Claude Code SDK is not installed. Install it:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install @anthropic-ai/claude-code
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### "Cannot find package '@openai/codex'"
|
|
36
|
+
|
|
37
|
+
The Codex SDK is not installed. Install it:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install @openai/codex
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Authentication
|
|
46
|
+
|
|
47
|
+
### Bot doesn't respond to messages
|
|
48
|
+
|
|
49
|
+
Relay only responds to authorized users. Check your `ALLOWED_USER_ID`:
|
|
50
|
+
|
|
51
|
+
```env
|
|
52
|
+
ALLOWED_USER_ID=123456789
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
To find your Telegram user ID, send a message to [@userinfobot](https://t.me/userinfobot).
|
|
56
|
+
|
|
57
|
+
### Multiple users
|
|
58
|
+
|
|
59
|
+
Separate multiple user IDs with commas:
|
|
60
|
+
|
|
61
|
+
```env
|
|
62
|
+
ALLOWED_USER_ID=123456789,987654321
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## OpenCode Issues
|
|
68
|
+
|
|
69
|
+
### "Connection refused" when using connect mode
|
|
70
|
+
|
|
71
|
+
The OpenCode server isn't running or isn't reachable at the configured URL:
|
|
72
|
+
|
|
73
|
+
1. Check that the OpenCode server is running
|
|
74
|
+
2. Verify the URL in your `.env`:
|
|
75
|
+
```env
|
|
76
|
+
OPENCODE_URL=http://localhost:4096
|
|
77
|
+
```
|
|
78
|
+
3. If the server is on a different machine, ensure the port is open and the host is correct
|
|
79
|
+
|
|
80
|
+
### "Failed to start OpenCode server" in start mode
|
|
81
|
+
|
|
82
|
+
Relay couldn't spawn the OpenCode server. Check:
|
|
83
|
+
|
|
84
|
+
1. OpenCode is installed and in your PATH
|
|
85
|
+
2. The port isn't already in use:
|
|
86
|
+
```bash
|
|
87
|
+
lsof -i :4096
|
|
88
|
+
```
|
|
89
|
+
3. Check the configured host and port:
|
|
90
|
+
```env
|
|
91
|
+
OPENCODE_HOSTNAME=127.0.0.1
|
|
92
|
+
OPENCODE_PORT=4096
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### HTTP warning for remote OpenCode
|
|
96
|
+
|
|
97
|
+
If you see a warning about connecting over HTTP, it means your `OPENCODE_URL` uses `http://` instead of `https://`. This is fine for local development but use HTTPS for production:
|
|
98
|
+
|
|
99
|
+
```env
|
|
100
|
+
OPENCODE_URL=https://your-server.example.com:4096
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Claude Code Issues
|
|
106
|
+
|
|
107
|
+
### "Invalid API key"
|
|
108
|
+
|
|
109
|
+
Your Anthropic API key is invalid or expired:
|
|
110
|
+
|
|
111
|
+
1. Check the key in `.env`:
|
|
112
|
+
```env
|
|
113
|
+
ANTHROPIC_API_KEY=sk-ant-api03-...
|
|
114
|
+
```
|
|
115
|
+
2. Verify the key at [console.anthropic.com](https://console.anthropic.com/)
|
|
116
|
+
3. Ensure the key has Claude Code API access
|
|
117
|
+
|
|
118
|
+
### Claude doesn't modify files
|
|
119
|
+
|
|
120
|
+
Claude Code requires the `acceptEdits` permission mode to automatically accept file operations in a bot context:
|
|
121
|
+
|
|
122
|
+
```env
|
|
123
|
+
CLAUDE_PERMISSION_MODE=acceptEdits
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Without this, Claude may prompt for interactive approval, which doesn't work in a Telegram bot.
|
|
127
|
+
|
|
128
|
+
### Wrong working directory
|
|
129
|
+
|
|
130
|
+
Claude operates in the directory specified by `CLAUDE_CWD`. If files aren't found, check the path:
|
|
131
|
+
|
|
132
|
+
```env
|
|
133
|
+
CLAUDE_CWD=/path/to/your/project
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
Defaults to the directory where Relay is running.
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Codex Issues
|
|
141
|
+
|
|
142
|
+
### "Invalid API key"
|
|
143
|
+
|
|
144
|
+
Check your OpenAI API key:
|
|
145
|
+
|
|
146
|
+
```env
|
|
147
|
+
CODEX_API_KEY=sk-...
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
You can use either `CODEX_API_KEY` or `OPENAI_API_KEY`. If both are set, `CODEX_API_KEY` takes priority.
|
|
151
|
+
|
|
152
|
+
### Wrong working directory
|
|
153
|
+
|
|
154
|
+
Set the project directory:
|
|
155
|
+
|
|
156
|
+
```env
|
|
157
|
+
CODEX_CWD=/path/to/your/project
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Voice Messages
|
|
163
|
+
|
|
164
|
+
### "No STT provider available"
|
|
165
|
+
|
|
166
|
+
No speech-to-text provider is configured. Add at least one API key:
|
|
167
|
+
|
|
168
|
+
```env
|
|
169
|
+
GROQ_API_KEY=gsk_... # Recommended (fastest, free tier)
|
|
170
|
+
OPENAI_API_KEY=sk-... # Alternative
|
|
171
|
+
ASSEMBLYAI_API_KEY=... # Alternative
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Voice transcription is inaccurate
|
|
175
|
+
|
|
176
|
+
- Speak clearly and minimize background noise
|
|
177
|
+
- Try a different STT provider — Groq and OpenAI Whisper generally produce good results
|
|
178
|
+
- Very short voice messages (under 1 second) may not transcribe well
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## MCP Servers
|
|
183
|
+
|
|
184
|
+
### "MCP not supported" error
|
|
185
|
+
|
|
186
|
+
MCP is only available with OpenCode and Claude providers. Codex does not support MCP.
|
|
187
|
+
|
|
188
|
+
### MCP server shows "failed" status
|
|
189
|
+
|
|
190
|
+
Run `/mcp` to check the error message. Common causes:
|
|
191
|
+
|
|
192
|
+
1. **Command not found**: The MCP server command isn't installed
|
|
193
|
+
```bash
|
|
194
|
+
# Install the server package first
|
|
195
|
+
npx -y @modelcontextprotocol/server-memory
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
2. **Connection refused** (remote servers): The URL is wrong or the server is down
|
|
199
|
+
|
|
200
|
+
3. **Permission denied**: The command doesn't have execute permissions
|
|
201
|
+
|
|
202
|
+
### MCP servers disappear after restart (Claude)
|
|
203
|
+
|
|
204
|
+
Claude stores MCP configs in memory. They're passed to every query but lost when the bot restarts. Re-add them after restart:
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
/mcp add memory local npx -y @modelcontextprotocol/server-memory
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
OpenCode servers persist across restarts since they're saved in the OpenCode configuration.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Streaming
|
|
215
|
+
|
|
216
|
+
### Messages appear jumpy or laggy
|
|
217
|
+
|
|
218
|
+
Telegram rate limits message edits. Relay batches updates to avoid hitting limits, but on slow connections you may notice slight delays. This is normal behavior.
|
|
219
|
+
|
|
220
|
+
### "Message is not modified" warnings in logs
|
|
221
|
+
|
|
222
|
+
This happens when a stream update has the same content as the current message. It's harmless and can be ignored.
|
|
223
|
+
|
|
224
|
+
### Very long responses get cut off
|
|
225
|
+
|
|
226
|
+
Telegram messages have a 4096-character limit. Relay automatically splits long responses into multiple messages. If a response seems incomplete, it may still be generating — wait for the stream to finish.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## Model Selection
|
|
231
|
+
|
|
232
|
+
### "/model sonnet" doesn't work
|
|
233
|
+
|
|
234
|
+
Partial model matching searches through available models. If the match is ambiguous, try a more specific name:
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
/model anthropic/claude-sonnet-4-20250514
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
Use `/models` to see all available model IDs.
|
|
241
|
+
|
|
242
|
+
### No models listed
|
|
243
|
+
|
|
244
|
+
- **OpenCode**: Check that your OpenCode config has providers and models configured
|
|
245
|
+
- **Claude/Codex**: Models are a static list and should always appear
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## System Prompt
|
|
250
|
+
|
|
251
|
+
### Changes to skill.md aren't picked up
|
|
252
|
+
|
|
253
|
+
The file watcher should detect changes automatically. If it doesn't:
|
|
254
|
+
|
|
255
|
+
1. Use `/system reload` to force a reload
|
|
256
|
+
2. Check that the file path is correct:
|
|
257
|
+
```env
|
|
258
|
+
SYSTEM_PROMPT_FILE=skill.md
|
|
259
|
+
```
|
|
260
|
+
3. Verify the file exists and is readable
|
|
261
|
+
|
|
262
|
+
### "/system" shows "default prompt"
|
|
263
|
+
|
|
264
|
+
No custom prompt file was found. Create `skill.md` in the project root or set `SYSTEM_PROMPT_FILE` to your prompt file path.
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## General
|
|
269
|
+
|
|
270
|
+
### Bot is slow to respond
|
|
271
|
+
|
|
272
|
+
- Check your internet connection
|
|
273
|
+
- The AI provider may be experiencing high load
|
|
274
|
+
- Larger models (opus, o3) are slower than smaller ones (haiku, o4-mini)
|
|
275
|
+
- If using OpenCode in connect mode, check the server's health
|
|
276
|
+
|
|
277
|
+
### "Operation timed out"
|
|
278
|
+
|
|
279
|
+
The AI took too long to respond. This can happen with complex requests. Try:
|
|
280
|
+
|
|
281
|
+
- Simplifying your request
|
|
282
|
+
- Using a faster model (`/model haiku` or `/model o4-mini`)
|
|
283
|
+
- Breaking the task into smaller steps
|
|
284
|
+
|
|
285
|
+
### Telegram message formatting looks wrong
|
|
286
|
+
|
|
287
|
+
Relay sends messages in HTML format. If you see raw HTML tags, there may be an escaping issue. Report it as a bug.
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@4via6/relay",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Telegram bot for AI coding agents — supports OpenCode, Claude Code, and OpenAI Codex",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"relay": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"docs",
|
|
13
|
+
".env.example",
|
|
14
|
+
"README.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"start": "node dist/cli.js",
|
|
20
|
+
"dev": "tsc --watch & node --watch dist/cli.js",
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"telegram",
|
|
25
|
+
"bot",
|
|
26
|
+
"ai",
|
|
27
|
+
"coding-agent",
|
|
28
|
+
"opencode",
|
|
29
|
+
"claude",
|
|
30
|
+
"codex",
|
|
31
|
+
"mcp",
|
|
32
|
+
"cli"
|
|
33
|
+
],
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "https://github.com/Harsh-2002/Relay"
|
|
37
|
+
},
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18.0.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@opencode-ai/sdk": "^1.2.15",
|
|
44
|
+
"grammy": "^1.40.1"
|
|
45
|
+
},
|
|
46
|
+
"optionalDependencies": {
|
|
47
|
+
"@anthropic-ai/claude-code": "^0.2.62",
|
|
48
|
+
"@openai/codex": "^0.1.0"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/node": "^25.3.2",
|
|
52
|
+
"typescript": "^5.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|