dsh-tg-bridge 1.25.2 → 1.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -15
- package/bridge.mjs +1 -1
- package/callbacks.mjs +39 -21
- package/commands-registry.mjs +1 -1
- package/control/cmd-agents.mjs +1 -1
- package/control/cmd-bridge.mjs +1 -1
- package/control/cmd-fallback.mjs +17 -6
- package/control/cmd-plugin.mjs +1 -1
- package/control/cmd-session.mjs +1 -1
- package/control/cmd-skills.mjs +1 -1
- package/control/cmd-task.mjs +1 -1
- package/control/cmd-views.mjs +33 -12
- package/control/tasks.mjs +9 -20
- package/control.mjs +2 -2
- package/handle-message.mjs +10 -3
- package/help-explain.mjs +1 -1
- package/i18n/en/core.mjs +26 -8
- package/i18n/en/ctrl.mjs +4 -3
- package/i18n/ru/core.mjs +26 -8
- package/i18n/ru/ctrl.mjs +4 -3
- package/i18n/zh/core.mjs +26 -8
- package/i18n/zh/ctrl.mjs +4 -3
- package/menu-card.mjs +1 -1
- package/notes.mjs +40 -8
- package/package.json +1 -1
- package/progress.mjs +55 -2
- package/settings-card.mjs +77 -10
package/i18n/en/ctrl.mjs
CHANGED
|
@@ -27,13 +27,14 @@ export default {
|
|
|
27
27
|
'ctrl.help.about.subscribe': "Whether this install is announced as a user of the plugin, /subscribe on|off.",
|
|
28
28
|
'ctrl.help.about.settings': "Every switch on one card with pages: /settings, /settings agent, /settings updates.",
|
|
29
29
|
'ctrl.help.about.lang': "The language of the bot in this topic: /lang en|ru|zh.",
|
|
30
|
-
'ctrl.help.about.reasoning': "Working notes in the chat
|
|
30
|
+
'ctrl.help.about.reasoning': "Working notes: off, in the progress card, or as messages in the chat — /reasoning off|card|chat.",
|
|
31
|
+
'ctrl.help.about.pin': "Holds the progress card pinned while its turn runs, so the clock and the steps are one tap away — /pin on|off.",
|
|
31
32
|
'ctrl.help.about.doctor': "Checks the install: bridge, network, disk, plugins, session. Run it first when something breaks.",
|
|
32
33
|
'ctrl.help.about.logs': "The bridge log: /logs, /logs 100, /logs errors, /logs file.",
|
|
33
34
|
'ctrl.help.about.app': "The DSH desktop app, not the bridge: /app restart confirm.",
|
|
34
35
|
'ctrl.help.about.restart': "Restarts the bridge: /restart confirm. The DSH app is /app.",
|
|
35
36
|
'ctrl.help.about.help': "This list. /help <command> explains one command.",
|
|
36
|
-
'ctrl.help.about.menu': "The panel: each job as a button. A press runs the command
|
|
37
|
+
'ctrl.help.about.menu': "The panel: each job as a button. A press runs the command, the card stays, and the answer arrives under it.",
|
|
37
38
|
'ctrl.help.versus': "The line for /{name} in /help:",
|
|
38
39
|
'ctrl.help.unknown': "No command /{name}. The full list: /help",
|
|
39
40
|
'ctrl.menu.title': "What this bot can do",
|
|
@@ -157,7 +158,7 @@ export default {
|
|
|
157
158
|
'ctrl.status.turns': 'Agent running: {state} ({n} turn(s))',
|
|
158
159
|
'ctrl.status.running': 'yes',
|
|
159
160
|
'ctrl.status.idle': 'no',
|
|
160
|
-
'ctrl.status.notes': 'Working notes (💭
|
|
161
|
+
'ctrl.status.notes': 'Working notes (💭): {state}',
|
|
161
162
|
'ctrl.status.on': 'on',
|
|
162
163
|
'ctrl.status.off': 'off',
|
|
163
164
|
'ctrl.status.skills': 'Skills: {n}',
|
package/i18n/ru/core.mjs
CHANGED
|
@@ -14,13 +14,17 @@ export default {
|
|
|
14
14
|
'settings.state.on': 'вкл',
|
|
15
15
|
'settings.state.off': 'выкл',
|
|
16
16
|
'settings.state.auto': 'авто',
|
|
17
|
-
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (нажать, чтобы отметить)\nСессии: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nРасширения: /skills · /plugins [add|remove] · /soul\nВерсии: /update [confirm|on|off|auto] · /subscribe on|off\nПрочее: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nПанели: /menu — те же команды кнопками, по страницам. /menu on добавляет четыре клавиши под полем ввода.",
|
|
17
|
+
'help.body': "Задачу можно писать обычным текстом. Каждая ветка форума — отдельная сессия:\n\nРабота: /cd \u003cпроект\u003e · /new · /stop · /send \u003cфайл\u003e · /seed \u003cтекст\u003e\nЦели: /goal · /tasks [\u003ctext\u003e|done N] · /tasks (нажать, чтобы отметить)\nСессии: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003cимя\u003e\nАгенты: /agents · /agents set model|depth|filter … @tool\nМодели: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\nНастройка: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\nРасширения: /skills · /plugins [add|remove] · /soul\nВерсии: /update [confirm|on|off|auto] · /subscribe on|off\nПрочее: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\nПанели: /menu — те же команды кнопками, по страницам. /menu on добавляет четыре клавиши под полем ввода.",
|
|
18
18
|
'settings.reply.title': 'Что бот говорит',
|
|
19
19
|
'settings.agent.title': 'Кто отвечает и как старается',
|
|
20
20
|
'settings.updates.title': 'Новые версии (эта установка, не тема)',
|
|
21
21
|
'settings.health.title': 'Если что-то не так',
|
|
22
22
|
'settings.reasoning.label': 'Заметки по ходу',
|
|
23
|
-
'settings.reasoning.hint': 'Строки
|
|
23
|
+
'settings.reasoning.hint': 'Строки 💭: в карточке прогресса, ещё и сообщениями в чат, или выкл.',
|
|
24
|
+
'settings.pin.label': '📌 Закреплять карточку',
|
|
25
|
+
'settings.pin.hint': 'Держит карточку наверху чата, пока идёт ход: цифры в одно касание.',
|
|
26
|
+
'settings.reasoning.chat': 'в чат',
|
|
27
|
+
'settings.reasoning.card': 'в карточке',
|
|
24
28
|
'settings.lang.label': 'Язык ответов',
|
|
25
29
|
'settings.lang.hint': 'auto — отвечать на языке сообщения; en, ru, zh — закрепить.',
|
|
26
30
|
'settings.thoughts.label': '💭 Заметки по ходу: последний ход, все или выкл',
|
|
@@ -38,6 +42,11 @@ export default {
|
|
|
38
42
|
'settings.set.hint': 'Модель, усилие, права и пресет одним переключателем.',
|
|
39
43
|
'settings.agents.label': '🕸 Агенты',
|
|
40
44
|
'settings.agents.hint': 'Кого можно порождать, на какой модели, с какими инструментами.',
|
|
45
|
+
'settings.cd.label': '📁 Проект',
|
|
46
|
+
'settings.cd.hint': 'В какой папке работает эта тема.',
|
|
47
|
+
'settings.fallback.label': '🔁 Цепочка подмены',
|
|
48
|
+
'settings.fallback.hint': 'Кто отвечает, когда провайдер отказал, и в каком порядке.',
|
|
49
|
+
'settings.done': '✓ Готово',
|
|
41
50
|
'settings.u-late.label': 'Уведомления о версиях',
|
|
42
51
|
'settings.u-auto.label': 'Автоустановка',
|
|
43
52
|
'settings.u-auto.hint': 'С авто версия скачивается сама; включает её /restart.',
|
|
@@ -60,10 +69,9 @@ export default {
|
|
|
60
69
|
'settings.tab.updates': 'Версии',
|
|
61
70
|
'settings.tab.health': 'Здоровье',
|
|
62
71
|
'settings.u-late.hint': 'Одно сообщение на новую версию; выключение ничего не ставит и ничего не сдвигает.',
|
|
63
|
-
'settings.card.foot': 'Нажатие меняет настройку,
|
|
72
|
+
'settings.card.foot': 'Нажатие меняет настройку, а карточка остаётся и перерисовывается с новым значением. «Готово» убирает её из чата.',
|
|
64
73
|
'settings.reply.setBound': 'Тема использует набор {name}: модель, усилие, права и пресет берутся из него.',
|
|
65
|
-
'settings.card.changed': '
|
|
66
|
-
'settings.card.door': '⌨️ {command} — отправь ниже или нажми ещё раз',
|
|
74
|
+
'settings.card.changed': '✓ {label}: {value}',
|
|
67
75
|
'settings.card.stale': 'Эта кнопка из старой версии карточки. Открой /settings заново.',
|
|
68
76
|
'btn.stop': 'Стоп',
|
|
69
77
|
'btn.logs': 'Логи',
|
|
@@ -98,6 +106,10 @@ export default {
|
|
|
98
106
|
'msg.langSet': 'Язык переключён на русский.',
|
|
99
107
|
'msg.reasoningOn': 'Заметки по ходу включены: 💭 будут появляться в сообщении прогресса.\nВыключить: /reasoning off',
|
|
100
108
|
'msg.reasoningOff': 'Заметки по ходу выключены. В прогрессе остаётся только список шагов.\nВключить: /reasoning on',
|
|
109
|
+
'msg.reasoningChat': 'Заметки по ходу идут в чат: каждая строка 💭 приходит отдельным сообщением, длинный ход читается по мере работы.\nОбратно в карточку: /reasoning card',
|
|
110
|
+
'msg.reasoningMode.off': 'выключены',
|
|
111
|
+
'msg.reasoningMode.card': 'в сообщении прогресса',
|
|
112
|
+
'msg.reasoningMode.chat': 'в чате и в сообщении прогресса',
|
|
101
113
|
'msg.stateOn': 'включены',
|
|
102
114
|
'msg.stateOff': 'выключены',
|
|
103
115
|
'msg.turnHardCap': 'Ход упёрся в потолок {minutes} минут и был остановлен. Ничего не потеряно: сессия сохранена — нажми «Продолжить», я проверю состояние и продолжу с того места, где остановился.',
|
|
@@ -114,8 +126,14 @@ export default {
|
|
|
114
126
|
'profile.createFailed': 'Не смог создать профиль {name} — шаблон не записался. Повтори или создай его в приложении.',
|
|
115
127
|
'profile.badName': 'Имя — строчные буквы, цифры и дефис: /profile new my-space from web',
|
|
116
128
|
'profile.set': 'Профиль темы → {name} ({route}). Действует со следующего хода.',
|
|
117
|
-
'msg.reasoningState': 'Заметки по ходу: {state}. Переключить: /reasoning
|
|
118
|
-
'
|
|
129
|
+
'msg.reasoningState': 'Заметки по ходу: {state}. Переключить: /reasoning off, /reasoning card или /reasoning chat.',
|
|
130
|
+
'msg.pinOn': 'Карточка прогресса закреплена на время хода: одно касание возвращает часы, скорость и шаги. Следующий ход заменит её.',
|
|
131
|
+
'msg.pinOff': 'Карточка прогресса больше не закрепляется.',
|
|
132
|
+
'msg.pinState': 'Карточка прогресса закреплена: {state}. Переключить: /pin on или /pin off.',
|
|
133
|
+
'msg.pinMode.on': 'да',
|
|
134
|
+
'msg.pinMode.off': 'нет',
|
|
135
|
+
'prompt.reasoning': 'Заметки по ходу: в каждом ходе, на каждом значимом шаге — задача ясна, причина найдена, сейчас изменю рискованное, результат проверен — дописывай одну строку до 90 символов через `node {say} --thought "..."`. Она видна как 💭 в сообщении прогресса: пиши решение, а не пересказ. Строка — простым текстом, без разметки, секретов и путей к ключам: в режиме чата она уходит отдельным сообщением. Пропускать можно только если весь ход — один вызов инструмента. Когда решение меняет то, что человек должен знать сразу — выпущена версия, найдена причина, упёрся в блокер, ход идёт долго — отправь это в чат одной строкой без разметки: `node {say} --note "..."`. В чат — только то, что важно сейчас, не каждый шаг.',
|
|
136
|
+
'prompt.reasoningChat': 'Эта тема в режиме чата: каждая строка 💭 дополнительно уходит в чат отдельным сообщением, поэтому человек, читающий только чат, видит шаги по мере работы. Пиши строку так, чтобы она читалась сама по себе — что изменилось и почему это важно — и никогда не вставляй в неё секрет, токен или приватный путь.',
|
|
119
137
|
'cmd.help.title': 'Команды',
|
|
120
138
|
'cmd.help.hint': 'Любой текст — задача агенту. В теме форума: /cd <проект> привяжет тему к проекту.',
|
|
121
139
|
'cmd.cd.bound': 'Тема привязана к проекту:\n{path}\n\nДальше все команды идут отсюда.',
|
|
@@ -204,7 +222,7 @@ export default {
|
|
|
204
222
|
'bridge.fail.sandbox': 'DSH запретил доступ к файлу или каталогу. Проверь путь проекта и права на него.',
|
|
205
223
|
'bridge.fail.unknownModel': 'модель из конфига недоступна. Список рабочих: /model.',
|
|
206
224
|
'bridge.fail.reject': 'провайдер отказал самому запросу, а не ответу. Остальные маршруты уже перепробованы. Если сессия длинная, /new начнёт свежую; /report пришлёт хвост сопровождающему.',
|
|
207
|
-
'bridge.fail.rate': 'провайдер ограничивает частоту запросов по этому ключу. Подождите минуту — или /fallback переведёт ход на другой маршрут.',
|
|
225
|
+
'bridge.fail.rate': 'провайдер ограничивает частоту запросов по этому ключу. Подождите минуту — или /fallback переведёт ход на другой маршрут.',
|
|
208
226
|
'bridge.fail.empty': 'модель ничего не вернула. Повтори или смени модель: /model.',
|
|
209
227
|
'bridge.fail.generic': 'повтори запрос; если ошибка та же — /doctor и /logs errors.',
|
|
210
228
|
'bridge.fail.timeCap': "Ход упёрся в потолок {minutes} минут и был остановлен — это не ошибка, и ничего не потеряно: сессия сохранена. Нажми «Продолжить» или напиши следующее сообщение, и я продолжу с того места, где остановился.",
|
package/i18n/ru/ctrl.mjs
CHANGED
|
@@ -27,13 +27,14 @@ export default {
|
|
|
27
27
|
'ctrl.help.about.subscribe': "Сообщается ли о нас как о пользователе плагина: /subscribe on|off.",
|
|
28
28
|
'ctrl.help.about.settings': "Все переключатели одной карточкой по страницам: /settings, /settings agent, /settings updates.",
|
|
29
29
|
'ctrl.help.about.lang': "Язык бота в теме: /lang en|ru|zh.",
|
|
30
|
-
'ctrl.help.about.reasoning': "Заметки о ходе
|
|
30
|
+
'ctrl.help.about.reasoning': "Заметки о ходе работы: выкл, в карточке прогресса или отдельными сообщениями в чат — /reasoning off|card|chat.",
|
|
31
|
+
'ctrl.help.about.pin': "Держит карточку прогресса закреплённой на время хода, чтобы часы и шаги были в одно касание — /pin on|off.",
|
|
32
|
+
'ctrl.help.about.menu': "Панель: каждая работа кнопкой. Нажатие выполняет команду, карточка остаётся, а ответ приходит под ней.",
|
|
31
33
|
'ctrl.help.about.doctor': "Проверяет установку: мост, сеть, диск, плагины, сессию. С него начинают, когда что-то сломалось.",
|
|
32
34
|
'ctrl.help.about.logs': "Лог моста: /logs, /logs 100, /logs errors, /logs file.",
|
|
33
35
|
'ctrl.help.about.app': "Приложение DSH, не мост: /app restart confirm.",
|
|
34
36
|
'ctrl.help.about.restart': "Перезапускает мост: /restart confirm. Приложение — /app.",
|
|
35
37
|
'ctrl.help.about.help': "Этот список. /help <команда> объясняет одну команду.",
|
|
36
|
-
'ctrl.help.about.menu': "Панель: каждая работа кнопкой. Нажатие выполняет команду, а карточка становится ответом.",
|
|
37
38
|
'ctrl.help.versus': "Строка про /{name} в /help:",
|
|
38
39
|
'ctrl.help.unknown': "Нет команды /{name}. Весь список: /help",
|
|
39
40
|
'ctrl.menu.title': "Что умеет бот",
|
|
@@ -157,7 +158,7 @@ export default {
|
|
|
157
158
|
'ctrl.status.turns': 'Агент работает: {state} ({n} ход(ов))',
|
|
158
159
|
'ctrl.status.running': 'да',
|
|
159
160
|
'ctrl.status.idle': 'нет',
|
|
160
|
-
'ctrl.status.notes': 'Заметки по ходу (💭
|
|
161
|
+
'ctrl.status.notes': 'Заметки по ходу (💭): {state}',
|
|
161
162
|
'ctrl.status.on': 'включены',
|
|
162
163
|
'ctrl.status.off': 'выключены',
|
|
163
164
|
'ctrl.status.skills': 'Скиллы: {n}',
|
package/i18n/zh/core.mjs
CHANGED
|
@@ -14,13 +14,17 @@ export default {
|
|
|
14
14
|
'settings.state.on': '开',
|
|
15
15
|
'settings.state.off': '关',
|
|
16
16
|
'settings.state.auto': '自动',
|
|
17
|
-
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /tasks [\u003ctext\u003e|done N] · /tasks(点击勾选)\n会话: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\n调优: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\n扩展: /skills · /plugins [add|remove] · /soul\n版本: /update [confirm|on|off|auto] · /subscribe on|off\n其他: /settings · /lang · /reasoning · /doctor · /logs [errors|N] · /report · /app · /restart · /help\n面板: /menu — 同样的命令做成按钮,分页浏览。/menu on 在输入框下方加四个键。",
|
|
17
|
+
'help.body': "任务直接以文本发送。每个论坛话题是一个独立会话:\n\n工作: /cd \u003c项目\u003e · /new · /stop · /send \u003c文件\u003e · /seed \u003c文本\u003e\n目标: /goal · /tasks [\u003ctext\u003e|done N] · /tasks(点击勾选)\n会话: /status · /sessions [\u003cid\u003e] · /rewind [n|undo|fork [n]|branches] · /new · /profile \u003c名称\u003e\n智能体: /agents · /agents set model|depth|filter … @tool\n模型: /model · /model \u003cid\u003e · /fallback · /prices · /thoughts\n调优: /effort · /permissions · /preset · /crew [use|show|off|new] · /plan · /jobs [n] · /remind\n扩展: /skills · /plugins [add|remove] · /soul\n版本: /update [confirm|on|off|auto] · /subscribe on|off\n其他: /settings · /lang · /reasoning · /pin · /doctor · /logs [errors|N] · /report · /app · /restart · /help\n面板: /menu — 同样的命令做成按钮,分页浏览。/menu on 在输入框下方加四个键。",
|
|
18
18
|
'settings.reply.title': '机器人怎么说',
|
|
19
19
|
'settings.agent.title': '谁来回答、投入多少',
|
|
20
20
|
'settings.updates.title': '新版本(针对本次安装,而非话题)',
|
|
21
21
|
'settings.health.title': '如果哪里不对',
|
|
22
22
|
'settings.reasoning.label': '过程记录',
|
|
23
|
-
'settings.reasoning.hint': '
|
|
23
|
+
'settings.reasoning.hint': '💭 行:放在进度卡片里、同时发到聊天,或关闭。',
|
|
24
|
+
'settings.pin.label': '📌 置顶进度卡片',
|
|
25
|
+
'settings.pin.hint': '运行期间把卡片固定在聊天顶部,数字一按就到。',
|
|
26
|
+
'settings.reasoning.chat': '发到聊天',
|
|
27
|
+
'settings.reasoning.card': '放在卡片里',
|
|
24
28
|
'settings.lang.label': '回复语言',
|
|
25
29
|
'settings.lang.hint': 'auto 按消息语言回复;en、ru、zh 则固定。',
|
|
26
30
|
'settings.thoughts.label': '💭 过程记录:上一轮、全部或关闭',
|
|
@@ -38,6 +42,11 @@ export default {
|
|
|
38
42
|
'settings.set.hint': '把模型、力度、权限、预设合成一个开关。',
|
|
39
43
|
'settings.agents.label': '🕸 代理',
|
|
40
44
|
'settings.agents.hint': '可以派生子代理、用什么模型、带哪些工具。',
|
|
45
|
+
'settings.cd.label': '📁 项目',
|
|
46
|
+
'settings.cd.hint': '本话题在哪个目录里工作。',
|
|
47
|
+
'settings.fallback.label': '🔁 备用链路',
|
|
48
|
+
'settings.fallback.hint': '供应商拒绝时由谁接手,按什么顺序。',
|
|
49
|
+
'settings.done': '✓ 完成',
|
|
41
50
|
'settings.u-late.label': '新版本提示',
|
|
42
51
|
'settings.u-auto.label': '自动安装',
|
|
43
52
|
'settings.u-auto.hint': '开启后自动下载新版本;/restart 使其生效。',
|
|
@@ -60,10 +69,9 @@ export default {
|
|
|
60
69
|
'settings.tab.updates': '版本',
|
|
61
70
|
'settings.tab.health': '健康',
|
|
62
71
|
'settings.u-late.hint': '每个新版本只发一条;关闭它不安装、不移动任何东西。',
|
|
63
|
-
'settings.card.foot': '
|
|
72
|
+
'settings.card.foot': '点一下即改变设置,卡片会留着并按新值重画。“完成”把卡片从聊天里删掉。',
|
|
64
73
|
'settings.reply.setBound': '本话题使用组合 {name}:模型、力度、权限、预设都来自它。',
|
|
65
|
-
'settings.card.changed': '
|
|
66
|
-
'settings.card.door': '⌨️ {command} — 在下面发送或再点一次',
|
|
74
|
+
'settings.card.changed': '✓ {label}:{value}',
|
|
67
75
|
'settings.card.stale': '这个按钮来自旧版卡片。请重新打开 /settings。',
|
|
68
76
|
'btn.stop': '停止',
|
|
69
77
|
'btn.logs': '日志',
|
|
@@ -98,6 +106,10 @@ export default {
|
|
|
98
106
|
'msg.langSet': '界面语言已切换为中文。',
|
|
99
107
|
'msg.reasoningOn': '工作记录已开启:💭 会显示在进度消息里。\n关闭:/reasoning off',
|
|
100
108
|
'msg.reasoningOff': '工作记录已关闭,进度消息只保留步骤列表。\n开启:/reasoning on',
|
|
109
|
+
'msg.reasoningChat': '工作记录会发到聊天:每条 💭 单独成一条消息,长回合可以边跑边看。\n回到进度卡片:/reasoning card',
|
|
110
|
+
'msg.reasoningMode.off': '关闭',
|
|
111
|
+
'msg.reasoningMode.card': '在进度消息里',
|
|
112
|
+
'msg.reasoningMode.chat': '在聊天和进度消息里',
|
|
101
113
|
'msg.stateOn': '开启',
|
|
102
114
|
'msg.stateOff': '关闭',
|
|
103
115
|
'msg.turnHardCap': '本轮达到 {minutes} 分钟上限并被停止。进度没有丢失:会话已保留——点击“继续”,我会检查状态并从停下的地方接着做。',
|
|
@@ -114,8 +126,14 @@ export default {
|
|
|
114
126
|
'profile.createFailed': '无法创建配置档 {name}——模板未写入。请重试或在应用中创建。',
|
|
115
127
|
'profile.badName': '名称只能用小写字母、数字和连字符:/profile new my-space from web',
|
|
116
128
|
'profile.set': '话题配置档 → {name}({route})。下一轮生效。',
|
|
117
|
-
'msg.reasoningState': '工作记录:{state}。切换:/reasoning
|
|
118
|
-
'
|
|
129
|
+
'msg.reasoningState': '工作记录:{state}。切换:/reasoning off、/reasoning card 或 /reasoning chat。',
|
|
130
|
+
'msg.pinOn': '进度卡片在本次运行期间置顶:一按就回到时间、速度和步骤。下一次运行会替换它。',
|
|
131
|
+
'msg.pinOff': '进度卡片不再置顶。',
|
|
132
|
+
'msg.pinState': '进度卡片置顶:{state}。切换:/pin on 或 /pin off。',
|
|
133
|
+
'msg.pinMode.on': '开',
|
|
134
|
+
'msg.pinMode.off': '关',
|
|
135
|
+
'prompt.reasoning': '工作记录:每一轮在每个有意义的节点——任务已清楚、原因已找到、即将改动有风险的地方、结果已验证——用 `node {say} --thought "..."` 追加一行,不超过 90 个字符。它会以 💭 出现在进度消息里:写结论,不要复述。这一行要用纯文本,不带标记、不含密钥和凭据路径:在聊天模式下它会单独成一条消息。只有整轮只是一次工具调用时才可以跳过。当某个决定改变对方需要预期的事——版本已发布、找到原因、遇到阻塞、这一轮跑得很久——用一行纯文本发到聊天:`node {say} --note "..."`。聊天里只发此刻重要的内容,不是每一步。',
|
|
136
|
+
'prompt.reasoningChat': '这个会话处于聊天模式:每条 💭 还会单独作为一条消息发到聊天,只看聊天的人也能边跑边看到步骤。每一行都要能独立读懂——改了什么、为什么重要——绝不写入密钥、令牌或私有路径。',
|
|
119
137
|
'cmd.help.title': '命令',
|
|
120
138
|
'cmd.help.hint': '发送任意文本即可开始任务。在论坛话题中:/cd <项目> 将该话题绑定到项目目录。',
|
|
121
139
|
'cmd.cd.bound': '话题已绑定到项目:\n{path}\n\n之后所有操作都在此目录执行。',
|
|
@@ -204,7 +222,7 @@ export default {
|
|
|
204
222
|
'bridge.fail.sandbox': 'DSH 拒绝访问文件或目录。请检查项目路径及其权限。',
|
|
205
223
|
'bridge.fail.unknownModel': '配置中的模型不可用。可用的列表:/model。',
|
|
206
224
|
'bridge.fail.reject': '服务商拒绝的是请求本身,而不是回答。其他线路已全部试过。若会话过长,用 /new 开一个;用 /report 把日志尾部发给维护者。',
|
|
207
|
-
'bridge.fail.rate': '服务商正在限制此密钥的请求频率。请等一分钟,或用 /fallback 让本轮换到其他线路。',
|
|
225
|
+
'bridge.fail.rate': '服务商正在限制此密钥的请求频率。请等一分钟,或用 /fallback 让本轮换到其他线路。',
|
|
208
226
|
'bridge.fail.empty': '模型没有返回任何内容。请重试或切换模型:/model。',
|
|
209
227
|
'bridge.fail.generic': '请重试请求;如果错误相同 —— /doctor 和 /logs errors。',
|
|
210
228
|
'bridge.fail.timeCap': "本轮达到 {minutes} 分钟上限并被停止——这不是错误,也没有丢失任何东西:会话已保存。点击“继续”或写下一条消息,我会从停下的地方接着做。",
|
package/i18n/zh/ctrl.mjs
CHANGED
|
@@ -27,13 +27,14 @@ export default {
|
|
|
27
27
|
'ctrl.help.about.subscribe': "是否公开本安装为该插件的使用者:/subscribe on|off。",
|
|
28
28
|
'ctrl.help.about.settings': "所有开关在一张卡片上,分页显示:/settings、/settings agent、/settings updates。",
|
|
29
29
|
'ctrl.help.about.lang': "本话题中机器人的语言:/lang en|ru|zh。",
|
|
30
|
-
'ctrl.help.about.reasoning': "
|
|
30
|
+
'ctrl.help.about.reasoning': "工作记录:关闭、放在进度卡片里,或作为消息发到聊天——/reasoning off|card|chat。",
|
|
31
|
+
'ctrl.help.about.pin': "让进度卡片在本次运行期间保持置顶,时间和步骤一按就到——/pin on|off。",
|
|
31
32
|
'ctrl.help.about.doctor': "检查安装:桥接、网络、磁盘、插件、会话。出问题先跑它。",
|
|
32
33
|
'ctrl.help.about.logs': "桥接日志:/logs、/logs 100、/logs errors、/logs file。",
|
|
33
34
|
'ctrl.help.about.app': "DSH 桌面应用,不是桥接:/app restart confirm。",
|
|
34
35
|
'ctrl.help.about.restart': "重启桥接:/restart confirm。桌面应用用 /app。",
|
|
35
36
|
'ctrl.help.about.help': "这个列表。/help <命令> 解释单个命令。",
|
|
36
|
-
'ctrl.help.about.menu': "
|
|
37
|
+
'ctrl.help.about.menu': "面板:每项工作一个按钮。点击执行命令,卡片留着,回答出现在它下面。",
|
|
37
38
|
'ctrl.help.versus': "/help 中关于 /{name} 的这一行:",
|
|
38
39
|
'ctrl.help.unknown': "没有命令 /{name}。完整列表:/help",
|
|
39
40
|
'ctrl.menu.title': "这个机器人能做什么",
|
|
@@ -157,7 +158,7 @@ export default {
|
|
|
157
158
|
'ctrl.status.turns': '代理运行中:{state}({n} 个任务)',
|
|
158
159
|
'ctrl.status.running': '是',
|
|
159
160
|
'ctrl.status.idle': '否',
|
|
160
|
-
'ctrl.status.notes': '
|
|
161
|
+
'ctrl.status.notes': '工作记录(💭):{state}',
|
|
161
162
|
'ctrl.status.on': '开',
|
|
162
163
|
'ctrl.status.off': '关',
|
|
163
164
|
'ctrl.status.skills': '技能:{n}',
|
package/menu-card.mjs
CHANGED
|
@@ -18,7 +18,7 @@ const SECTIONS = {
|
|
|
18
18
|
work: ['cd', 'seed', 'send'],
|
|
19
19
|
session: ['sessions', 'rewind', 'profile', 'agents'],
|
|
20
20
|
goals: ['goal', 'task', 'tasks', 'plan', 'jobs', 'remind'],
|
|
21
|
-
talk: ['effort', 'reasoning', 'thoughts', 'prices', 'lang', 'fallback'],
|
|
21
|
+
talk: ['effort', 'reasoning', 'pin', 'thoughts', 'prices', 'lang', 'fallback'],
|
|
22
22
|
ext: ['plugins', 'skills', 'soul', 'preset', 'permissions', 'crew'],
|
|
23
23
|
house: ['settings', 'update', 'subscribe', 'doctor', 'logs', 'report', 'restart', 'app', 'help'],
|
|
24
24
|
};
|
package/notes.mjs
CHANGED
|
@@ -34,13 +34,13 @@ export function readNotes(file) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
*
|
|
37
|
+
* Every note of this turn across `files`, oldest first, de-duplicated.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
39
|
+
* The chat forwarder needs the whole list, not the last two the card shows: a
|
|
40
|
+
* step that only ever reached a card the person was not looking at is a step
|
|
41
|
+
* they never learned about.
|
|
42
42
|
*/
|
|
43
|
-
export function
|
|
43
|
+
export function thoughtRows(files, since = 0) {
|
|
44
44
|
const seen = new Set();
|
|
45
45
|
return files
|
|
46
46
|
.filter(Boolean)
|
|
@@ -49,7 +49,39 @@ export function recentThoughts(files, since = 0, limit = 2) {
|
|
|
49
49
|
// The same note can sit in both files when `say.mjs` wrote to each; a
|
|
50
50
|
// duplicated 💭 line reads as two decisions instead of one.
|
|
51
51
|
.filter((row) => (seen.has(`${row.at}:${row.text}`) ? false : seen.add(`${row.at}:${row.text}`)))
|
|
52
|
-
.sort((a, b) => a.at - b.at)
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
.sort((a, b) => a.at - b.at);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* How much of the decision trail this topic wants: `off`, `card` or `chat`.
|
|
57
|
+
*
|
|
58
|
+
* Three ends, one switch — the trail is one job, and a second command for "send
|
|
59
|
+
* them to the chat" would be the lookalike name this surface spent a release
|
|
60
|
+
* removing. `card` is the default: the last two lines inside the progress
|
|
61
|
+
* message. `chat` also sends each line as its own message, for a turn a person
|
|
62
|
+
* wants to read while it runs instead of afterwards.
|
|
63
|
+
*
|
|
64
|
+
* An old `true`/`false` in `state.json` is still a mode: `card`/`off`. It is
|
|
65
|
+
* what the previous release stored, and a settings file must not need editing
|
|
66
|
+
* by hand after an update.
|
|
67
|
+
*/
|
|
68
|
+
export function reasoningMode(state, config, key = '') {
|
|
69
|
+
const raw = state?.reasoning?.[key];
|
|
70
|
+
const fromTopic = raw === 'chat' || raw === 'card' || raw === 'off' ? raw : raw === true ? 'card' : raw === false ? 'off' : '';
|
|
71
|
+
if (fromTopic) return fromTopic;
|
|
72
|
+
const fallback = config?.reasoning;
|
|
73
|
+
if (fallback === 'chat' || fallback === 'card' || fallback === 'off') return fallback;
|
|
74
|
+
if (fallback === false) return 'off';
|
|
75
|
+
return 'card';
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The last `limit` note texts across `files`, written at or after `since`.
|
|
80
|
+
*
|
|
81
|
+
* `since` is the turn's start time: it is what separates "this turn said X" from
|
|
82
|
+
* "a previous turn in this topic said X". Notes without a timestamp are dropped
|
|
83
|
+
* rather than shown at the wrong moment.
|
|
84
|
+
*/
|
|
85
|
+
export function recentThoughts(files, since = 0, limit = 2) {
|
|
86
|
+
return thoughtRows(files, since).slice(-limit).map((row) => row.text);
|
|
55
87
|
}
|
package/package.json
CHANGED
package/progress.mjs
CHANGED
|
@@ -14,7 +14,8 @@ import { tg } from './telegram.mjs';
|
|
|
14
14
|
import { topicName } from './topics.mjs';
|
|
15
15
|
import { t } from './i18n.mjs';
|
|
16
16
|
import { addStep, progressPanel, stepLine } from './panel.mjs';
|
|
17
|
-
import {
|
|
17
|
+
import { reasoningMode, thoughtRows } from './notes.mjs';
|
|
18
|
+
import { cardPin } from './settings-card.mjs';
|
|
18
19
|
import { continueKeyboard, errorKeyboard } from './keyboards.mjs';
|
|
19
20
|
|
|
20
21
|
/**
|
|
@@ -71,6 +72,17 @@ export async function startProgress(chatId, threadId, lang = config.lang || 'en'
|
|
|
71
72
|
const notes = thoughtFile || join(THOUGHT_DIR, `${chatId}_${threadId || 0}.jsonl`);
|
|
72
73
|
const topicNotes = join(THOUGHT_DIR, `${chatId}_${threadId || 0}.jsonl`);
|
|
73
74
|
let thoughts = [];
|
|
75
|
+
// In `chat` mode every note also leaves the card as its own message: a turn
|
|
76
|
+
// that runs for twenty minutes is read as it happens, not scrolled back to.
|
|
77
|
+
// The set holds what already went out, so a rewrite of the card never repeats
|
|
78
|
+
// a step, and a note that arrives while the person is reading is not lost.
|
|
79
|
+
const forwarded = new Set();
|
|
80
|
+
// Switching to chat mid-turn must not dump the steps already shown in the card
|
|
81
|
+
// into the chat as a burst: the mode takes effect from the next step written
|
|
82
|
+
// after the switch. A turn that starts in chat mode forwards from its first
|
|
83
|
+
// line, so `chatFrom` is the turn's own start in that case.
|
|
84
|
+
let chatFrom = reasoningMode(state, config, panelKey) === 'chat' ? started : Infinity;
|
|
85
|
+
let wasChat = Number.isFinite(chatFrom);
|
|
74
86
|
try {
|
|
75
87
|
mkdirSync(THOUGHT_DIR, { recursive: true });
|
|
76
88
|
// Start this turn's file empty — but never truncate the stable per-topic
|
|
@@ -79,7 +91,34 @@ export async function startProgress(chatId, threadId, lang = config.lang || 'en'
|
|
|
79
91
|
if (thoughtFile) writeFileSync(notes, '');
|
|
80
92
|
} catch {}
|
|
81
93
|
const thoughtTimer = setInterval(() => {
|
|
82
|
-
const
|
|
94
|
+
const mode = reasoningMode(state, config, panelKey);
|
|
95
|
+
if (mode === 'chat' && !wasChat) chatFrom = Date.now();
|
|
96
|
+
wasChat = mode === 'chat';
|
|
97
|
+
if (mode === 'off') {
|
|
98
|
+
if (thoughts.length) {
|
|
99
|
+
thoughts = [];
|
|
100
|
+
schedule();
|
|
101
|
+
}
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
const rows = thoughtRows([notes, topicNotes], started);
|
|
105
|
+
if (mode === 'chat') {
|
|
106
|
+
for (const row of rows) {
|
|
107
|
+
if (row.at < chatFrom) continue;
|
|
108
|
+
const id = `${row.at}:${row.text}`;
|
|
109
|
+
if (forwarded.has(id)) continue;
|
|
110
|
+
forwarded.add(id);
|
|
111
|
+
// One message per decision, and a failed send must not kill the turn:
|
|
112
|
+
// the note is still in the card, which is where it always lived.
|
|
113
|
+
tg('sendMessage', {
|
|
114
|
+
chat_id: chatId,
|
|
115
|
+
text: `💭 ${row.text}`,
|
|
116
|
+
disable_web_page_preview: true,
|
|
117
|
+
...(threadId > 0 ? { message_thread_id: threadId } : {}),
|
|
118
|
+
}).catch((error) => log(`note forward failed: ${String(error.message).slice(0, 100)}`));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const merged = rows.slice(-2).map((row) => row.text);
|
|
83
122
|
if (merged.join('\n') !== thoughts.join('\n')) {
|
|
84
123
|
thoughts = merged;
|
|
85
124
|
schedule();
|
|
@@ -150,6 +189,20 @@ export async function startProgress(chatId, threadId, lang = config.lang || 'en'
|
|
|
150
189
|
log(`progress message failed: ${error.message}`);
|
|
151
190
|
}
|
|
152
191
|
|
|
192
|
+
// Pinned on request. Telegram keeps one pinned message per chat and topic, so
|
|
193
|
+
// pinning this card is also what replaces the previous turn's — the slot always
|
|
194
|
+
// holds the turn that is running now, or the numbers of the one that just
|
|
195
|
+
// finished. A pin that lands with a notification reads as an interruption, so
|
|
196
|
+
// it goes silently; a chat where the bot may not pin is not an error either —
|
|
197
|
+
// the card works the same unpinned, and the reason belongs in the log.
|
|
198
|
+
if (messageId && cardPin(state, config, panelKey) === 'on') {
|
|
199
|
+
tg('pinChatMessage', {
|
|
200
|
+
chat_id: chatId,
|
|
201
|
+
message_id: messageId,
|
|
202
|
+
disable_notification: true,
|
|
203
|
+
}).catch((error) => log(`pin failed: ${String(error.message).slice(0, 120)}`));
|
|
204
|
+
}
|
|
205
|
+
|
|
153
206
|
let lastView = '';
|
|
154
207
|
const edit = async (text, keyboard = undefined, view = null) => {
|
|
155
208
|
if (!messageId) return;
|
package/settings-card.mjs
CHANGED
|
@@ -8,12 +8,21 @@
|
|
|
8
8
|
* draws — one line per setting, a tap to flip it — and it is deletable, so the
|
|
9
9
|
* history is not a wall of menus.
|
|
10
10
|
*
|
|
11
|
+
* The card stays after a press. An earlier version turned it into one line naming
|
|
12
|
+
* the change, which answered "what did I just do" and took away "what can I do
|
|
13
|
+
* next": the menu vanished the moment it was used, and the way out had to be the
|
|
14
|
+
* person deleting a message by hand. So a press now edits the card in place — same
|
|
15
|
+
* message, same buttons, the new value marked — and the one line saying what
|
|
16
|
+
* changed sits above the rows. Removing it is a button of its own (`✓ Done`),
|
|
17
|
+
* which is the difference between a thing that stays and a thing that traps.
|
|
18
|
+
*
|
|
11
19
|
* Design rule, and the reason this file has no settings logic of its own: a
|
|
12
20
|
* button runs the command a person would have typed. `m:reasoning:on` becomes
|
|
13
21
|
* `/reasoning on` and goes through `handleControl`, so the card cannot validate,
|
|
14
22
|
* translate or store a value differently from the command, and a new command
|
|
15
23
|
* turns into a button by adding a row here — nothing else.
|
|
16
24
|
*/
|
|
25
|
+
import { reasoningMode } from './notes.mjs';
|
|
17
26
|
|
|
18
27
|
/**
|
|
19
28
|
* A row is one setting. `values` are the ends a card offers (only where a pair is
|
|
@@ -26,8 +35,26 @@
|
|
|
26
35
|
const PAGES = {
|
|
27
36
|
// What the bot says, and in which language.
|
|
28
37
|
reply: [
|
|
29
|
-
|
|
38
|
+
// Three ends, one row: the trail is off, in the card, or in the chat. The
|
|
39
|
+
// card marks whichever end is the current mode, so a tap on ● does nothing
|
|
40
|
+
// surprising and a tap on a ○ is the only thing that changes anything.
|
|
41
|
+
{
|
|
42
|
+
id: 'reasoning',
|
|
43
|
+
field: 'reasoning',
|
|
44
|
+
values: ['card', 'chat', 'off'],
|
|
45
|
+
command: '/reasoning {v}',
|
|
46
|
+
labels: { card: 'settings.reasoning.card', chat: 'settings.reasoning.chat', off: 'settings.state.off' },
|
|
47
|
+
},
|
|
30
48
|
{ id: 'lang', field: 'lang', values: ['en', 'ru', 'zh'], on: 'auto', command: '/lang {v}', labels: {} },
|
|
49
|
+
// The card that shows the numbers can hold the one pinned slot the chat has,
|
|
50
|
+
// so getting back to it is a tap rather than a scroll back through a turn.
|
|
51
|
+
{
|
|
52
|
+
id: 'pin',
|
|
53
|
+
field: 'pin',
|
|
54
|
+
values: ['on', 'off'],
|
|
55
|
+
command: '/pin {v}',
|
|
56
|
+
labels: { on: 'settings.state.on', off: 'settings.state.off' },
|
|
57
|
+
},
|
|
31
58
|
{ id: 'thoughts', command: '/thoughts' },
|
|
32
59
|
],
|
|
33
60
|
// Who answers and how hard it works. These open the command that owns the
|
|
@@ -40,6 +67,11 @@ const PAGES = {
|
|
|
40
67
|
{ id: 'preset', command: '/preset' },
|
|
41
68
|
{ id: 'set', command: '/agentset' },
|
|
42
69
|
{ id: 'agents', command: '/agents' },
|
|
70
|
+
// The two doors a person reaches for from the chat more often than the rest:
|
|
71
|
+
// which project this topic works in, and what answers when the provider
|
|
72
|
+
// refuses. Both already have a card of their own; the row is just the way in.
|
|
73
|
+
{ id: 'cd', command: '/cd' },
|
|
74
|
+
{ id: 'fallback', command: '/fallback' },
|
|
43
75
|
],
|
|
44
76
|
// New releases: install-wide, so the row is about the install, not the topic.
|
|
45
77
|
updates: [
|
|
@@ -89,8 +121,9 @@ export function settingsButtons({ t, current = {}, updateMode = 'check' }) {
|
|
|
89
121
|
const data = value ? `${SET_PREFIX}${row.id}:${value}` : `${SET_PREFIX}${row.id}`;
|
|
90
122
|
if (data.length > MAX_PAYLOAD) throw new Error(`payload too long: ${data}`);
|
|
91
123
|
let active = false;
|
|
92
|
-
if (row.field === 'reasoning') active =
|
|
124
|
+
if (row.field === 'reasoning') active = current.reasoning === value;
|
|
93
125
|
else if (row.field === 'lang') active = current.lang === value;
|
|
126
|
+
else if (row.field === 'pin') active = current.pin === value;
|
|
94
127
|
else if (row.id === 'u-late') active = value === 'on' ? updateMode !== 'off' : updateMode === 'off';
|
|
95
128
|
else if (row.id === 'u-auto') active = updateMode === value;
|
|
96
129
|
buttons.push({
|
|
@@ -114,18 +147,39 @@ export function settingsButtons({ t, current = {}, updateMode = 'check' }) {
|
|
|
114
147
|
* What the card reads as the current values. Every field comes from the same
|
|
115
148
|
* place the matching command reads it, so a `●` cannot lie.
|
|
116
149
|
*/
|
|
117
|
-
export function settingsCurrent({ config = {}, state = {}, key = ''
|
|
150
|
+
export function settingsCurrent({ config = {}, state = {}, key = '' }) {
|
|
118
151
|
return {
|
|
119
|
-
reasoning:
|
|
152
|
+
reasoning: reasoningMode(state, config, key),
|
|
120
153
|
lang: state.lang?.[key] || 'auto',
|
|
154
|
+
pin: cardPin(state, config, key),
|
|
121
155
|
};
|
|
122
156
|
}
|
|
123
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Is the progress card pinned while its turn runs?
|
|
160
|
+
*
|
|
161
|
+
* Per-topic wins over the install default, and the default is off: pinning
|
|
162
|
+
* somebody's chat uninvited takes the one slot Telegram gives a conversation, and
|
|
163
|
+
* a group needs the right to pin at all. `true`/`false` read as on/off, the way
|
|
164
|
+
* the notes switch migrated.
|
|
165
|
+
*/
|
|
166
|
+
export function cardPin(state, config, key = '') {
|
|
167
|
+
const raw = state?.pin?.[key];
|
|
168
|
+
if (raw === 'on' || raw === 'off') return raw;
|
|
169
|
+
if (raw === true) return 'on';
|
|
170
|
+
if (raw === false) return 'off';
|
|
171
|
+
if (config?.pin === 'on' || config?.pin === true) return 'on';
|
|
172
|
+
return 'off';
|
|
173
|
+
}
|
|
174
|
+
|
|
124
175
|
/** The line above the buttons: what a tap on this row changes it to. */
|
|
125
176
|
function rowLine(button, group, t) {
|
|
126
177
|
if (!button.value) return t('settings.row.action', { label: button.label, hint: button.hint });
|
|
127
178
|
const active = group.find((b) => b.active);
|
|
128
|
-
|
|
179
|
+
// The filled dot is layout, not language, so it is added here: the same mark
|
|
180
|
+
// sits on the button and on the value the card names in words. A person who
|
|
181
|
+
// scans only the text still sees which end is in force.
|
|
182
|
+
const now = active ? `● ${wordFor(active.row, active.value, t)}` : t('settings.notSet');
|
|
129
183
|
const next = group.filter((b) => !b.active && b.value).map((b) => wordFor(b.row, b.value, t)).join(' / ');
|
|
130
184
|
return t('settings.row.toggle', { label: button.label, now, next, hint: button.hint });
|
|
131
185
|
}
|
|
@@ -136,9 +190,12 @@ function rowLine(button, group, t) {
|
|
|
136
190
|
* explanation the commands never had to give, because the person typed them
|
|
137
191
|
* knowing what they do.
|
|
138
192
|
*/
|
|
139
|
-
export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode = 'check', bound = null }) {
|
|
193
|
+
export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode = 'check', bound = null, note = '' }) {
|
|
140
194
|
const buttons = settingsButtons({ t, current, updateMode }).filter((b) => b.page === page);
|
|
141
195
|
const lines = [t(`settings.${page}.title`), ''];
|
|
196
|
+
// What the last tap did, in one line above the rows: the card stays, so the
|
|
197
|
+
// change needs somewhere to be said, and the top is where the eye lands.
|
|
198
|
+
if (note) lines.push(note, '');
|
|
142
199
|
|
|
143
200
|
// One line per row, in the order the rows declare.
|
|
144
201
|
const byId = new Map();
|
|
@@ -158,15 +215,18 @@ export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode
|
|
|
158
215
|
lines.push('', t('settings.card.foot'));
|
|
159
216
|
|
|
160
217
|
// Doors get their own full-width row so they read as actions; switches sit
|
|
161
|
-
// together; tabs last, because they switch the page, not the
|
|
218
|
+
// together; the way out, then tabs last, because they switch the page, not the
|
|
219
|
+
// setting. Only the value in force carries the dot — a card where every option
|
|
220
|
+
// is marked says nothing about which one is on.
|
|
162
221
|
const keyboard = [];
|
|
163
222
|
for (const group of byId.values()) {
|
|
164
223
|
if (!group[0].value) {
|
|
165
224
|
keyboard.push(group.map((b) => ({ text: b.label, data: b.data })));
|
|
166
225
|
continue;
|
|
167
226
|
}
|
|
168
|
-
keyboard.push(group.map((b) => ({ text:
|
|
227
|
+
keyboard.push(group.map((b) => ({ text: b.active ? `● ${wordFor(b.row, b.value, t)}` : wordFor(b.row, b.value, t), data: b.data })));
|
|
169
228
|
}
|
|
229
|
+
keyboard.push([{ text: t('settings.done'), data: `${SET_PREFIX}done` }]);
|
|
170
230
|
keyboard.push(SETTINGS_PAGES.map((p) => ({
|
|
171
231
|
text: p === page ? `— ${t(`settings.tab.${p}`)} —` : t(`settings.tab.${p}`),
|
|
172
232
|
data: `${SET_PREFIX}${p}`,
|
|
@@ -177,8 +237,9 @@ export function renderSettingsCard({ page = 'reply', t, current = {}, updateMode
|
|
|
177
237
|
|
|
178
238
|
/**
|
|
179
239
|
* Turn a button payload into what it stands for: `{ page }` for a tab,
|
|
180
|
-
* `{
|
|
181
|
-
*
|
|
240
|
+
* `{ done: true }` for the way out, `{ command, label, page }` for a setting
|
|
241
|
+
* (what to run, what to call it in the line above the rows, and which page to
|
|
242
|
+
* redraw once it has run).
|
|
182
243
|
*
|
|
183
244
|
* Unknown rows and unknown values answer `null`: a button from a message written
|
|
184
245
|
* before this release is the normal case, not an error, and the caller says so in
|
|
@@ -188,6 +249,9 @@ export function commandFor({ t, current = {}, updateMode = 'check' }, data) {
|
|
|
188
249
|
const text = String(data || '');
|
|
189
250
|
if (!text.startsWith(SET_PREFIX)) return null;
|
|
190
251
|
const [, row, value = ''] = text.split(':');
|
|
252
|
+
// The way out is not a setting: it removes the card, which is the one action
|
|
253
|
+
// the buttons could not do while a press turned the card into a line.
|
|
254
|
+
if (row === 'done' && !value) return { done: true };
|
|
191
255
|
if (SETTINGS_PAGES.includes(row) && !value) return { page: row };
|
|
192
256
|
const button = settingsButtons({ t, current, updateMode }).find((b) => b.id === row && (b.value || '') === value);
|
|
193
257
|
if (!button || !button.command) return null;
|
|
@@ -195,5 +259,8 @@ export function commandFor({ t, current = {}, updateMode = 'check' }, data) {
|
|
|
195
259
|
command: button.command,
|
|
196
260
|
label: button.label,
|
|
197
261
|
value: button.value ? wordFor(button.row, button.value, t) : '',
|
|
262
|
+
// The card is redrawn after the press, and a redraw needs to know which page
|
|
263
|
+
// it is looking at: the payload does not carry it, the row does.
|
|
264
|
+
page: button.page,
|
|
198
265
|
};
|
|
199
266
|
}
|