Skip to content

Commit 6fa041f

Browse files
committed
mirror aicodebox env var rename + add PIBOX_MCP_MODE
aicodebox v0.2.0 normalized every mode env var to <MODE>_MODE / <MODE>_MODE_<KNOB>. The pibox alias map and README follow: PIBOX_MODE_API → PIBOX_API_MODE PIBOX_MODE_API_PORT → PIBOX_API_MODE_PORT PIBOX_MODE_API_TOKEN → PIBOX_API_MODE_TOKEN PIBOX_MODE_TELEGRAM → PIBOX_TELEGRAM_MODE PIBOX_TELEGRAM_BOT_TOKEN → PIBOX_TELEGRAM_MODE_TOKEN PIBOX_TELEGRAM_CONFIG → PIBOX_TELEGRAM_MODE_CONFIG PIBOX_TELEGRAM_OVERRIDES → PIBOX_TELEGRAM_MODE_OVERRIDES PIBOX_MODE_CRON → PIBOX_CRON_MODE PIBOX_MODE_CRON_FILE → PIBOX_CRON_MODE_FILE PIBOX_CRON_HISTORY_DIR → PIBOX_CRON_MODE_HISTORY_DIR MCP is now its own toggle (PIBOX_MCP_MODE=1) on top of the foreground mode. In API mode it stays mounted at /mcp (gated on MCP_MODE=1 now, not always-on); in telegram/cron/passthrough it spawns as a sidecar uvicorn on PIBOX_MCP_MODE_PORT (default 8081). Auth via PIBOX_MCP_MODE_TOKEN — own bearer, no fallback to API_MODE_TOKEN. E2E tests updated to the new AICODEBOX_* names they pass to docker run, and the API test fixture now enables MCP_MODE + shares the API bearer with MCP so the existing /mcp handshake + auth assertions stay valid. .env.test.example bumps AICODEBOX_TELEGRAM_BOT_TOKEN to AICODEBOX_TELEGRAM_MODE_TOKEN. README rewritten around the new shape with explicit MCP mode + coexistence sections.
1 parent 405e2a7 commit 6fa041f

9 files changed

Lines changed: 97 additions & 58 deletions

.env.test.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ANTHROPIC_API_KEY=your-token-here
1111

1212
# Telegram e2e tests (test_telegram.sh, test_cron_telegram.sh, test_e2e_telegram.sh).
1313
# Leave blank to skip those tests.
14-
AICODEBOX_TELEGRAM_BOT_TOKEN=
14+
AICODEBOX_TELEGRAM_MODE_TOKEN=
1515
TELEGRAM_CHAT_ID=
1616

1717
# Telethon userbot — drives the user side of the Telegram e2e tests.

README.md

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ docker run --rm \
3333

3434
# API server
3535
docker run -d --network host \
36-
-e PIBOX_MODE_API=1 \
37-
-e PIBOX_MODE_API_TOKEN=your-secret \
36+
-e PIBOX_API_MODE=1 \
37+
-e PIBOX_API_MODE_TOKEN=your-secret \
3838
-e ANTHROPIC_AUTH_TOKEN=your-token \
3939
-e ANTHROPIC_BASE_URL=https://api.z.ai/api/anthropic \
4040
-e ANTHROPIC_MODEL=glm-4.6 \
@@ -44,11 +44,13 @@ docker run -d --network host \
4444

4545
## Modes
4646

47-
One mode per container, with one exception: `PIBOX_MODE_TELEGRAM=1` and `PIBOX_MODE_CRON=1` can run together — cron runs in-thread inside the telegram process. API mode always takes priority if set alongside anything else.
47+
**Foreground modes** (API / Telegram / Cron) are mutually exclusive — except `PIBOX_TELEGRAM_MODE=1` + `PIBOX_CRON_MODE=1`, which run together (cron in-thread inside telegram). API wins if set alongside anything else.
48+
49+
**MCP mode** (`PIBOX_MCP_MODE=1`) is independent — it coexists with whatever foreground mode is running. In API mode it's mounted at `/mcp` on the API port; in other modes it runs as a sidecar uvicorn on its own port.
4850

4951
### API mode
5052

51-
`PIBOX_MODE_API=1`. FastAPI server on `:8080` (override with `PIBOX_MODE_API_PORT`).
53+
`PIBOX_API_MODE=1`. FastAPI server on `:8080` (override with `PIBOX_API_MODE_PORT`).
5254

5355
| Method | Path | What it does |
5456
|--------|------|--------------|
@@ -64,7 +66,7 @@ One mode per container, with one exception: `PIBOX_MODE_TELEGRAM=1` and `PIBOX_M
6466
| `DELETE` | `/files/{path}` | delete a file (refuses directories — 400) |
6567
| `POST` | `/v1/chat/completions` | OpenAI-compatible (streaming + non-streaming) |
6668
| `GET` | `/v1/models` | model list |
67-
| `POST` | `/mcp` | MCP server (streamable HTTP) |
69+
| `POST` | `/mcp` | MCP server (streamable HTTP) — mounted only when `PIBOX_MCP_MODE=1` |
6870

6971
All `/files/*` paths are resolved against the workspace root with traversal checking — `..` segments that escape the root return 400. Same `Authorization: Bearer ...` token gates them as the rest of the API.
7072

@@ -99,15 +101,15 @@ curl -s http://localhost:8080/run \
99101

100102
### Telegram mode
101103

102-
`PIBOX_MODE_TELEGRAM=1` + `PIBOX_TELEGRAM_BOT_TOKEN=<token>`.
104+
`PIBOX_TELEGRAM_MODE=1` + `PIBOX_TELEGRAM_MODE_TOKEN=<token>`.
103105

104106
- Text in → pi runs → Markdown→HTML rendered response back.
105107
- File uploads land in the chat's workspace. `[SEND_FILE: path]` in pi's output delivers workspace files as Telegram attachments.
106108
- Per-chat overrides: `/model`, `/effort` (maps to pi's `--thinking` levels), `/system_prompt`, `/append_system_prompt`. Persisted across restarts.
107109
- `/cancel` kills the in-flight run. `/reload` re-reads config. `/config` dumps merged settings. `/fetch <path>` downloads a file.
108110
- Replies to cron messages inject the job's instruction + result so pi has full context for follow-ups.
109111

110-
Config at `$HOME/.aicodebox/telegram.yml` (override via `PIBOX_TELEGRAM_CONFIG`):
112+
Config at `$HOME/.aicodebox/telegram.yml` (override via `PIBOX_TELEGRAM_MODE_CONFIG`):
111113

112114
```yaml
113115
allowed_chats: [-100123, 42]
@@ -122,7 +124,7 @@ chats:
122124
123125
### Cron mode
124126
125-
`PIBOX_MODE_CRON=1` + `PIBOX_MODE_CRON_FILE=/path/to/cron.yaml`. 6-field schedules via croniter. Each job fires pi with the given instruction.
127+
`PIBOX_CRON_MODE=1` + `PIBOX_CRON_MODE_FILE=/path/to/cron.yaml`. 6-field schedules via croniter. Each job fires pi with the given instruction.
126128

127129
```yaml
128130
jobs:
@@ -139,28 +141,60 @@ jobs:
139141

140142
Each run gets a history dir at `$HOME/.aicodebox/cron/history/<workspace>/<timestamp>-<job>/` with `meta.json`, `stdout.log`, `stderr.log`, `result.txt`. If telegram is configured, `telegram.json` lands there too and the next run's prompt gets a "prior run" hint so pi can reference its own history without you wiring it up.
141143

144+
### MCP mode
145+
146+
`PIBOX_MCP_MODE=1`. Exposes the MCP (Model Context Protocol) surface — `run_prompt`, `list_files`, `read_file`, `write_file`, `delete_file` as tools. Coexists with any foreground mode:
147+
148+
| Foreground | MCP placement |
149+
|---|---|
150+
| API mode (`PIBOX_API_MODE=1`) | mounted at `/mcp` on the API port — no extra process |
151+
| Telegram / Cron / passthrough | sidecar uvicorn on `PIBOX_MCP_MODE_PORT` (default `8081`) |
152+
153+
Auth: `PIBOX_MCP_MODE_TOKEN=<token>` — bearer in the `Authorization: Bearer …` header, or `?apiToken=…` for clients that can't set headers. Empty = no auth. **No fallback to `API_MODE_TOKEN`** — MCP has its own bearer.
154+
142155
## Configuration
143156

144-
Every var below is `PIBOX_*`. The image is built on top of [aicodebox](https://github.com/psyb0t/docker-aicodebox), so the original `AICODEBOX_*` names also work — the entrypoint translates `PIBOX_X` to `AICODEBOX_X` when only the pibox-prefixed one is set. If you set both, `AICODEBOX_*` wins.
157+
Naming convention: `PIBOX_<MODE>_MODE=1` is the on/off flag, `PIBOX_<MODE>_MODE_<KNOB>=...` is its config. Non-mode-scoped vars (workspace, container name, available models) are bare.
158+
159+
The image is built on top of [aicodebox](https://github.com/psyb0t/docker-aicodebox), so the equivalent `AICODEBOX_*` names also work — the entrypoint translates `PIBOX_X` to `AICODEBOX_X` when only the pibox-prefixed one is set. If you set both, `AICODEBOX_*` wins.
160+
161+
### Mode flags
162+
163+
| Var | Default | What it does |
164+
|-----|---------|--------------|
165+
| `PIBOX_API_MODE` | `0` | Boot the HTTP API server (foreground) |
166+
| `PIBOX_TELEGRAM_MODE` | `0` | Boot the Telegram bot (foreground) |
167+
| `PIBOX_CRON_MODE` | `0` | Boot the cron scheduler (foreground; in-thread when telegram is also on) |
168+
| `PIBOX_MCP_MODE` | `0` | Expose MCP — mounted at `/mcp` in API mode, or as a sidecar elsewhere |
169+
170+
### API mode config
171+
172+
| Var | Default | What it does |
173+
|-----|---------|--------------|
174+
| `PIBOX_API_MODE_PORT` | `8080` | Port the API server binds to |
175+
| `PIBOX_API_MODE_TOKEN` | empty | Bearer token for the API surface. Empty = no auth |
176+
177+
### Telegram mode config
178+
179+
| Var | Default | What it does |
180+
|-----|---------|--------------|
181+
| `PIBOX_TELEGRAM_MODE_TOKEN` | — | Bot token from @BotFather |
182+
| `PIBOX_TELEGRAM_MODE_CONFIG` | `~/.aicodebox/telegram.yml` | Path to the telegram config yaml |
183+
| `PIBOX_TELEGRAM_MODE_OVERRIDES` | `~/.aicodebox/telegram_overrides.json` | Per-chat override store (model/effort/system prompts) |
145184

146-
### Modes
185+
### Cron mode config
147186

148187
| Var | Default | What it does |
149188
|-----|---------|--------------|
150-
| `PIBOX_MODE_API` | `0` | Boot the HTTP API server |
151-
| `PIBOX_MODE_API_PORT` | `8080` | Port the API server binds to |
152-
| `PIBOX_MODE_API_TOKEN` | empty | Bearer token required on every API + MCP request. Unset = no auth |
153-
| `PIBOX_MODE_TELEGRAM` | `0` | Boot the Telegram bot |
154-
| `PIBOX_MODE_CRON` | `0` | Boot the cron scheduler (also runs in-thread when telegram mode is on) |
155-
| `PIBOX_MODE_CRON_FILE` | — | Path to the cron yaml |
189+
| `PIBOX_CRON_MODE_FILE` | — | Path to the cron yaml |
190+
| `PIBOX_CRON_MODE_HISTORY_DIR` | `~/.aicodebox/cron/history` | Where cron writes per-run history dirs (`meta.json`, `stdout.log`, `stderr.log`, `result.txt`, `telegram.json`) |
156191

157-
### Telegram
192+
### MCP mode config
158193

159194
| Var | Default | What it does |
160195
|-----|---------|--------------|
161-
| `PIBOX_TELEGRAM_BOT_TOKEN` | — | Bot token from @BotFather |
162-
| `PIBOX_TELEGRAM_CONFIG` | `~/.aicodebox/telegram.yml` | Path to the telegram config yaml |
163-
| `PIBOX_TELEGRAM_OVERRIDES` | `~/.aicodebox/telegram-overrides.json` | Path to the per-chat override store (model/effort/system prompts) |
196+
| `PIBOX_MCP_MODE_PORT` | `8081` | Port the sidecar MCP server binds to (ignored when mounted inside API) |
197+
| `PIBOX_MCP_MODE_TOKEN` | empty | Bearer token for MCP. Empty = no auth. **No fallback to `API_MODE_TOKEN`** |
164198

165199
### Workspace & runtime
166200

@@ -170,7 +204,6 @@ Every var below is `PIBOX_*`. The image is built on top of [aicodebox](https://g
170204
| `PIBOX_CONTAINER_NAME` | `aicodebox` | Used to scope per-container state files (auth, etc.) |
171205
| `PIBOX_AVAILABLE_MODELS` | adapter list | Override the model list returned by `/v1/models` and the telegram `/model` picker (comma-separated) |
172206
| `PIBOX_AVAILABLE_EFFORTS` | adapter list | Override the effort/`--thinking` list shown by the telegram `/effort` picker (comma-separated) |
173-
| `PIBOX_CRON_HISTORY_DIR` | `~/.aicodebox/cron/history` | Where cron writes per-run history dirs (`meta.json`, `stdout.log`, `stderr.log`, `result.txt`, `telegram.json`) |
174207

175208
## Auth
176209

@@ -209,7 +242,7 @@ $EDITOR .env.test # fill in ANTHROPIC_* and optionally Telegram creds
209242
make test
210243
```
211244

212-
Telegram tests auto-skip if `PIBOX_TELEGRAM_BOT_TOKEN` is empty. Everything else only needs `ANTHROPIC_AUTH_TOKEN` + `ANTHROPIC_BASE_URL`.
245+
Telegram tests auto-skip if `AICODEBOX_TELEGRAM_MODE_TOKEN` is empty. Everything else only needs `ANTHROPIC_AUTH_TOKEN` + `ANTHROPIC_BASE_URL`.
213246

214247
## License
215248

pibox-entrypoint.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ set -e
1010
# PIBOX_X is set, copy the value across. Internal vars (ADAPTER, AGENT_BINARY)
1111
# are NOT exposed — the pibox Dockerfile pins those.
1212
_PIBOX_ALIASES=(
13-
MODE_API
14-
MODE_API_PORT
15-
MODE_API_TOKEN
16-
MODE_TELEGRAM
17-
MODE_CRON
18-
MODE_CRON_FILE
19-
TELEGRAM_BOT_TOKEN
20-
TELEGRAM_CONFIG
21-
TELEGRAM_OVERRIDES
13+
API_MODE
14+
API_MODE_PORT
15+
API_MODE_TOKEN
16+
TELEGRAM_MODE
17+
TELEGRAM_MODE_TOKEN
18+
TELEGRAM_MODE_CONFIG
19+
TELEGRAM_MODE_OVERRIDES
20+
CRON_MODE
21+
CRON_MODE_FILE
22+
CRON_MODE_HISTORY_DIR
23+
MCP_MODE
24+
MCP_MODE_PORT
25+
MCP_MODE_TOKEN
2226
WORKSPACE
2327
AVAILABLE_MODELS
2428
AVAILABLE_EFFORTS
25-
CRON_HISTORY_DIR
2629
CONTAINER_NAME
2730
)
2831

tests/test_api.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,17 @@ _api_start() {
3333

3434
local extra=()
3535
if [ -n "$token" ]; then
36-
extra+=(-e "AICODEBOX_MODE_API_TOKEN=$token")
36+
extra+=(-e "AICODEBOX_API_MODE_TOKEN=$token")
37+
# Share the same bearer with MCP for these tests — keeps curl one-token.
38+
extra+=(-e "AICODEBOX_MCP_MODE_TOKEN=$token")
3739
fi
3840

3941
docker rm -f "$cname" >/dev/null 2>&1 || true
4042
docker run -d --name "$cname" \
4143
--network host \
42-
-e "AICODEBOX_MODE_API=1" \
43-
-e "AICODEBOX_MODE_API_PORT=$port" \
44+
-e "AICODEBOX_API_MODE=1" \
45+
-e "AICODEBOX_API_MODE_PORT=$port" \
46+
-e "AICODEBOX_MCP_MODE=1" \
4447
-e "ANTHROPIC_AUTH_TOKEN=$ANTHROPIC_AUTH_TOKEN" \
4548
-e "ANTHROPIC_API_KEY=$ANTHROPIC_AUTH_TOKEN" \
4649
-e "ANTHROPIC_BASE_URL=$ANTHROPIC_BASE_URL" \

tests/test_cron.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ _cron_start() {
2424
docker run -d --name "$cname" \
2525
--network host \
2626
-v "$hostdir:/workspace" \
27-
-e "AICODEBOX_MODE_CRON=1" \
28-
-e "AICODEBOX_MODE_CRON_FILE=/workspace/cron.yaml" \
27+
-e "AICODEBOX_CRON_MODE=1" \
28+
-e "AICODEBOX_CRON_MODE_FILE=/workspace/cron.yaml" \
2929
-e "AICODEBOX_WORKSPACE=/workspace" \
3030
-e "ANTHROPIC_AUTH_TOKEN=$ANTHROPIC_AUTH_TOKEN" \
3131
-e "ANTHROPIC_API_KEY=$ANTHROPIC_AUTH_TOKEN" \
@@ -53,8 +53,8 @@ test_cron_yaml_parse() {
5353
local rc
5454
rc=$(docker run --rm \
5555
-v "$hostdir:/workspace" \
56-
-e "AICODEBOX_MODE_CRON=1" \
57-
-e "AICODEBOX_MODE_CRON_FILE=/workspace/cron.yaml" \
56+
-e "AICODEBOX_CRON_MODE=1" \
57+
-e "AICODEBOX_CRON_MODE_FILE=/workspace/cron.yaml" \
5858
-e "AICODEBOX_WORKSPACE=/workspace" \
5959
"$IMAGE" >/dev/null 2>&1; echo $?)
6060
if [ "$rc" = "0" ]; then

tests/test_cron_telegram.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
_ct_check_env() {
77
local missing=()
8-
for v in AICODEBOX_TELEGRAM_BOT_TOKEN TELEGRAM_CHAT_ID \
8+
for v in AICODEBOX_TELEGRAM_MODE_TOKEN TELEGRAM_CHAT_ID \
99
TELETHON_API_ID TELETHON_API_HASH TELETHON_SESSION TELETHON_AUTH_KEY; do
1010
if [ -z "${!v:-}" ]; then
1111
missing+=("$v")
@@ -62,7 +62,7 @@ CT_BOT_REF=""
6262
_ct_resolve_bot() {
6363
[ -n "$CT_BOT_REF" ] && return 0
6464
local resp username
65-
resp=$(curl -sf "https://api.telegram.org/bot${AICODEBOX_TELEGRAM_BOT_TOKEN}/getMe")
65+
resp=$(curl -sf "https://api.telegram.org/bot${AICODEBOX_TELEGRAM_MODE_TOKEN}/getMe")
6666
username=$(echo "$resp" | python3 -c 'import json,sys
6767
print((json.load(sys.stdin).get("result") or {}).get("username", ""))')
6868
if [ -z "$username" ]; then
@@ -73,7 +73,7 @@ print((json.load(sys.stdin).get("result") or {}).get("username", ""))')
7373
log " OK: bot resolved as $CT_BOT_REF"
7474
}
7575

76-
_ct_bot_user_id() { echo "${AICODEBOX_TELEGRAM_BOT_TOKEN%%:*}"; }
76+
_ct_bot_user_id() { echo "${AICODEBOX_TELEGRAM_MODE_TOKEN%%:*}"; }
7777

7878
_ct_curl() {
7979
curl -sS -H "Authorization: Bearer $TELETHON_AUTH_KEY" "$@"
@@ -161,11 +161,11 @@ _ct_start_container() {
161161
-v "$hostdir/workspace:/workspace" \
162162
-v "$hostdir/home/.aicodebox:/home/aicode/.aicodebox" \
163163
-v "$hostdir/cron.yaml:/cron.yaml:ro" \
164-
-e "AICODEBOX_MODE_CRON=1" \
165-
-e "AICODEBOX_MODE_TELEGRAM=1" \
166-
-e "AICODEBOX_MODE_CRON_FILE=/cron.yaml" \
164+
-e "AICODEBOX_CRON_MODE=1" \
165+
-e "AICODEBOX_TELEGRAM_MODE=1" \
166+
-e "AICODEBOX_CRON_MODE_FILE=/cron.yaml" \
167167
-e "AICODEBOX_WORKSPACE=/workspace" \
168-
-e "AICODEBOX_TELEGRAM_BOT_TOKEN=$AICODEBOX_TELEGRAM_BOT_TOKEN" \
168+
-e "AICODEBOX_TELEGRAM_MODE_TOKEN=$AICODEBOX_TELEGRAM_MODE_TOKEN" \
169169
-e "TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID" \
170170
-e "ANTHROPIC_AUTH_TOKEN=$ANTHROPIC_AUTH_TOKEN" \
171171
-e "ANTHROPIC_API_KEY=$ANTHROPIC_AUTH_TOKEN" \

tests/test_e2e_telegram.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# wrapper, container lifecycle). Required env (loaded by common.sh from
1818
# .env.test, which is gitignored):
1919
#
20-
# AICODEBOX_TELEGRAM_BOT_TOKEN
20+
# AICODEBOX_TELEGRAM_MODE_TOKEN
2121
# TELEGRAM_CHAT_ID
2222
# TELETHON_API_ID, TELETHON_API_HASH, TELETHON_SESSION, TELETHON_AUTH_KEY
2323
#

tests/test_smoke.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ test_jsonschema_pi() {
6161

6262
docker run -d --name "$cname" "${DOCKER_RUN_BASE[@]}" \
6363
-e "AICODEBOX_CONTAINER_NAME=$cname" \
64-
-e "AICODEBOX_MODE_API=1" \
65-
-e "AICODEBOX_MODE_API_PORT=$port" \
66-
-e "AICODEBOX_MODE_API_TOKEN=$token" \
64+
-e "AICODEBOX_API_MODE=1" \
65+
-e "AICODEBOX_API_MODE_PORT=$port" \
66+
-e "AICODEBOX_API_MODE_TOKEN=$token" \
6767
-p "127.0.0.1:$port:$port" \
6868
"$IMAGE" >/dev/null
6969

tests/test_telegram.sh

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ TELETHON_IMAGE="psyb0t/telethon-plus"
66

77
_tg_check_env() {
88
local missing=()
9-
for v in AICODEBOX_TELEGRAM_BOT_TOKEN TELEGRAM_CHAT_ID \
9+
for v in AICODEBOX_TELEGRAM_MODE_TOKEN TELEGRAM_CHAT_ID \
1010
TELETHON_API_ID TELETHON_API_HASH TELETHON_SESSION TELETHON_AUTH_KEY; do
1111
if [ -z "${!v:-}" ]; then
1212
missing+=("$v")
@@ -63,7 +63,7 @@ TG_BOT_REF=""
6363
_tg_resolve_bot() {
6464
[ -n "$TG_BOT_REF" ] && return 0
6565
local resp username
66-
resp=$(curl -sf "https://api.telegram.org/bot${AICODEBOX_TELEGRAM_BOT_TOKEN}/getMe")
66+
resp=$(curl -sf "https://api.telegram.org/bot${AICODEBOX_TELEGRAM_MODE_TOKEN}/getMe")
6767
username=$(echo "$resp" | python3 -c 'import json,sys
6868
print((json.load(sys.stdin).get("result") or {}).get("username", ""))')
6969
if [ -z "$username" ]; then
@@ -74,7 +74,7 @@ print((json.load(sys.stdin).get("result") or {}).get("username", ""))')
7474
log " OK: bot resolved as $TG_BOT_REF"
7575
}
7676

77-
_tg_bot_user_id() { echo "${AICODEBOX_TELEGRAM_BOT_TOKEN%%:*}"; }
77+
_tg_bot_user_id() { echo "${AICODEBOX_TELEGRAM_MODE_TOKEN%%:*}"; }
7878

7979
_tg_curl() {
8080
curl -sS -H "Authorization: Bearer $TELETHON_AUTH_KEY" "$@"
@@ -154,9 +154,9 @@ _tg_start_bot() {
154154
--network host \
155155
-v "$TG_TMP/workspace:/workspace" \
156156
-v "$TG_TMP/home/.aicodebox:/home/aicode/.aicodebox" \
157-
-e "AICODEBOX_MODE_TELEGRAM=1" \
157+
-e "AICODEBOX_TELEGRAM_MODE=1" \
158158
-e "AICODEBOX_WORKSPACE=/workspace" \
159-
-e "AICODEBOX_TELEGRAM_BOT_TOKEN=$AICODEBOX_TELEGRAM_BOT_TOKEN" \
159+
-e "AICODEBOX_TELEGRAM_MODE_TOKEN=$AICODEBOX_TELEGRAM_MODE_TOKEN" \
160160
-e "TELEGRAM_CHAT_ID=$TELEGRAM_CHAT_ID" \
161161
-e "ANTHROPIC_AUTH_TOKEN=$ANTHROPIC_AUTH_TOKEN" \
162162
-e "ANTHROPIC_API_KEY=$ANTHROPIC_AUTH_TOKEN" \
@@ -197,7 +197,7 @@ test_tg_unit_md_to_html() {
197197
local cname="${CONTAINER_PREFIX}-tg-unit-$$"
198198
local rc out
199199
out=$(docker run --rm --name "$cname" \
200-
-e "AICODEBOX_TELEGRAM_BOT_TOKEN=dummy:dummy" \
200+
-e "AICODEBOX_TELEGRAM_MODE_TOKEN=dummy:dummy" \
201201
--entrypoint python3 \
202202
"$IMAGE" -c '
203203
from aicodebox.modes.telegram.utils import md_to_tg_html
@@ -293,7 +293,7 @@ test_tg_long_response() {
293293
local cname="${CONTAINER_PREFIX}-tg-long-$$"
294294
local rc out
295295
out=$(docker run --rm --name "$cname" \
296-
-e "AICODEBOX_TELEGRAM_BOT_TOKEN=dummy:dummy" \
296+
-e "AICODEBOX_TELEGRAM_MODE_TOKEN=dummy:dummy" \
297297
--entrypoint python3 \
298298
"$IMAGE" -c '
299299
import asyncio

0 commit comments

Comments
 (0)