dsh-tg-bridge 1.7.5 → 1.7.7

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/agents.mjs ADDED
@@ -0,0 +1,191 @@
1
+ // Reading a profile's delegation setup out of its Cordis patch.
2
+ //
3
+ // A profile patch is YAML, and this module deliberately does not parse YAML: it
4
+ // reads the few keys the bridge reports on, from the rows that declare them.
5
+ // A row is `- id: <row>` with `name:` and `config:` beside it, so the row ends
6
+ // where the indent drops back to the dash, and the config's own keys are the
7
+ // shallowest lines inside it.
8
+ //
9
+ // This is its own module with tests because a wrong indent assumption turns
10
+ // "the subagent model is X" into a confident lie, and a person setting a cost
11
+ // budget has to be able to trust that line.
12
+
13
+ /** Indent width of a line (tabs count as one column, as YAML forbids them). */
14
+ const indentOf = (line) => /^\s*/.exec(line)[0].length;
15
+
16
+ /** Strip one layer of matching quotes. */
17
+ const unquote = (value) => value.replace(/^['"]|['"]$/g, '');
18
+
19
+ /**
20
+ * The row that owns the `name:` line at `at`: its dash line indent and the
21
+ * lines below it, up to the next row.
22
+ * @param {string[]} lines patch lines
23
+ * @param {number} at index of the `name:` line
24
+ * @returns {{ indent: number, body: string[] }}
25
+ */
26
+ function rowAt(lines, at) {
27
+ let indent = Math.max(0, indentOf(lines[at]) - 2);
28
+ for (let i = at - 1; i >= 0 && i >= at - 3; i -= 1) {
29
+ if (/^\s*-\s*(id|name):/.test(lines[i])) {
30
+ indent = indentOf(lines[i]);
31
+ break;
32
+ }
33
+ }
34
+ const body = [];
35
+ for (let i = at + 1; i < lines.length; i += 1) {
36
+ const line = lines[i];
37
+ if (!line.trim()) continue;
38
+ if (indentOf(line) <= indent) break;
39
+ body.push(line);
40
+ }
41
+ return { indent, body };
42
+ }
43
+
44
+ /**
45
+ * The keys of a nested block (`config:`, `agentOptions:`), read as a flat map of
46
+ * its shallowest keys. Deeper values belong to the nested maps this module reads
47
+ * separately, so they never override a top-level key.
48
+ * @param {string[]} body lines below the block's key
49
+ * @param {number} base indent of the block's key line
50
+ */
51
+ function blockKeys(body, base) {
52
+ const rows = body.filter((line) => indentOf(line) > base && !/^\s*-\s/.test(line));
53
+ if (rows.length === 0) return {};
54
+ const depth = Math.min(...rows.map(indentOf));
55
+ const out = {};
56
+ for (const line of rows) {
57
+ if (indentOf(line) !== depth) continue;
58
+ const match = /^\s*([A-Za-z][\w-]*):\s*(.*?)\s*$/.exec(line);
59
+ if (!match) continue;
60
+ if (match[2]) out[match[1]] = unquote(match[2]);
61
+ else out[match[1]] = true;
62
+ }
63
+ return out;
64
+ }
65
+
66
+ /** Index of the last `key:` line at a depth shallower than `body`'s keys. */
67
+ function blockStart(body, key) {
68
+ for (let i = body.length - 1; i >= 0; i -= 1) {
69
+ if (new RegExp(`^\\s*${key}:\\s*$`).test(body[i])) return i;
70
+ }
71
+ return -1;
72
+ }
73
+
74
+ /** A `toolFilter:` allow/deny list, counted rather than enumerated. */
75
+ function toolFilterOf(body) {
76
+ const at = blockStart(body, 'toolFilter');
77
+ if (at < 0) return { allow: 0, deny: 0 };
78
+ const base = indentOf(body[at]);
79
+ const out = { allow: 0, deny: 0 };
80
+ let list = '';
81
+ for (let i = at + 1; i < body.length; i += 1) {
82
+ const line = body[i];
83
+ if (!line.trim()) continue;
84
+ if (indentOf(line) <= base) break;
85
+ const key = /^\s*(allow|deny):\s*$/.exec(line);
86
+ if (key) {
87
+ list = key[1];
88
+ continue;
89
+ }
90
+ if (list && /^\s*-\s*\S/.test(line)) out[list] += 1;
91
+ }
92
+ return out;
93
+ }
94
+
95
+ /**
96
+ * Every `dsh-tool-subagent` row of a patch: one per delegation tool the model
97
+ * can actually see (`subagent`, `subagent_fork`, …).
98
+ * @param {string} text profile patch
99
+ */
100
+ export function parseSubagentRows(text) {
101
+ const lines = String(text || '').split(/\r?\n/);
102
+ const rows = [];
103
+ for (let i = 0; i < lines.length; i += 1) {
104
+ if (!/^\s*name:\s*['"]?@deepseek-ai\/dsh-tool-subagent['"]?\s*$/.test(lines[i])) continue;
105
+ const { body } = rowAt(lines, i);
106
+ const configAt = blockStart(body, 'config');
107
+ const config = configAt >= 0 ? blockKeys(body.slice(configAt + 1), indentOf(body[configAt])) : {};
108
+ const optionsAt = blockStart(body, 'agentOptions');
109
+ const options = optionsAt >= 0 ? blockKeys(body.slice(optionsAt + 1), indentOf(body[optionsAt])) : {};
110
+ const filter = toolFilterOf(body);
111
+ // The row id sits on the line above `name:`; a patch can also declare the
112
+ // pair inline, and then there is nothing to name the row by.
113
+ const idLine = i > 0 ? /^\s*-\s*id:\s*(\S+)\s*$/.exec(lines[i - 1]) : null;
114
+ rows.push({
115
+ id: idLine ? idLine[1] : '',
116
+ toolName: config.toolName || 'subagent',
117
+ provider: config.provider || 'spawn',
118
+ model: options.model || '',
119
+ modelProvider: options.provider || '',
120
+ reasoningEffort: options.reasoningEffort || '',
121
+ maxTokens: options.maxTokens || '',
122
+ maxDepth: typeof config.maxDepth === 'string' ? config.maxDepth : '',
123
+ backgroundMode: config.backgroundMode || 'one-shot',
124
+ background: config.enableRunInBackground !== 'false',
125
+ persona: body.some((line) => /^\s*persona:\s*\S/.test(line)),
126
+ toolAllow: filter.allow,
127
+ toolDeny: filter.deny,
128
+ });
129
+ }
130
+ return rows;
131
+ }
132
+
133
+ /**
134
+ * The `model-selection-settings` row: which routes a delegated turn may pick.
135
+ * Absent means the child simply inherits the tool's own `agentOptions`.
136
+ * @param {string} text profile patch
137
+ */
138
+ export function parseModelSelection(text) {
139
+ const lines = String(text || '').split(/\r?\n/);
140
+ const at = lines.findIndex((line) => /^\s*name:\s*['"]?@deepseek-ai\/dsh-tool-subagent\/model-selection-settings['"]?\s*$/.test(line));
141
+ if (at < 0) return null;
142
+ const { body } = rowAt(lines, at);
143
+ const configAt = blockStart(body, 'config');
144
+ const config = configAt >= 0 ? blockKeys(body.slice(configAt + 1), indentOf(body[configAt])) : {};
145
+ const allowed = [];
146
+ const base = blockStart(body, 'allowedModels');
147
+ if (base >= 0) {
148
+ const indent = indentOf(body[base]);
149
+ let current = null;
150
+ for (let i = base + 1; i < body.length; i += 1) {
151
+ const line = body[i];
152
+ if (!line.trim()) continue;
153
+ if (indentOf(line) <= indent && !/^\s*-/.test(line)) break;
154
+ const start = /^\s*-\s*(.*)$/.exec(line);
155
+ if (start) {
156
+ current = {};
157
+ allowed.push(current);
158
+ const inline = /^(provider|model):\s*(\S+)/.exec(start[1]);
159
+ if (inline) current[inline[1]] = unquote(inline[2]);
160
+ continue;
161
+ }
162
+ const pair = /^\s*([a-z]+):\s*(\S+)/.exec(line);
163
+ if (pair && current) current[pair[1]] = unquote(pair[2]);
164
+ }
165
+ }
166
+ return { enabled: config.enabled !== 'false', allowed };
167
+ }
168
+
169
+ /**
170
+ * Child sessions this session started, newest first, from DSH's projection
171
+ * cache. The catalog row is what the delegation tools themselves publish, so
172
+ * the list is the same one the desktop sidebar shows.
173
+ * @param {unknown} cache parsed `session-*.json`
174
+ */
175
+ export function parseSubagentFleet(cache) {
176
+ const rows = cache?.record?.rows ?? cache?.rows ?? {};
177
+ const head = rows.subagentCatalog?.val?.head?.values;
178
+ const list = Array.isArray(head)
179
+ ? head
180
+ .filter((row) => row && typeof row.childId === 'string')
181
+ .map((row) => ({
182
+ id: row.childId,
183
+ label: typeof row.label === 'string' ? row.label : '',
184
+ mode: typeof row.mode === 'string' ? row.mode : '',
185
+ at: Number(row.childCreatedAt) || 0,
186
+ }))
187
+ .sort((a, b) => b.at - a.at)
188
+ : [];
189
+ const policy = rows.subagentModelSelectionPolicy?.val;
190
+ return { children: list, policy: policy && typeof policy === 'object' ? policy : null };
191
+ }
package/bot-menu.mjs CHANGED
@@ -52,6 +52,7 @@ const COMMANDS = [
52
52
  { command: 'lang', description: 'Язык интерфейса: en, ru, zh' },
53
53
  { command: 'reasoning', description: 'Заметки по ходу: /reasoning on|off' },
54
54
  { command: 'profile', description: 'Профиль темы: /profile <имя>, /profile new' },
55
+ { command: 'agents', description: 'Агенты и субагенты: кто, на какой модели, кого запускали' },
55
56
  { command: 'thoughts', description: 'Рассуждения последнего хода (исчезает)' },
56
57
  { command: 'version', description: 'Версия моста и последняя на npm' },
57
58
  { command: 'update', description: 'Обновить мост из npm: /update confirm' },
@@ -82,6 +83,7 @@ const COMMANDS_EN = [
82
83
  { command: 'lang', description: 'Interface language: en, ru, zh' },
83
84
  { command: 'reasoning', description: 'Working notes: /reasoning on|off' },
84
85
  { command: 'profile', description: 'Topic profile: /profile <name>, /profile new' },
86
+ { command: 'agents', description: 'Agents and subagents: who runs, on which model, who was spawned' },
85
87
  { command: 'thoughts', description: 'Reasoning of the last turn (self-deleting)' },
86
88
  { command: 'version', description: 'Bridge version and the latest on npm' },
87
89
  { command: 'update', description: 'Update the bridge from npm: /update confirm' },
@@ -112,6 +114,7 @@ const COMMANDS_ZH = [
112
114
  { command: 'lang', description: '界面语言:en、ru、zh' },
113
115
  { command: 'reasoning', description: '工作记录:/reasoning on|off' },
114
116
  { command: 'profile', description: '话题配置档:/profile <名称>,/profile new' },
117
+ { command: 'agents', description: '智能体与子智能体:谁在运行、用什么模型、启动过谁' },
115
118
  { command: 'thoughts', description: '上一轮的推理(稍后自动消失)' },
116
119
  { command: 'version', description: '桥接版本与 npm 上的最新版本' },
117
120
  { command: 'update', description: '从 npm 更新桥接:/update confirm' },
package/control.mjs CHANGED
@@ -12,6 +12,7 @@ import { fileURLToPath } from 'node:url';
12
12
  import { t, LANGS, normalizeLang } from './i18n.mjs';
13
13
  import { addTask, clearGoal, doneTask, finishGoal, goalOf, progressOf, removeTask, setGoal } from './goals.mjs';
14
14
  import { lastTurnReasoning, lastTurnText, sessionFile, sessionStats } from './thoughts.mjs';
15
+ import { parseModelSelection, parseSubagentFleet, parseSubagentRows } from './agents.mjs';
15
16
 
16
17
  const HOME = homedir();
17
18
  const DSH_HOME = process.env.DSH_HOME || join(HOME, '.dsh');
@@ -304,6 +305,29 @@ function stamp(ms) {
304
305
  return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())} ${pad(d.getHours())}:${pad(d.getMinutes())}`;
305
306
  }
306
307
 
308
+ /**
309
+ * What a profile hands to the model as delegation tools, and which routes a
310
+ * delegated turn may pick. Both live in the profile patch, so a topic's agents
311
+ * are a property of the topic's profile, not of the bridge.
312
+ */
313
+ function agentsOf(profile) {
314
+ const text = read(patchPath(profile));
315
+ return { rows: parseSubagentRows(text), selection: parseModelSelection(text) };
316
+ }
317
+
318
+ /** Child sessions this session started, from DSH's projection cache. */
319
+ function fleetOf(sessionId) {
320
+ if (!sessionId) return { children: [], policy: null };
321
+ const record = readJson(join(DSH_HOME, 'storages', 'session_projcache', 'sessions', `session-${bareId(sessionId)}.json`));
322
+ return parseSubagentFleet(record);
323
+ }
324
+
325
+ /** Loader rows a profile's own patch declares, nested groupings included. */
326
+ function patchRows(profile) {
327
+ const text = read(patchPath(profile));
328
+ return [...text.matchAll(/^\s*-?\s*id:\s*\S+/gm)].length;
329
+ }
330
+
307
331
  /** Recent DSH sessions of this workspace, newest first, with their titles. */
308
332
  function recentSessions(cwd, limit, lang = 'ru') { const root = join(DSH_HOME, 'sessions');
309
333
  const rows = [];
@@ -368,6 +392,21 @@ function recentSessions(cwd, limit, lang = 'ru') { const root = join(DSH_HOME,
368
392
  .map((row) => ({ ...row, title: titles.get(bareId(row.id))?.title || t(lang, 'ctrl.sessions.untitled') }));
369
393
  }
370
394
 
395
+ /**
396
+ * A session's title, read from DSH's own projection cache. `/sessions` already
397
+ * shows these, and the status card is a worse place to lose one: the card is
398
+ * what a person screenshots. Empty when the session was never titled.
399
+ */
400
+ function sessionTitle(id) {
401
+ const record = readJson(join(DSH_HOME, 'storages', 'session_projcache', 'sessions', `session-${bareId(id)}.json`));
402
+ const rows = record?.record?.rows ?? record?.rows ?? {};
403
+ const title = rows.title?.val;
404
+ if (typeof title === 'string' && title.trim()) return title.trim();
405
+ const first = rows.titleInput?.val?.first?.text;
406
+ if (typeof first === 'string' && first.trim()) return first.trim().split('\n')[0].slice(0, 80);
407
+ return '';
408
+ }
409
+
371
410
  /** Skills directory listing. */
372
411
  function skillsOf() {
373
412
  const dir = join(DSH_HOME, 'skills');
@@ -421,7 +460,7 @@ function goalView(goal, lang) {
421
460
  * command and the caller must not run a turn.
422
461
  */
423
462
  export const CONTROL_COMMANDS = [
424
- 'status', 'models', 'model', 'profile', 'sessions', 'resume', 'plugins', 'plugin',
463
+ 'status', 'models', 'model', 'profile', 'agents', 'sessions', 'resume', 'plugins', 'plugin',
425
464
  'skills', 'soul', 'restart', 'app', 'stop', 'new', 'seed', 'send', 'cd',
426
465
  'prices', 'help', 'doctor', 'logs', 'lang', 'reasoning', 'goal', 'task',
427
466
  'thoughts', 'version', 'update',
@@ -494,7 +533,7 @@ export async function handleControl(ctx) {
494
533
  // ("how much context is left", "how big is this session").
495
534
  const sessionId = state.sessions[key] || '';
496
535
  const stats = sessionId ? sessionStats(sessionFile(join(DSH_HOME, 'sessions'), sessionId)) : null;
497
- const title = sessionId ? state.titles?.[key] : '';
536
+ const title = sessionId ? (state.titles?.[key] || sessionTitle(sessionId)) : '';
498
537
  const lines = [t(lang, 'ctrl.status.head')];
499
538
  lines.push(t(lang, 'ctrl.status.session', { id: sessionId || t(lang, 'ctrl.session.none') }));
500
539
  if (title) lines.push(t(lang, 'ctrl.status.title', { title }));
@@ -597,6 +636,29 @@ export async function handleControl(ctx) {
597
636
  return true;
598
637
  }
599
638
 
639
+ if (action === 'show') {
640
+ // One card per profile: what it runs, what it carries, who may delegate.
641
+ // `/profile` alone answers "which one am I on"; this answers "should I
642
+ // switch to it", which is the question a person asks next.
643
+ const name = verb || bound || activeProfile;
644
+ if (!profiles.includes(name)) {
645
+ say(t(lang, 'profile.unknown', { name, list: profiles.join(', ') }));
646
+ return true;
647
+ }
648
+ const pkg = pluginsOf(name);
649
+ const route = modelOf(name);
650
+ const { rows, selection } = agentsOf(name);
651
+ say([
652
+ t(lang, 'ctrl.profile.title', { name }),
653
+ t(lang, 'ctrl.profile.model', { route: `${route.provider}/${route.model}` }),
654
+ t(lang, 'ctrl.profile.plugins', { n: patchRows(name), off: pkg.disabled.length }),
655
+ t(lang, 'ctrl.profile.bundles', { n: pkg.bundles.length }),
656
+ t(lang, 'ctrl.profile.agents', { n: rows.length, routes: selection ? selection.allowed.length : 0 }),
657
+ t(lang, 'ctrl.profile.file', { path: join(PROFILES, name, 'cordis.patch.yml') }),
658
+ ].join('\n'));
659
+ return true;
660
+ }
661
+
600
662
  if (action === 'new') {
601
663
  const from = template || 'headless';
602
664
  if (!verb || !/^[a-z0-9][a-z0-9-]{1,30}$/.test(verb)) {
@@ -641,6 +703,75 @@ export async function handleControl(ctx) {
641
703
  return true;
642
704
  }
643
705
 
706
+ case '/agents': {
707
+ // The desktop sidebar has a subagent list and a settings page; Telegram
708
+ // gets the same two facts in one card: what this profile hands the model
709
+ // as delegation tools, and which children this session actually started.
710
+ const profileName = state.profiles?.[key] || activeProfile;
711
+ const { rows, selection } = agentsOf(profileName);
712
+ const head = modelOf(profileName);
713
+ const fleet = fleetOf(state.sessions?.[key]);
714
+ const wanted = String(arg || '').trim();
715
+
716
+ if (wanted) {
717
+ const needle = wanted.replace(/^session-/, '').toLowerCase();
718
+ const child = fleet.children.find((row) => row.id.replace(/^session-/, '').toLowerCase().startsWith(needle)
719
+ || row.label.toLowerCase().includes(wanted.toLowerCase()));
720
+ if (!child) {
721
+ say(t(lang, 'ctrl.agents.notFound', { id: wanted }));
722
+ return true;
723
+ }
724
+ say([
725
+ t(lang, 'ctrl.agents.oneTitle', { id: child.id }),
726
+ t(lang, 'ctrl.agents.oneName', { label: child.label || '—' }),
727
+ t(lang, 'ctrl.agents.oneMode', { mode: child.mode || '—' }),
728
+ t(lang, 'ctrl.agents.oneCreated', { when: stamp(child.at) }),
729
+ '',
730
+ t(lang, 'ctrl.agents.resume', { id: child.id }),
731
+ ].join('\n'));
732
+ return true;
733
+ }
734
+
735
+ const lines = [
736
+ t(lang, 'ctrl.agents.title'),
737
+ t(lang, 'ctrl.agents.profile', { name: profileName, route: `${head.provider}/${head.model}` }),
738
+ t(lang, 'ctrl.agents.tools', { n: rows.length }),
739
+ ];
740
+ for (const row of rows) {
741
+ lines.push(row.model
742
+ ? ` • ${row.toolName} — ${row.provider}, ${row.modelProvider ? `${row.modelProvider}/` : ''}${row.model}`
743
+ : t(lang, 'ctrl.agents.rowNoModel', { tool: row.toolName, provider: row.provider }));
744
+ const filter = row.toolAllow + row.toolDeny > 0
745
+ ? t(lang, 'ctrl.agents.filterList', { allow: row.toolAllow, deny: row.toolDeny })
746
+ : t(lang, 'ctrl.agents.filterNone');
747
+ lines.push(t(lang, 'ctrl.agents.detail', {
748
+ depth: row.maxDepth || t(lang, 'ctrl.agents.hostDepth'),
749
+ bg: row.background ? t(lang, 'ctrl.status.on') : t(lang, 'ctrl.status.off'),
750
+ filter,
751
+ }));
752
+ }
753
+ if (selection && selection.allowed.length > 0) {
754
+ lines.push(t(lang, 'ctrl.agents.routes', { n: selection.allowed.length }));
755
+ for (const route of selection.allowed) lines.push(` • ${route.provider}/${route.model}`);
756
+ }
757
+ lines.push(t(lang, 'ctrl.agents.children', { n: fleet.children.length }));
758
+ if (fleet.children.length === 0) {
759
+ lines.push(t(lang, 'ctrl.agents.noChildren'));
760
+ } else {
761
+ for (const child of fleet.children.slice(0, 8)) {
762
+ lines.push(t(lang, 'ctrl.agents.childLine', {
763
+ label: (child.label || t(lang, 'ctrl.sessions.untitled')).slice(0, 40),
764
+ mode: child.mode || '—',
765
+ when: stamp(child.at),
766
+ }));
767
+ }
768
+ if (fleet.children.length > 8) lines.push(` … +${fleet.children.length - 8}`);
769
+ }
770
+ lines.push(t(lang, 'ctrl.agents.hint'));
771
+ say(lines.join('\n'));
772
+ return true;
773
+ }
774
+
644
775
  case '/sessions': {
645
776
  const limit = Number.parseInt(arg, 10) > 0 ? Math.min(Number.parseInt(arg, 10), 20) : 8;
646
777
  const rows = recentSessions((state.cwd && state.cwd[key]) || config.cwd, limit, lang);
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\nModels: /model · /model \u003cid\u003e · /prices · /thoughts\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 \u003cid\u003e\nModels: /model · /model \u003cid\u003e · /prices · /thoughts\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',
@@ -52,7 +52,13 @@ const DICT = {
52
52
  'profile.default': ' (default)',
53
53
  'profile.current': 'Topic profile: {name}',
54
54
  'profile.available': 'Available: {list}',
55
- 'profile.hint': 'Switch: /profile <name> · back to the install default: /profile default · new from a template: /profile new myspace from web',
55
+ 'profile.hint': 'Switch: /profile <name> · back to the install default: /profile default · new from a template: /profile new myspace from web · what a profile runs: /profile show [name]',
56
+ 'ctrl.profile.title': '🧩 Profile {name}',
57
+ 'ctrl.profile.model': 'Model: {route}',
58
+ 'ctrl.profile.plugins': 'Rows in the profile patch: {n} (disabled {off})',
59
+ 'ctrl.profile.bundles': 'Bundles: {n}',
60
+ 'ctrl.profile.agents': 'Delegation tools: {n}, child routes: {routes}',
61
+ 'ctrl.profile.file': 'File: {path}',
56
62
  'profile.unknown': 'No profile "{name}". Available: {list}',
57
63
  'profile.unknownTemplate': 'No template "{name}". Available: {list}',
58
64
  'profile.exists': 'Profile "{name}" already exists — switch to it with /profile {name}.',
@@ -89,6 +95,25 @@ const DICT = {
89
95
  'ctrl.status.off': 'off',
90
96
  'ctrl.status.skills': 'Skills: {n}',
91
97
  'ctrl.status.ui': 'UI: desktop ({route}) — bundled plugins: {n}',
98
+ 'ctrl.agents.title': '🤖 Agents and subagents',
99
+ 'ctrl.agents.profile': 'Profile: {name} ({route})',
100
+ 'ctrl.agents.tools': 'Delegation tools: {n}',
101
+ 'ctrl.agents.rowNoModel': ' • {tool} — {provider}, model: inherits the session route',
102
+ 'ctrl.agents.detail': ' depth: {depth} · background: {bg} · tool filter: {filter}',
103
+ 'ctrl.agents.hostDepth': 'host default',
104
+ 'ctrl.agents.filterNone': 'none',
105
+ 'ctrl.agents.filterList': 'allow {allow}, deny {deny}',
106
+ 'ctrl.agents.routes': 'Routes a delegated turn may pick ({n}):',
107
+ 'ctrl.agents.children': 'Children of this session: {n}',
108
+ 'ctrl.agents.childLine': ' • {label} — {mode}, {when}',
109
+ 'ctrl.agents.noChildren': 'No child sessions yet — the model has not delegated in this session.',
110
+ 'ctrl.agents.notFound': 'No child with id or label "{id}" in this session.',
111
+ 'ctrl.agents.oneTitle': '🤖 Subagent {id}',
112
+ 'ctrl.agents.oneName': 'Name: {label}',
113
+ 'ctrl.agents.oneMode': 'Mode: {mode}',
114
+ 'ctrl.agents.oneCreated': 'Created: {when}',
115
+ 'ctrl.agents.resume': 'Continue it here: /resume {id}',
116
+ 'ctrl.agents.hint': 'A profile owns its agents: edit delegation in ~/.dsh/profiles/<name>/cordis.patch.yml, switch a topic with /profile <name>.',
92
117
  'ctrl.models.current': 'Current model: {model}',
93
118
  'ctrl.models.none': 'Profile {name} has no model list',
94
119
  'ctrl.models.available': 'Available:',
@@ -136,7 +161,7 @@ const DICT = {
136
161
  'ctrl.version.offline': 'unreachable',
137
162
  'ctrl.version.update': 'Update available: /update, then /update confirm',
138
163
  'ctrl.version.root': 'Bridge directory: {path}',
139
- 'ctrl.version.stale': 'Files are newer than this process ({when}) — /restart confirm loads them.',
164
+ 'ctrl.version.stale': 'Files are newer than this process ({when}) — /restart confirm loads them.',
140
165
  'ctrl.version.hint': 'The new code loads after /restart confirm; the current chat keeps running until then.',
141
166
  'ctrl.update.available': 'Version {from} is running, {to} is on npm.\nInstall it: /update confirm.\nEverything keeps working on the old code until /restart confirm.',
142
167
  'ctrl.update.current': 'Already on {v} — the latest published version.',
@@ -292,7 +317,7 @@ const DICT = {
292
317
  'status.failed': 'Ход не удался',
293
318
  'status.queued': 'в очереди',
294
319
  'status.stop': 'Стоп',
295
- '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Модели: /model · /model \u003cid\u003e · /prices · /thoughts\nРасширения: /skills · /plugins · /plugin add|remove · /soul\nВерсии: /version · /update · /update confirm\nПрочее: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
320
+ '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Расширения: /skills · /plugins · /plugin add|remove · /soul\nВерсии: /version · /update · /update confirm\nПрочее: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
296
321
  'btn.stop': 'Стоп',
297
322
  'btn.logs': 'Логи',
298
323
  'btn.retry': 'Повторить',
@@ -325,7 +350,13 @@ const DICT = {
325
350
  'profile.default': ' (по умолчанию)',
326
351
  'profile.current': 'Профиль темы: {name}',
327
352
  'profile.available': 'Доступны: {list}',
328
- 'profile.hint': 'Переключить: /profile <имя> · вернуться к общему: /profile default · новый из шаблона: /profile new myspace from web',
353
+ 'profile.hint': 'Переключить: /profile <имя> · вернуться к общему: /profile default · новый из шаблона: /profile new myspace from web · что внутри профиля: /profile show [имя]',
354
+ 'ctrl.profile.title': '🧩 Профиль {name}',
355
+ 'ctrl.profile.model': 'Модель: {route}',
356
+ 'ctrl.profile.plugins': 'Строк в патче профиля: {n} (выключено {off})',
357
+ 'ctrl.profile.bundles': 'Пакетов в bundle: {n}',
358
+ 'ctrl.profile.agents': 'Инструментов делегирования: {n}, маршрутов детям: {routes}',
359
+ 'ctrl.profile.file': 'Файл: {path}',
329
360
  'profile.unknown': 'Профиля «{name}» нет. Доступны: {list}',
330
361
  'profile.unknownTemplate': 'Шаблона «{name}» нет. Доступны: {list}',
331
362
  'profile.exists': 'Профиль «{name}» уже есть — переключиться: /profile {name}.',
@@ -362,6 +393,25 @@ const DICT = {
362
393
  'ctrl.status.off': 'выключены',
363
394
  'ctrl.status.skills': 'Скиллы: {n}',
364
395
  'ctrl.status.ui': 'UI: desktop ({route}) — плагинов {n}',
396
+ 'ctrl.agents.title': '🤖 Агенты и субагенты',
397
+ 'ctrl.agents.profile': 'Профиль: {name} ({route})',
398
+ 'ctrl.agents.tools': 'Инструментов делегирования: {n}',
399
+ 'ctrl.agents.rowNoModel': ' • {tool} — {provider}, модель: как у сессии',
400
+ 'ctrl.agents.detail': ' глубина: {depth} · фон: {bg} · фильтр инструментов: {filter}',
401
+ 'ctrl.agents.hostDepth': 'по умолчанию хоста',
402
+ 'ctrl.agents.filterNone': 'нет',
403
+ 'ctrl.agents.filterList': 'разрешено {allow}, запрещено {deny}',
404
+ 'ctrl.agents.routes': 'Маршруты, которые может выбрать субагент ({n}):',
405
+ 'ctrl.agents.children': 'Детей у этой сессии: {n}',
406
+ 'ctrl.agents.childLine': ' • {label} — {mode}, {when}',
407
+ 'ctrl.agents.noChildren': 'Детских сессий пока нет — в этой сессии агент не делегировал.',
408
+ 'ctrl.agents.notFound': 'В этой сессии нет ребёнка с id или именем «{id}».',
409
+ 'ctrl.agents.oneTitle': '🤖 Субагент {id}',
410
+ 'ctrl.agents.oneName': 'Название: {label}',
411
+ 'ctrl.agents.oneMode': 'Режим: {mode}',
412
+ 'ctrl.agents.oneCreated': 'Создан: {when}',
413
+ 'ctrl.agents.resume': 'Продолжить здесь: /resume {id}',
414
+ 'ctrl.agents.hint': 'Агентами владеет профиль: делегирование правится в ~/.dsh/profiles/<имя>/cordis.patch.yml, профиль темы переключается /profile <имя>.',
365
415
  'ctrl.models.current': 'Модель сейчас: {model}',
366
416
  'ctrl.models.none': 'В профиле {name} нет списка моделей',
367
417
  'ctrl.models.available': 'Доступные:',
@@ -409,7 +459,7 @@ const DICT = {
409
459
  'ctrl.version.offline': 'недоступен',
410
460
  'ctrl.version.update': 'Есть обновление: /update, затем /update confirm',
411
461
  'ctrl.version.root': 'Каталог моста: {path}',
412
- 'ctrl.version.stale': 'Файлы новее запуска ({when}) — /restart confirm загрузит их.',
462
+ 'ctrl.version.stale': 'Файлы новее запуска ({when}) — /restart confirm загрузит их.',
413
463
  'ctrl.version.hint': 'Новый код включится после /restart confirm — до этого чат работает как есть.',
414
464
  'ctrl.update.available': 'Работает {from}, на npm уже {to}.\nПоставить: /update confirm.\nДо /restart confirm всё работает на старом коде.',
415
465
  'ctrl.update.current': 'Уже стоит {v} — это последняя опубликованная версия.',
@@ -565,7 +615,7 @@ const DICT = {
565
615
  'status.failed': '运行失败',
566
616
  'status.queued': '排队中',
567
617
  'status.stop': '停止',
568
- '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模型: /model · /model \u003cid\u003e · /prices · /thoughts\n扩展: /skills · /plugins · /plugin add|remove · /soul\n版本: /version · /update · /update confirm\n其他: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
618
+ '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扩展: /skills · /plugins · /plugin add|remove · /soul\n版本: /version · /update · /update confirm\n其他: /lang · /reasoning · /doctor · /logs [errors|N] · /app · /restart · /help",
569
619
  'btn.stop': '停止',
570
620
  'btn.logs': '日志',
571
621
  'btn.retry': '重试',
@@ -598,7 +648,13 @@ const DICT = {
598
648
  'profile.default': '(默认)',
599
649
  'profile.current': '话题配置档:{name}',
600
650
  'profile.available': '可用:{list}',
601
- 'profile.hint': '切换:/profile <名称> · 回到默认:/profile default · 从模板新建:/profile new myspace from web',
651
+ 'profile.hint': '切换:/profile <名称> · 回到默认:/profile default · 从模板新建:/profile new myspace from web · 查看配置档内容:/profile show [名称]',
652
+ 'ctrl.profile.title': '🧩 配置档 {name}',
653
+ 'ctrl.profile.model': '模型:{route}',
654
+ 'ctrl.profile.plugins': '配置档 patch 中的行:{n}(已禁用 {off})',
655
+ 'ctrl.profile.bundles': 'Bundle 中的包:{n}',
656
+ 'ctrl.profile.agents': '委派工具:{n},子会话路由:{routes}',
657
+ 'ctrl.profile.file': '文件:{path}',
602
658
  'profile.unknown': '没有配置档「{name}」。可用:{list}',
603
659
  'profile.unknownTemplate': '没有模板「{name}」。可用:{list}',
604
660
  'profile.exists': '配置档「{name}」已存在——切换:/profile {name}。',
@@ -635,6 +691,25 @@ const DICT = {
635
691
  'ctrl.status.off': '关',
636
692
  'ctrl.status.skills': '技能:{n}',
637
693
  'ctrl.status.ui': 'UI:desktop({route})— 插件 {n} 个',
694
+ 'ctrl.agents.title': '🤖 智能体与子智能体',
695
+ 'ctrl.agents.profile': '配置:{name}({route})',
696
+ 'ctrl.agents.tools': '委派工具:{n}',
697
+ 'ctrl.agents.rowNoModel': ' • {tool} — {provider},模型:跟随会话',
698
+ 'ctrl.agents.detail': ' 深度:{depth} · 后台:{bg} · 工具过滤:{filter}',
699
+ 'ctrl.agents.hostDepth': '宿主默认',
700
+ 'ctrl.agents.filterNone': '无',
701
+ 'ctrl.agents.filterList': '允许 {allow},禁止 {deny}',
702
+ 'ctrl.agents.routes': '子智能体可选的模型路由({n}):',
703
+ 'ctrl.agents.children': '本会话的子会话:{n}',
704
+ 'ctrl.agents.childLine': ' • {label} — {mode},{when}',
705
+ 'ctrl.agents.noChildren': '还没有子会话——本会话中助手尚未委派任务。',
706
+ 'ctrl.agents.notFound': '本会话没有 id 或名称匹配“{id}”的子会话。',
707
+ 'ctrl.agents.oneTitle': '🤖 子智能体 {id}',
708
+ 'ctrl.agents.oneName': '名称:{label}',
709
+ 'ctrl.agents.oneMode': '模式:{mode}',
710
+ 'ctrl.agents.oneCreated': '创建时间:{when}',
711
+ 'ctrl.agents.resume': '在此继续:/resume {id}',
712
+ 'ctrl.agents.hint': '智能体由配置决定:委派设置位于 ~/.dsh/profiles/<名称>/cordis.patch.yml,用 /profile <名称> 切换会话配置。',
638
713
  'ctrl.models.current': '当前模型:{model}',
639
714
  'ctrl.models.none': '配置档 {name} 中没有模型列表',
640
715
  'ctrl.models.available': '可用:',
@@ -682,7 +757,7 @@ const DICT = {
682
757
  'ctrl.version.offline': '不可达',
683
758
  'ctrl.version.update': '有更新:/update,然后 /update confirm',
684
759
  'ctrl.version.root': '桥接目录:{path}',
685
- 'ctrl.version.stale': '文件比本进程更新({when})—— /restart confirm 后生效。',
760
+ 'ctrl.version.stale': '文件比本进程更新({when})—— /restart confirm 后生效。',
686
761
  'ctrl.version.hint': '新代码在 /restart confirm 之后生效;在此之前聊天照常运行。',
687
762
  'ctrl.update.available': '当前 {from},npm 上已是 {to}。\n安装:/update confirm。\n在 /restart confirm 之前一切仍用旧代码。',
688
763
  'ctrl.update.current': '已经是 {v} —— 最新发布版本。',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tg-bridge",
3
- "version": "1.7.5",
3
+ "version": "1.7.7",
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",
@@ -44,6 +44,7 @@
44
44
  "plugin-bridge.mjs",
45
45
  "cordis.patch.yml",
46
46
  "control.mjs",
47
+ "agents.mjs",
47
48
  "goals.mjs",
48
49
  "goal.mjs",
49
50
  "i18n.mjs",