dsh-tg-bridge 1.19.1 → 1.19.3
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 +443 -441
- package/bridge.mjs +25 -9
- package/control.mjs +122 -19
- package/goals.mjs +27 -1
- package/i18n.mjs +2011 -1945
- package/package.json +7 -3
- package/plugin-search.mjs +113 -46
package/README.md
CHANGED
|
@@ -1,442 +1,444 @@
|
|
|
1
|
-
# dsh-tg-bridge
|
|
2
|
-
|
|
3
|
-
A Telegram bridge for [DeepSeek Harness](https://deepseek.com): drive the agent from a
|
|
4
|
-
bot with text, voice and photos, without opening the desktop app.
|
|
5
|
-
|
|
6
|
-
Each forum topic is a separate project with its own session and its own working
|
|
7
|
-
directory. Replies arrive with progress, a "Stop" button and copyable code
|
|
8
|
-
blocks.
|
|
9
|
-
|
|
10
|
-
Never made a bot? [QUICKSTART.md](QUICKSTART.md) takes you from "no account" to
|
|
11
|
-
a bot that answers, one step at a time.
|
|
12
|
-
|
|
13
|
-
## Features
|
|
14
|
-
|
|
15
|
-
- **Text**: a regular task goes to the agent, the answer comes back in the same topic.
|
|
16
|
-
- **Voice**: local faster-whisper, the transcript is shown before the answer.
|
|
17
|
-
- **Photos**: the turn's own model reads them through `read_image`, text and UI
|
|
18
|
-
included; no second model is needed (a vision overlay stays opt-in).
|
|
19
|
-
- **Project per topic**: `/cd my-app`, and all turns run from that directory.
|
|
20
|
-
- **Goal and checklist per topic**: `/goal`, `/task`; both survive restarts and are prepended to every turn.
|
|
21
|
-
- **Live progress**: one edited message per turn — steps, a timer and the cache hit rate, plus
|
|
22
|
-
the model's reasoning in a collapsed block you can tap open. A long turn adds a second
|
|
23
|
-
collapsed block with every tool call, so the whole run stays in the chat as one message.
|
|
24
|
-
- **No lost messages**: a journal with acknowledgement and replay.
|
|
25
|
-
- **Settings per topic**: `/crew use reviewer` gives one topic its own model,
|
|
26
|
-
effort, permissions, agent preset and language while the others keep the profile;
|
|
27
|
-
`/crew off` returns it. Four built-in sets ship read-only and can be copied.
|
|
28
|
-
- **Fail-fast**: when the quota runs out it switches to a free model right away.
|
|
29
|
-
- **`dsh-tg check`**: diagnostics in one command, no changes to the system.
|
|
30
|
-
- **Languages**: menus and service messages in `en`, `ru`, `zh`; `/lang` pins the topic language, and without it a new topic takes the language of the message itself (Cyrillic → `ru`, Han characters → `zh`), then the Telegram `language_code`, then `en`.
|
|
31
|
-
- **"Stop"/"Retry" buttons, tool confirmations**: right in the message, no commands to type.
|
|
32
|
-
|
|
33
|
-
## Requirements
|
|
34
|
-
|
|
35
|
-
- Node.js ≥ 20
|
|
36
|
-
- DeepSeek Harness `0.2.1-rc.2` or newer in the `0.2.x` line (`>=0.2.1-rc.2 <0.3.0`)
|
|
37
|
-
- DeepSeek Harness installed (`~/.dsh/profiles/headless`)
|
|
38
|
-
- A Telegram bot token from [@BotFather](https://t.me/BotFather)
|
|
39
|
-
|
|
40
|
-
The supported harness range is declared in `engines.dsh`; that field decides
|
|
41
|
-
compatibility on its own (DSH ignores `peerDependencies` when it is present).
|
|
42
|
-
The range includes an explicit prerelease branch, because a plain `<0.3.0`
|
|
43
|
-
silently excludes `0.2.2-*` builds. A future `0.3.0` needs an explicit bump:
|
|
44
|
-
the bridge relies on the `0.2.x` CLI flags and profile layout.
|
|
45
|
-
|
|
46
|
-
## Ecosystem
|
|
47
|
-
|
|
48
|
-
The Chinese DSH community maintains the largest plugin catalogs and the
|
|
49
|
-
in-app markets that read them; this bridge follows their packaging rules so it
|
|
50
|
-
can be listed next to them:
|
|
51
|
-
|
|
52
|
-
- [awesome-dsh-plugin](https://awesome-dsh-plugin.com) — bilingual (English /
|
|
53
|
-
中文) plugin list and the `dsh-plugin-catalog` npm package
|
|
54
|
-
- [dsh-market](https://github.com/dsh-market/dsh-market) — the Chinese-built
|
|
55
|
-
in-app market with one-click install and themes
|
|
56
|
-
- [dsh-find-plugin](https://github.com/awesome-dsh-plugin/dsh-find-plugin) —
|
|
57
|
-
finds a plugin from chat instead of browsing a catalog
|
|
58
|
-
|
|
59
|
-
## Languages
|
|
60
|
-
|
|
61
|
-
- Menus (`/` in chat): three sets, `ru` by default, plus `en` and `zh`; a client whose locale matches neither gets the Russian set.
|
|
62
|
-
- Topic language: `/lang en|ru|zh`; stored in `state.json` and survives a restart.
|
|
63
|
-
- A new user gets the language from the Telegram `language_code`; anything that is not `ru`/`zh` → `en`.
|
|
64
|
-
- Translated so far: menus, the start message, turn status, errors, `/cd`, `/new`, `/stop`, `/lang`,
|
|
65
|
-
the reply to an unknown command. Long reports (`/status`, `/sessions`, `/model` and similar)
|
|
66
|
-
are still in Russian, that is the next pass.
|
|
67
|
-
|
|
68
|
-
## Installation
|
|
69
|
-
|
|
70
|
-
One command: your bot token and your numeric id. Nothing to edit by hand.
|
|
71
|
-
|
|
72
|
-
**Any platform with Node.js ≥ 20**
|
|
73
|
-
|
|
74
|
-
```bash
|
|
75
|
-
npx dsh-tg-bridge@latest init --token 123456789:AA... --user 123456789
|
|
76
|
-
npx dsh-tg-bridge@latest setup
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
`init` writes the token, your id and the working directory; `setup` registers
|
|
80
|
-
autostart and starts the bridge.
|
|
81
|
-
|
|
82
|
-
**As a DSH plugin** (the package carries a `dsh.bundle`; the catalog entry is
|
|
83
|
-
pending review):
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
dsh plugin --profile desktop add dsh-tg-bridge
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
The plugin starts one bridge when DSH boots and stops it on shutdown; if a
|
|
90
|
-
bridge is already running (for example from the scheduled task), it leaves it
|
|
91
|
-
alone. Run `npx dsh-tg-bridge@latest init ...` first so a config exists.
|
|
92
|
-
|
|
93
|
-
What `init` does:
|
|
94
|
-
|
|
95
|
-
| What | Where |
|
|
96
|
-
|---|---|
|
|
97
|
-
| bot token | `~/.dsh/.credentials.yaml` → `refs.DSH_TELEGRAM_BOT_TOKEN`; other keys are left alone |
|
|
98
|
-
| your id and working directory | `~/.dsh/tg-bridge/config.json`; an existing file is not overwritten |
|
|
99
|
-
| `headless` profile | checked, with a hint on how to create it if missing |
|
|
100
|
-
|
|
101
|
-
`init` flags: `--cwd <path>` (default `~/Projects`), `--voice` (enable
|
|
102
|
-
voice transcription), `--dry-run` (show what would be written, change nothing).
|
|
103
|
-
|
|
104
|
-
Optional provider settings live in `config.json`:
|
|
105
|
-
|
|
106
|
-
| Key | Meaning |
|
|
107
|
-
|---|---|
|
|
108
|
-
| `providerKeys` | extra env var names to pass to a turn, read from `~/.dsh/.credentials.yaml`; default `[]` |
|
|
109
|
-
| `pricesUrl` | public model page for `/prices`; default `""` uses models.dev only |
|
|
110
|
-
| `vision.patch` | opt-in overlay profile for photo turns; default `""` — the turn's own model reads images |
|
|
111
|
-
| `vision.enabled` | set `true` to run photo turns on `vision.patch` instead of the topic profile |
|
|
112
|
-
| `fallbackModels` | free-model fallbacks; default `[]` |
|
|
113
|
-
|
|
114
|
-
Get your id from [@userinfobot](https://t.me/userinfobot), the token from
|
|
115
|
-
[@BotFather](https://t.me/BotFather).
|
|
116
|
-
|
|
117
|
-
### Bot settings in Telegram
|
|
118
|
-
|
|
119
|
-
Three things without which the bot will stay silent in a group or work only halfway:
|
|
120
|
-
|
|
121
|
-
1. **Privacy mode → Disable** (`/setprivacy` in BotFather). Otherwise the bot sees
|
|
122
|
-
only commands, not regular text in a topic.
|
|
123
|
-
2. **Topics enabled** in the group settings (Edit → Topics). Without them all work
|
|
124
|
-
goes to a single chat and per-topic sessions are not created.
|
|
125
|
-
3. **Pin Messages** permission for the bot. Only needed to pin the first
|
|
126
|
-
message of a topic; without it the bridge keeps working but will not pin.
|
|
127
|
-
|
|
128
|
-
You do not need to set up the command menu by hand: `init` and `setup` install it
|
|
129
|
-
in Russian, English and Chinese at once. The menu is not refreshed by a plain
|
|
130
|
-
bridge restart, so after adding commands run `dsh-tg menu`. The full settings
|
|
131
|
-
table, permissions, checks and common errors are in
|
|
132
|
-
[docs/TELEGRAM-SETUP.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/TELEGRAM-SETUP.md).
|
|
133
|
-
|
|
134
|
-
**Autostart** is installed by the setup: `launchd` on macOS, `systemd --user` on
|
|
135
|
-
Linux. On Windows `setup` registers the `DSH-TG-Bridge` task, which runs the
|
|
136
|
-
guarded supervisor (the same launcher on logon and every five minutes) so a
|
|
137
|
-
crashed bridge comes back without a second poller.
|
|
138
|
-
|
|
139
|
-
**Manual install** (if you want full control):
|
|
140
|
-
|
|
141
|
-
```bash
|
|
142
|
-
npm install -g dsh-tg-bridge
|
|
143
|
-
dsh-tg init --token 123456789:AA... --user 123456789
|
|
144
|
-
dsh-tg check # report only, changes nothing
|
|
145
|
-
dsh-tg setup # stop the old bridge and start the new one
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
If the bridge is already installed, `setup` restarts it on the new code and reinstalls
|
|
149
|
-
the command menu.
|
|
150
|
-
|
|
151
|
-
## Troubleshooting
|
|
152
|
-
|
|
153
|
-
Starting from nothing, or helping someone who is: [QUICKSTART.md](QUICKSTART.md)
|
|
154
|
-
has the same answers with the terminal output they will actually see.
|
|
155
|
-
|
|
156
|
-
Error replies end with a code, which tells you what to fix:
|
|
157
|
-
|
|
158
|
-
| Code | Meaning |
|
|
159
|
-
|---|---|
|
|
160
|
-
| `INSUFFICIENT_QUOTA` | provider balance is empty: top up or stay on free models (`/prices`, `/model`) |
|
|
161
|
-
| `TG_CONFLICT` | a second process is polling the same bot: `/doctor`, then `/restart` |
|
|
162
|
-
| `MISSING_CREDENTIAL` | no provider key in the profile: add it in the DSH app |
|
|
163
|
-
| `NO_DSH_CLI` | DeepSeek Harness CLI not found: check the app installation |
|
|
164
|
-
| `NETWORK` | no network to the provider: retry, check VPN/DNS |
|
|
165
|
-
| `SANDBOX_DENY` | DSH denied access to a file or directory: check the project path and permissions |
|
|
166
|
-
| `UNKNOWN_MODEL` | the model from the config is unavailable: `/model` lists the working ones |
|
|
167
|
-
| `EMPTY_RESPONSE` | the model returned nothing: retry or switch model (`/model`) |
|
|
1
|
+
# dsh-tg-bridge
|
|
2
|
+
|
|
3
|
+
A Telegram bridge for [DeepSeek Harness](https://deepseek.com): drive the agent from a
|
|
4
|
+
bot with text, voice and photos, without opening the desktop app.
|
|
5
|
+
|
|
6
|
+
Each forum topic is a separate project with its own session and its own working
|
|
7
|
+
directory. Replies arrive with progress, a "Stop" button and copyable code
|
|
8
|
+
blocks.
|
|
9
|
+
|
|
10
|
+
Never made a bot? [QUICKSTART.md](QUICKSTART.md) takes you from "no account" to
|
|
11
|
+
a bot that answers, one step at a time.
|
|
12
|
+
|
|
13
|
+
## Features
|
|
14
|
+
|
|
15
|
+
- **Text**: a regular task goes to the agent, the answer comes back in the same topic.
|
|
16
|
+
- **Voice**: local faster-whisper, the transcript is shown before the answer.
|
|
17
|
+
- **Photos**: the turn's own model reads them through `read_image`, text and UI
|
|
18
|
+
included; no second model is needed (a vision overlay stays opt-in).
|
|
19
|
+
- **Project per topic**: `/cd my-app`, and all turns run from that directory.
|
|
20
|
+
- **Goal and checklist per topic**: `/goal`, `/task`; both survive restarts and are prepended to every turn.
|
|
21
|
+
- **Live progress**: one edited message per turn — steps, a timer and the cache hit rate, plus
|
|
22
|
+
the model's reasoning in a collapsed block you can tap open. A long turn adds a second
|
|
23
|
+
collapsed block with every tool call, so the whole run stays in the chat as one message.
|
|
24
|
+
- **No lost messages**: a journal with acknowledgement and replay.
|
|
25
|
+
- **Settings per topic**: `/crew use reviewer` gives one topic its own model,
|
|
26
|
+
effort, permissions, agent preset and language while the others keep the profile;
|
|
27
|
+
`/crew off` returns it. Four built-in sets ship read-only and can be copied.
|
|
28
|
+
- **Fail-fast**: when the quota runs out it switches to a free model right away.
|
|
29
|
+
- **`dsh-tg check`**: diagnostics in one command, no changes to the system.
|
|
30
|
+
- **Languages**: menus and service messages in `en`, `ru`, `zh`; `/lang` pins the topic language, and without it a new topic takes the language of the message itself (Cyrillic → `ru`, Han characters → `zh`), then the Telegram `language_code`, then `en`.
|
|
31
|
+
- **"Stop"/"Retry" buttons, tool confirmations**: right in the message, no commands to type.
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
- Node.js ≥ 20
|
|
36
|
+
- DeepSeek Harness `0.2.1-rc.2` or newer in the `0.2.x` line (`>=0.2.1-rc.2 <0.3.0`)
|
|
37
|
+
- DeepSeek Harness installed (`~/.dsh/profiles/headless`)
|
|
38
|
+
- A Telegram bot token from [@BotFather](https://t.me/BotFather)
|
|
39
|
+
|
|
40
|
+
The supported harness range is declared in `engines.dsh`; that field decides
|
|
41
|
+
compatibility on its own (DSH ignores `peerDependencies` when it is present).
|
|
42
|
+
The range includes an explicit prerelease branch, because a plain `<0.3.0`
|
|
43
|
+
silently excludes `0.2.2-*` builds. A future `0.3.0` needs an explicit bump:
|
|
44
|
+
the bridge relies on the `0.2.x` CLI flags and profile layout.
|
|
45
|
+
|
|
46
|
+
## Ecosystem
|
|
47
|
+
|
|
48
|
+
The Chinese DSH community maintains the largest plugin catalogs and the
|
|
49
|
+
in-app markets that read them; this bridge follows their packaging rules so it
|
|
50
|
+
can be listed next to them:
|
|
51
|
+
|
|
52
|
+
- [awesome-dsh-plugin](https://awesome-dsh-plugin.com) — bilingual (English /
|
|
53
|
+
中文) plugin list and the `dsh-plugin-catalog` npm package
|
|
54
|
+
- [dsh-market](https://github.com/dsh-market/dsh-market) — the Chinese-built
|
|
55
|
+
in-app market with one-click install and themes
|
|
56
|
+
- [dsh-find-plugin](https://github.com/awesome-dsh-plugin/dsh-find-plugin) —
|
|
57
|
+
finds a plugin from chat instead of browsing a catalog
|
|
58
|
+
|
|
59
|
+
## Languages
|
|
60
|
+
|
|
61
|
+
- Menus (`/` in chat): three sets, `ru` by default, plus `en` and `zh`; a client whose locale matches neither gets the Russian set.
|
|
62
|
+
- Topic language: `/lang en|ru|zh`; stored in `state.json` and survives a restart.
|
|
63
|
+
- A new user gets the language from the Telegram `language_code`; anything that is not `ru`/`zh` → `en`.
|
|
64
|
+
- Translated so far: menus, the start message, turn status, errors, `/cd`, `/new`, `/stop`, `/lang`,
|
|
65
|
+
the reply to an unknown command. Long reports (`/status`, `/sessions`, `/model` and similar)
|
|
66
|
+
are still in Russian, that is the next pass.
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
One command: your bot token and your numeric id. Nothing to edit by hand.
|
|
71
|
+
|
|
72
|
+
**Any platform with Node.js ≥ 20**
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
npx dsh-tg-bridge@latest init --token 123456789:AA... --user 123456789
|
|
76
|
+
npx dsh-tg-bridge@latest setup
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
`init` writes the token, your id and the working directory; `setup` registers
|
|
80
|
+
autostart and starts the bridge.
|
|
81
|
+
|
|
82
|
+
**As a DSH plugin** (the package carries a `dsh.bundle`; the catalog entry is
|
|
83
|
+
pending review):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
dsh plugin --profile desktop add dsh-tg-bridge
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The plugin starts one bridge when DSH boots and stops it on shutdown; if a
|
|
90
|
+
bridge is already running (for example from the scheduled task), it leaves it
|
|
91
|
+
alone. Run `npx dsh-tg-bridge@latest init ...` first so a config exists.
|
|
92
|
+
|
|
93
|
+
What `init` does:
|
|
94
|
+
|
|
95
|
+
| What | Where |
|
|
96
|
+
|---|---|
|
|
97
|
+
| bot token | `~/.dsh/.credentials.yaml` → `refs.DSH_TELEGRAM_BOT_TOKEN`; other keys are left alone |
|
|
98
|
+
| your id and working directory | `~/.dsh/tg-bridge/config.json`; an existing file is not overwritten |
|
|
99
|
+
| `headless` profile | checked, with a hint on how to create it if missing |
|
|
100
|
+
|
|
101
|
+
`init` flags: `--cwd <path>` (default `~/Projects`), `--voice` (enable
|
|
102
|
+
voice transcription), `--dry-run` (show what would be written, change nothing).
|
|
103
|
+
|
|
104
|
+
Optional provider settings live in `config.json`:
|
|
105
|
+
|
|
106
|
+
| Key | Meaning |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `providerKeys` | extra env var names to pass to a turn, read from `~/.dsh/.credentials.yaml`; default `[]` |
|
|
109
|
+
| `pricesUrl` | public model page for `/prices`; default `""` uses models.dev only |
|
|
110
|
+
| `vision.patch` | opt-in overlay profile for photo turns; default `""` — the turn's own model reads images |
|
|
111
|
+
| `vision.enabled` | set `true` to run photo turns on `vision.patch` instead of the topic profile |
|
|
112
|
+
| `fallbackModels` | free-model fallbacks; default `[]` |
|
|
113
|
+
|
|
114
|
+
Get your id from [@userinfobot](https://t.me/userinfobot), the token from
|
|
115
|
+
[@BotFather](https://t.me/BotFather).
|
|
116
|
+
|
|
117
|
+
### Bot settings in Telegram
|
|
118
|
+
|
|
119
|
+
Three things without which the bot will stay silent in a group or work only halfway:
|
|
120
|
+
|
|
121
|
+
1. **Privacy mode → Disable** (`/setprivacy` in BotFather). Otherwise the bot sees
|
|
122
|
+
only commands, not regular text in a topic.
|
|
123
|
+
2. **Topics enabled** in the group settings (Edit → Topics). Without them all work
|
|
124
|
+
goes to a single chat and per-topic sessions are not created.
|
|
125
|
+
3. **Pin Messages** permission for the bot. Only needed to pin the first
|
|
126
|
+
message of a topic; without it the bridge keeps working but will not pin.
|
|
127
|
+
|
|
128
|
+
You do not need to set up the command menu by hand: `init` and `setup` install it
|
|
129
|
+
in Russian, English and Chinese at once. The menu is not refreshed by a plain
|
|
130
|
+
bridge restart, so after adding commands run `dsh-tg menu`. The full settings
|
|
131
|
+
table, permissions, checks and common errors are in
|
|
132
|
+
[docs/TELEGRAM-SETUP.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/TELEGRAM-SETUP.md).
|
|
133
|
+
|
|
134
|
+
**Autostart** is installed by the setup: `launchd` on macOS, `systemd --user` on
|
|
135
|
+
Linux. On Windows `setup` registers the `DSH-TG-Bridge` task, which runs the
|
|
136
|
+
guarded supervisor (the same launcher on logon and every five minutes) so a
|
|
137
|
+
crashed bridge comes back without a second poller.
|
|
138
|
+
|
|
139
|
+
**Manual install** (if you want full control):
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
npm install -g dsh-tg-bridge
|
|
143
|
+
dsh-tg init --token 123456789:AA... --user 123456789
|
|
144
|
+
dsh-tg check # report only, changes nothing
|
|
145
|
+
dsh-tg setup # stop the old bridge and start the new one
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
If the bridge is already installed, `setup` restarts it on the new code and reinstalls
|
|
149
|
+
the command menu.
|
|
150
|
+
|
|
151
|
+
## Troubleshooting
|
|
152
|
+
|
|
153
|
+
Starting from nothing, or helping someone who is: [QUICKSTART.md](QUICKSTART.md)
|
|
154
|
+
has the same answers with the terminal output they will actually see.
|
|
155
|
+
|
|
156
|
+
Error replies end with a code, which tells you what to fix:
|
|
157
|
+
|
|
158
|
+
| Code | Meaning |
|
|
159
|
+
|---|---|
|
|
160
|
+
| `INSUFFICIENT_QUOTA` | provider balance is empty: top up or stay on free models (`/prices`, `/model`) |
|
|
161
|
+
| `TG_CONFLICT` | a second process is polling the same bot: `/doctor`, then `/restart` |
|
|
162
|
+
| `MISSING_CREDENTIAL` | no provider key in the profile: add it in the DSH app |
|
|
163
|
+
| `NO_DSH_CLI` | DeepSeek Harness CLI not found: check the app installation |
|
|
164
|
+
| `NETWORK` | no network to the provider: retry, check VPN/DNS |
|
|
165
|
+
| `SANDBOX_DENY` | DSH denied access to a file or directory: check the project path and permissions |
|
|
166
|
+
| `UNKNOWN_MODEL` | the model from the config is unavailable: `/model` lists the working ones |
|
|
167
|
+
| `EMPTY_RESPONSE` | the model returned nothing: retry or switch model (`/model`) |
|
|
168
168
|
| `TURN_TIME_CAP` | the turn hit its own time ceiling: the work is saved, press Continue |
|
|
169
|
-
| `TURN_FAILED` | cause not recognized: `/doctor` and `/logs errors` |
|
|
170
|
-
|
|
171
|
-
## Checks
|
|
172
|
-
|
|
173
|
-
Send the bot:
|
|
174
|
-
|
|
175
|
-
| Command | Expected |
|
|
176
|
-
|---|---|
|
|
177
|
-
| `/doctor` | report: pid, Telegram, disk, directory, session |
|
|
178
|
-
| `/version` | bridge version, the latest on npm, bridge directory |
|
|
179
|
-
| `/update` | says whether a newer release exists (`/update confirm` installs it) |
|
|
180
|
-
| `/thoughts [file\|all\|off]` | the last turn's reasoning as a message; `file`/`all` send the full log as a Markdown document, `off` hides the block |
|
|
181
|
-
| `/help` | commands grouped by category |
|
|
182
|
-
| `/cd my-app` | topic bound to the project |
|
|
183
|
-
| `/prices` | what the current model costs, and whose price that is: your provider's, the same model on another gateway, or "no public price" when nobody publishes one |
|
|
184
|
-
|
|
185
|
-
## Commands
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
Work: /cd · /new · /stop · /send · /seed
|
|
189
|
-
Goals: /goal · /task · /task done|rm <n>
|
|
190
|
-
Sessions: /status · /sessions · /resume
|
|
191
|
-
Agents: /agents · /agents <id> · /agents set model|depth|filter
|
|
192
|
-
Models: /model · /model <id> · /prices
|
|
193
|
-
Tuning: /effort · /permissions · /preset · /plan · /jobs · /remind
|
|
194
|
-
Profiles: /profile · /profile <name> · /profile new <name> from <template>
|
|
195
|
-
Sets: /crew · /crew use|off|new|copy|rm · /crew model <v>
|
|
196
|
-
Extensions: /skills · /plugins · /plugins search <word> · /plugins disable|enable <id> · /soul
|
|
197
|
-
Updates: /version · /update · /update confirm · /update on|off|check|auto · /subscribe on|off
|
|
198
|
-
Diagnostics: /doctor · /logs [errors|N|text]
|
|
199
|
-
Service: /app · /restart · /help
|
|
200
|
-
Settings: /settings — the same switches as buttons, grouped in four tabs
|
|
201
|
-
Display: /lang · /reasoning on|off · /thoughts
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
### Settings as a card
|
|
205
|
-
|
|
206
|
-
`/settings` draws the same switches that the commands set, in one message with
|
|
207
|
-
four tabs: what the bot says, who answers and how hard it works, new releases,
|
|
208
|
-
and the health checks. Each row shows what the setting is now and what a tap
|
|
209
|
-
would change it to. A tap runs the command a person would have typed
|
|
210
|
-
(`/reasoning off`, `/update on`), so the card cannot disagree with the command:
|
|
211
|
-
it is a view of them. After the change the card collapses into one plain line —
|
|
212
|
-
delete it and the chat is back to what it was.
|
|
213
|
-
|
|
214
|
-
Nothing on the card is only available on the card. `/settings` is for people who
|
|
215
|
-
would rather press a labelled button than remember which of `/effort`,
|
|
216
|
-
`/preset` and `/crew` changes what.
|
|
217
|
-
|
|
218
|
-
Every command answers `/help` in the chat, in the language you write in: a
|
|
219
|
-
message written in Cyrillic or Han characters switches the topic to Russian or
|
|
220
|
-
Chinese even when the phone's menu is set to another language, and `/lang`
|
|
221
|
-
pins a choice above that. The Telegram menu shows the same list, minus
|
|
222
|
-
`/subscribe`: it is one line, and a person who turns it off should not have to
|
|
223
|
-
find it in a menu again.
|
|
224
|
-
|
|
225
|
-
## Updates
|
|
226
|
-
|
|
227
|
-
The npm tag `latest` is a label, not an updater: installing a package pins the
|
|
228
|
-
version on disk, and nothing moves until something moves it. Two switches, both
|
|
229
|
-
about this install (not about a topic, because it is the install that updates):
|
|
230
|
-
|
|
231
|
-
| Command | What it does |
|
|
232
|
-
|---|---|
|
|
233
|
-
| `/update` | one line: what runs here, what is published, which switches are set |
|
|
234
|
-
| `/update on` | tell me about new releases: one message per version, checked once a day |
|
|
235
|
-
| `/update off` | stop telling me; nothing installs, nothing moves |
|
|
236
|
-
| `/update auto` | besides telling me, install the release by itself (checked hourly) |
|
|
237
|
-
| `/update confirm` | install the new release now, by hand |
|
|
238
|
-
|
|
239
|
-
Nothing above installs except `confirm` and `auto`, and even those only change the
|
|
240
|
-
files: the running process keeps its old modules until `/restart confirm`, so a
|
|
241
|
-
bad release never lands mid-chat. `confirm` and `auto` copy the replaced files to
|
|
242
|
-
`update-backup-<date>` and print the path; copying that folder back is the way to
|
|
243
|
-
roll back, with no state to undo.
|
|
244
|
-
|
|
245
|
-
`/subscribe on|off` says the same thing as `/update on|off`, for people who do not
|
|
246
|
-
want to read `/update` first. It is not in the Telegram menu on purpose.
|
|
247
|
-
|
|
248
|
-
There are no notices about failures. The bridge cannot decide what counts as one
|
|
249
|
-
for you, and "something failed" that nobody can act on is noise; errors stay in
|
|
250
|
-
the chat where they happened, under `/doctor` and `/logs errors`.
|
|
251
|
-
|
|
252
|
-
## How it works
|
|
253
|
-
|
|
254
|
-
```
|
|
255
|
-
Telegram → bridge.mjs → dsh --profile headless --json → reply
|
|
256
|
-
│
|
|
257
|
-
├─ pending/ journal + ack (messages are not lost)
|
|
258
|
-
├─ per-topic queue (turns in topics run in parallel)
|
|
259
|
-
├─ progress + buttons (you can see the work is going)
|
|
260
|
-
└─ fail-fast on quota (free models as a fallback)
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
The bridge is a single process with long polling. Each turn spawns a separate
|
|
264
|
-
CLI process that exits after the answer, so "no DSH process" between
|
|
265
|
-
turns is normal, not a failure.
|
|
266
|
-
|
|
267
|
-
### Steering during a turn
|
|
268
|
-
|
|
269
|
-
If you write in a topic while a turn is still running, the message does not queue
|
|
270
|
-
behind it: the bridge drops the task into `~/.dsh/tg-bridge/steer/`, the `dsh-steer-inbox`
|
|
271
|
-
plugin hands it to the live agent on its next step, and the agent immediately replies with a short
|
|
272
|
-
line in the chat: what it is doing now and where it put the addition. If the agent stays silent
|
|
273
|
-
for 90 seconds, the bridge writes one neutral line itself so there is no silence.
|
|
274
|
-
|
|
275
|
-
Attachments work the same way. A voice note is transcribed first and its transcript is echoed in
|
|
276
|
-
the chat, then the text is steered into the running turn; a photo or a file is downloaded to a
|
|
277
|
-
local path and that path is steered, exactly as an idle turn would hand it over.
|
|
278
|
-
|
|
279
|
-
What each kind of attachment becomes inside a running turn:
|
|
280
|
-
|
|
281
|
-
| Sent | Inside the turn |
|
|
282
|
-
|---|---|
|
|
283
|
-
| voice note, audio file, audio sent as a document | transcript, echoed as `🎤 …` before the steer |
|
|
284
|
-
| small text file (`.md`, `.json`, `.csv`, `.py`, `.log`, … up to 60 KB) | the content itself between `<file>` markers — no tool call needed |
|
|
285
|
-
| PDF, archive, binary, anything bigger | its local path under `~/.dsh/tg-bridge/inbox/` |
|
|
286
|
-
| video, video note, animation | its path; the agent can pull frames or sound out with ffmpeg |
|
|
287
|
-
| photo | its path plus one honest line; the turn reads it with `read_image`, and says so in one line if it cannot |
|
|
288
|
-
|
|
289
|
-
A caption does not turn the attachment into a text-only message: it is folded into the same
|
|
290
|
-
hand-over, so "why did this fail" plus a `.log` file arrives as one steer.
|
|
291
|
-
|
|
292
|
-
An album is one request, not ten. Telegram delivers it as one update per file, all sharing a
|
|
293
|
-
`media_group_id`; the bridge collects the group (1.2 s of quiet after the last item, at most
|
|
294
|
-
4 s) and hands it over once — one steer into a running turn, one turn when the topic is idle.
|
|
295
|
-
|
|
296
|
-
### When a turn hits the time ceiling
|
|
297
|
-
|
|
298
|
-
`turnTimeoutMs` (default 30 min, this install 75) is a ceiling, not a target: if a turn reaches
|
|
299
|
-
it, the bridge stops it with `⏱` instead of letting one runaway loop own the topic for hours.
|
|
300
|
-
Nothing is lost — the session and every file the turn produced stay in place — so the message
|
|
301
|
-
carries **⏵ Continue**, which asks the agent to check the state and go on from where it stopped.
|
|
302
|
-
That is deliberately not the same as **Retry**, which would redo the whole task from the start.
|
|
303
|
-
|
|
304
|
-
This needs the plugin from this repository:
|
|
305
|
-
|
|
306
|
-
```bash
|
|
307
|
-
dsh plugin --profile headless add link:<path-to-repository>/plugin/steer-inbox
|
|
308
|
-
```
|
|
309
|
-
|
|
310
|
-
and a line in `~/.dsh/profiles/headless/cordis.patch.yml`:
|
|
311
|
-
|
|
312
|
-
```yaml
|
|
313
|
-
- insert:
|
|
314
|
-
- id: steer-inbox
|
|
315
|
-
name: 'dsh-steer-inbox'
|
|
316
|
-
```
|
|
317
|
-
|
|
318
|
-
The bridge checks the profile itself: if the line is missing, it does not write the task
|
|
319
|
-
(it would just expire) and behaves as before, queueing the message.
|
|
320
|
-
|
|
321
|
-
### Live thoughts and reasoning
|
|
322
|
-
|
|
323
|
-
Two things land in the same progress message, and neither sends a chat message of its own.
|
|
324
|
-
|
|
325
|
-
**The model's reasoning.** Every `thinking` block the CLI commits is folded into one
|
|
326
|
-
Telegram `<blockquote expandable>`: collapsed it is a single line, tapped it opens the whole
|
|
327
|
-
trail of the turn, and it stays there after the turn ends — the same way the desktop app shows
|
|
328
|
-
a reasoning section you can expand. The block is written once, in the final edit of the turn,
|
|
329
|
-
and never touched again: Telegram re-collapses an expanded block on every edit of its message,
|
|
330
|
-
which used to yank the chat away from a half-read paragraph. While the turn runs the message
|
|
331
|
-
only gets a counter (`🧠 Размышления · 4821`) and the last three steps, so the live edits stay
|
|
332
|
-
short. Escaped, and trimmed to its tail when a turn thinks longer than a message can hold; the
|
|
333
|
-
panel never exceeds one message. A cut block says `… · начало скрыто · /thoughts file`, which
|
|
334
|
-
sends the whole log as a document. If the API refuses the markup, the same content is retried
|
|
335
|
-
as plain text.
|
|
336
|
-
|
|
337
|
-
**The steps.** Three calls fit inline. A turn that makes more moves its complete step list into
|
|
338
|
-
a second collapsed block, added in that same final edit, so "what did it actually run" is one
|
|
339
|
-
tap away instead of a count.
|
|
340
|
-
|
|
341
|
-
**The agent's own notes.** The agent can add a short decision trail:
|
|
342
|
-
|
|
343
|
-
```bash
|
|
344
|
-
node ~/.dsh/tg-bridge/say.mjs --thought "checking why the watchdog fired twice"
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
The note is appended to `~/.dsh/tg-bridge/thoughts/<chat>_<thread>.jsonl`; the progress
|
|
348
|
-
message shows the last two as `💭` lines. The command needs no ids: it falls back to the
|
|
349
|
-
newest turn's thought file, because tool shells do not inherit the bridge environment.
|
|
350
|
-
`--thought` never sends a Telegram message on its own.
|
|
351
|
-
|
|
352
|
-
A decision the person must know before the turn ends — a release shipped, a cause found,
|
|
353
|
-
a blocker — goes to the chat as one plain line instead:
|
|
354
|
-
|
|
355
|
-
```bash
|
|
356
|
-
node ~/.dsh/tg-bridge/say.mjs --note "1.10.1 is on npm; restart to load it"
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
`--note` sends a real message and takes the same no-ids fallback as `--thought`. The split
|
|
360
|
-
is deliberate: `--thought` is the working trail inside the progress message, `--note` is the
|
|
361
|
-
short line that changes what the reader expects to happen next. The progress message itself
|
|
362
|
-
opens with the request echoed back (`⏳ Принял: «…» · 3 с`), so the first thing the person
|
|
363
|
-
sees after sending names their task rather than a generic spinner.
|
|
364
|
-
|
|
365
|
-
`/reasoning` is the switch for the 💭 mechanism. It is on by default: every turn carries a
|
|
366
|
-
short instruction to leave one line at each decision point (task clear, cause found, risky
|
|
367
|
-
change, result checked). `/reasoning off` drops the instruction and the `💭` lines for that
|
|
368
|
-
topic — useful when the step list is all you want. The setting lives in `state.json` per topic,
|
|
369
|
-
so a chatty research topic and a terse deploy topic can differ.
|
|
370
|
-
|
|
371
|
-
The reasoning block itself is model output; `/thoughts` is what reads it back:
|
|
372
|
-
|
|
373
|
-
- `/thoughts` — the last turn as a message, in parts, deleted after a few minutes;
|
|
374
|
-
- `/thoughts file` — the **whole** last turn as `reasoning-<date>-file.md`, sent as a document
|
|
375
|
-
(a five-hour turn is tens of thousands of characters, which no chat message can hold);
|
|
376
|
-
- `/thoughts all` — every turn of the session in one file (a long session is a couple of MB);
|
|
377
|
-
- `/thoughts off` / `on` — keep the block out of the turn panel (the panel then shows
|
|
378
|
-
`🧠 Размышления · N · /thoughts file`) or bring it back.
|
|
379
|
-
|
|
380
|
-
The log is built from the session file on demand, so nothing is duplicated while a turn runs.
|
|
381
|
-
Files land in `~/.dsh/tg-bridge/thoughts/` and older ones are pruned after a week.
|
|
382
|
-
|
|
383
|
-
### Profiles per topic
|
|
384
|
-
|
|
385
|
-
The desktop app lets you build several profiles for different kinds of work, each with its own
|
|
386
|
-
plugin set and model. The same switch works from a topic:
|
|
387
|
-
|
|
388
|
-
```
|
|
389
|
-
/profile current profile, available ones, hints
|
|
390
|
-
/profile research run this topic's turns on another profile
|
|
391
|
-
/profile new research from web
|
|
392
|
-
create a profile from a shipped template and bind it
|
|
393
|
-
/profile default back to the install default
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
A new profile is written by `dsh <name> --from-default-profile <template> --dump-config`, so
|
|
397
|
-
nothing boots and no plugin is loaded at creation time; dependencies are installed by the
|
|
398
|
-
profile's first turn. The binding is per topic: `/model` then edits that profile's model, and
|
|
399
|
-
`/plugins` manages that profile's rows, and `/plugins search <word>` lists what the npm registry
|
|
400
|
-
has with the `dsh-plugin` keyword — the desktop app's plugin browser, from the chat. Each result
|
|
401
|
-
carries a plus button that runs `/plugins add <name>`.
|
|
402
|
-
|
|
403
|
-
### Goals and tasks
|
|
404
|
-
|
|
405
|
-
A topic carries its own goal and checklist, so the aim survives `/new`, a
|
|
406
|
-
restart and a different session:
|
|
407
|
-
|
|
408
|
-
```
|
|
409
|
-
/goal ship the release set or replace the goal
|
|
410
|
-
/goal show the goal and the checklist
|
|
411
|
-
/task write the migration add a task
|
|
412
|
-
/task done 2 tick it off
|
|
413
|
-
/task
|
|
414
|
-
/
|
|
415
|
-
/goal
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
- [docs/
|
|
436
|
-
- [docs/
|
|
437
|
-
- [docs/
|
|
438
|
-
- [docs/
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
169
|
+
| `TURN_FAILED` | cause not recognized: `/doctor` and `/logs errors` |
|
|
170
|
+
|
|
171
|
+
## Checks
|
|
172
|
+
|
|
173
|
+
Send the bot:
|
|
174
|
+
|
|
175
|
+
| Command | Expected |
|
|
176
|
+
|---|---|
|
|
177
|
+
| `/doctor` | report: pid, Telegram, disk, directory, session |
|
|
178
|
+
| `/version` | bridge version, the latest on npm, bridge directory |
|
|
179
|
+
| `/update` | says whether a newer release exists (`/update confirm` installs it) |
|
|
180
|
+
| `/thoughts [file\|all\|off]` | the last turn's reasoning as a message; `file`/`all` send the full log as a Markdown document, `off` hides the block |
|
|
181
|
+
| `/help` | commands grouped by category |
|
|
182
|
+
| `/cd my-app` | topic bound to the project |
|
|
183
|
+
| `/prices` | what the current model costs, and whose price that is: your provider's, the same model on another gateway, or "no public price" when nobody publishes one |
|
|
184
|
+
|
|
185
|
+
## Commands
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Work: /cd · /new · /stop · /send · /seed
|
|
189
|
+
Goals: /goal · /goal reopen · /task · /task done|rm|edit <n>
|
|
190
|
+
Sessions: /status · /sessions · /resume
|
|
191
|
+
Agents: /agents · /agents <id> · /agents set model|depth|filter
|
|
192
|
+
Models: /model · /model <id> · /prices
|
|
193
|
+
Tuning: /effort · /permissions · /preset · /plan · /jobs · /remind
|
|
194
|
+
Profiles: /profile · /profile <name> · /profile new <name> from <template>
|
|
195
|
+
Sets: /crew · /crew use|off|new|copy|rm · /crew model <v>
|
|
196
|
+
Extensions: /skills · /plugins · /plugins search <word> · /plugins disable|enable <id> · /soul
|
|
197
|
+
Updates: /version · /update · /update confirm · /update on|off|check|auto · /subscribe on|off
|
|
198
|
+
Diagnostics: /doctor · /logs [errors|N|text]
|
|
199
|
+
Service: /app · /restart · /help
|
|
200
|
+
Settings: /settings — the same switches as buttons, grouped in four tabs
|
|
201
|
+
Display: /lang · /reasoning on|off · /thoughts
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### Settings as a card
|
|
205
|
+
|
|
206
|
+
`/settings` draws the same switches that the commands set, in one message with
|
|
207
|
+
four tabs: what the bot says, who answers and how hard it works, new releases,
|
|
208
|
+
and the health checks. Each row shows what the setting is now and what a tap
|
|
209
|
+
would change it to. A tap runs the command a person would have typed
|
|
210
|
+
(`/reasoning off`, `/update on`), so the card cannot disagree with the command:
|
|
211
|
+
it is a view of them. After the change the card collapses into one plain line —
|
|
212
|
+
delete it and the chat is back to what it was.
|
|
213
|
+
|
|
214
|
+
Nothing on the card is only available on the card. `/settings` is for people who
|
|
215
|
+
would rather press a labelled button than remember which of `/effort`,
|
|
216
|
+
`/preset` and `/crew` changes what.
|
|
217
|
+
|
|
218
|
+
Every command answers `/help` in the chat, in the language you write in: a
|
|
219
|
+
message written in Cyrillic or Han characters switches the topic to Russian or
|
|
220
|
+
Chinese even when the phone's menu is set to another language, and `/lang`
|
|
221
|
+
pins a choice above that. The Telegram menu shows the same list, minus
|
|
222
|
+
`/subscribe`: it is one line, and a person who turns it off should not have to
|
|
223
|
+
find it in a menu again.
|
|
224
|
+
|
|
225
|
+
## Updates
|
|
226
|
+
|
|
227
|
+
The npm tag `latest` is a label, not an updater: installing a package pins the
|
|
228
|
+
version on disk, and nothing moves until something moves it. Two switches, both
|
|
229
|
+
about this install (not about a topic, because it is the install that updates):
|
|
230
|
+
|
|
231
|
+
| Command | What it does |
|
|
232
|
+
|---|---|
|
|
233
|
+
| `/update` | one line: what runs here, what is published, which switches are set |
|
|
234
|
+
| `/update on` | tell me about new releases: one message per version, checked once a day |
|
|
235
|
+
| `/update off` | stop telling me; nothing installs, nothing moves |
|
|
236
|
+
| `/update auto` | besides telling me, install the release by itself (checked hourly) |
|
|
237
|
+
| `/update confirm` | install the new release now, by hand |
|
|
238
|
+
|
|
239
|
+
Nothing above installs except `confirm` and `auto`, and even those only change the
|
|
240
|
+
files: the running process keeps its old modules until `/restart confirm`, so a
|
|
241
|
+
bad release never lands mid-chat. `confirm` and `auto` copy the replaced files to
|
|
242
|
+
`update-backup-<date>` and print the path; copying that folder back is the way to
|
|
243
|
+
roll back, with no state to undo.
|
|
244
|
+
|
|
245
|
+
`/subscribe on|off` says the same thing as `/update on|off`, for people who do not
|
|
246
|
+
want to read `/update` first. It is not in the Telegram menu on purpose.
|
|
247
|
+
|
|
248
|
+
There are no notices about failures. The bridge cannot decide what counts as one
|
|
249
|
+
for you, and "something failed" that nobody can act on is noise; errors stay in
|
|
250
|
+
the chat where they happened, under `/doctor` and `/logs errors`.
|
|
251
|
+
|
|
252
|
+
## How it works
|
|
253
|
+
|
|
254
|
+
```
|
|
255
|
+
Telegram → bridge.mjs → dsh --profile headless --json → reply
|
|
256
|
+
│
|
|
257
|
+
├─ pending/ journal + ack (messages are not lost)
|
|
258
|
+
├─ per-topic queue (turns in topics run in parallel)
|
|
259
|
+
├─ progress + buttons (you can see the work is going)
|
|
260
|
+
└─ fail-fast on quota (free models as a fallback)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
The bridge is a single process with long polling. Each turn spawns a separate
|
|
264
|
+
CLI process that exits after the answer, so "no DSH process" between
|
|
265
|
+
turns is normal, not a failure.
|
|
266
|
+
|
|
267
|
+
### Steering during a turn
|
|
268
|
+
|
|
269
|
+
If you write in a topic while a turn is still running, the message does not queue
|
|
270
|
+
behind it: the bridge drops the task into `~/.dsh/tg-bridge/steer/`, the `dsh-steer-inbox`
|
|
271
|
+
plugin hands it to the live agent on its next step, and the agent immediately replies with a short
|
|
272
|
+
line in the chat: what it is doing now and where it put the addition. If the agent stays silent
|
|
273
|
+
for 90 seconds, the bridge writes one neutral line itself so there is no silence.
|
|
274
|
+
|
|
275
|
+
Attachments work the same way. A voice note is transcribed first and its transcript is echoed in
|
|
276
|
+
the chat, then the text is steered into the running turn; a photo or a file is downloaded to a
|
|
277
|
+
local path and that path is steered, exactly as an idle turn would hand it over.
|
|
278
|
+
|
|
279
|
+
What each kind of attachment becomes inside a running turn:
|
|
280
|
+
|
|
281
|
+
| Sent | Inside the turn |
|
|
282
|
+
|---|---|
|
|
283
|
+
| voice note, audio file, audio sent as a document | transcript, echoed as `🎤 …` before the steer |
|
|
284
|
+
| small text file (`.md`, `.json`, `.csv`, `.py`, `.log`, … up to 60 KB) | the content itself between `<file>` markers — no tool call needed |
|
|
285
|
+
| PDF, archive, binary, anything bigger | its local path under `~/.dsh/tg-bridge/inbox/` |
|
|
286
|
+
| video, video note, animation | its path; the agent can pull frames or sound out with ffmpeg |
|
|
287
|
+
| photo | its path plus one honest line; the turn reads it with `read_image`, and says so in one line if it cannot |
|
|
288
|
+
|
|
289
|
+
A caption does not turn the attachment into a text-only message: it is folded into the same
|
|
290
|
+
hand-over, so "why did this fail" plus a `.log` file arrives as one steer.
|
|
291
|
+
|
|
292
|
+
An album is one request, not ten. Telegram delivers it as one update per file, all sharing a
|
|
293
|
+
`media_group_id`; the bridge collects the group (1.2 s of quiet after the last item, at most
|
|
294
|
+
4 s) and hands it over once — one steer into a running turn, one turn when the topic is idle.
|
|
295
|
+
|
|
296
|
+
### When a turn hits the time ceiling
|
|
297
|
+
|
|
298
|
+
`turnTimeoutMs` (default 30 min, this install 75) is a ceiling, not a target: if a turn reaches
|
|
299
|
+
it, the bridge stops it with `⏱` instead of letting one runaway loop own the topic for hours.
|
|
300
|
+
Nothing is lost — the session and every file the turn produced stay in place — so the message
|
|
301
|
+
carries **⏵ Continue**, which asks the agent to check the state and go on from where it stopped.
|
|
302
|
+
That is deliberately not the same as **Retry**, which would redo the whole task from the start.
|
|
303
|
+
|
|
304
|
+
This needs the plugin from this repository:
|
|
305
|
+
|
|
306
|
+
```bash
|
|
307
|
+
dsh plugin --profile headless add link:<path-to-repository>/plugin/steer-inbox
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
and a line in `~/.dsh/profiles/headless/cordis.patch.yml`:
|
|
311
|
+
|
|
312
|
+
```yaml
|
|
313
|
+
- insert:
|
|
314
|
+
- id: steer-inbox
|
|
315
|
+
name: 'dsh-steer-inbox'
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
The bridge checks the profile itself: if the line is missing, it does not write the task
|
|
319
|
+
(it would just expire) and behaves as before, queueing the message.
|
|
320
|
+
|
|
321
|
+
### Live thoughts and reasoning
|
|
322
|
+
|
|
323
|
+
Two things land in the same progress message, and neither sends a chat message of its own.
|
|
324
|
+
|
|
325
|
+
**The model's reasoning.** Every `thinking` block the CLI commits is folded into one
|
|
326
|
+
Telegram `<blockquote expandable>`: collapsed it is a single line, tapped it opens the whole
|
|
327
|
+
trail of the turn, and it stays there after the turn ends — the same way the desktop app shows
|
|
328
|
+
a reasoning section you can expand. The block is written once, in the final edit of the turn,
|
|
329
|
+
and never touched again: Telegram re-collapses an expanded block on every edit of its message,
|
|
330
|
+
which used to yank the chat away from a half-read paragraph. While the turn runs the message
|
|
331
|
+
only gets a counter (`🧠 Размышления · 4821`) and the last three steps, so the live edits stay
|
|
332
|
+
short. Escaped, and trimmed to its tail when a turn thinks longer than a message can hold; the
|
|
333
|
+
panel never exceeds one message. A cut block says `… · начало скрыто · /thoughts file`, which
|
|
334
|
+
sends the whole log as a document. If the API refuses the markup, the same content is retried
|
|
335
|
+
as plain text.
|
|
336
|
+
|
|
337
|
+
**The steps.** Three calls fit inline. A turn that makes more moves its complete step list into
|
|
338
|
+
a second collapsed block, added in that same final edit, so "what did it actually run" is one
|
|
339
|
+
tap away instead of a count.
|
|
340
|
+
|
|
341
|
+
**The agent's own notes.** The agent can add a short decision trail:
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
node ~/.dsh/tg-bridge/say.mjs --thought "checking why the watchdog fired twice"
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
The note is appended to `~/.dsh/tg-bridge/thoughts/<chat>_<thread>.jsonl`; the progress
|
|
348
|
+
message shows the last two as `💭` lines. The command needs no ids: it falls back to the
|
|
349
|
+
newest turn's thought file, because tool shells do not inherit the bridge environment.
|
|
350
|
+
`--thought` never sends a Telegram message on its own.
|
|
351
|
+
|
|
352
|
+
A decision the person must know before the turn ends — a release shipped, a cause found,
|
|
353
|
+
a blocker — goes to the chat as one plain line instead:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
node ~/.dsh/tg-bridge/say.mjs --note "1.10.1 is on npm; restart to load it"
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
`--note` sends a real message and takes the same no-ids fallback as `--thought`. The split
|
|
360
|
+
is deliberate: `--thought` is the working trail inside the progress message, `--note` is the
|
|
361
|
+
short line that changes what the reader expects to happen next. The progress message itself
|
|
362
|
+
opens with the request echoed back (`⏳ Принял: «…» · 3 с`), so the first thing the person
|
|
363
|
+
sees after sending names their task rather than a generic spinner.
|
|
364
|
+
|
|
365
|
+
`/reasoning` is the switch for the 💭 mechanism. It is on by default: every turn carries a
|
|
366
|
+
short instruction to leave one line at each decision point (task clear, cause found, risky
|
|
367
|
+
change, result checked). `/reasoning off` drops the instruction and the `💭` lines for that
|
|
368
|
+
topic — useful when the step list is all you want. The setting lives in `state.json` per topic,
|
|
369
|
+
so a chatty research topic and a terse deploy topic can differ.
|
|
370
|
+
|
|
371
|
+
The reasoning block itself is model output; `/thoughts` is what reads it back:
|
|
372
|
+
|
|
373
|
+
- `/thoughts` — the last turn as a message, in parts, deleted after a few minutes;
|
|
374
|
+
- `/thoughts file` — the **whole** last turn as `reasoning-<date>-file.md`, sent as a document
|
|
375
|
+
(a five-hour turn is tens of thousands of characters, which no chat message can hold);
|
|
376
|
+
- `/thoughts all` — every turn of the session in one file (a long session is a couple of MB);
|
|
377
|
+
- `/thoughts off` / `on` — keep the block out of the turn panel (the panel then shows
|
|
378
|
+
`🧠 Размышления · N · /thoughts file`) or bring it back.
|
|
379
|
+
|
|
380
|
+
The log is built from the session file on demand, so nothing is duplicated while a turn runs.
|
|
381
|
+
Files land in `~/.dsh/tg-bridge/thoughts/` and older ones are pruned after a week.
|
|
382
|
+
|
|
383
|
+
### Profiles per topic
|
|
384
|
+
|
|
385
|
+
The desktop app lets you build several profiles for different kinds of work, each with its own
|
|
386
|
+
plugin set and model. The same switch works from a topic:
|
|
387
|
+
|
|
388
|
+
```
|
|
389
|
+
/profile current profile, available ones, hints
|
|
390
|
+
/profile research run this topic's turns on another profile
|
|
391
|
+
/profile new research from web
|
|
392
|
+
create a profile from a shipped template and bind it
|
|
393
|
+
/profile default back to the install default
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
A new profile is written by `dsh <name> --from-default-profile <template> --dump-config`, so
|
|
397
|
+
nothing boots and no plugin is loaded at creation time; dependencies are installed by the
|
|
398
|
+
profile's first turn. The binding is per topic: `/model` then edits that profile's model, and
|
|
399
|
+
`/plugins` manages that profile's rows, and `/plugins search <word>` lists what the npm registry
|
|
400
|
+
has with the `dsh-plugin` keyword — the desktop app's plugin browser, from the chat. Each result
|
|
401
|
+
carries a plus button that runs `/plugins add <name>`.
|
|
402
|
+
|
|
403
|
+
### Goals and tasks
|
|
404
|
+
|
|
405
|
+
A topic carries its own goal and checklist, so the aim survives `/new`, a
|
|
406
|
+
restart and a different session:
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
/goal ship the release set or replace the goal
|
|
410
|
+
/goal show the goal and the checklist
|
|
411
|
+
/task write the migration add a task
|
|
412
|
+
/task done 2 tick it off
|
|
413
|
+
/task edit 2 shorter words rewrite it in place, same number
|
|
414
|
+
/task rm 2 remove it
|
|
415
|
+
/goal reopen open a closed goal again
|
|
416
|
+
/goal done close the goal (all tasks done)
|
|
417
|
+
/goal clear delete the goal and its tasks
|
|
418
|
+
```
|
|
419
|
+
|
|
420
|
+
The bridge prepends the goal and the list to every turn, with the exact command
|
|
421
|
+
that updates it (`goal.mjs`). The agent ticks tasks as it finishes them, and the
|
|
422
|
+
next turn sees the new state. The bridge is the only writer of `state.json`: the
|
|
423
|
+
agent drops a job file into `goal-jobs/` and the bridge applies it, so there is
|
|
424
|
+
no lock race and no lost update.
|
|
425
|
+
|
|
426
|
+
## Security
|
|
427
|
+
|
|
428
|
+
- `config.json`, `state.json`, `pending/`, logs are in `.gitignore` and never
|
|
429
|
+
end up in the repository.
|
|
430
|
+
- The token is stored in the DSH credentials store, not in code or config.
|
|
431
|
+
- The bridge only replies to ids in `allowedUserIds`.
|
|
432
|
+
|
|
433
|
+
## Documentation
|
|
434
|
+
|
|
435
|
+
- [docs/TELEGRAM-SETUP.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/TELEGRAM-SETUP.md): BotFather settings, group and bot permissions
|
|
436
|
+
- [docs/ROADMAP.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/ROADMAP.md): what comes next
|
|
437
|
+
- [docs/UX-ANALYSIS.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/UX-ANALYSIS.md): interactive UX review
|
|
438
|
+
- [docs/COST.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/COST.md): what one turn costs and how to reduce it
|
|
439
|
+
- [docs/CHANGELOG.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/CHANGELOG.md): change history
|
|
440
|
+
- [docs/RELEASE-CRITERIA.md](https://github.com/aleksvega/dsh-tg-bridge/blob/master/docs/RELEASE-CRITERIA.md): release readiness criteria
|
|
441
|
+
|
|
442
|
+
## License
|
|
443
|
+
|
|
444
|
+
MIT, see [LICENSE](LICENSE).
|