dsh-tg-bridge 1.2.0 → 1.2.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/bot-menu.mjs CHANGED
@@ -19,6 +19,7 @@ const token = (() => {
19
19
  try {
20
20
  const home = process.env.DSH_HOME || join(homedir(), '.dsh');
21
21
  const yaml = readFileSync(join(home, '.credentials.yaml'), 'utf8');
22
+ // `dsh-tg init` writes the plain name; the DSH app adds a random suffix.
22
23
  const m = /^\s*(DSH_TELEGRAM_BOT_TOKEN[A-Z0-9_]*):\s*["']?([^"'\s]+)/m.exec(yaml);
23
24
  return m ? m[2] : '';
24
25
  } catch {
@@ -41,8 +42,7 @@ const COMMANDS = [
41
42
  { command: 'model', description: 'Сменить модель: /model <id>' },
42
43
  { command: 'skills', description: 'Скиллы: список или текст одного' },
43
44
  { command: 'soul', description: 'Персона: показать или задать' },
44
- { command: 'plugins', description: 'Плагины профиля' },
45
- { command: 'plugin', description: 'add/remove/disable/enable плагина' },
45
+ { command: 'plugins', description: 'Список и управление: add/remove/disable/enable' },
46
46
  { command: 'app', description: 'Перезапуск приложения: /app restart confirm' },
47
47
  { command: 'restart', description: 'Перезапуск моста: /restart confirm' },
48
48
  { command: 'doctor', description: 'Диагностика: мост, сеть, диск, каталог, сессия' },
@@ -66,8 +66,7 @@ const COMMANDS_EN = [
66
66
  { command: 'model', description: 'Show or switch the model' },
67
67
  { command: 'skills', description: 'Installed skills' },
68
68
  { command: 'soul', description: 'Agent persona' },
69
- { command: 'plugins', description: 'Installed plugins' },
70
- { command: 'plugin', description: 'Enable or disable a plugin' },
69
+ { command: 'plugins', description: 'List and manage: add/remove/disable/enable' },
71
70
  { command: 'app', description: 'Desktop app control' },
72
71
  { command: 'restart', description: 'Restart the bridge: /restart confirm' },
73
72
  { command: 'doctor', description: 'Diagnostics: bridge, network, disk, directory, session' },
@@ -91,8 +90,7 @@ const COMMANDS_ZH = [
91
90
  { command: 'model', description: '查看或切换模型' },
92
91
  { command: 'skills', description: '已安装的技能' },
93
92
  { command: 'soul', description: '代理人格设定' },
94
- { command: 'plugins', description: '已安装的插件' },
95
- { command: 'plugin', description: '启用或停用插件' },
93
+ { command: 'plugins', description: '列表与管理:add/remove/disable/enable' },
96
94
  { command: 'app', description: '桌面应用控制' },
97
95
  { command: 'restart', description: '重启桥接:/restart confirm' },
98
96
  { command: 'doctor', description: '诊断:桥接、网络、磁盘、目录、会话' },
package/control.mjs CHANGED
@@ -354,7 +354,8 @@ export const CONTROL_COMMAND_HINT =
354
354
  'Работа: /cd · /new · /stop · /send · /seed\n' +
355
355
  'Сессии: /status · /sessions · /resume\n' +
356
356
  'Модели: /models · /model · /prices\n' +
357
- 'Расширения: /skills · /plugins · /plugin · /soul\n' +
357
+ 'Расширения: /skills · /soul\n' +
358
+ 'Плагины: /plugins [headless] — список; /plugins add|remove|disable|enable <что> — действия\n' +
358
359
  'Диагностика: /doctor · /logs\n' +
359
360
  'Язык: /lang en|ru|zh\n' +
360
361
  'Служебное: /app · /restart · /help';
@@ -363,7 +364,21 @@ export async function handleControl(ctx) {
363
364
  const { command, arg, send, reply, log, profile, state, key, config } = ctx;
364
365
  const say = (text) => reply(text);
365
366
 
366
- switch (command) {
367
+ // One command for one job: `/plugins` is both the list and the way to change
368
+ // things. Two near-identical names (`/plugin` / `/plugins`) invited the exact
369
+ // mistake of typing the plural with an action. The singular form stays as an
370
+ // alias so old instructions and muscle memory keep working.
371
+ let effective = command;
372
+ if (effective === '/plugins') {
373
+ const [maybeAction] = String(arg || '').trim().split(/\s+/);
374
+ // `/plugins add|remove|disable|enable …` is the same work as `/plugin …`;
375
+ // the case bodies read `arg`, which already holds the action and its value.
376
+ if (['add', 'remove', 'disable', 'enable'].includes((maybeAction || '').toLowerCase())) {
377
+ effective = '/plugin';
378
+ }
379
+ }
380
+
381
+ switch (effective) {
367
382
  case '/status': {
368
383
  const head = modelOf('headless');
369
384
  const desk = modelOf('desktop');
@@ -452,6 +467,10 @@ export async function handleControl(ctx) {
452
467
  ...lines,
453
468
  orphan.length ? `\nУстановлены, но не в bundles:\n${fmt(orphan)}` : '',
454
469
  `\nОтключены строки: ${disabled.length ? disabled.join(', ') : 'нет'}`,
470
+ // The actions live behind the same command, so the list must say how
471
+ // to reach them — otherwise people keep hunting for `/plugin`.
472
+ `\nИзменить: /plugins add <пакет> · remove <имя> · disable <id> · enable <id>`,
473
+ 'Профиль: добавь headless или desktop в конце.',
455
474
  ]
456
475
  .filter(Boolean)
457
476
  .join('\n'),
@@ -464,7 +483,7 @@ export async function handleControl(ctx) {
464
483
  const target = (rest[0] === 'headless' || rest[0] === 'desktop') && rest.length > 1 ? rest.shift() : 'desktop';
465
484
  const value = rest.join(' ').trim();
466
485
  if (!action || !value) {
467
- say('Использование:\n/plugin add <npm|github|file:>\n/plugin remove <name>\n/plugin disable <id>\n/plugin enable <id>\nДоп. аргумент headless|desktop — профиль.');
486
+ say('Использование:\n/plugins add <npm|github|file:>\n/plugins remove <name>\n/plugins disable <id>\n/plugins enable <id>\nПрофиль: допиши headless или desktop.\n\n/plugin — то же самое, старая форма.');
468
487
  return true;
469
488
  }
470
489
  if (action === 'disable' || action === 'enable') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.2.0",
3
+ "version": "1.2.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": "bridge.mjs",