dsh-tg-bridge 1.19.0 → 1.19.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
@@ -193,7 +193,7 @@ Models: /model · /model <id> · /prices
193
193
  Tuning: /effort · /permissions · /preset · /plan · /jobs · /remind
194
194
  Profiles: /profile · /profile <name> · /profile new <name> from <template>
195
195
  Sets: /crew · /crew use|off|new|copy|rm · /crew model <v>
196
- Extensions: /skills · /plugins · /plugins disable|enable <id> · /soul
196
+ Extensions: /skills · /plugins · /plugins search <word> · /plugins disable|enable <id> · /soul
197
197
  Updates: /version · /update · /update confirm · /update on|off|check|auto · /subscribe on|off
198
198
  Diagnostics: /doctor · /logs [errors|N|text]
199
199
  Service: /app · /restart · /help
@@ -396,7 +396,9 @@ plugin set and model. The same switch works from a topic:
396
396
  A new profile is written by `dsh <name> --from-default-profile <template> --dump-config`, so
397
397
  nothing boots and no plugin is loaded at creation time; dependencies are installed by the
398
398
  profile's first turn. The binding is per topic: `/model` then edits that profile's model, and
399
- `/plugins` manages that profile's rows.
399
+ `/plugins` manages that profile's rows, and `/plugins search <word>` lists what the npm registry
400
+ has with the `dsh-plugin` keyword — the desktop app's plugin browser, from the chat. Each result
401
+ carries a plus button that runs `/plugins add <name>`.
400
402
 
401
403
  ### Goals and tasks
402
404
 
package/bot-menu.mjs CHANGED
@@ -38,15 +38,12 @@ const COMMANDS = [
38
38
  { command: 'seed', description: 'Засеять пустую тему текстом и закрепить' },
39
39
  { command: 'goal', description: 'Цель темы: /goal <текст>, /goal done' },
40
40
  { command: 'task', description: 'Задачи: /task <текст>, /task done <n>' },
41
- { command: 'tasks', description: 'Список задач кнопками: нажатие закрывает' },
42
41
  { command: 'sessions', description: 'Сессии темы — обычный текст продолжает последнюю' },
43
42
  { command: 'resume', description: 'Продолжить сессию: /resume <id>' },
44
43
  { command: 'model', description: 'Показать или сменить: /model, /model <id>' },
45
- { command: 'models', description: 'Все модели профиля и цены' },
46
44
  { command: 'skills', description: 'Скиллы: список или текст одного' },
47
45
  { command: 'soul', description: 'Персона: показать или задать' },
48
46
  { command: 'plugins', description: 'Список, add, remove, disable, enable — всё здесь' },
49
- { command: 'plugin', description: 'Старая форма /plugins — то же самое' },
50
47
  { command: 'app', description: 'Приложение DSH, не мост: /app restart confirm' },
51
48
  { command: 'restart', description: 'Перезапуск моста: /restart confirm' },
52
49
  { command: 'doctor', description: 'Диагностика: мост, сеть, диск, плагины, сессия' },
@@ -59,7 +56,6 @@ const COMMANDS = [
59
56
  { command: 'reasoning', description: 'Заметки по ходу: /reasoning on|off' },
60
57
  { command: 'profile', description: 'Профиль темы: /profile <имя>, /profile new' },
61
58
  { command: 'agents', description: 'Агенты и субагенты: кто, на какой модели, кого запускали' },
62
- { command: 'agentset', description: 'Набор настроек темы: модель, права, пресет одним переключателем' },
63
59
  { command: 'effort', description: 'Усилие рассуждения модели: /effort high' },
64
60
  { command: 'permissions', description: 'Права профиля: пресет песочницы и подтверждений' },
65
61
  { command: 'preset', description: 'Пресет агента (персона и инструменты): /preset <id>' },
@@ -82,15 +78,12 @@ const COMMANDS_EN = [
82
78
  { command: 'seed', description: 'Seed an empty topic with text and pin it' },
83
79
  { command: 'goal', description: 'Topic goal: /goal <text>, /goal done' },
84
80
  { command: 'task', description: 'Checklist: /task <text>, /task done <n>' },
85
- { command: 'tasks', description: 'Task list as buttons: tap to close' },
86
81
  { command: 'sessions', description: 'Sessions of this topic — plain text continues the last one' },
87
82
  { command: 'resume', description: 'Continue a session: /resume <id>' },
88
83
  { command: 'model', description: 'Show or switch: /model, /model <id>' },
89
- { command: 'models', description: 'All models of this profile with prices' },
90
84
  { command: 'skills', description: 'Installed skills' },
91
85
  { command: 'soul', description: 'Agent persona' },
92
86
  { command: 'plugins', description: 'List, add, remove, disable, enable — all here' },
93
- { command: 'plugin', description: 'Старая форма /plugins — то же самое' },
94
87
  { command: 'app', description: 'DSH desktop app (not the bridge)' },
95
88
  { command: 'restart', description: 'Restart the bridge: /restart confirm' },
96
89
  { command: 'doctor', description: 'Diagnostics: bridge, network, disk, plugins, session' },
@@ -103,7 +96,6 @@ const COMMANDS_EN = [
103
96
  { command: 'reasoning', description: 'Working notes: /reasoning on|off' },
104
97
  { command: 'profile', description: 'Topic profile: /profile <name>, /profile new' },
105
98
  { command: 'agents', description: 'Agents and subagents: who runs, on which model, who was spawned' },
106
- { command: 'agentset', description: 'Named settings for this topic: model, permissions, preset in one switch' },
107
99
  { command: 'effort', description: 'Reasoning effort: /effort high' },
108
100
  { command: 'permissions', description: 'Profile permissions: sandbox and approval preset' },
109
101
  { command: 'preset', description: 'Agent preset (persona and tools): /preset <id>' },
@@ -126,15 +118,12 @@ const COMMANDS_ZH = [
126
118
  { command: 'seed', description: '用文本初始化空话题并置顶' },
127
119
  { command: 'goal', description: '本话题目标:/goal <文本>、/goal done' },
128
120
  { command: 'task', description: '任务清单:/task <文本>、/task done <n>' },
129
- { command: 'tasks', description: '任务列表按钮:点击即完成' },
130
121
  { command: 'sessions', description: '本主题的会话 —— 直接发文字会延续最近一个' },
131
122
  { command: 'resume', description: '继续会话:/resume <id>' },
132
123
  { command: 'model', description: '查看或切换:/model, /model <id>' },
133
- { command: 'models', description: '本配置档的全部模型与价格' },
134
124
  { command: 'skills', description: '已安装的技能' },
135
125
  { command: 'soul', description: '代理人格设定' },
136
126
  { command: 'plugins', description: '列表、add、remove、disable、enable 都在这里' },
137
- { command: 'plugin', description: 'Старая форма /plugins — то же самое' },
138
127
  { command: 'app', description: 'DSH 桌面应用(不是桥接)' },
139
128
  { command: 'restart', description: '重启桥接:/restart confirm' },
140
129
  { command: 'doctor', description: '诊断:桥接、网络、磁盘、插件、会话' },
@@ -147,7 +136,6 @@ const COMMANDS_ZH = [
147
136
  { command: 'reasoning', description: '工作记录:/reasoning on|off' },
148
137
  { command: 'profile', description: '话题配置档:/profile <名称>,/profile new' },
149
138
  { command: 'agents', description: '智能体与子智能体:谁在运行、用什么模型、启动过谁' },
150
- { command: 'agentset', description: '本话题的命名设置:模型、权限、预设一键切换' },
151
139
  { command: 'effort', description: '推理力度:/effort high' },
152
140
  { command: 'permissions', description: '配置档权限:沙箱与确认预设' },
153
141
  { command: 'preset', description: '智能体预设(人格与工具):/preset <id>' },
package/bridge.mjs CHANGED
@@ -1770,7 +1770,7 @@ ${t(lang, 'help.body')}`,
1770
1770
  log(` tool[${telemetry.steps}] ${(stepLine(event) || event.tool || 'tool').slice(0, 140)}`);
1771
1771
  } else if (event.type === 'tool_result') {
1772
1772
  const failed = event.status && event.status !== 'completed';
1773
- log(` tool[${telemetry.steps}] ${failed ? 'ОШИБКА' : 'ok'} ${String(event.tool || '').slice(0, 40)}`);
1773
+ log(` tool[${telemetry.steps}] ${failed ? 'ERROR' : 'ok'} ${String(event.tool || '').slice(0, 40)}`);
1774
1774
  } else if (event.type === 'status' && event.usage) {
1775
1775
  if (Number.isFinite(event.usage.inputTokens)) telemetry.inputTokens = event.usage.inputTokens;
1776
1776
  if (Number.isFinite(event.usage.cacheReadTokens)) telemetry.cacheReadTokens = event.usage.cacheReadTokens;
@@ -2349,6 +2349,22 @@ async function handleCallback(query) {
2349
2349
  return;
2350
2350
  }
2351
2351
 
2352
+ // A search result's plus button. The name came from the registry and the
2353
+ // command is the one the hint under the list names, so a tap installs exactly
2354
+ // what was read — no hidden second path into pnpm.
2355
+ if (data.startsWith('pl:i:')) {
2356
+ const wanted = data.slice(5);
2357
+ if (!/^(@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i.test(wanted)) {
2358
+ await answer(t(lang, 'bridge.cb.unknown'));
2359
+ return;
2360
+ }
2361
+ await clearKeyboard();
2362
+ await answer(`/plugin add ${wanted}`);
2363
+ log(`plugin install via button: ${wanted}`);
2364
+ await runCommandFromButton(`/plugin add ${wanted}`, { chatId, threadId, key, lang });
2365
+ return;
2366
+ }
2367
+
2352
2368
  if (data.startsWith('fk:')) {
2353
2369
  // A branch button from /branches. It does what `/resume <id>` does, so the
2354
2370
  // topic moves onto that branch and the answer comes from the command
@@ -2987,4 +3003,4 @@ async function main() {
2987
3003
  }
2988
3004
  }
2989
3005
 
2990
- main();
3006
+ main();
package/control.mjs CHANGED
@@ -24,6 +24,7 @@ import { MENU_GROUPS, commandForName, renderPanel, replyKeyboard } from './menu-
24
24
  import { explainCommand } from './help-explain.mjs';
25
25
  import { profileValues, resolveSettings } from './settings.mjs';
26
26
  import { UPDATE_DEFAULTS, describeUpdate, modeChange, updateState } from './update-policy.mjs';
27
+ import { rowLine, searchPlugins } from './plugin-search.mjs';
27
28
 
28
29
  const HOME = homedir();
29
30
  const DSH_HOME = process.env.DSH_HOME || join(HOME, '.dsh');
@@ -757,7 +758,7 @@ export async function handleControl(ctx) {
757
758
  const [maybeAction] = String(arg || '').trim().split(/\s+/);
758
759
  // `/plugins add|remove|disable|enable …` is the same work as `/plugin …`;
759
760
  // the case bodies read `arg`, which already holds the action and its value.
760
- if (['add', 'remove', 'disable', 'enable'].includes((maybeAction || '').toLowerCase())) {
761
+ if (['add', 'remove', 'disable', 'enable', 'search', 'find'].includes((maybeAction || '').toLowerCase())) {
761
762
  effective = '/plugin';
762
763
  }
763
764
  }
@@ -1432,6 +1433,43 @@ export async function handleControl(ctx) {
1432
1433
  const [action, ...rest] = (arg || '').split(/\s+/);
1433
1434
  const target = (rest[0] === 'headless' || rest[0] === 'desktop') && rest.length > 1 ? rest.shift() : 'desktop';
1434
1435
  const value = rest.join(' ').trim();
1436
+ if (action === 'search' || action === 'find') {
1437
+ // The marketplace, from the chat. A word is optional: with none, the
1438
+ // registry lists what DSH plugins exist at all — the question the
1439
+ // desktop app answers with a page.
1440
+ const found = await searchPlugins(value, { fetchImpl: ctx.fetch || fetch });
1441
+ if (!found.ok) {
1442
+ say(t(lang, 'ctrl.plugin.searchFailed', { err: found.error }));
1443
+ return true;
1444
+ }
1445
+ if (!found.rows.length) {
1446
+ say(t(lang, 'ctrl.plugin.searchEmpty', { word: value || 'dsh-plugin' }));
1447
+ return true;
1448
+ }
1449
+ const installed = new Set(pluginsOf(target).bundles);
1450
+ const body = found.rows.map((row) => rowLine(row, installed.has(row.name))).join('\n\n');
1451
+ // A button under a result is the shortest honest path from "I found it"
1452
+ // to "it is installed": it runs `/plugin add <name>` and nothing else.
1453
+ say(
1454
+ [
1455
+ t(lang, 'ctrl.plugin.searchTitle', {
1456
+ n: found.rows.length,
1457
+ word: value || t(lang, 'ctrl.plugin.searchAll'),
1458
+ profile: target,
1459
+ }),
1460
+ '',
1461
+ body,
1462
+ '',
1463
+ t(lang, 'ctrl.plugin.searchHint'),
1464
+ ].join('\n'),
1465
+ {
1466
+ keyboard: found.rows.slice(0, 6).map((row) => [
1467
+ { text: `+ ${row.name}`, callback_data: `pl:i:${row.name}` },
1468
+ ]),
1469
+ },
1470
+ );
1471
+ return true;
1472
+ }
1435
1473
  if (!action || !value) {
1436
1474
  say(t(lang, 'ctrl.plugin.usage'));
1437
1475
  return true;