@4via6/relay 1.0.0 → 1.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 +89 -47
- package/dist/auth.d.ts +1 -0
- package/dist/auth.js +6 -3
- package/dist/auth.js.map +1 -1
- package/dist/bot.js +2 -1
- package/dist/bot.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +110 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/admin.js +134 -29
- package/dist/commands/admin.js.map +1 -1
- package/dist/commands/media.js +10 -7
- package/dist/commands/media.js.map +1 -1
- package/dist/config/index.d.ts +7 -0
- package/dist/config/index.js +16 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/loader.js +235 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +32 -0
- package/dist/config/schema.js +32 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/setup.d.ts +3 -0
- package/dist/config/setup.js +142 -0
- package/dist/config/setup.js.map +1 -0
- package/dist/daemon.d.ts +5 -0
- package/dist/daemon.js +215 -0
- package/dist/daemon.js.map +1 -0
- package/dist/index.js +23 -25
- package/dist/index.js.map +1 -1
- package/dist/providers/claude.js +31 -30
- package/dist/providers/claude.js.map +1 -1
- package/dist/providers/codex.js +29 -28
- package/dist/providers/codex.js.map +1 -1
- package/dist/providers/index.js +2 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/opencode.js +8 -5
- package/dist/providers/opencode.js.map +1 -1
- package/dist/session.js +3 -2
- package/dist/session.js.map +1 -1
- package/dist/update.d.ts +1 -0
- package/dist/update.js +132 -0
- package/dist/update.js.map +1 -0
- package/dist/utils/files.js +2 -1
- package/dist/utils/files.js.map +1 -1
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.js +16 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/store.js +1 -0
- package/dist/utils/store.js.map +1 -1
- package/dist/utils/stream.js +6 -3
- package/dist/utils/stream.js.map +1 -1
- package/dist/utils/stt.js +27 -16
- package/dist/utils/stt.js.map +1 -1
- package/dist/utils/system-prompt.js +16 -5
- package/dist/utils/system-prompt.js.map +1 -1
- package/dist/utils/timeout.js +2 -3
- package/dist/utils/timeout.js.map +1 -1
- package/docs/commands.md +7 -15
- package/docs/configuration.md +124 -108
- package/docs/features.md +70 -36
- package/docs/getting-started.md +63 -30
- package/docs/providers.md +18 -32
- package/docs/troubleshooting.md +108 -63
- package/package.json +4 -3
- package/.env.example +0 -50
package/docs/troubleshooting.md
CHANGED
|
@@ -6,22 +6,24 @@ Common issues and solutions when running Relay.
|
|
|
6
6
|
|
|
7
7
|
## Bot won't start
|
|
8
8
|
|
|
9
|
-
### "
|
|
9
|
+
### "No config found" / setup wizard starts automatically
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
No configuration file exists. Run the interactive setup wizard:
|
|
12
12
|
|
|
13
|
-
```
|
|
14
|
-
|
|
13
|
+
```bash
|
|
14
|
+
relay onboard
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
This creates `.relay/config.json` with your bot token, user ID, and provider settings.
|
|
18
18
|
|
|
19
19
|
### "Unknown provider: xyz"
|
|
20
20
|
|
|
21
|
-
The `
|
|
21
|
+
The `provider` value in your config is not one of `opencode`, `claude`, or `codex`. Run `relay onboard` to reconfigure, or check `.relay/config.json`:
|
|
22
22
|
|
|
23
|
-
```
|
|
24
|
-
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"provider": "opencode"
|
|
26
|
+
}
|
|
25
27
|
```
|
|
26
28
|
|
|
27
29
|
### "Cannot find package '@anthropic-ai/claude-code'"
|
|
@@ -46,22 +48,16 @@ npm install @openai/codex
|
|
|
46
48
|
|
|
47
49
|
### Bot doesn't respond to messages
|
|
48
50
|
|
|
49
|
-
Relay only responds to authorized users. Check
|
|
51
|
+
Relay only responds to authorized users. Check `allowedUserId` in `.relay/config.json`:
|
|
50
52
|
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"allowedUserId": 123456789
|
|
56
|
+
}
|
|
53
57
|
```
|
|
54
58
|
|
|
55
59
|
To find your Telegram user ID, send a message to [@userinfobot](https://t.me/userinfobot).
|
|
56
60
|
|
|
57
|
-
### Multiple users
|
|
58
|
-
|
|
59
|
-
Separate multiple user IDs with commas:
|
|
60
|
-
|
|
61
|
-
```env
|
|
62
|
-
ALLOWED_USER_ID=123456789,987654321
|
|
63
|
-
```
|
|
64
|
-
|
|
65
61
|
---
|
|
66
62
|
|
|
67
63
|
## OpenCode Issues
|
|
@@ -71,9 +67,12 @@ ALLOWED_USER_ID=123456789,987654321
|
|
|
71
67
|
The OpenCode server isn't running or isn't reachable at the configured URL:
|
|
72
68
|
|
|
73
69
|
1. Check that the OpenCode server is running
|
|
74
|
-
2. Verify the URL in
|
|
75
|
-
```
|
|
76
|
-
|
|
70
|
+
2. Verify the URL in `.relay/config.json`:
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"opencodeMode": "connect",
|
|
74
|
+
"opencodeUrl": "http://localhost:4096"
|
|
75
|
+
}
|
|
77
76
|
```
|
|
78
77
|
3. If the server is on a different machine, ensure the port is open and the host is correct
|
|
79
78
|
|
|
@@ -86,18 +85,22 @@ Relay couldn't spawn the OpenCode server. Check:
|
|
|
86
85
|
```bash
|
|
87
86
|
lsof -i :4096
|
|
88
87
|
```
|
|
89
|
-
3. Check the configured host and port
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
|
|
88
|
+
3. Check the configured host and port in `.relay/config.json`:
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"opencodeHostname": "127.0.0.1",
|
|
92
|
+
"opencodePort": 4096
|
|
93
|
+
}
|
|
93
94
|
```
|
|
94
95
|
|
|
95
96
|
### HTTP warning for remote OpenCode
|
|
96
97
|
|
|
97
|
-
If you see a warning about connecting over HTTP, it means your `
|
|
98
|
+
If you see a warning about connecting over HTTP, it means your `opencodeUrl` uses `http://` instead of `https://`. This is fine for local development but use HTTPS for production:
|
|
98
99
|
|
|
99
|
-
```
|
|
100
|
-
|
|
100
|
+
```json
|
|
101
|
+
{
|
|
102
|
+
"opencodeUrl": "https://your-server.example.com:4096"
|
|
103
|
+
}
|
|
101
104
|
```
|
|
102
105
|
|
|
103
106
|
---
|
|
@@ -106,31 +109,31 @@ OPENCODE_URL=https://your-server.example.com:4096
|
|
|
106
109
|
|
|
107
110
|
### "Invalid API key"
|
|
108
111
|
|
|
109
|
-
Your Anthropic API key is invalid or expired
|
|
112
|
+
Your Anthropic API key is invalid or expired. The `ANTHROPIC_API_KEY` environment variable must be set in the environment where Claude Code runs — this is configured in your coding agent's environment, not in Relay.
|
|
110
113
|
|
|
111
|
-
1.
|
|
112
|
-
|
|
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
|
|
114
|
+
1. Verify the key at [console.anthropic.com](https://console.anthropic.com/)
|
|
115
|
+
2. Ensure the key has Claude Code API access
|
|
117
116
|
|
|
118
117
|
### Claude doesn't modify files
|
|
119
118
|
|
|
120
|
-
Claude Code requires the `acceptEdits` permission mode to automatically accept file operations in a bot context
|
|
119
|
+
Claude Code requires the `acceptEdits` permission mode to automatically accept file operations in a bot context. Set it in `.relay/config.json`:
|
|
121
120
|
|
|
122
|
-
```
|
|
123
|
-
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"claudePermissionMode": "acceptEdits"
|
|
124
|
+
}
|
|
124
125
|
```
|
|
125
126
|
|
|
126
127
|
Without this, Claude may prompt for interactive approval, which doesn't work in a Telegram bot.
|
|
127
128
|
|
|
128
129
|
### Wrong working directory
|
|
129
130
|
|
|
130
|
-
Claude operates in the directory specified by `
|
|
131
|
+
Claude operates in the directory specified by `claudeCwd`. If files aren't found, check the path in `.relay/config.json`:
|
|
131
132
|
|
|
132
|
-
```
|
|
133
|
-
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"claudeCwd": "/path/to/your/project"
|
|
136
|
+
}
|
|
134
137
|
```
|
|
135
138
|
|
|
136
139
|
Defaults to the directory where Relay is running.
|
|
@@ -141,20 +144,16 @@ Defaults to the directory where Relay is running.
|
|
|
141
144
|
|
|
142
145
|
### "Invalid API key"
|
|
143
146
|
|
|
144
|
-
|
|
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.
|
|
147
|
+
Your OpenAI API key must be set in the environment where Codex runs — this is configured in your coding agent's environment, not in Relay. Set `CODEX_API_KEY` or `OPENAI_API_KEY` in your environment.
|
|
151
148
|
|
|
152
149
|
### Wrong working directory
|
|
153
150
|
|
|
154
|
-
Set the project directory
|
|
151
|
+
Set the project directory in `.relay/config.json`:
|
|
155
152
|
|
|
156
|
-
```
|
|
157
|
-
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"codexCwd": "/path/to/your/project"
|
|
156
|
+
}
|
|
158
157
|
```
|
|
159
158
|
|
|
160
159
|
---
|
|
@@ -163,14 +162,18 @@ CODEX_CWD=/path/to/your/project
|
|
|
163
162
|
|
|
164
163
|
### "No STT provider available"
|
|
165
164
|
|
|
166
|
-
No speech-to-text provider is configured.
|
|
165
|
+
No speech-to-text provider is configured. Run `relay onboard` and enable voice transcription, or add API keys to `.relay/config.json`:
|
|
167
166
|
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"groqApiKey": "gsk_...",
|
|
170
|
+
"openaiSttApiKey": "sk-...",
|
|
171
|
+
"assemblyaiApiKey": "..."
|
|
172
|
+
}
|
|
172
173
|
```
|
|
173
174
|
|
|
175
|
+
At least one key is required. Groq is recommended (fastest, has a free tier).
|
|
176
|
+
|
|
174
177
|
### Voice transcription is inaccurate
|
|
175
178
|
|
|
176
179
|
- Speak clearly and minimize background noise
|
|
@@ -242,26 +245,68 @@ Use `/models` to see all available model IDs.
|
|
|
242
245
|
### No models listed
|
|
243
246
|
|
|
244
247
|
- **OpenCode**: Check that your OpenCode config has providers and models configured
|
|
245
|
-
- **Claude
|
|
248
|
+
- **Claude**: Ensure `ANTHROPIC_API_KEY` is set in the environment — models are fetched dynamically from the API
|
|
249
|
+
- **Codex**: Ensure `CODEX_API_KEY` or `OPENAI_API_KEY` is set in the environment — models are fetched dynamically from the API
|
|
246
250
|
|
|
247
251
|
---
|
|
248
252
|
|
|
249
253
|
## System Prompt
|
|
250
254
|
|
|
251
|
-
### Changes to
|
|
255
|
+
### Changes to SKILL.md aren't picked up
|
|
252
256
|
|
|
253
257
|
The file watcher should detect changes automatically. If it doesn't:
|
|
254
258
|
|
|
255
259
|
1. Use `/system reload` to force a reload
|
|
256
|
-
2. Check that the file path is correct
|
|
257
|
-
```
|
|
258
|
-
|
|
260
|
+
2. Check that the file path is correct in `.relay/config.json`:
|
|
261
|
+
```json
|
|
262
|
+
{
|
|
263
|
+
"systemPromptFile": "path/to/SKILL.md"
|
|
264
|
+
}
|
|
259
265
|
```
|
|
260
266
|
3. Verify the file exists and is readable
|
|
261
267
|
|
|
262
268
|
### "/system" shows "default prompt"
|
|
263
269
|
|
|
264
|
-
No custom prompt file was found. Create
|
|
270
|
+
No custom prompt file was found. Create `.relay/SKILL.md` or set `systemPromptFile` in your config to point to your prompt file.
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Daemon Mode
|
|
275
|
+
|
|
276
|
+
### pm2 fails to install
|
|
277
|
+
|
|
278
|
+
If `relay start` can't install pm2 automatically, install it manually:
|
|
279
|
+
|
|
280
|
+
```bash
|
|
281
|
+
sudo npm install -g pm2
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
On some systems you may need to fix npm's global prefix permissions instead of using `sudo`. See the [npm docs](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally) for details.
|
|
285
|
+
|
|
286
|
+
### Daemon won't start
|
|
287
|
+
|
|
288
|
+
1. Make sure the project is built: `npm run build`
|
|
289
|
+
2. Check if another instance is already running: `relay status`
|
|
290
|
+
3. Check logs for errors: `relay logs`
|
|
291
|
+
|
|
292
|
+
### "Relay daemon is not running" but the bot was started
|
|
293
|
+
|
|
294
|
+
The bot may be running in foreground mode (plain `relay`), not as a daemon. Daemon commands only manage the background pm2 process. Stop the foreground process and use `relay start` instead.
|
|
295
|
+
|
|
296
|
+
### Where are daemon logs?
|
|
297
|
+
|
|
298
|
+
pm2 stores logs in `~/.pm2/logs/`. You can view them with:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
relay logs # Tail recent output
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
Or access the raw files directly:
|
|
305
|
+
|
|
306
|
+
```
|
|
307
|
+
~/.pm2/logs/relay-out.log # stdout
|
|
308
|
+
~/.pm2/logs/relay-error.log # stderr
|
|
309
|
+
```
|
|
265
310
|
|
|
266
311
|
---
|
|
267
312
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@4via6/relay",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Telegram bot for AI coding agents — supports OpenCode, Claude Code, and OpenAI Codex",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
12
|
"docs",
|
|
13
|
-
".env.example",
|
|
14
13
|
"README.md",
|
|
15
14
|
"LICENSE"
|
|
16
15
|
],
|
|
@@ -40,8 +39,10 @@
|
|
|
40
39
|
"node": ">=18.0.0"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
42
|
+
"@inquirer/prompts": "^8.3.0",
|
|
43
43
|
"@opencode-ai/sdk": "^1.2.15",
|
|
44
|
-
"grammy": "^1.40.1"
|
|
44
|
+
"grammy": "^1.40.1",
|
|
45
|
+
"pino": "^10.3.1"
|
|
45
46
|
},
|
|
46
47
|
"optionalDependencies": {
|
|
47
48
|
"@anthropic-ai/claude-code": "^0.2.62",
|
package/.env.example
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
# Telegram
|
|
2
|
-
BOT_TOKEN=your-telegram-bot-token
|
|
3
|
-
ALLOWED_USER_ID=your-telegram-user-id
|
|
4
|
-
|
|
5
|
-
# Provider selection: "opencode" | "claude" | "codex"
|
|
6
|
-
PROVIDER=opencode
|
|
7
|
-
|
|
8
|
-
# --- OpenCode provider ---
|
|
9
|
-
OPENCODE_MODE=start # "start" (spawn server) or "connect" (remote URL)
|
|
10
|
-
OPENCODE_URL=http://localhost:4096 # used when MODE=connect
|
|
11
|
-
OPENCODE_HOSTNAME=127.0.0.1 # used when MODE=start
|
|
12
|
-
OPENCODE_PORT=4096 # used when MODE=start
|
|
13
|
-
OPENCODE_MODEL= # e.g. "anthropic/claude-sonnet-4-20250514"
|
|
14
|
-
|
|
15
|
-
# --- Claude Code provider ---
|
|
16
|
-
# ANTHROPIC_API_KEY=sk-ant-... # required for PROVIDER=claude
|
|
17
|
-
# CLAUDE_MODEL=sonnet # "sonnet" | "opus" | "haiku"
|
|
18
|
-
# CLAUDE_PERMISSION_MODE=acceptEdits # Claude permission mode
|
|
19
|
-
# CLAUDE_CWD= # working directory (default: process.cwd())
|
|
20
|
-
|
|
21
|
-
# --- Codex provider ---
|
|
22
|
-
# CODEX_API_KEY=sk-... # required for PROVIDER=codex (or use OPENAI_API_KEY)
|
|
23
|
-
# CODEX_MODEL=o3 # "o3" | "o4-mini" etc.
|
|
24
|
-
# CODEX_CWD= # working directory (default: process.cwd())
|
|
25
|
-
|
|
26
|
-
# Bot mode: "polling" (default) or "webhook"
|
|
27
|
-
BOT_MODE=polling
|
|
28
|
-
# WEBHOOK_URL=https://example.com/bot # required when BOT_MODE=webhook
|
|
29
|
-
# WEBHOOK_PORT=3000 # HTTP server port (default: 3000)
|
|
30
|
-
# WEBHOOK_SECRET=your-secret-token # optional secret for webhook verification
|
|
31
|
-
|
|
32
|
-
# Data directory for persisted state (default: .relay/ in project root)
|
|
33
|
-
# RELAY_DATA_DIR=.relay
|
|
34
|
-
|
|
35
|
-
# Streaming (progressive message editing — supported by all providers)
|
|
36
|
-
STREAMING_ENABLED=false
|
|
37
|
-
STREAM_EDIT_INTERVAL_MS=2000
|
|
38
|
-
|
|
39
|
-
# Prompt timeout (milliseconds) — max time to wait for a provider response
|
|
40
|
-
PROMPT_TIMEOUT_MS=300000 # 5 minutes
|
|
41
|
-
|
|
42
|
-
# System prompt — loaded from file and prepended to every message
|
|
43
|
-
# Default built-in prompt is used if no file exists
|
|
44
|
-
# SYSTEM_PROMPT_FILE=skill.md # default: looks for skill.md in project root
|
|
45
|
-
|
|
46
|
-
# Voice STT — set one or more; cheapest available is auto-selected
|
|
47
|
-
# STT_PROVIDER=auto # "openai" | "groq" | "assemblyai" | "auto" (default)
|
|
48
|
-
GROQ_API_KEY=
|
|
49
|
-
OPENAI_API_KEY=
|
|
50
|
-
ASSEMBLYAI_API_KEY=
|