@goodandready/dsh-messenger-gateway 0.3.20 → 0.3.22

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/lib/commands.js CHANGED
@@ -1,70 +1,74 @@
1
- export const DEFAULT_TELEGRAM_COMMANDS = [
2
- { command: 'start', description: 'Подключение и приветствие' },
3
- { command: 'help', description: 'Список команд' },
4
- { command: 'new', description: 'Новая сессия агента' },
5
- { command: 'whoami', description: 'Показать ваш Telegram id' },
6
- { command: 'stop', description: 'Прервать текущий ответ' },
7
- { command: 'pair', description: 'Одобрить код сопряжения: /pair CODE' },
8
- { command: 'sethome', description: 'Home: /sethome [name]' },
9
- { command: 'home', description: 'Список home-каналов' },
10
- { command: 'model', description: 'Интерактивный выбор или смена модели' },
11
- { command: 'top', description: 'Ресурсы сервера: CPU, RAM, uptime, сессии' },
12
- { command: 'topic', description: 'Создать новый форум-топик под задачу: /topic <имя>' },
13
- { command: 'status', description: 'Статус шлюза' },
14
- { command: 'setalert', description: 'Назначить этот чат каналом алертов' },
15
- { command: 'alert', description: 'Статус канала алертов: /alert [test]' },
16
- { command: 'keyboard', description: 'Клавиатура быстрых действий: /keyboard on|off' },
17
- { command: 'role', description: 'Роль и персона агента: /role [name]' },
18
- { command: 'skills', description: 'Список активных инструментов и навыков' },
19
- { command: 'tools', description: 'Список активных инструментов' },
20
- { command: 'fork', description: 'Форк текущей сессии в новую ветку' },
21
- { command: 'export', description: 'Экспорт истории диалога в Markdown' },
22
- { command: 'rewind', description: 'Откат сообщений: /rewind [N]' },
23
- { command: 'files', description: 'Файловый менеджер рабочей папки: /files [dir]' },
24
- { command: 'get', description: 'Скачать файл в Telegram: /get <path>' },
25
- { command: 'remind', description: 'Напоминание: /remind <время> <текст>' },
26
- { command: 'voice', description: 'Голосовые ответы: /voice on|off|status' },
27
- { command: 'tts', description: 'Озвучка в этом чате: /tts on|off|status' },
28
- { command: 'mute', description: 'Не присылать уведомления в этот чат' },
29
- { command: 'unmute', description: 'Вернуть уведомления в этот чат' },
30
- ]
31
-
32
- export function normalizeTelegramCommands(commands) {
33
- const source = Array.isArray(commands) && commands.length ? commands : DEFAULT_TELEGRAM_COMMANDS
34
- const out = []
35
- const seen = new Set()
36
- for (const raw of source) {
37
- if (!raw || typeof raw !== 'object') continue
38
- let command = String(raw.command || '').trim().replace(/^\//, '')
39
- const description = String(raw.description || '').trim()
40
- if (!command || !description) continue
41
- command = command.slice(0, 32).toLowerCase()
42
- if (seen.has(command)) continue
43
- seen.add(command)
44
- out.push({ command, description: description.slice(0, 256) })
45
- }
46
- return out.length ? out : [...DEFAULT_TELEGRAM_COMMANDS]
47
- }
48
-
49
- export function mergeDynamicCommands(baseCommands = DEFAULT_TELEGRAM_COMMANDS, dynamicCommands = [], maxTotal = 100) {
50
- const normalizedBase = normalizeTelegramCommands(baseCommands)
51
- const out = [...normalizedBase]
52
- const seen = new Set(out.map((c) => c.command))
53
-
54
- for (const item of dynamicCommands || []) {
55
- if (out.length >= maxTotal) break
56
- if (!item || typeof item !== 'object') continue
57
- let command = String(item.command || item.name || '').trim().replace(/^\//, '').toLowerCase()
58
- // Telegram format: lowercase alphanumeric and underscore only, 1-32 chars
59
- command = command.replace(/[^a-z0-9_]/g, '_').slice(0, 32)
60
- if (!command || seen.has(command)) continue
61
- let description = String(item.description || item.title || `Скилл ${command}`).trim()
62
- if (!description) description = `Скилл ${command}`
63
- description = description.slice(0, 256)
64
- seen.add(command)
65
- out.push({ command, description })
66
- }
67
-
68
- return out.slice(0, maxTotal)
69
- }
70
-
1
+ export const DEFAULT_TELEGRAM_COMMANDS = [
2
+ { command: 'start', description: 'Connect and show greeting' },
3
+ { command: 'help', description: 'Show commands help' },
4
+ { command: 'new', description: 'Start a new agent session' },
5
+ { command: 'whoami', description: 'Show your messenger user ID' },
6
+ { command: 'stop', description: 'Interrupt current turn' },
7
+ { command: 'pair', description: 'Approve pairing code: /pair CODE' },
8
+ { command: 'sethome', description: 'Set home: /sethome [name]' },
9
+ { command: 'home', description: 'List registered home channels' },
10
+ { command: 'model', description: 'Interactive model selector' },
11
+ { command: 'top', description: 'System resources: CPU, RAM, uptime' },
12
+ { command: 'topic', description: 'Create forum topic: /topic <name>' },
13
+ { command: 'status', description: 'Gateway and bot status' },
14
+ { command: 'setalert', description: 'Designate channel for alerts' },
15
+ { command: 'alert', description: 'Alert channel status: /alert [test]' },
16
+ { command: 'keyboard', description: 'Toggle quick actions: /keyboard on|off' },
17
+ { command: 'role', description: 'Switch persona: /role [name]' },
18
+ { command: 'bind', description: 'Bind preset/persona to forum topic: /bind <name>' },
19
+ { command: 'preset', description: 'Show or switch agent preset: /preset [name]' },
20
+ { command: 'cron', description: 'Manage recurring reports: /cron' },
21
+ { command: 'skills', description: 'List active tools & skills' },
22
+ { command: 'tools', description: 'List active tools' },
23
+ { command: 'fork', description: 'Fork session into new branch' },
24
+ { command: 'export', description: 'Export history to Markdown' },
25
+ { command: 'rewind', description: 'Rewind turns: /rewind [N]' },
26
+ { command: 'files', description: 'Workspace file explorer: /files [dir]' },
27
+ { command: 'get', description: 'Download file to messenger: /get <path>' },
28
+ { command: 'remind', description: 'Set reminder: /remind <time> <text>' },
29
+ { command: 'voice', description: 'Voice reply mode: /voice on|off|status' },
30
+ { command: 'tts', description: 'Speech in this chat: /tts on|off|status' },
31
+ { command: 'mute', description: 'Mute notifications in this chat' },
32
+ { command: 'unmute', description: 'Unmute notifications in this chat' },
33
+ { command: 'update', description: 'Check or install plugin update: /update [now]' },
34
+ ]
35
+
36
+ export function normalizeTelegramCommands(commands) {
37
+ const source = Array.isArray(commands) && commands.length ? commands : DEFAULT_TELEGRAM_COMMANDS
38
+ const out = []
39
+ const seen = new Set()
40
+ for (const raw of source) {
41
+ if (!raw || typeof raw !== 'object') continue
42
+ let command = String(raw.command || '').trim().replace(/^\//, '')
43
+ const description = String(raw.description || '').trim()
44
+ if (!command || !description) continue
45
+ command = command.slice(0, 32).toLowerCase()
46
+ if (seen.has(command)) continue
47
+ seen.add(command)
48
+ out.push({ command, description: description.slice(0, 256) })
49
+ }
50
+ return out.length ? out : [...DEFAULT_TELEGRAM_COMMANDS]
51
+ }
52
+
53
+ export function mergeDynamicCommands(baseCommands = DEFAULT_TELEGRAM_COMMANDS, dynamicCommands = [], maxTotal = 100) {
54
+ const normalizedBase = normalizeTelegramCommands(baseCommands)
55
+ const out = [...normalizedBase]
56
+ const seen = new Set(out.map((c) => c.command))
57
+
58
+ for (const item of dynamicCommands || []) {
59
+ if (out.length >= maxTotal) break
60
+ if (!item || typeof item !== 'object') continue
61
+ let command = String(item.command || item.name || '').trim().replace(/^\//, '').toLowerCase()
62
+ // Telegram format: lowercase alphanumeric and underscore only, 1-32 chars
63
+ command = command.replace(/[^a-z0-9_]/g, '_').slice(0, 32)
64
+ if (!command || seen.has(command)) continue
65
+ let description = String(item.description || item.title || `Skill ${command}`).trim()
66
+ if (!description) description = `Skill ${command}`
67
+ description = description.slice(0, 256)
68
+ seen.add(command)
69
+ out.push({ command, description })
70
+ }
71
+
72
+ return out.slice(0, maxTotal)
73
+ }
74
+
package/lib/config.js CHANGED
@@ -1,104 +1,104 @@
1
- import z from '@deepseek-ai/schemastery'
2
-
3
- const HomeEntry = z.object({
4
- name: z.string().default('default'),
5
- chatId: z.union([z.number(), z.string()]),
6
- threadId: z.number().default(0),
7
- })
8
-
9
- export const PluginConfig = z.object({
10
- enabled: z.boolean().default(true),
11
- internalBaseURL: z.string().default('http://127.0.0.1:3080'),
12
- telegram: z.object({
13
- enabled: z.boolean().default(false),
14
- botToken: z.string().role('secret').default(''),
15
- allowedUserIds: z.array(z.number()).default([]),
16
- pollTimeoutSeconds: z.number().default(50),
17
- pollIntervalMs: z.number().default(500),
18
- commands: z.array(z.object({
19
- command: z.string(),
20
- description: z.string(),
21
- })).default([]),
22
- textFormat: z.union([z.const('html'), z.const('plain')]).default('html').description('html: Markdown→Telegram HTML; plain: без разметки'),
23
- homeChatId: z.union([z.number(), z.string()]).default('').description('Legacy default home chatId'),
24
- homeThreadId: z.number().default(0),
25
- homes: z.array(HomeEntry).default([]).description('Named homes (forum topics / channels)'),
26
- pairingEnabled: z.boolean().default(true).description('Issue pairing codes to unknown users when allowlist is non-empty'),
27
- streaming: z.boolean().default(false).description('If true, edit one Telegram message while tokens arrive; default off'),
28
- streamEditIntervalMs: z.number().default(1200),
29
- progressEnabled: z.boolean().default(true),
30
- approvalsEnabled: z.boolean().default(true),
31
- groupsEnabled: z.boolean().default(true).description('Process group/supergroup messages'),
32
- groupRequireMention: z.boolean().default(true).description('In groups, only respond to @mention, reply-to-bot, or /commands'),
33
- reactionsEnabled: z.boolean().default(true).description('React with 👀 while processing a turn'),
34
- statusIndicator: z.boolean().default(false).description('Opt-in: set bot short description to Online/Offline (bots have no presence)'),
35
- statusOnline: z.string().default('Online'),
36
- statusOffline: z.string().default('Offline'),
37
- transport: z.union([z.const('poll'), z.const('webhook')]).default('poll'),
38
- webhookUrl: z.string().default(''),
39
- webhookSecret: z.string().role('secret').default(''),
40
- webhookPath: z.string().default('/dsh-messenger-gateway/telegram/webhook'),
41
- voiceMode: z.union([z.const('mirror'), z.const('always'), z.const('off')]).default('mirror')
42
- .description('mirror: TTS when inbound was voice; always/off override (per-user /voice wins)'),
43
- quickActions: z.boolean().default(false).description('Show quick actions keyboard in Telegram (/new, /stop, /voice, /status)'),
44
- artifactPreviews: z.boolean().default(true).description('Render diagrams and formatted tables as previews'),
45
- notifyBridge: z.object({
46
- enabled: z.boolean().default(false),
47
- events: z.array(z.string()).default(['task_done', 'error']),
48
- home: z.string().default('default'),
49
- excludeSessionPrefixes: z.array(z.string()).default(['msgw-']),
50
- }).default({ enabled: false }),
51
- alerts: z.object({
52
- enabled: z.boolean().default(false),
53
- chatId: z.union([z.number(), z.string()]).default(''),
54
- threadId: z.number().default(0),
55
- home: z.string().default(''),
56
- events: z.array(z.string()).default(['error', 'pairing']),
57
- }).default({ enabled: false }),
58
- forumMirror: z.object({
59
- enabled: z.boolean().default(false),
60
- chatId: z.union([z.number(), z.string()]).default(''),
61
- }).default({ enabled: false }),
62
- forumMirrorChatId: z.union([z.number(), z.string()]).default(''),
63
- forumMirrorEnabled: z.boolean().default(false),
64
- }),
65
- discord: z.object({
66
- enabled: z.boolean().default(false),
67
- botToken: z.string().role('secret').default(''),
68
- webhookUrl: z.string().default(''),
69
- }).default({ enabled: false }),
70
- slack: z.object({
71
- enabled: z.boolean().default(false),
72
- botToken: z.string().role('secret').default(''),
73
- webhookUrl: z.string().default(''),
74
- }).default({ enabled: false }),
75
- webhooks: z.object({
76
- enabled: z.boolean().default(true),
77
- secret: z.string().role('secret').default(''),
78
- }).default({ enabled: true }),
79
- media: z.object({
80
- cacheDir: z.string().default(''),
81
- maxDocBytes: z.number().default(20 * 1024 * 1024),
82
- maxTextInjectBytes: z.number().default(100 * 1024),
83
- maxImageBytes: z.number().default(20 * 1024 * 1024),
84
- }),
85
- tts: z.object({
86
- enabled: z.boolean().default(false),
87
- maxChars: z.number().default(4000),
88
- voiceSummary: z.boolean().default(false).description('Speak concise TL;DR summary while full text is sent to chat'),
89
- }),
90
- agent: z.object({
91
- provider: z.string().default(''),
92
- model: z.string().default(''),
93
- cwd: z.string().default(''),
94
- instructionPrefix: z.string().default(''),
95
- maxMessageLength: z.number().default(4000),
96
- idleTimeoutMs: z.number().default(3_600_000),
97
- turnTimeoutMs: z.number().default(600_000),
98
- photoOnlyMode: z.union([z.const('prompt'), z.const('run')]).default('prompt'),
99
- sessionScope: z.union([z.const('chat'), z.const('user')]).default('user')
100
- .description('In groups: user = per-user session; chat = shared session for the chat/topic'),
101
- }),
102
- })
103
-
104
- export const Config = PluginConfig
1
+ import z from '@deepseek-ai/schemastery'
2
+
3
+ const HomeEntry = z.object({
4
+ name: z.string().default('default'),
5
+ chatId: z.union([z.number(), z.string()]),
6
+ threadId: z.number().default(0),
7
+ })
8
+
9
+ export const PluginConfig = z.object({
10
+ enabled: z.boolean().default(true),
11
+ internalBaseURL: z.string().default('http://127.0.0.1:3080'),
12
+ telegram: z.object({
13
+ enabled: z.boolean().default(false),
14
+ botToken: z.string().role('secret').default(''),
15
+ allowedUserIds: z.array(z.number()).default([]),
16
+ pollTimeoutSeconds: z.number().default(50),
17
+ pollIntervalMs: z.number().default(500),
18
+ commands: z.array(z.object({
19
+ command: z.string(),
20
+ description: z.string(),
21
+ })).default([]),
22
+ textFormat: z.union([z.const('html'), z.const('plain')]).default('html').description('html: Markdown→Telegram HTML; plain: unformatted plain text'),
23
+ homeChatId: z.union([z.number(), z.string()]).default('').description('Legacy default home chatId'),
24
+ homeThreadId: z.number().default(0),
25
+ homes: z.array(HomeEntry).default([]).description('Named homes (forum topics / channels)'),
26
+ pairingEnabled: z.boolean().default(true).description('Issue pairing codes to unknown users when allowlist is non-empty'),
27
+ streaming: z.boolean().default(false).description('If true, edit one Telegram message while tokens arrive; default off'),
28
+ streamEditIntervalMs: z.number().default(1200),
29
+ progressEnabled: z.boolean().default(true),
30
+ approvalsEnabled: z.boolean().default(true),
31
+ groupsEnabled: z.boolean().default(true).description('Process group/supergroup messages'),
32
+ groupRequireMention: z.boolean().default(true).description('In groups, only respond to @mention, reply-to-bot, or /commands'),
33
+ reactionsEnabled: z.boolean().default(true).description('React with 👀 while processing a turn'),
34
+ statusIndicator: z.boolean().default(false).description('Opt-in: set bot short description to Online/Offline (bots have no presence)'),
35
+ statusOnline: z.string().default('Online'),
36
+ statusOffline: z.string().default('Offline'),
37
+ transport: z.union([z.const('poll'), z.const('webhook')]).default('poll'),
38
+ webhookUrl: z.string().default(''),
39
+ webhookSecret: z.string().role('secret').default(''),
40
+ webhookPath: z.string().default('/dsh-messenger-gateway/telegram/webhook'),
41
+ voiceMode: z.union([z.const('mirror'), z.const('always'), z.const('off')]).default('mirror')
42
+ .description('mirror: TTS when inbound was voice; always/off override (per-user /voice wins)'),
43
+ quickActions: z.boolean().default(false).description('Show quick actions keyboard in Telegram (/new, /stop, /voice, /status)'),
44
+ artifactPreviews: z.boolean().default(true).description('Render diagrams and formatted tables as previews'),
45
+ notifyBridge: z.object({
46
+ enabled: z.boolean().default(false),
47
+ events: z.array(z.string()).default(['task_done', 'error']),
48
+ home: z.string().default('default'),
49
+ excludeSessionPrefixes: z.array(z.string()).default(['msgw-']),
50
+ }).default({ enabled: false }),
51
+ alerts: z.object({
52
+ enabled: z.boolean().default(false),
53
+ chatId: z.union([z.number(), z.string()]).default(''),
54
+ threadId: z.number().default(0),
55
+ home: z.string().default(''),
56
+ events: z.array(z.string()).default(['error', 'pairing']),
57
+ }).default({ enabled: false }),
58
+ forumMirror: z.object({
59
+ enabled: z.boolean().default(false),
60
+ chatId: z.union([z.number(), z.string()]).default(''),
61
+ }).default({ enabled: false }),
62
+ forumMirrorChatId: z.union([z.number(), z.string()]).default(''),
63
+ forumMirrorEnabled: z.boolean().default(false),
64
+ }),
65
+ discord: z.object({
66
+ enabled: z.boolean().default(false),
67
+ botToken: z.string().role('secret').default(''),
68
+ webhookUrl: z.string().default(''),
69
+ }).default({ enabled: false }),
70
+ slack: z.object({
71
+ enabled: z.boolean().default(false),
72
+ botToken: z.string().role('secret').default(''),
73
+ webhookUrl: z.string().default(''),
74
+ }).default({ enabled: false }),
75
+ webhooks: z.object({
76
+ enabled: z.boolean().default(true),
77
+ secret: z.string().role('secret').default(''),
78
+ }).default({ enabled: true }),
79
+ media: z.object({
80
+ cacheDir: z.string().default(''),
81
+ maxDocBytes: z.number().default(20 * 1024 * 1024),
82
+ maxTextInjectBytes: z.number().default(100 * 1024),
83
+ maxImageBytes: z.number().default(20 * 1024 * 1024),
84
+ }),
85
+ tts: z.object({
86
+ enabled: z.boolean().default(false),
87
+ maxChars: z.number().default(4000),
88
+ voiceSummary: z.boolean().default(false).description('Speak concise TL;DR summary while full text is sent to chat'),
89
+ }),
90
+ agent: z.object({
91
+ provider: z.string().default(''),
92
+ model: z.string().default(''),
93
+ cwd: z.string().default(''),
94
+ instructionPrefix: z.string().default(''),
95
+ maxMessageLength: z.number().default(4000),
96
+ idleTimeoutMs: z.number().default(3_600_000),
97
+ turnTimeoutMs: z.number().default(600_000),
98
+ photoOnlyMode: z.union([z.const('prompt'), z.const('run')]).default('prompt'),
99
+ sessionScope: z.union([z.const('chat'), z.const('user')]).default('user')
100
+ .description('In groups: user = per-user session; chat = shared session for the chat/topic'),
101
+ }),
102
+ })
103
+
104
+ export const Config = PluginConfig
@@ -7,8 +7,8 @@
7
7
  export function ensureContentArray(content) {
8
8
  if (Array.isArray(content)) return content
9
9
  if (typeof content === 'string') {
10
- return content ? [{ type: 'text', text: content }] : [{ type: 'text', text: '(пустое сообщение)' }]
10
+ return content ? [{ type: 'text', text: content }] : [{ type: 'text', text: '(empty message)' }]
11
11
  }
12
12
  if (content && typeof content === 'object' && content.type) return [content]
13
- return [{ type: 'text', text: String(content ?? '(пустое сообщение)') }]
13
+ return [{ type: 'text', text: String(content ?? '(empty message)') }]
14
14
  }
package/lib/documents.js CHANGED
@@ -5,16 +5,16 @@ import { inflateRawSync } from 'node:zlib'
5
5
  /** Format a cached inbound document/video path for the agent (fs tools). */
6
6
  export function formatInboundDocument(att, parsed = null) {
7
7
  const kind = att?.kind || 'document'
8
- const labels = { video: 'Видео', sticker: 'Стикер', animation: 'GIF', document: 'Документ' }
9
- const label = labels[kind] || 'Файл'
8
+ const labels = { video: 'Video', sticker: 'Sticker', animation: 'GIF', document: 'Document' }
9
+ const label = labels[kind] || 'File'
10
10
  const name = att?.name ? ` ${att.name}` : ''
11
11
  const mime = att?.mime ? ` (${att.mime})` : ''
12
12
  const emoji = att?.emoji ? ` emoji=${att.emoji}` : ''
13
- let base = `[${label}${name}${mime}${emoji}]\nПуть: ${att.path}`
13
+ let base = `[${label}${name}${mime}${emoji}]\nPath: ${att.path}`
14
14
 
15
15
  if (parsed?.text) {
16
- const truncNote = parsed.truncated ? ' (содержимое усечено)' : ''
17
- base += `\n\n[Распознанный текст из файла${truncNote}]:\n\`\`\`\n${parsed.text}\n\`\`\``
16
+ const truncNote = parsed.truncated ? ' (content truncated)' : ''
17
+ base += `\n\n[Extracted text from file${truncNote}]:\n\`\`\`\n${parsed.text}\n\`\`\``
18
18
  }
19
19
  return base
20
20
  }
@@ -25,11 +25,11 @@ export function documentOnlyHint(attachments, userText) {
25
25
  if (!docs.length) return ''
26
26
  if (docs.length === 1) {
27
27
  const k = docs[0].kind
28
- if (k === 'sticker') return '[Пользователь отправил стикер]'
29
- if (k === 'video' || k === 'animation') return '[Пользователь отправил видео]'
30
- return '[Пользователь отправил файл]'
28
+ if (k === 'sticker') return '[User sent a sticker]'
29
+ if (k === 'video' || k === 'animation') return '[User sent a video]'
30
+ return '[User sent a file]'
31
31
  }
32
- return `[Пользователь отправил ${docs.length} файла]`
32
+ return `[User sent ${docs.length} files]`
33
33
  }
34
34
 
35
35
  export const TEXT_INJECT_EXTS = new Set([
@@ -32,7 +32,7 @@ export async function listFiles(baseCwd, subPath = '.', opts = {}) {
32
32
  try {
33
33
  st = await stat(target)
34
34
  } catch (err) {
35
- return { ok: false, error: `Каталог не найден: ${err.message}` }
35
+ return { ok: false, error: `Directory not found: ${err.message}` }
36
36
  }
37
37
 
38
38
  if (!st.isDirectory()) {
@@ -41,7 +41,7 @@ export async function listFiles(baseCwd, subPath = '.', opts = {}) {
41
41
  isDirectory: false,
42
42
  currentPath: relativePath,
43
43
  entries: [{ name: relativePath, size: st.size, isDirectory: false }],
44
- formattedText: `📄 <b>${relativePath}</b> (${formatFileSize(st.size)})\nДля скачивания: <code>/get ${relativePath}</code>`,
44
+ formattedText: `📄 <b>${relativePath}</b> (${formatFileSize(st.size)})\nDownload: <code>/get ${relativePath}</code>`,
45
45
  }
46
46
  }
47
47
 
@@ -81,12 +81,12 @@ export async function listFiles(baseCwd, subPath = '.', opts = {}) {
81
81
  const sliced = entries.slice(0, maxEntries)
82
82
 
83
83
  const lines = [
84
- `📂 <b>Файлы: <code>${relativePath === '.' ? '/' : `/${relativePath}`}</code></b> (${total} элементов):`,
84
+ `📂 <b>Files: <code>${relativePath === '.' ? '/' : `/${relativePath}`}</code></b> (${total} items):`,
85
85
  '',
86
86
  ]
87
87
 
88
88
  if (relativePath !== '.') {
89
- lines.push('📁 <code>..</code> (на уровень выше: <code>/files ..</code>)')
89
+ lines.push('📁 <code>..</code> (parent folder: <code>/files ..</code>)')
90
90
  }
91
91
 
92
92
  for (const e of sliced) {
@@ -98,10 +98,10 @@ export async function listFiles(baseCwd, subPath = '.', opts = {}) {
98
98
  }
99
99
 
100
100
  if (total > maxEntries) {
101
- lines.push(`\n<i>... и ещё ${total - maxEntries} файлов</i>`)
101
+ lines.push(`\n<i>... and ${total - maxEntries} more files</i>`)
102
102
  }
103
103
 
104
- lines.push('\nСкачать файл: <code>/get <файл></code>\nПереход по папкам: <code>/files <папка></code>')
104
+ lines.push('\nDownload file: <code>/get <file></code>\nNavigate directory: <code>/files <dir></code>')
105
105
 
106
106
  return {
107
107
  ok: true,
@@ -119,17 +119,17 @@ export async function getFileForDownload(baseCwd, relativePath, maxBytes = 50 *
119
119
  try {
120
120
  st = await stat(target)
121
121
  } catch (err) {
122
- return { ok: false, error: `Файл не найден: ${safeRel}` }
122
+ return { ok: false, error: `File not found: ${safeRel}` }
123
123
  }
124
124
 
125
125
  if (st.isDirectory()) {
126
- return { ok: false, error: `«${safeRel}» является каталогом, а не файлом. Список: /files ${safeRel}` }
126
+ return { ok: false, error: `"${safeRel}" is a directory, not a file. List: /files ${safeRel}` }
127
127
  }
128
128
 
129
129
  if (st.size > maxBytes) {
130
130
  return {
131
131
  ok: false,
132
- error: `Файл слишком большой (${formatFileSize(st.size)} > ${formatFileSize(maxBytes)}).`,
132
+ error: `File is too large (${formatFileSize(st.size)} > ${formatFileSize(maxBytes)}).`,
133
133
  }
134
134
  }
135
135