dsh-tg-bridge 1.14.0 → 1.15.1

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/QUICKSTART.md CHANGED
@@ -38,7 +38,7 @@ Optional but recommended in the same chat:
38
38
  ## 2. Tell the bridge about the token
39
39
 
40
40
  ```bash
41
- npx dsh-tg@latest init --token <the token> --user <your id>
41
+ npx dsh-tg-bridge@latest init --token <the token> --user <your id>
42
42
  ```
43
43
 
44
44
  - **`<the token>`** — the line from step 1, in quotes if your shell needs it.
@@ -54,12 +54,13 @@ would write without writing.
54
54
  ## 3. Start the bridge
55
55
 
56
56
  ```bash
57
- npx dsh-tg@latest setup
57
+ npx dsh-tg-bridge@latest setup
58
58
  ```
59
59
 
60
- This registers the bridge so it starts with your session and runs it once. Watch
61
- for `bridge started` at the end. A failure here is almost always one of the three
62
- things in [If it does not work](#if-it-does-not-work).
60
+ This registers the bridge so it starts with your session and runs it once. It
61
+ ends with `ok new bridge pid <number>` — that number is the running bridge. A
62
+ failure here is almost always one of the three things in [If it does not
63
+ work](#if-it-does-not-work).
63
64
 
64
65
  ## 4. Say hello
65
66
 
@@ -83,10 +84,11 @@ Everything below is typed in the chat, not in a terminal.
83
84
  | See what it is doing | it posts a live progress message; `/thoughts` toggles the 💭 notes |
84
85
  | A plan you can tick off | `/goal <what done looks like>`, then `/task <step>`, then `/tasks` to tap items |
85
86
  | Stop a long answer | `/stop` |
86
- | Update the bridge | `/update` shows where you stand. By default it tells you once about a new release; `/update confirm` installs it and `/restart confirm` loads it. `/update off` stays on the version you have. |
87
+ | Tell me about new versions, or stop | /update on / /update off — neither one installs anything |
88
+ | Install an update, then load it | /update confirm, then /restart confirm |
87
89
  | Everything it can do | `/help` |
88
90
 
89
- `/lang` pins the reply language; without it the bridge answers in the language you
91
+ `/lang` pins the reply language; without it the bridge answers in the language your
90
92
  write in (Russian, Chinese, otherwise English).
91
93
 
92
94
  ---
@@ -95,14 +97,14 @@ write in (Russian, Chinese, otherwise English).
95
97
 
96
98
  | What you see | What it means |
97
99
  |---|---|
98
- | Nothing at all after `hi` | The id in `config.json` is not yours, or the bridge is not running: `npx dsh-tg@latest setup` again and read its output. |
100
+ | Nothing at all after `hi` | The id in `config.json` is not yours, or the bridge is not running: `npx dsh-tg-bridge@latest setup` again and read its output. |
99
101
  | `401 Unauthorized` | The token is wrong or was revoked by BotFather. Run `init` again with a fresh token. |
100
102
  | Works in private chat, silent in a group | Privacy mode is on: `/setprivacy` → Disable, then remove and re-add the bot to the group. |
101
- | `Error [ERR_MODULE_NOT_FOUND]` on start | The package is older than 1.13.1, which shipped without a file it needs. `npm i -g dsh-tg-bridge@latest`. |
102
- | Bot answers in the wrong language | `/lang ru` / `/lang en` / `/lang zh`, or just write in the language you want. |
103
+ | `Error [ERR_MODULE_NOT_FOUND]` on start | The running copy is older than the files it imports. A global install never updates itself: `npm i -g dsh-tg-bridge@latest`, then `/restart confirm` in the chat. With `npx` this cannot happen — `npx dsh-tg-bridge@latest` fetches the newest release on every launch. |
104
+ | Bot answers in the wrong language | `/lang ru` / `/lang en` / `/lang zh` — one command pins it for the topic. |
103
105
  | Two answers to one message | Another copy of the bridge is running: `/status` shows the pid, kill the duplicate. |
104
106
 
105
- Still stuck: `/doctor` in the chat, or `npx dsh-tg@latest check` in a
107
+ Still stuck: `/doctor` in the chat, or `npx dsh-tg-bridge@latest check` in a
106
108
  terminal — both print what is missing and how to fix it.
107
109
 
108
110
  ---
@@ -121,10 +123,10 @@ An agent helping a person needs three answers, then can do the rest:
121
123
  Then:
122
124
 
123
125
  ```bash
124
- npx dsh-tg@latest check # what is missing right now
125
- npx dsh-tg@latest init --token <token> --user <id> [--cwd <path>] [--dry-run]
126
- npx dsh-tg@latest setup # register autostart and start
127
- npx dsh-tg@latest menu # push the command menu to Telegram
126
+ npx dsh-tg-bridge@latest check # what is missing right now
127
+ npx dsh-tg-bridge@latest init --token <token> --user <id> [--cwd <path>] [--dry-run]
128
+ npx dsh-tg-bridge@latest setup # register autostart and start
129
+ npx dsh-tg-bridge@latest menu # push the command menu to Telegram
128
130
  ```
129
131
 
130
132
  Verify with a real message, not with logs: ask the person to send `hi` and wait
package/README.md CHANGED
@@ -27,7 +27,7 @@ a bot that answers, one step at a time.
27
27
  `/agentset off` returns it. Four built-in sets ship read-only and can be copied.
28
28
  - **Fail-fast**: when the quota runs out it switches to a free model right away.
29
29
  - **`dsh-tg check`**: diagnostics in one command, no changes to the system.
30
- - **Languages**: menus and service messages in `en`, `ru`, `zh`; `/lang` switches the topic language, a new user gets theirs from the Telegram `language_code` (anything outside ru/zh → `en`).
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
31
  - **"Stop"/"Retry" buttons, tool confirmations**: right in the message, no commands to type.
32
32
 
33
33
  ## Requirements
@@ -58,7 +58,7 @@ can be listed next to them:
58
58
 
59
59
  ## Languages
60
60
 
61
- - Menus (`/` in chat): three sets, `ru` by default, plus `en` and `zh`.
61
+ - Menus (`/` in chat): three sets, `ru` by default, plus `en` and `zh`; a client whose locale matches neither gets the Russian set.
62
62
  - Topic language: `/lang en|ru|zh`; stored in `state.json` and survives a restart.
63
63
  - A new user gets the language from the Telegram `language_code`; anything that is not `ru`/`zh` → `en`.
64
64
  - Translated so far: menus, the start message, turn status, errors, `/cd`, `/new`, `/stop`, `/lang`,
@@ -179,7 +179,7 @@ Send the bot:
179
179
  | `/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 |
180
180
  | `/help` | commands grouped by category |
181
181
  | `/cd my-app` | topic bound to the project |
182
- | `/prices` | model prices and the cost of the current one |
182
+ | `/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 |
183
183
 
184
184
  ## Commands
185
185
 
@@ -196,37 +196,57 @@ Extensions: /skills · /plugins · /plugin disable|enable <id> · /soul
196
196
  Updates: /version · /update · /update confirm · /update on|off|check|auto · /subscribe on|off
197
197
  Diagnostics: /doctor · /logs [errors|N|text]
198
198
  Service: /app · /restart · /help
199
+ Settings: /settings — the same switches as buttons, grouped in four tabs
199
200
  Display: /lang · /reasoning on|off · /thoughts
200
201
  ```
201
202
 
202
- Every command answers `/help` in the chat, in the language you write in. The
203
- Telegram menu shows the same list, minus `/subscribe`: it is one line, and a
204
- person who turns it off should not have to find it in a menu again.
203
+ ### Settings as a card
204
+
205
+ `/settings` draws the same switches that the commands set, in one message with
206
+ four tabs: what the bot says, who answers and how hard it works, new releases,
207
+ and the health checks. Each row shows what the setting is now and what a tap
208
+ would change it to. A tap runs the command a person would have typed
209
+ (`/reasoning off`, `/update on`), so the card cannot disagree with the command:
210
+ it is a view of them. After the change the card collapses into one plain line —
211
+ delete it and the chat is back to what it was.
212
+
213
+ Nothing on the card is only available on the card. `/settings` is for people who
214
+ would rather press a labelled button than remember which of `/effort`,
215
+ `/preset` and `/agentset` changes what.
216
+
217
+ Every command answers `/help` in the chat, in the language you write in: a
218
+ message written in Cyrillic or Han characters switches the topic to Russian or
219
+ Chinese even when the phone's menu is set to another language, and `/lang`
220
+ pins a choice above that. The Telegram menu shows the same list, minus
221
+ `/subscribe`: it is one line, and a person who turns it off should not have to
222
+ find it in a menu again.
205
223
 
206
224
  ## Updates
207
225
 
208
226
  The npm tag `latest` is a label, not an updater: installing a package pins the
209
- version on disk, and nothing moves until something moves it. Three modes, one
210
- per install (a global setting, since it is the install that updates, not a
211
- topic):
227
+ version on disk, and nothing moves until something moves it. Two switches, both
228
+ about this install (not about a topic, because it is the install that updates):
212
229
 
213
- | `/update …` | What happens |
230
+ | Command | What it does |
214
231
  |---|---|
215
- | *(none)* | one line: what runs here, what is published, which mode is set |
216
- | `check` (default) | one message per new release, at most once a day of checking |
217
- | `auto` | the new release is fetched and installed by itself; `/restart confirm` loads it |
218
- | `off` | no notices, no checks; `/version` still reports what is published |
219
- | `confirm` | install now, keeping a copy of the old files in `update-backup-<date>` |
220
-
221
- In every mode the running process keeps its modules until `/restart confirm`,
222
- so a bad release never arrives in the middle of a chat. `/update off` pins the
223
- install to the version it runs; `npx dsh-tg@latest setup` is how you follow
224
- releases again.
225
-
226
- Failure notices are not a thing here on purpose: the bridge cannot report a bug
227
- to its own author, and a message about "something failed" that nobody can act on
228
- is noise. What it does send is the release notice above, and only to the chat
229
- that last ran a turn.
232
+ | `/update` | one line: what runs here, what is published, which switches are set |
233
+ | `/update on` | tell me about new releases: one message per version, checked once a day |
234
+ | `/update off` | stop telling me; nothing installs, nothing moves |
235
+ | `/update auto` | besides telling me, install the release by itself (checked hourly) |
236
+ | `/update confirm` | install the new release now, by hand |
237
+
238
+ Nothing above installs except `confirm` and `auto`, and even those only change the
239
+ files: the running process keeps its old modules until `/restart confirm`, so a
240
+ bad release never lands mid-chat. `confirm` and `auto` copy the replaced files to
241
+ `update-backup-<date>` and print the path; copying that folder back is the way to
242
+ roll back, with no state to undo.
243
+
244
+ `/subscribe on|off` says the same thing as `/update on|off`, for people who do not
245
+ want to read `/update` first. It is not in the Telegram menu on purpose.
246
+
247
+ There are no notices about failures. The bridge cannot decide what counts as one
248
+ for you, and "something failed" that nobody can act on is noise; errors stay in
249
+ the chat where they happened, under `/doctor` and `/logs errors`.
230
250
 
231
251
  ## How it works
232
252
 
package/bot-menu.mjs CHANGED
@@ -45,13 +45,14 @@ const COMMANDS = [
45
45
  { command: 'models', description: 'Все модели профиля и цены' },
46
46
  { command: 'skills', description: 'Скиллы: список или текст одного' },
47
47
  { command: 'soul', description: 'Персона: показать или задать' },
48
- { command: 'plugins', description: 'Список и управление: add/remove/disable/enable' },
48
+ { command: 'plugins', description: 'Список и включение: disable/enable (add/remove — /plugin)' },
49
49
  { command: 'plugin', description: 'Один плагин: /plugin disable <id>' },
50
50
  { command: 'app', description: 'Приложение DSH, не мост: /app restart confirm' },
51
51
  { command: 'restart', description: 'Перезапуск моста: /restart confirm' },
52
52
  { command: 'doctor', description: 'Диагностика: мост, сеть, диск, плагины, сессия' },
53
53
  { command: 'logs', description: 'Лог: /logs, /logs 100, /logs errors, /logs file' },
54
54
  { command: 'help', description: 'Все команды и подсказки' },
55
+ { command: 'settings', description: 'Настройки кнопками, по разделам' },
55
56
  { command: 'lang', description: 'Язык интерфейса: en, ru, zh' },
56
57
  { command: 'reasoning', description: 'Заметки по ходу: /reasoning on|off' },
57
58
  { command: 'profile', description: 'Профиль темы: /profile <имя>, /profile new' },
@@ -86,13 +87,14 @@ const COMMANDS_EN = [
86
87
  { command: 'models', description: 'All models of this profile with prices' },
87
88
  { command: 'skills', description: 'Installed skills' },
88
89
  { command: 'soul', description: 'Agent persona' },
89
- { command: 'plugins', description: 'List and manage: add/remove/disable/enable' },
90
+ { command: 'plugins', description: 'List and toggle: disable/enable (add/remove is /plugin)' },
90
91
  { command: 'plugin', description: 'One plugin: /plugin disable <id>' },
91
92
  { command: 'app', description: 'DSH desktop app (not the bridge)' },
92
93
  { command: 'restart', description: 'Restart the bridge: /restart confirm' },
93
94
  { command: 'doctor', description: 'Diagnostics: bridge, network, disk, plugins, session' },
94
95
  { command: 'logs', description: 'Log: /logs, /logs 100, /logs errors, /logs file' },
95
96
  { command: 'help', description: 'All commands and hints' },
97
+ { command: 'settings', description: 'Settings as buttons, grouped by topic' },
96
98
  { command: 'lang', description: 'Interface language: en, ru, zh' },
97
99
  { command: 'reasoning', description: 'Working notes: /reasoning on|off' },
98
100
  { command: 'profile', description: 'Topic profile: /profile <name>, /profile new' },
@@ -127,13 +129,14 @@ const COMMANDS_ZH = [
127
129
  { command: 'models', description: '本配置档的全部模型与价格' },
128
130
  { command: 'skills', description: '已安装的技能' },
129
131
  { command: 'soul', description: '代理人格设定' },
130
- { command: 'plugins', description: '列表与管理:add/remove/disable/enable' },
132
+ { command: 'plugins', description: '列表与开关:disable/enable(add/remove 用 /plugin)' },
131
133
  { command: 'plugin', description: '单个插件:/plugin disable <id>' },
132
134
  { command: 'app', description: 'DSH 桌面应用(不是桥接)' },
133
135
  { command: 'restart', description: '重启桥接:/restart confirm' },
134
136
  { command: 'doctor', description: '诊断:桥接、网络、磁盘、插件、会话' },
135
137
  { command: 'logs', description: '日志:/logs、/logs 100、/logs errors、/logs file' },
136
138
  { command: 'help', description: '全部命令与提示' },
139
+ { command: 'settings', description: '用按钮调设置,按主题分组' },
137
140
  { command: 'lang', description: '界面语言:en、ru、zh' },
138
141
  { command: 'reasoning', description: '工作记录:/reasoning on|off' },
139
142
  { command: 'profile', description: '话题配置档:/profile <名称>,/profile new' },
package/bridge.mjs CHANGED
@@ -43,6 +43,7 @@ import { parseAgentPresets, parsePermissionPresets, parseReasoningEfforts } from
43
43
  import { drainAsetJobs } from './aset-jobs.mjs';
44
44
  import { materialiseProfile, pruneDerived } from './aset-profile.mjs';
45
45
  import { parseCallback } from './aset-schema.mjs';
46
+ import { commandFor, renderSettingsCard, settingsCurrent } from './settings-card.mjs';
46
47
 
47
48
  const HOME = homedir();
48
49
  const DSH_HOME = process.env.DSH_HOME || join(HOME, '.dsh');
@@ -767,6 +768,28 @@ function lastTurnTarget() {
767
768
  return { chatId, threadId: Number(thread) || 0 };
768
769
  }
769
770
 
771
+ /**
772
+ * The forum topic's own title, for a card that has to say where it is.
773
+ *
774
+ * One API call per topic, then cached for the life of the process: a rename
775
+ * shows up on the next restart, which is a fair trade for not calling Telegram
776
+ * on every panel edit. A failure caches the empty name — a card is not worth a
777
+ * retry storm — and the caller renders the id alone.
778
+ */
779
+ const topicNames = new Map();
780
+ function topicName(chatId, threadId) {
781
+ const cacheKey = sessionKey(chatId, threadId);
782
+ if (topicNames.has(cacheKey)) return topicNames.get(cacheKey);
783
+ topicNames.set(cacheKey, '');
784
+ tg('getForumTopic', { chat_id: chatId, message_thread_id: threadId })
785
+ .then((res) => {
786
+ const name = String(res?.name || '').trim();
787
+ if (name) topicNames.set(cacheKey, name);
788
+ })
789
+ .catch(() => {});
790
+ return '';
791
+ }
792
+
770
793
  async function send(chatId, text, threadId = 0, replyTo = 0) {
771
794
  // Who is reading: the topic's language decides even the fallback line, so an
772
795
  // English or Chinese topic never sees a Russian placeholder.
@@ -1064,6 +1087,11 @@ async function startProgress(chatId, threadId, lang = 'ru', task = '', chip = ''
1064
1087
  : '';
1065
1088
  return progressPanel({
1066
1089
  lang,
1090
+ // Two topics run at once in a group, so a card that does not name its topic
1091
+ // is unattributable the moment it scrolls: the same 💭 line in the wrong
1092
+ // place looks like a cross-topic bug, and half the time it is one. The
1093
+ // name comes from Telegram, cached: one API call per topic per process.
1094
+ topic: threadId ? t(lang, 'bridge.progress.topic', { n: threadId, name: topicName(chatId, threadId) || t(lang, 'bridge.progress.topicNoName') }) : '',
1067
1095
  seconds: Math.round((Date.now() - started) / 1000),
1068
1096
  final,
1069
1097
  steps,
@@ -2140,8 +2168,6 @@ async function handleCallback(query) {
2140
2168
  const messageId = query.message?.message_id;
2141
2169
  const threadId = query.message?.message_thread_id ?? 0;
2142
2170
  const key = sessionKey(chatId, threadId);
2143
- // One lookup for every answer: a button press carries no message of its own,
2144
- // so the language comes from the topic the buttons were posted in.
2145
2171
  const lang = resolveLang(state, key, null, config);
2146
2172
  const answer = (text, show = false) =>
2147
2173
  tg('answerCallbackQuery', { callback_query_id: query.id, text, show_alert: show }).catch(() => {});
@@ -2162,6 +2188,14 @@ async function handleCallback(query) {
2162
2188
  const clearKeyboard = () =>
2163
2189
  tg('editMessageReplyMarkup', { chat_id: chatId, message_id: messageId, reply_markup: { inline_keyboard: [] } }).catch(() => {});
2164
2190
 
2191
+ if (data.startsWith('m:')) {
2192
+ // The settings card. Its own answer path, because a tap that redraws or
2193
+ // flips one setting must not go through the defaults below (`clearKeyboard`
2194
+ // would strip the tabs it is about to draw again).
2195
+ await handleCardPress(query, { chatId, messageId, threadId, key, lang });
2196
+ return;
2197
+ }
2198
+
2165
2199
  if (data === 'stop') {
2166
2200
  const killed = killTurn(key);
2167
2201
  await clearKeyboard();
@@ -2264,6 +2298,126 @@ async function handleCallback(query) {
2264
2298
  await answer(t(lang, 'bridge.cb.unknown'));
2265
2299
  }
2266
2300
 
2301
+ /**
2302
+ * Answer a button from the settings card.
2303
+ *
2304
+ * Two kinds of press, one rule: the card is a view of the commands.
2305
+ *
2306
+ * - A tab (`m:agent`) redraws the same message as another page.
2307
+ * - A switch or a door (`m:reasoning:on`, `m:model`) runs the command a person
2308
+ * would have typed, through `handleControl`, and then replaces the card with
2309
+ * one plain line saying what changed. The card does not stay: a menu left in
2310
+ * the history is what the person asked to avoid, and one line is easier to
2311
+ * delete than a twelve-row keyboard.
2312
+ *
2313
+ * The press carries no text of its own, which is why `handleMessage` is not this
2314
+ * path's entry point: it would journal, queue and spend a turn on a tap.
2315
+ */
2316
+ async function handleCardPress(query, ctx) {
2317
+ const { chatId, messageId, threadId, key, lang } = ctx;
2318
+ const data = String(query.data || '');
2319
+ const current = settingsCurrent({ config, state, key, reasoningOf });
2320
+ const updateMode = state.update?.mode || 'check';
2321
+ const wanted = commandFor({ t: (k, vars) => t(lang, k, vars), current, updateMode }, data);
2322
+
2323
+ if (!wanted) {
2324
+ await tg('answerCallbackQuery', { callback_query_id: query.id, text: t(lang, 'settings.card.stale') }).catch(() => {});
2325
+ return;
2326
+ }
2327
+
2328
+ if (wanted.page) {
2329
+ const card = renderSettingsCard({
2330
+ page: wanted.page,
2331
+ t: (k, vars) => t(lang, k, vars),
2332
+ current,
2333
+ updateMode,
2334
+ bound: boundSetOf(key),
2335
+ });
2336
+ await tg('editMessageText', {
2337
+ chat_id: chatId,
2338
+ message_id: messageId,
2339
+ text: card.text,
2340
+ reply_markup: { inline_keyboard: card.keyboard },
2341
+ ...(threadId > 0 ? { message_thread_id: threadId } : {}),
2342
+ }).catch((error) => log(`settings card redraw failed: ${error.message}`));
2343
+ await tg('answerCallbackQuery', { callback_query_id: query.id }).catch(() => {});
2344
+ return;
2345
+ }
2346
+
2347
+ // Run the command. Whatever it answers goes in the log and, by default, not
2348
+ // in the chat: the one line below is the chat's share of this press. Only a
2349
+ // command that failed says more than that.
2350
+ const replies = [];
2351
+ const [head, ...rest] = wanted.command.split(/\s+/);
2352
+ const handled = await handleControl({
2353
+ command: head,
2354
+ arg: rest.join(' '),
2355
+ text: wanted.command,
2356
+ lang,
2357
+ chatId,
2358
+ threadId,
2359
+ key,
2360
+ state,
2361
+ config,
2362
+ activeTurns,
2363
+ saveState,
2364
+ log,
2365
+ send: (text) => {
2366
+ replies.push(String(text ?? ''));
2367
+ return Promise.resolve(0);
2368
+ },
2369
+ reply: (text) => {
2370
+ replies.push(String(text ?? ''));
2371
+ return Promise.resolve(0);
2372
+ },
2373
+ jobs: () => ({ active: [], queued: 0, max: MAX_PARALLEL }),
2374
+ api: tg,
2375
+ sendFile: () => Promise.resolve(0),
2376
+ profile: profileOf(key),
2377
+ prices: () => Promise.resolve(''),
2378
+ }).catch((error) => {
2379
+ log(`settings press ${data} failed: ${error.message}`);
2380
+ replies.push(error.message);
2381
+ return true;
2382
+ });
2383
+
2384
+ const changed = Boolean(wanted.value);
2385
+ const answerText = changed
2386
+ ? t(lang, 'settings.card.changed', { label: wanted.label, value: wanted.value })
2387
+ : t(lang, 'settings.card.door', { command: wanted.command });
2388
+
2389
+ // The card becomes the line: the buttons go away with the text they described.
2390
+ await tg('editMessageText', {
2391
+ chat_id: chatId,
2392
+ message_id: messageId,
2393
+ text: answerText,
2394
+ ...(threadId > 0 ? { message_thread_id: threadId } : {}),
2395
+ }).catch(() => {});
2396
+ await tg('answerCallbackQuery', { callback_query_id: query.id }).catch(() => {});
2397
+
2398
+ // A door that opened to nothing (an unknown set id, a command that is not
2399
+ // allowed here) still has something to say; it goes under the line, once.
2400
+ if (!handled) log(`settings press ${data}: no handler answered`);
2401
+ const notLine = replies.filter(Boolean).filter((r) => r !== answerText);
2402
+ if (notLine.length > 0 && !changed) {
2403
+ await send(chatId, notLine[0], threadId).catch(() => {});
2404
+ }
2405
+ }
2406
+
2407
+ /**
2408
+ * The set bound to this topic, for the card that names it. Read through the
2409
+ * agentset store the commands use, so the card never keeps a second copy.
2410
+ */
2411
+ function boundSetOf(key) {
2412
+ const id = state.agentsets?.[key];
2413
+ if (!id) return null;
2414
+ try {
2415
+ return new AgentsetStore(join(DIR, 'agentsets.json')).load().get(id) || null;
2416
+ } catch {
2417
+ return null;
2418
+ }
2419
+ }
2420
+
2267
2421
  /**
2268
2422
  * Turn runner with an IDLE deadline and a live progress sink.
2269
2423
  *
package/cli.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
2
  // dsh-tg — CLI entrypoint for the Telegram bridge of DeepSeek Harness.
3
3
  //
4
- // npx dsh-tg init --token <T> --user <ID> write config + credentials, no editing
5
- // npx dsh-tg setup install/restart the bridge
6
- // npx dsh-tg check diagnostics only, changes nothing
7
- // npx dsh-tg doctor supervisor report (pid, log tail)
8
- // npx dsh-tg menu register the bot command menu
9
- // npx dsh-tg start run the bridge in the foreground
4
+ // npx dsh-tg-bridge init --token <T> --user <ID> write config + credentials, no editing
5
+ // npx dsh-tg-bridge setup install/restart the bridge
6
+ // npx dsh-tg-bridge check diagnostics only, changes nothing
7
+ // npx dsh-tg-bridge doctor supervisor report (pid, log tail)
8
+ // npx dsh-tg-bridge menu register the bot command menu
9
+ // npx dsh-tg-bridge start run the bridge in the foreground
10
10
  //
11
11
  // The goal of `init` is a cold start with ONE command: the person pastes the
12
12
  // bot token and their numeric id, and nothing else needs hand-editing.
@@ -75,6 +75,12 @@ function flag(name, fallback = '') {
75
75
  const help = `
76
76
  dsh-tg ${pkg.version} — Telegram bridge for DeepSeek Harness
77
77
 
78
+ Install once, then use the short name:
79
+ npm i -g dsh-tg-bridge → dsh-tg setup
80
+ Without installing, run the same things through npx (the PACKAGE name, not the
81
+ command name — \`npx dsh-tg\` alone does not resolve):
82
+ npx dsh-tg-bridge@latest setup
83
+
78
84
  dsh-tg init --token <bot-token> --user <your-id> настроить всё одной командой
79
85
  dsh-tg setup установить и перезапустить мост (setup.log хранит шаги)
80
86
  dsh-tg check диагностика, ничего не меняет
@@ -216,7 +222,7 @@ switch (cmd) {
216
222
  case 'doctor': run('bridge-kick.mjs', rest); break;
217
223
  case 'menu': run('bot-menu.mjs', rest); break;
218
224
  case 'start': run('bridge.mjs', rest, { sync: true }); break;
219
- case 'version': console.log(pkg.version); break;
225
+ case 'version': case '--version': case '-v': console.log(pkg.version); break;
220
226
  case 'help': case '--help': case '-h': console.log(help); break;
221
227
  default:
222
228
  console.error(`unknown command: ${cmd}`);