dsh-tg-bridge 1.8.1 → 1.9.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/README.md CHANGED
@@ -16,8 +16,8 @@ blocks.
16
16
  - **Project per topic**: `/cd my-app`, and all turns run from that directory.
17
17
  - **Goal and checklist per topic**: `/goal`, `/task`; both survive restarts and are prepended to every turn.
18
18
  - **Live progress**: one edited message per turn — steps, a timer and the cache hit rate, plus
19
- the model's reasoning in a collapsed block you can tap open (no extra messages, the whole
20
- trail stays with the turn).
19
+ the model's reasoning in a collapsed block you can tap open. A long turn adds a second
20
+ collapsed block with every tool call, so the whole run stays in the chat as one message.
21
21
  - **No lost messages**: a journal with acknowledgement and replay.
22
22
  - **Fail-fast**: when the quota runs out it switches to a free model right away.
23
23
  - **`dsh-tg check`**: diagnostics in one command, no changes to the system.
@@ -269,6 +269,9 @@ rate-limits edits), escaped, and trimmed to its tail when a turn thinks longer t
269
269
  can hold; the panel never exceeds one message. If the API refuses the markup, the same content
270
270
  is retried as plain text.
271
271
 
272
+ **The steps.** Three calls fit inline. A turn that makes more moves its complete step list into
273
+ a second collapsed block, so "what did it actually run" is one tap away instead of a count.
274
+
272
275
  **The agent's own notes.** The agent can add a short decision trail:
273
276
 
274
277
  ```bash
package/control.mjs CHANGED
@@ -1066,7 +1066,7 @@ export async function handleControl(ctx) {
1066
1066
  return t(lang, 'ctrl.remind.inDay', { n: Math.round(hours / 24) });
1067
1067
  };
1068
1068
 
1069
- if (!input) {
1069
+ if (!input || input === 'list') {
1070
1070
  if (ahead.length === 0) {
1071
1071
  say([t(lang, 'ctrl.remind.title'), t(lang, 'ctrl.remind.empty'), t(lang, 'ctrl.remind.hint')].join('\n'));
1072
1072
  return true;
package/i18n.mjs CHANGED
@@ -19,7 +19,7 @@ const DICT = {
19
19
  'status.failed': 'Turn failed',
20
20
  'status.queued': 'queued',
21
21
  'status.stop': 'Stop',
22
- 'help.body': "Write the task as plain text. Each forum topic is its own session:\n\nWork: /cd \u003cproject\u003e · /new · /stop · /send \u003cfile\u003e · /seed \u003ctext\u003e\nGoals: /goal · /task\nSessions: /status · /sessions [n] · /resume \u003cid\u003e\nAgents: /agents · /agents \u003cid\u003e\nModels: /model · /model \u003cid\u003e · /prices · /thoughts\nTuning: /effort · /permissions · /preset · /plan · /jobs · /remind\nExtensions: /skills · /plugins · /plugin add|remove · /soul\nVersions: /version · /update · /update confirm\nOther: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
22
+ 'help.body': "Write the task as plain text. Each forum topic is its own session:\n\nWork: /cd \u003cproject\u003e · /new · /stop · /send \u003cfile\u003e · /seed \u003ctext\u003e\nGoals: /goal · /task\nSessions: /status · /sessions [n] · /resume \u003cid\u003e\nAgents: /agents · /agents set model|depth|filter … @tool\nModels: /model · /model \u003cid\u003e · /prices · /thoughts\nTuning: /effort · /permissions · /preset · /plan · /jobs · /remind\nExtensions: /skills · /plugins · /plugin add|remove · /soul\nVersions: /version · /update · /update confirm\nOther: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
23
23
  'btn.stop': 'Stop',
24
24
  'btn.logs': 'Logs',
25
25
  'btn.retry': 'Retry',
@@ -31,7 +31,8 @@ const DICT = {
31
31
  'msg.transcribing': '🎤 Transcribing…',
32
32
  'status.steps': 'steps',
33
33
  'status.thinking': 'waiting for the model',
34
- 'status.thinkTitle': 'Reasoning',
34
+ 'status.thinkTitle': 'Reasoning',
35
+ 'status.stepsTitle': 'Steps',
35
36
  'status.thinkCut': 'earlier reasoning hidden',
36
37
  'err.timeout': 'no activity for {min} min — turn interrupted',
37
38
  'err.generic': 'something went wrong',
@@ -313,7 +314,7 @@ const DICT = {
313
314
  'bridge.cb.denied': 'Denied',
314
315
  'bridge.cb.unknown': 'Unknown button',
315
316
  'ctrl.agents.setUsage': 'Usage:\n/agents set model <id> [@tool]\n/agents set depth <n|default> [@tool]\n/agents set filter none|<tool,tool> [@tool]\nWithout @tool every delegation row changes; @subagent or @subagent_fork picks one.',
316
- 'ctrl.agents.setDone': '✅ {name}: delegation rows written.',
317
+ 'ctrl.agents.setDone': '✅ {name}: delegation written.',
317
318
  'ctrl.agents.setSame': 'Already in that state — nothing to write.',
318
319
  'ctrl.agents.setUnknownModel': 'No model "{model}" in this profile. Available: {list}',
319
320
  'ctrl.agents.setBadDepth': 'Depth must be 1–10, or "default" to follow the host.',
@@ -362,7 +363,7 @@ const DICT = {
362
363
  'ctrl.remind.title': '⏰ Reminders',
363
364
  'ctrl.remind.empty': 'Nothing scheduled.',
364
365
  'ctrl.remind.line': '{n}. {when} ({left}) — {text}',
365
- 'ctrl.remind.hint': 'Add: /remind +15m text · /remind 09:30 text · remove: /remind del 1 · clear: /remind clear',
366
+ 'ctrl.remind.hint': 'List: /remind list · Add: /remind +15m text · /remind 09:30 text · remove: /remind del 1 · clear: /remind clear',
366
367
  'ctrl.remind.added': '⏰ {when} — {text}',
367
368
  'ctrl.remind.delDone': 'Removed reminder {n} ({text}).',
368
369
  'ctrl.remind.delUsage': 'Which one? /remind del <number from the list>.',
@@ -382,7 +383,7 @@ const DICT = {
382
383
  'status.failed': 'Ход не удался',
383
384
  'status.queued': 'в очереди',
384
385
  'status.stop': 'Стоп',
385
- 'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /task\nСессии: /status · /sessions [n] · /resume \u003cid\u003e\nАгенты: /agents · /agents \u003cid\u003e\nМодели: /model · /model \u003cid\u003e · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /plan · /jobs · /remind\nРасширения: /skills · /plugins · /plugin add|remove · /soul\nВерсии: /version · /update · /update confirm\nПрочее: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
386
+ 'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /task\nСессии: /status · /sessions [n] · /resume \u003cid\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /plan · /jobs · /remind\nРасширения: /skills · /plugins · /plugin add|remove · /soul\nВерсии: /version · /update · /update confirm\nПрочее: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
386
387
  'btn.stop': 'Стоп',
387
388
  'btn.logs': 'Логи',
388
389
  'btn.retry': 'Повторить',
@@ -394,7 +395,8 @@ const DICT = {
394
395
  'msg.transcribing': '🎤 Расшифровываю…',
395
396
  'status.steps': 'шагов',
396
397
  'status.thinking': 'жду модель',
397
- 'status.thinkTitle': 'Размышления',
398
+ 'status.thinkTitle': 'Размышления',
399
+ 'status.stepsTitle': 'Шаги',
398
400
  'status.thinkCut': 'начало скрыто',
399
401
  'err.timeout': 'нет активности {min} мин — ход прерван',
400
402
  'err.generic': 'что-то пошло не так',
@@ -676,7 +678,7 @@ const DICT = {
676
678
  'bridge.cb.denied': 'Запрещено',
677
679
  'bridge.cb.unknown': 'Неизвестная кнопка',
678
680
  'ctrl.agents.setUsage': 'Как:\n/agents set model <id> [@инструмент]\n/agents set depth <n|default> [@инструмент]\n/agents set filter none|<инструмент,инструмент> [@инструмент]\nБез @инструмент меняются все строки делегирования; @subagent или @subagent_fork выбирает одну.',
679
- 'ctrl.agents.setDone': '✅ {name}: строки делегирования записаны.',
681
+ 'ctrl.agents.setDone': '✅ {name}: делегирование записано.',
680
682
  'ctrl.agents.setSame': 'Уже так — записывать нечего.',
681
683
  'ctrl.agents.setUnknownModel': 'В этом профиле нет модели «{model}». Доступны: {list}',
682
684
  'ctrl.agents.setBadDepth': 'Глубина — от 1 до 10, либо «default», чтобы следовать хосту.',
@@ -725,7 +727,7 @@ const DICT = {
725
727
  'ctrl.remind.title': '⏰ Напоминания',
726
728
  'ctrl.remind.empty': 'Ничего не запланировано.',
727
729
  'ctrl.remind.line': '{n}. {when} ({left}) — {text}',
728
- 'ctrl.remind.hint': 'Добавить: /remind +15m текст · /remind 09:30 текст · убрать: /remind del 1 · очистить: /remind clear',
730
+ 'ctrl.remind.hint': 'Список: /remind list · добавить: /remind +15m текст · /remind 09:30 текст · убрать: /remind del 1 · очистить: /remind clear',
729
731
  'ctrl.remind.added': '⏰ {when} — {text}',
730
732
  'ctrl.remind.delDone': 'Напоминание {n} убрано ({text}).',
731
733
  'ctrl.remind.delUsage': 'Какое? /remind del <номер из списка>.',
@@ -745,7 +747,7 @@ const DICT = {
745
747
  'status.failed': '运行失败',
746
748
  'status.queued': '排队中',
747
749
  'status.stop': '停止',
748
- 'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /task\n会话: /status · /sessions [n] · /resume \u003cid\u003e\n智能体: /agents · /agents \u003cid\u003e\n模型: /model · /model \u003cid\u003e · /prices · /thoughts\n调优: /effort · /permissions · /preset · /plan · /jobs · /remind\n扩展: /skills · /plugins · /plugin add|remove · /soul\n版本: /version · /update · /update confirm\n其他: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
750
+ 'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /task\n会话: /status · /sessions [n] · /resume \u003cid\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /prices · /thoughts\n调优: /effort · /permissions · /preset · /plan · /jobs · /remind\n扩展: /skills · /plugins · /plugin add|remove · /soul\n版本: /version · /update · /update confirm\n其他: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
749
751
  'btn.stop': '停止',
750
752
  'btn.logs': '日志',
751
753
  'btn.retry': '重试',
@@ -757,7 +759,8 @@ const DICT = {
757
759
  'msg.transcribing': '🎤 正在转写…',
758
760
  'status.steps': '步',
759
761
  'status.thinking': '等待模型',
760
- 'status.thinkTitle': '推理',
762
+ 'status.thinkTitle': '推理',
763
+ 'status.stepsTitle': '步骤',
761
764
  'status.thinkCut': '前文已省略',
762
765
  'err.timeout': '{min} 分钟无活动 — 已中断',
763
766
  'err.generic': '出现错误',
@@ -1039,7 +1042,7 @@ const DICT = {
1039
1042
  'bridge.cb.denied': '已拒绝',
1040
1043
  'bridge.cb.unknown': '未知按钮',
1041
1044
  'ctrl.agents.setUsage': '用法:\n/agents set model <id> [@工具]\n/agents set depth <n|default> [@工具]\n/agents set filter none|<工具,工具> [@工具]\n省略 @工具 则改动全部委派行;@subagent 或 @subagent_fork 只改一行。',
1042
- 'ctrl.agents.setDone': '✅ {name}:委派行已写入。',
1045
+ 'ctrl.agents.setDone': '✅ {name}:委派设置已写入。',
1043
1046
  'ctrl.agents.setSame': '已经是这样——无需写入。',
1044
1047
  'ctrl.agents.setUnknownModel': '此配置档没有模型「{model}」。可用:{list}',
1045
1048
  'ctrl.agents.setBadDepth': '深度为 1–10,或 default 表示跟随宿主。',
@@ -1088,7 +1091,7 @@ const DICT = {
1088
1091
  'ctrl.remind.title': '⏰ 提醒',
1089
1092
  'ctrl.remind.empty': '没有安排。',
1090
1093
  'ctrl.remind.line': '{n}. {when}({left})— {text}',
1091
- 'ctrl.remind.hint': '添加:/remind +15m 文本 · /remind 09:30 文本 · 删除:/remind del 1 · 清空:/remind clear',
1094
+ 'ctrl.remind.hint': '列表:/remind list · 添加:/remind +15m 文本 · /remind 09:30 文本 · 删除:/remind del 1 · 清空:/remind clear',
1092
1095
  'ctrl.remind.added': '⏰ {when} — {text}',
1093
1096
  'ctrl.remind.delDone': '已删除提醒 {n}({text})。',
1094
1097
  'ctrl.remind.delUsage': '哪一个?/remind del <列表中的编号>。',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.8.1",
3
+ "version": "1.9.1",
4
4
  "description": "Telegram bridge for DeepSeek Harness: text, voice, photos and project-per-topic sessions without opening the desktop app",
5
5
  "type": "module",
6
6
  "main": "plugin-bridge.mjs",
package/panel.mjs CHANGED
@@ -18,18 +18,28 @@ function secondsUnit(lang) {
18
18
  return lang === 'en' ? 's' : lang === 'zh' ? '秒' : 'с';
19
19
  }
20
20
 
21
- /** How much of the reasoning stream the panel keeps; the tail is the useful end. */
22
- const THINKING_MAX = 2400;
21
+ /** How much of the reasoning stream a block keeps; the tail is the useful end. */
22
+ const THINKING_MAX = 2000;
23
23
  /** Telegram rejects a message over 4096 characters; the rest needs room too. */
24
24
  const PANEL_MAX = 3900;
25
+ /** Steps stay short lines, so a long turn can show all of them. */
26
+ const STEPS_MAX = 1600;
27
+
28
+ /** Collapse `text` to its tail, saying so when something was dropped. */
29
+ function tailOf(text, room) {
30
+ if (text.length <= room) return { text, cut: false };
31
+ return { text: text.slice(-room), cut: true };
32
+ }
25
33
 
26
34
  /**
27
35
  * One status message per turn, rewritten in place.
28
36
  *
29
- * `thinking` is the model's reasoning for this turn. It sits inside Telegram's
30
- * native `<blockquote expandable>`: collapsed it is one line, tapped it shows
31
- * the whole trail, and it never floods the chat. `plain` is the same content
32
- * without markup, for the fallback path when the parser refuses a message.
37
+ * Long content lives in Telegram's native `<blockquote expandable>`: collapsed it
38
+ * is one line, tapped it shows the whole trail, and it never floods the chat. Two
39
+ * blocks at most — the model's reasoning and, when a turn makes more than three
40
+ * tool calls, the full step list — so the chat still reads as one message per
41
+ * turn. `plain` is the same content without markup, for the fallback path when
42
+ * the parser refuses a message and for `plainText` installs.
33
43
  */
34
44
  export function progressPanel({
35
45
  lang = 'ru', seconds = 0, final = false, steps = [], thoughts = [], thinking = '', cache = '',
@@ -38,33 +48,38 @@ export function progressPanel({
38
48
  ? `✅ ${t(lang, 'status.done')} · ${seconds} ${secondsUnit(lang)}`
39
49
  : `⏳ ${t(lang, 'status.working')}… ${seconds} ${secondsUnit(lang)}`;
40
50
  const mind = thoughts.map((line) => `💭 ${line}`);
41
- // Three recent steps is enough to see the shape of the work; six lines of
42
- // shell commands read as noise on a phone.
43
- const tail = steps.slice(-3).map((line) => `• ${line}`);
44
- const more = steps.length > 3 ? t(lang, 'status.more', { n: steps.length - 3 }) : '';
45
- const fixed = [head, ...mind, ...tail, more, cache].filter(Boolean).join('\n').length;
46
- const room = Math.max(400, Math.min(THINKING_MAX, PANEL_MAX - fixed - 80));
47
- let body = String(thinking || '').trim();
48
- let cut = false;
49
- if (body.length > room) {
50
- body = body.slice(-room);
51
- cut = true;
52
- }
53
- const label = `🧠 ${t(lang, 'status.thinkTitle')}${cut ? ` · ${t(lang, 'status.thinkCut')}` : ''}`;
51
+ const base = [head, ...mind, cache].filter(Boolean).join('\n').length;
52
+
53
+ // Up to three steps fit inline and read better there; a longer turn would turn
54
+ // the panel into a wall of shell commands, so its steps move into a block.
55
+ const many = steps.length > 3;
56
+ const inline = many ? [] : steps.map((line) => `• ${line}`);
57
+ const stepsRoom = Math.max(0, Math.min(STEPS_MAX, PANEL_MAX - base - 1200));
58
+ const all = many
59
+ ? tailOf(steps.map((line) => `• ${line}`).join('\n'), stepsRoom)
60
+ : { text: '', cut: false };
61
+ const stepsLabel = `🛠 ${t(lang, 'status.stepsTitle')} · ${steps.length}`
62
+ + `${all.cut ? ` · ${t(lang, 'status.thinkCut')}` : ''}`;
63
+
64
+ const fixed = base + inline.join('\n').length + all.text.length + 120;
65
+ const room = Math.max(400, Math.min(THINKING_MAX, PANEL_MAX - fixed));
66
+ const body = tailOf(String(thinking || '').trim(), room);
67
+ const thinkLabel = `🧠 ${t(lang, 'status.thinkTitle')}${body.cut ? ` · ${t(lang, 'status.thinkCut')}` : ''}`;
68
+
54
69
  const html = [
55
70
  head,
56
71
  ...mind.map((line) => escapeHtml(line)),
57
- body ? `<blockquote expandable>${escapeHtml(label)}\n${escapeHtml(body)}</blockquote>` : '',
58
- ...tail.map((line) => escapeHtml(line)),
59
- escapeHtml(more),
72
+ body.text ? `<blockquote expandable>${escapeHtml(thinkLabel)}\n${escapeHtml(body.text)}</blockquote>` : '',
73
+ ...inline.map((line) => escapeHtml(line)),
74
+ all.text ? `<blockquote expandable>${escapeHtml(stepsLabel)}\n${escapeHtml(all.text)}</blockquote>` : '',
60
75
  escapeHtml(cache),
61
76
  ].filter(Boolean).join('\n');
62
77
  const plain = [
63
78
  head,
64
79
  ...mind,
65
- body ? `${label}\n${body}` : '',
66
- ...tail,
67
- more,
80
+ body.text ? `${thinkLabel}\n${body.text}` : '',
81
+ ...inline,
82
+ all.text ? `${stepsLabel}\n${all.text}` : '',
68
83
  cache,
69
84
  ].filter(Boolean).join('\n');
70
85
  return { html, plain };