alvin-bot 5.6.2 → 5.8.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.
Files changed (137) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +1 -1
  3. package/dist/claude.js +1 -102
  4. package/dist/config.js +1 -96
  5. package/dist/engine.js +1 -90
  6. package/dist/find-claude-binary.js +1 -98
  7. package/dist/handlers/async-agent-chunk-handler.js +1 -50
  8. package/dist/handlers/background-bypass.js +1 -75
  9. package/dist/handlers/commands.js +1 -2336
  10. package/dist/handlers/cron-progress.js +1 -52
  11. package/dist/handlers/document.js +1 -194
  12. package/dist/handlers/message.js +1 -959
  13. package/dist/handlers/photo.js +1 -154
  14. package/dist/handlers/platform-message.js +1 -360
  15. package/dist/handlers/stuck-timer.js +1 -54
  16. package/dist/handlers/video.js +1 -237
  17. package/dist/handlers/voice.js +1 -148
  18. package/dist/i18n.js +1 -805
  19. package/dist/index.js +1 -697
  20. package/dist/init-data-dir.js +1 -98
  21. package/dist/middleware/auth.js +1 -233
  22. package/dist/migrate.js +1 -162
  23. package/dist/paths.js +1 -146
  24. package/dist/platforms/discord.js +1 -175
  25. package/dist/platforms/index.js +1 -130
  26. package/dist/platforms/signal.js +1 -205
  27. package/dist/platforms/slack-slash-parser.js +1 -32
  28. package/dist/platforms/slack.js +1 -501
  29. package/dist/platforms/telegram.js +1 -111
  30. package/dist/platforms/types.js +1 -8
  31. package/dist/platforms/whatsapp-auth-helpers.js +1 -53
  32. package/dist/platforms/whatsapp.js +1 -707
  33. package/dist/providers/claude-sdk-provider.js +1 -565
  34. package/dist/providers/codex-cli-provider.js +1 -134
  35. package/dist/providers/index.js +1 -7
  36. package/dist/providers/ollama-provider.js +1 -32
  37. package/dist/providers/openai-compatible.js +1 -406
  38. package/dist/providers/registry.js +1 -352
  39. package/dist/providers/runtime-header.js +1 -45
  40. package/dist/providers/tool-executor.js +1 -475
  41. package/dist/providers/types.js +1 -227
  42. package/dist/services/access.js +1 -144
  43. package/dist/services/allowed-users-gate.js +1 -56
  44. package/dist/services/alvin-dispatch.js +1 -130
  45. package/dist/services/alvin-mcp-tools.js +1 -104
  46. package/dist/services/asset-index.js +1 -224
  47. package/dist/services/async-agent-parser.js +1 -418
  48. package/dist/services/async-agent-watcher.js +1 -443
  49. package/dist/services/auto-diagnostic.js +1 -228
  50. package/dist/services/broadcast.js +1 -52
  51. package/dist/services/browser-manager.js +1 -562
  52. package/dist/services/browser-webfetch.js +1 -127
  53. package/dist/services/browser.js +1 -121
  54. package/dist/services/cdp-bootstrap.js +1 -357
  55. package/dist/services/compaction.js +1 -144
  56. package/dist/services/critical-notify.js +1 -203
  57. package/dist/services/cron-resolver.js +1 -58
  58. package/dist/services/cron-scheduling.js +1 -310
  59. package/dist/services/cron.js +1 -861
  60. package/dist/services/custom-tools.js +1 -317
  61. package/dist/services/delivery-queue.js +1 -173
  62. package/dist/services/delivery-registry.js +1 -21
  63. package/dist/services/disk-cleanup.js +1 -203
  64. package/dist/services/elevenlabs.js +1 -58
  65. package/dist/services/embeddings/auto-detect.js +1 -74
  66. package/dist/services/embeddings/fts5.js +1 -108
  67. package/dist/services/embeddings/gemini.js +1 -65
  68. package/dist/services/embeddings/index.js +1 -496
  69. package/dist/services/embeddings/ollama.js +1 -78
  70. package/dist/services/embeddings/openai.js +1 -49
  71. package/dist/services/embeddings/provider.js +1 -22
  72. package/dist/services/embeddings/vector-base.js +1 -113
  73. package/dist/services/embeddings-migration.js +1 -193
  74. package/dist/services/embeddings.js +1 -9
  75. package/dist/services/env-file.js +1 -50
  76. package/dist/services/exec-guard.js +1 -71
  77. package/dist/services/fallback-order.js +1 -154
  78. package/dist/services/file-permissions.js +1 -93
  79. package/dist/services/heartbeat-file.js +1 -65
  80. package/dist/services/heartbeat.js +1 -313
  81. package/dist/services/hooks.js +1 -44
  82. package/dist/services/imagegen.js +1 -72
  83. package/dist/services/language-detect.js +1 -154
  84. package/dist/services/markdown.js +1 -63
  85. package/dist/services/mcp.js +1 -263
  86. package/dist/services/memory-extractor.js +1 -178
  87. package/dist/services/memory-inject-mode.js +1 -43
  88. package/dist/services/memory-layers.js +1 -156
  89. package/dist/services/memory.js +1 -146
  90. package/dist/services/ollama-manager.js +1 -339
  91. package/dist/services/permissions-wizard.js +1 -291
  92. package/dist/services/personality.js +1 -376
  93. package/dist/services/plugins.js +1 -171
  94. package/dist/services/preflight.js +1 -292
  95. package/dist/services/process-manager.js +1 -291
  96. package/dist/services/release-highlights.js +1 -79
  97. package/dist/services/reminders.js +1 -97
  98. package/dist/services/restart.js +1 -48
  99. package/dist/services/security-audit.js +1 -74
  100. package/dist/services/self-diagnosis.js +1 -272
  101. package/dist/services/self-search.js +1 -129
  102. package/dist/services/session-persistence.js +1 -237
  103. package/dist/services/session.js +1 -282
  104. package/dist/services/skills.js +1 -290
  105. package/dist/services/ssrf-guard.js +1 -162
  106. package/dist/services/standing-orders.js +1 -29
  107. package/dist/services/steer-channel.js +1 -46
  108. package/dist/services/stop-controller.js +1 -52
  109. package/dist/services/subagent-dedup.js +1 -0
  110. package/dist/services/subagent-delivery.js +1 -452
  111. package/dist/services/subagent-stats.js +1 -123
  112. package/dist/services/subagents.js +1 -814
  113. package/dist/services/sudo.js +1 -329
  114. package/dist/services/telegram.js +1 -158
  115. package/dist/services/timing-safe-bearer.js +1 -51
  116. package/dist/services/tool-discovery.js +1 -214
  117. package/dist/services/trends.js +1 -580
  118. package/dist/services/updater.js +1 -291
  119. package/dist/services/usage-tracker.js +1 -144
  120. package/dist/services/users.js +1 -271
  121. package/dist/services/voice.js +1 -104
  122. package/dist/services/watchdog-brake.js +1 -154
  123. package/dist/services/watchdog.js +1 -311
  124. package/dist/services/workspaces.js +1 -276
  125. package/dist/tui/index.js +1 -667
  126. package/dist/util/console-formatter.js +1 -109
  127. package/dist/util/debounce.js +1 -24
  128. package/dist/util/telegram-error-filter.js +1 -62
  129. package/dist/version.js +1 -24
  130. package/dist/web/bind-strategy.js +1 -42
  131. package/dist/web/canvas.js +1 -30
  132. package/dist/web/doctor-api.js +1 -604
  133. package/dist/web/openai-compat.js +1 -252
  134. package/dist/web/server.js +1 -1831
  135. package/dist/web/setup-api.js +1 -1101
  136. package/package.json +5 -2
  137. package/dist/.metadata_never_index +0 -0
@@ -1,2336 +1 @@
1
- import { InlineKeyboard, InputFile } from "grammy";
2
- import fs from "fs";
3
- import path, { resolve } from "path";
4
- import os from "os";
5
- import { getSession, buildSessionKey, resetSession, markSessionDirty, getTelegramWorkspace, setTelegramWorkspace } from "../services/session.js";
6
- import { listWorkspaces, getWorkspace } from "../services/workspaces.js";
7
- import { getRegistry } from "../engine.js";
8
- import { reloadSoul } from "../services/personality.js";
9
- import { parseDuration, createReminder, listReminders, cancelReminder } from "../services/reminders.js";
10
- import { writeSessionSummary, getMemoryStats, appendDailyLog } from "../services/memory.js";
11
- import { approveGroup, blockGroup, listGroups, getSettings, setForwardingAllowed, setAutoApprove, } from "../services/access.js";
12
- import { generateImage } from "../services/imagegen.js";
13
- import { searchMemory, reindexMemory, getIndexStats } from "../services/embeddings.js";
14
- import { listProfiles, addUserNote } from "../services/users.js";
15
- import { getLoadedPlugins, getPluginsDir } from "../services/plugins.js";
16
- import { getMCPStatus, getMCPTools, callMCPTool } from "../services/mcp.js";
17
- import { listCustomTools, executeCustomTool } from "../services/custom-tools.js";
18
- import { screenshotUrl, extractText, generatePdf, hasPlaywright } from "../services/browser.js";
19
- import { writeEnvVar } from "../services/env-file.js";
20
- import { listJobs, createJob, deleteJob, toggleJob, runJobNow, formatNextRun, humanReadableSchedule } from "../services/cron.js";
21
- import { resolveJobByNameOrId } from "../services/cron-resolver.js";
22
- import { buildTickerText, buildDoneText, escapeMarkdown } from "./cron-progress.js";
23
- import { isHarmlessTelegramError } from "../util/telegram-error-filter.js";
24
- import { storePassword, revokePassword, getSudoStatus, verifyPassword } from "../services/sudo.js";
25
- import { config } from "../config.js";
26
- import { BOT_VERSION } from "../version.js";
27
- import { getWebPort } from "../web/server.js";
28
- import { getUsageSummary, getAllRateLimits, formatTokens } from "../services/usage-tracker.js";
29
- import { runUpdate, getAutoUpdate, setAutoUpdate, startAutoUpdateLoop } from "../services/updater.js";
30
- import { markExpectedRestart } from "../services/watchdog.js";
31
- import { getReleaseHighlights } from "../services/release-highlights.js";
32
- import { runCleanup, getCleanupPolicy } from "../services/disk-cleanup.js";
33
- import { getHealthStatus, isFailedOver } from "../services/heartbeat.js";
34
- import { t, LOCALE_NAMES, LOCALE_FLAGS } from "../i18n.js";
35
- import { requestStop, interruptQuery } from "../services/stop-controller.js";
36
- import { killSessionDetachedAgents, cancelPendingForSession } from "../services/async-agent-watcher.js";
37
- // Kick off auto-update loop on module load if the persistent flag is set.
38
- // Doing this as a module side-effect avoids touching the bot entry point.
39
- if (getAutoUpdate()) {
40
- // 30s delay so the bot is fully started before the first check
41
- setTimeout(() => startAutoUpdateLoop(), 30_000);
42
- }
43
- /** Bot start time for uptime tracking */
44
- const botStartTime = Date.now();
45
- /** Format bytes to human-readable */
46
- function formatBytes(bytes) {
47
- if (bytes < 1024)
48
- return `${bytes} B`;
49
- if (bytes < 1024 * 1024)
50
- return `${(bytes / 1024).toFixed(1)} KB`;
51
- if (bytes < 1024 * 1024 * 1024)
52
- return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
53
- return `${(bytes / (1024 * 1024 * 1024)).toFixed(1)} GB`;
54
- }
55
- /** Render a working directory path with a meaningful label.
56
- * Home → 🏠 ~ (Home), anywhere under home → 📁 ~/rel/path, absolute → 📁 /path */
57
- function formatWorkingDir(workingDir, locale) {
58
- const home = os.homedir();
59
- if (workingDir === home) {
60
- return `🏠 \`~\` _(${t("bot.status.homeLabel", locale)})_`;
61
- }
62
- if (workingDir.startsWith(home + "/")) {
63
- return `📁 \`~${workingDir.slice(home.length)}\``;
64
- }
65
- return `📁 \`${workingDir}\``;
66
- }
67
- /** Format a raw token count for the context progress line.
68
- * Keeps precision tight — "450k/1M" not "450.2k/1.0M". */
69
- function formatContextTokens(n) {
70
- if (n < 1_000)
71
- return String(n);
72
- if (n < 1_000_000)
73
- return `${Math.round(n / 1_000)}k`;
74
- const m = n / 1_000_000;
75
- return m >= 10 ? `${Math.round(m)}M` : `${m.toFixed(1)}M`;
76
- }
77
- /** Human relative-time rendered in the user's locale. */
78
- function formatRelativeTime(ms, locale) {
79
- const s = Math.floor(ms / 1000);
80
- if (s < 10)
81
- return t("bot.time.justNow", locale);
82
- if (s < 60)
83
- return t("bot.time.secondsAgo", locale, { n: s });
84
- const m = Math.floor(s / 60);
85
- if (m < 60)
86
- return t("bot.time.minutesAgo", locale, { n: m });
87
- const h = Math.floor(m / 60);
88
- if (h < 24)
89
- return t("bot.time.hoursAgo", locale, { n: h });
90
- const d = Math.floor(h / 24);
91
- return t(d === 1 ? "bot.time.dayAgo" : "bot.time.daysAgo", locale, { n: d });
92
- }
93
- const EFFORT_LABELS = {
94
- low: "Low — Quick, concise answers",
95
- medium: "Medium — Moderate reasoning depth",
96
- high: "High — Deep reasoning (default)",
97
- max: "Max — Maximum effort (Opus only)",
98
- };
99
- export function registerCommands(bot) {
100
- bot.command("ping", async (ctx) => {
101
- const start = Date.now();
102
- const registry = getRegistry();
103
- const active = registry.getActive();
104
- const info = active.getInfo();
105
- const latency = Date.now() - start;
106
- await ctx.reply(`🏓 Pong! (${latency}ms)\n${info.name} ${info.status}`);
107
- });
108
- bot.command("help", async (ctx) => {
109
- await ctx.reply(`🤖 *Alvin Bot — Commands*\n\n` +
110
- `💬 *Chat*\n` +
111
- `Just write — I'll respond.\n` +
112
- `I also understand voice messages & photos.\n\n` +
113
- `⚙️ *Controls*\n` +
114
- `/model — Switch AI model\n` +
115
- `/fallback — Provider order\n` +
116
- `/effort — Set reasoning depth\n` +
117
- `/voice — Voice replies on/off\n` +
118
- `/dir <path> — Working directory\n\n` +
119
- `🧭 *Workspaces*\n` +
120
- `/workspaces — List all workspaces\n` +
121
- `/workspace <name> — Switch active workspace\n` +
122
- `/workspace default — Reset to default\n\n` +
123
- `🎨 *Extras*\n` +
124
- `/imagine <prompt> — Generate image\n` +
125
- `/remind <time> <text> — Set reminder\n` +
126
- `/export — Export conversation\n\n` +
127
- `🧠 *Memory*\n` +
128
- `/recall <query> — Semantic search\n` +
129
- `/remember <text> — Remember something\n` +
130
- `/reindex — Re-index memory\n\n` +
131
- `🌐 *Browser*\n` +
132
- `/browse <URL> — Screenshot\n` +
133
- `/browse text <URL> — Extract text\n` +
134
- `/browse pdf <URL> — Save as PDF\n\n` +
135
- `🔌 *Extensions*\n` +
136
- `/plugins — Loaded plugins\n` +
137
- `/mcp — MCP servers & tools\n` +
138
- `/users — User profiles\n\n` +
139
- `🖥️ *Web UI*\n` +
140
- `/webui — Open Web UI in browser\n\n` +
141
- `📊 *Session*\n` +
142
- `/status — Current status\n` +
143
- `/new — Start new session\n` +
144
- `/cancel — Cancel running request\n\n` +
145
- `🔧 *Ops*\n` +
146
- `/restart — Restart the bot\n` +
147
- `/update — Pull latest + rebuild + restart\n` +
148
- `/autoupdate on|off — Auto-update loop (6h)\n\n` +
149
- `_Tip: Send me documents, photos, or voice messages!_\n` +
150
- `_In groups: @mention me or reply to my messages._`, { parse_mode: "Markdown" });
151
- });
152
- // Register bot commands in Telegram's menu
153
- bot.api.setMyCommands([
154
- { command: "help", description: "Show all commands" },
155
- { command: "model", description: "Switch AI model" },
156
- { command: "effort", description: "Set reasoning depth" },
157
- { command: "voice", description: "Voice replies on/off" },
158
- { command: "status", description: "Current status" },
159
- { command: "version", description: "Show Alvin Bot version" },
160
- { command: "new", description: "Start new session" },
161
- { command: "dir", description: "Change working directory" },
162
- { command: "workspaces", description: "List all workspaces" },
163
- { command: "workspace", description: "Switch active workspace" },
164
- { command: "web", description: "Quick web search" },
165
- { command: "imagine", description: "Generate image (e.g. /imagine A fox)" },
166
- { command: "remind", description: "Set reminder (e.g. /remind 30m Text)" },
167
- { command: "export", description: "Export conversation" },
168
- { command: "recall", description: "Semantic memory search" },
169
- { command: "remember", description: "Remember something" },
170
- { command: "cron", description: "Manage scheduled jobs" },
171
- { command: "subagents", description: "Manage background sub-agents" },
172
- { command: "webui", description: "Open Web UI in browser" },
173
- { command: "setup", description: "Configure API keys & platforms" },
174
- { command: "cancel", description: "Cancel running request" },
175
- { command: "restart", description: "Restart the bot" },
176
- { command: "update", description: "Pull latest, build, restart" },
177
- { command: "autoupdate", description: "Auto-update on|off|status" },
178
- ]).catch(err => console.error("Failed to set bot commands:", err));
179
- bot.command("start", async (ctx) => {
180
- const registry = getRegistry();
181
- const activeInfo = registry.getActive().getInfo();
182
- await ctx.reply(`👋 *Hey! I'm Alvin Bot.*\n\n` +
183
- `Your autonomous AI assistant on Telegram. Just write me — ` +
184
- `I understand text, voice messages, photos, and documents.\n\n` +
185
- `🤖 Model: *${activeInfo.name}*\n` +
186
- `🧠 Reasoning: High\n\n` +
187
- `Type /help for all commands.`, { parse_mode: "Markdown" });
188
- });
189
- bot.command("webui", async (ctx) => {
190
- const port = getWebPort();
191
- const url = `http://localhost:${port}`;
192
- await ctx.reply(`🌐 *Web UI* is running on port ${port}.\n\n` +
193
- `Open in your browser:\n${url}`, { parse_mode: "Markdown" });
194
- });
195
- bot.command("new", async (ctx) => {
196
- const userId = ctx.from.id;
197
- const session = getSession(userId);
198
- const hadSession = !!session.sessionId || session.history.length > 0;
199
- const msgCount = session.messageCount;
200
- const cost = session.totalCost;
201
- // Write session summary to daily log before reset
202
- if (hadSession && msgCount > 0) {
203
- const registry = getRegistry();
204
- writeSessionSummary({
205
- messageCount: msgCount,
206
- toolUseCount: session.toolUseCount,
207
- costUsd: cost,
208
- provider: registry.getActiveKey(),
209
- });
210
- }
211
- resetSession(userId);
212
- if (hadSession) {
213
- await ctx.reply(`🔄 *New session started.*\n\n` +
214
- `Previous session: ${msgCount} messages, $${cost.toFixed(4)} cost.\n` +
215
- `Summary saved to memory.`, { parse_mode: "Markdown" });
216
- }
217
- else {
218
- await ctx.reply("🔄 New session started.");
219
- }
220
- });
221
- bot.command("dir", async (ctx) => {
222
- const userId = ctx.from.id;
223
- const session = getSession(userId);
224
- const newDir = ctx.match?.trim();
225
- if (!newDir) {
226
- await ctx.reply(`Current directory: ${session.workingDir}`);
227
- return;
228
- }
229
- const resolved = newDir.startsWith("~")
230
- ? path.join(os.homedir(), newDir.slice(1))
231
- : path.resolve(newDir);
232
- if (fs.existsSync(resolved) && fs.statSync(resolved).isDirectory()) {
233
- // v4.19.1 — Claude Agent SDK's `resume` is bound to the cwd. Changing
234
- // the working dir without clearing the resume anchor would make the
235
- // next SDK turn look up the session file in the wrong project folder
236
- // → silent empty stream. Null out sessionId + history-anchor so the
237
- // next turn starts a fresh SDK session in the new cwd.
238
- const cwdChanged = session.workingDir !== resolved;
239
- session.workingDir = resolved;
240
- if (cwdChanged) {
241
- session.sessionId = null;
242
- // v4.19.2 — Anchor at current last turn so no catch-up bridge is
243
- // generated for the next turn. /dir semantically means "switch
244
- // project context" just like /workspace — starting fresh is the
245
- // sane default.
246
- session.lastSdkHistoryIndex = session.history.length - 1;
247
- }
248
- markSessionDirty(userId);
249
- await ctx.reply(`Working directory: ${session.workingDir}`);
250
- }
251
- else {
252
- await ctx.reply(`Directory not found: ${resolved}`);
253
- }
254
- });
255
- bot.command("version", async (ctx) => {
256
- await ctx.reply(`🤖 *Alvin Bot* \`v${BOT_VERSION}\`\n` +
257
- `Node ${process.version} · ${process.platform}/${process.arch}`, { parse_mode: "Markdown" });
258
- });
259
- bot.command("status", async (ctx) => {
260
- const userId = ctx.from.id;
261
- const session = getSession(userId);
262
- const lang = session.language;
263
- const registry = getRegistry();
264
- const active = registry.getActive();
265
- const info = active.getInfo();
266
- // Uptime
267
- const uptimeMs = Date.now() - botStartTime;
268
- const uptimeH = Math.floor(uptimeMs / 3_600_000);
269
- const uptimeM = Math.floor((uptimeMs % 3_600_000) / 60_000);
270
- // Provider type detection
271
- const isOAuth = active.config.type === "claude-sdk" || active.config.type === "codex-cli";
272
- const providerTag = isOAuth ? "_Flat-Rate_" : "_API_";
273
- // ── Session block — intelligent empty/active/idle rendering ─────────
274
- // The in-memory session is always fresh after a bot restart, so plain
275
- // "Session (0 min)" with all zeros looks broken. Render an empty state
276
- // explicitly, plus active/idle badges based on last activity.
277
- const now = Date.now();
278
- const idleMs = now - session.lastActivity;
279
- const sessionAgeMs = now - session.startedAt;
280
- const sessionAgeMin = Math.floor(sessionAgeMs / 60_000);
281
- const IDLE_THRESHOLD_MS = 2 * 60 * 1000;
282
- const isEmpty = session.messageCount === 0
283
- && !session.sessionId
284
- && session.history.length === 0;
285
- let sessionBlock;
286
- const sessionHeader = t("bot.status.sessionHeader", lang);
287
- if (isEmpty) {
288
- sessionBlock = `${sessionHeader}\n${t("bot.status.sessionNew", lang)}`;
289
- }
290
- else {
291
- const isActiveNow = idleMs < IDLE_THRESHOLD_MS;
292
- const badge = isActiveNow ? t("bot.status.active", lang) : t("bot.status.idle", lang);
293
- // Line 1: activity summary
294
- const msgWord = t(session.messageCount === 1 ? "bot.status.message" : "bot.status.messages", lang);
295
- const toolWord = t(session.toolUseCount === 1 ? "bot.status.toolCall" : "bot.status.toolCalls", lang);
296
- const summary = `${badge} — ${session.messageCount} ${msgWord}, ${session.toolUseCount} ${toolWord}`;
297
- // Line 2: tokens (only if non-zero — zero is noise after restart)
298
- const totalTok = session.totalInputTokens + session.totalOutputTokens;
299
- const tokenLine = totalTok > 0
300
- ? `\nTokens: ${formatTokens(session.totalInputTokens)} in / ${formatTokens(session.totalOutputTokens)} out`
301
- : "";
302
- // Line 2.5: context window usage progress (X / Y with percentage).
303
- // Shown only when we have both a last-turn input token count AND the
304
- // provider declares its context window. Otherwise skipped to avoid
305
- // showing meaningless zeros.
306
- const ctxWindow = active.config.contextWindow;
307
- let contextLine = "";
308
- if (session.lastTurnInputTokens > 0 && typeof ctxWindow === "number" && ctxWindow > 0) {
309
- const used = session.lastTurnInputTokens;
310
- const pct = Math.round((used / ctxWindow) * 100);
311
- contextLine = `\nContext: ${formatContextTokens(used)}/${formatContextTokens(ctxWindow)} (${pct}%)`;
312
- }
313
- // Line 3: timing (age + last turn)
314
- const ageStr = sessionAgeMin >= 1
315
- ? `${sessionAgeMin} min`
316
- : t("bot.status.lessThanMin", lang);
317
- const timingLine = `\n${t("bot.status.duration", lang)}: ${ageStr} | ${t("bot.status.lastTurn", lang)}: ${formatRelativeTime(idleMs, lang)}`;
318
- // Line 4: cost (only for non-OAuth providers AND only when meaningful)
319
- const costLine = (!isOAuth && session.totalCost > 0)
320
- ? `\nCost: $${session.totalCost.toFixed(4)}`
321
- : "";
322
- // Line 5: telemetry counters — compactions (non-SDK), checkpoint
323
- // hints (SDK), and SDK-internal sub-tasks (Claude's Task tool).
324
- // Each only shown when > 0 to keep the status clean.
325
- const telemetryParts = [];
326
- if (session.compactionCount > 0) {
327
- telemetryParts.push(`Compactions: ${session.compactionCount}`);
328
- }
329
- if (session.checkpointHintsInjected > 0) {
330
- telemetryParts.push(`Checkpoint hints: ${session.checkpointHintsInjected}`);
331
- }
332
- if (session.sdkSubTaskCount > 0) {
333
- telemetryParts.push(`SDK sub-tasks: ${session.sdkSubTaskCount}`);
334
- }
335
- const telemetryLine = telemetryParts.length > 0
336
- ? `\n${telemetryParts.join(" | ")}`
337
- : "";
338
- sessionBlock = `${sessionHeader}\n${summary}${tokenLine}${contextLine}${timingLine}${costLine}${telemetryLine}`;
339
- }
340
- // Usage summary (daily/weekly from tracker)
341
- const usage = getUsageSummary();
342
- const todayTotalTok = usage.today.inputTokens + usage.today.outputTokens;
343
- const weekTotalTok = usage.week.inputTokens + usage.week.outputTokens;
344
- const todayTok = formatTokens(todayTotalTok);
345
- const weekTok = formatTokens(weekTotalTok);
346
- // Cost or plan label for usage section
347
- const todayCostStr = isOAuth ? "" : ` ($${usage.today.costUsd.toFixed(4)})`;
348
- const weekCostStr = isOAuth ? "" : ` ($${usage.week.costUsd.toFixed(4)})`;
349
- // Rate limits (from last API response)
350
- let rlLines = "";
351
- const allRL = getAllRateLimits();
352
- if (allRL.size > 0) {
353
- const parts = [];
354
- for (const [prov, rl] of allRL) {
355
- const lines = [];
356
- if (rl.requestsRemaining != null && rl.requestsLimit) {
357
- const pct = Math.round((rl.requestsRemaining / rl.requestsLimit) * 100);
358
- const reset = rl.requestsReset ? ` (reset ${rl.requestsReset.replace(/T.*/, "").slice(5) || rl.requestsReset})` : "";
359
- lines.push(`Req: ${rl.requestsRemaining}/${rl.requestsLimit} (${pct}%)${reset}`);
360
- }
361
- if (rl.tokensRemaining != null && rl.tokensLimit) {
362
- const pct = Math.round((rl.tokensRemaining / rl.tokensLimit) * 100);
363
- lines.push(`Tok: ${formatTokens(rl.tokensRemaining)}/${formatTokens(rl.tokensLimit)} (${pct}%)`);
364
- }
365
- if (lines.length > 0) {
366
- parts.push(` ${lines.join(" | ")}`);
367
- }
368
- }
369
- if (parts.length > 0) {
370
- rlLines = `\n⚡ *Rate Limits*\n${parts.join("\n")}\n`;
371
- }
372
- }
373
- // Memory stats
374
- const memStats = getMemoryStats();
375
- const idxStats = getIndexStats();
376
- const { getEffectiveInjectMode, getInjectModeRaw } = await import("../services/memory-inject-mode.js");
377
- const injectMode = getEffectiveInjectMode();
378
- const injectRaw = getInjectModeRaw();
379
- const indexLabel = idxStats.tier === "keyword-local" ? "FTS5" : "vec";
380
- const modeLabel = injectRaw === "auto" ? `${injectMode}(auto)` : injectMode;
381
- const memLine = `${memStats.dailyLogs} days, ${memStats.todayEntries} entries today, ${formatBytes(memStats.longTermSize)} LTM | 🔍 ${idxStats.entries} ${indexLabel} (${idxStats.provider}) | inject:${modeLabel}`;
382
- // Provider health + failover state
383
- const healthRows = getHealthStatus();
384
- const failedOver = isFailedOver();
385
- const activeKey = registry.getActiveKey();
386
- let healthLines = "";
387
- if (healthRows.length > 0) {
388
- // Render each row, live-checking lifecycle-managed providers so the
389
- // status reflects reality (not just heartbeat's always-healthy flag
390
- // for on-demand runners).
391
- const rows = await Promise.all(healthRows.map(async (h) => {
392
- const isActive = h.key === activeKey;
393
- const arrow = isActive ? "→" : " ";
394
- const provider = registry.get(h.key);
395
- // Lifecycle-managed providers (local runners) get on-demand rendering
396
- if (provider?.lifecycle) {
397
- const running = await provider.lifecycle.isRunning();
398
- const botManaged = provider.lifecycle.isBotManaged();
399
- if (!running) {
400
- return `${arrow} 💤 ${h.key} ${t("bot.status.ollamaOnDemand", lang)}`;
401
- }
402
- if (botManaged) {
403
- return `${arrow} 🔧 ${h.key} ${t("bot.status.ollamaBotManaged", lang)}`;
404
- }
405
- return `${arrow} ✅ ${h.key} ${t("bot.status.ollamaExternal", lang)}`;
406
- }
407
- // Default rendering for cloud providers
408
- const icon = h.healthy ? "✅" : "❌";
409
- const latency = h.latencyMs > 0 ? ` ${h.latencyMs}ms` : "";
410
- const fails = h.failCount > 0 ? ` (${h.failCount} fails)` : "";
411
- return `${arrow} ${icon} ${h.key}${latency}${fails}`;
412
- }));
413
- const failoverBadge = failedOver ? ` ${t("bot.status.failedOver", lang)}` : "";
414
- healthLines = `\n${t("bot.status.providerHealth", lang)}${failoverBadge}\n${rows.join("\n")}\n`;
415
- }
416
- await ctx.reply(`🤖 *Alvin Bot* \`v${BOT_VERSION}\`\n\n` +
417
- `*Model:* ${info.name} ${providerTag}\n` +
418
- `*Effort:* ${EFFORT_LABELS[session.effort]}\n` +
419
- `*Voice:* ${session.voiceReply ? "on" : "off"}\n` +
420
- `*Working Dir:* ${formatWorkingDir(session.workingDir, lang)}\n\n` +
421
- `${sessionBlock}\n` +
422
- `\n📈 *Usage*\n` +
423
- `Today: ${usage.today.queries} req, ${todayTok} tokens${todayCostStr}\n` +
424
- `Week: ${usage.week.queries} req, ${weekTok} tokens${weekCostStr}\n` +
425
- (usage.daysTracked > 1 ? `Avg: ${formatTokens(usage.avgDailyTokens)} tok/day _(7d rolling)_\n` : "") +
426
- rlLines +
427
- healthLines +
428
- `\n🧠 *Memory:* ${memLine}\n` +
429
- `⏱ *Uptime:* ${uptimeH}h ${uptimeM}m`, { parse_mode: "Markdown" });
430
- });
431
- bot.command("voice", async (ctx) => {
432
- const userId = ctx.from.id;
433
- const session = getSession(userId);
434
- session.voiceReply = !session.voiceReply;
435
- markSessionDirty(userId);
436
- await ctx.reply(session.voiceReply
437
- ? "Voice replies enabled. Responses will also be sent as voice messages."
438
- : "Voice replies disabled. Text-only responses.");
439
- });
440
- bot.command("effort", async (ctx) => {
441
- const userId = ctx.from.id;
442
- const session = getSession(userId);
443
- const level = ctx.match?.trim().toLowerCase();
444
- if (!level) {
445
- const keyboard = new InlineKeyboard();
446
- for (const [key, label] of Object.entries(EFFORT_LABELS)) {
447
- const marker = key === session.effort ? "✅ " : "";
448
- keyboard.text(`${marker}${label}`, `effort:${key}`).row();
449
- }
450
- await ctx.reply(`🧠 *Choose reasoning depth:*\n\nActive: *${EFFORT_LABELS[session.effort]}*`, { parse_mode: "Markdown", reply_markup: keyboard });
451
- return;
452
- }
453
- if (!["low", "medium", "high", "max"].includes(level)) {
454
- await ctx.reply("Invalid. Use: /effort low | medium | high | max");
455
- return;
456
- }
457
- session.effort = level;
458
- markSessionDirty(userId);
459
- await ctx.reply(`✅ Effort: ${EFFORT_LABELS[session.effort]}`);
460
- });
461
- // v4.12.0 P1 #3 — Multi-workspace support on Telegram
462
- bot.command("workspaces", async (ctx) => {
463
- const userId = ctx.from.id;
464
- const active = getTelegramWorkspace(userId) ?? "default";
465
- const all = listWorkspaces();
466
- if (all.length === 0) {
467
- await ctx.reply("🧭 No workspaces configured.\n\n" +
468
- "Create one by adding a file at `~/.alvin-bot/workspaces/<name>.md` " +
469
- "with YAML frontmatter. See docs/install/slack-setup.md for the format.", { parse_mode: "Markdown" });
470
- return;
471
- }
472
- const lines = [`🧭 *Workspaces* (active: \`${active}\`)`, ""];
473
- for (const ws of all) {
474
- const marker = ws.name === active ? "✅" : (ws.emoji ?? "▪️");
475
- const purpose = ws.purpose || "(no purpose)";
476
- lines.push(`${marker} \`${ws.name}\` — ${purpose}`);
477
- }
478
- lines.push("");
479
- lines.push("Switch with: `/workspace <name>` · Reset: `/workspace default`");
480
- await ctx.reply(lines.join("\n"), { parse_mode: "Markdown" });
481
- });
482
- bot.command("workspace", async (ctx) => {
483
- const userId = ctx.from.id;
484
- const arg = ctx.match?.trim();
485
- if (!arg) {
486
- const active = getTelegramWorkspace(userId) ?? "default";
487
- const ws = active === "default" ? null : getWorkspace(active);
488
- const purpose = ws?.purpose || "global default — no persona, global cwd";
489
- await ctx.reply(`🧭 Active workspace: *${active}*\n_${purpose}_\n\nUse \`/workspaces\` to see all available.`, { parse_mode: "Markdown" });
490
- return;
491
- }
492
- if (arg === "default" || arg === "reset") {
493
- setTelegramWorkspace(userId, null);
494
- await ctx.reply("✅ Switched to the default workspace.");
495
- return;
496
- }
497
- const ws = getWorkspace(arg);
498
- if (!ws) {
499
- await ctx.reply(`❌ Workspace \`${arg}\` not found.\nUse \`/workspaces\` to list available ones.`, { parse_mode: "Markdown" });
500
- return;
501
- }
502
- setTelegramWorkspace(userId, arg);
503
- await ctx.reply(`✅ Switched to workspace *${ws.emoji ?? "🧭"} ${ws.name}*\n_${ws.purpose || "(no purpose set)"}_\n\nNext message will use this workspace's persona and cwd (\`${ws.cwd}\`).`, { parse_mode: "Markdown" });
504
- });
505
- // Inline keyboard callback for effort switching
506
- bot.callbackQuery(/^effort:(.+)$/, async (ctx) => {
507
- const level = ctx.match[1];
508
- if (!["low", "medium", "high", "max"].includes(level)) {
509
- await ctx.answerCallbackQuery("Invalid level");
510
- return;
511
- }
512
- const userId = ctx.from.id;
513
- const session = getSession(userId);
514
- session.effort = level;
515
- markSessionDirty(userId);
516
- const keyboard = new InlineKeyboard();
517
- for (const [key, label] of Object.entries(EFFORT_LABELS)) {
518
- const marker = key === session.effort ? "✅ " : "";
519
- keyboard.text(`${marker}${label}`, `effort:${key}`).row();
520
- }
521
- await ctx.editMessageText(`🧠 *Choose reasoning depth:*\n\nActive: *${EFFORT_LABELS[session.effort]}*`, { parse_mode: "Markdown", reply_markup: keyboard });
522
- await ctx.answerCallbackQuery(`Effort: ${EFFORT_LABELS[session.effort]}`);
523
- });
524
- // Helper: switch provider with lifecycle management for local runners.
525
- // Boots the target's lifecycle daemon (if any) BEFORE the switch, and
526
- // tears down the previous provider's lifecycle (if any) AFTER the switch.
527
- // Fully generic — no hardcoded provider keys.
528
- async function switchProviderWithLifecycle(targetKey, lang) {
529
- const registry = getRegistry();
530
- const previousKey = registry.getActiveKey();
531
- if (previousKey === targetKey)
532
- return { ok: true };
533
- const target = registry.get(targetKey);
534
- if (!target)
535
- return { ok: false, error: `provider "${targetKey}" not found` };
536
- const previous = registry.get(previousKey);
537
- // Boot the target's lifecycle (if any) before the switch
538
- if (target.lifecycle) {
539
- const booted = await target.lifecycle.ensureRunning();
540
- if (!booted) {
541
- return { ok: false, error: t("bot.model.bootFailed", lang, { key: targetKey }) };
542
- }
543
- }
544
- if (!registry.switchTo(targetKey)) {
545
- return { ok: false, error: "switch rejected by registry" };
546
- }
547
- // v4.15 — Persist the switch to ~/.alvin-bot/.env so the choice
548
- // survives bot restarts. In-memory switchTo() alone would revert to
549
- // PRIMARY_PROVIDER on next boot.
550
- try {
551
- writeEnvVar("PRIMARY_PROVIDER", targetKey);
552
- }
553
- catch (err) {
554
- console.warn("⚠️ Failed to persist PRIMARY_PROVIDER:", err);
555
- }
556
- // Tear down the previous provider's lifecycle (if any) after the switch.
557
- // ensureStopped() internally checks isBotManaged — no-op for externally
558
- // managed daemons.
559
- if (previous?.lifecycle) {
560
- await previous.lifecycle.ensureStopped();
561
- }
562
- return { ok: true };
563
- }
564
- bot.command("model", async (ctx) => {
565
- const lang = getSession(ctx.from.id).language;
566
- const arg = ctx.match?.trim().toLowerCase();
567
- const registry = getRegistry();
568
- if (!arg) {
569
- // Show inline keyboard with available models
570
- const providers = await registry.listAll();
571
- const keyboard = new InlineKeyboard();
572
- for (const p of providers) {
573
- const label = p.active ? `✅ ${p.name}` : p.name;
574
- keyboard.text(label, `model:${p.key}`).row();
575
- }
576
- await ctx.reply(`${t("bot.model.chooseHeader", lang)}\n\n${t("bot.model.active", lang)} *${registry.getActive().getInfo().name}*`, { parse_mode: "Markdown", reply_markup: keyboard });
577
- return;
578
- }
579
- const result = await switchProviderWithLifecycle(arg, lang);
580
- if (result.ok) {
581
- const info = registry.get(arg).getInfo();
582
- await ctx.reply(`${t("bot.model.switched", lang)} ${info.name} (${info.model})`);
583
- }
584
- else {
585
- await ctx.reply(`${t("bot.model.switchFailed", lang)} ${result.error || `"${arg}"`}\n${t("bot.model.notFoundHint", lang)}`);
586
- }
587
- });
588
- // Inline keyboard callback for model switching
589
- bot.callbackQuery(/^model:(.+)$/, async (ctx) => {
590
- const key = ctx.match[1];
591
- const registry = getRegistry();
592
- const lang = getSession(ctx.from.id).language;
593
- const result = await switchProviderWithLifecycle(key, lang);
594
- if (result.ok) {
595
- const provider = registry.get(key);
596
- const info = provider.getInfo();
597
- // Update the keyboard to show new selection
598
- const providers = await registry.listAll();
599
- const keyboard = new InlineKeyboard();
600
- for (const p of providers) {
601
- const label = p.active ? `✅ ${p.name}` : p.name;
602
- keyboard.text(label, `model:${p.key}`).row();
603
- }
604
- await ctx.editMessageText(`🤖 *Choose model:*\n\nActive: *${info.name}*`, { parse_mode: "Markdown", reply_markup: keyboard });
605
- await ctx.answerCallbackQuery(`Switched: ${info.name}`);
606
- }
607
- else {
608
- await ctx.answerCallbackQuery(`Switch failed: ${result.error || "unknown"}`);
609
- }
610
- });
611
- // ── Fallback Order ────────────────────────────────────────────────────
612
- bot.command("fallback", async (ctx) => {
613
- const { getFallbackOrder, setFallbackOrder, formatOrder } = await import("../services/fallback-order.js");
614
- const { getHealthStatus } = await import("../services/heartbeat.js");
615
- const registry = getRegistry();
616
- const arg = ctx.match?.trim();
617
- if (!arg) {
618
- // Show current order with inline keyboard
619
- const order = getFallbackOrder();
620
- const health = getHealthStatus();
621
- const healthMap = new Map(health.map(h => [h.key, h]));
622
- const allKeys = [order.primary, ...order.fallbacks];
623
- const keyboard = new InlineKeyboard();
624
- for (let i = 0; i < allKeys.length; i++) {
625
- const key = allKeys[i];
626
- const h = healthMap.get(key);
627
- const status = h ? (h.healthy ? "✅" : "❌") : "❓";
628
- const label = i === 0 ? `🥇 ${key} ${status}` : `${i + 1}. ${key} ${status}`;
629
- if (i > 0)
630
- keyboard.text("⬆️", `fb:up:${key}`);
631
- keyboard.text(label, `fb:info:${key}`);
632
- if (i < allKeys.length - 1)
633
- keyboard.text("⬇️", `fb:down:${key}`);
634
- keyboard.row();
635
- }
636
- const text = `🔄 *Fallback Order*\n\n` +
637
- `Providers are tried in this order.\n` +
638
- `Use ⬆️/⬇️ to reorder.\n\n` +
639
- `_Last changed: ${order.updatedBy} (${new Date(order.updatedAt).toLocaleString("en-US")})_`;
640
- await ctx.reply(text, { parse_mode: "Markdown", reply_markup: keyboard });
641
- return;
642
- }
643
- // Direct text commands: /fallback set groq,openai,nvidia-llama-3.3-70b
644
- if (arg.startsWith("set ")) {
645
- const parts = arg.slice(4).split(",").map(s => s.trim()).filter(Boolean);
646
- if (parts.length < 1) {
647
- await ctx.reply("Usage: `/fallback set primary,fallback1,fallback2,...`", { parse_mode: "Markdown" });
648
- return;
649
- }
650
- const [primary, ...fallbacks] = parts;
651
- setFallbackOrder(primary, fallbacks, "telegram");
652
- await ctx.reply(`✅ New order:\n\n${formatOrder()}`);
653
- return;
654
- }
655
- await ctx.reply(`🔄 *Fallback Order*\n\n` +
656
- `\`/fallback\` — Show & change order\n` +
657
- `\`/fallback set groq,openai,...\` — Set directly`, { parse_mode: "Markdown" });
658
- });
659
- // Callback queries for fallback ordering
660
- bot.callbackQuery(/^fb:up:(.+)$/, async (ctx) => {
661
- const { moveUp, formatOrder, getFallbackOrder } = await import("../services/fallback-order.js");
662
- const { getHealthStatus } = await import("../services/heartbeat.js");
663
- const key = ctx.match[1];
664
- moveUp(key, "telegram");
665
- const order = getFallbackOrder();
666
- const health = getHealthStatus();
667
- const healthMap = new Map(health.map(h => [h.key, h]));
668
- const allKeys = [order.primary, ...order.fallbacks];
669
- const keyboard = new InlineKeyboard();
670
- for (let i = 0; i < allKeys.length; i++) {
671
- const k = allKeys[i];
672
- const h = healthMap.get(k);
673
- const status = h ? (h.healthy ? "✅" : "❌") : "❓";
674
- const label = i === 0 ? `🥇 ${k} ${status}` : `${i + 1}. ${k} ${status}`;
675
- if (i > 0)
676
- keyboard.text("⬆️", `fb:up:${k}`);
677
- keyboard.text(label, `fb:info:${k}`);
678
- if (i < allKeys.length - 1)
679
- keyboard.text("⬇️", `fb:down:${k}`);
680
- keyboard.row();
681
- }
682
- await ctx.editMessageText(`🔄 *Fallback Order*\n\n` +
683
- `Provider werden in dieser Reihenfolge versucht.\n` +
684
- `Nutze ⬆️/⬇️ zum Umsortieren.\n\n` +
685
- `_Last changed: telegram (${new Date().toLocaleString("en-US")})_`, { parse_mode: "Markdown", reply_markup: keyboard });
686
- await ctx.answerCallbackQuery(`${key} moved up`);
687
- });
688
- bot.callbackQuery(/^fb:down:(.+)$/, async (ctx) => {
689
- const { moveDown, getFallbackOrder } = await import("../services/fallback-order.js");
690
- const { getHealthStatus } = await import("../services/heartbeat.js");
691
- const key = ctx.match[1];
692
- moveDown(key, "telegram");
693
- const order = getFallbackOrder();
694
- const health = getHealthStatus();
695
- const healthMap = new Map(health.map(h => [h.key, h]));
696
- const allKeys = [order.primary, ...order.fallbacks];
697
- const keyboard = new InlineKeyboard();
698
- for (let i = 0; i < allKeys.length; i++) {
699
- const k = allKeys[i];
700
- const h = healthMap.get(k);
701
- const status = h ? (h.healthy ? "✅" : "❌") : "❓";
702
- const label = i === 0 ? `🥇 ${k} ${status}` : `${i + 1}. ${k} ${status}`;
703
- if (i > 0)
704
- keyboard.text("⬆️", `fb:up:${k}`);
705
- keyboard.text(label, `fb:info:${k}`);
706
- if (i < allKeys.length - 1)
707
- keyboard.text("⬇️", `fb:down:${k}`);
708
- keyboard.row();
709
- }
710
- await ctx.editMessageText(`🔄 *Fallback Order*\n\n` +
711
- `Provider werden in dieser Reihenfolge versucht.\n` +
712
- `Nutze ⬆️/⬇️ zum Umsortieren.\n\n` +
713
- `_Last changed: telegram (${new Date().toLocaleString("en-US")})_`, { parse_mode: "Markdown", reply_markup: keyboard });
714
- await ctx.answerCallbackQuery(`${key} moved down`);
715
- });
716
- bot.callbackQuery(/^fb:info:(.+)$/, async (ctx) => {
717
- const { getHealthStatus } = await import("../services/heartbeat.js");
718
- const key = ctx.match[1];
719
- const health = getHealthStatus();
720
- const h = health.find(p => p.key === key);
721
- if (h) {
722
- await ctx.answerCallbackQuery({
723
- text: `${key}: ${h.healthy ? "✅ Healthy" : "❌ Unhealthy"} | ${h.latencyMs}ms | Errors: ${h.failCount}`,
724
- show_alert: true,
725
- });
726
- }
727
- else {
728
- await ctx.answerCallbackQuery(`${key}: Not checked yet`);
729
- }
730
- });
731
- bot.command("web", async (ctx) => {
732
- const query = ctx.match?.trim();
733
- if (!query) {
734
- await ctx.reply("Search: `/web your search query`", { parse_mode: "Markdown" });
735
- return;
736
- }
737
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
738
- try {
739
- // Use DuckDuckGo instant answer API (no key needed)
740
- const encoded = encodeURIComponent(query);
741
- const res = await fetch(`https://api.duckduckgo.com/?q=${encoded}&format=json&no_html=1&skip_disambig=1`);
742
- const data = await res.json();
743
- const lines = [];
744
- if (data.Answer) {
745
- lines.push(`💡 *${data.Answer}*\n`);
746
- }
747
- if (data.AbstractText) {
748
- const text = data.AbstractText.length > 500
749
- ? data.AbstractText.slice(0, 500) + "..."
750
- : data.AbstractText;
751
- lines.push(text);
752
- if (data.AbstractSource && data.AbstractURL) {
753
- lines.push(`\n_Source: [${data.AbstractSource}](${data.AbstractURL})_`);
754
- }
755
- }
756
- if (lines.length === 0 && data.RelatedTopics && data.RelatedTopics.length > 0) {
757
- lines.push(`🔍 *Results for "${query}":*\n`);
758
- for (const topic of data.RelatedTopics.slice(0, 5)) {
759
- if (topic.Text) {
760
- const short = topic.Text.length > 150 ? topic.Text.slice(0, 150) + "..." : topic.Text;
761
- lines.push(`• ${short}`);
762
- }
763
- }
764
- }
765
- if (lines.length === 0) {
766
- lines.push(`No results for "${query}". Try it as a regular message — I'll search using the AI model.`);
767
- }
768
- await ctx.reply(lines.join("\n"), { parse_mode: "Markdown" }).catch(() => ctx.reply(lines.join("\n")));
769
- }
770
- catch (err) {
771
- await ctx.reply(`Search error: ${err instanceof Error ? err.message : String(err)}`);
772
- }
773
- });
774
- bot.command("imagine", async (ctx) => {
775
- const prompt = ctx.match?.trim();
776
- if (!prompt) {
777
- await ctx.reply("Describe what I should generate:\n`/imagine A fox sitting on the moon`", { parse_mode: "Markdown" });
778
- return;
779
- }
780
- if (!config.apiKeys.google) {
781
- await ctx.reply("⚠️ Image generation unavailable (GOOGLE_API_KEY missing).");
782
- return;
783
- }
784
- await ctx.api.sendChatAction(ctx.chat.id, "upload_photo");
785
- const result = await generateImage(prompt, config.apiKeys.google);
786
- if (result.success && result.filePath) {
787
- try {
788
- const fileData = fs.readFileSync(result.filePath);
789
- await ctx.replyWithPhoto(new InputFile(fileData, `generated${result.filePath.endsWith(".png") ? ".png" : ".jpg"}`), {
790
- caption: `🎨 _${prompt}_`,
791
- parse_mode: "Markdown",
792
- });
793
- fs.unlink(result.filePath, () => { });
794
- }
795
- catch (err) {
796
- await ctx.reply(`Error sending: ${err instanceof Error ? err.message : String(err)}`);
797
- }
798
- }
799
- else {
800
- await ctx.reply(`❌ ${result.error || "Image generation failed."}`);
801
- }
802
- });
803
- bot.command("remind", async (ctx) => {
804
- const userId = ctx.from.id;
805
- const chatId = ctx.chat.id;
806
- const input = ctx.match?.trim();
807
- if (!input) {
808
- // List reminders
809
- const pending = listReminders(userId);
810
- if (pending.length === 0) {
811
- await ctx.reply("No active reminders.\n\nNew: `/remind 30m Call mom`", { parse_mode: "Markdown" });
812
- }
813
- else {
814
- const lines = pending.map(r => `• *${r.remaining}* — ${r.text} (ID: ${r.id})`);
815
- await ctx.reply(`⏰ *Active Reminders:*\n\n${lines.join("\n")}\n\nCancel: \`/remind cancel <ID>\``, { parse_mode: "Markdown" });
816
- }
817
- return;
818
- }
819
- // Cancel a reminder
820
- if (input.startsWith("cancel ")) {
821
- const id = parseInt(input.slice(7).trim());
822
- if (isNaN(id)) {
823
- await ctx.reply("Invalid ID. Use: `/remind cancel <ID>`", { parse_mode: "Markdown" });
824
- return;
825
- }
826
- if (cancelReminder(id, userId)) {
827
- await ctx.reply(`✅ Reminder #${id} cancelled.`);
828
- }
829
- else {
830
- await ctx.reply(`❌ Reminder #${id} not found.`);
831
- }
832
- return;
833
- }
834
- // Parse: /remind <duration> <text>
835
- const spaceIdx = input.indexOf(" ");
836
- if (spaceIdx === -1) {
837
- await ctx.reply("Format: `/remind 30m Reminder text`", { parse_mode: "Markdown" });
838
- return;
839
- }
840
- const durationStr = input.slice(0, spaceIdx);
841
- const text = input.slice(spaceIdx + 1).trim();
842
- const delayMs = parseDuration(durationStr);
843
- if (!delayMs) {
844
- await ctx.reply("Invalid duration. Examples: `30s`, `5m`, `2h`, `1d`", { parse_mode: "Markdown" });
845
- return;
846
- }
847
- if (!text) {
848
- await ctx.reply("Please provide text: `/remind 30m Call mom`", { parse_mode: "Markdown" });
849
- return;
850
- }
851
- const reminder = createReminder(chatId, userId, text, delayMs, ctx.api);
852
- // Format trigger time
853
- const triggerDate = new Date(reminder.triggerAt);
854
- const timeStr = triggerDate.toLocaleTimeString("en-US", { hour: "2-digit", minute: "2-digit" });
855
- await ctx.reply(`✅ Reminder set for *${timeStr}*: ${text}`, { parse_mode: "Markdown" });
856
- });
857
- bot.command("export", async (ctx) => {
858
- const userId = ctx.from.id;
859
- const session = getSession(userId);
860
- if (session.history.length === 0 && !session.sessionId) {
861
- await ctx.reply("No conversation data to export.");
862
- return;
863
- }
864
- // Build export text
865
- const lines = [
866
- `# Alvin Bot — Conversation Export`,
867
- `Date: ${new Date().toLocaleString("en-US")}`,
868
- `Messages: ${session.messageCount}`,
869
- `Cost: $${session.totalCost.toFixed(4)}`,
870
- `---\n`,
871
- ];
872
- for (const msg of session.history) {
873
- const role = msg.role === "user" ? "👤 User" : "🤖 Alvin Bot";
874
- lines.push(`### ${role}\n${msg.content}\n`);
875
- }
876
- if (session.history.length === 0) {
877
- lines.push("(SDK session — history managed internally, no export available)\n");
878
- }
879
- const exportText = lines.join("\n");
880
- const buffer = Buffer.from(exportText, "utf-8");
881
- const filename = `chat-export-${new Date().toISOString().slice(0, 10)}.md`;
882
- await ctx.replyWithDocument(new InputFile(buffer, filename), {
883
- caption: `📄 Export: ${session.history.length} messages`,
884
- });
885
- });
886
- // Helper: build the /language inline keyboard for all 4 locales + auto.
887
- function buildLangKeyboard(current) {
888
- const kb = new InlineKeyboard();
889
- const order = ["en", "de", "es", "fr"];
890
- // First row: 2 buttons
891
- kb.text(`${current === "en" ? "✅ " : ""}${LOCALE_FLAGS.en} ${LOCALE_NAMES.en}`, "lang:en").text(`${current === "de" ? "✅ " : ""}${LOCALE_FLAGS.de} ${LOCALE_NAMES.de}`, "lang:de").row();
892
- // Second row: 2 buttons
893
- kb.text(`${current === "es" ? "✅ " : ""}${LOCALE_FLAGS.es} ${LOCALE_NAMES.es}`, "lang:es").text(`${current === "fr" ? "✅ " : ""}${LOCALE_FLAGS.fr} ${LOCALE_NAMES.fr}`, "lang:fr").row();
894
- // Third row: auto-detect
895
- void order; // silence unused warning from the `order` declaration (kept for doc clarity)
896
- kb.text(t("bot.lang.autoDetect", current), "lang:auto");
897
- return kb;
898
- }
899
- bot.command("lang", async (ctx) => {
900
- const userId = ctx.from.id;
901
- const session = getSession(userId);
902
- const arg = ctx.match?.trim().toLowerCase();
903
- if (!arg) {
904
- const header = t("bot.lang.header", session.language);
905
- const currentName = `${LOCALE_FLAGS[session.language]} ${LOCALE_NAMES[session.language]}`;
906
- await ctx.reply(`${header} ${currentName}`, {
907
- parse_mode: "Markdown",
908
- reply_markup: buildLangKeyboard(session.language),
909
- });
910
- return;
911
- }
912
- if (arg === "auto") {
913
- const { resetToAutoLanguage } = await import("../services/language-detect.js");
914
- resetToAutoLanguage(userId);
915
- await ctx.reply(t("bot.lang.autoEnabled", session.language));
916
- }
917
- else if (arg === "en" || arg === "de" || arg === "es" || arg === "fr") {
918
- session.language = arg;
919
- markSessionDirty(userId);
920
- const { setExplicitLanguage } = await import("../services/language-detect.js");
921
- setExplicitLanguage(userId, arg);
922
- await ctx.reply(t("bot.lang.setFixed", arg, { name: LOCALE_NAMES[arg] }));
923
- }
924
- else {
925
- await ctx.reply(t("bot.lang.usage", session.language), { parse_mode: "Markdown" });
926
- }
927
- });
928
- // /lang callback — accept all 4 locales plus auto
929
- bot.callbackQuery(/^lang:(en|de|es|fr|auto)$/, async (ctx) => {
930
- const choice = ctx.match[1];
931
- const userId = ctx.from.id;
932
- const session = getSession(userId);
933
- if (choice === "auto") {
934
- const { resetToAutoLanguage } = await import("../services/language-detect.js");
935
- resetToAutoLanguage(userId);
936
- await ctx.answerCallbackQuery({ text: t("bot.lang.autoEnabled", session.language).slice(0, 60) });
937
- await ctx.editMessageText(`${t("bot.lang.header", session.language)} ${t("bot.lang.autoDetect", session.language)}`, {
938
- parse_mode: "Markdown",
939
- });
940
- return;
941
- }
942
- const newLang = choice;
943
- session.language = newLang;
944
- markSessionDirty(userId);
945
- const { setExplicitLanguage } = await import("../services/language-detect.js");
946
- setExplicitLanguage(userId, newLang);
947
- const currentName = `${LOCALE_FLAGS[newLang]} ${LOCALE_NAMES[newLang]}`;
948
- await ctx.editMessageText(`${t("bot.lang.header", newLang)} ${currentName}`, {
949
- parse_mode: "Markdown",
950
- reply_markup: buildLangKeyboard(newLang),
951
- });
952
- await ctx.answerCallbackQuery(LOCALE_NAMES[newLang]);
953
- });
954
- bot.command("memory", async (ctx) => {
955
- const stats = getMemoryStats();
956
- const arg = ctx.match?.trim();
957
- if (!arg) {
958
- await ctx.reply(`🧠 *Memory*\n\n` +
959
- `*Long-term memory:* ${formatBytes(stats.longTermSize)}\n` +
960
- `*Daily logs:* ${stats.dailyLogs} files\n` +
961
- `*Today:* ${stats.todayEntries} entries\n\n` +
962
- `_Memory is automatically written on /new._\n` +
963
- `_Non-SDK providers load memory as context._`, { parse_mode: "Markdown" });
964
- return;
965
- }
966
- });
967
- bot.command("system", async (ctx) => {
968
- const memTotal = os.totalmem();
969
- const memFree = os.freemem();
970
- const memUsed = memTotal - memFree;
971
- const memPercent = Math.round((memUsed / memTotal) * 100);
972
- const uptime = os.uptime();
973
- const uptimeH = Math.floor(uptime / 3600);
974
- const uptimeM = Math.floor((uptime % 3600) / 60);
975
- const cpus = os.cpus();
976
- const loadAvg = os.loadavg();
977
- const procMem = process.memoryUsage();
978
- await ctx.reply(`🖥 *System Info*\n\n` +
979
- `*OS:* ${os.platform()} ${os.arch()} (${os.release()})\n` +
980
- `*Host:* ${os.hostname()}\n` +
981
- `*CPUs:* ${cpus.length}x ${cpus[0]?.model?.trim() || "unknown"}\n` +
982
- `*Load:* ${loadAvg.map(l => l.toFixed(2)).join(", ")}\n` +
983
- `*RAM:* ${formatBytes(memUsed)} / ${formatBytes(memTotal)} (${memPercent}%)\n` +
984
- `*System Uptime:* ${uptimeH}h ${uptimeM}m\n\n` +
985
- `🤖 *Bot Process*\n` +
986
- `*Node:* ${process.version}\n` +
987
- `*Heap:* ${formatBytes(procMem.heapUsed)} / ${formatBytes(procMem.heapTotal)}\n` +
988
- `*RSS:* ${formatBytes(procMem.rss)}\n` +
989
- `*PID:* ${process.pid}`, { parse_mode: "Markdown" });
990
- });
991
- bot.command("reload", async (ctx) => {
992
- const success = reloadSoul();
993
- await ctx.reply(success ? "✅ SOUL.md reloaded." : "❌ SOUL.md not found.");
994
- });
995
- // ── Access Control ────────────────────────────────
996
- // Callback for group approval/block
997
- bot.callbackQuery(/^access:(approve|block):(-?\d+)$/, async (ctx) => {
998
- const action = ctx.match[1];
999
- const chatId = parseInt(ctx.match[2]);
1000
- if (action === "approve") {
1001
- approveGroup(chatId);
1002
- await ctx.editMessageText(`✅ Group ${chatId} approved. Alvin Bot will now respond there.`);
1003
- // Notify the group
1004
- try {
1005
- await ctx.api.sendMessage(chatId, "👋 Alvin Bot is now active in this group!\n\n@mention me or reply to my messages.");
1006
- }
1007
- catch { /* group might not allow bot messages yet */ }
1008
- }
1009
- else {
1010
- blockGroup(chatId);
1011
- await ctx.editMessageText(`🚫 Group ${chatId} blocked. Alvin Bot will ignore this group.`);
1012
- }
1013
- await ctx.answerCallbackQuery();
1014
- });
1015
- bot.command("groups", async (ctx) => {
1016
- const groups = listGroups();
1017
- if (groups.length === 0) {
1018
- await ctx.reply("No groups registered.");
1019
- return;
1020
- }
1021
- const lines = groups.map(g => {
1022
- const status = g.status === "approved" ? "✅" : g.status === "blocked" ? "🚫" : "⏳";
1023
- return `${status} *${g.title}* (${g.messageCount} msgs)\n ID: \`${g.chatId}\``;
1024
- });
1025
- const keyboard = new InlineKeyboard();
1026
- for (const g of groups) {
1027
- if (g.status === "approved") {
1028
- keyboard.text(`🚫 Block: ${g.title.slice(0, 20)}`, `access:block:${g.chatId}`).row();
1029
- }
1030
- else if (g.status === "blocked" || g.status === "pending") {
1031
- keyboard.text(`✅ Approve: ${g.title.slice(0, 20)}`, `access:approve:${g.chatId}`).row();
1032
- }
1033
- }
1034
- const settings = getSettings();
1035
- await ctx.reply(`🔐 *Group Management*\n\n` +
1036
- `${lines.join("\n\n")}\n\n` +
1037
- `⚙️ *Settings:*\n` +
1038
- `Forwards: ${settings.allowForwards ? "✅" : "❌"}\n` +
1039
- `Auto-Approve: ${settings.autoApproveGroups ? "⚠️ ON" : "✅ OFF"}`, { parse_mode: "Markdown", reply_markup: keyboard });
1040
- });
1041
- bot.command("security", async (ctx) => {
1042
- const arg = ctx.match?.trim().toLowerCase();
1043
- const settings = getSettings();
1044
- if (!arg) {
1045
- await ctx.reply(`🔐 *Security Settings*\n\n` +
1046
- `*Forwards:* ${settings.allowForwards ? "✅ allowed" : "❌ blocked"}\n` +
1047
- `*Auto-Approve Groups:* ${settings.autoApproveGroups ? "⚠️ ON (dangerous!)" : "✅ OFF"}\n` +
1048
- `*Group Rate Limit:* ${settings.groupRateLimitPerHour}/h\n\n` +
1049
- `Change:\n` +
1050
- `\`/security forwards on|off\`\n` +
1051
- `\`/security autoapprove on|off\``, { parse_mode: "Markdown" });
1052
- return;
1053
- }
1054
- if (arg.startsWith("forwards ")) {
1055
- const val = arg.slice(9).trim();
1056
- setForwardingAllowed(val === "on" || val === "true");
1057
- await ctx.reply(`✅ Forwards: ${val === "on" || val === "true" ? "allowed" : "blocked"}`);
1058
- }
1059
- else if (arg.startsWith("autoapprove ")) {
1060
- const val = arg.slice(12).trim();
1061
- setAutoApprove(val === "on" || val === "true");
1062
- await ctx.reply(`${val === "on" || val === "true" ? "⚠️" : "✅"} Auto-Approve: ${val === "on" || val === "true" ? "ON" : "OFF"}`);
1063
- }
1064
- else {
1065
- await ctx.reply("Unknown. Use `/security` for options.", { parse_mode: "Markdown" });
1066
- }
1067
- });
1068
- // ── Browser Automation ─────────────────────────────────
1069
- bot.command("browse", async (ctx) => {
1070
- const arg = ctx.match?.toString().trim();
1071
- if (!arg) {
1072
- await ctx.reply("🌐 *Browser Commands:*\n\n" +
1073
- "`/browse <URL>` — Screenshot a webpage\n" +
1074
- "`/browse text <URL>` — Extract text\n" +
1075
- "`/browse pdf <URL>` — Save as PDF", { parse_mode: "Markdown" });
1076
- return;
1077
- }
1078
- if (!hasPlaywright()) {
1079
- await ctx.reply("❌ Playwright not installed.\n`npm install playwright && npx playwright install chromium`", { parse_mode: "Markdown" });
1080
- return;
1081
- }
1082
- try {
1083
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
1084
- // /browse text <url>
1085
- if (arg.startsWith("text ")) {
1086
- const url = arg.slice(5).trim();
1087
- const text = await extractText(url);
1088
- const truncated = text.length > 3500 ? text.slice(0, 3500) + "\n\n_[...truncated]_" : text;
1089
- await ctx.reply(`🌐 *Text from ${url}:*\n\n${truncated}`, { parse_mode: "Markdown" });
1090
- return;
1091
- }
1092
- // /browse pdf <url>
1093
- if (arg.startsWith("pdf ")) {
1094
- const url = arg.slice(4).trim();
1095
- await ctx.api.sendChatAction(ctx.chat.id, "upload_document");
1096
- const pdfPath = await generatePdf(url);
1097
- await ctx.replyWithDocument(new InputFile(fs.readFileSync(pdfPath), "page.pdf"), {
1098
- caption: `📄 PDF from ${url}`,
1099
- });
1100
- fs.unlink(pdfPath, () => { });
1101
- return;
1102
- }
1103
- // Default: screenshot
1104
- const url = arg.startsWith("http") ? arg : `https://${arg}`;
1105
- await ctx.api.sendChatAction(ctx.chat.id, "upload_photo");
1106
- const screenshotPath = await screenshotUrl(url, { fullPage: false });
1107
- await ctx.replyWithPhoto(new InputFile(fs.readFileSync(screenshotPath), "screenshot.png"), {
1108
- caption: `🌐 ${url}`,
1109
- });
1110
- fs.unlink(screenshotPath, () => { });
1111
- }
1112
- catch (err) {
1113
- const msg = err instanceof Error ? err.message : String(err);
1114
- await ctx.reply(`❌ Browser error: ${msg}`);
1115
- }
1116
- });
1117
- // ── Custom Tools ──────────────────────────────────────
1118
- bot.command("tools", async (ctx) => {
1119
- const arg = ctx.match?.toString().trim();
1120
- // /tools run <name> [params json]
1121
- if (arg?.startsWith("run ")) {
1122
- const parts = arg.slice(4).trim().split(/\s+/);
1123
- const toolName = parts[0];
1124
- let params = {};
1125
- if (parts.length > 1) {
1126
- try {
1127
- params = JSON.parse(parts.slice(1).join(" "));
1128
- }
1129
- catch {
1130
- await ctx.reply("❌ Invalid JSON for parameters.", { parse_mode: "Markdown" });
1131
- return;
1132
- }
1133
- }
1134
- try {
1135
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
1136
- const result = await executeCustomTool(toolName, params);
1137
- const truncated = result.length > 3000 ? result.slice(0, 3000) + "\n..." : result;
1138
- await ctx.reply(`🔧 *${toolName}:*\n\`\`\`\n${truncated}\n\`\`\``, { parse_mode: "Markdown" });
1139
- }
1140
- catch (err) {
1141
- const msg = err instanceof Error ? err.message : String(err);
1142
- await ctx.reply(`❌ Tool error: ${msg}`);
1143
- }
1144
- return;
1145
- }
1146
- // /tools — list all
1147
- const tools = listCustomTools();
1148
- if (tools.length === 0) {
1149
- await ctx.reply("🔧 *Custom Tools*\n\n" +
1150
- "No tools configured.\n" +
1151
- "Create `TOOLS.md` (see `TOOLS.example.md`).", { parse_mode: "Markdown" });
1152
- return;
1153
- }
1154
- const lines = tools.map(t => {
1155
- const icon = t.type === "http" ? "🌐" : "⚡";
1156
- return `${icon} \`${t.name}\` — ${t.description}`;
1157
- });
1158
- await ctx.reply(`🔧 *Custom Tools (${tools.length}):*\n\n${lines.join("\n")}\n\n` +
1159
- `_Run: \`/tools run <name> {"param":"value"}\`_`, { parse_mode: "Markdown" });
1160
- });
1161
- // ── MCP ────────────────────────────────────────────────
1162
- bot.command("mcp", async (ctx) => {
1163
- const arg = ctx.match?.toString().trim();
1164
- // /mcp call <server> <tool> <json-args>
1165
- if (arg?.startsWith("call ")) {
1166
- const parts = arg.slice(5).trim().split(/\s+/);
1167
- if (parts.length < 2) {
1168
- await ctx.reply("Format: `/mcp call <server> <tool> {\"arg\":\"value\"}`", { parse_mode: "Markdown" });
1169
- return;
1170
- }
1171
- const [server, tool, ...rest] = parts;
1172
- let args = {};
1173
- if (rest.length > 0) {
1174
- try {
1175
- args = JSON.parse(rest.join(" "));
1176
- }
1177
- catch {
1178
- await ctx.reply("❌ Invalid JSON for tool arguments.");
1179
- return;
1180
- }
1181
- }
1182
- try {
1183
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
1184
- const result = await callMCPTool(server, tool, args);
1185
- const truncated = result.length > 3000 ? result.slice(0, 3000) + "\n..." : result;
1186
- await ctx.reply(`🔧 *${server}/${tool}:*\n\`\`\`\n${truncated}\n\`\`\``, { parse_mode: "Markdown" });
1187
- }
1188
- catch (err) {
1189
- const msg = err instanceof Error ? err.message : String(err);
1190
- await ctx.reply(`❌ MCP error: ${msg}`);
1191
- }
1192
- return;
1193
- }
1194
- // Default: show status
1195
- const mcpServers = getMCPStatus();
1196
- const tools = getMCPTools();
1197
- if (mcpServers.length === 0) {
1198
- await ctx.reply(`🔌 *MCP (Model Context Protocol)*\n\n` +
1199
- `No servers configured.\n` +
1200
- `Create \`docs/mcp.json\` (see \`docs/mcp.example.json\`).`, { parse_mode: "Markdown" });
1201
- return;
1202
- }
1203
- const serverLines = mcpServers.map(s => {
1204
- const status = s.connected ? "🟢" : "🔴";
1205
- return `${status} *${s.name}* — ${s.tools} Tools`;
1206
- });
1207
- const toolLines = tools.length > 0
1208
- ? "\n\n*Available Tools:*\n" + tools.map(t => ` 🔧 \`${t.server}/${t.name}\` — ${t.description}`).join("\n")
1209
- : "";
1210
- await ctx.reply(`🔌 *MCP Server (${mcpServers.length}):*\n\n` +
1211
- serverLines.join("\n") +
1212
- toolLines +
1213
- `\n\n_Use \`/mcp call <server> <tool> {args}\` to execute._`, { parse_mode: "Markdown" });
1214
- });
1215
- // ── Plugins ───────────────────────────────────────────
1216
- bot.command("plugins", async (ctx) => {
1217
- const plugins = getLoadedPlugins();
1218
- if (plugins.length === 0) {
1219
- await ctx.reply(`🔌 No plugins loaded.\n\n` +
1220
- `Place plugins in \`${getPluginsDir()}/\`.\n` +
1221
- `Each plugin needs a folder with \`index.js\`.`, { parse_mode: "Markdown" });
1222
- return;
1223
- }
1224
- const lines = plugins.map(p => {
1225
- const cmds = p.commands.length > 0 ? `\n Commands: ${p.commands.join(", ")}` : "";
1226
- const tools = p.tools.length > 0 ? `\n Tools: ${p.tools.join(", ")}` : "";
1227
- return `🔌 *${p.name}* v${p.version}\n ${p.description}${cmds}${tools}`;
1228
- });
1229
- await ctx.reply(`🔌 *Loaded Plugins (${plugins.length}):*\n\n${lines.join("\n\n")}`, { parse_mode: "Markdown" });
1230
- });
1231
- // ── Skills ─────────────────────────────────────────────
1232
- bot.command("skills", async (ctx) => {
1233
- const { getSkills } = await import("../services/skills.js");
1234
- const skills = getSkills();
1235
- if (skills.length === 0) {
1236
- await ctx.reply("🎯 No skills installed.\n\nAdd SKILL.md files to the `skills/` directory.", { parse_mode: "HTML" });
1237
- return;
1238
- }
1239
- const lines = skills.map(s => `🎯 <b>${s.name}</b> (${s.category})\n ${s.description || "(no description)"}\n Triggers: ${s.triggers.slice(0, 5).join(", ")}`);
1240
- await ctx.reply(`🎯 <b>Skills (${skills.length}):</b>\n\n${lines.join("\n\n")}`, { parse_mode: "HTML" });
1241
- });
1242
- // ── User Profiles ─────────────────────────────────────
1243
- bot.command("users", async (ctx) => {
1244
- const profiles = listProfiles();
1245
- if (profiles.length === 0) {
1246
- await ctx.reply("No user profiles saved yet.");
1247
- return;
1248
- }
1249
- const lines = profiles.map(p => {
1250
- const lastActive = new Date(p.lastActive).toLocaleDateString("en-US");
1251
- const badge = p.isOwner ? "👑" : "👤";
1252
- return `${badge} *${p.name}*${p.username ? ` (@${p.username})` : ""}\n ${p.totalMessages} messages, last active: ${lastActive}`;
1253
- });
1254
- await ctx.reply(`👥 *User-Profile (${profiles.length}):*\n\n${lines.join("\n\n")}`, { parse_mode: "Markdown" });
1255
- });
1256
- bot.command("note", async (ctx) => {
1257
- const arg = ctx.match?.toString().trim();
1258
- if (!arg) {
1259
- await ctx.reply("📝 Use: `/note @username Note text`\nSaves a note about a user.", { parse_mode: "Markdown" });
1260
- return;
1261
- }
1262
- // Parse @username or userId + note text
1263
- const match = arg.match(/^@?(\S+)\s+(.+)$/s);
1264
- if (!match) {
1265
- await ctx.reply("Format: `/note @username Text`", { parse_mode: "Markdown" });
1266
- return;
1267
- }
1268
- const [, target, noteText] = match;
1269
- const profiles = listProfiles();
1270
- const profile = profiles.find(p => p.username === target || p.userId.toString() === target || p.name.toLowerCase() === target.toLowerCase());
1271
- if (!profile) {
1272
- await ctx.reply(`User "${target}" not found.`);
1273
- return;
1274
- }
1275
- addUserNote(profile.userId, noteText);
1276
- await ctx.reply(`📝 Note saved for ${profile.name}.`);
1277
- });
1278
- // ── Memory Search Commands ───────────────────────────
1279
- bot.command("recall", async (ctx) => {
1280
- const query = ctx.match?.toString().trim();
1281
- if (!query) {
1282
- await ctx.reply("🔍 Use: `/recall <search term>`\nSemantic search through my memory.", { parse_mode: "Markdown" });
1283
- return;
1284
- }
1285
- try {
1286
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
1287
- const results = await searchMemory(query, 5, 0.25);
1288
- if (results.length === 0) {
1289
- await ctx.reply(`🔍 No memories found for "${query}".`);
1290
- return;
1291
- }
1292
- const lines = results.map((r, i) => {
1293
- const score = Math.round(r.score * 100);
1294
- const preview = r.text.length > 200 ? r.text.slice(0, 200) + "..." : r.text;
1295
- return `**${i + 1}.** (${score}%) _${r.source}_\n${preview}`;
1296
- });
1297
- await ctx.reply(`🧠 Memories for "${query}":\n\n${lines.join("\n\n")}`, { parse_mode: "Markdown" });
1298
- }
1299
- catch (err) {
1300
- const msg = err instanceof Error ? err.message : String(err);
1301
- await ctx.reply(`❌ Recall error: ${msg}`);
1302
- }
1303
- });
1304
- bot.command("remember", async (ctx) => {
1305
- const text = ctx.match?.toString().trim();
1306
- if (!text) {
1307
- await ctx.reply("💾 Use: `/remember <text>`\nSaves something to my memory.", { parse_mode: "Markdown" });
1308
- return;
1309
- }
1310
- try {
1311
- appendDailyLog(`**Manually remembered:** ${text}`);
1312
- // Trigger reindex so the new entry is searchable
1313
- const stats = await reindexMemory();
1314
- await ctx.reply(`💾 Remembered! (${stats.total} entries in index)`);
1315
- }
1316
- catch (err) {
1317
- const msg = err instanceof Error ? err.message : String(err);
1318
- await ctx.reply(`❌ Error saving: ${msg}`);
1319
- }
1320
- });
1321
- bot.command("reindex", async (ctx) => {
1322
- try {
1323
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
1324
- const stats = await reindexMemory(true);
1325
- const indexStats = getIndexStats();
1326
- const sizeKB = (indexStats.sizeBytes / 1024).toFixed(1);
1327
- await ctx.reply(`🔄 Memory re-indexed!\n\n` +
1328
- `📊 ${stats.indexed} chunks processed\n` +
1329
- `📁 ${indexStats.files} files indexed\n` +
1330
- `🧠 ${stats.total} total entries\n` +
1331
- `💾 Index size: ${sizeKB} KB`);
1332
- }
1333
- catch (err) {
1334
- const msg = err instanceof Error ? err.message : String(err);
1335
- await ctx.reply(`❌ Reindex error: ${msg}`);
1336
- }
1337
- });
1338
- // ── Cron Jobs ──────────────────────────────────────────
1339
- bot.command("cron", async (ctx) => {
1340
- const arg = ctx.match?.toString().trim() || "";
1341
- const userId = ctx.from.id;
1342
- const chatId = ctx.chat.id;
1343
- // /cron — list all jobs
1344
- if (!arg) {
1345
- const jobs = listJobs();
1346
- if (jobs.length === 0) {
1347
- await ctx.reply("⏰ <b>Cron Jobs</b>\n\nNo jobs configured.\n\n" +
1348
- "Create:\n" +
1349
- "<code>/cron add 5m reminder Wasser trinken</code>\n" +
1350
- "<code>/cron add \"0 9 * * 1\" shell pm2 status</code>\n" +
1351
- "<code>/cron add 1h http https://api.example.com/health</code>\n\n" +
1352
- "<i>Manage jobs also in the Web UI under ⏰ Cron.</i>", { parse_mode: "HTML" });
1353
- return;
1354
- }
1355
- const lines = jobs.map(j => {
1356
- const status = j.enabled ? "🟢" : "⏸️";
1357
- const next = j.enabled ? formatNextRun(j.nextRunAt) : "paused";
1358
- const lastErr = j.lastError ? " ⚠️" : "";
1359
- const readable = humanReadableSchedule(j.schedule);
1360
- const recur = j.oneShot ? "⚡ One-shot" : "🔄 " + readable;
1361
- return `${status} <b>${j.name}</b>\n 📅 ${recur} | Next: ${next}\n Runs: ${j.runCount}${lastErr} | ID: <code>${j.id}</code>`;
1362
- });
1363
- const keyboard = new InlineKeyboard();
1364
- for (const j of jobs) {
1365
- const label = j.enabled ? `⏸ ${j.name}` : `▶️ ${j.name}`;
1366
- keyboard.text(label, `cron:toggle:${j.id}`);
1367
- keyboard.text(`🗑`, `cron:delete:${j.id}`);
1368
- keyboard.row();
1369
- }
1370
- await ctx.reply(`⏰ <b>Cron Jobs (${jobs.length}):</b>\n\n${lines.join("\n\n")}\n\n` +
1371
- `Commands: /cron add · delete · toggle · run · info`, { parse_mode: "HTML", reply_markup: keyboard });
1372
- return;
1373
- }
1374
- // /cron add <schedule> <type> <payload> [--timeout <sec|off>]
1375
- if (arg.startsWith("add ")) {
1376
- let rest = arg.slice(4).trim();
1377
- // Extract optional --timeout flag from anywhere in the command.
1378
- // Accepts seconds, "off", "unlimited", "-1", or "0" — anything ≤ 0
1379
- // or non-numeric collapses to -1 (unlimited).
1380
- let timeoutMs;
1381
- const timeoutMatch = rest.match(/(^|\s)--timeout\s+(\S+)/);
1382
- if (timeoutMatch) {
1383
- const val = timeoutMatch[2].toLowerCase();
1384
- if (["off", "unlimited", "infinite", "-1", "0"].includes(val)) {
1385
- timeoutMs = -1;
1386
- }
1387
- else {
1388
- const secs = Number(timeoutMatch[2]);
1389
- if (!Number.isFinite(secs) || secs < 0) {
1390
- await ctx.reply(`❌ Invalid <code>--timeout</code> value: ${timeoutMatch[2]}`, { parse_mode: "HTML" });
1391
- return;
1392
- }
1393
- timeoutMs = Math.floor(secs * 1000);
1394
- }
1395
- rest = rest.replace(/(^|\s)--timeout\s+\S+/, "").trim();
1396
- }
1397
- // Natural language schedule shortcuts (German + English)
1398
- const naturalSchedules = {
1399
- "täglich": "0 8 * * *", "daily": "0 8 * * *",
1400
- "stündlich": "0 * * * *", "hourly": "0 * * * *",
1401
- "wöchentlich": "0 8 * * 1", "weekly": "0 8 * * 1",
1402
- "monatlich": "0 8 1 * *", "monthly": "0 8 1 * *",
1403
- "werktags": "0 8 * * 1-5", "weekdays": "0 8 * * 1-5",
1404
- "wochenende": "0 10 * * 0,6", "weekend": "0 10 * * 0,6",
1405
- "montags": "0 8 * * 1", "dienstags": "0 8 * * 2", "mittwochs": "0 8 * * 3",
1406
- "donnerstags": "0 8 * * 4", "freitags": "0 8 * * 5", "samstags": "0 10 * * 6", "sonntags": "0 10 * * 0",
1407
- "morgens": "0 8 * * *", "mittags": "0 12 * * *", "abends": "0 18 * * *", "nachts": "0 0 * * *",
1408
- };
1409
- // Time-prefixed natural: "8:30 täglich" or "täglich 8:30"
1410
- function resolveNatural(input) {
1411
- // Try "HH:MM keyword rest" or "keyword HH:MM rest"
1412
- const timeKeyword = input.match(/^(\d{1,2}):(\d{2})\s+(\S+)\s*(.*)/);
1413
- if (timeKeyword) {
1414
- const key = timeKeyword[3].toLowerCase();
1415
- if (naturalSchedules[key]) {
1416
- const base = naturalSchedules[key].split(" ");
1417
- base[0] = String(parseInt(timeKeyword[2]));
1418
- base[1] = String(parseInt(timeKeyword[1]));
1419
- return { schedule: base.join(" "), rest: timeKeyword[4] };
1420
- }
1421
- }
1422
- const keywordTime = input.match(/^(\S+)\s+(\d{1,2}):(\d{2})\s*(.*)/);
1423
- if (keywordTime) {
1424
- const key = keywordTime[1].toLowerCase();
1425
- if (naturalSchedules[key]) {
1426
- const base = naturalSchedules[key].split(" ");
1427
- base[0] = String(parseInt(keywordTime[3]));
1428
- base[1] = String(parseInt(keywordTime[2]));
1429
- return { schedule: base.join(" "), rest: keywordTime[4] };
1430
- }
1431
- }
1432
- // Simple keyword
1433
- const firstWord = input.split(" ")[0].toLowerCase();
1434
- if (naturalSchedules[firstWord]) {
1435
- return { schedule: naturalSchedules[firstWord], rest: input.slice(firstWord.length).trim() };
1436
- }
1437
- return null;
1438
- }
1439
- // Parse: schedule can be "5m", natural keyword, or "0 9 * * 1" (quoted)
1440
- let schedule;
1441
- let remainder;
1442
- const natural = resolveNatural(rest);
1443
- if (natural) {
1444
- schedule = natural.schedule;
1445
- remainder = natural.rest;
1446
- }
1447
- else if (rest.startsWith('"')) {
1448
- const endQuote = rest.indexOf('"', 1);
1449
- if (endQuote < 0) {
1450
- await ctx.reply("❌ Missing closing quote for cron expression.");
1451
- return;
1452
- }
1453
- schedule = rest.slice(1, endQuote);
1454
- remainder = rest.slice(endQuote + 1).trim();
1455
- }
1456
- else {
1457
- const sp = rest.indexOf(" ");
1458
- if (sp < 0) {
1459
- await ctx.reply("Format: <code>/cron add &lt;schedule&gt; &lt;type&gt; &lt;payload&gt; [--timeout &lt;sec|off&gt;]</code>\n\nSchedule options:\n• <b>Intervals:</b> 5m, 1h, 30s, 2d\n• <b>Natural:</b> daily, weekly, monthly, weekdays, hourly\n• <b>With time:</b> 8:30 daily, weekdays 9:00\n• <b>German:</b> täglich, wöchentlich, morgens, abends\n• <b>Cron:</b> \"0 9 * * 1-5\"\n\nOptional <code>--timeout</code> in seconds, or <code>off</code>/<code>-1</code> for unlimited.", { parse_mode: "HTML" });
1460
- return;
1461
- }
1462
- schedule = rest.slice(0, sp);
1463
- remainder = rest.slice(sp + 1).trim();
1464
- }
1465
- // Parse type + payload
1466
- const typeSp = remainder.indexOf(" ");
1467
- const typeStr = typeSp >= 0 ? remainder.slice(0, typeSp) : remainder;
1468
- const payloadStr = typeSp >= 0 ? remainder.slice(typeSp + 1).trim() : "";
1469
- const validTypes = ["reminder", "shell", "http", "message", "ai-query"];
1470
- if (!validTypes.includes(typeStr)) {
1471
- await ctx.reply(`❌ Invalid type "${typeStr}". Allowed: ${validTypes.join(", ")}`);
1472
- return;
1473
- }
1474
- const payload = {};
1475
- switch (typeStr) {
1476
- case "reminder":
1477
- case "message":
1478
- payload.text = payloadStr;
1479
- break;
1480
- case "shell":
1481
- payload.command = payloadStr;
1482
- break;
1483
- case "http":
1484
- payload.url = payloadStr;
1485
- break;
1486
- case "ai-query":
1487
- payload.prompt = payloadStr;
1488
- break;
1489
- }
1490
- const name = `${typeStr}: ${payloadStr.slice(0, 30)}${payloadStr.length > 30 ? "..." : ""}`;
1491
- const job = createJob({
1492
- name,
1493
- type: typeStr,
1494
- schedule,
1495
- payload,
1496
- target: { platform: "telegram", chatId: String(chatId) },
1497
- createdBy: `telegram:${userId}`,
1498
- ...(timeoutMs !== undefined ? { timeoutMs } : {}),
1499
- });
1500
- const readableSched = humanReadableSchedule(job.schedule);
1501
- const timeoutLine = typeof job.timeoutMs === "number"
1502
- ? job.timeoutMs <= 0
1503
- ? `<b>Timeout:</b> ∞ (unlimited)\n`
1504
- : `<b>Timeout:</b> ${Math.round(job.timeoutMs / 1000)}s\n`
1505
- : "";
1506
- await ctx.reply(`✅ <b>Cron Job created</b>\n\n` +
1507
- `<b>Name:</b> ${job.name}\n` +
1508
- `📅 <b>${readableSched}</b>\n` +
1509
- `<b>Type:</b> ${job.type}\n` +
1510
- timeoutLine +
1511
- `<b>Next run:</b> ${formatNextRun(job.nextRunAt)}\n` +
1512
- `<b>ID:</b> <code>${job.id}</code>`, { parse_mode: "HTML" });
1513
- return;
1514
- }
1515
- // /cron delete <id>
1516
- if (arg.startsWith("delete ")) {
1517
- const id = arg.slice(7).trim();
1518
- if (deleteJob(id)) {
1519
- await ctx.reply(`✅ Job \`${id}\` deleted.`, { parse_mode: "Markdown" });
1520
- }
1521
- else {
1522
- await ctx.reply(`❌ Job \`${id}\` not found.`, { parse_mode: "Markdown" });
1523
- }
1524
- return;
1525
- }
1526
- // /cron toggle <id>
1527
- if (arg.startsWith("toggle ")) {
1528
- const id = arg.slice(7).trim();
1529
- const job = toggleJob(id);
1530
- if (job) {
1531
- await ctx.reply(`${job.enabled ? "▶️" : "⏸️"} Job "${job.name}" ${job.enabled ? "enabled" : "paused"}.`);
1532
- }
1533
- else {
1534
- await ctx.reply(`❌ Job not found.`);
1535
- }
1536
- return;
1537
- }
1538
- // /cron run <name-or-id>
1539
- //
1540
- // UX contract:
1541
- // 1. Instantly post a "🚀 Started …" message so the user knows
1542
- // the command was received.
1543
- // 2. Every 60s edit that message with the elapsed-time ticker
1544
- // so the chat shows proof-of-life during 10+ min sub-agent
1545
- // runs (the Daily Job Alert takes ~13 min in production).
1546
- // 3. When runJobNow returns, edit the same message into a
1547
- // final "✅ Done" / "❌ error" / "⏳ already running" state.
1548
- // 4. The heavy lifting (banner + full body + chunking) stays in
1549
- // subagent-delivery.ts — which now has a Markdown→plain-text
1550
- // fallback so it actually reaches the user.
1551
- if (arg.startsWith("run ")) {
1552
- const nameOrId = arg.slice(4).trim();
1553
- // Resolve up-front so we can show the real job name in the
1554
- // "Started" ack, and so we handle the not-found case BEFORE
1555
- // spending a Telegram round-trip on a pointless placeholder.
1556
- const resolved = resolveJobByNameOrId(listJobs(), nameOrId);
1557
- if (!resolved) {
1558
- const jobs = listJobs();
1559
- const hint = jobs.length > 0
1560
- ? `\n\nAvailable:\n${jobs.slice(0, 10).map(j => `• ${j.name}`).join("\n")}`
1561
- : "";
1562
- await ctx.reply(`❌ No job matches <code>${nameOrId}</code>.${hint}`, { parse_mode: "HTML" });
1563
- return;
1564
- }
1565
- const jobName = resolved.name;
1566
- const startedAt = Date.now();
1567
- // Post initial ack — we'll edit THIS message for the ticker and
1568
- // the final state.
1569
- let ackMessageId = null;
1570
- try {
1571
- const ack = await ctx.reply(`🚀 Started *${escapeMarkdown(jobName)}* — working…`, { parse_mode: "Markdown" });
1572
- ackMessageId = ack.message_id;
1573
- }
1574
- catch (err) {
1575
- // If even the initial ack fails, fall back to plain text so
1576
- // the user still knows we received the command.
1577
- try {
1578
- const ack = await ctx.reply(`🚀 Started ${jobName} — working…`);
1579
- ackMessageId = ack.message_id;
1580
- }
1581
- catch { /* give up on the ack — run still fires below */ }
1582
- }
1583
- const chatId = ctx.chat.id;
1584
- // Progress ticker: edit the ack message with elapsed time every
1585
- // 60s. Errors from editMessageText (including the harmless
1586
- // "message is not modified") are swallowed via the central filter.
1587
- const ticker = setInterval(async () => {
1588
- if (ackMessageId === null)
1589
- return;
1590
- const elapsed = Math.floor((Date.now() - startedAt) / 1000);
1591
- try {
1592
- await ctx.api.editMessageText(chatId, ackMessageId, buildTickerText(jobName, elapsed), { parse_mode: "Markdown" });
1593
- }
1594
- catch (err) {
1595
- if (!isHarmlessTelegramError(err)) {
1596
- console.warn(`[cron:run] ticker edit failed:`, err);
1597
- }
1598
- }
1599
- }, 60_000);
1600
- let outcome;
1601
- try {
1602
- outcome = await runJobNow(nameOrId);
1603
- }
1604
- finally {
1605
- clearInterval(ticker);
1606
- }
1607
- // Final state — edit the ack message one last time.
1608
- const elapsed = Math.floor((Date.now() - startedAt) / 1000);
1609
- const finalText = (() => {
1610
- if (outcome.status === "not-found") {
1611
- // Shouldn't happen — we already resolved successfully above —
1612
- // but handle it for completeness.
1613
- return `❌ ${escapeMarkdown(jobName)} — not found (race?)`;
1614
- }
1615
- if (outcome.status === "already-running") {
1616
- return buildDoneText(outcome.job.name, elapsed, { ok: true, skipped: true });
1617
- }
1618
- return buildDoneText(outcome.job.name, elapsed, {
1619
- ok: !outcome.error,
1620
- error: outcome.error,
1621
- });
1622
- })();
1623
- if (ackMessageId !== null) {
1624
- try {
1625
- await ctx.api.editMessageText(chatId, ackMessageId, finalText, { parse_mode: "Markdown" });
1626
- }
1627
- catch (err) {
1628
- if (!isHarmlessTelegramError(err)) {
1629
- // Last-ditch fallback: post as a new plain message so the
1630
- // user sees the result even if the edit failed.
1631
- await ctx.reply(finalText).catch(() => { });
1632
- }
1633
- }
1634
- }
1635
- else {
1636
- // We never got an ack message id — just post fresh
1637
- await ctx.reply(finalText, { parse_mode: "Markdown" }).catch(() => ctx.reply(finalText));
1638
- }
1639
- return;
1640
- }
1641
- await ctx.reply("Unknown cron command. Use /cron for help.");
1642
- });
1643
- // Inline keyboard callbacks for cron
1644
- bot.callbackQuery(/^cron:toggle:(.+)$/, async (ctx) => {
1645
- const id = ctx.match[1];
1646
- const job = toggleJob(id);
1647
- if (job) {
1648
- await ctx.answerCallbackQuery(`${job.enabled ? "Enabled" : "Paused"}: ${job.name}`);
1649
- // Refresh the cron list
1650
- ctx.match = "";
1651
- // Re-render the list message (HTML to avoid Markdown * conflicts with cron expressions)
1652
- const jobs = listJobs();
1653
- const lines = jobs.map(j => {
1654
- const status = j.enabled ? "🟢" : "⏸️";
1655
- const next = j.enabled ? formatNextRun(j.nextRunAt) : "paused";
1656
- const readable = humanReadableSchedule(j.schedule);
1657
- const recur = j.oneShot ? "⚡ One-shot" : "🔄 " + readable;
1658
- return `${status} <b>${j.name}</b>\n 📅 ${recur} | Next: ${next}\n Runs: ${j.runCount} | ID: <code>${j.id}</code>`;
1659
- });
1660
- const keyboard = new InlineKeyboard();
1661
- for (const j of jobs) {
1662
- keyboard.text(j.enabled ? `⏸ ${j.name}` : `▶️ ${j.name}`, `cron:toggle:${j.id}`);
1663
- keyboard.text(`🗑`, `cron:delete:${j.id}`);
1664
- keyboard.row();
1665
- }
1666
- await ctx.editMessageText(`⏰ <b>Cron Jobs (${jobs.length}):</b>\n\n${lines.join("\n\n")}`, { parse_mode: "HTML", reply_markup: keyboard });
1667
- }
1668
- });
1669
- bot.callbackQuery(/^cron:delete:(.+)$/, async (ctx) => {
1670
- const id = ctx.match[1];
1671
- deleteJob(id);
1672
- await ctx.answerCallbackQuery("Deleted");
1673
- // Refresh (HTML parse mode)
1674
- const jobs = listJobs();
1675
- if (jobs.length === 0) {
1676
- await ctx.editMessageText("⏰ No cron jobs configured.");
1677
- }
1678
- else {
1679
- const lines = jobs.map(j => {
1680
- const status = j.enabled ? "🟢" : "⏸️";
1681
- const readable = humanReadableSchedule(j.schedule);
1682
- return `${status} <b>${j.name}</b>\n 📅 ${readable} | ID: <code>${j.id}</code>`;
1683
- });
1684
- const keyboard = new InlineKeyboard();
1685
- for (const j of jobs) {
1686
- keyboard.text(j.enabled ? `⏸ ${j.name}` : `▶️ ${j.name}`, `cron:toggle:${j.id}`);
1687
- keyboard.text(`🗑`, `cron:delete:${j.id}`);
1688
- keyboard.row();
1689
- }
1690
- await ctx.editMessageText(`⏰ <b>Cron Jobs (${jobs.length}):</b>\n\n${lines.join("\n\n")}`, { parse_mode: "HTML", reply_markup: keyboard });
1691
- }
1692
- });
1693
- // ── Setup (API Keys & Platforms via Telegram) ─────────
1694
- bot.command("setup", async (ctx) => {
1695
- const arg = ctx.match?.toString().trim() || "";
1696
- if (!arg) {
1697
- const registry = getRegistry();
1698
- const providers = await registry.listAll();
1699
- const activeInfo = registry.getActive().getInfo();
1700
- const keyboard = new InlineKeyboard()
1701
- .text("🔑 Manage API Keys", "setup:keys").row()
1702
- .text("📱 Platforms", "setup:platforms").row()
1703
- .text("🔐 Sudo / Admin Access", "setup:sudo").row()
1704
- .text("🛡️ Permissions Wizard (Mac)", "setup:permissions").row()
1705
- .text("🔧 Open Web Dashboard", "setup:web").row();
1706
- await ctx.reply(`⚙️ *Alvin Bot Setup*\n\n` +
1707
- `*Active Model:* ${activeInfo.name}\n` +
1708
- `*Providers:* ${providers.length} configured\n` +
1709
- `*Web UI:* http://localhost:${process.env.WEB_PORT || 3100}\n\n` +
1710
- `What would you like to configure?`, { parse_mode: "Markdown", reply_markup: keyboard });
1711
- return;
1712
- }
1713
- // /setup sudo [password] — configure sudo access
1714
- if (arg.startsWith("sudo")) {
1715
- const pw = arg.slice(4).trim();
1716
- if (!pw) {
1717
- // Show status
1718
- const status = await getSudoStatus();
1719
- const statusIcon = status.configured ? (status.verified ? "✅" : "⚠️") : "❌";
1720
- const keyboard = new InlineKeyboard();
1721
- if (status.configured) {
1722
- keyboard.text("🧪 Verify", "sudo:verify").row();
1723
- keyboard.text("🔴 Revoke Access", "sudo:revoke").row();
1724
- }
1725
- await ctx.reply(`🔐 *Sudo / Admin Access*\n\n` +
1726
- `*Status:* ${statusIcon} ${status.configured ? (status.verified ? "Configured & verified" : "Configured, not verified") : "Not set up"}\n` +
1727
- `*Storage:* ${status.storageMethod}\n` +
1728
- `*System:* ${status.platform} (${status.user})\n` +
1729
- (status.permissions.accessibility !== null ? `*Accessibility:* ${status.permissions.accessibility ? "✅" : "❌"}\n` : "") +
1730
- (status.permissions.fullDiskAccess !== null ? `*Full Disk Access:* ${status.permissions.fullDiskAccess ? "✅" : "❌"}\n` : "") +
1731
- `\n*Setup:*\n\`/setup sudo <your-system-password>\`\n\n` +
1732
- `_The password is securely stored in ${status.storageMethod}. ` +
1733
- `This allows Alvin Bot to run admin commands (install software, change system settings, etc.)._\n\n` +
1734
- `⚠️ _Delete this message after setup! The password is visible in chat history._`, { parse_mode: "Markdown", reply_markup: keyboard });
1735
- return;
1736
- }
1737
- // Store the password
1738
- await ctx.api.sendChatAction(ctx.chat.id, "typing");
1739
- const result = storePassword(pw);
1740
- if (!result.ok) {
1741
- await ctx.reply(`❌ Error saving: ${result.error}`);
1742
- return;
1743
- }
1744
- // Verify
1745
- const verify = await verifyPassword();
1746
- if (verify.ok) {
1747
- await ctx.reply(`✅ *Sudo access configured!*\n\n` +
1748
- `Password stored in: ${result.method}\n` +
1749
- `Verification: ✅ successful\n\n` +
1750
- `Alvin Bot can now run admin commands.\n\n` +
1751
- `⚠️ _Please delete the message with the password from the chat!_`, { parse_mode: "Markdown" });
1752
- }
1753
- else {
1754
- revokePassword(); // Wrong password — clean up
1755
- await ctx.reply(`❌ *Wrong password!*\n\n` +
1756
- `The entered password does not work for sudo.\n` +
1757
- `Please try again: \`/setup sudo <correct-password>\``, { parse_mode: "Markdown" });
1758
- }
1759
- // Try to delete the user's message containing the password
1760
- try {
1761
- await ctx.api.deleteMessage(ctx.chat.id, ctx.message.message_id);
1762
- }
1763
- catch {
1764
- // Can't delete in private chats sometimes — that's ok
1765
- }
1766
- return;
1767
- }
1768
- // /setup key <provider> <key>
1769
- if (arg.startsWith("key ")) {
1770
- const parts = arg.slice(4).trim().split(/\s+/);
1771
- if (parts.length < 2) {
1772
- await ctx.reply("🔑 *Set API Key:*\n\n" +
1773
- "`/setup key openai sk-...`\n" +
1774
- "`/setup key google AIza...`\n" +
1775
- "`/setup key nvidia nvapi-...`\n" +
1776
- "`/setup key openrouter sk-or-...`\n\n" +
1777
- "_The key will be saved to .env. Restart required._", { parse_mode: "Markdown" });
1778
- return;
1779
- }
1780
- const envMap = {
1781
- openai: "OPENAI_API_KEY",
1782
- google: "GOOGLE_API_KEY",
1783
- nvidia: "NVIDIA_API_KEY",
1784
- openrouter: "OPENROUTER_API_KEY",
1785
- groq: "GROQ_API_KEY",
1786
- };
1787
- const provider = parts[0].toLowerCase();
1788
- const key = parts.slice(1).join(" ");
1789
- const envKey = envMap[provider];
1790
- if (!envKey) {
1791
- await ctx.reply(`❌ Unknown provider "${provider}". Use: ${Object.keys(envMap).join(", ")}`);
1792
- return;
1793
- }
1794
- // Write to .env
1795
- const envFile = resolve(process.cwd(), ".env");
1796
- let content = fs.existsSync(envFile) ? fs.readFileSync(envFile, "utf-8") : "";
1797
- const regex = new RegExp(`^${envKey}=.*$`, "m");
1798
- if (regex.test(content))
1799
- content = content.replace(regex, `${envKey}=${key}`);
1800
- else
1801
- content = content.trimEnd() + `\n${envKey}=${key}\n`;
1802
- fs.writeFileSync(envFile, content);
1803
- await ctx.reply(`✅ ${envKey} saved! Please restart the bot (/system restart or Web UI).`);
1804
- return;
1805
- }
1806
- });
1807
- bot.callbackQuery(/^sudo:(.+)$/, async (ctx) => {
1808
- const action = ctx.match[1];
1809
- if (action === "verify") {
1810
- const result = await verifyPassword();
1811
- await ctx.answerCallbackQuery(result.ok ? "✅ Sudo works!" : `❌ ${result.error}`);
1812
- }
1813
- else if (action === "revoke") {
1814
- revokePassword();
1815
- await ctx.editMessageText("🔴 Sudo access revoked. Password deleted.");
1816
- await ctx.answerCallbackQuery("Access revoked");
1817
- }
1818
- });
1819
- bot.callbackQuery(/^setup:(.+)$/, async (ctx) => {
1820
- const action = ctx.match[1];
1821
- switch (action) {
1822
- case "keys": {
1823
- const envMap = [
1824
- { name: "OpenAI", env: "OPENAI_API_KEY", has: !!config.apiKeys.openai },
1825
- { name: "Google", env: "GOOGLE_API_KEY", has: !!config.apiKeys.google },
1826
- { name: "NVIDIA", env: "NVIDIA_API_KEY", has: !!config.apiKeys.nvidia },
1827
- { name: "OpenRouter", env: "OPENROUTER_API_KEY", has: !!config.apiKeys.openrouter },
1828
- { name: "Groq", env: "GROQ_API_KEY", has: !!config.apiKeys.groq },
1829
- ];
1830
- const lines = envMap.map(e => `${e.has ? "✅" : "❌"} *${e.name}* — \`${e.env}\``);
1831
- await ctx.editMessageText(`🔑 *API Keys*\n\n${lines.join("\n")}\n\n` +
1832
- `Set key: \`/setup key <provider> <key>\`\n` +
1833
- `Example: \`/setup key nvidia nvapi-...\`\n\n` +
1834
- `_Restart required after changes._`, { parse_mode: "Markdown" });
1835
- break;
1836
- }
1837
- case "platforms": {
1838
- const platforms = [
1839
- { name: "Telegram", icon: "📱", env: "BOT_TOKEN", has: !!process.env.BOT_TOKEN },
1840
- { name: "Discord", icon: "🎮", env: "DISCORD_TOKEN", has: !!process.env.DISCORD_TOKEN },
1841
- { name: "WhatsApp", icon: "💬", env: "WHATSAPP_ENABLED", has: process.env.WHATSAPP_ENABLED === "true" },
1842
- { name: "Signal", icon: "🔒", env: "SIGNAL_API_URL", has: !!process.env.SIGNAL_API_URL },
1843
- ];
1844
- const lines = platforms.map(p => `${p.has ? "✅" : "❌"} ${p.icon} *${p.name}* — \`${p.env}\``);
1845
- await ctx.editMessageText(`📱 *Platforms*\n\n${lines.join("\n")}\n\n` +
1846
- `_Set up platforms in Web UI: Models → Platforms_\n` +
1847
- `_There you can enter tokens and install dependencies._`, { parse_mode: "Markdown" });
1848
- break;
1849
- }
1850
- case "sudo": {
1851
- const status = await getSudoStatus();
1852
- const statusIcon = status.configured ? (status.verified ? "✅" : "⚠️") : "❌";
1853
- await ctx.editMessageText(`🔐 *Sudo / Admin Access*\n\n` +
1854
- `*Status:* ${statusIcon} ${status.configured ? (status.verified ? "Active & verified" : "Configured") : "Not set up"}\n` +
1855
- `*Storage:* ${status.storageMethod}\n\n` +
1856
- `Setup: \`/setup sudo <system-password>\`\n` +
1857
- `Revoke: \`/setup sudo\` → "Revoke" button\n\n` +
1858
- `_The password is securely stored in ${status.storageMethod}._`, { parse_mode: "Markdown" });
1859
- break;
1860
- }
1861
- case "permissions": {
1862
- // 5.1.0 — Permissions Wizard summary. Mobile UX is intentionally
1863
- // read-only: the wizard itself needs to open System Settings panes
1864
- // on the host machine, which only the CLI/WebUI can drive. Here
1865
- // we surface status + tell the user how to run the actual wizard.
1866
- try {
1867
- const { readPermissionsSnapshot } = await import("../services/permissions-wizard.js");
1868
- const snaps = await readPermissionsSnapshot();
1869
- const icons = { granted: "✅", missing: "❌", "tool-missing": "⚠️", "n/a": "·" };
1870
- const lines = snaps.map(s => `${icons[s.state]} *${s.permission.name}* — ${s.state}${s.detail ? " _(" + s.detail + ")_" : ""}`);
1871
- const missing = snaps.filter(s => s.state === "missing" || s.state === "tool-missing").length;
1872
- const summary = missing === 0
1873
- ? "*All applicable permissions granted.*"
1874
- : `*${missing} permission${missing === 1 ? "" : "s"} need attention.*`;
1875
- await ctx.editMessageText(`🛡️ *Permissions Status*\n\n${lines.join("\n")}\n\n${summary}\n\n` +
1876
- `_macOS doesn't let any app grant TCC permissions on its own — you toggle the switch, the wizard verifies._\n\n` +
1877
- `*To run the guided wizard:*\n` +
1878
- `• CLI: \`alvin-bot permissions wizard\` (opens each Settings pane, waits, verifies)\n` +
1879
- `• WebUI: http://localhost:${process.env.WEB_PORT || 3100} → Settings`, { parse_mode: "Markdown" });
1880
- }
1881
- catch (err) {
1882
- await ctx.editMessageText("🛡️ *Permissions Status*\n\n_Could not load wizard module — try `alvin-bot permissions status` in a terminal._", { parse_mode: "Markdown" });
1883
- }
1884
- break;
1885
- }
1886
- case "web": {
1887
- await ctx.editMessageText(`🌐 *Web Dashboard*\n\n` +
1888
- `URL: \`http://localhost:${process.env.WEB_PORT || 3100}\`\n\n` +
1889
- `In the dashboard you can:\n` +
1890
- `• 🤖 Manage models & API keys\n` +
1891
- `• 📱 Set up platforms\n` +
1892
- `• ⏰ Manage cron jobs\n` +
1893
- `• 🧠 Edit memory\n` +
1894
- `• 💻 Use terminal\n` +
1895
- `• 🛠️ Run tools`, { parse_mode: "Markdown" });
1896
- break;
1897
- }
1898
- }
1899
- await ctx.answerCallbackQuery();
1900
- });
1901
- /** Build StopDeps for a session — wires the three stop side-effects. */
1902
- function buildStopDeps(session) {
1903
- return {
1904
- interruptQuery: () => interruptQuery(session),
1905
- killDetachedAgents: () => killSessionDetachedAgents(session),
1906
- clearPendingForSession: (k) => cancelPendingForSession(k),
1907
- };
1908
- }
1909
- bot.command("cancel", async (ctx) => {
1910
- const userId = ctx.from.id;
1911
- // Use buildSessionKey so the resolved session is always the SAME object
1912
- // that message.ts created (and that registered pending agents under this key).
1913
- // In per-user mode this equals String(userId); in per-channel modes it
1914
- // incorporates chatId — matching the key used for the ⛔ button payload.
1915
- const sessionKey = buildSessionKey("telegram", ctx.chat.id, userId);
1916
- const session = getSession(sessionKey);
1917
- const lang = session.language;
1918
- if (session.isProcessing) {
1919
- requestStop(session, "soft", buildStopDeps(session));
1920
- await ctx.reply(t("bot.cancel.cancelling", lang));
1921
- // V56-T2c — a real stop fired: follow the "cancelling…" notice with a
1922
- // brief confirmation that the work was actually halted (consistent UX
1923
- // with the ⛔ button). Best-effort — must never throw into the handler.
1924
- await ctx.reply(t("bot.cancel.confirmed", lang)).catch(() => { });
1925
- }
1926
- else {
1927
- await ctx.reply(t("bot.cancel.noRunning", lang));
1928
- }
1929
- });
1930
- // /stopall — hard stop: interrupt query + kill detached agents + clear queue + cancel pending.
1931
- bot.command("stopall", async (ctx) => {
1932
- const userId = ctx.from.id;
1933
- // Same canonical-key resolution as /cancel above — must match message.ts.
1934
- const sessionKey = buildSessionKey("telegram", ctx.chat.id, userId);
1935
- const session = getSession(sessionKey);
1936
- const lang = session.language;
1937
- if (session.isProcessing) {
1938
- requestStop(session, "hard", buildStopDeps(session));
1939
- await ctx.reply(t("bot.cancel.stoppedAll", lang));
1940
- }
1941
- else {
1942
- await ctx.reply(t("bot.cancel.noRunning", lang));
1943
- }
1944
- });
1945
- // stop: inline keyboard callback — soft stop triggered from the ⛔ button
1946
- // sent alongside the processing indicator in the message handler.
1947
- // Payload format: "stop:<sessionKey>" where sessionKey = String(userId) in
1948
- // default per-user mode (mirrors buildSessionKey used in message.ts).
1949
- bot.callbackQuery(/^stop:(.+)$/, async (ctx) => {
1950
- const sessionKey = ctx.match[1];
1951
- const session = getSession(sessionKey);
1952
- const lang = session.language;
1953
- // A1 — Capture isProcessing BEFORE requestStop (which sets it false)
1954
- // so we can show the right toast: "stopped" vs "already finished".
1955
- const wasProcessing = session.isProcessing;
1956
- if (wasProcessing) {
1957
- requestStop(session, "soft", buildStopDeps(session));
1958
- }
1959
- // A1 — Honest toast: if the turn had already finished when the button was
1960
- // tapped, don't claim "stopped" — tell the user it was already done.
1961
- const toastKey = wasProcessing
1962
- ? "bot.cancel.stoppedToast"
1963
- : "bot.cancel.alreadyDone";
1964
- try {
1965
- await ctx.answerCallbackQuery({ text: t(toastKey, lang) });
1966
- }
1967
- catch { /* harmless grammy race */ }
1968
- try {
1969
- await ctx.editMessageReplyMarkup({});
1970
- }
1971
- catch { /* harmless grammy race — message may already be gone */ }
1972
- // V56-T2c — when a real stop genuinely fired (wasProcessing), also send a
1973
- // short in-chat confirmation in the session language so the user gets a
1974
- // persistent acknowledgement, not only the ephemeral toast. When nothing
1975
- // was running we deliberately stay silent here (v5.5.0 honesty: the
1976
- // alreadyDone toast already told the truth). Best-effort — must never
1977
- // throw into the handler.
1978
- if (wasProcessing) {
1979
- await ctx.reply(t("bot.cancel.confirmed", lang)).catch(() => { });
1980
- }
1981
- });
1982
- // /restart — trigger a PM2-managed restart by exiting the process.
1983
- // The PM2 supervisor picks up the exit and respawns with --update-env.
1984
- bot.command("restart", async (ctx) => {
1985
- const lang = getSession(ctx.from.id).language;
1986
- await ctx.reply(t("bot.restart.triggered", lang));
1987
- // Intentional restart — don't let the watchdog score it as a crash.
1988
- markExpectedRestart();
1989
- // Small delay so the Telegram message is actually delivered before exit
1990
- setTimeout(() => process.exit(0), 500);
1991
- });
1992
- // /update — git pull + install + build, then PM2-restart if anything changed.
1993
- bot.command("update", async (ctx) => {
1994
- const lang = getSession(ctx.from.id).language;
1995
- await ctx.reply(t("bot.update.checking", lang));
1996
- try {
1997
- const result = await runUpdate();
1998
- if (result.ok) {
1999
- await ctx.reply(`✅ ${result.message}`);
2000
- // Extract the installed version from the message (e.g. "Installed v4.16.1 ...")
2001
- // so we can look up its CHANGELOG block. Falls silently if no match.
2002
- const versionMatch = result.message.match(/v(\d+\.\d+\.\d+)/);
2003
- if (versionMatch) {
2004
- const highlights = getReleaseHighlights(versionMatch[1]);
2005
- if (highlights) {
2006
- await ctx.reply(`📝 *What's new in v${versionMatch[1]}*\n\n${highlights}`, {
2007
- parse_mode: "Markdown",
2008
- });
2009
- }
2010
- }
2011
- if (result.requiresRestart) {
2012
- await ctx.reply(t("bot.update.restarting", lang));
2013
- // Intentional restart — don't let the watchdog score it as a crash.
2014
- markExpectedRestart();
2015
- setTimeout(() => process.exit(0), 500);
2016
- }
2017
- }
2018
- else {
2019
- await ctx.reply(`${t("bot.update.failed", lang)}\n\`${result.message}\``, { parse_mode: "Markdown" });
2020
- }
2021
- }
2022
- catch (err) {
2023
- const msg = err instanceof Error ? err.message : String(err);
2024
- await ctx.reply(`${t("bot.update.error", lang)} ${msg}`);
2025
- }
2026
- });
2027
- // /autoupdate on|off|status — toggle the background auto-update loop.
2028
- // Persisted to ~/.alvin-bot/auto-update.flag so it survives restarts.
2029
- bot.command("autoupdate", async (ctx) => {
2030
- const lang = getSession(ctx.from.id).language;
2031
- const arg = (ctx.match || "").trim().toLowerCase();
2032
- if (arg === "on") {
2033
- setAutoUpdate(true);
2034
- await ctx.reply(t("bot.autoupdate.enabled", lang), { parse_mode: "Markdown" });
2035
- }
2036
- else if (arg === "off") {
2037
- setAutoUpdate(false);
2038
- await ctx.reply(t("bot.autoupdate.disabled", lang), { parse_mode: "Markdown" });
2039
- }
2040
- else {
2041
- const status = getAutoUpdate();
2042
- await ctx.reply(`${t("bot.autoupdate.statusLabel", lang)} *${status ? "ON" : "OFF"}*\n\n${t("bot.autoupdate.commandsLabel", lang)}\n\`/autoupdate on\`\n\`/autoupdate off\``, { parse_mode: "Markdown" });
2043
- }
2044
- });
2045
- // /cleanup — trigger disk cleanup manually, or show current policy.
2046
- // /cleanup → show policy
2047
- // /cleanup run → run a cleanup pass and report what was deleted
2048
- bot.command("cleanup", async (ctx) => {
2049
- const arg = (ctx.match || "").trim().toLowerCase();
2050
- if (arg === "run" || arg === "now") {
2051
- await ctx.reply("🧹 Running disk cleanup...");
2052
- const r = await runCleanup();
2053
- const bytes = r.bytesReclaimed;
2054
- const human = bytes < 1024 * 1024
2055
- ? `${(bytes / 1024).toFixed(1)} KB`
2056
- : bytes < 1024 * 1024 * 1024
2057
- ? `${(bytes / 1024 / 1024).toFixed(1)} MB`
2058
- : `${(bytes / 1024 / 1024 / 1024).toFixed(2)} GB`;
2059
- const errLine = r.errors.length > 0 ? `\n⚠️ ${r.errors.length} error(s)` : "";
2060
- await ctx.reply(`✅ Cleanup done\n• Files deleted: ${r.filesDeleted}\n• Logs rotated: ${r.logsRotated}\n• Reclaimed: ${human}${errLine}`);
2061
- }
2062
- else {
2063
- const p = getCleanupPolicy();
2064
- await ctx.reply(`🧹 *Cleanup policy*\n` +
2065
- `• Log rotation: >${p.logMaxSizeMb} MB\n` +
2066
- `• Screenshots: >${p.screenshotsMaxAgeDays} days\n` +
2067
- `• Subagent outputs: >${p.subagentsMaxAgeDays} days\n` +
2068
- `• /tmp/alvin-bot: >${p.tmpMaxAgeDays} days\n` +
2069
- `• WhatsApp media: >${p.waMediaMaxAgeDays} days\n\n` +
2070
- `Memory, assets, workspaces, cron jobs are NEVER touched.\n\n` +
2071
- `Configure via env: \`CLEANUP_LOG_MAX_MB\`, \`CLEANUP_SCREENSHOTS_DAYS\`, \`CLEANUP_SUBAGENTS_DAYS\`, \`CLEANUP_TMP_DAYS\`, \`CLEANUP_WA_MEDIA_DAYS\`\n\n` +
2072
- `Run manually: \`/cleanup run\``, { parse_mode: "Markdown" });
2073
- }
2074
- });
2075
- // ── /sub-agents — manage background subagents (cron jobs + manual spawns) ──
2076
- //
2077
- // /sub-agents → show current config + running agents
2078
- // /sub-agents max <n> → set max parallel (0 = auto = CPU cores, capped 16)
2079
- // /sub-agents list → list all agents with IDs
2080
- // /sub-agents cancel <id> → cancel a specific running agent
2081
- // /sub-agents result <id> → show the result of a completed agent
2082
- //
2083
- // Grammy normalises command names — dashes are not allowed in the command
2084
- // string, so the actual handler binds to "subagents" (no dash). Users can
2085
- // type both "/sub-agents" and "/subagents" — Telegram routes both to this.
2086
- bot.command(["sub_agents", "subagents"], async (ctx) => {
2087
- const lang = getSession(ctx.from.id).language;
2088
- const { listSubAgents, listActiveSubAgents, cancelSubAgent, getSubAgentResult, getMaxParallelAgents, getConfiguredMaxParallel, setMaxParallelAgents, findSubAgentByName, getVisibility, setVisibility, getQueueCap, setQueueCap, getDefaultTimeoutMs, setDefaultTimeoutMs, } = await import("../services/subagents.js");
2089
- const arg = (ctx.match || "").trim();
2090
- const tokens = arg.split(/\s+/).filter(Boolean);
2091
- const sub = tokens[0]?.toLowerCase() || "";
2092
- // Helper: shorten a UUID to its first 8 chars for display
2093
- const shortId = (id) => id.slice(0, 8);
2094
- // Helper: format a SubAgentInfo line with depth indent (F2 visibility)
2095
- const formatAgent = (a) => {
2096
- const indent = " ".repeat(Math.max(0, a.depth));
2097
- const ageSec = Math.floor((Date.now() - a.startedAt) / 1000);
2098
- const ageLabel = ageSec < 60 ? `${ageSec}s` : ageSec < 3600 ? `${Math.floor(ageSec / 60)}m` : `${Math.floor(ageSec / 3600)}h`;
2099
- const sourceBadge = a.source === "cron" ? "⏰" : a.source === "implicit" ? "🔗" : "👤";
2100
- const depthTag = a.depth > 0 ? ` d${a.depth}` : "";
2101
- const queueTag = a.status === "queued" && a.queuePosition ? ` #${a.queuePosition}` : "";
2102
- return `${indent}${sourceBadge} \`${shortId(a.id)}\` ${a.name} (${a.status}${queueTag}, ${ageLabel}${depthTag})`;
2103
- };
2104
- // /sub-agents max <n>
2105
- if (sub === "max") {
2106
- const n = parseInt(tokens[1] || "", 10);
2107
- if (isNaN(n)) {
2108
- await ctx.reply(t("bot.subagents.usage", lang), { parse_mode: "Markdown" });
2109
- return;
2110
- }
2111
- const effective = setMaxParallelAgents(n);
2112
- await ctx.reply(t("bot.subagents.maxSet", lang, { n, eff: effective }), { parse_mode: "Markdown" });
2113
- return;
2114
- }
2115
- // /subagents stats — show rolling 24h run stats (H3)
2116
- if (sub === "stats") {
2117
- const { getSubAgentStats } = await import("../services/subagent-stats.js");
2118
- const s = getSubAgentStats();
2119
- const formatTok = (n) => (n < 1000 ? `${n}` : `${(n / 1000).toFixed(1)}k`);
2120
- const formatDur = (ms) => {
2121
- const sec = Math.floor(ms / 1000);
2122
- if (sec < 60)
2123
- return `${sec}s`;
2124
- const m = Math.floor(sec / 60);
2125
- return `${m}m`;
2126
- };
2127
- const lines = [
2128
- `📊 *Sub-Agent Stats* — last ${s.windowHours}h`,
2129
- ``,
2130
- `*Total:* ${s.total.runs} runs · ${formatTok(s.total.inputTokens)} in / ${formatTok(s.total.outputTokens)} out · ${formatDur(s.total.totalDurationMs)}`,
2131
- ``,
2132
- `*By source:*`,
2133
- ` 👤 user: ${s.bySource.user.runs} runs · ${formatTok(s.bySource.user.inputTokens)} in / ${formatTok(s.bySource.user.outputTokens)} out`,
2134
- ` ⏰ cron: ${s.bySource.cron.runs} runs · ${formatTok(s.bySource.cron.inputTokens)} in / ${formatTok(s.bySource.cron.outputTokens)} out`,
2135
- ` 🔗 implicit: ${s.bySource.implicit.runs} runs · ${formatTok(s.bySource.implicit.inputTokens)} in / ${formatTok(s.bySource.implicit.outputTokens)} out`,
2136
- ``,
2137
- `*By status:*`,
2138
- ` ✅ completed: ${s.byStatus.completed}`,
2139
- ` ⚠️ cancelled: ${s.byStatus.cancelled}`,
2140
- ` ⏱️ timeout: ${s.byStatus.timeout}`,
2141
- ` ❌ error: ${s.byStatus.error}`,
2142
- ];
2143
- await ctx.reply(lines.join("\n"), { parse_mode: "Markdown" });
2144
- return;
2145
- }
2146
- // /subagents timeout [sec|off|unlimited|-1] — set default sub-agent timeout
2147
- if (sub === "timeout") {
2148
- const val = tokens[1];
2149
- const formatTimeout = (ms) => {
2150
- if (ms <= 0)
2151
- return "∞ (unlimited)";
2152
- if (ms < 1000)
2153
- return `${ms}ms`;
2154
- const sec = ms / 1000;
2155
- if (sec < 60)
2156
- return `${sec}s`;
2157
- const min = sec / 60;
2158
- if (min < 60)
2159
- return `${min.toFixed(min < 10 ? 1 : 0)}min`;
2160
- return `${(min / 60).toFixed(1)}h`;
2161
- };
2162
- if (!val) {
2163
- const current = getDefaultTimeoutMs();
2164
- await ctx.reply(`⏱ Default sub-agent timeout: *${formatTimeout(current)}*\n\n` +
2165
- `Usage: \`/subagents timeout <sec>\` · \`/subagents timeout off\`\n` +
2166
- `\`off\`, \`unlimited\`, \`-1\` oder \`0\` = kein Timeout. ` +
2167
- `Gilt für neue Subagents und ai-query Cron-Jobs ohne eigenen Wert.`, { parse_mode: "Markdown" });
2168
- return;
2169
- }
2170
- const lower = val.toLowerCase();
2171
- let ms;
2172
- if (["off", "unlimited", "infinite", "-1", "0"].includes(lower)) {
2173
- ms = -1;
2174
- }
2175
- else {
2176
- const secs = Number(val);
2177
- if (!Number.isFinite(secs) || secs < 0) {
2178
- await ctx.reply(`❌ Ungültiger Wert \`${val}\`. Nutze Sekunden (z.B. \`300\`) oder \`off\`.`, { parse_mode: "Markdown" });
2179
- return;
2180
- }
2181
- ms = Math.floor(secs * 1000);
2182
- }
2183
- const effective = setDefaultTimeoutMs(ms);
2184
- await ctx.reply(`✅ Default sub-agent timeout: *${formatTimeout(effective)}*`, { parse_mode: "Markdown" });
2185
- return;
2186
- }
2187
- // /subagents queue <n> — set bounded-queue cap (0 disables queue)
2188
- if (sub === "queue") {
2189
- const n = parseInt(tokens[1] || "", 10);
2190
- if (isNaN(n)) {
2191
- const current = getQueueCap();
2192
- await ctx.reply(`Queue cap: *${current}* (${current === 0 ? "disabled" : "bounded"})\nUsage: \`/subagents queue <n>\` (0 disables the queue, max 200)`, { parse_mode: "Markdown" });
2193
- return;
2194
- }
2195
- const effective = setQueueCap(n);
2196
- await ctx.reply(`✅ Queue cap set to *${effective}* ${effective === 0 ? "(queue disabled — full pool rejects immediately)" : ""}`, { parse_mode: "Markdown" });
2197
- return;
2198
- }
2199
- // /sub-agents visibility <auto|banner|silent|live>
2200
- if (sub === "visibility") {
2201
- const mode = tokens[1];
2202
- if (!mode) {
2203
- // Show current value
2204
- const current = getVisibility();
2205
- await ctx.reply(`${t("bot.subagents.visibilityLabel", lang)} *${current}*\n\n${t("bot.subagents.usage", lang)}`, { parse_mode: "Markdown" });
2206
- return;
2207
- }
2208
- try {
2209
- setVisibility(mode);
2210
- await ctx.reply(t("bot.subagents.visibilitySet", lang, { mode }), { parse_mode: "Markdown" });
2211
- }
2212
- catch {
2213
- await ctx.reply(t("bot.subagents.visibilityInvalid", lang, { mode }), { parse_mode: "Markdown" });
2214
- }
2215
- return;
2216
- }
2217
- // /sub-agents list — same rendering as the default, but forced
2218
- // v4.14.1 — uses listActiveSubAgents (merged view) so v4.13+
2219
- // alvin_dispatch_agent detached subprocesses also show up here.
2220
- if (sub === "list") {
2221
- const agents = await listActiveSubAgents();
2222
- if (agents.length === 0) {
2223
- await ctx.reply(t("bot.subagents.noneRunning", lang));
2224
- return;
2225
- }
2226
- const lines = agents.map(formatAgent).join("\n");
2227
- await ctx.reply(`${t("bot.subagents.activeHeader", lang)}\n${lines}`, { parse_mode: "Markdown" });
2228
- return;
2229
- }
2230
- // /sub-agents cancel <name|id>
2231
- // Resolution order: exact name → base-name (single match) → UUID prefix.
2232
- // If the base name is ambiguous, show a disambiguation reply.
2233
- if (sub === "cancel") {
2234
- const key = tokens[1] || "";
2235
- if (!key) {
2236
- await ctx.reply(t("bot.subagents.usage", lang), { parse_mode: "Markdown" });
2237
- return;
2238
- }
2239
- // 1. Ambiguity check via the resolver
2240
- const ambig = findSubAgentByName(key, { ambiguousAsList: true });
2241
- if (ambig && "ambiguous" in ambig) {
2242
- const list = ambig.candidates.map((c) => `• ${c.name}`).join("\n");
2243
- await ctx.reply(`Mehrdeutig — welchen meinst du?\n${list}\n\nBenutze den genauen Namen (z.B. \`${ambig.candidates[0].name}\`).`, { parse_mode: "Markdown" });
2244
- return;
2245
- }
2246
- // 2. Name match → cancel via that id
2247
- let targetId = null;
2248
- let displayName = key;
2249
- if (ambig && !("ambiguous" in ambig)) {
2250
- targetId = ambig.id;
2251
- displayName = ambig.name;
2252
- }
2253
- else {
2254
- // 3. Fallback: UUID-prefix match (back-compat with old usage)
2255
- const allAgents = listSubAgents();
2256
- const byId = allAgents.find((a) => a.id.startsWith(key));
2257
- if (byId) {
2258
- targetId = byId.id;
2259
- displayName = byId.name;
2260
- }
2261
- }
2262
- if (!targetId || !cancelSubAgent(targetId)) {
2263
- await ctx.reply(t("bot.subagents.notFound", lang, { id: key }));
2264
- return;
2265
- }
2266
- await ctx.reply(t("bot.subagents.cancelled", lang, { id: displayName }));
2267
- return;
2268
- }
2269
- // /sub-agents result <name|id>
2270
- if (sub === "result") {
2271
- const key = tokens[1] || "";
2272
- if (!key) {
2273
- await ctx.reply(t("bot.subagents.usage", lang), { parse_mode: "Markdown" });
2274
- return;
2275
- }
2276
- const ambig = findSubAgentByName(key, { ambiguousAsList: true });
2277
- if (ambig && "ambiguous" in ambig) {
2278
- const list = ambig.candidates.map((c) => `• ${c.name}`).join("\n");
2279
- await ctx.reply(`Mehrdeutig — welchen meinst du?\n${list}`, { parse_mode: "Markdown" });
2280
- return;
2281
- }
2282
- let target = null;
2283
- if (ambig && !("ambiguous" in ambig)) {
2284
- target = { id: ambig.id, name: ambig.name };
2285
- }
2286
- else {
2287
- const allAgents = listSubAgents();
2288
- const byId = allAgents.find((a) => a.id.startsWith(key));
2289
- if (byId)
2290
- target = { id: byId.id, name: byId.name };
2291
- }
2292
- if (!target) {
2293
- await ctx.reply(t("bot.subagents.notFound", lang, { id: key }));
2294
- return;
2295
- }
2296
- const result = getSubAgentResult(target.id);
2297
- if (!result) {
2298
- await ctx.reply(t("bot.subagents.notFound", lang, { id: key }));
2299
- return;
2300
- }
2301
- const duration = Math.floor(result.duration / 1000);
2302
- const header = t("bot.subagents.resultHeader", lang, { name: result.name, status: result.status });
2303
- const meta = t("bot.subagents.resultDuration", lang, { sec: duration, in: result.tokensUsed.input, out: result.tokensUsed.output });
2304
- // Cap output at ~3500 chars to stay inside Telegram message limit
2305
- const body = result.output.length > 3500 ? result.output.slice(0, 3500) + "\n\n…[truncated]" : result.output;
2306
- await ctx.reply(`${header}\n${meta}\n\n${body || result.error || "(no output)"}`, { parse_mode: "Markdown" }).catch(() =>
2307
- // retry without markdown in case the body has unescaped characters
2308
- ctx.reply(`${header}\n${meta}\n\n${body || result.error || "(no output)"}`));
2309
- return;
2310
- }
2311
- // Default: /sub-agents — show state + running list
2312
- const configured = getConfiguredMaxParallel();
2313
- const effective = getMaxParallelAgents();
2314
- const maxLabel = configured === 0
2315
- ? `${t("bot.subagents.maxLabel", lang)} 0 ${t("bot.subagents.autoSuffix", lang, { n: effective })}`
2316
- : `${t("bot.subagents.maxLabel", lang)} ${configured}`;
2317
- const visibilityLabel = `${t("bot.subagents.visibilityLabel", lang)} *${getVisibility()}*`;
2318
- const currentTimeout = getDefaultTimeoutMs();
2319
- const timeoutLabel = currentTimeout <= 0
2320
- ? `⏱ Timeout: *∞ (unlimited)*`
2321
- : `⏱ Timeout: *${Math.round(currentTimeout / 1000)}s*`;
2322
- // v4.14.1 — merged view incl. v4.13+ alvin_dispatch_agent agents.
2323
- const agents = await listActiveSubAgents();
2324
- let body = "";
2325
- if (agents.length === 0) {
2326
- body = `\n${t("bot.subagents.noneRunning", lang)}`;
2327
- }
2328
- else {
2329
- body = `\n${t("bot.subagents.activeHeader", lang)}\n${agents.map(formatAgent).join("\n")}`;
2330
- }
2331
- const header = t("bot.subagents.header", lang);
2332
- const usage = `\n\n${t("bot.subagents.usage", lang)}`;
2333
- const full = `${header}\n${maxLabel}\n${visibilityLabel}\n${timeoutLabel}${body}${usage}`;
2334
- await ctx.reply(full, { parse_mode: "Markdown" }).catch(() => ctx.reply(full));
2335
- });
2336
- }
1
+ const _0x576083=_0x2df7,_0x20cc6a=_0x2df7;(function(_0x1653b1,_0x72574b){const _0x3ab0f0=_0x2df7,_0x5d2e5d=_0x2df7,_0x4cc358=_0x1653b1();while(!![]){try{const _0x183ae1=-parseInt(_0x3ab0f0(0x3f9))/(-0x26eb+0x4*0x5d0+0xfac)*(-parseInt(_0x3ab0f0(0x2c1))/(-0x2d3*-0x5+-0x1763*0x1+0x946))+-parseInt(_0x5d2e5d(0x506))/(-0x95f*0x3+-0x1*-0xf85+0xc9b)+-parseInt(_0x3ab0f0(0x59d))/(0x1b2+-0x85d*0x4+0x2*0xfe3)*(-parseInt(_0x5d2e5d(0x2e2))/(-0x47*0xb+-0x2025+-0x259*-0xf))+parseInt(_0x3ab0f0(0xb3))/(-0x1d21+-0x6*0x2bd+0x1*0x2d95)*(-parseInt(_0x3ab0f0(0x224))/(0x74b+0x12f6+-0x1a3a))+-parseInt(_0x5d2e5d(0x5db))/(-0x502+-0xf61+0x146b)+-parseInt(_0x5d2e5d(0x246))/(0x2*0x745+-0x1bce*-0x1+-0x2a4f)+parseInt(_0x3ab0f0(0x5ce))/(0x2*-0x10fc+0xe*-0x35+0x49d*0x8);if(_0x183ae1===_0x72574b)break;else _0x4cc358['push'](_0x4cc358['shift']());}catch(_0x16949a){_0x4cc358['push'](_0x4cc358['shift']());}}}(_0x3df1,-0xa6e9d+0x3b823+0x1*0xc31d7));const _0x5027ee=(function(){let _0x1ebe12=!![];return function(_0x161eda,_0x4af4b8){const _0x3b0075=_0x1ebe12?function(){const _0x519de7=_0x2df7;if(_0x4af4b8){const _0x361067=_0x4af4b8[_0x519de7(0x3d0)](_0x161eda,arguments);return _0x4af4b8=null,_0x361067;}}:function(){};return _0x1ebe12=![],_0x3b0075;};}()),_0x1d01c5=_0x5027ee(this,function(){const _0x5698be=_0x2df7,_0x490bd3=_0x2df7;return _0x1d01c5[_0x5698be(0x268)]()[_0x490bd3(0x3e3)]('(((.+)+)+)'+'+$')['toString']()[_0x5698be(0x526)+'r'](_0x1d01c5)['search']('(((.+)+)+)'+'+$');});_0x1d01c5();import{InlineKeyboard,InputFile}from'grammy';import _0x40611e from'fs';import _0x159c6f,{resolve}from'path';import _0x3a2d43 from'os';import{getSession,buildSessionKey,resetSession,markSessionDirty,getTelegramWorkspace,setTelegramWorkspace}from'../services/session.js';import{listWorkspaces,getWorkspace}from'../services/workspaces.js';import{getRegistry}from'../engine.js';import{reloadSoul}from'../services/personality.js';import{parseDuration,createReminder,listReminders,cancelReminder}from'../services/reminders.js';import{writeSessionSummary,getMemoryStats,appendDailyLog}from'../services/memory.js';import{approveGroup,blockGroup,listGroups,getSettings,setForwardingAllowed,setAutoApprove}from'../services/access.js';import{generateImage}from'../services/imagegen.js';import{searchMemory,reindexMemory,getIndexStats}from'../services/embeddings.js';import{listProfiles,addUserNote}from'../services/users.js';import{getLoadedPlugins,getPluginsDir}from'../services/plugins.js';import{getMCPStatus,getMCPTools,callMCPTool}from'../services/mcp.js';import{listCustomTools,executeCustomTool}from'../services/custom-tools.js';import{screenshotUrl,extractText,generatePdf,hasPlaywright}from'../services/browser.js';function _0x3df1(){const _0xb3442=['zMyMz3q7xtWVyW','AcbGAw5KzxGUAG','CMfTicG','y2f0y2G','B3jRC3bHy2vZya','zw1VAMK','ig1LAw5ZDcbKDq','z28Uy29TlZ9Xpq','ywnJzxnZoMfWCa','y29Kzt4TlxrPBq','lMvUDG','zgf0zs5ZDgf0Dq','u3vTBwfYEsbZyq','yxiGBwvZC2fNzq','ifDLyIbvstOGtq','BgWGCg9VBcbYzq','Bg9Uz1rLCM1tAq','zgvYcG','yc9Zzwn1CML0Eq','yxrMB3jTC18k','igzHAwXZkq','BgvK','B29SigfYz3vTzq','C2f0Aw9Uiev4Ca','D29Yzd5GcGO','y2vZCYbJB25MAq','AwvYzw4UcGO','y3jVBJPKzwXLDa','vgvSzwDYyw0','lMLKBgu','vgHLigvUDgvYzq','yxv0B2fWChjVDG','q3jLyxrLigbutW','BMX5ihjLC3bVBG','CM92ztO','8j+KLIbnB2rLBdOGkG','mZbTienHBgWGBq','AM9I','igbdtevbtLvqxW','8j+oRYboBYbZA2LSBa','AguGzM9YBwf0lG','Axq6ia','u2vHCMnOoIbGlW','l3nLDhvWigTLEq','zYbKAxjLy3rVCG','kKj5ihnVDxjJzq','r2vYBwfUoJWVyG','zxjKzw4GAw4Gza','ktO8l2i+cGO','BgL0EuXHyMvS','ihbLCM1PC3nPBW','DxaU','lNbUzW','ifjLBwLUzgvYia','DgLTzw91DdOGkG','DcbWCMLTyxj5la','DxjJzq','4P2mifjLy2fSBcbL','8j+uTcbszxzVA2uGqq','igeGzMLSzsbHDa','yM90lMXHBMCUDq','ihLVDsbSAwTLia','pIb0W6rNBgLJAcW','8j+tGsbGFG','kLrVihj1BIb0Aa','C3vIywDLBNrZ','l2f1Dg91CgrHDa','B3rLigzVCIbJCG','z2v0','Ag9K','ihrVA2vUCW','ENvTifvTC29YDa','kLn5C3rLBtOQia','cIPtzxr1CdOQcG','C2LVBIbZDgfYDa','CgvYC29UysWGzW','B2zM','mca4icOGkIaX','kfnesYbZzxnZAq','yM90lMnHBMnLBa','igrHExmk','BJO8l2i+ia','C3rVCgfSBa','zw4GB24Gl25LDW','C2vJDxjPDhK','CMvHC29UAw5Nia','zgvUigDLBMf1zq','twfUywDLza','Aw1PDhmQcG','l2vMzM9YDcdIGjqG','iejVDcb2zxjZAq','DhLWAw5N','ig9KzxiGyg9MzG','CYWGB3iGDM9PyW','zgLYzwn0B3j5lG','igzPBgvZigLUza','D2LUzg93sg91CG','C2v0Dxa6A2v5CW','mtu1mZGXmKD5CKzxzq','8j+BOE+4JYaQugvYBwLZCW','yM90lNrPBwuUAa','rLrtnq','Ahr0Chm6lY9HCa','8j+tHcbqreyGzNjVBq','DMuGB258B2zMya','sfrnta','zc4kcKfKzcbtsW','8j+uHcaQrMfSBgjHyW','BIbUzwvKCYbHia','CNn1y2H0lGO','BMzPz3vYzwqUcG','x1jLC3rHCNqGCG','cUkaOIbszwnSywLT','4PQz77IpicPdB250CM9S','8j+sRcaQq2HHDcOk','kKDYB3vWifjHDa','ywXSEsb3CML0Da','8j+LHYa','kLn0B3jHz2u6kG','r2LSDcbMW7XYig4','4OcIic90BxaVywX2','igrHExmkcG','imk3ia','kg5VigrLC2nYAq','xWOkvxnLigaVDW','CY5F','C3vKBZP2zxjPzG','idXJB3jYzwn0lq','DgvKxq','cGPFwY4UlNrYDq','uerg','DhjPz2DLCKf0','zxjUywW','8j+tSsaQugXHDgzVCG','y29UzMLNDxjLza','4OcIidXIpK5HDhvY','B2zPBgvZihnHDG','B21Tyw5KCY4','CM9Szq','Axr5ycbMB3iGBW','yMfNzw50CYb0Aq','qwrTAw4GqwnJzq','AxqGzMfPBgvKoG','Aw9UlG','u0LhtKfmx0fqsq','ywDL','rM9YBwf0oIbGlW','nZa0nJy3mfjgug5NAq','BgfUzZPHDxrV','vw5RBM93BIbJCG','l2i+idvTlcaXAa','B2W+ihTHCMDZFq','uxvLDwuGy2fWoG','pc9JB2rLpI4','zZOGsgLNAaOk','B3vNAcbTEsbTzq','ie1ccG','BgfZDfnKA0HPCW','lwrLDgvJDc5QCW','BwfPBMLUzW','mJm1oti0ogXPs2visq','zw5HyMXLza','cIaGifrYAwDNzq','AxPHCMq6kGO','z2v0qwn0AxzLsW','vgHPCYbHBgXVDW','ig1LC3nHz2vZ','zYb0BYbTEsbTzq','y2HHDa','CMvJDg9YEtOG','DxbKyxrLzef0','CMvNAxn0zxjLza','BNKGyxbWigDYyq','Acb8ig1HEa','u3rHCNqGBMv3ia','4PQz77IpicPtzxr0Aw5N','twfUywDLigjHyW','CgrMia','BNrZlcbWAg90BW','CMvXDwvZDhnszq','lMXHC3ruDxjU','B3j5lG','zMfSBgjHy2S','zxjTAxnZAw9UCW','yc9Zzxr1CcbZDq','CNvUCW','B3jRC3bHy2u6ia','B2rLpGOku2nOzq','qvbjigTLExmGjG','4PQG77Ipif9ezwXLDguG','DxbKyxrL','zg8GphLVDxiTCW','D29YA3nWywnL','qxzNoIaGia','C2v0ia','ihrVA2vUCYbHBG','DxnLCKLK','zw52','C3nLCIb0CMLUAW','lM5VuNvUBMLUzW','BMrZ','tM8Gz3jVDxbZia','Axr0Aw5Nig9Uia','Bw9KzwW6kGOkqq','zw48l2nVzgu+cG','lxn0yxrZlMPZ','igfZihzVAwnLia','oJWVyJ4G4OIEicH1','mca4icOGkIaY','4PQHie9Uzs1ZAg90','CGOk','4O+WienYB24Upc9P','icbFka','CgXLlMnVBs9Ozq','zNvSBerPC2TbyW','zM9SzgvYihDPDa','kLjtuZOQia','rM9YD2fYzhm6ia','kLbjrdOQia','B2rLBaO','zhvSzsbVChrPBW','B21Tyw5KCW','igfUC3DLCNm','u0nsruvou0Hpva','igaYAgaSigaXza','iYmJia','yxLZqwDV','ig91Dhb1Dhm6ia','CgfZC3DVCMq+ya','Bw9KzwW','BI1kB2jZig9OBG','iJOQcG','8j+rPsaQvxnLCI1qCG','q2fSBcbTB21G','yaOk','ueLFs0vzig1PCW','B3bLBNjVDxrLCG','pc9IpGOGicdWN5ofia','C2rRu3vIvgfZAW','C2vHCMnOihrOCG','zwnHBgWGphnLyq','ihjLB3jKzxiUcG','zwqUkGOk','D2L0Acbzqu1mia','AhqGBM90igLUCW','C2TZoIa','Bwv0AgLUzWO','CZOG','yw1LpIb7iNbHCG','kg5Vihb1CNbVCW','zwqGEwv0lG','zxjYB3jZ','4OcuihLVDsb0B2DN','BMPLy3qTBw9Kzq','lGOk','BgL0EuLUDMfSAq','BwvTB3j5vxnHzW','CgvK','zwqGDg8GlMvUDG','zxH0idXvuKW+ya','r1jpuv9bueLFsW','DgLTzw91Da','pgi+tMv4DcbYDq','kGOk','4PQG77Ipif9qBgvHC2uG','BNrZlNvZywDL','zsbG','DMLKzsb0zxH0oG','kKHVC3q6kIa','ugXHy2uGCgX1zW','l3n0yxr1CYdIGjqG','DxrVrgv0zwn0','BwLUzgvYcG','sufFrefzu2akcG','z3jVDxbZ','igHPBNrZoIa','CMvWzwf0','BNrZlMHLywrLCG','BMvZlG','oJWVyJ4G','zxjYB3i','zsbTzxnZywDLCW','D2fnzwrPyu1HEa','yxjJAcb1C2LUzW','zgvMyxvSDa','Dg90ywXnzxnZyq','ihf1zxvLidXUpG','ienVBw1HBMrZoG','BhzPBI1IB3qGCa','zwqGAw4G','CM91BMq','zxnZywDLCY5F','CMvWBhLxAxrOra','zwWGpeLepMa','l3jLy2fSBca8Cq','CMf0Aw9UlIbfEa','tM8GDxnLCIbWCG','rwfJAcbWBhvNAq','AM9ICYbJB25MAq','ChvZAa','y29UDgvUDa','ignHBIbLBNrLCG','ihrVigXPC3qGyq','C3rHDhvZ','C3bVBMqUcG','ywjSzwqG4Ocuigz1','DhLWzsaI','yxLZ','yw5Hz2vTzw50kG','4OcIieXVzYbYB3rH','zwfYy2GGCxvLCG','y29KzxGTy2XP','DwjHz2vUDhmGDa','u3DPDgnOiefjia','kKfSBcbHChbSAq','CY4kcG','CMvXDwvZDhnmAq','mca4icOGkIaXlq','l3jLC3rHCNqG4Ocu','yxr1CW','cMbGya','BcbHDMfPBgfIBa','BNrZlM1HEeXHyG','CMvZCg9Uzcb0Aa','zxr1CcbZDwrVia','CMvJywXS','u2v0Dxa6igaVCW','BNrZihvUzcbHAq','Dg9VBfvZzunVDq','CY9ZDwjHz2vUDa','zMLSzxm','B3i6ia','8j+mKcaQv2vIifvjkG','4OcIifn1yMfNzw50','4PYfiePVyIbG','zgv0ywLS','DxnLCNm','icHnywmP','CYOk','8j+sOsaQ','BgfUzZPMCG','icdWN5sNiga','zwnVBMrZqwDV','zwfSDgG','oIOkcG','ugfZC3DVCMqGCW','BMv3','CNnZ','4P2migjSB2nRzwq','y2fUig5VDYbYDq','8j+uJcboBYbWBhvNAq','y29ZDfvZza','ief1Dg8TqxbWCG','D2vIDwK','igvUDhjPzxmGAq','kKfJDgL2zsbnBW','C3rHCNrLzef0','y2HLy2TWB2LUDa','BMv4Dfj1BKf0','t1zjrevsoG','zwqUifrLEhqTBW','nZq5mdeWCwnusg9Y','8j+uHcbnzw1VCNKGCG','yM90lMXHBMCUAa','z3jVDxbsyxrLta','u19eqvLtycWGya','BNm6cUkaOIa8yJ5j','C3DPDgnOrMfPBa','C3rVCMfNzu1LDa','kIdIGjqGD29YA2LU','igvUDhjPzxmkcG','u2vHCMnOigvYCG','ywnLcG','lcaZmhmSidjKcG','ywnLicO','icHht09htevFqq','Dg9Rzw5ZuMvTyq','4PYfieDYB3vWia','iI4Gvhj5igL0ia','CNjVCJOG','zsbmAw1PDdOQia','z2vKoIb0zwXLzW','l2zHBgXIywnRia','oIOG','BgWGC29MDhDHCG','igb+lY5HBhzPBG','4P2mie1ducbLCNjV','cIaGifrVB2XZoG','rGOk','ig9MzMa','zsbIB3q','AxncB3rnyw5HzW','ignHBMnLBgXLza','khf1zxvLigrPCW','8j+uKcaQu3vKBYaVia','iev4DhjHy3qGDa','8j+uKsaQqvbjieTLEq','ihWGsuq6idXJBW','Dgv4Dga','ierHC2HIB2fYza','u2v0igTLEtOGya','ChvYCg9Zzq','4PYfieHLywX0AhK','icGK','B2LJzsbYzxbSAq','DMvYAwzPzwq','zg93','zw91DdWVy29Kzq','idXIpG','BMrZicHPBNn0yq','twvTB3j5lcbHCW','AY0UlI5GcG','q3jLyxrLigbKBW','l2jYB3DZzsbWza','BNqGvendihbLCG','BgfUzZPLCW','Dcb0BYbYDw4Gyq','DMvKihrVig1LBq','8j+NUsaQq2XLyw51Ca','cKnVBNrLEhq6ia','y2fUzgLKyxrLCW','CxvLCMLLCW','sM9ICZWVyJ4kcG','x0XHC3qGy2HHBG','AgvHBhrOEq','CZOQcG','yxrPB24Gzgf0yq','x1rOzsbRzxKGDW','4OcIipcFP6aGrwrPDcbT','iIbUB3qGzM91BG','ig91DcdcTYa','CMvXDwLYzwqUxW','ihrVigv4Cg9YDa','Aw1LpIa8Dgv4Da','ifrVB2XZ','mcaWicOGkIaQ','mcaXmcaQicOGnG','zgf0zs5KAxnHyG','lKiUigaZmdbGkq','l3vZzxjZiokaLcbv','ywnJzxnZAwjPBa','r29Vz2XL','u3DPDgnOigzHAq','ycKU','yc9ICM93C2uGDa','EsbNB29NBguGqq','yhnRAwXSCY9Gia','Bg9NC1jVDgf0zq','BgLMzwn5y2XL','ChjPBwfYEq','ifnLDhrPBMDZia','ywnJzxnZoMjSBW','CgvYBwLZC2LVBG','CMvPBMrLEa','Axr5','CcbYzwfZB25PBG','DwnOzwqUcGO','CgLK','ywXSyMfJAYbZzq','yMXVy2TLza','y2vZkGO','DxaUlI4','xWOktMv4DcbTzq','ignVBMzPz3vYzq','kg5Vig91Dhb1Da','Dgv4Da','ihFdTMnOzw50BgK','tg93iokaLcbrDwLJ','zg1PBIbJB21Tyq','DguGBwuG4Ocuia','4OcIifnJCMvLBNnO','A3mH','q2HLy2TWB2LUDa','idXUyw1LpIdIGjqG','Esbtzxr0Aw5NCW','zM9YD2fYzhmG','C2v0txLdB21Tyq','ihrVihnLzsbHBa','8j+tNsaQv2HHDcDZia','kIdIGjqG','DgL0Bgu','Dg9KyxK','BgLZDa','BIbHzgqGmwGGAa','Bw9KzwW6','yc9MywXSyMfJAW','BIbPBMrLEcK','ignHBJOk','ycb0BYbLEgvJDq','C2v0Dxa6C3vKBW','l3jLAw5KzxGG4Ocu','B3vYC0fNBW','DgvtDhjPBMC','t0zg','BgfUzZPLBG','C2v0Dxa6CgXHDa','pgnVzgu+l2nYBW','vw5RBM93BI4Gvq','ifvjihvUzgvYia','ycdIHPiGiLjLDM9R','AwvZigrPC2fIBa','CYKk','pgi+vhLWztO8lW','Aw4TyM90oIa+','q3jLyxrLig9Uzq','8j+NOcbnzw1VCMLLCW','ihDPBgWGBM93ia','lM1LC3nHz2u','igfNywLUoIbGlW','zxjVDxmHkq','y3jVBG','zMi6Aw5MBZO','8j+tIIaQu2vZC2LVBG','ktOQcGO','ihrVB2XZcG','AxnsDw5UAw5N','DwXLiokaLcb0CNKG','z2uGywz0zxiGCW','CMvTAw5KzxjZlG','B2XZihj1BIa8BG','8j+uHcaQtMv3ihnLCW','BgLZDefSBa','yNLtDgf0Dxm','ihrVAY9KyxKGxW','ycbKzwXLDgvKlG','q2fUy2vSihj1BG','twf4iokaLcbnyxHP','l2nYB24GywrKia','zxmGjIbWAg90BW','zwT1BMrLBIaOEG','Aw1Hz2LUzq','CNqGyxzHAwXHyG','ihvZzsb0AgLZia','8j+mKcaQv2vIierHCW','cI4UlG','DM9Py2vszxbSEq','4OcIidXIpKnYB246','Bwf0y2G','rhvYyxrPB24','DxrMltG','zw1LBwjLCIbZBW','ugX1z2LUCYaO','lMPZ','ief1Dg8TDxbKyq','CMrZ','B21VDxmGquKGyq','DxnLCG','sw52ywXPzcbjra','D2fYBG','zvrLEhq','4OcuifnHDMuGyxmG','CNKGBwfUywDLza','ignVC3qUcG','BIbHzg1PBIbJBW','Ew5J','ihnLDcbNCM9Xla','sLnptIbMB3iGDa','CMv2B2TL','BNvWihj1BMa','igrVzxmGBM90ia','zgLY','C3rHDhm','C28GyMuGC2vUDa','zdWVyJ4kcG','zw4Tvvm','BIbHzgqGiJaGoq','lKiUiga','B3v0Chv0','twvOCMrLDxrPzW','ig1LC3nHz2uGDW','mca4icOGkIaQ','mca4icOGkIa1','AxrOihrOzsbWyq','CMvHzezPBgvtEq','t3bLBLjVDxrLCG','AxzLihDVCMTZCa','mhnGlcbGnw1Gla','yxv0BW','B2fKig1LBw9YEq','igj5igfKzgLUzW','zwr1BgvKigPVyG','cGPczw51DhPLia','yJ4G','CMvWBhK','C2LVBGO','B2TLza','kLbYB3zPzgvYCW','qwn0AxzLicyGDG','BwL0','CxvLDwvK','Dg9VBc1TAxnZAq','Dg9YEuLUzgv4','yM90lNrPBwuUCW','EsWGBw9UDgHSEq','kJOG','CgfYC2u','ihrVz2DSzsdcTYa','zYaOzgvMyxvSDa','CYWGywjLBMrZcG','yxv0B3vWzgf0zq','l2v4Cg9YDcdIGjqG','8j+uKcaQr3jVDxaGtq','BIbHzgqGnw0GCG','ihWG','C3LZDgvTihnLDa','sgvHzgvY','ig1VzgvSCYaMia','Dg90ywXjBNb1Da','zhmSig9YidXJBW','Dgv4Dca','ksOkcG','y2vZCW','Dg9Nz2XLia','C3vJy2vZCW','BhKGDg8GBxKGBq','u2v0ihjLyxnVBG','DwvYEt4G4OcuifnL','DcWGyNvPBgqSia','C2aU','igfWChjVDMvKlG','jsKk','zgvSienVBNrLEa','4OcIipcFPjyGtwfUywDL','BgvUz3rO','AgjVyxjKihLVDq','icdIJ7aGy3jVBJOG','BIboyw1LBIaOEG','rgvSzxrLza','B25Lu2HVDa','ig1PBG','tLzjreLb','4O+WidXIpKnYB24G','CgfZC3DVCMqGAq','zxnZAw9UoIa','CYb2AxnPyMXLia','Dw5SAw1PDgvK','8j+uHcbozxCGC2vZCW','BM90lwzVDw5K','Ahr0CdOVl2XVyW','cGPbDMfPBgfIBa','AxnqCM9JzxnZAq','t3b0Aw9UywWGpa','ihWGtMv4DdOG','uMvSyxrLzfrVCa','B21LDgHPBMC','B25ZlxDPEMfYza','ihj1BNmGWRCG','ChjVDMLKzxiGiG','x1vsta','icdWN5gKihvZzxi6ia','Dg90ywXTzw0','D29YA3nWywnLCW','lY9HCgKUzxHHBq','x1j1BJOGyc90BW','r3jVCq','mca4icOGkIa0','igjSB2nRzwqUia','kKXVywq6kIa','lMzHAwXLze92zq','AxPHCMqGDMvYAq','BgfZDefJDgL2zq','yxrLig9UyaPGlW','v2vLAZOGia','sw5MBYOkcG','yxrJAgvZidXJBW','CMvSB2fKzwqU','sLnptIbMB3iGCa','Aw1WBgLJAxq','pgi+vgLTzw91Da','qxv0BY1bChbYBW','iJOkcG','ig1LC3nHz2vZla','CNqGDgHLigjVDa','zxrgAxHLza','8j+mKcaQqNjVD3nLCG','oIOkygbGcG','kGPF','DMLUzZOG','x0LUigDYB3vWCW','lte8l2nVzgu+ia','qw5ZD2vY','DxrVrw5HyMXLza','kKj5ihn0yxr1CW','ugf1C2vK','zw1HBMq','ig5VDcbSB2fKia','4PQG77Ipie9o','zwzMB3j0oG','Aw5KzxHpzG','uMvZDgfYDcb0Aa','C3vKBZPYzxzVAW','y2vZkIaOywn0Aq','icdIJ7hVUi8GDgLTzw91','C2v0Dxa6D2vI','zgL1Bsb8igHPzW','t1bftLjpvvrfuG','yMfJA1f1zxj5','8j+AGcbtDgfYDgvKia','8j+KLIaQqM90ifbYBW','8j+uJsbvC2u6igaVCG','rxjYB3iGC2vUza','zMXVB3i','4OcIienmstOGigbH','B2XZ','8j+uJcaQ','cGPFvxnLigaVBq','otOWmaRIGkiGpgi+','kLn0yxr1CZOQia','idaG','vM9Py2uGCMvWBa','BMvYyxrPB24GDq','CNvUimk3igLUzM8','DhLWzq','y3mVBwnWlMPZBW','v2HHDcb3B3vSza','uhvSBcbSyxrLCW','C2HLBgW','CgfUzsWGD2fPDa','C2vZC2LVBKLK','zcbPBNn0ywXSia','yxmGysbYzwD1Ba','4P2mie5VigPVyIbT','BxmGFcbfCNjVCG','zxjLlG','zNjVBNrTyxr0zq','qwDLrgf5CW','zw1PBMrLCIbxyq','yM90lMXHBMCUCW','8j+uJsaQuMvZDwX0CW','DgvSzwDYyw0','n1fUr1ruvG','yI1Hz2vUDhm','pGOk','lNnLC3nPB25ozq','CM92AwrLCNmGBa','ufjjtufswv9quG','BgL0EvnLDa','CgvUifDLyIbvsq','q3vYCMvUDcbZDa','zxHWB3j0','BwvVDxqGB2zMya','8j+uPYaQq3vZDg9Tia','Bsb0AguGy2HHDa','u0rlihn1yI10yq','lMnOzwnRAw5N','BYbWzxjZAxn0ia','zw1LBwjLCIa8Da','iokAOo+4JW','pIdIGjqGu2v0ihjL','vxnLCIaI','4P2miejYB3DZzxiG','DMfWAs0UlI5GcG','zgyGpfvstd5Gia','cMaVyxv0B3vWza','AwvZig9Ul29MzG','8j+wPE+4JYaQv2vIifvjkG','ChrPB24P','C3vIx2fNzw50CW','CMvSzwfZzq','igvUDhjPzxmGDa','y2HVB3nLsgvHza','EqOk','zw1PBMqGy2fUyW','Aw5WDxq','mZi3mdGXnLHUEwzbva','ksb8igLUAMvJDa','yxbWCM92zq','cLrVA2vUCZOG','D29YAYbMB3iGCW','zxj5','qwX2Aw4GqM90ia','Aw1Lza','ignOyw5NzsbVCG','CYaO','yw5ZD2vYq2fSBa','Dc5F','D2LSBcbPz25VCG','DxbSB2fKx2rVyW','qsbMB3GP','CgXHDgzVCM1Z','Bgf0zw5JEu1Z','yM90lMXHBMCUyq','zxHLzaO','qvbjigTLExmk','C2vYDMvYpIa8Da','ihnLCNzLCNmGjG','t0XtlM1KycaOCW','B24GzxHWCMvZCW','sM9ICYaO','yM90lNn0yxr1CW','8j+NRsboBYb3B3jRCW','zgu+lZXJB2rLpG','Aw5JBhvKzxm','Dg9mB2nHBgveyq','vgv4Da','uhjVDMLKzxiGDW','Aw1PDfbLCKHVDq','lM9SBgfTyujVDa','Dg9tDhjPBMC','ifDLyIbvssKU','8j+uKcbtDwrVic8Gqq','yZ5Gimk3igaVC3u','Aw1LoJWVyJ4Goa','CMvSB2fK','BNzPzgLH','suq6iga','B3bLBMfP','B3bLBMfPlc4UlG','BM90zsbaDxnLCG','8j+uKsbnyw5Hz2uGqq','DgLTzw91De1Z','C2vUzenOyxrbyW','DMvYC2f0Aw9U','Dg9mB2nHBgvuAq','ig1LigrVy3vTzq','4OcIifDLyLvjoIaG','x21Hy09tigrVzq','ycdIGjqG','C2vZC2LVBG','lMnHBMnLBgXPBG','icdINiuGy29TCgXL','y2HHDc1LEhbVCG','kLrVDgfSoIOG','q29ZDdOGja','8j+wPsaQu3LZDgvTia','CMvTywLUAw5N','ztOk','B20G','pc9IpGO','B3qG4OcuienVBw1H','z2v0sw5MBW','z29Vz2XL','igLUigjYB3DZzq','EsWGBM8GzxHWBW','tM8GC2vYDMvYCW','Bwv0Ag9K','zxiGkguUzY4GlW','l3DVCMTZCgfJzq','AwvZigzVDw5Kia','Dg9VBhm','rM9YBwf0oIa8yW','l2nHBMnLBcdIGjqG','ywKTCxvLCNK','iePVyIaI','ig1Zz3mPcIaGia','D29YA3nWywnLjW','BNrZlM5VBMvsDq','zMLUza','BwvTB3j5cGO','BM5PBMC','zxmkcG','C2u6ic9LzMzVCG','zMLSzxnezwXLDa','CJOkcG','l2jYB3DZzsb0zq','uhjVDMLKzxjZia','BgfUz3vHz2u','CxvLDwu','igvYCM9YkhmP','ywrKiczSDdTZyW','y3rPDMu6icO','kqOGica','y2XLyw51Ca','BNrZlM5VDezVDq','DgfSBgvKlGPGBG','C3vIlwfNzw50ia','8j+uJcaQtg9HzgvKia','zsiGyNv0Dg9UcG','zxf1AxjLzcbHzG','Dgf0zwq6ia','Dg9Rzw5ZtgLTAq','CMvLBNnOB3qGyq','AYbpCMrLCIOkcG','zxvLifn1yMfNzq','C3bHy2uU','ipcFLkCG','zvjLCgX5twfYAW','y2nLC3m','uNvUig1HBNvHBa','BwvVDxq8l2nVza','zM9Yici','igLUic8G','B3rLieb1C2vYBG','zwq6ia','zw1PBMqGmZbTia','BgvKoIa','BguPcG','mtm2r3H4ALns','ig1LBw9YEtOQia','y2f0zwDVCNK','Aw5NigrLChrO','lIbszxn0yxj0ia','8j+mKca','lMnVBMzPCM1Lza','igzVCIaI','DxnLCM5HBwu','zgfPBhLmB2DZ','C2v0DxaGC3vKBW','lNrVB2XdywXS','q0Xfqu5vuf9mtW','zgvWDgG6kGOkqq','icHa','A2DYB3vUzcbZDq','mcaQicOGkIaQ','zwqGzM9Yia','DgvZDa','qwjZDhjHy3ruzq','4PA277Ipia','pc9JB2rLpG','BNvTyMvY','ywXS','kIaQideTnsikcG','cVcFP6aGkK1LBw9YEq','4OcIipcFM6dVUi8GuNvUihrV','CMLLCWO','Bg9Ntwf4u2L6zq','igrLzMf1BhqG4Ocu','rwzMB3j0oIa','kK9toIOG','Dg90ywXeDxjHDa','nuzYq0z1zG','v29YA2LUzYbKAq','z3jVCq','kKnqvxm6kIa','yM90lNn1yMfNzq','8j+NRsaQv29YA3nWyq','lcb3zwvRzgf5CW','tM8GAM9ICYbJBW','BNrZlNjLC3vSDa','C3vKBW','DMu6iga','8j+AQYbhCM91Cca','CgXHDgzVCM0','zc4GuMvZCg9UCW','BMf2ywLSywjSzq','BNmGC3rHDhvZya','zw5KC1DPDgG','l3n1yMfNzw50CW','DdOGica','Chv0vg9Rzw5Z','yw5JzwWGpeLepG','q29UzMLNDxjLza','icHYzxnLDca','igzVCIbHBgWGyW','AM9PBG','Bg93','r2vUzxjHDguGAq','y29TCgfJDgLVBG','BwfW','ycdIGjqGu2v0igrP','q2HHBMDLoGO','zwzMB3j0','ie1c','yM90lNvWzgf0zq','z2vUzxjHDgvK','tLvqx1Dbx01fra','B24G4OcuigHPC3rV','DgvKlG','iokaLcbjj2XSihnL','DcbqCM90B2nVBa','rgvZy3jPyMuGDW','zsbZzxqP','Bw9YEs4','4PQG77IpieLTywDLigDL','BguGvg9VBhm6kG','zgvSzxrLtwvZCW','ieDc','z2vKoIa','q3vYCMvUDcbKAq','u3DPDgnOigfJDa','uhjLDMLVDxmGCW','4O+WicPby3rPDMuG','qwjZDhjHy3rtBW','Aw5KzxHLza','lM1K','C3rHCNrZv2L0Aa','zxmGB24VB2zMcG','8j+rPcbvC2vY','8j+sVIbjBMrLEcbZAq','zwuGyfrpt0XtlG','ihrVihDVCMTZCa','CMvWBgfJzq','ywrKia','Aw5ZigLUiga','BguGDgHLihn3Aq','yxbPs2v5CW','CgfNzs5Wzgy','igLZihj1BM5PBG','q29TCgfJDgLVBG','yNL0zxnszwnSyq','Dg90ywXpDxrWDq','CMvTAw5K','vMvYAwzPy2f0Aq','u3DPDgnOzwq6ia','zxnZzNvScGO','8j+AQYbcBg9JAZOG','BIbMB3iGAgvSCa','4P2mifjLAw5KzxGG','yxbP','Cgf1C2vK','l3DLyNvPiokaLcbp','BM90igzVDw5KlG','AxneAxjLy3rVCG','ChjVBxb0','yM90lMf1Dg91Ca','yM90lNrPBwuUza','zgvWzw5Kzw5JAq','8j+tIIa','zxj2zxi+idX0BW','zwrPDe1LC3nHzW','AgvHCfvZzwq','Dg9KyxLfBNrYAq','ycbUB3qGzM91BG','cGPdyw5JzwW6ia','ugXLyxnLihbYBW','ywX0AdWVy29Kzq','zMf1BhqGD29YAW','zMi6zg93BJO','yxzNrgfPBhLuBW','BNrZlMnHBMnLBa','CY9ZA2LSBhmUAG','yNLtB3vYy2u','vxnHz2u6igaVCW','CNqGBMv3ihnLCW','ihjLCsWG','ig1Lig9YihjLCa','Aw5MAw5PDgu','Aw9Utxm','8j+NUsbsDw5UAw5Nia','B246iokCHsbZDwnJ','vxnLiokSHU+4JY/IRiFVUi8GDg8','C2nVCMu','z2v0qwn0AxzL','kKrHAwX5igXVzW','vvjmoIbGAhr0Ca','DMLZAwjPBgL0Eq','AYWGy29Uy2LZzq','ihrOzsbbssbTBW','ifjLC3rHCNqGDa','Aw4GDgHPCYbVCG','yxjJAa','C2v0CYWGD29YAW','zYbVBIbWB3j0ia','8j+pOcbGFMaGxYG','zc4k','zsWGy2HHBMDLia','BgvKlG','Ahr0Ca','4OcIicO','t1zjrevs','icaGia','yxr1CZWVy29Kzq','AgvKDwXLjMD0oW','phn5C3rLBs1Wyq','sw52ywXPzcbSzq','Dg9Rzw5ZvxnLza','C2nOzwr1Bgu','DMvS','4OcIipcFKRSGvxnLihrL','lIOQicG','Dc5QCW','C291CMnL','BM90igzVDw5KoG','D3jPDgvgAwXLuW','CxvLDwvqB3nPDa','zsbLAwDLBMvUia','yM90lNjLC3rHCG','ic8G','zNjVBq','ig91Da','BMfTzsbuzxH0ya','tM8GCMvZDwX0CW','sM9IignYzwf0zq','AwnZ','C2LUzYKU','A2v5','x0Tfwq','8j+uPYaQt3bZkGO','Dg8Gy29UzMLNDq','rgf0ztOG','BNrZlNzPC2LIAq','BM93','sxPHlI4UyaO','BxvTigvMzM9YDa','l21VzgvSiokaLcbt','qwjZDhjHy3rvuG','yw1WBgvZoIbGmW','C3mQcGO','B25ZkGO','v0HbvfnbufbFrq','kIaO','8j+oRYa8yJ5tA2LSBa','ifrLEhqP','yc9ICM93C2uGpa','sgLUDhnjBMPLyW','Aw5WDxruB2TLBG','Dxb0Aw1L','DfrVA2vUCW','zxH0cG','ywn0AxzL','AxnpD25LCG','4OcIipcFK7eGu2v0ihvW','kKf1Dg8TqxbWCG','CI4Gu2vLigrVyW','ic9PBwfNAw5Lia','B3v0igeGDxnLCG','CMvTAw5Kzxi','icaGica','zxHPDa','u2HVDYbHBgWGyW','ig52AwrPysbUDG','BwvKAxvT','sgLNAcdIGjqGrgvL','AxnZAw9UCYbNCG','kgf1Dg8P','EsbUDMLKAweGBG','CMvZzxq','zgvZy3jPChrPBW','x0fqsv9lrvK','zwqHicG','BxmPcG','iokaLcb3B3jRAw5N','lMPWzW','zgvMyxvSDaOk','8j+uKsaQu2v0iefqsq','zxiGC2STB3iTlG','Dw5RBM93BG','zgu+B2zMpc9JBW','yc0XycbVzgvYia','4OcIiokpScbnyw5Hz2u','BwfUDgLJihnLyq','CMf0Aw9UigzHAq','Bg9Hzgf2zW','CgvUzgLUzW','DhrWigH0DhbZoG','zc4kvxnLigaVDW','8j+uTcbtDwrVigfJyW','iJOIDMfSDwuIFq','iokaLcbUB3qGzM91','lMXLC3nuAgfUtq','DgvK','zw5MB2XNzsb2zq','uMvXoIa','A2LUzYbKAxjLyW','igf1Dg9TyxrPyW','yc9ICM93C2uGCa','CMvZDa','4PQz77IpicPbBhzPBIbc','zxjPzMLLza','ihDLyNbHz2uk','Aw1LB3v0idXZzq','vg9VBhmQcGO','v2HHDhnbCha','DguUxW','Dg90ywXdB3n0','l2aUcG','B3v0Chv0vg9Rzq','D2L0y2GGquKGBq','yxbWBhK','4PYfienSzwfUDxaG','cGPaBwvUDgLVBG','rxHWB3j0ignVBG','z3vYzwqU','C3nHz2uGD2LSBa','zw50CMLLCW','l3zVAwnLiokaLcbw','sNvZDcb3CML0zq','ywXSB3DLza','C3DPDgnOvg8','8j+KLIbbBhzPBIbcBW','lMzHAwXLza','BNrZlM1HEfnLDa','vhLWzsaVAgvSCa','kKz1BgWGrgLZAW','ihrVihrOzsbKzq','Dg9gAxHLza','CMvXDwLYzxnszq','C2vHCMnO','zgvSzxrLihrOzq','u2f2zsbHCYbqra','Ag9ZDg5HBwu','r09pr0Xfx0fqsq','zt4GDMfSDwu6ia','yg9MzMaSigb1BG','BwnW','ihjLBwvTyMvYzq','DcaRihjLyNvPBa','CM1PBMfScG','tNv0EMuG4QYg77Ipl+kSH++4JYa','yM9VDezHAwXLza','yxjHBwv0zxjZlG','8j+uJcaQtunqicHnBW','BwfNzsaOzs5NlG','DcbSB3CGFcbTzq','yxv0B0fWChjVDG','lM9SBgfTyu9Ura','4PYfiff1zxvLignH','BgfZDfr1CM5jBG','4O+Wie5VignYB24G','ntmZn2rSAhPuwa','CNvUia','4P2mifDVCMTZCgfJ','zwqP','y29TCgXLDgvK','D2vIihLVDxiGCW','icHpChvZig9UBa','yM90lM1VzgvSlG','4O+XierLzMf1BhqG','x1rOzxjLihLVDq','DMvYC2LVBG','igfZignVBNrLEa','lMHVBwvmywjLBa','CMu/','cIaGia','DxjLBhKGC3rVCG','ihDPEMfYzgaGka','pIdIGjqGv29YA2LU','zw1VCNKGC2vHCG','AxrLzcKQ','CNvUq291BNq','q29UzMLNDxjLia','y2vZCYOk','B3rZoIa+','DgHLig1VB25G','DMvYAwz5','CM93','ihbVBgLJEsOk','zMfPBenVDw50','tKfcteve','yM91BMrLza','igLUDgvYBMfSBa','C3n3B3jKpMak','iokaLca','4PYfigfSBg93zwq','l21JCcdIGjqGtunq','l2rPCIa8Cgf0Aa','B2rLCMf0zsbYzq','BMLUzYbYzxf1zq','D29YA2LUz0rPCG','lI4U','CY9Syw5NDwfNzq','B2n1BwvUDa','4O+XicPvChrPBwu6','twvZC2fNzxm6ia','DxbKyxrLzej5','zxjZDgfUzcb2BW','y29TBwfUzhm','BwvZC2fNzv9Pza','ihbSyxL3CMLNAa','AwvZzxiGuMvPAa','DgLVBJOGpG','Dg90ywW','B25ZifDPEMfYza','DhjPBq','icdINyWGzxjYB3i6','BwvZC2fNzq','yxHbz2veyxLZ','DgLTztOQia','DMvYC2f0Aw9UcG','8j+pKYbqB25NisaO','BwvTB3j5','s0vo','CgLUzW','zMi6Dxa6','BwvZC2fNzunVDq','t3bLBKfj','4PYfifn3AxrJAgvK','mdaP','t1bftKfjx0fqsq','v0vcx1bpuLq','8j+uHca','zcbWyxnZD29Yza','cGPozxC6igaVCG','zMfSBgjHy2TZ','ihDLzwTKyxLZia','vg9RoIa','zs1PBMrLEgvKiq','pMaGWRCGuMvZzxq','Dw1LBNrZlGOk','zxHPC3rZu3LUyW','qwnJzxnZihjLDG','8j+BOE+4JYbqzxjTAxnZAq','8j+NOcbszwfZB25PBG','BgfUzZPKzq','AwnVBG','8j+mKcaQvgv4DcbMCG','zxnZywDLCY4','lI4VC2vYDMLJzq','4P2mievYCM9YihnH','y2fSBgjHy2TrDq','8j+oQcbF','iYbbBhzPBIbcBW','C2XHy2STC2v0Dq','8j+uJcaQtunqifnLCG','4PYficPtDwrVigfJ','zhm6ia','Ahr0Chm6lY8','BwnWignHBgWGpa','igf1Dg9HChbYBW','ifrPBwvVDxqUia','BqOk','y29UzMLN','C2v0Dxa','wvnGlcbGq0Xfqq','Bwf4','yxLbz28','Ag9TzwrPCG','lcbOB3vYBhKk4OcI','zsborvzfuIb0BW','sw4GDgHLigrHCW','ignYB24GAM9ICW','CYWGyw5KigrVyW','mcaXmcaQicOGma','vvjmpMaG4OcuifnJ','x1rPCdOGu2vUza','zwfZzsbYzxn0yq','lNjLC3rHCNrPBG','C2vYihbYB2zPBa','CYbPBNn0ywXSzq','iokaLcbfEhrYywn0','tM8Gywn0AxzLia','B3zLoIa','lIbkDxn0ihDYAq','x01LBw9YEsbPCW','D2vLAW','CgfJzxmGy29UzG','BMuGqsbMB3GGCW','DgLVBG','8j+NOcaQtwvTB3j5kG','DgvSzwDYyw06','lNnLC3nPB25izq','cUkAOsaQuMf0zsbm','yNjVD3nL','lMfJDgL2zq','EwXVywqMz3q7ia','4PYfie5LDYbVCMrL','kKHLyxa6kIa','AwD1CMvKlGOk','AcKkcG','AgvHCfrVDgfS','lMfSCMvHzhLeBW','y29TBwfUza','B3qQigb2','CYOkcL9dB3vSza','cIaGifj1BNm6ia','B21G','ihbSyxrMB3jTCW','4P2mifvUA25VD24G','AwvZigvUywjSzq','cIaGienVBw1HBG','yc9Zzxr1CcbRzq','CM9TAxvTya','idXJB2rLpG','igzPBgvZcG','tM90ihnLDcb1Ca','B3bLBNmGzwfJAa','q2HHBMDLihDVCG','rgLYzwn0B3j5ia','zxmUxW','lIbvC2u6igaVCG','zgvSzxrLia','Aw5PBMC','Aw5NoIa','CNm6ia','Ag90BW','C3rHDgu','pteMC2TPCf9KAq','pIbPBIbZzwnVBG','ywnLigrLzMf1Ba','ihnLDcbMB3iGkG','ipcFKQqG','ugXLyxnLihrYEq','vxnHz2u6igaVzG','4OIEicH1BMXPBwL0','Dg9mB3DLCKnHCW','ywrLCG','B3jKigLZihnLyW','BIbPDhmGB3DUia','D2vI','CY9OzwfYDgjLyq','CMvZDgfYDcbVCG','C3q6','mI1KAwDPDa','zwfKzxi','rw5HyMXLza','zMLSDgvY','Dw1LBNq','y3rPDMuGAw4GDa','4P2mifnpvuWUBwqG','zMLSzvbHDgG','lL8k','Dc4QcGO','AwXSigjLihnHDG','8j+NQIbwzxjPzNK','B2rHEsWG','ieTLEtOQcGO','y2HHDeLK','zc4GugfZC3DVCG','8j+oRYa8yJ4','x1rOzsbWyxnZDW','C3DPDgnOihjLAG','zgvWDgG','yM90lNrPBwuUBq','C2vYDMvY','zwn0zwqGyNKGCG','C2XPy2u','4PYfie9grG','AgLZDg9YEq','tLzjreLbx0fqsq','jMzVCM1HDd1QCW','C2TPBgXZ','zuDYB3vWCW','cGRIGkzBDhj1BMnH','8j+uPYaQ','zgLZywjSzwq','CY9MywXSyMfJAW','Bw1HBMrZlGOk','yxnZD29YzceQcG','q291BNq','AwnLig1LC3nHzW','8j+oQcaQrxH0CMfZkG','zxr1CceGvgHLia','C2nYzwvUC2HVDa','C3bSAxq','zM9YihvUBgLTAq','AgvSCa','zgu+','l3jLBwvTyMvYia','C3rHDfn5BMm','CYOkcG','DwrVlGO','y3b1CW','yw0IoIj2ywX1zq','8j+uJsboBYbTzw1VCG','qKfhru5uu19eqq','C2v0','mca4ideGkIaQ','DgvYignOyw5Nzq','ihrVDgfSigvUDa','zMfSBgjHy2SYla','8j+NOca','BMfTzq','4PYfifjLBwLUzgvY','DM9Py2u','ChjVDMLKzxi','y3jVBJP0B2DNBa','CMvWBhLxAxrOua','4P2miePVyIbG','pc9IpIaO','idXWCM92AwrLCG','AdOGyc93B3jRCW','Aw4Gy2HHDcbOAq','icHjrdOG','yw1IAwD1B3vZ','twvKAxvTiokaLcbn','8j+NOcaQq2HVB3nLia','yxbPls4UlMakcG','4OcuigXHC3qG','CMvTzw1Izxi','yxbWCM92zwq','BgfZDevYCM9Y','4P2mieLUDMfSAwqG','ig1LzgLHoIa+','rxHHBxbSztOGya','uKW+iokaLcbty3jL','C2uGyc9Zzwn1CG','vg9Rzw5Z','ssbPBIbICM93CW','otqWodmWC0nzrg9t','pc9IpIaImca5ia','B3qGu2v0DxaQcG','zxvLlcbTyxGGmG','CY9WzxjTAxnZAq','BgWGD29YA3nWyq','ywXOB3n0oG','lI5GcGO','cUkaOIbmB2DZihjV','BwfNzqO','kLDVCMTPBMCGra','yxrMB3jTCYbPBG','kKfJy2vZC2LIAq','Dhj1zq','ifjLC2v0ihrVia','twfYA2rVD24','ywnL','ieXutsb8ipcFLi0G','C29MDa','ChrPB25ZlG','y3DK','ieTc','ywXSB3DgB3j3yq','uMv2B2TLoIbGlW','kK5Vzgu6kIa','lw9YzgvYlMPZ','ig1VDMvKigrVDW','x0fqsv8','l2LTywDPBMuGpa','8j+sVIbszw1LBwjLCG','Dg9YEq','BMv3igLUihy','y29UC3rYDwn0BW','C2v0igjVDcbJBW','Bgf5D3jPz2H0ia','CMvZDgfYDa','sw52ywXPzcbKDq','4PYfifn1zg8GD29Y','8j+tNsboB3rLihnHDG','AwX5lcb3zwvRBa','zxH0yaPtyxzLCW','pgi+tMfTztO8lW','8j+uPYbpCgvUifDLyG','BNmGBg9HzgvKlG','zxmGzgvSzxrLza','Dg9mB2nHBgvtDa','DcdIGjqGq29UDMvY','BMXPBwL0zwqPcG','y2fUy2vS','CMLUzW','BMaGkhnLzsbGza','zNjLzw1LBq','4P2mifrVB2WGzxjY'];_0x3df1=function(){return _0xb3442;};return _0x3df1();}import{writeEnvVar}from'../services/env-file.js';import{listJobs,createJob,deleteJob,toggleJob,runJobNow,formatNextRun,humanReadableSchedule}from'../services/cron.js';import{resolveJobByNameOrId}from'../services/cron-resolver.js';import{buildTickerText,buildDoneText,escapeMarkdown}from'./cron-progress.js';import{isHarmlessTelegramError}from'../util/telegram-error-filter.js';import{storePassword,revokePassword,getSudoStatus,verifyPassword}from'../services/sudo.js';import{config}from'../config.js';import{BOT_VERSION}from'../version.js';import{getWebPort}from'../web/server.js';import{getUsageSummary,getAllRateLimits,formatTokens}from'../services/usage-tracker.js';import{runUpdate,getAutoUpdate,setAutoUpdate,startAutoUpdateLoop}from'../services/updater.js';import{markExpectedRestart}from'../services/watchdog.js';import{getReleaseHighlights}from'../services/release-highlights.js';import{runCleanup,getCleanupPolicy}from'../services/disk-cleanup.js';import{getHealthStatus,isFailedOver}from'../services/heartbeat.js';import{t,LOCALE_NAMES,LOCALE_FLAGS}from'../i18n.js';import{requestStop,interruptQuery}from'../services/stop-controller.js';import{killSessionDetachedAgents,cancelPendingForSession}from'../services/async-agent-watcher.js';getAutoUpdate()&&setTimeout(()=>startAutoUpdateLoop(),0x3*0x3ecd+0x2*-0x8d8+-0x3587);function _0x2df7(_0x48aeb5,_0x45ea67){_0x48aeb5=_0x48aeb5-(-0x2504+-0x1b7+0x2734);const _0x3e0e78=_0x3df1();let _0xb2337=_0x3e0e78[_0x48aeb5];if(_0x2df7['bPVaQd']===undefined){var _0x428196=function(_0x4ac529){const _0x482f70='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x23dbca='',_0x5166a3='',_0x32b4a9=_0x23dbca+_0x428196;for(let _0x34f018=0x2*0x5d7+-0x169+-0xa45,_0x4deed2,_0x3ef045,_0x15d33d=-0x1*0xfb5+0x2*0x1102+0x1*-0x124f;_0x3ef045=_0x4ac529['charAt'](_0x15d33d++);~_0x3ef045&&(_0x4deed2=_0x34f018%(-0x79*0x2f+0x238c+0xd51*-0x1)?_0x4deed2*(0xd07+0x2471+-0x348*0xf)+_0x3ef045:_0x3ef045,_0x34f018++%(-0x126b+0x1*-0x482+0x16f1))?_0x23dbca+=_0x32b4a9['charCodeAt'](_0x15d33d+(-0x8cd+0x1daf+-0x14d8))-(-0x12af+-0x705*0x4+-0x1*-0x2ecd)!==-0x6bf+-0x50*-0x22+-0x3e1?String['fromCharCode'](-0x2*-0x3ac+0xa7*0x25+0x2*-0xf3e&_0x4deed2>>(-(-0x26fe+0x76f+-0x1*-0x1f91)*_0x34f018&-0x1*-0x2597+-0x1*-0x611+-0x15d1*0x2)):_0x34f018:0x507+0x1*-0x1fc7+0xd60*0x2){_0x3ef045=_0x482f70['indexOf'](_0x3ef045);}for(let _0x3b3f38=-0x203a+-0x2074+0x40ae,_0x4d7c08=_0x23dbca['length'];_0x3b3f38<_0x4d7c08;_0x3b3f38++){_0x5166a3+='%'+('00'+_0x23dbca['charCodeAt'](_0x3b3f38)['toString'](0x15e0+-0x228b*-0x1+-0x385b))['slice'](-(0x1b8c+-0x1*0x19f3+-0x197));}return decodeURIComponent(_0x5166a3);};_0x2df7['ETSHrm']=_0x428196,_0x2df7['VsEPUc']={},_0x2df7['bPVaQd']=!![];}const _0x299f26=_0x3e0e78[-0x26cc+0x579+0x2153*0x1],_0x22cbad=_0x48aeb5+_0x299f26,_0x3ba0b8=_0x2df7['VsEPUc'][_0x22cbad];if(!_0x3ba0b8){const _0x123e32=function(_0x258907){this['najIZn']=_0x258907,this['smJUhT']=[0x6*0x512+-0x50d*-0x3+-0x2d92,-0x1498+-0x1392+0x282a,-0x9a1+-0x1ec2+0x2863],this['NhSNTB']=function(){return'newState';},this['NTwUKl']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['iqzNIz']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x123e32['prototype']['HSdhNJ']=function(){const _0x237bf1=new RegExp(this['NTwUKl']+this['iqzNIz']),_0x41f062=_0x237bf1['test'](this['NhSNTB']['toString']())?--this['smJUhT'][-0x38+-0x58a+0x5c3]:--this['smJUhT'][0x233*-0xb+0x5*0x596+-0x3bd];return this['vCTDmI'](_0x41f062);},_0x123e32['prototype']['vCTDmI']=function(_0x453f69){if(!Boolean(~_0x453f69))return _0x453f69;return this['FynqFm'](this['najIZn']);},_0x123e32['prototype']['FynqFm']=function(_0x2fc0b1){for(let _0x4c16a9=-0x26a8+0x2537+0x171,_0xfe83a0=this['smJUhT']['length'];_0x4c16a9<_0xfe83a0;_0x4c16a9++){this['smJUhT']['push'](Math['round'](Math['random']())),_0xfe83a0=this['smJUhT']['length'];}return _0x2fc0b1(this['smJUhT'][-0x771+-0x139*-0x10+0x6b*-0x1d]);},new _0x123e32(_0x2df7)['HSdhNJ'](),_0xb2337=_0x2df7['ETSHrm'](_0xb2337),_0x2df7['VsEPUc'][_0x22cbad]=_0xb2337;}else _0xb2337=_0x3ba0b8;return _0xb2337;}const botStartTime=Date[_0x576083(0x383)]();function formatBytes(_0x1318c5){const _0xd9fc61=_0x576083,_0x2c78b0=_0x576083;if(_0x1318c5<0x238c+0x15a2+0x352e*-0x1)return _0x1318c5+'\x20B';if(_0x1318c5<(0xd07+0x2471+-0x794*0x6)*(-0x126b+0x1*-0x482+0x1aed))return(_0x1318c5/(-0x8cd+0x1daf+-0x10e2))[_0xd9fc61(0x3e1)](-0x12af+-0x705*0x4+-0x4*-0xbb1)+_0xd9fc61(0x51b);if(_0x1318c5<(-0x6bf+-0x50*-0x22+0x1f)*(-0x2*-0x3ac+0xa7*0x25+0xf*-0x1d5)*(-0x26fe+0x76f+-0x1*-0x238f))return(_0x1318c5/((-0x1*-0x2597+-0x1*-0x611+-0x34e*0xc)*(0x507+0x1*-0x1fc7+0xa40*0x3)))[_0xd9fc61(0x3e1)](-0x203a+-0x2074+0x40af)+_0xd9fc61(0x302);return(_0x1318c5/((0x15e0+-0x228b*-0x1+-0x346b)*(0x1b8c+-0x1*0x19f3+0x267)*(-0x26cc+0x579+0x2df*0xd)))[_0xd9fc61(0x3e1)](0x6*0x512+-0x50d*-0x3+-0x2d92)+_0x2c78b0(0x310);}function formatWorkingDir(_0x1e281f,_0x3a8f26){const _0x5646f6=_0x576083,_0x5dd550=_0x576083,_0x21337b=_0x3a2d43[_0x5646f6(0x464)]();if(_0x1e281f===_0x21337b)return _0x5dd550(0x35d)+t(_0x5dd550(0x25f)+_0x5dd550(0x405),_0x3a8f26)+')_';if(_0x1e281f[_0x5dd550(0x319)](_0x21337b+'/'))return _0x5646f6(0x57a)+_0x1e281f[_0x5646f6(0x4c7)](_0x21337b[_0x5dd550(0x1b9)])+'`';return'📁\x20`'+_0x1e281f+'`';}function formatContextTokens(_0x264a74){const _0x176b2c=_0x576083,_0xe7e748=_0x576083;if(_0x264a74<-0x1498+-0x1392+0x2c12)return String(_0x264a74);if(_0x264a74<-0x785ab+-0x18072d+0x2ecf18)return Math[_0x176b2c(0x65d)](_0x264a74/(-0x38+-0x58a+0x9aa))+'k';const _0x2a9ea6=_0x264a74/(0x2e13*-0x69+0x3*0x745cc+0xc56a7);return _0x2a9ea6>=-0x26a8+0x2537+0x17b?Math[_0xe7e748(0x65d)](_0x2a9ea6)+'M':_0x2a9ea6[_0x176b2c(0x3e1)](-0x771+-0x139*-0x10+0x11a*-0xb)+'M';}function formatRelativeTime(_0xb58beb,_0x2f9c29){const _0x202ff2=_0x576083,_0xcb3162=_0x576083,_0x2099a9=Math['floor'](_0xb58beb/(-0x147a*-0x1+0x1236+-0x22c8));if(_0x2099a9<0x34*-0x34+0x9c8+0xd2)return t('bot.time.j'+'ustNow',_0x2f9c29);if(_0x2099a9<0x3*0xd3+0x44d+0x3e*-0x1b)return t(_0x202ff2(0x19a)+_0x202ff2(0xa0),_0x2f9c29,{'n':_0x2099a9});const _0x3743b0=Math[_0x202ff2(0x207)](_0x2099a9/(-0x1820+0x1e*-0x47+0x5e*0x59));if(_0x3743b0<0xb*-0x25e+-0x16e7+-0x312d*-0x1)return t(_0xcb3162(0x4c4)+'inutesAgo',_0x2f9c29,{'n':_0x3743b0});const _0x3bab4c=Math[_0x202ff2(0x207)](_0x3743b0/(0x5d*0x3+0x28c+0xd*-0x43));if(_0x3bab4c<0x3*0xb9d+-0x24ee+0x22f)return t(_0x202ff2(0x59f)+_0x202ff2(0x135),_0x2f9c29,{'n':_0x3bab4c});const _0x1c6bd3=Math[_0xcb3162(0x207)](_0x3bab4c/(0x1*0x1e8e+-0x2322*-0x1+-0x4198));return t(_0x1c6bd3===-0x151d*-0x1+-0x14b*-0x1a+-0x1d3*0x1e?_0xcb3162(0x337)+_0x202ff2(0x463):_0x202ff2(0x337)+_0x202ff2(0x61d),_0x2f9c29,{'n':_0x1c6bd3});}const EFFORT_LABELS={'low':_0x576083(0x11d)+_0x20cc6a(0x356)+_0x576083(0x619),'medium':_0x576083(0x4f8)+_0x20cc6a(0x41e)+'asoning\x20de'+'pth','high':_0x20cc6a(0x3a2)+_0x576083(0x111)+_0x20cc6a(0x19f)+')','max':_0x20cc6a(0x158)+_0x20cc6a(0x385)+_0x576083(0x3ff)+'y)'};export function registerCommands(_0x24722c){const _0xa4a5c3=_0x576083,_0x311a27=_0x576083;_0x24722c[_0xa4a5c3(0x487)](_0x311a27(0x438),async _0x142c27=>{const _0x351b96=_0xa4a5c3,_0x212596=_0x311a27,_0x5c302a=Date['now'](),_0xb38553=getRegistry(),_0xdf8fb7=_0xb38553['getActive'](),_0x6c2fb7=_0xdf8fb7[_0x351b96(0x288)](),_0x16115c=Date[_0x212596(0x383)]()-_0x5c302a;await _0x142c27[_0x351b96(0x191)](_0x212596(0x435)+_0x16115c+_0x351b96(0x3aa)+_0x6c2fb7[_0x351b96(0x4eb)]+'\x20'+_0x6c2fb7['status']);}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x4db),async _0x212528=>{const _0x136c78=_0x311a27,_0x52adc2=_0xa4a5c3;await _0x212528[_0x136c78(0x191)]('🤖\x20*Alvin\x20B'+_0x52adc2(0x287)+'nds*\x0a\x0a'+_0x52adc2(0x5ad)+(_0x136c78(0x3d8)+'\x20—\x20I\x27ll\x20re'+_0x52adc2(0x7a))+('I\x20also\x20und'+_0x52adc2(0x427)+_0x52adc2(0x4d5)+_0x52adc2(0x15a)+_0x136c78(0x85))+(_0x52adc2(0x5ac)+_0x136c78(0x9c))+(_0x52adc2(0x386)+_0x52adc2(0x3cf)+_0x52adc2(0x616))+(_0x52adc2(0xc8)+'—\x20Provider'+'\x20order\x0a')+(_0x136c78(0x594)+_0x136c78(0x1b1)+'ing\x20depth\x0a')+(_0x52adc2(0x3d7)+_0x136c78(0xde)+_0x52adc2(0x31a))+(_0x52adc2(0x41d)+_0x136c78(0x40a)+_0x136c78(0x567)+_0x136c78(0x243))+(_0x136c78(0x2e7)+_0x52adc2(0x116))+(_0x136c78(0x28f)+'s\x20—\x20List\x20a'+_0x136c78(0x50b)+'ces\x0a')+('/workspace'+_0x52adc2(0x123)+'Switch\x20act'+_0x136c78(0x189)+_0x136c78(0xbe))+('/workspace'+_0x52adc2(0x2de)+_0x136c78(0x514)+_0x136c78(0x3ad))+(_0x52adc2(0x4d6)+'\x0a')+(_0x136c78(0x522)+'prompt>\x20—\x20'+'Generate\x20i'+_0x136c78(0x50f))+('/remind\x20<t'+_0x136c78(0xfb)+_0x136c78(0x236)+_0x52adc2(0x64b))+(_0x52adc2(0x1a2)+'Export\x20con'+_0x52adc2(0x434)+'\x0a')+(_0x136c78(0x47a)+'\x0a')+(_0x136c78(0x661)+_0x52adc2(0x1b2)+_0x52adc2(0x3b4)+'rch\x0a')+(_0x52adc2(0x4dd)+'<text>\x20—\x20R'+_0x136c78(0x166)+_0x52adc2(0x631))+(_0x52adc2(0x134)+'\x20Re-index\x20'+_0x52adc2(0x29a))+(_0x52adc2(0x1ec)+'*\x0a')+('/browse\x20<U'+_0x136c78(0x502)+'enshot\x0a')+(_0x136c78(0x2a0)+'xt\x20<URL>\x20—'+_0x136c78(0xd5)+_0x136c78(0x394))+(_0x136c78(0xe7)+'f\x20<URL>\x20—\x20'+_0x136c78(0x3e5)+_0x52adc2(0xce))+('🔌\x20*Extensi'+_0x136c78(0x38a))+('/plugins\x20—'+'\x20Loaded\x20pl'+'ugins\x0a')+(_0x136c78(0x41c)+_0x136c78(0x25b)+_0x52adc2(0x14c))+(_0x52adc2(0x101)+_0x136c78(0x46f)+_0x136c78(0x29c))+(_0x52adc2(0x23d)+'\x0a')+(_0x136c78(0x332)+_0x52adc2(0x22b)+_0x136c78(0x28a)+_0x136c78(0x60d))+(_0x136c78(0x14a)+'*\x0a')+(_0x52adc2(0x649)+_0x136c78(0x22c)+'atus\x0a')+('/new\x20—\x20Sta'+_0x136c78(0x349)+_0x136c78(0x192))+(_0x136c78(0x293)+'Cancel\x20run'+_0x52adc2(0x41f)+'st\x0a\x0a')+_0x52adc2(0x37f)+(_0x52adc2(0x88)+_0x52adc2(0x358)+'he\x20bot\x0a')+('/update\x20—\x20'+_0x52adc2(0x215)+_0x136c78(0x3ec)+'d\x20+\x20restar'+'t\x0a')+(_0x136c78(0x57d)+'e\x20on|off\x20—'+_0x136c78(0x169)+'te\x20loop\x20(6'+_0x136c78(0x484))+(_0x52adc2(0x46c)+_0x52adc2(0x278)+_0x52adc2(0x5ed)+_0x136c78(0x598)+_0x136c78(0x654)+'!_\x0a')+(_0x136c78(0x1f0)+':\x20@mention'+_0x52adc2(0x34b)+_0x52adc2(0x1b0)+_0x52adc2(0x65e)),{'parse_mode':'Markdown'});}),_0x24722c[_0x311a27(0x330)][_0xa4a5c3(0x126)+_0xa4a5c3(0x603)]([{'command':_0xa4a5c3(0x4db),'description':_0x311a27(0x39f)+_0xa4a5c3(0x618)},{'command':_0x311a27(0x620),'description':_0x311a27(0x83)+_0x311a27(0x620)},{'command':'effort','description':'Set\x20reason'+_0x311a27(0x2c4)},{'command':_0x311a27(0x4ed),'description':_0x311a27(0x20f)+_0xa4a5c3(0x23c)},{'command':'status','description':_0xa4a5c3(0x22c)+_0x311a27(0x89)},{'command':'version','description':'Show\x20Alvin'+_0xa4a5c3(0x595)+'on'},{'command':_0x311a27(0xa4),'description':_0x311a27(0x5e9)+_0x311a27(0x27c)},{'command':_0xa4a5c3(0x17a),'description':_0x311a27(0x496)+_0x311a27(0x3c1)+_0x311a27(0x524)},{'command':_0xa4a5c3(0x1d5),'description':'List\x20all\x20w'+'orkspaces'},{'command':_0x311a27(0x5fb),'description':_0x311a27(0x313)+_0xa4a5c3(0x189)+_0xa4a5c3(0x516)},{'command':_0x311a27(0x4ac),'description':'Quick\x20web\x20'+_0xa4a5c3(0x3e3)},{'command':'imagine','description':_0xa4a5c3(0x2fc)+_0x311a27(0x3f2)+_0x311a27(0x39a)+_0x311a27(0x254)},{'command':_0xa4a5c3(0x329),'description':'Set\x20remind'+_0x311a27(0x28e)+'remind\x2030m'+_0xa4a5c3(0x38e)},{'command':_0x311a27(0x22d),'description':_0xa4a5c3(0x3d3)+_0x311a27(0x276)},{'command':_0xa4a5c3(0x8f),'description':'Semantic\x20m'+_0xa4a5c3(0x40b)+'ch'},{'command':_0xa4a5c3(0x4fc),'description':'Remember\x20s'+_0x311a27(0x1ce)},{'command':_0x311a27(0x148),'description':'Manage\x20sch'+_0xa4a5c3(0x18e)+'s'},{'command':_0xa4a5c3(0x57c),'description':_0x311a27(0x5eb)+_0x311a27(0x2d0)+_0xa4a5c3(0x225)},{'command':_0x311a27(0xab),'description':'Open\x20Web\x20U'+_0x311a27(0x505)+'er'},{'command':_0x311a27(0x460),'description':_0x311a27(0x40e)+_0xa4a5c3(0x5f7)+_0xa4a5c3(0x48c)},{'command':_0x311a27(0x536),'description':_0x311a27(0x157)+_0x311a27(0x41f)+'st'},{'command':_0x311a27(0x529),'description':_0x311a27(0x1fb)+_0xa4a5c3(0xd0)},{'command':'update','description':_0x311a27(0x215)+_0x311a27(0x1b3)+_0xa4a5c3(0x529)},{'command':_0xa4a5c3(0x1a1),'description':'Auto-updat'+'e\x20on|off|s'+'tatus'}])[_0x311a27(0x53e)](_0x4f2e40=>console[_0xa4a5c3(0x653)]('Failed\x20to\x20'+_0xa4a5c3(0x527)+'mmands:',_0x4f2e40)),_0x24722c[_0xa4a5c3(0x487)]('start',async _0x5ea8dc=>{const _0x33a67a=_0xa4a5c3,_0x5aad45=_0x311a27,_0x4e9ff2=getRegistry(),_0x16cccf=_0x4e9ff2[_0x33a67a(0x352)]()[_0x5aad45(0x288)]();await _0x5ea8dc[_0x33a67a(0x191)]('👋\x20*Hey!\x20I\x27'+'m\x20Alvin\x20Bo'+_0x33a67a(0x4b9)+('Your\x20auton'+_0x5aad45(0x16b)+'ssistant\x20o'+'n\x20Telegram'+_0x5aad45(0x474)+_0x33a67a(0x11f))+('I\x20understa'+'nd\x20text,\x20v'+'oice\x20messa'+'ges,\x20photo'+_0x5aad45(0x469)+_0x33a67a(0x448))+(_0x33a67a(0x55e)+_0x16cccf['name']+'*\x0a')+(_0x33a67a(0x44c)+_0x33a67a(0x5d5))+(_0x5aad45(0x3de)+_0x5aad45(0x2f9)+_0x33a67a(0x5c4)),{'parse_mode':_0x33a67a(0x515)});}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0xab),async _0x2e59e6=>{const _0x27fba9=_0x311a27,_0x4e76b=_0xa4a5c3,_0x21fed7=getWebPort(),_0xcf5fa1='http://loc'+_0x27fba9(0x50c)+_0x21fed7;await _0x2e59e6[_0x4e76b(0x191)](_0x4e76b(0x96)+_0x27fba9(0x325)+_0x27fba9(0x35c)+_0x21fed7+_0x4e76b(0x639)+('Open\x20in\x20yo'+'ur\x20browser'+':\x0a'+_0xcf5fa1),{'parse_mode':_0x4e76b(0x515)});}),_0x24722c[_0x311a27(0x487)](_0x311a27(0xa4),async _0xc40196=>{const _0x2f6e01=_0x311a27,_0x31d411=_0x311a27,_0x301da3=_0xc40196['from']['id'],_0x8aa274=getSession(_0x301da3),_0x300037=!!_0x8aa274[_0x2f6e01(0x218)]||_0x8aa274['history'][_0x2f6e01(0x1b9)]>0x1fd5*0x1+0x1ddb+-0x3db0,_0x44ab14=_0x8aa274[_0x2f6e01(0x43a)+'nt'],_0x4f9108=_0x8aa274[_0x31d411(0x3cc)];if(_0x300037&&_0x44ab14>0x2f*0xc2+-0xb75*0x1+-0x1829){const _0x2045d6=getRegistry();writeSessionSummary({'messageCount':_0x44ab14,'toolUseCount':_0x8aa274['toolUseCou'+'nt'],'costUsd':_0x4f9108,'provider':_0x2045d6[_0x2f6e01(0x5df)+'ey']()});}resetSession(_0x301da3),_0x300037?await _0xc40196[_0x31d411(0x191)](_0x31d411(0x152)+_0x31d411(0x585)+_0x31d411(0x62d)+(_0x2f6e01(0x314)+_0x2f6e01(0x1c3)+_0x44ab14+(_0x31d411(0x1e9)+'\x20$')+_0x4f9108[_0x2f6e01(0x3e1)](0x2661+0x1*-0x751+-0x7c3*0x4)+_0x31d411(0x172))+(_0x31d411(0x547)+_0x31d411(0xeb)+_0x2f6e01(0x5f0)),{'parse_mode':_0x31d411(0x515)}):await _0xc40196['reply'](_0x2f6e01(0x1c6)+'ion\x20starte'+'d.');}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x17a),async _0x52fa96=>{const _0xa1530b=_0xa4a5c3,_0x4f38df=_0xa4a5c3,_0x1d7eac=_0x52fa96['from']['id'],_0x410d53=getSession(_0x1d7eac),_0x4e36bc=_0x52fa96['match']?.[_0xa1530b(0x42f)]();if(!_0x4e36bc){await _0x52fa96[_0xa1530b(0x191)](_0x4f38df(0x312)+_0xa1530b(0x5e4)+_0x410d53[_0xa1530b(0x420)]);return;}const _0x2f1150=_0x4e36bc[_0xa1530b(0x319)]('~')?_0x159c6f[_0xa1530b(0x2fa)](_0x3a2d43[_0xa1530b(0x464)](),_0x4e36bc[_0xa1530b(0x4c7)](0x3*-0x6f2+-0xc5*0x2d+-0x6ef*-0x8)):_0x159c6f['resolve'](_0x4e36bc);if(_0x40611e['existsSync'](_0x2f1150)&&_0x40611e[_0x4f38df(0x4de)](_0x2f1150)[_0xa1530b(0x334)+'y']()){const _0x51c31d=_0x410d53[_0x4f38df(0x420)]!==_0x2f1150;_0x410d53['workingDir']=_0x2f1150,_0x51c31d&&(_0x410d53['sessionId']=null,_0x410d53[_0x4f38df(0x5d8)+_0x4f38df(0x199)]=_0x410d53[_0xa1530b(0x4c9)][_0xa1530b(0x1b9)]-(0x1cf*0x9+-0x206f+0x24f*0x7)),markSessionDirty(_0x1d7eac),await _0x52fa96[_0x4f38df(0x191)](_0xa1530b(0x2e3)+_0x4f38df(0x5e4)+_0x410d53[_0x4f38df(0x420)]);}else await _0x52fa96[_0x4f38df(0x191)](_0x4f38df(0x497)+_0xa1530b(0x370)+'\x20'+_0x2f1150);}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x403),async _0x446727=>{const _0x20d6a8=_0x311a27,_0x21a4eb=_0xa4a5c3;await _0x446727[_0x20d6a8(0x191)]('🤖\x20*Alvin\x20B'+_0x20d6a8(0x488)+BOT_VERSION+'`\x0a'+('Node\x20'+process[_0x20d6a8(0x403)]+_0x20d6a8(0x5b5)+process[_0x20d6a8(0x2ee)]+'/'+process['arch']),{'parse_mode':_0x20d6a8(0x515)});}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x79),async _0x2fbe47=>{const _0x469319=_0xa4a5c3,_0x194de4=_0xa4a5c3,_0x1793f4=_0x2fbe47['from']['id'],_0xfed07c=getSession(_0x1793f4),_0x42aa86=_0xfed07c['language'],_0x7e3267=getRegistry(),_0x41985b=_0x7e3267[_0x469319(0x352)](),_0x429ce3=_0x41985b['getInfo'](),_0x1cab88=Date[_0x194de4(0x383)]()-botStartTime,_0x5b2749=Math[_0x194de4(0x207)](_0x1cab88/(0x2bf125+0x4ddcf1+-0x42df96)),_0x48aa56=Math[_0x194de4(0x207)](_0x1cab88%(0x192164+-0x583c59+-0x760975*-0x1)/(-0x18e7f+-0x19349+-0x1030a*-0x4)),_0x5b2120=_0x41985b['config'][_0x469319(0x212)]==='claude-sdk'||_0x41985b[_0x194de4(0x45f)][_0x469319(0x212)]===_0x194de4(0x81),_0x19873e=_0x5b2120?'_Flat-Rate'+'_':_0x194de4(0x521),_0x1b9f5e=Date[_0x469319(0x383)](),_0x3e1cf0=_0x1b9f5e-_0xfed07c['lastActivi'+'ty'],_0x59ba52=_0x1b9f5e-_0xfed07c[_0x469319(0xae)],_0x139bc6=Math[_0x469319(0x207)](_0x59ba52/(-0x8d68+0x2*-0x1c2b+0x1b01e)),_0x188df8=(0x4f9+0x1*0xdd5+-0x12cc)*(0x21f6+0x19c0+-0x1*0x3b7a)*(-0x569+0x148f+-0xb3e),_0x7eb8c0=_0xfed07c[_0x469319(0x43a)+'nt']===-0xa80+0x191+0x8ef&&!_0xfed07c[_0x469319(0x218)]&&_0xfed07c[_0x194de4(0x4c9)][_0x194de4(0x1b9)]===0x2405+0x7e3+-0x2be8;let _0x3f8f18;const _0x9c7ee1=t(_0x194de4(0x25f)+_0x194de4(0x47c)+_0x194de4(0x4a9),_0x42aa86);if(_0x7eb8c0)_0x3f8f18=_0x9c7ee1+'\x0a'+t(_0x194de4(0x25f)+_0x194de4(0x227)+'w',_0x42aa86);else{const _0x3ed5ee=_0x3e1cf0<_0x188df8,_0x5938da=_0x3ed5ee?t(_0x469319(0x25f)+_0x469319(0x47f),_0x42aa86):t(_0x194de4(0x25f)+_0x194de4(0x558),_0x42aa86),_0x9c9e8e=t(_0xfed07c[_0x194de4(0x43a)+'nt']===-0x204b+-0x20ad+-0x1*-0x40f9?_0x469319(0x25f)+_0x469319(0x145):_0x194de4(0x25f)+'.messages',_0x42aa86),_0xc4fefe=t(_0xfed07c['toolUseCou'+'nt']===-0x2*-0x769+0xb57+-0x1a28?_0x194de4(0x25f)+_0x469319(0x2cc):_0x469319(0x25f)+'.toolCalls',_0x42aa86),_0x11ae5a=_0x5938da+_0x469319(0x41a)+_0xfed07c[_0x194de4(0x43a)+'nt']+'\x20'+_0x9c9e8e+',\x20'+_0xfed07c[_0x194de4(0x92)+'nt']+'\x20'+_0xc4fefe,_0x27e3b9=_0xfed07c[_0x194de4(0x1a9)+_0x194de4(0x504)]+_0xfed07c[_0x194de4(0x328)+_0x194de4(0x393)],_0x510fa2=_0x27e3b9>-0x1c9f*0x1+-0x1*-0x1c4f+0x50?_0x194de4(0x249)+formatTokens(_0xfed07c[_0x194de4(0x1a9)+_0x469319(0x504)])+_0x469319(0x2bb)+formatTokens(_0xfed07c['totalOutpu'+'tTokens'])+_0x194de4(0x377):'',_0x4805ae=_0x41985b['config']['contextWin'+_0x469319(0xe0)];let _0x1ca5a7='';if(_0xfed07c[_0x469319(0x3f7)+_0x469319(0x2f5)]>0xf4f+0xb5b+-0x2*0xd55&&typeof _0x4805ae===_0x469319(0x2d7)&&_0x4805ae>0xd00+-0x7*-0x30d+0x5*-0x6df){const _0x24d259=_0xfed07c[_0x469319(0x3f7)+_0x194de4(0x2f5)],_0x18005c=Math[_0x469319(0x65d)](_0x24d259/_0x4805ae*(0xff8+0x456+-0x13ea*0x1));_0x1ca5a7=_0x194de4(0xed)+formatContextTokens(_0x24d259)+'/'+formatContextTokens(_0x4805ae)+'\x20('+_0x18005c+'%)';}const _0x4a05f7=_0x139bc6>=-0x216e+0x396+0x1dd9?_0x139bc6+_0x469319(0x1bf):t(_0x194de4(0x25f)+_0x194de4(0x3bd)+'in',_0x42aa86),_0x278ea8='\x0a'+t(_0x194de4(0x25f)+'.duration',_0x42aa86)+':\x20'+_0x4a05f7+_0x194de4(0x1a5)+t('bot.status'+_0x469319(0x5ef),_0x42aa86)+':\x20'+formatRelativeTime(_0x3e1cf0,_0x42aa86),_0xe27c48=!_0x5b2120&&_0xfed07c[_0x194de4(0x3cc)]>0xc07+-0xa*0x86+-0x25*0x2f?'\x0aCost:\x20$'+_0xfed07c['totalCost'][_0x469319(0x3e1)](-0x4*0x3ea+0x3a1*0x2+0x6*0x167):'',_0x479f04=[];_0xfed07c[_0x469319(0x2fd)+_0x469319(0x4d4)]>-0x2f*0x3+0xca2+-0xc15*0x1&&_0x479f04[_0x469319(0x666)](_0x469319(0x326)+'s:\x20'+_0xfed07c[_0x469319(0x2fd)+'Count']);_0xfed07c[_0x469319(0xaf)+_0x194de4(0x390)+_0x469319(0x3be)]>0x2*-0x511+0x7e9+0x239&&_0x479f04[_0x469319(0x666)](_0x194de4(0x122)+_0x469319(0x64e)+_0xfed07c['checkpoint'+_0x469319(0x390)+_0x469319(0x3be)]);_0xfed07c[_0x194de4(0x629)+_0x469319(0x4d4)]>0x1*0x953+0x997+-0x12ea&&_0x479f04[_0x469319(0x666)](_0x194de4(0x231)+_0x194de4(0x630)+_0xfed07c[_0x194de4(0x629)+_0x469319(0x4d4)]);const _0x1aba55=_0x479f04[_0x469319(0x1b9)]>0x12fc+-0x1*0x10d7+-0x9*0x3d?'\x0a'+_0x479f04['join'](_0x469319(0x1a5)):'';_0x3f8f18=_0x9c7ee1+'\x0a'+_0x11ae5a+_0x510fa2+_0x1ca5a7+_0x278ea8+_0xe27c48+_0x1aba55;}const _0x564742=getUsageSummary(),_0x24c406=_0x564742[_0x469319(0x12b)][_0x194de4(0x391)+'s']+_0x564742[_0x469319(0x12b)]['outputToke'+'ns'],_0x1c8d93=_0x564742['week'][_0x194de4(0x391)+'s']+_0x564742['week'][_0x194de4(0x3ce)+'ns'],_0xdbc3c4=formatTokens(_0x24c406),_0x18f6ce=formatTokens(_0x1c8d93),_0x2ce0ce=_0x5b2120?'':_0x194de4(0xdd)+_0x564742[_0x194de4(0x12b)]['costUsd'][_0x194de4(0x3e1)](-0x3b8+0x126*-0x3+0x72e)+')',_0x35d231=_0x5b2120?'':_0x469319(0xdd)+_0x564742[_0x469319(0x476)][_0x194de4(0xa9)][_0x194de4(0x3e1)](-0x20e1+0x269c+0xd1*-0x7)+')';let _0x458187='';const _0x28679d=getAllRateLimits();if(_0x28679d['size']>0x506+-0xe63+-0x2f*-0x33){const _0x5a89f8=[];for(const [_0x32d2dd,_0x42d34f]of _0x28679d){const _0x34887c=[];if(_0x42d34f[_0x469319(0x5ee)+_0x194de4(0x5da)]!=null&&_0x42d34f[_0x469319(0x86)+_0x469319(0x196)]){const _0x5e56ab=Math['round'](_0x42d34f[_0x469319(0x5ee)+_0x469319(0x5da)]/_0x42d34f[_0x469319(0x86)+_0x194de4(0x196)]*(-0x1*-0xe6e+0xc2f*-0x3+0x1*0x1683)),_0x9b7df5=_0x42d34f[_0x469319(0x5ee)+_0x469319(0x4e5)]?_0x469319(0x2f8)+(_0x42d34f[_0x194de4(0x5ee)+_0x469319(0x4e5)][_0x194de4(0x31f)](/T.*/,'')[_0x194de4(0x4c7)](0x8*0x220+0x2*0xeb4+-0x7d*0x5f)||_0x42d34f[_0x194de4(0x5ee)+_0x194de4(0x4e5)])+')':'';_0x34887c[_0x469319(0x666)](_0x469319(0x3c0)+_0x42d34f[_0x194de4(0x5ee)+'maining']+'/'+_0x42d34f[_0x469319(0x86)+_0x194de4(0x196)]+'\x20('+_0x5e56ab+'%)'+_0x9b7df5);}if(_0x42d34f['tokensRema'+_0x194de4(0x49b)]!=null&&_0x42d34f[_0x469319(0x2b0)+'t']){const _0x3a23cb=Math[_0x194de4(0x65d)](_0x42d34f[_0x194de4(0xc2)+_0x469319(0x49b)]/_0x42d34f[_0x194de4(0x2b0)+'t']*(-0xa03+-0x1916+0x237d*0x1));_0x34887c[_0x469319(0x666)](_0x469319(0x445)+formatTokens(_0x42d34f[_0x194de4(0xc2)+_0x194de4(0x49b)])+'/'+formatTokens(_0x42d34f[_0x194de4(0x2b0)+'t'])+'\x20('+_0x3a23cb+'%)');}_0x34887c[_0x194de4(0x1b9)]>-0x4*0x5f3+-0x1240*-0x2+-0xcb4&&_0x5a89f8[_0x194de4(0x666)]('\x20\x20'+_0x34887c[_0x469319(0x2fa)](_0x194de4(0x1a5)));}_0x5a89f8[_0x194de4(0x1b9)]>-0x880+0x236+0x64a*0x1&&(_0x458187=_0x469319(0x47d)+_0x194de4(0x593)+_0x5a89f8[_0x194de4(0x2fa)]('\x0a')+'\x0a');}const _0x127208=getMemoryStats(),_0x4e0ba7=getIndexStats(),{getEffectiveInjectMode:_0x4c7ee9,getInjectModeRaw:_0x1ab6a3}=await import('../service'+'s/memory-i'+_0x469319(0x638)+_0x469319(0x168)),_0x47e8a4=_0x4c7ee9(),_0x1b6519=_0x1ab6a3(),_0x33d530=_0x4e0ba7['tier']==='keyword-lo'+'cal'?_0x194de4(0x5a0):'vec',_0x23c387=_0x1b6519===_0x194de4(0x18b)?_0x47e8a4+_0x194de4(0x3a4):_0x47e8a4,_0x3bfdfe=_0x127208[_0x469319(0x2ca)]+'\x20days,\x20'+_0x127208['todayEntri'+'es']+(_0x469319(0x241)+_0x194de4(0x4bc))+formatBytes(_0x127208[_0x469319(0x54b)+'ze'])+_0x194de4(0x517)+_0x4e0ba7[_0x469319(0x3d6)]+'\x20'+_0x33d530+'\x20('+_0x4e0ba7[_0x194de4(0x4ee)]+(_0x194de4(0x247)+':')+_0x23c387,_0x3c672d=getHealthStatus(),_0x48f8c3=isFailedOver(),_0x157b90=_0x7e3267['getActiveK'+'ey']();let _0xae13f9='';if(_0x3c672d['length']>0xb1f+-0x1*0x1657+0xb38){const _0x41ce1c=await Promise[_0x194de4(0x2d8)](_0x3c672d[_0x194de4(0x2fe)](async _0x5edc8a=>{const _0x229b36=_0x469319,_0x2d781b=_0x194de4,_0x36543d=_0x5edc8a[_0x229b36(0x37d)]===_0x157b90,_0x1ce359=_0x36543d?'→':'\x20\x20',_0x2e0277=_0x7e3267[_0x229b36(0x57f)](_0x5edc8a[_0x2d781b(0x37d)]);if(_0x2e0277?.['lifecycle']){const _0x585f1a=await _0x2e0277[_0x229b36(0x10a)][_0x229b36(0x14d)](),_0x3b470f=_0x2e0277[_0x229b36(0x10a)][_0x229b36(0xd1)+'ed']();if(!_0x585f1a)return _0x1ce359+_0x229b36(0x4a4)+_0x5edc8a[_0x2d781b(0x37d)]+'\x20'+t(_0x229b36(0x25f)+_0x229b36(0x3f5)+_0x229b36(0x1f6),_0x42aa86);if(_0x3b470f)return _0x1ce359+_0x2d781b(0x2b5)+_0x5edc8a[_0x2d781b(0x37d)]+'\x20'+t(_0x2d781b(0x25f)+_0x229b36(0x267)+_0x229b36(0x592),_0x42aa86);return _0x1ce359+'\x20✅\x20'+_0x5edc8a[_0x229b36(0x37d)]+'\x20'+t(_0x2d781b(0x25f)+'.ollamaExt'+_0x2d781b(0x5bf),_0x42aa86);}const _0x34e955=_0x5edc8a[_0x2d781b(0xf2)]?'✅':'❌',_0x593115=_0x5edc8a[_0x2d781b(0x256)]>0x13*-0x53+-0xc00+-0x1229*-0x1?'\x20'+_0x5edc8a[_0x2d781b(0x256)]+'ms':'',_0x2e7b74=_0x5edc8a['failCount']>0x15f3*-0x1+-0x1*0x5f+-0xb29*-0x2?'\x20('+_0x5edc8a[_0x2d781b(0x415)]+_0x2d781b(0x54f):'';return _0x1ce359+'\x20'+_0x34e955+'\x20'+_0x5edc8a[_0x229b36(0x37d)]+_0x593115+_0x2e7b74;})),_0x5bc6b9=_0x48f8c3?'\x20'+t(_0x194de4(0x25f)+_0x469319(0x1dc)+'r',_0x42aa86):'';_0xae13f9='\x0a'+t(_0x194de4(0x25f)+'.providerH'+_0x194de4(0xa1),_0x42aa86)+_0x5bc6b9+'\x0a'+_0x41ce1c[_0x194de4(0x2fa)]('\x0a')+'\x0a';}await _0x2fbe47['reply']('🤖\x20*Alvin\x20B'+_0x469319(0x488)+BOT_VERSION+_0x194de4(0x625)+('*Model:*\x20'+_0x429ce3[_0x469319(0x4eb)]+'\x20'+_0x19873e+'\x0a')+('*Effort:*\x20'+EFFORT_LABELS[_0xfed07c[_0x194de4(0x301)]]+'\x0a')+('*Voice:*\x20'+(_0xfed07c['voiceReply']?'on':_0x194de4(0x587))+'\x0a')+(_0x469319(0x510)+'ir:*\x20'+formatWorkingDir(_0xfed07c['workingDir'],_0x42aa86)+'\x0a\x0a')+(_0x3f8f18+'\x0a')+('\x0a📈\x20*Usage*'+'\x0a')+('Today:\x20'+_0x564742[_0x194de4(0x12b)][_0x194de4(0xef)]+_0x469319(0x34a)+_0xdbc3c4+'\x20tokens'+_0x2ce0ce+'\x0a')+(_0x469319(0x1e0)+_0x564742[_0x194de4(0x476)][_0x194de4(0xef)]+_0x469319(0x34a)+_0x18f6ce+_0x469319(0x581)+_0x35d231+'\x0a')+(_0x564742['daysTracke'+'d']>-0x19ab*0x1+0x13ab+-0x1*-0x601?_0x469319(0x5fc)+formatTokens(_0x564742[_0x194de4(0x344)+'kens'])+(_0x194de4(0x155)+'(7d\x20rollin'+'g)_\x0a'):'')+_0x458187+_0xae13f9+(_0x194de4(0x2da)+':*\x20'+_0x3bfdfe+'\x0a')+(_0x194de4(0x424)+'*\x20'+_0x5b2749+'h\x20'+_0x48aa56+'m'),{'parse_mode':'Markdown'});}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x4ed),async _0xd2835c=>{const _0x3c33e4=_0xa4a5c3,_0x38233c=_0x311a27,_0x22e112=_0xd2835c[_0x3c33e4(0x376)]['id'],_0x17bd15=getSession(_0x22e112);_0x17bd15[_0x3c33e4(0x161)]=!_0x17bd15[_0x3c33e4(0x161)],markSessionDirty(_0x22e112),await _0xd2835c[_0x38233c(0x191)](_0x17bd15[_0x38233c(0x161)]?_0x3c33e4(0x20f)+_0x38233c(0x48e)+_0x3c33e4(0x2ef)+'es\x20will\x20al'+_0x3c33e4(0x17c)+_0x38233c(0x609)+'messages.':_0x3c33e4(0x20f)+_0x38233c(0x13e)+_0x3c33e4(0xb2)+_0x3c33e4(0x55c)+'ses.');}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x301),async _0x42ef5e=>{const _0x10ef8c=_0x311a27,_0x1c633b=_0xa4a5c3,_0x2e7caf=_0x42ef5e[_0x10ef8c(0x376)]['id'],_0x2a2135=getSession(_0x2e7caf),_0x31caa4=_0x42ef5e['match']?.[_0x1c633b(0x42f)]()[_0x10ef8c(0x4a8)+'e']();if(!_0x31caa4){const _0x4edd81=new InlineKeyboard();for(const [_0x55f38b,_0x482736]of Object[_0x10ef8c(0x3d6)](EFFORT_LABELS)){const _0x41f183=_0x55f38b===_0x2a2135[_0x10ef8c(0x301)]?'✅\x20':'';_0x4edd81[_0x10ef8c(0x11b)](''+_0x41f183+_0x482736,'effort:'+_0x55f38b)['row']();}await _0x42ef5e[_0x1c633b(0x191)](_0x10ef8c(0x4f9)+_0x1c633b(0x590)+_0x10ef8c(0x2ce)+_0x1c633b(0x2a6)+EFFORT_LABELS[_0x2a2135[_0x10ef8c(0x301)]]+'*',{'parse_mode':_0x10ef8c(0x515),'reply_markup':_0x4edd81});return;}if(![_0x10ef8c(0x2fb),_0x1c633b(0x3a1),'high',_0x1c633b(0x462)][_0x1c633b(0x262)](_0x31caa4)){await _0x42ef5e[_0x10ef8c(0x191)]('Invalid.\x20U'+_0x10ef8c(0x29d)+_0x10ef8c(0x3f3)+_0x10ef8c(0x200)+_0x10ef8c(0x5e8));return;}_0x2a2135[_0x10ef8c(0x301)]=_0x31caa4,markSessionDirty(_0x2e7caf),await _0x42ef5e[_0x10ef8c(0x191)]('✅\x20Effort:\x20'+EFFORT_LABELS[_0x2a2135['effort']]);}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x1d5),async _0xacb389=>{const _0x5ec26a=_0xa4a5c3,_0x313e6f=_0xa4a5c3,_0x35030e=_0xacb389[_0x5ec26a(0x376)]['id'],_0x140b43=getTelegramWorkspace(_0x35030e)??_0x5ec26a(0x657),_0x1b80ca=listWorkspaces();if(_0x1b80ca[_0x5ec26a(0x1b9)]===-0xd78+0x8f4+0x484){await _0xacb389[_0x5ec26a(0x191)](_0x313e6f(0x260)+_0x313e6f(0x477)+_0x313e6f(0x483)+(_0x313e6f(0x142)+_0x313e6f(0x18d)+_0x5ec26a(0x576)+_0x5ec26a(0xcb)+'-bot/works'+'paces/<nam'+'e>.md`\x20')+(_0x313e6f(0x62e)+_0x313e6f(0x21e)+_0x313e6f(0x399)+'s/install/'+_0x5ec26a(0x456)+'p.md\x20for\x20t'+_0x5ec26a(0x563)),{'parse_mode':_0x5ec26a(0x515)});return;}const _0x7a292d=[_0x5ec26a(0x2e7)+_0x5ec26a(0x1fd)+_0x313e6f(0x2ec)+_0x140b43+'`)',''];for(const _0x1489b0 of _0x1b80ca){const _0x4285f6=_0x1489b0['name']===_0x140b43?'✅':_0x1489b0[_0x313e6f(0x540)]??'▪️',_0x5d4972=_0x1489b0['purpose']||'(no\x20purpos'+'e)';_0x7a292d[_0x5ec26a(0x666)](_0x4285f6+'\x20`'+_0x1489b0['name']+_0x5ec26a(0x27b)+_0x5d4972);}_0x7a292d[_0x5ec26a(0x666)](''),_0x7a292d[_0x313e6f(0x666)]('Switch\x20wit'+_0x5ec26a(0x4f4)+'pace\x20<name'+_0x5ec26a(0x447)+':\x20`/worksp'+_0x313e6f(0x4a2)+'t`'),await _0xacb389[_0x5ec26a(0x191)](_0x7a292d[_0x5ec26a(0x2fa)]('\x0a'),{'parse_mode':'Markdown'});}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x5fb),async _0x826e74=>{const _0x57ea53=_0x311a27,_0x965d50=_0xa4a5c3,_0x41dedb=_0x826e74[_0x57ea53(0x376)]['id'],_0xaff2e8=_0x826e74['match']?.[_0x57ea53(0x42f)]();if(!_0xaff2e8){const _0xbe7988=getTelegramWorkspace(_0x41dedb)??_0x57ea53(0x657),_0x3f78f8=_0xbe7988===_0x965d50(0x657)?null:getWorkspace(_0xbe7988),_0x5722ea=_0x3f78f8?.[_0x965d50(0xdb)]||'global\x20def'+'ault\x20—\x20no\x20'+_0x965d50(0x586)+'lobal\x20cwd';await _0x826e74['reply']('🧭\x20Active\x20w'+_0x965d50(0x5f5)+'*'+_0xbe7988+'*\x0a_'+_0x5722ea+(_0x965d50(0x5b7)+_0x965d50(0x53f)+_0x57ea53(0x127)+_0x57ea53(0x8b)+'e.'),{'parse_mode':_0x965d50(0x515)});return;}if(_0xaff2e8==='default'||_0xaff2e8===_0x965d50(0x3a6)){setTelegramWorkspace(_0x41dedb,null),await _0x826e74[_0x57ea53(0x191)](_0x965d50(0x43c)+_0x57ea53(0x3e0)+_0x965d50(0x342)+_0x57ea53(0x2b4));return;}const _0x495798=getWorkspace(_0xaff2e8);if(!_0x495798){await _0x826e74[_0x57ea53(0x191)](_0x965d50(0x3fb)+_0x57ea53(0x645)+_0xaff2e8+(_0x57ea53(0x33e)+_0x57ea53(0x3b9)+'orkspaces`'+_0x57ea53(0x669)+'vailable\x20o'+_0x57ea53(0x651)),{'parse_mode':'Markdown'});return;}setTelegramWorkspace(_0x41dedb,_0xaff2e8),await _0x826e74[_0x965d50(0x191)]('✅\x20Switched'+_0x965d50(0x31e)+_0x965d50(0xc0)+(_0x495798[_0x57ea53(0x540)]??'🧭')+'\x20'+_0x495798['name']+_0x965d50(0x1ee)+(_0x495798[_0x57ea53(0xdb)]||_0x965d50(0x634)+_0x965d50(0x30b))+(_0x57ea53(0x118)+_0x965d50(0x3d5)+_0x965d50(0x15e)+_0x965d50(0x297)+'s\x20persona\x20'+'and\x20cwd\x20(`')+_0x495798[_0x57ea53(0x51a)]+_0x57ea53(0x105),{'parse_mode':_0x57ea53(0x515)});}),_0x24722c['callbackQu'+_0xa4a5c3(0x24b)](/^effort:(.+)$/,async _0x5e72d3=>{const _0x2cf7b0=_0xa4a5c3,_0x147e19=_0xa4a5c3,_0x29544d=_0x5e72d3[_0x2cf7b0(0x163)][0x1088+0x1cb2+-0x2d39];if(![_0x147e19(0x2fb),_0x147e19(0x3a1),'high',_0x2cf7b0(0x462)]['includes'](_0x29544d)){await _0x5e72d3['answerCall'+_0x2cf7b0(0x202)](_0x147e19(0x368)+_0x147e19(0x36b));return;}const _0x2f2792=_0x5e72d3[_0x147e19(0x376)]['id'],_0x5caa29=getSession(_0x2f2792);_0x5caa29[_0x147e19(0x301)]=_0x29544d,markSessionDirty(_0x2f2792);const _0x2bc708=new InlineKeyboard();for(const [_0x153dc2,_0x1443b4]of Object['entries'](EFFORT_LABELS)){const _0x4211a6=_0x153dc2===_0x5caa29[_0x147e19(0x301)]?'✅\x20':'';_0x2bc708['text'](''+_0x4211a6+_0x1443b4,_0x2cf7b0(0x1f9)+_0x153dc2)['row']();}await _0x5e72d3['editMessag'+'eText'](_0x2cf7b0(0x4f9)+_0x2cf7b0(0x590)+_0x147e19(0x2ce)+_0x2cf7b0(0x2a6)+EFFORT_LABELS[_0x5caa29[_0x147e19(0x301)]]+'*',{'parse_mode':_0x147e19(0x515),'reply_markup':_0x2bc708}),await _0x5e72d3[_0x147e19(0x250)+_0x147e19(0x202)](_0x147e19(0x2df)+EFFORT_LABELS[_0x5caa29['effort']]);});async function _0x3f0df2(_0x248153,_0x264b66){const _0x1d9a6b=_0xa4a5c3,_0x289251=_0xa4a5c3,_0xf5d958=getRegistry(),_0x410afe=_0xf5d958[_0x1d9a6b(0x5df)+'ey']();if(_0x410afe===_0x248153)return{'ok':!![]};const _0x51e96e=_0xf5d958['get'](_0x248153);if(!_0x51e96e)return{'ok':![],'error':_0x289251(0x1d1)+_0x248153+(_0x1d9a6b(0xf7)+'d')};const _0x7c7dcc=_0xf5d958['get'](_0x410afe);if(_0x51e96e[_0x1d9a6b(0x10a)]){const _0x5c95ad=await _0x51e96e[_0x289251(0x10a)]['ensureRunn'+'ing']();if(!_0x5c95ad)return{'ok':![],'error':t(_0x289251(0x400)+_0x289251(0x3ef),_0x264b66,{'key':_0x248153})};}if(!_0xf5d958[_0x289251(0x3da)](_0x248153))return{'ok':![],'error':_0x1d9a6b(0x4c2)+_0x289251(0x4c6)+'egistry'};try{writeEnvVar(_0x289251(0x229)+_0x1d9a6b(0x363),_0x248153);}catch(_0xd49217){console[_0x1d9a6b(0x16e)]('⚠️\x20Failed\x20t'+_0x1d9a6b(0x233)+'PRIMARY_PR'+_0x289251(0xb1),_0xd49217);}return _0x7c7dcc?.[_0x289251(0x10a)]&&await _0x7c7dcc[_0x1d9a6b(0x10a)]['ensureStop'+_0x1d9a6b(0x63c)](),{'ok':!![]};}_0x24722c['command'](_0x311a27(0x620),async _0x47ef39=>{const _0x3f8f0c=_0x311a27,_0xf44365=_0xa4a5c3,_0x1a84f7=getSession(_0x47ef39[_0x3f8f0c(0x376)]['id'])[_0xf44365(0x2a2)],_0x315536=_0x47ef39['match']?.[_0x3f8f0c(0x42f)]()[_0x3f8f0c(0x4a8)+'e'](),_0x3d00b7=getRegistry();if(!_0x315536){const _0x358b33=await _0x3d00b7['listAll'](),_0x53e34d=new InlineKeyboard();for(const _0x54abf5 of _0x358b33){const _0x2f1f9c=_0x54abf5[_0x3f8f0c(0x395)]?'✅\x20'+_0x54abf5[_0x3f8f0c(0x4eb)]:_0x54abf5[_0x3f8f0c(0x4eb)];_0x53e34d['text'](_0x2f1f9c,_0x3f8f0c(0x12e)+_0x54abf5[_0x3f8f0c(0x37d)])[_0xf44365(0x413)]();}await _0x47ef39[_0x3f8f0c(0x191)](t(_0x3f8f0c(0x400)+_0xf44365(0x242)+'er',_0x1a84f7)+'\x0a\x0a'+t(_0xf44365(0x400)+_0xf44365(0x395),_0x1a84f7)+'\x20*'+_0x3d00b7[_0xf44365(0x352)]()[_0x3f8f0c(0x288)]()[_0x3f8f0c(0x4eb)]+'*',{'parse_mode':'Markdown','reply_markup':_0x53e34d});return;}const _0x415271=await _0x3f0df2(_0x315536,_0x1a84f7);if(_0x415271['ok']){const _0xef050=_0x3d00b7['get'](_0x315536)['getInfo']();await _0x47ef39['reply'](t(_0x3f8f0c(0x400)+'switched',_0x1a84f7)+'\x20'+_0xef050[_0xf44365(0x4eb)]+'\x20('+_0xef050[_0x3f8f0c(0x620)]+')');}else await _0x47ef39[_0x3f8f0c(0x191)](t(_0x3f8f0c(0x400)+_0xf44365(0xb9)+'ed',_0x1a84f7)+'\x20'+(_0x415271['error']||'\x22'+_0x315536+'\x22')+'\x0a'+t('bot.model.'+'notFoundHi'+'nt',_0x1a84f7));}),_0x24722c[_0xa4a5c3(0x453)+'ery'](/^model:(.+)$/,async _0x218004=>{const _0x6659d3=_0x311a27,_0x4b2bed=_0xa4a5c3,_0x2908a9=_0x218004['match'][-0x7*-0x45f+0x7*-0x2c5+0x97*-0x13],_0x16c793=getRegistry(),_0x466423=getSession(_0x218004[_0x6659d3(0x376)]['id'])[_0x4b2bed(0x2a2)],_0x3b0f9a=await _0x3f0df2(_0x2908a9,_0x466423);if(_0x3b0f9a['ok']){const _0x3fcd6e=_0x16c793[_0x6659d3(0x57f)](_0x2908a9),_0x16c6c7=_0x3fcd6e[_0x6659d3(0x288)](),_0x3001dc=await _0x16c793[_0x4b2bed(0x153)](),_0x5980b8=new InlineKeyboard();for(const _0x3a29f9 of _0x3001dc){const _0x47ba6a=_0x3a29f9['active']?'✅\x20'+_0x3a29f9[_0x4b2bed(0x4eb)]:_0x3a29f9['name'];_0x5980b8[_0x4b2bed(0x11b)](_0x47ba6a,_0x4b2bed(0x12e)+_0x3a29f9['key'])['row']();}await _0x218004[_0x6659d3(0x33b)+_0x4b2bed(0x16f)]('🤖\x20*Choose\x20'+_0x4b2bed(0x606)+_0x6659d3(0x2a6)+_0x16c6c7[_0x6659d3(0x4eb)]+'*',{'parse_mode':_0x4b2bed(0x515),'reply_markup':_0x5980b8}),await _0x218004[_0x4b2bed(0x250)+_0x6659d3(0x202)](_0x6659d3(0x32b)+_0x16c6c7['name']);}else await _0x218004[_0x4b2bed(0x250)+_0x4b2bed(0x202)](_0x4b2bed(0x104)+_0x6659d3(0x2bf)+(_0x3b0f9a[_0x6659d3(0x653)]||_0x4b2bed(0x3b0)));}),_0x24722c['command'](_0xa4a5c3(0x5f1),async _0x5a2dd3=>{const _0x386799=_0x311a27,_0x131c21=_0x311a27,{getFallbackOrder:_0x2d5af5,setFallbackOrder:_0x53241a,formatOrder:_0x1f5e1c}=await import(_0x386799(0x451)+_0x131c21(0x4d1)+_0x131c21(0x51f)),{getHealthStatus:_0x5d43a8}=await import(_0x131c21(0x451)+_0x131c21(0x4ad)+'t.js'),_0x203341=getRegistry(),_0xb7ff0a=_0x5a2dd3[_0x131c21(0x163)]?.['trim']();if(!_0xb7ff0a){const _0x13813a=_0x2d5af5(),_0x1b8f93=_0x5d43a8(),_0x12f5f7=new Map(_0x1b8f93[_0x386799(0x2fe)](_0x33b1f2=>[_0x33b1f2['key'],_0x33b1f2])),_0x26576c=[_0x13813a[_0x131c21(0x10b)],..._0x13813a[_0x386799(0x443)]],_0x28a951=new InlineKeyboard();for(let _0x2c401a=-0x1d*0x152+0x61f*0x6+-0x32*-0x8;_0x2c401a<_0x26576c[_0x386799(0x1b9)];_0x2c401a++){const _0x245162=_0x26576c[_0x2c401a],_0x3ef583=_0x12f5f7['get'](_0x245162),_0x489527=_0x3ef583?_0x3ef583[_0x131c21(0xf2)]?'✅':'❌':'❓',_0xd60d03=_0x2c401a===0x2419*-0x1+-0x35*-0x1+0x23e4?_0x386799(0x5b0)+_0x245162+'\x20'+_0x489527:_0x2c401a+(-0x25*0x14+-0x1cba+0x1f9f)+'.\x20'+_0x245162+'\x20'+_0x489527;if(_0x2c401a>0x6a0+-0x24ae+0x1e0e)_0x28a951[_0x386799(0x11b)]('⬆️',_0x386799(0x439)+_0x245162);_0x28a951[_0x386799(0x11b)](_0xd60d03,_0x131c21(0x149)+_0x245162);if(_0x2c401a<_0x26576c[_0x131c21(0x1b9)]-(0x18d5+0x57*0x3+-0x19d9*0x1))_0x28a951[_0x131c21(0x11b)]('⬇️','fb:down:'+_0x245162);_0x28a951['row']();}const _0x502cae='🔄\x20*Fallbac'+_0x386799(0x2b2)+(_0x386799(0x2a1)+'are\x20tried\x20'+_0x131c21(0x359)+'der.\x0a')+(_0x386799(0x350)+_0x386799(0x62c)+'\x0a')+(_0x386799(0xf1)+_0x386799(0x311)+_0x13813a[_0x386799(0x426)]+'\x20('+new Date(_0x13813a[_0x386799(0x5e5)])['toLocaleSt'+_0x386799(0x537)](_0x131c21(0x17e))+')_');await _0x5a2dd3[_0x386799(0x191)](_0x502cae,{'parse_mode':_0x386799(0x515),'reply_markup':_0x28a951});return;}if(_0xb7ff0a[_0x386799(0x319)](_0x131c21(0x5fd))){const _0x270762=_0xb7ff0a[_0x386799(0x4c7)](-0x2b3+0x1ca2+0x1*-0x19eb)[_0x131c21(0x4d9)](',')[_0x386799(0x2fe)](_0x168dee=>_0x168dee[_0x131c21(0x42f)]())[_0x131c21(0x4b3)](Boolean);if(_0x270762[_0x131c21(0x1b9)]<0x3*0xad+0x1838*0x1+-0x1a3e){await _0x5a2dd3[_0x131c21(0x191)](_0x131c21(0x4a6)+_0x386799(0x114)+_0x386799(0x572)+'fallback1,'+_0x386799(0x4e9)+'...`',{'parse_mode':_0x131c21(0x515)});return;}const [_0x660794,..._0xf0bd28]=_0x270762;_0x53241a(_0x660794,_0xf0bd28,_0x386799(0x223)),await _0x5a2dd3[_0x131c21(0x191)](_0x386799(0x481)+_0x386799(0x29f)+_0x1f5e1c());return;}await _0x5a2dd3[_0x386799(0x191)](_0x131c21(0x5a6)+_0x386799(0x2b2)+(_0x131c21(0x12f)+'`\x20—\x20Show\x20&'+_0x386799(0x24e)+_0x131c21(0x54c))+(_0x131c21(0x12f)+_0x131c21(0x175)+_0x131c21(0x271)+_0x131c21(0x2ff)+'rectly'),{'parse_mode':'Markdown'});}),_0x24722c[_0xa4a5c3(0x453)+'ery'](/^fb:up:(.+)$/,async _0x16e299=>{const _0x3d1da1=_0x311a27,_0x3d8ee2=_0x311a27,{moveUp:_0xc7180a,formatOrder:_0xa3bc5d,getFallbackOrder:_0x60b229}=await import('../service'+'s/fallback'+_0x3d1da1(0x51f)),{getHealthStatus:_0x57675b}=await import('../service'+_0x3d1da1(0x4ad)+_0x3d1da1(0x36e)),_0x4abe8a=_0x16e299['match'][0x1a6b+-0xd9b+-0xccf*0x1];_0xc7180a(_0x4abe8a,_0x3d1da1(0x223));const _0x357878=_0x60b229(),_0x1b669a=_0x57675b(),_0x5d758c=new Map(_0x1b669a['map'](_0x13410e=>[_0x13410e['key'],_0x13410e])),_0x28cb0f=[_0x357878[_0x3d1da1(0x10b)],..._0x357878['fallbacks']],_0x1d0bbe=new InlineKeyboard();for(let _0x15b214=-0x74b*0x1+0x4da+0x271;_0x15b214<_0x28cb0f[_0x3d8ee2(0x1b9)];_0x15b214++){const _0x18a6c3=_0x28cb0f[_0x15b214],_0x24217f=_0x5d758c[_0x3d1da1(0x57f)](_0x18a6c3),_0x26d1ab=_0x24217f?_0x24217f[_0x3d1da1(0xf2)]?'✅':'❌':'❓',_0x2b3cec=_0x15b214===-0x1849*-0x1+-0x2f*-0x5+-0x1934?_0x3d8ee2(0x5b0)+_0x18a6c3+'\x20'+_0x26d1ab:_0x15b214+(-0x1*-0xd49+-0x11*-0x8e+-0x16b6)+'.\x20'+_0x18a6c3+'\x20'+_0x26d1ab;if(_0x15b214>-0x16d7+-0xc5*-0x1+0xe2*0x19)_0x1d0bbe['text']('⬆️',_0x3d1da1(0x439)+_0x18a6c3);_0x1d0bbe['text'](_0x2b3cec,_0x3d1da1(0x149)+_0x18a6c3);if(_0x15b214<_0x28cb0f[_0x3d8ee2(0x1b9)]-(0x6c7*0x3+-0xbd4*0x1+-0x880))_0x1d0bbe[_0x3d8ee2(0x11b)]('⬇️',_0x3d8ee2(0x343)+_0x18a6c3);_0x1d0bbe['row']();}await _0x16e299[_0x3d1da1(0x33b)+'eText'](_0x3d1da1(0x5a6)+_0x3d8ee2(0x2b2)+(_0x3d1da1(0x265)+_0x3d8ee2(0x56a)+_0x3d8ee2(0x42b)+'enfolge\x20ve'+_0x3d1da1(0x5a8))+(_0x3d1da1(0x3ee)+_0x3d8ee2(0x582)+_0x3d1da1(0x555))+(_0x3d8ee2(0xf1)+_0x3d8ee2(0xc7)+_0x3d1da1(0x53d)+new Date()[_0x3d1da1(0x533)+_0x3d1da1(0x537)](_0x3d8ee2(0x17e))+')_'),{'parse_mode':_0x3d1da1(0x515),'reply_markup':_0x1d0bbe}),await _0x16e299[_0x3d8ee2(0x250)+_0x3d1da1(0x202)](_0x4abe8a+'\x20moved\x20up');}),_0x24722c[_0xa4a5c3(0x453)+_0x311a27(0x24b)](/^fb:down:(.+)$/,async _0x5326ca=>{const _0xcbcd27=_0xa4a5c3,_0x16f28a=_0xa4a5c3,{moveDown:_0x3f01c9,getFallbackOrder:_0x156094}=await import('../service'+'s/fallback'+'-order.js'),{getHealthStatus:_0x4e09d2}=await import('../service'+'s/heartbea'+_0xcbcd27(0x36e)),_0x4dea0e=_0x5326ca[_0xcbcd27(0x163)][0x1490+-0x19*-0xfb+-0x2d12];_0x3f01c9(_0x4dea0e,_0x16f28a(0x223));const _0x2dd5c4=_0x156094(),_0x2acb06=_0x4e09d2(),_0x2fd47c=new Map(_0x2acb06[_0x16f28a(0x2fe)](_0x33645b=>[_0x33645b['key'],_0x33645b])),_0x5ca89a=[_0x2dd5c4['primary'],..._0x2dd5c4[_0xcbcd27(0x443)]],_0x45c5a0=new InlineKeyboard();for(let _0x388ced=-0x2358+0x239d+-0x45;_0x388ced<_0x5ca89a['length'];_0x388ced++){const _0x570031=_0x5ca89a[_0x388ced],_0x35192b=_0x2fd47c[_0x16f28a(0x57f)](_0x570031),_0x520305=_0x35192b?_0x35192b[_0x16f28a(0xf2)]?'✅':'❌':'❓',_0x55810a=_0x388ced===0x4*-0x8d7+0x23fe+0x51*-0x2?_0xcbcd27(0x5b0)+_0x570031+'\x20'+_0x520305:_0x388ced+(0xf99+0x1e90+0x1*-0x2e28)+'.\x20'+_0x570031+'\x20'+_0x520305;if(_0x388ced>0x1ee8+-0x7cd+-0x41*0x5b)_0x45c5a0[_0xcbcd27(0x11b)]('⬆️',_0xcbcd27(0x439)+_0x570031);_0x45c5a0[_0x16f28a(0x11b)](_0x55810a,'fb:info:'+_0x570031);if(_0x388ced<_0x5ca89a[_0xcbcd27(0x1b9)]-(0x1*0x7dc+0xab6+-0x1*0x1291))_0x45c5a0[_0x16f28a(0x11b)]('⬇️',_0x16f28a(0x343)+_0x570031);_0x45c5a0[_0xcbcd27(0x413)]();}await _0x5326ca[_0x16f28a(0x33b)+_0x16f28a(0x16f)]('🔄\x20*Fallbac'+_0xcbcd27(0x2b2)+('Provider\x20w'+_0x16f28a(0x56a)+'ieser\x20Reih'+_0x16f28a(0x3bf)+'rsucht.\x0a')+(_0x16f28a(0x3ee)+'zum\x20Umsort'+_0x16f28a(0x555))+(_0x16f28a(0xf1)+_0xcbcd27(0xc7)+_0xcbcd27(0x53d)+new Date()['toLocaleSt'+_0xcbcd27(0x537)](_0xcbcd27(0x17e))+')_'),{'parse_mode':'Markdown','reply_markup':_0x45c5a0}),await _0x5326ca[_0xcbcd27(0x250)+_0x16f28a(0x202)](_0x4dea0e+(_0x16f28a(0x520)+'n'));}),_0x24722c[_0x311a27(0x453)+_0x311a27(0x24b)](/^fb:info:(.+)$/,async _0x327f24=>{const _0xea9c87=_0x311a27,_0x1f3334=_0xa4a5c3,{getHealthStatus:_0x57cdeb}=await import(_0xea9c87(0x451)+_0xea9c87(0x4ad)+_0xea9c87(0x36e)),_0x216c28=_0x327f24['match'][0x20aa+0x257b*0x1+0x1*-0x4624],_0x39b56c=_0x57cdeb(),_0x467295=_0x39b56c[_0x1f3334(0x299)](_0x49f700=>_0x49f700[_0x1f3334(0x37d)]===_0x216c28);_0x467295?await _0x327f24[_0x1f3334(0x250)+_0x1f3334(0x202)]({'text':_0x216c28+':\x20'+(_0x467295['healthy']?_0x1f3334(0xdc):'❌\x20Unhealth'+'y')+_0xea9c87(0x1a5)+_0x467295[_0x1f3334(0x256)]+(_0x1f3334(0x21c)+_0xea9c87(0x632))+_0x467295[_0xea9c87(0x415)],'show_alert':!![]}):await _0x327f24[_0x1f3334(0x250)+_0xea9c87(0x202)](_0x216c28+(':\x20Not\x20chec'+'ked\x20yet'));}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x4ac),async _0x24f484=>{const _0x15ca60=_0xa4a5c3,_0x29502f=_0x311a27,_0x595fe9=_0x24f484[_0x15ca60(0x163)]?.[_0x15ca60(0x42f)]();if(!_0x595fe9){await _0x24f484[_0x15ca60(0x191)](_0x15ca60(0x565)+_0x15ca60(0x3fe)+_0x15ca60(0x80)+'y`',{'parse_mode':_0x29502f(0x515)});return;}await _0x24f484['api'][_0x29502f(0x275)+_0x29502f(0x479)](_0x24f484[_0x15ca60(0x5e3)]['id'],_0x15ca60(0x596));try{const _0x16f181=encodeURIComponent(_0x595fe9),_0x4387e6=await fetch(_0x15ca60(0x5a1)+'i.duckduck'+_0x15ca60(0x542)+_0x16f181+(_0x15ca60(0x4cb)+'on&no_html'+_0x29502f(0x4a0)+'sambig=1')),_0x6981ba=await _0x4387e6['json'](),_0x110fe0=[];_0x6981ba[_0x15ca60(0x1f2)]&&_0x110fe0[_0x29502f(0x666)](_0x29502f(0x9d)+_0x6981ba['Answer']+'*\x0a');if(_0x6981ba[_0x29502f(0x2d4)+'xt']){const _0x1c02ff=_0x6981ba[_0x15ca60(0x2d4)+'xt']['length']>-0x1167+0x1*-0x1ac9+0x4*0xb89?_0x6981ba['AbstractTe'+'xt'][_0x29502f(0x4c7)](0xac6+0x42*-0x31+-0x1*-0x1dc,0x10d5+-0x14cf+-0x3*-0x1fa)+_0x29502f(0x421):_0x6981ba['AbstractTe'+'xt'];_0x110fe0['push'](_0x1c02ff),_0x6981ba[_0x29502f(0x316)+_0x15ca60(0x573)]&&_0x6981ba[_0x29502f(0x387)+'L']&&_0x110fe0[_0x15ca60(0x666)]('\x0a_Source:\x20'+'['+_0x6981ba['AbstractSo'+_0x29502f(0x573)]+']('+_0x6981ba[_0x15ca60(0x387)+'L']+')_');}if(_0x110fe0[_0x29502f(0x1b9)]===0x196d+0x102b+-0x2998&&_0x6981ba[_0x15ca60(0x1cd)+'ics']&&_0x6981ba[_0x29502f(0x1cd)+'ics'][_0x29502f(0x1b9)]>-0x2*-0x80+0x1*0x1487+-0x1587){_0x110fe0[_0x29502f(0x666)](_0x15ca60(0x222)+_0x15ca60(0x2c8)+_0x595fe9+_0x29502f(0x622));for(const _0x464eba of _0x6981ba[_0x29502f(0x1cd)+_0x29502f(0x37b)][_0x15ca60(0x4c7)](-0x2ef+-0x977+0xc66,0xe0+-0xeb+-0x10*-0x1)){if(_0x464eba[_0x29502f(0x264)]){const _0x11c189=_0x464eba[_0x29502f(0x264)][_0x15ca60(0x1b9)]>0xf0+0x836+-0x1*0x890?_0x464eba[_0x15ca60(0x264)]['slice'](-0xaad*-0x1+0x1691+0x213e*-0x1,0x1aba+0x1987+-0x33ab)+'...':_0x464eba[_0x29502f(0x264)];_0x110fe0[_0x15ca60(0x666)]('•\x20'+_0x11c189);}}}_0x110fe0[_0x29502f(0x1b9)]===0x6d3*0x1+-0x142b+0xd58&&_0x110fe0[_0x29502f(0x666)](_0x15ca60(0x379)+'\x20for\x20\x22'+_0x595fe9+(_0x15ca60(0xc4)+_0x29502f(0x21a)+_0x29502f(0x548)+_0x29502f(0x308)+_0x29502f(0x656)+_0x15ca60(0x357)+'del.')),await _0x24f484[_0x29502f(0x191)](_0x110fe0[_0x29502f(0x2fa)]('\x0a'),{'parse_mode':_0x15ca60(0x515)})[_0x29502f(0x53e)](()=>_0x24f484[_0x15ca60(0x191)](_0x110fe0[_0x15ca60(0x2fa)]('\x0a')));}catch(_0x90e38b){await _0x24f484[_0x15ca60(0x191)](_0x29502f(0xbd)+_0x15ca60(0x95)+(_0x90e38b instanceof Error?_0x90e38b[_0x15ca60(0x431)]:String(_0x90e38b)));}}),_0x24722c['command'](_0xa4a5c3(0x15c),async _0x37fc3e=>{const _0x202be2=_0x311a27,_0x283c37=_0x311a27,_0x41c427=_0x37fc3e['match']?.[_0x202be2(0x42f)]();if(!_0x41c427){await _0x37fc3e[_0x283c37(0x191)](_0x202be2(0x30a)+'hat\x20I\x20shou'+'ld\x20generat'+'e:\x0a`/imagi'+_0x283c37(0x478)+_0x202be2(0x605)+_0x202be2(0x411),{'parse_mode':_0x202be2(0x515)});return;}if(!config['apiKeys'][_0x202be2(0x289)]){await _0x37fc3e[_0x283c37(0x191)](_0x283c37(0x30d)+_0x202be2(0x210)+_0x202be2(0x2f0)+_0x202be2(0xc1)+_0x202be2(0x626)+_0x283c37(0x37c));return;}await _0x37fc3e[_0x202be2(0x330)][_0x283c37(0x275)+_0x283c37(0x479)](_0x37fc3e[_0x202be2(0x5e3)]['id'],'upload_pho'+'to');const _0x310c08=await generateImage(_0x41c427,config[_0x202be2(0x323)][_0x283c37(0x289)]);if(_0x310c08[_0x283c37(0x1af)]&&_0x310c08[_0x283c37(0x4b7)])try{const _0x5467aa=_0x40611e[_0x283c37(0x187)+'nc'](_0x310c08[_0x202be2(0x4b7)]);await _0x37fc3e[_0x202be2(0x4f0)+_0x202be2(0x49e)](new InputFile(_0x5467aa,_0x202be2(0x304)+(_0x310c08[_0x202be2(0x4b7)][_0x202be2(0x2f2)](_0x283c37(0x56f))?_0x202be2(0x56f):_0x202be2(0x3ac))),{'caption':_0x283c37(0x454)+_0x41c427+'_','parse_mode':'Markdown'}),_0x40611e['unlink'](_0x310c08[_0x202be2(0x4b7)],()=>{});}catch(_0x2e2c7f){await _0x37fc3e[_0x202be2(0x191)](_0x202be2(0x206)+_0x202be2(0x49c)+(_0x2e2c7f instanceof Error?_0x2e2c7f[_0x202be2(0x431)]:String(_0x2e2c7f)));}else await _0x37fc3e[_0x283c37(0x191)]('❌\x20'+(_0x310c08['error']||'Image\x20gene'+_0x283c37(0x3b5)+_0x202be2(0x360)));}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x329),async _0x4e369d=>{const _0x790176=_0xa4a5c3,_0x3f90d3=_0xa4a5c3,_0x4fa119=_0x4e369d[_0x790176(0x376)]['id'],_0x327a17=_0x4e369d[_0x790176(0x5e3)]['id'],_0x3b07cf=_0x4e369d['match']?.[_0x790176(0x42f)]();if(!_0x3b07cf){const _0xfedd9=listReminders(_0x4fa119);if(_0xfedd9[_0x790176(0x1b9)]===-0x17c*0x3+-0x1147+0x15bb)await _0x4e369d[_0x3f90d3(0x191)](_0x790176(0x472)+_0x3f90d3(0x150)+_0x790176(0x442)+_0x3f90d3(0x2be)+_0x3f90d3(0x624),{'parse_mode':'Markdown'});else{const _0x560e73=_0xfedd9[_0x3f90d3(0x2fe)](_0x4dce4a=>_0x3f90d3(0x362)+_0x4dce4a[_0x790176(0x283)]+'*\x20—\x20'+_0x4dce4a[_0x3f90d3(0x11b)]+_0x790176(0x4f6)+_0x4dce4a['id']+')');await _0x4e369d[_0x790176(0x191)](_0x790176(0x315)+'Reminders:'+_0x3f90d3(0x642)+_0x560e73['join']('\x0a')+(_0x3f90d3(0x33f)+'`/remind\x20c'+_0x3f90d3(0x2f6)+'`'),{'parse_mode':_0x3f90d3(0x515)});}return;}if(_0x3b07cf[_0x3f90d3(0x319)]('cancel\x20')){const _0x459972=parseInt(_0x3b07cf[_0x790176(0x4c7)](0x33+-0x270a+0x26de)[_0x3f90d3(0x42f)]());if(isNaN(_0x459972)){await _0x4e369d[_0x3f90d3(0x191)](_0x790176(0x16d)+_0x3f90d3(0x499)+_0x790176(0x244)+_0x790176(0x660),{'parse_mode':_0x790176(0x515)});return;}cancelReminder(_0x459972,_0x4fa119)?await _0x4e369d[_0x3f90d3(0x191)]('✅\x20Reminder'+'\x20#'+_0x459972+(_0x3f90d3(0xd2)+'.')):await _0x4e369d['reply']('❌\x20Reminder'+'\x20#'+_0x459972+('\x20not\x20found'+'.'));return;}const _0x5ce251=_0x3b07cf[_0x3f90d3(0x1fa)]('\x20');if(_0x5ce251===-(0x835+0x1646+0x1*-0x1e7a)){await _0x4e369d['reply'](_0x790176(0x5cd)+'remind\x2030m'+_0x3f90d3(0x570)+_0x3f90d3(0xd8),{'parse_mode':_0x3f90d3(0x515)});return;}const _0x1d24f0=_0x3b07cf[_0x790176(0x4c7)](-0x14e4+0x5*0x3ff+-0x1*-0xe9,_0x5ce251),_0x4ad871=_0x3b07cf[_0x790176(0x4c7)](_0x5ce251+(0x1c9*-0xb+-0x1a5d*-0x1+-0x6b9))[_0x3f90d3(0x42f)](),_0x3b4b8b=parseDuration(_0x1d24f0);if(!_0x3b4b8b){await _0x4e369d[_0x3f90d3(0x191)](_0x3f90d3(0x52a)+_0x790176(0x662)+_0x790176(0x388)+_0x3f90d3(0x18a)+_0x3f90d3(0x61b)+'`',{'parse_mode':_0x3f90d3(0x515)});return;}if(!_0x4ad871){await _0x4e369d[_0x3f90d3(0x191)](_0x3f90d3(0x340)+_0x3f90d3(0x646)+'\x20`/remind\x20'+_0x3f90d3(0x55f)+_0x3f90d3(0x48b),{'parse_mode':_0x3f90d3(0x515)});return;}const _0x226795=createReminder(_0x327a17,_0x4fa119,_0x4ad871,_0x3b4b8b,_0x4e369d[_0x790176(0x330)]),_0x1a8e67=new Date(_0x226795[_0x790176(0x5be)]),_0x3e4681=_0x1a8e67[_0x790176(0x277)+'meString']('en-US',{'hour':_0x3f90d3(0x4b0),'minute':_0x790176(0x4b0)});await _0x4e369d['reply'](_0x3f90d3(0x4ec)+_0x3f90d3(0x4a3)+_0x3e4681+_0x3f90d3(0x19c)+_0x4ad871,{'parse_mode':_0x790176(0x515)});}),_0x24722c[_0xa4a5c3(0x487)](_0x311a27(0x22d),async _0x30c4f8=>{const _0x321869=_0x311a27,_0x2a1a6f=_0xa4a5c3,_0xdac16=_0x30c4f8[_0x321869(0x376)]['id'],_0x215a4a=getSession(_0xdac16);if(_0x215a4a['history'][_0x321869(0x1b9)]===-0xe3a+-0x164e+0x2488&&!_0x215a4a[_0x2a1a6f(0x218)]){await _0x30c4f8[_0x2a1a6f(0x191)]('No\x20convers'+_0x2a1a6f(0xf4)+_0x2a1a6f(0xfa)+'.');return;}const _0x54cb4d=[_0x321869(0x455)+_0x321869(0x534)+_0x2a1a6f(0x552)+'ort',_0x321869(0x381)+new Date()[_0x2a1a6f(0x533)+_0x2a1a6f(0x537)]('en-US'),_0x2a1a6f(0x425)+_0x215a4a[_0x2a1a6f(0x43a)+'nt'],_0x2a1a6f(0x281)+_0x215a4a[_0x321869(0x3cc)]['toFixed'](-0x1ddf+0x10b+0x11c*0x1a),'---\x0a'];for(const _0x902fb7 of _0x215a4a[_0x321869(0x4c9)]){const _0x2939ce=_0x902fb7[_0x2a1a6f(0x5c5)]===_0x2a1a6f(0x16c)?_0x2a1a6f(0x31b):_0x2a1a6f(0x3db)+'t';_0x54cb4d['push'](_0x321869(0x61c)+_0x2939ce+'\x0a'+_0x902fb7[_0x2a1a6f(0x667)]+'\x0a');}_0x215a4a[_0x2a1a6f(0x4c9)][_0x321869(0x1b9)]===-0xb26+0x1*0x50f+0x617&&_0x54cb4d[_0x321869(0x666)](_0x2a1a6f(0x589)+_0x321869(0x306)+_0x2a1a6f(0x171)+_0x2a1a6f(0x418)+_0x2a1a6f(0x28b)+_0x2a1a6f(0x15d)+_0x321869(0x2c0));const _0x3f1e52=_0x54cb4d[_0x2a1a6f(0x2fa)]('\x0a'),_0x3e3142=Buffer['from'](_0x3f1e52,_0x2a1a6f(0x165)),_0x1a303b=_0x321869(0x27f)+'t-'+new Date()['toISOStrin'+'g']()[_0x321869(0x4c7)](-0x2347*-0x1+-0x1*-0x10fa+-0x31*0x111,-0x659+0x257b+-0x1f18)+_0x2a1a6f(0x318);await _0x30c4f8['replyWithD'+_0x2a1a6f(0x423)](new InputFile(_0x3e3142,_0x1a303b),{'caption':'📄\x20Export:\x20'+_0x215a4a[_0x321869(0x4c9)][_0x2a1a6f(0x1b9)]+_0x2a1a6f(0x5e1)});});function _0x23312b(_0x488fc5){const _0x32d367=_0x311a27,_0x4709fb=_0xa4a5c3,_0x5ca64a=new InlineKeyboard(),_0x270226=['en','de','es','fr'];return _0x5ca64a[_0x32d367(0x11b)](''+(_0x488fc5==='en'?'✅\x20':'')+LOCALE_FLAGS['en']+'\x20'+LOCALE_NAMES['en'],_0x32d367(0x138))[_0x4709fb(0x11b)](''+(_0x488fc5==='de'?'✅\x20':'')+LOCALE_FLAGS['de']+'\x20'+LOCALE_NAMES['de'],_0x32d367(0x44d))[_0x32d367(0x413)](),_0x5ca64a[_0x4709fb(0x11b)](''+(_0x488fc5==='es'?'✅\x20':'')+LOCALE_FLAGS['es']+'\x20'+LOCALE_NAMES['es'],_0x4709fb(0xe9))[_0x32d367(0x11b)](''+(_0x488fc5==='fr'?'✅\x20':'')+LOCALE_FLAGS['fr']+'\x20'+LOCALE_NAMES['fr'],_0x32d367(0x9e))[_0x32d367(0x413)](),void _0x270226,_0x5ca64a[_0x4709fb(0x11b)](t(_0x4709fb(0x257)+_0x4709fb(0x64a),_0x488fc5),_0x32d367(0x5cf)),_0x5ca64a;}_0x24722c['command']('lang',async _0x296df7=>{const _0x1e60c1=_0x311a27,_0x4001e4=_0xa4a5c3,_0x29886d=_0x296df7[_0x1e60c1(0x376)]['id'],_0x3418dc=getSession(_0x29886d),_0x103e84=_0x296df7[_0x1e60c1(0x163)]?.[_0x1e60c1(0x42f)]()[_0x1e60c1(0x4a8)+'e']();if(!_0x103e84){const _0x3d6f25=t(_0x1e60c1(0xb5)+'eader',_0x3418dc[_0x4001e4(0x2a2)]),_0x214bb5=LOCALE_FLAGS[_0x3418dc[_0x4001e4(0x2a2)]]+'\x20'+LOCALE_NAMES[_0x3418dc[_0x4001e4(0x2a2)]];await _0x296df7[_0x1e60c1(0x191)](_0x3d6f25+'\x20'+_0x214bb5,{'parse_mode':_0x4001e4(0x515),'reply_markup':_0x23312b(_0x3418dc['language'])});return;}if(_0x103e84===_0x1e60c1(0x18b)){const {resetToAutoLanguage:_0x5199bf}=await import(_0x4001e4(0x451)+_0x1e60c1(0x422)+_0x1e60c1(0x5d9));_0x5199bf(_0x29886d),await _0x296df7['reply'](t(_0x4001e4(0x257)+'utoEnabled',_0x3418dc[_0x4001e4(0x2a2)]));}else{if(_0x103e84==='en'||_0x103e84==='de'||_0x103e84==='es'||_0x103e84==='fr'){_0x3418dc[_0x1e60c1(0x2a2)]=_0x103e84,markSessionDirty(_0x29886d);const {setExplicitLanguage:_0x149441}=await import(_0x4001e4(0x451)+_0x4001e4(0x422)+_0x4001e4(0x5d9));_0x149441(_0x29886d,_0x103e84),await _0x296df7['reply'](t(_0x1e60c1(0x221)+_0x1e60c1(0x1eb),_0x103e84,{'name':LOCALE_NAMES[_0x103e84]}));}else await _0x296df7[_0x4001e4(0x191)](t(_0x1e60c1(0x577)+'sage',_0x3418dc[_0x4001e4(0x2a2)]),{'parse_mode':_0x4001e4(0x515)});}}),_0x24722c[_0x311a27(0x453)+_0xa4a5c3(0x24b)](/^lang:(en|de|es|fr|auto)$/,async _0x471044=>{const _0x5e706f=_0xa4a5c3,_0x46c845=_0xa4a5c3,_0x215d75=_0x471044[_0x5e706f(0x163)][-0xf*0x127+0xe62+0xc*0x3e],_0x540133=_0x471044[_0x46c845(0x376)]['id'],_0x4373c4=getSession(_0x540133);if(_0x215d75===_0x46c845(0x18b)){const {resetToAutoLanguage:_0x52863f}=await import(_0x5e706f(0x451)+_0x46c845(0x422)+'-detect.js');_0x52863f(_0x540133),await _0x471044['answerCall'+_0x46c845(0x202)]({'text':t(_0x46c845(0x257)+_0x46c845(0x1f3),_0x4373c4[_0x5e706f(0x2a2)])[_0x5e706f(0x4c7)](0x5*-0x3a1+-0x1*0xf83+0x21a8,0x23*0x4d+0x23ed+0x7b4*-0x6)}),await _0x471044['editMessag'+_0x5e706f(0x16f)](t(_0x46c845(0xb5)+_0x5e706f(0x4b1),_0x4373c4[_0x46c845(0x2a2)])+'\x20'+t(_0x46c845(0x257)+_0x5e706f(0x64a),_0x4373c4[_0x5e706f(0x2a2)]),{'parse_mode':_0x5e706f(0x515)});return;}const _0x446880=_0x215d75;_0x4373c4['language']=_0x446880,markSessionDirty(_0x540133);const {setExplicitLanguage:_0x53cf5f}=await import('../service'+'s/language'+'-detect.js');_0x53cf5f(_0x540133,_0x446880);const _0x417ff5=LOCALE_FLAGS[_0x446880]+'\x20'+LOCALE_NAMES[_0x446880];await _0x471044[_0x5e706f(0x33b)+_0x5e706f(0x16f)](t('bot.lang.h'+_0x46c845(0x4b1),_0x446880)+'\x20'+_0x417ff5,{'parse_mode':_0x5e706f(0x515),'reply_markup':_0x23312b(_0x446880)}),await _0x471044['answerCall'+_0x46c845(0x202)](LOCALE_NAMES[_0x446880]);}),_0x24722c['command'](_0x311a27(0x436),async _0x3c0448=>{const _0x43009a=_0xa4a5c3,_0x4bbcae=_0xa4a5c3,_0x4c4378=getMemoryStats(),_0x57905a=_0x3c0448[_0x43009a(0x163)]?.[_0x4bbcae(0x42f)]();if(!_0x57905a){await _0x3c0448['reply'](_0x4bbcae(0x47a)+'\x0a\x0a'+('*Long-term'+_0x4bbcae(0x2c2)+formatBytes(_0x4c4378[_0x4bbcae(0x54b)+'ze'])+'\x0a')+(_0x4bbcae(0x353)+'s:*\x20'+_0x4c4378[_0x43009a(0x2ca)]+_0x4bbcae(0x493))+('*Today:*\x20'+_0x4c4378[_0x4bbcae(0x33d)+'es']+_0x4bbcae(0xbc))+(_0x43009a(0x475)+_0x43009a(0x3c2)+_0x43009a(0x5af)+_0x4bbcae(0x58e)+_0x4bbcae(0x4b8))+('_Non-SDK\x20p'+_0x4bbcae(0x228)+_0x4bbcae(0x18c)+_0x4bbcae(0x404)+_0x43009a(0x251)),{'parse_mode':'Markdown'});return;}}),_0x24722c[_0xa4a5c3(0x487)]('system',async _0x595e2f=>{const _0x2c377=_0xa4a5c3,_0x44636=_0x311a27,_0x222f5c=_0x3a2d43[_0x2c377(0x1d4)](),_0x6e0e32=_0x3a2d43[_0x2c377(0x539)](),_0xc0b5fa=_0x222f5c-_0x6e0e32,_0x2f4540=Math[_0x44636(0x65d)](_0xc0b5fa/_0x222f5c*(0x222f+0x1147*0x1+0x2*-0x1989)),_0x4217c9=_0x3a2d43[_0x44636(0x392)](),_0x43ad40=Math['floor'](_0x4217c9/(-0x14b1*0x1+0x2621+-0x10*0x36)),_0x2e8b8b=Math['floor'](_0x4217c9%(-0x1fd4+0x1fbc+0xe28)/(0x419*-0x7+0x56d+0x3e*0x61)),_0x4705a6=_0x3a2d43[_0x2c377(0x4e1)](),_0x5ab823=_0x3a2d43[_0x44636(0x3b6)](),_0x438a25=process[_0x2c377(0x63b)+'e']();await _0x595e2f['reply'](_0x44636(0x282)+_0x44636(0x1e1)+(_0x2c377(0x2e0)+_0x3a2d43[_0x2c377(0x2ee)]()+'\x20'+_0x3a2d43[_0x44636(0x35a)]()+'\x20('+_0x3a2d43[_0x44636(0x240)]()+')\x0a')+(_0x2c377(0x647)+_0x3a2d43[_0x44636(0x3e6)]()+'\x0a')+(_0x2c377(0x2e5)+_0x4705a6['length']+'x\x20'+(_0x4705a6[-0x455+-0x1*-0x1369+-0xf14]?.['model']?.[_0x2c377(0x42f)]()||'unknown')+'\x0a')+(_0x44636(0x1db)+_0x5ab823[_0x44636(0x2fe)](_0x4ce337=>_0x4ce337['toFixed'](-0xf*-0x112+-0x1f07+0xefb))[_0x44636(0x2fa)](',\x20')+'\x0a')+('*RAM:*\x20'+formatBytes(_0xc0b5fa)+_0x2c377(0x375)+formatBytes(_0x222f5c)+'\x20('+_0x2f4540+_0x2c377(0x1b6))+('*System\x20Up'+_0x44636(0x433)+_0x43ad40+'h\x20'+_0x2e8b8b+_0x44636(0x45e))+(_0x44636(0x204)+_0x44636(0x40f))+(_0x44636(0x51e)+process[_0x44636(0x403)]+'\x0a')+(_0x2c377(0x482)+formatBytes(_0x438a25[_0x2c377(0x33c)])+_0x44636(0x375)+formatBytes(_0x438a25[_0x2c377(0x485)])+'\x0a')+(_0x2c377(0x613)+formatBytes(_0x438a25[_0x2c377(0xa5)])+'\x0a')+(_0x44636(0x615)+process[_0x44636(0x113)]),{'parse_mode':'Markdown'});}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x26d),async _0x45fc0c=>{const _0x55e822=_0x311a27,_0x3d41d5=_0xa4a5c3,_0xaf206=reloadSoul();await _0x45fc0c['reply'](_0xaf206?'✅\x20SOUL.md\x20'+_0x55e822(0x1e3):_0x55e822(0x4b6)+_0x3d41d5(0x333));}),_0x24722c['callbackQu'+_0x311a27(0x24b)](/^access:(approve|block):(-?\d+)$/,async _0x38989d=>{const _0x4195ab=_0x311a27,_0x7554a8=_0x311a27,_0x5a9ce6=_0x38989d[_0x4195ab(0x163)][-0x119f+-0x1056+0x19e*0x15],_0x4bcb4e=parseInt(_0x38989d[_0x4195ab(0x163)][-0x6f*0x14+-0x295*0x8+0xa*0x2ef]);if(_0x5a9ce6===_0x7554a8(0x248)){approveGroup(_0x4bcb4e),await _0x38989d['editMessag'+_0x4195ab(0x16f)](_0x7554a8(0xc3)+_0x4bcb4e+(_0x7554a8(0x1b5)+'\x20Alvin\x20Bot'+_0x7554a8(0x144)+_0x7554a8(0x8d)+_0x4195ab(0x21d)));try{await _0x38989d[_0x7554a8(0x330)]['sendMessag'+'e'](_0x4bcb4e,'👋\x20Alvin\x20Bo'+'t\x20is\x20now\x20a'+_0x7554a8(0x4b5)+'his\x20group!'+_0x4195ab(0x3d2)+_0x7554a8(0x34b)+_0x4195ab(0x1b0)+_0x7554a8(0x450));}catch{}}else blockGroup(_0x4bcb4e),await _0x38989d[_0x4195ab(0x33b)+_0x4195ab(0x16f)](_0x7554a8(0x2ed)+_0x4bcb4e+(_0x7554a8(0x1da)+_0x4195ab(0x24c)+_0x4195ab(0x252)+'e\x20this\x20gro'+_0x7554a8(0x56e)));await _0x38989d['answerCall'+_0x7554a8(0x202)]();}),_0x24722c['command'](_0x311a27(0x64d),async _0x15e747=>{const _0x2b5921=_0xa4a5c3,_0x2b1ed7=_0xa4a5c3,_0x3c3994=listGroups();if(_0x3c3994[_0x2b5921(0x1b9)]===0x88*-0x40+-0x2*0x58a+-0x241*-0x14){await _0x15e747['reply'](_0x2b1ed7(0x604)+_0x2b5921(0x5e6)+'.');return;}const _0x14faa1=_0x3c3994[_0x2b5921(0x2fe)](_0x2ad9a7=>{const _0x549467=_0x2b1ed7,_0x4908b0=_0x2b5921,_0x5a6856=_0x2ad9a7[_0x549467(0x79)]===_0x549467(0x4fd)?'✅':_0x2ad9a7['status']===_0x4908b0(0x115)?'🚫':'⏳';return _0x5a6856+'\x20*'+_0x2ad9a7[_0x549467(0x12a)]+_0x549467(0x38c)+_0x2ad9a7['messageCou'+'nt']+(_0x549467(0x296)+_0x4908b0(0x26f))+_0x2ad9a7[_0x549467(0x4be)]+'`';}),_0x514102=new InlineKeyboard();for(const _0x144b15 of _0x3c3994){if(_0x144b15[_0x2b5921(0x79)]===_0x2b5921(0x4fd))_0x514102[_0x2b5921(0x11b)](_0x2b1ed7(0x32d)+_0x144b15[_0x2b5921(0x12a)][_0x2b1ed7(0x4c7)](-0x1*0x1535+-0x1671+0x2ba6,0x1298+0x2f*-0x6e+0x56*0x5),_0x2b5921(0x10d)+'ck:'+_0x144b15[_0x2b1ed7(0x4be)])[_0x2b5921(0x413)]();else(_0x144b15[_0x2b1ed7(0x79)]==='blocked'||_0x144b15['status']===_0x2b5921(0x3b7))&&_0x514102[_0x2b5921(0x11b)]('✅\x20Approve:'+'\x20'+_0x144b15[_0x2b1ed7(0x12a)]['slice'](-0x264c+-0x1a87+0x40d3,-0x24a8+0x1d11+-0x97*-0xd),_0x2b1ed7(0x543)+_0x2b5921(0x55d)+_0x144b15['chatId'])[_0x2b5921(0x413)]();}const _0xe54ae6=getSettings();await _0x15e747['reply'](_0x2b1ed7(0x1a3)+_0x2b5921(0x7e)+'\x0a\x0a'+(_0x14faa1[_0x2b1ed7(0x2fa)]('\x0a\x0a')+'\x0a\x0a')+(_0x2b5921(0x5ea)+_0x2b1ed7(0xf3))+(_0x2b1ed7(0x614)+(_0xe54ae6[_0x2b5921(0x51c)+'rds']?'✅':'❌')+'\x0a')+(_0x2b5921(0x1e7)+'ve:\x20'+(_0xe54ae6[_0x2b1ed7(0x3f4)+_0x2b1ed7(0x4cd)]?_0x2b1ed7(0x1f8):'✅\x20OFF')),{'parse_mode':_0x2b5921(0x515),'reply_markup':_0x514102});}),_0x24722c['command'](_0xa4a5c3(0x58f),async _0x7e2bb6=>{const _0x2629e5=_0xa4a5c3,_0x43643a=_0x311a27,_0x25e748=_0x7e2bb6[_0x2629e5(0x163)]?.[_0x2629e5(0x42f)]()['toLowerCas'+'e'](),_0x3fe89c=getSettings();if(!_0x25e748){await _0x7e2bb6[_0x43643a(0x191)]('🔐\x20*Securit'+_0x2629e5(0x124)+_0x43643a(0x642)+('*Forwards:'+'*\x20'+(_0x3fe89c[_0x2629e5(0x51c)+_0x2629e5(0x16a)]?_0x2629e5(0x41b):_0x2629e5(0xa6))+'\x0a')+(_0x2629e5(0x398)+'ove\x20Groups'+_0x43643a(0xc9)+(_0x3fe89c[_0x43643a(0x3f4)+'eGroups']?'⚠️\x20ON\x20(dang'+_0x2629e5(0x147):_0x43643a(0x4c8))+'\x0a')+(_0x43643a(0x5ae)+_0x43643a(0xc6)+_0x3fe89c[_0x2629e5(0xb6)+_0x2629e5(0x266)+'r']+'/h\x0a\x0a')+_0x43643a(0x300)+(_0x2629e5(0x54d)+'\x20forwards\x20'+'on|off`\x0a')+(_0x2629e5(0x54d)+_0x43643a(0x45c)+_0x2629e5(0x5a3)),{'parse_mode':_0x43643a(0x515)});return;}if(_0x25e748[_0x2629e5(0x319)](_0x43643a(0x125))){const _0xbd7e27=_0x25e748[_0x43643a(0x4c7)](-0x4*0x9b6+-0x12*0xee+-0x1*-0x379d)[_0x2629e5(0x42f)]();setForwardingAllowed(_0xbd7e27==='on'||_0xbd7e27===_0x2629e5(0x513)),await _0x7e2bb6['reply']('✅\x20Forwards'+':\x20'+(_0xbd7e27==='on'||_0xbd7e27===_0x43643a(0x513)?_0x2629e5(0x3d9):_0x2629e5(0x115)));}else{if(_0x25e748[_0x43643a(0x319)](_0x2629e5(0x55a)+'e\x20')){const _0x48e6dc=_0x25e748[_0x2629e5(0x4c7)](0x4b6+0x662+0x2*-0x586)['trim']();setAutoApprove(_0x48e6dc==='on'||_0x48e6dc===_0x2629e5(0x513)),await _0x7e2bb6[_0x2629e5(0x191)]((_0x48e6dc==='on'||_0x48e6dc===_0x2629e5(0x513)?'⚠️':'✅')+(_0x2629e5(0xaa)+_0x43643a(0x473))+(_0x48e6dc==='on'||_0x48e6dc==='true'?'ON':_0x2629e5(0x137)));}else await _0x7e2bb6['reply'](_0x2629e5(0x13b)+_0x2629e5(0x503)+_0x43643a(0x5c6)+_0x43643a(0x519),{'parse_mode':_0x2629e5(0x515)});}}),_0x24722c[_0x311a27(0x487)](_0x311a27(0x47e),async _0x55ca10=>{const _0x28ac61=_0x311a27,_0x45f32d=_0xa4a5c3,_0x484213=_0x55ca10[_0x28ac61(0x163)]?.[_0x45f32d(0x268)]()['trim']();if(!_0x484213){await _0x55ca10[_0x28ac61(0x191)]('🌐\x20*Browser'+_0x45f32d(0x65a)+_0x45f32d(0x642)+(_0x28ac61(0x38f)+_0x45f32d(0x46b)+_0x45f32d(0x2b1)+_0x45f32d(0x3c7))+(_0x28ac61(0x106)+_0x28ac61(0x63e)+_0x28ac61(0x471)+'\x20text\x0a')+(_0x45f32d(0x3c3)+_0x45f32d(0x23a)+_0x28ac61(0x170)+_0x45f32d(0x5bd)),{'parse_mode':_0x28ac61(0x515)});return;}if(!hasPlaywright()){await _0x55ca10[_0x45f32d(0x191)]('❌\x20Playwrig'+_0x28ac61(0x62f)+_0x28ac61(0x2aa)+'pm\x20install'+_0x45f32d(0x42a)+'t\x20&&\x20npx\x20p'+_0x28ac61(0x528)+'install\x20ch'+_0x45f32d(0x491),{'parse_mode':_0x28ac61(0x515)});return;}try{await _0x55ca10[_0x28ac61(0x330)][_0x45f32d(0x275)+_0x45f32d(0x479)](_0x55ca10[_0x45f32d(0x5e3)]['id'],_0x45f32d(0x596));if(_0x484213[_0x28ac61(0x319)](_0x45f32d(0x1ab))){const _0x5b7d00=_0x484213[_0x45f32d(0x4c7)](0x1b*-0xb+0x1965+-0x1837)[_0x28ac61(0x42f)](),_0x467ad2=await extractText(_0x5b7d00),_0x15d20d=_0x467ad2[_0x45f32d(0x1b9)]>-0x15*-0x10f+-0x2*-0xfc2+0x2813*-0x1?_0x467ad2['slice'](-0x2*-0x4e1+-0x58+-0x96a,0x1*0xb8a+0x117*0x16+-0x15d8)+(_0x45f32d(0x5bc)+'ncated]_'):_0x467ad2;await _0x55ca10['reply'](_0x28ac61(0x44f)+_0x45f32d(0x285)+_0x5b7d00+_0x28ac61(0xa2)+_0x15d20d,{'parse_mode':_0x45f32d(0x515)});return;}if(_0x484213[_0x45f32d(0x319)](_0x45f32d(0x5ec))){const _0x4e63a7=_0x484213[_0x28ac61(0x4c7)](0x39a+0x16a8+-0x1a3e)[_0x28ac61(0x42f)]();await _0x55ca10[_0x45f32d(0x330)][_0x28ac61(0x275)+_0x28ac61(0x479)](_0x55ca10[_0x45f32d(0x5e3)]['id'],_0x45f32d(0x253)+_0x45f32d(0x4b4));const _0x2eef34=await generatePdf(_0x4e63a7);await _0x55ca10[_0x28ac61(0x65f)+_0x45f32d(0x423)](new InputFile(_0x40611e[_0x28ac61(0x187)+'nc'](_0x2eef34),_0x45f32d(0x324)),{'caption':_0x45f32d(0x5a2)+'\x20'+_0x4e63a7}),_0x40611e['unlink'](_0x2eef34,()=>{});return;}const _0x19c568=_0x484213['startsWith'](_0x28ac61(0x361))?_0x484213:_0x45f32d(0x45a)+_0x484213;await _0x55ca10[_0x28ac61(0x330)][_0x28ac61(0x275)+_0x45f32d(0x479)](_0x55ca10[_0x28ac61(0x5e3)]['id'],'upload_pho'+'to');const _0x52bdfb=await screenshotUrl(_0x19c568,{'fullPage':![]});await _0x55ca10[_0x45f32d(0x4f0)+_0x28ac61(0x49e)](new InputFile(_0x40611e[_0x28ac61(0x187)+'nc'](_0x52bdfb),_0x45f32d(0x4d8)+_0x28ac61(0x56f)),{'caption':_0x45f32d(0x2c6)+_0x19c568}),_0x40611e['unlink'](_0x52bdfb,()=>{});}catch(_0xacffc0){const _0x583052=_0xacffc0 instanceof Error?_0xacffc0['message']:String(_0xacffc0);await _0x55ca10[_0x45f32d(0x191)](_0x45f32d(0x238)+'error:\x20'+_0x583052);}}),_0x24722c[_0xa4a5c3(0x487)]('tools',async _0x54378b=>{const _0x493082=_0x311a27,_0x321002=_0x311a27,_0x296750=_0x54378b[_0x493082(0x163)]?.[_0x321002(0x268)]()[_0x493082(0x42f)]();if(_0x296750?.['startsWith'](_0x321002(0x3fa))){const _0x42ea52=_0x296750[_0x493082(0x4c7)](-0x6e2+0x12b*-0x17+-0x81*-0x43)[_0x321002(0x42f)]()[_0x321002(0x4d9)](/\s+/),_0x145724=_0x42ea52[0x11*0x7b+0x2*-0xd1f+0x1213*0x1];let _0x29a954={};if(_0x42ea52[_0x321002(0x1b9)]>-0x1cbe+-0x7e5+0x24a4)try{_0x29a954=JSON[_0x321002(0x19d)](_0x42ea52[_0x321002(0x4c7)](-0x1c6c+0x1*-0x1a0b+0x3678)[_0x493082(0x2fa)]('\x20'));}catch{await _0x54378b['reply'](_0x493082(0x4ff)+_0x321002(0x1e4)+_0x321002(0x3f0),{'parse_mode':_0x493082(0x515)});return;}try{await _0x54378b['api'][_0x321002(0x275)+_0x321002(0x479)](_0x54378b[_0x321002(0x5e3)]['id'],'typing');const _0x593e49=await executeCustomTool(_0x145724,_0x29a954),_0x4bf16e=_0x593e49[_0x321002(0x1b9)]>-0xbf*0x1e+-0x1*-0x95d+0x18bd?_0x593e49[_0x321002(0x4c7)](0x1*0x9a+0x22b0+-0x11a5*0x2,0x2e*0x4+0xdc1+-0x2c1)+_0x493082(0x160):_0x593e49;await _0x54378b[_0x321002(0x191)](_0x493082(0x4cf)+_0x145724+_0x321002(0x1ed)+_0x4bf16e+_0x321002(0x8a),{'parse_mode':_0x321002(0x515)});}catch(_0x2d2438){const _0x231c84=_0x2d2438 instanceof Error?_0x2d2438[_0x321002(0x431)]:String(_0x2d2438);await _0x54378b[_0x321002(0x191)](_0x493082(0x53a)+'or:\x20'+_0x231c84);}return;}const _0x1e81b6=listCustomTools();if(_0x1e81b6[_0x321002(0x1b9)]===-0x3*0x74b+-0x2339+0x391a){await _0x54378b[_0x321002(0x191)](_0x321002(0x22f)+_0x321002(0x3c9)+('No\x20tools\x20c'+'onfigured.'+'\x0a')+(_0x321002(0x55b)+_0x493082(0x25c)+_0x321002(0x31d)+'example.md'+_0x493082(0x105)),{'parse_mode':'Markdown'});return;}const _0x131f49=_0x1e81b6[_0x321002(0x2fe)](_0x41130b=>{const _0x148637=_0x493082,_0x282b61=_0x493082,_0x49411a=_0x41130b[_0x148637(0x212)]===_0x282b61(0x361)?'🌐':'⚡';return _0x49411a+'\x20`'+_0x41130b['name']+_0x282b61(0x27b)+_0x41130b['descriptio'+'n'];});await _0x54378b[_0x493082(0x191)](_0x493082(0x22f)+'Tools\x20('+_0x1e81b6[_0x321002(0x1b9)]+'):*\x0a\x0a'+_0x131f49[_0x493082(0x2fa)]('\x0a')+'\x0a\x0a'+(_0x321002(0x1d7)+_0x493082(0x151)+_0x321002(0x633)+_0x493082(0x4e2)+'\x22}`_'),{'parse_mode':_0x321002(0x515)});}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x3ea),async _0x1c83df=>{const _0x1e1617=_0xa4a5c3,_0x28ac7e=_0xa4a5c3,_0x1d54ae=_0x1c83df[_0x1e1617(0x163)]?.[_0x28ac7e(0x268)]()['trim']();if(_0x1d54ae?.[_0x1e1617(0x319)]('call\x20')){const _0x3c5abe=_0x1d54ae[_0x28ac7e(0x4c7)](0xbfd+-0x65*-0x44+-0x26cc)[_0x28ac7e(0x42f)]()[_0x28ac7e(0x4d9)](/\s+/);if(_0x3c5abe[_0x1e1617(0x1b9)]<0x75a+0x7*-0x239+0x837){await _0x1c83df[_0x1e1617(0x191)](_0x28ac7e(0x5cd)+_0x28ac7e(0x45b)+_0x28ac7e(0x25a)+'ool>\x20{\x22arg'+_0x28ac7e(0x3bb)+'`',{'parse_mode':'Markdown'});return;}const [_0x1b8dec,_0x5a3c88,..._0xc4e5fc]=_0x3c5abe;let _0x3d48e7={};if(_0xc4e5fc[_0x1e1617(0x1b9)]>0xb0*0x7+-0x1df2+0x1922)try{_0x3d48e7=JSON[_0x1e1617(0x19d)](_0xc4e5fc[_0x28ac7e(0x2fa)]('\x20'));}catch{await _0x1c83df[_0x1e1617(0x191)](_0x1e1617(0x4ff)+_0x28ac7e(0x176)+_0x28ac7e(0x551)+'nts.');return;}try{await _0x1c83df[_0x28ac7e(0x330)]['sendChatAc'+'tion'](_0x1c83df[_0x1e1617(0x5e3)]['id'],_0x1e1617(0x596));const _0x46d9c5=await callMCPTool(_0x1b8dec,_0x5a3c88,_0x3d48e7),_0x378b3c=_0x46d9c5[_0x1e1617(0x1b9)]>-0x1221+-0x261d*0x1+0x43f6?_0x46d9c5[_0x1e1617(0x4c7)](0x28b*-0x9+0x2*-0xc4b+0x2f79,-0x2*-0x17b+0xd*0x59+-0x1*-0x43d)+_0x28ac7e(0x160):_0x46d9c5;await _0x1c83df['reply'](_0x28ac7e(0x4cf)+_0x1b8dec+'/'+_0x5a3c88+':*\x0a```\x0a'+_0x378b3c+_0x28ac7e(0x8a),{'parse_mode':'Markdown'});}catch(_0x328754){const _0x281ddb=_0x328754 instanceof Error?_0x328754[_0x28ac7e(0x431)]:String(_0x328754);await _0x1c83df[_0x28ac7e(0x191)](_0x1e1617(0xcc)+'r:\x20'+_0x281ddb);}return;}const _0x2334f8=getMCPStatus(),_0x1aaf8c=getMCPTools();if(_0x2334f8[_0x28ac7e(0x1b9)]===0x2e2*0x3+0xc7*0x1a+-0xe6e*0x2){await _0x1c83df[_0x1e1617(0x191)](_0x1e1617(0x3f1)+_0x1e1617(0x1b7)+_0x28ac7e(0x309)+_0x1e1617(0x1ac)+(_0x1e1617(0x28c)+_0x1e1617(0x119)+_0x28ac7e(0x35e))+(_0x1e1617(0xe6)+_0x1e1617(0x213)+_0x28ac7e(0x538)+'ocs/mcp.ex'+'ample.json'+_0x1e1617(0x105)),{'parse_mode':_0x28ac7e(0x515)});return;}const _0x5687f3=_0x2334f8['map'](_0xe38fbb=>{const _0x135c21=_0x1e1617,_0x3e00c6=_0x1e1617,_0x23fbbd=_0xe38fbb['connected']?'🟢':'🔴';return _0x23fbbd+'\x20*'+_0xe38fbb[_0x135c21(0x4eb)]+_0x3e00c6(0x129)+_0xe38fbb[_0x135c21(0x291)]+_0x135c21(0xfc);}),_0x476910=_0x1aaf8c[_0x28ac7e(0x1b9)]>0xb*0xfb+0x1fae+-0x2a77?'\x0a\x0a*Availab'+_0x1e1617(0x30e)+'\x0a'+_0x1aaf8c[_0x28ac7e(0x2fe)](_0x387676=>_0x28ac7e(0x9f)+_0x387676[_0x28ac7e(0x4c5)]+'/'+_0x387676[_0x1e1617(0x4eb)]+_0x1e1617(0x27b)+_0x387676['descriptio'+'n'])[_0x28ac7e(0x2fa)]('\x0a'):'';await _0x1c83df[_0x1e1617(0x191)](_0x1e1617(0x457)+'ver\x20('+_0x2334f8[_0x28ac7e(0x1b9)]+_0x1e1617(0x14b)+_0x5687f3[_0x1e1617(0x2fa)]('\x0a')+_0x476910+(_0x1e1617(0x20b)+'cp\x20call\x20<s'+_0x28ac7e(0x33a)+_0x28ac7e(0x5d2)+_0x1e1617(0x132)+_0x1e1617(0x3cb)),{'parse_mode':'Markdown'});}),_0x24722c[_0xa4a5c3(0x487)]('plugins',async _0x18d16e=>{const _0x4ed501=_0xa4a5c3,_0x50afd4=_0xa4a5c3,_0x5cca9a=getLoadedPlugins();if(_0x5cca9a[_0x4ed501(0x1b9)]===0x469*0x6+0xcd0+-0x13a3*0x2){await _0x18d16e['reply'](_0x50afd4(0xa8)+_0x4ed501(0x531)+'\x0a\x0a'+(_0x4ed501(0x648)+_0x50afd4(0x321)+getPluginsDir()+_0x50afd4(0x3cd))+(_0x4ed501(0x664)+_0x50afd4(0x5a7)+_0x50afd4(0x612)+_0x4ed501(0x53c)+_0x4ed501(0x1b4)),{'parse_mode':_0x50afd4(0x515)});return;}const _0x195535=_0x5cca9a['map'](_0x30aecd=>{const _0x11d707=_0x4ed501,_0x1e1c38=_0x50afd4,_0x18fbbc=_0x30aecd[_0x11d707(0x428)][_0x1e1c38(0x1b9)]>0x198b+-0xe*0x1ec+-0x1*-0x15d?_0x11d707(0x48f)+_0x1e1c38(0x459)+_0x30aecd[_0x1e1c38(0x428)]['join'](',\x20'):'',_0x2b0f6f=_0x30aecd[_0x11d707(0x291)][_0x1e1c38(0x1b9)]>0xef9+0x3*-0xbf+-0xcbc?_0x11d707(0xcd)+'\x20'+_0x30aecd['tools']['join'](',\x20'):'';return _0x11d707(0x20a)+_0x30aecd[_0x11d707(0x4eb)]+'*\x20v'+_0x30aecd[_0x11d707(0x403)]+_0x11d707(0x407)+_0x30aecd[_0x11d707(0x3a7)+'n']+_0x18fbbc+_0x2b0f6f;});await _0x18d16e['reply'](_0x50afd4(0x2ac)+_0x50afd4(0x167)+_0x5cca9a[_0x4ed501(0x1b9)]+'):*\x0a\x0a'+_0x195535[_0x50afd4(0x2fa)]('\x0a\x0a'),{'parse_mode':'Markdown'});}),_0x24722c['command'](_0x311a27(0x4cc),async _0x3a1a42=>{const _0x315eb7=_0xa4a5c3,_0x58efc0=_0xa4a5c3,{getSkills:_0x27424e}=await import('../service'+_0x315eb7(0x346)+'s'),_0x5987e0=_0x27424e();if(_0x5987e0[_0x315eb7(0x1b9)]===-0x13a*0x10+0xb2b*-0x1+-0x1*-0x1ecb){await _0x3a1a42['reply'](_0x315eb7(0x562)+_0x315eb7(0x470)+_0x58efc0(0x5a5)+'ILL.md\x20fil'+'es\x20to\x20the\x20'+_0x315eb7(0x108)+_0x58efc0(0x599),{'parse_mode':_0x315eb7(0x5a4)});return;}const _0x3034fc=_0x5987e0['map'](_0x4352fc=>_0x58efc0(0x4c0)+_0x4352fc[_0x58efc0(0x4eb)]+_0x315eb7(0x4f2)+_0x4352fc[_0x315eb7(0x2c3)]+_0x315eb7(0x2a7)+(_0x4352fc['descriptio'+'n']||_0x58efc0(0x5b6)+_0x58efc0(0x23e))+(_0x58efc0(0x5dd)+_0x58efc0(0x49d))+_0x4352fc['triggers'][_0x58efc0(0x4c7)](0x1a76+-0x9c*0x3f+0x1fd*0x6,0x1079*0x1+0x1*-0x257e+0x2*0xa85)[_0x315eb7(0x2fa)](',\x20'));await _0x3a1a42['reply'](_0x58efc0(0x38d)+_0x315eb7(0x24f)+_0x5987e0['length']+_0x58efc0(0x56b)+_0x3034fc[_0x58efc0(0x2fa)]('\x0a\x0a'),{'parse_mode':_0x315eb7(0x5a4)});}),_0x24722c[_0x311a27(0x487)](_0x311a27(0x9a),async _0x564e46=>{const _0x2d6646=_0xa4a5c3,_0x30a188=_0xa4a5c3,_0x255b02=listProfiles();if(_0x255b02[_0x2d6646(0x1b9)]===-0x9a2+0x18fa+-0xf58){await _0x564e46['reply'](_0x2d6646(0x663)+_0x2d6646(0x5c3)+_0x2d6646(0x635));return;}const _0x3c36b4=_0x255b02['map'](_0x286790=>{const _0x5dfc80=_0x2d6646,_0x109dc9=_0x30a188,_0x3cda3c=new Date(_0x286790[_0x5dfc80(0x1de)])[_0x109dc9(0x263)+_0x109dc9(0x136)]('en-US'),_0x3f80a4=_0x286790[_0x5dfc80(0x396)]?'👑':'👤';return _0x3f80a4+'\x20*'+_0x286790['name']+'*'+(_0x286790[_0x109dc9(0x2c9)]?_0x109dc9(0x2cf)+_0x286790[_0x5dfc80(0x2c9)]+')':'')+_0x109dc9(0x407)+_0x286790[_0x5dfc80(0x658)+'ges']+('\x20messages,'+'\x20last\x20acti'+'ve:\x20')+_0x3cda3c;});await _0x564e46[_0x2d6646(0x191)](_0x30a188(0x623)+'ofile\x20('+_0x255b02[_0x30a188(0x1b9)]+_0x30a188(0x14b)+_0x3c36b4[_0x2d6646(0x2fa)]('\x0a\x0a'),{'parse_mode':_0x30a188(0x515)});}),_0x24722c['command']('note',async _0x5a6bee=>{const _0x2bbc91=_0x311a27,_0x423739=_0xa4a5c3,_0x8b5fa8=_0x5a6bee[_0x2bbc91(0x163)]?.['toString']()[_0x2bbc91(0x42f)]();if(!_0x8b5fa8){await _0x5a6bee[_0x423739(0x191)]('📝\x20Use:\x20`/n'+_0x2bbc91(0x2bc)+'ame\x20Note\x20t'+_0x423739(0x52e)+'\x20a\x20note\x20ab'+_0x2bbc91(0x39b)+'.',{'parse_mode':_0x2bbc91(0x515)});return;}const _0x4fa22e=_0x8b5fa8[_0x2bbc91(0x163)](/^@?(\S+)\s+(.+)$/s);if(!_0x4fa22e){await _0x5a6bee[_0x2bbc91(0x191)](_0x2bbc91(0x5cd)+_0x423739(0x272)+_0x423739(0x378),{'parse_mode':_0x2bbc91(0x515)});return;}const [,_0x163fda,_0x39c568]=_0x4fa22e,_0x5aa915=listProfiles(),_0x9a645e=_0x5aa915['find'](_0x27569c=>_0x27569c[_0x2bbc91(0x2c9)]===_0x163fda||_0x27569c['userId'][_0x423739(0x268)]()===_0x163fda||_0x27569c[_0x423739(0x4eb)][_0x2bbc91(0x4a8)+'e']()===_0x163fda[_0x423739(0x4a8)+'e']());if(!_0x9a645e){await _0x5a6bee['reply'](_0x423739(0x237)+_0x163fda+(_0x2bbc91(0xf7)+'d.'));return;}addUserNote(_0x9a645e[_0x423739(0x5ff)],_0x39c568),await _0x5a6bee['reply'](_0x423739(0x52c)+_0x423739(0x2d2)+_0x9a645e['name']+'.');}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x8f),async _0x1a4704=>{const _0x2a0208=_0xa4a5c3,_0x250a8e=_0x311a27,_0x4c575a=_0x1a4704[_0x2a0208(0x163)]?.['toString']()[_0x2a0208(0x42f)]();if(!_0x4c575a){await _0x1a4704['reply'](_0x250a8e(0x205)+_0x2a0208(0x62b)+'rch\x20term>`'+'\x0aSemantic\x20'+_0x250a8e(0x62a)+_0x2a0208(0x5d6)+_0x2a0208(0x30c),{'parse_mode':_0x2a0208(0x515)});return;}try{await _0x1a4704[_0x250a8e(0x330)][_0x2a0208(0x275)+_0x250a8e(0x479)](_0x1a4704[_0x2a0208(0x5e3)]['id'],_0x2a0208(0x596));const _0x5a594c=await searchMemory(_0x4c575a,0xfa5+-0x3*-0xc50+-0x3490,-0x24ed+0x468+0x2085+0.25);if(_0x5a594c[_0x2a0208(0x1b9)]===-0x1*-0x1d79+-0x1bbd+-0x1bc){await _0x1a4704[_0x250a8e(0x191)](_0x250a8e(0x4e3)+_0x250a8e(0x290)+_0x2a0208(0x2ba)+_0x4c575a+'\x22.');return;}const _0x6e946d=_0x5a594c[_0x250a8e(0x2fe)]((_0x4a669b,_0x5ded31)=>{const _0x42a7fb=_0x2a0208,_0x5a5cab=_0x2a0208,_0x485e72=Math[_0x42a7fb(0x65d)](_0x4a669b[_0x5a5cab(0x351)]*(-0x2511+0xb62+0x1a13)),_0x1bd3a6=_0x4a669b[_0x5a5cab(0x11b)][_0x5a5cab(0x1b9)]>-0x4d*0x61+0xaad*-0x1+0xe*0x2e7?_0x4a669b[_0x42a7fb(0x11b)][_0x5a5cab(0x4c7)](-0x1*0x4ee+-0x5*-0x3d7+-0xe45,0x1*-0x332+-0x1080+-0x147a*-0x1)+_0x5a5cab(0x421):_0x4a669b[_0x42a7fb(0x11b)];return'**'+(_0x5ded31+(-0x166*0xe+-0xc51+0x1fe6))+_0x42a7fb(0x36d)+_0x485e72+'%)\x20_'+_0x4a669b['source']+'_\x0a'+_0x1bd3a6;});await _0x1a4704[_0x2a0208(0x191)](_0x2a0208(0x143)+'\x20for\x20\x22'+_0x4c575a+_0x2a0208(0x1e8)+_0x6e946d[_0x2a0208(0x2fa)]('\x0a\x0a'),{'parse_mode':'Markdown'});}catch(_0x5d8512){const _0x4e68ba=_0x5d8512 instanceof Error?_0x5d8512[_0x250a8e(0x431)]:String(_0x5d8512);await _0x1a4704['reply'](_0x2a0208(0x574)+_0x250a8e(0xc5)+_0x4e68ba);}}),_0x24722c[_0x311a27(0x487)]('remember',async _0x1850d7=>{const _0x10086c=_0x311a27,_0x56414a=_0xa4a5c3,_0x1c8afa=_0x1850d7[_0x10086c(0x163)]?.[_0x56414a(0x268)]()[_0x56414a(0x42f)]();if(!_0x1c8afa){await _0x1850d7[_0x10086c(0x191)]('💾\x20Use:\x20`/r'+_0x56414a(0x234)+'ext>`\x0aSave'+'s\x20somethin'+_0x56414a(0x5e2)+'mory.',{'parse_mode':_0x10086c(0x515)});return;}try{appendDailyLog('**Manually'+_0x10086c(0x3eb)+'d:**\x20'+_0x1c8afa);const _0x124e02=await reindexMemory();await _0x1850d7[_0x56414a(0x191)](_0x56414a(0x523)+_0x10086c(0x3a9)+_0x124e02[_0x56414a(0x42d)]+(_0x56414a(0xac)+_0x56414a(0x130)));}catch(_0x6a7525){const _0x2a32bc=_0x6a7525 instanceof Error?_0x6a7525[_0x10086c(0x431)]:String(_0x6a7525);await _0x1850d7[_0x56414a(0x191)](_0x10086c(0x452)+_0x56414a(0x1ef)+_0x2a32bc);}}),_0x24722c[_0x311a27(0x487)](_0x311a27(0x10f),async _0x36a055=>{const _0x56167d=_0x311a27,_0x4d6999=_0x311a27;try{await _0x36a055[_0x56167d(0x330)][_0x56167d(0x275)+_0x56167d(0x479)](_0x36a055[_0x4d6999(0x5e3)]['id'],_0x56167d(0x596));const _0x9b9a03=await reindexMemory(!![]),_0x411485=getIndexStats(),_0x5d681c=(_0x411485['sizeBytes']/(0x23eb+-0x2a1*0xb+-0x300))['toFixed'](-0x12bf+-0x104e+0x7*0x502);await _0x36a055[_0x56167d(0x191)](_0x56167d(0xb4)+_0x4d6999(0x446)+'\x0a\x0a'+(_0x4d6999(0x339)+_0x9b9a03[_0x56167d(0x317)]+('\x20chunks\x20pr'+'ocessed\x0a'))+('📁\x20'+_0x411485[_0x56167d(0x94)]+(_0x56167d(0x59a)+_0x56167d(0x258)))+(_0x4d6999(0x4ea)+_0x9b9a03[_0x56167d(0x42d)]+(_0x4d6999(0x4e8)+_0x4d6999(0x2dc)))+(_0x4d6999(0x31c)+'ze:\x20'+_0x5d681c+_0x4d6999(0x51b)));}catch(_0x99d678){const _0x2ee1bd=_0x99d678 instanceof Error?_0x99d678[_0x56167d(0x431)]:String(_0x99d678);await _0x36a055[_0x56167d(0x191)](_0x4d6999(0x32f)+'error:\x20'+_0x2ee1bd);}}),_0x24722c[_0xa4a5c3(0x487)](_0x311a27(0x148),async _0x271cd7=>{const _0x655e72=_0x311a27,_0x1f2d43=_0xa4a5c3,_0x7d1744=_0x271cd7[_0x655e72(0x163)]?.['toString']()[_0x655e72(0x42f)]()||'',_0x3f2fb3=_0x271cd7['from']['id'],_0x2d62fb=_0x271cd7[_0x1f2d43(0x5e3)]['id'];if(!_0x7d1744){const _0x511909=listJobs();if(_0x511909[_0x1f2d43(0x1b9)]===-0x74*-0x3e+0x1359+-0x2f71){await _0x271cd7[_0x1f2d43(0x191)](_0x1f2d43(0x1c1)+_0x1f2d43(0xf0)+_0x1f2d43(0x2e9)+_0x655e72(0x5a9)+'\x0a'+'Create:\x0a'+(_0x1f2d43(0x13a)+_0x1f2d43(0x1a4)+_0x655e72(0x220)+_0x655e72(0x601)+_0x655e72(0x607))+(_0x1f2d43(0x13a)+_0x655e72(0x17f)+'\x20*\x20*\x201\x22\x20sh'+'ell\x20pm2\x20st'+_0x655e72(0x365)+'>\x0a')+(_0x1f2d43(0x13a)+_0x655e72(0x12d)+_0x655e72(0x3b8)+_0x1f2d43(0x1d6)+_0x655e72(0x610)+_0x655e72(0x341)+_0x655e72(0x226))+('<i>Manage\x20'+'jobs\x20also\x20'+'in\x20the\x20Web'+_0x1f2d43(0x13c)+_0x1f2d43(0x60e)+'>'),{'parse_mode':_0x1f2d43(0x5a4)});return;}const _0x22f1a5=_0x511909[_0x1f2d43(0x2fe)](_0x494964=>{const _0x13d28b=_0x1f2d43,_0x2abadb=_0x1f2d43,_0x1d942c=_0x494964['enabled']?'🟢':'⏸️',_0x3aeb60=_0x494964[_0x13d28b(0x5dc)]?formatNextRun(_0x494964[_0x2abadb(0xb0)]):_0x2abadb(0x331),_0x5104b3=_0x494964[_0x2abadb(0x4fe)]?_0x13d28b(0x235):'',_0xd4a2d6=humanReadableSchedule(_0x494964[_0x13d28b(0x36a)]),_0x3b9caf=_0x494964[_0x2abadb(0x1be)]?_0x2abadb(0x60c):_0x13d28b(0x440)+_0xd4a2d6;return _0x1d942c+'\x20<b>'+_0x494964['name']+'</b>\x0a\x20\x20\x20📅\x20'+_0x3b9caf+_0x2abadb(0x1cc)+_0x3aeb60+_0x2abadb(0x48a)+_0x494964[_0x2abadb(0x40d)]+_0x5104b3+('\x20|\x20ID:\x20<co'+_0x2abadb(0x4dc))+_0x494964['id']+'</code>';}),_0x4659f6=new InlineKeyboard();for(const _0x40a7b1 of _0x511909){const _0x156662=_0x40a7b1[_0x1f2d43(0x5dc)]?'⏸\x20'+_0x40a7b1['name']:_0x655e72(0x2d5)+_0x40a7b1[_0x655e72(0x4eb)];_0x4659f6['text'](_0x156662,'cron:toggl'+'e:'+_0x40a7b1['id']),_0x4659f6[_0x1f2d43(0x11b)]('🗑',_0x1f2d43(0x556)+'e:'+_0x40a7b1['id']),_0x4659f6['row']();}await _0x271cd7['reply'](_0x655e72(0x1c1)+_0x655e72(0x25e)+_0x511909[_0x1f2d43(0x1b9)]+'):</b>\x0a\x0a'+_0x22f1a5[_0x655e72(0x2fa)]('\x0a\x0a')+'\x0a\x0a'+('Commands:\x20'+_0x1f2d43(0x159)+'·\x20delete\x20·'+_0x655e72(0x19e)+_0x1f2d43(0x211)),{'parse_mode':_0x1f2d43(0x5a4),'reply_markup':_0x4659f6});return;}if(_0x7d1744[_0x1f2d43(0x319)](_0x1f2d43(0x320))){let _0x47e613=_0x7d1744[_0x655e72(0x4c7)](-0x312*0x4+-0x624*-0x1+0x4*0x18a)[_0x1f2d43(0x42f)](),_0x453bcf;const _0x177eee=_0x47e613[_0x1f2d43(0x163)](/(^|\s)--timeout\s+(\S+)/);if(_0x177eee){const _0x59b992=_0x177eee[-0x124+0xcac+0xb86*-0x1][_0x1f2d43(0x4a8)+'e']();if([_0x655e72(0x587),_0x1f2d43(0x1c5),_0x655e72(0x34c),'-1','0'][_0x1f2d43(0x262)](_0x59b992))_0x453bcf=-(-0xf65+-0x114e+-0x34*-0xa1);else{const _0x711824=Number(_0x177eee[0x775*-0x1+0xae6+-0x36f]);if(!Number['isFinite'](_0x711824)||_0x711824<-0x1*0x14ba+0x1*-0x8ad+-0xc1*-0x27){await _0x271cd7[_0x1f2d43(0x191)](_0x1f2d43(0x4ff)+'<code>--ti'+_0x1f2d43(0x2b9)+_0x1f2d43(0x3e8)+_0x177eee[-0x590*0x3+-0x6b9*0x1+0x176b],{'parse_mode':'HTML'});return;}_0x453bcf=Math['floor'](_0x711824*(-0x47b*0x1+-0x1*-0x94+0x7cf));}_0x47e613=_0x47e613[_0x1f2d43(0x31f)](/(^|\s)--timeout\s+\S+/,'')[_0x655e72(0x42f)]();}const _0x40b019={'täglich':'0\x208\x20*\x20*\x20*','daily':_0x655e72(0x184),'stündlich':_0x655e72(0x2d1),'hourly':_0x655e72(0x2d1),'wöchentlich':'0\x208\x20*\x20*\x201','weekly':_0x1f2d43(0x588),'monatlich':'0\x208\x201\x20*\x20*','monthly':_0x655e72(0x4e6),'werktags':_0x655e72(0x87)+'5','weekdays':_0x1f2d43(0x87)+'5','wochenende':_0x655e72(0x46a)+',6','weekend':_0x1f2d43(0x46a)+',6','montags':'0\x208\x20*\x20*\x201','dienstags':_0x1f2d43(0x60b),'mittwochs':'0\x208\x20*\x20*\x203','donnerstags':_0x655e72(0x1d9),'freitags':_0x655e72(0x185),'samstags':_0x655e72(0xfe),'sonntags':_0x655e72(0x46a),'morgens':_0x655e72(0x184),'mittags':'0\x2012\x20*\x20*\x20*','abends':'0\x2018\x20*\x20*\x20*','nachts':_0x655e72(0xfd)};function _0x2e01a0(_0x26509a){const _0x4336d6=_0x655e72,_0x15b703=_0x655e72,_0x54ed41=_0x26509a['match'](/^(\d{1,2}):(\d{2})\s+(\S+)\s*(.*)/);if(_0x54ed41){const _0x266dc0=_0x54ed41[-0xc06+0x23aa+-0x17a1*0x1][_0x4336d6(0x4a8)+'e']();if(_0x40b019[_0x266dc0]){const _0x4682a7=_0x40b019[_0x266dc0][_0x15b703(0x4d9)]('\x20');return _0x4682a7[0xde0+0x12*-0x42+-0x93c]=String(parseInt(_0x54ed41[0x6a2*-0x2+0x1f6c+0x17*-0xca])),_0x4682a7[0x7f3+-0x139*0x1d+0x1b83*0x1]=String(parseInt(_0x54ed41[-0x161d+0x8*0x13a+0x627*0x2])),{'schedule':_0x4682a7[_0x15b703(0x2fa)]('\x20'),'rest':_0x54ed41[0x11b3*0x1+-0xc1*0x13+-0x35c]};}}const _0x11f42a=_0x26509a['match'](/^(\S+)\s+(\d{1,2}):(\d{2})\s*(.*)/);if(_0x11f42a){const _0x5de616=_0x11f42a[-0x212d+0x880+0x18ae]['toLowerCas'+'e']();if(_0x40b019[_0x5de616]){const _0x41d02c=_0x40b019[_0x5de616][_0x15b703(0x4d9)]('\x20');return _0x41d02c[-0x225c+0x1*-0x19a1+0x3bfd*0x1]=String(parseInt(_0x11f42a[-0x1*-0x1060+-0x1d74+0xd17])),_0x41d02c[-0x219a+-0x5e*-0x57+0x1a9]=String(parseInt(_0x11f42a[0x740+0x183d+-0x1f7b])),{'schedule':_0x41d02c['join']('\x20'),'rest':_0x11f42a[0x1223+-0x19c2*0x1+-0x7a3*-0x1]};}}const _0x5dbd17=_0x26509a[_0x15b703(0x4d9)]('\x20')[0x9a5+0x2233+0xb8*-0x3d][_0x4336d6(0x4a8)+'e']();if(_0x40b019[_0x5dbd17])return{'schedule':_0x40b019[_0x5dbd17],'rest':_0x26509a[_0x15b703(0x4c7)](_0x5dbd17[_0x4336d6(0x1b9)])['trim']()};return null;}let _0x500561,_0x12d6df;const _0x2b5d45=_0x2e01a0(_0x47e613);if(_0x2b5d45)_0x500561=_0x2b5d45[_0x1f2d43(0x36a)],_0x12d6df=_0x2b5d45[_0x655e72(0x3c4)];else{if(_0x47e613['startsWith']('\x22')){const _0x28efd5=_0x47e613['indexOf']('\x22',-0xbef*-0x3+-0xb7a+-0x1852);if(_0x28efd5<0xd*-0x152+-0x171*0x1b+0x3815){await _0x271cd7[_0x655e72(0x191)]('❌\x20Missing\x20'+'closing\x20qu'+_0x655e72(0x57e)+_0x1f2d43(0x25d)+_0x1f2d43(0x5ca));return;}_0x500561=_0x47e613[_0x1f2d43(0x4c7)](0x1*0x1b1+0x1338+-0x8*0x29d,_0x28efd5),_0x12d6df=_0x47e613[_0x655e72(0x4c7)](_0x28efd5+(-0x230*0x10+-0x21cc+0x13*0x39f))['trim']();}else{const _0x310be7=_0x47e613[_0x1f2d43(0x1fa)]('\x20');if(_0x310be7<-0x1c52+0x262d+0x3*-0x349){await _0x271cd7['reply'](_0x1f2d43(0x292)+'ode>/cron\x20'+_0x655e72(0x2a5)+_0x655e72(0x366)+'\x20&lt;type&'+'gt;\x20&lt;pa'+_0x655e72(0x480)+'[--timeout'+'\x20&lt;sec|o'+_0x1f2d43(0x53b)+_0x655e72(0x5f6)+_0x655e72(0x617)+_0x655e72(0xb8)+'ntervals:<'+_0x655e72(0x5d1)+_0x655e72(0xbf)+_0x655e72(0x5c2)+'al:</b>\x20da'+_0x655e72(0x52d)+_0x655e72(0x19b)+_0x1f2d43(0x2e8)+_0x1f2d43(0x465)+'\x20<b>With\x20t'+_0x655e72(0x26c)+':30\x20daily,'+_0x655e72(0x444)+_0x1f2d43(0x20c)+_0x1f2d43(0x569)+_0x655e72(0x579)+_0x1f2d43(0x11c)+'ch,\x20morgen'+_0x1f2d43(0x1a0)+_0x1f2d43(0x162)+_0x1f2d43(0x507)+_0x1f2d43(0x2d9)+_0x1f2d43(0x1cb)+_0x1f2d43(0x544)+_0x655e72(0xe1)+_0x655e72(0x4a1)+_0x1f2d43(0x1aa)+_0x655e72(0x3b1)+_0x1f2d43(0x261)+_0x1f2d43(0x1f1)+_0x1f2d43(0x4da)+_0x1f2d43(0x307),{'parse_mode':'HTML'});return;}_0x500561=_0x47e613['slice'](0x9c2+0x171c+-0x20de,_0x310be7),_0x12d6df=_0x47e613['slice'](_0x310be7+(0x1b65*0x1+-0xb9*-0x2+-0x1cd6))[_0x1f2d43(0x42f)]();}}const _0x32e26b=_0x12d6df['indexOf']('\x20'),_0x507282=_0x32e26b>=0xc7*-0x19+0x155*0x4+-0x17*-0x9d?_0x12d6df[_0x1f2d43(0x4c7)](0x14f9+-0x1554*0x1+0x5b,_0x32e26b):_0x12d6df,_0x42e251=_0x32e26b>=0x1*-0x1b8f+0x12b3+0xa2*0xe?_0x12d6df[_0x655e72(0x4c7)](_0x32e26b+(-0x1935+0x3af*-0x5+0x2ba1))['trim']():'',_0xb46925=[_0x655e72(0x39c),_0x655e72(0x216),_0x1f2d43(0x361),_0x1f2d43(0x431),_0x1f2d43(0x294)];if(!_0xb46925['includes'](_0x507282)){await _0x271cd7[_0x655e72(0x191)](_0x655e72(0x4ff)+_0x1f2d43(0x7c)+_0x507282+('\x22.\x20Allowed'+':\x20')+_0xb46925[_0x655e72(0x2fa)](',\x20'));return;}const _0x289b1c={};switch(_0x507282){case _0x655e72(0x39c):case'message':_0x289b1c[_0x1f2d43(0x11b)]=_0x42e251;break;case'shell':_0x289b1c[_0x655e72(0x487)]=_0x42e251;break;case _0x1f2d43(0x361):_0x289b1c['url']=_0x42e251;break;case _0x1f2d43(0x294):_0x289b1c[_0x655e72(0x335)]=_0x42e251;break;}const _0x1afef6=_0x507282+':\x20'+_0x42e251[_0x1f2d43(0x4c7)](-0x7*0x39b+-0x2382+-0x3cbf*-0x1,-0xb*0x25+0x1182+-0xfcd)+(_0x42e251[_0x1f2d43(0x1b9)]>-0x1*-0x8f3+-0x1b04+0x122f?_0x1f2d43(0x421):''),_0x164101=createJob({'name':_0x1afef6,'type':_0x507282,'schedule':_0x500561,'payload':_0x289b1c,'target':{'platform':'telegram','chatId':String(_0x2d62fb)},'createdBy':_0x655e72(0x47b)+_0x3f2fb3,..._0x453bcf!==undefined?{'timeoutMs':_0x453bcf}:{}}),_0x1bcb2a=humanReadableSchedule(_0x164101[_0x655e72(0x36a)]),_0x4c4d72=typeof _0x164101[_0x655e72(0x274)]===_0x655e72(0x2d7)?_0x164101[_0x1f2d43(0x274)]<=0x20b1+-0x9fd+-0x4*0x5ad?_0x655e72(0x1e6)+_0x1f2d43(0x60a)+_0x655e72(0x535):_0x655e72(0x1e6)+_0x655e72(0x652)+Math[_0x655e72(0x65d)](_0x164101[_0x1f2d43(0x274)]/(0x3b*0x8b+-0x1*0xec9+-0xd58))+'s\x0a':'';await _0x271cd7['reply']('✅\x20<b>Cron\x20'+_0x1f2d43(0x37a)+_0x655e72(0x17d)+(_0x655e72(0x52f)+_0x1f2d43(0x190)+_0x164101[_0x1f2d43(0x4eb)]+'\x0a')+('📅\x20<b>'+_0x1bcb2a+_0x655e72(0x286))+(_0x1f2d43(0x140)+_0x655e72(0x190)+_0x164101[_0x1f2d43(0x212)]+'\x0a')+_0x4c4d72+(_0x1f2d43(0x641)+_0x1f2d43(0x58c)+formatNextRun(_0x164101[_0x1f2d43(0xb0)])+'\x0a')+('<b>ID:</b>'+_0x1f2d43(0x492)+_0x164101['id']+_0x655e72(0x2d6)),{'parse_mode':_0x1f2d43(0x5a4)});return;}if(_0x7d1744[_0x655e72(0x319)](_0x655e72(0x49a))){const _0x379ecd=_0x7d1744[_0x655e72(0x4c7)](0x1f7e+0x1*0x1a69+-0x10*0x39e)[_0x1f2d43(0x42f)]();deleteJob(_0x379ecd)?await _0x271cd7[_0x1f2d43(0x191)](_0x655e72(0x98)+_0x379ecd+_0x655e72(0x156),{'parse_mode':_0x1f2d43(0x515)}):await _0x271cd7[_0x655e72(0x191)](_0x655e72(0x4f1)+_0x379ecd+(_0x1f2d43(0x33e)+'d.'),{'parse_mode':_0x655e72(0x515)});return;}if(_0x7d1744[_0x1f2d43(0x319)](_0x655e72(0x1ae))){const _0x13a39d=_0x7d1744[_0x1f2d43(0x4c7)](0x3*0xb2b+-0x6*-0x1eb+-0x2*0x167e)[_0x655e72(0x42f)](),_0x588ad3=toggleJob(_0x13a39d);_0x588ad3?await _0x271cd7['reply']((_0x588ad3[_0x1f2d43(0x5dc)]?'▶️':'⏸️')+_0x655e72(0x295)+_0x588ad3[_0x1f2d43(0x4eb)]+'\x22\x20'+(_0x588ad3[_0x1f2d43(0x5dc)]?_0x655e72(0x5dc):'paused')+'.'):await _0x271cd7[_0x1f2d43(0x191)]('❌\x20Job\x20not\x20'+'found.');return;}if(_0x7d1744['startsWith'](_0x1f2d43(0x3fa))){const _0x47d392=_0x7d1744['slice'](0x1e41+-0x20b8+0x27b)[_0x1f2d43(0x42f)](),_0x5aa865=resolveJobByNameOrId(listJobs(),_0x47d392);if(!_0x5aa865){const _0x769a30=listJobs(),_0xaa143d=_0x769a30[_0x655e72(0x1b9)]>-0x1a38+-0xac1*-0x2+0x4b6?_0x1f2d43(0x1c9)+_0x655e72(0x284)+_0x769a30[_0x655e72(0x4c7)](-0xd20+0x369+-0x3*-0x33d,0x3*0x635+0x122b+0xe*-0x2a0)['map'](_0x60c98=>'•\x20'+_0x60c98[_0x1f2d43(0x4eb)])['join']('\x0a'):'';await _0x271cd7[_0x655e72(0x191)](_0x655e72(0x21b)+_0x655e72(0x1e2)+_0x655e72(0x4dc)+_0x47d392+_0x1f2d43(0x5d4)+_0xaa143d,{'parse_mode':'HTML'});return;}const _0xb2f5ca=_0x5aa865[_0x1f2d43(0x4eb)],_0x4773dc=Date[_0x1f2d43(0x383)]();let _0x4c8e6b=null;try{const _0x21986e=await _0x271cd7[_0x1f2d43(0x191)](_0x655e72(0x203)+'*'+escapeMarkdown(_0xb2f5ca)+(_0x655e72(0xbb)+'g…'),{'parse_mode':_0x1f2d43(0x515)});_0x4c8e6b=_0x21986e['message_id'];}catch(_0x599c74){try{const _0x536da7=await _0x271cd7['reply'](_0x655e72(0x203)+_0xb2f5ca+(_0x1f2d43(0x3ab)+'…'));_0x4c8e6b=_0x536da7['message_id'];}catch{}}const _0x48e02a=_0x271cd7[_0x1f2d43(0x5e3)]['id'],_0x53bdad=setInterval(async()=>{const _0x28e679=_0x655e72,_0x9a7212=_0x655e72;if(_0x4c8e6b===null)return;const _0x10b770=Math[_0x28e679(0x207)]((Date[_0x9a7212(0x383)]()-_0x4773dc)/(-0x4b2*0x3+-0x1331*-0x1+0x133*-0x1));try{await _0x271cd7['api']['editMessag'+_0x28e679(0x16f)](_0x48e02a,_0x4c8e6b,buildTickerText(_0xb2f5ca,_0x10b770),{'parse_mode':_0x28e679(0x515)});}catch(_0x5dfe61){!isHarmlessTelegramError(_0x5dfe61)&&console[_0x9a7212(0x16e)]('[cron:run]'+'\x20ticker\x20ed'+_0x9a7212(0x5c9),_0x5dfe61);}},0x2e*-0x384+0x13e8c+-0xb14*-0x7);let _0x1f1349;try{_0x1f1349=await runJobNow(_0x47d392);}finally{clearInterval(_0x53bdad);}const _0x1c2656=Math[_0x655e72(0x207)]((Date['now']()-_0x4773dc)/(-0xbe2+-0xfc9+0x1*0x1f93)),_0x5bfe85=((()=>{const _0x135564=_0x1f2d43,_0x3764e5=_0x1f2d43;if(_0x1f1349[_0x135564(0x79)]===_0x135564(0x1c7))return'❌\x20'+escapeMarkdown(_0xb2f5ca)+(_0x3764e5(0x3bc)+'nd\x20(race?)');if(_0x1f1349['status']==='already-ru'+'nning')return buildDoneText(_0x1f1349[_0x3764e5(0x560)]['name'],_0x1c2656,{'ok':!![],'skipped':!![]});return buildDoneText(_0x1f1349[_0x3764e5(0x560)][_0x3764e5(0x4eb)],_0x1c2656,{'ok':!_0x1f1349[_0x135564(0x653)],'error':_0x1f1349[_0x135564(0x653)]});})());if(_0x4c8e6b!==null)try{await _0x271cd7['api'][_0x655e72(0x33b)+_0x1f2d43(0x16f)](_0x48e02a,_0x4c8e6b,_0x5bfe85,{'parse_mode':_0x655e72(0x515)});}catch(_0x1a6b9e){!isHarmlessTelegramError(_0x1a6b9e)&&await _0x271cd7[_0x655e72(0x191)](_0x5bfe85)[_0x1f2d43(0x53e)](()=>{});}else await _0x271cd7['reply'](_0x5bfe85,{'parse_mode':_0x1f2d43(0x515)})['catch'](()=>_0x271cd7['reply'](_0x5bfe85));return;}await _0x271cd7['reply'](_0x1f2d43(0x5d0)+'on\x20command'+'.\x20Use\x20/cro'+_0x1f2d43(0x32e)+'.');}),_0x24722c[_0x311a27(0x453)+'ery'](/^cron:toggle:(.+)$/,async _0x3f0713=>{const _0x51a5e3=_0x311a27,_0x59d31f=_0x311a27,_0x534566=_0x3f0713[_0x51a5e3(0x163)][0x1*0x8c1+0x1ccf+-0x258f],_0x5b6ee9=toggleJob(_0x534566);if(_0x5b6ee9){await _0x3f0713[_0x51a5e3(0x250)+_0x59d31f(0x202)]((_0x5b6ee9[_0x59d31f(0x5dc)]?_0x51a5e3(0x4b2):_0x51a5e3(0x1f5))+':\x20'+_0x5b6ee9[_0x59d31f(0x4eb)]),_0x3f0713[_0x59d31f(0x163)]='';const _0x3a9b90=listJobs(),_0x42efb7=_0x3a9b90[_0x51a5e3(0x2fe)](_0x44d861=>{const _0x8b82e9=_0x51a5e3,_0x317e26=_0x59d31f,_0x34109a=_0x44d861[_0x8b82e9(0x5dc)]?'🟢':'⏸️',_0x5f52b7=_0x44d861[_0x8b82e9(0x5dc)]?formatNextRun(_0x44d861[_0x317e26(0xb0)]):_0x317e26(0x331),_0x30cc2d=humanReadableSchedule(_0x44d861[_0x8b82e9(0x36a)]),_0x4d48be=_0x44d861['oneShot']?_0x317e26(0x60c):'🔄\x20'+_0x30cc2d;return _0x34109a+_0x317e26(0xe2)+_0x44d861['name']+_0x8b82e9(0x628)+_0x4d48be+_0x8b82e9(0x1cc)+_0x5f52b7+_0x8b82e9(0x48a)+_0x44d861[_0x8b82e9(0x40d)]+('\x20|\x20ID:\x20<co'+_0x8b82e9(0x4dc))+_0x44d861['id']+_0x317e26(0x2d6);}),_0x47b70e=new InlineKeyboard();for(const _0x2a51f9 of _0x3a9b90){_0x47b70e[_0x51a5e3(0x11b)](_0x2a51f9['enabled']?'⏸\x20'+_0x2a51f9[_0x51a5e3(0x4eb)]:_0x59d31f(0x2d5)+_0x2a51f9['name'],_0x59d31f(0x4ef)+'e:'+_0x2a51f9['id']),_0x47b70e['text']('🗑',_0x51a5e3(0x556)+'e:'+_0x2a51f9['id']),_0x47b70e['row']();}await _0x3f0713[_0x59d31f(0x33b)+_0x59d31f(0x16f)](_0x59d31f(0x1c1)+_0x59d31f(0x25e)+_0x3a9b90[_0x59d31f(0x1b9)]+_0x51a5e3(0x56b)+_0x42efb7[_0x59d31f(0x2fa)]('\x0a\x0a'),{'parse_mode':_0x51a5e3(0x5a4),'reply_markup':_0x47b70e});}}),_0x24722c['callbackQu'+_0xa4a5c3(0x24b)](/^cron:delete:(.+)$/,async _0x594244=>{const _0x1f24d1=_0xa4a5c3,_0x13ae97=_0x311a27,_0x392ae0=_0x594244['match'][-0x1b3b+0x3*0x259+0x1431];deleteJob(_0x392ae0),await _0x594244[_0x1f24d1(0x250)+_0x1f24d1(0x202)](_0x13ae97(0x1bd));const _0x7893c8=listJobs();if(_0x7893c8[_0x13ae97(0x1b9)]===0x14f*-0x1d+0xfae+0x1645)await _0x594244[_0x1f24d1(0x33b)+'eText'](_0x13ae97(0x3f8)+_0x13ae97(0x665)+_0x13ae97(0x3d4));else{const _0x47b29b=_0x7893c8[_0x13ae97(0x2fe)](_0x373faf=>{const _0x4affde=_0x1f24d1,_0x57d495=_0x13ae97,_0x3adbf8=_0x373faf[_0x4affde(0x5dc)]?'🟢':'⏸️',_0x13c236=humanReadableSchedule(_0x373faf[_0x57d495(0x36a)]);return _0x3adbf8+_0x57d495(0xe2)+_0x373faf['name']+_0x57d495(0x628)+_0x13c236+(_0x57d495(0xd7)+_0x57d495(0x4dc))+_0x373faf['id']+'</code>';}),_0x4f3b0c=new InlineKeyboard();for(const _0x319948 of _0x7893c8){_0x4f3b0c[_0x1f24d1(0x11b)](_0x319948['enabled']?'⏸\x20'+_0x319948['name']:_0x1f24d1(0x2d5)+_0x319948[_0x1f24d1(0x4eb)],_0x1f24d1(0x4ef)+'e:'+_0x319948['id']),_0x4f3b0c[_0x1f24d1(0x11b)]('🗑','cron:delet'+'e:'+_0x319948['id']),_0x4f3b0c[_0x13ae97(0x413)]();}await _0x594244[_0x1f24d1(0x33b)+_0x1f24d1(0x16f)](_0x13ae97(0x1c1)+'Jobs\x20('+_0x7893c8['length']+'):</b>\x0a\x0a'+_0x47b29b[_0x1f24d1(0x2fa)]('\x0a\x0a'),{'parse_mode':'HTML','reply_markup':_0x4f3b0c});}}),_0x24722c['command']('setup',async _0x57c003=>{const _0x3435b8=_0xa4a5c3,_0x542aae=_0xa4a5c3,_0x37b3ad=_0x57c003['match']?.[_0x3435b8(0x268)]()[_0x3435b8(0x42f)]()||'';if(!_0x37b3ad){const _0x3ec549=getRegistry(),_0x54a2dd=await _0x3ec549[_0x3435b8(0x153)](),_0x398c17=_0x3ec549['getActive']()[_0x3435b8(0x288)](),_0xa461c7=new InlineKeyboard()[_0x542aae(0x11b)](_0x542aae(0x273)+'PI\x20Keys',_0x3435b8(0x59c))['row']()[_0x3435b8(0x11b)]('📱\x20Platform'+'s',_0x3435b8(0x139)+'forms')[_0x542aae(0x413)]()[_0x3435b8(0x11b)](_0x542aae(0x26a)+'dmin\x20Acces'+'s',_0x542aae(0x133))[_0x542aae(0x413)]()['text'](_0x3435b8(0x44b)+_0x3435b8(0x42e)+_0x3435b8(0x9b),'setup:perm'+'issions')[_0x542aae(0x413)]()[_0x542aae(0x11b)](_0x3435b8(0x530)+_0x542aae(0xd9),_0x3435b8(0x1ff))['row']();await _0x57c003[_0x3435b8(0x191)](_0x3435b8(0x3c5)+_0x3435b8(0x508)+'\x0a'+(_0x542aae(0xad)+'del:*\x20'+_0x398c17[_0x542aae(0x4eb)]+'\x0a')+(_0x542aae(0x194)+_0x542aae(0xc9)+_0x54a2dd['length']+(_0x542aae(0x119)+'d\x0a'))+('*Web\x20UI:*\x20'+_0x542aae(0x1c8)+_0x542aae(0x50c)+(process[_0x3435b8(0x600)]['WEB_PORT']||0xd*-0x1f+0x2500+-0x1751)+'\x0a\x0a')+(_0x3435b8(0x214)+_0x3435b8(0x578)+_0x3435b8(0x380)+_0x3435b8(0x406)),{'parse_mode':_0x3435b8(0x515),'reply_markup':_0xa461c7});return;}if(_0x37b3ad['startsWith'](_0x3435b8(0x2eb))){const _0x4bf096=_0x37b3ad[_0x3435b8(0x4c7)](-0x21a+0x1628+-0x140a)[_0x542aae(0x42f)]();if(!_0x4bf096){const _0x48f30b=await getSudoStatus(),_0x4e77e3=_0x48f30b[_0x3435b8(0x5c1)]?_0x48f30b[_0x542aae(0xdf)]?'✅':'⚠️':'❌',_0x3799f1=new InlineKeyboard();_0x48f30b['configured']&&(_0x3799f1[_0x542aae(0x11b)](_0x542aae(0x4bb),_0x3435b8(0x5b9)+'y')[_0x3435b8(0x413)](),_0x3799f1[_0x3435b8(0x11b)](_0x542aae(0x575)+_0x542aae(0x2b7),_0x542aae(0x1fc)+'e')[_0x3435b8(0x413)]());await _0x57c003[_0x3435b8(0x191)](_0x542aae(0xd4)+_0x3435b8(0x5c8)+_0x542aae(0x389)+(_0x3435b8(0x20d)+_0x4e77e3+'\x20'+(_0x48f30b[_0x3435b8(0x5c1)]?_0x48f30b[_0x542aae(0xdf)]?_0x3435b8(0x2f7)+'\x20&\x20verifie'+'d':'Configured'+',\x20not\x20veri'+'fied':'Not\x20set\x20up')+'\x0a')+(_0x3435b8(0x5b1)+'\x20'+_0x48f30b[_0x542aae(0xba)+_0x3435b8(0x580)]+'\x0a')+(_0x542aae(0x583)+_0x48f30b[_0x3435b8(0x2ee)]+'\x20('+_0x48f30b[_0x3435b8(0x16c)]+')\x0a')+(_0x48f30b[_0x542aae(0x10e)+'s'][_0x3435b8(0x102)+'ity']!==null?_0x3435b8(0x512)+'lity:*\x20'+(_0x48f30b[_0x3435b8(0x10e)+'s'][_0x542aae(0x102)+_0x3435b8(0x110)]?'✅':'❌')+'\x0a':'')+(_0x48f30b[_0x3435b8(0x10e)+'s'][_0x3435b8(0x611)+_0x3435b8(0x1ad)]!==null?_0x542aae(0x3df)+'\x20Access:*\x20'+(_0x48f30b[_0x542aae(0x10e)+'s'][_0x3435b8(0x611)+_0x542aae(0x1ad)]?'✅':'❌')+'\x0a':'')+(_0x3435b8(0x584)+_0x3435b8(0x5f3)+_0x3435b8(0x5fa)+'ystem-pass'+_0x542aae(0x553))+(_0x542aae(0x4c1)+_0x542aae(0x4aa)+_0x542aae(0x408)+'ed\x20in\x20'+_0x48f30b[_0x3435b8(0xba)+_0x542aae(0x580)]+'.\x20')+(_0x3435b8(0x5e0)+'s\x20Alvin\x20Bo'+_0x3435b8(0xea)+_0x3435b8(0x11e)+_0x3435b8(0xe3)+_0x3435b8(0xca)+_0x542aae(0x35f)+_0x542aae(0x1a6)+'tings,\x20etc'+'.)._\x0a\x0a')+(_0x542aae(0x5f8)+'this\x20messa'+_0x3435b8(0x14f)+_0x542aae(0x4d7)+_0x542aae(0x1c2)+_0x3435b8(0x1c4)+_0x3435b8(0x4f5)+'story._'),{'parse_mode':_0x542aae(0x515),'reply_markup':_0x3799f1});return;}await _0x57c003[_0x542aae(0x330)][_0x3435b8(0x275)+'tion'](_0x57c003[_0x542aae(0x5e3)]['id'],_0x3435b8(0x596));const _0x42f0ef=storePassword(_0x4bf096);if(!_0x42f0ef['ok']){await _0x57c003[_0x3435b8(0x191)](_0x542aae(0x452)+_0x542aae(0x1ef)+_0x42f0ef[_0x542aae(0x653)]);return;}const _0x13a84c=await verifyPassword();_0x13a84c['ok']?await _0x57c003[_0x3435b8(0x191)](_0x3435b8(0x458)+_0x3435b8(0x554)+'gured!*\x0a\x0a'+(_0x542aae(0xa3)+'tored\x20in:\x20'+_0x42f0ef[_0x3435b8(0x28d)]+'\x0a')+(_0x3435b8(0x32a)+_0x3435b8(0x34f)+_0x542aae(0x32c))+('Alvin\x20Bot\x20'+_0x3435b8(0xa7)+_0x542aae(0x173)+_0x542aae(0x4d2))+(_0x542aae(0x643)+_0x3435b8(0x3e4)+_0x3435b8(0x183)+_0x542aae(0x186)+'ssword\x20fro'+_0x3435b8(0x230)+'!_'),{'parse_mode':_0x542aae(0x515)}):(revokePassword(),await _0x57c003['reply']('❌\x20*Wrong\x20p'+_0x542aae(0x4d3)+'\x0a'+(_0x3435b8(0x559)+_0x3435b8(0x441)+_0x542aae(0x179)+_0x3435b8(0x24a)+_0x3435b8(0x4e0))+(_0x3435b8(0x4a5)+_0x3435b8(0x146)+_0x3435b8(0x2cb)+_0x542aae(0x5ba)+_0x542aae(0x61f)),{'parse_mode':_0x3435b8(0x515)}));try{await _0x57c003[_0x3435b8(0x330)][_0x542aae(0x30f)+_0x3435b8(0x5cc)](_0x57c003['chat']['id'],_0x57c003['message'][_0x3435b8(0x429)]);}catch{}return;}if(_0x37b3ad[_0x542aae(0x319)]('key\x20')){const _0xdbfe76=_0x37b3ad['slice'](0x161*0x1b+0x1244+0x377b*-0x1)[_0x3435b8(0x42f)]()[_0x542aae(0x4d9)](/\s+/);if(_0xdbfe76[_0x3435b8(0x1b9)]<-0x506*0x7+0x259+0x20d3){await _0x57c003[_0x542aae(0x191)](_0x542aae(0x3ae)+_0x3435b8(0x4bd)+(_0x3435b8(0x490)+'y\x20openai\x20s'+_0x3435b8(0xe5))+('`/setup\x20ke'+_0x3435b8(0x107)+_0x3435b8(0x384))+('`/setup\x20ke'+_0x3435b8(0x3a5)+_0x542aae(0x239))+(_0x3435b8(0x490)+'y\x20openrout'+_0x542aae(0x3af)+_0x542aae(0x50d))+(_0x542aae(0xf5)+_0x542aae(0x4ba)+_0x542aae(0x63d)+_0x542aae(0x2c5)+_0x542aae(0xf9)),{'parse_mode':_0x542aae(0x515)});return;}const _0x6eb95f={'openai':_0x542aae(0x43e)+_0x3435b8(0x37e),'google':'GOOGLE_API'+_0x542aae(0x37e),'nvidia':_0x3435b8(0x4ca)+_0x542aae(0x37e),'openrouter':'OPENROUTER'+_0x3435b8(0x3a8),'groq':_0x542aae(0x63f)+'EY'},_0x10df46=_0xdbfe76[-0x8fd+0x1a5*0x4+0x269]['toLowerCas'+'e'](),_0x1f037d=_0xdbfe76['slice'](-0x47*-0x61+0xc50+-0x15*0x1de)[_0x3435b8(0x2fa)]('\x20'),_0x29ce93=_0x6eb95f[_0x10df46];if(!_0x29ce93){await _0x57c003[_0x3435b8(0x191)](_0x3435b8(0x48d)+_0x3435b8(0x1d1)+_0x10df46+'\x22.\x20Use:\x20'+Object['keys'](_0x6eb95f)[_0x542aae(0x2fa)](',\x20'));return;}const _0x3cb7d7=resolve(process[_0x542aae(0x51a)](),_0x3435b8(0x545));let _0x120f11=_0x40611e[_0x3435b8(0x449)](_0x3cb7d7)?_0x40611e[_0x542aae(0x187)+'nc'](_0x3cb7d7,_0x3435b8(0x165)):'';const _0x393c16=new RegExp('^'+_0x29ce93+'=.*$','m');if(_0x393c16[_0x542aae(0x2d3)](_0x120f11))_0x120f11=_0x120f11[_0x542aae(0x31f)](_0x393c16,_0x29ce93+'='+_0x1f037d);else _0x120f11=_0x120f11['trimEnd']()+('\x0a'+_0x29ce93+'='+_0x1f037d+'\x0a');_0x40611e[_0x542aae(0x371)+_0x3435b8(0x174)](_0x3cb7d7,_0x120f11),await _0x57c003[_0x3435b8(0x191)]('✅\x20'+_0x29ce93+('\x20saved!\x20Pl'+_0x542aae(0x46d)+_0x3435b8(0x1ea)+'\x20(/system\x20'+_0x542aae(0x4ae)+_0x3435b8(0x269)));return;}}),_0x24722c[_0x311a27(0x453)+'ery'](/^sudo:(.+)$/,async _0x5b3379=>{const _0x367a24=_0x311a27,_0x11fab0=_0x311a27,_0x2decc9=_0x5b3379[_0x367a24(0x163)][0x1192*0x1+-0x13ab+0x2*0x10d];if(_0x2decc9===_0x11fab0(0x412)){const _0x34d5fd=await verifyPassword();await _0x5b3379[_0x367a24(0x250)+_0x367a24(0x202)](_0x34d5fd['ok']?_0x11fab0(0x52b)+_0x367a24(0x121):'❌\x20'+_0x34d5fd[_0x367a24(0x653)]);}else _0x2decc9===_0x11fab0(0x177)&&(revokePassword(),await _0x5b3379[_0x11fab0(0x33b)+_0x11fab0(0x16f)](_0x367a24(0x3ba)+'ess\x20revoke'+_0x367a24(0x4bf)+'d\x20deleted.'),await _0x5b3379[_0x11fab0(0x250)+'backQuery'](_0x11fab0(0x44a)+_0x11fab0(0x193)));}),_0x24722c['callbackQu'+'ery'](/^setup:(.+)$/,async _0x44ef12=>{const _0x26c89c=_0xa4a5c3,_0x38af67=_0x311a27,_0x56bfae=_0x44ef12[_0x26c89c(0x163)][0x19ed+0x1b4+-0x1ba0];switch(_0x56bfae){case'keys':{const _0x5ecc98=[{'name':_0x26c89c(0x43b),'env':_0x38af67(0x43e)+_0x26c89c(0x37e),'has':!!config[_0x38af67(0x323)][_0x26c89c(0x270)]},{'name':_0x38af67(0x103),'env':_0x26c89c(0x3e7)+_0x26c89c(0x37e),'has':!!config['apiKeys'][_0x26c89c(0x289)]},{'name':_0x26c89c(0x1c0),'env':'NVIDIA_API'+_0x26c89c(0x37e),'has':!!config[_0x26c89c(0x323)][_0x38af67(0x26e)]},{'name':_0x26c89c(0x188),'env':_0x26c89c(0x201)+_0x38af67(0x3a8),'has':!!config[_0x38af67(0x323)][_0x38af67(0x627)]},{'name':_0x38af67(0x1d8),'env':_0x26c89c(0x63f)+'EY','has':!!config['apiKeys'][_0x26c89c(0x2e4)]}],_0x13995e=_0x5ecc98[_0x38af67(0x2fe)](_0x2dc8da=>(_0x2dc8da['has']?'✅':'❌')+'\x20*'+_0x2dc8da[_0x26c89c(0x4eb)]+'*\x20—\x20`'+_0x2dc8da[_0x38af67(0x600)]+'`');await _0x44ef12[_0x38af67(0x33b)+_0x26c89c(0x16f)](_0x26c89c(0xd6)+_0x38af67(0x4df)+_0x13995e[_0x38af67(0x2fa)]('\x0a')+'\x0a\x0a'+(_0x38af67(0xda)+'/setup\x20key'+_0x26c89c(0x4f3)+'>\x20<key>`\x0a')+(_0x26c89c(0x501)+_0x26c89c(0x566)+_0x26c89c(0x3a0)+_0x38af67(0x4fa))+(_0x26c89c(0x5aa)+_0x26c89c(0x2ae)+_0x38af67(0x4e7)+_0x38af67(0x5b8)),{'parse_mode':'Markdown'});break;}case _0x38af67(0x255):{const _0x56e1c3=[{'name':_0x26c89c(0x557),'icon':'📱','env':'BOT_TOKEN','has':!!process[_0x38af67(0x600)]['BOT_TOKEN']},{'name':'Discord','icon':'🎮','env':'DISCORD_TO'+_0x26c89c(0x437),'has':!!process[_0x38af67(0x600)]['DISCORD_TO'+_0x26c89c(0x437)]},{'name':_0x38af67(0x3ca),'icon':'💬','env':_0x38af67(0x38b)+_0x26c89c(0x416),'has':process['env'][_0x26c89c(0x38b)+'NABLED']===_0x26c89c(0x513)},{'name':'Signal','icon':'🔒','env':_0x26c89c(0x5cb)+_0x26c89c(0x1d2),'has':!!process[_0x26c89c(0x600)][_0x38af67(0x5cb)+_0x26c89c(0x1d2)]}],_0x274152=_0x56e1c3[_0x38af67(0x2fe)](_0x56961c=>(_0x56961c['has']?'✅':'❌')+'\x20'+_0x56961c[_0x26c89c(0x44e)]+'\x20*'+_0x56961c[_0x38af67(0x4eb)]+'*\x20—\x20`'+_0x56961c[_0x38af67(0x600)]+'`');await _0x44ef12[_0x26c89c(0x33b)+_0x26c89c(0x16f)](_0x38af67(0x5c0)+'ms*\x0a\x0a'+_0x274152[_0x26c89c(0x2fa)]('\x0a')+'\x0a\x0a'+('_Set\x20up\x20pl'+_0x38af67(0x511)+_0x38af67(0x549)+'odels\x20→\x20Pl'+_0x26c89c(0x54e))+(_0x26c89c(0x402)+_0x26c89c(0x668)+_0x26c89c(0x5fe)+_0x26c89c(0x219)+_0x38af67(0x338)+_0x26c89c(0x498)),{'parse_mode':_0x38af67(0x515)});break;}case _0x38af67(0x2eb):{const _0x575952=await getSudoStatus(),_0x529ba5=_0x575952[_0x38af67(0x5c1)]?_0x575952[_0x26c89c(0xdf)]?'✅':'⚠️':'❌';await _0x44ef12[_0x26c89c(0x33b)+_0x26c89c(0x16f)]('🔐\x20*Sudo\x20/\x20'+'Admin\x20Acce'+_0x26c89c(0x389)+(_0x38af67(0x20d)+_0x529ba5+'\x20'+(_0x575952[_0x38af67(0x5c1)]?_0x575952[_0x38af67(0xdf)]?_0x38af67(0x195)+_0x38af67(0x3c6):'Configured':_0x26c89c(0x494))+'\x0a')+(_0x38af67(0x5b1)+'\x20'+_0x575952[_0x38af67(0xba)+_0x38af67(0x580)]+'\x0a\x0a')+(_0x38af67(0x90)+_0x38af67(0x8e)+_0x38af67(0x367)+_0x26c89c(0x419))+(_0x26c89c(0x51d)+_0x38af67(0x2cb)+_0x38af67(0x13d)+_0x38af67(0x2ad)+'\x0a')+(_0x38af67(0x4c1)+_0x26c89c(0x4aa)+_0x26c89c(0x408)+_0x26c89c(0x65c)+_0x575952[_0x26c89c(0xba)+_0x38af67(0x580)]+'._'),{'parse_mode':_0x26c89c(0x515)});break;}case _0x26c89c(0x10e)+'s':{try{const {readPermissionsSnapshot:_0x5f31f9}=await import(_0x26c89c(0x451)+_0x26c89c(0x50a)+_0x26c89c(0x1cf)+'.js'),_0x2a2643=await _0x5f31f9(),_0x566bd8={'granted':'✅','missing':'❌','tool-missing':'⚠️','n/a':'·'},_0x67b008=_0x2a2643[_0x26c89c(0x2fe)](_0x41a352=>_0x566bd8[_0x41a352[_0x26c89c(0x49f)]]+'\x20*'+_0x41a352[_0x26c89c(0x10e)]['name']+_0x26c89c(0x129)+_0x41a352[_0x26c89c(0x49f)]+(_0x41a352['detail']?_0x38af67(0x60f)+_0x41a352[_0x38af67(0x99)]+')_':'')),_0x34942c=_0x2a2643[_0x38af67(0x4b3)](_0x7f17d4=>_0x7f17d4[_0x38af67(0x49f)]==='missing'||_0x7f17d4[_0x26c89c(0x49f)]===_0x38af67(0x198)+'ng')[_0x26c89c(0x1b9)],_0x2d6ad7=_0x34942c===0x9a0+0x2*-0x11c7+0x19ee*0x1?_0x26c89c(0x84)+'cable\x20perm'+_0x38af67(0x3a3)+'anted.*':'*'+_0x34942c+('\x20permissio'+'n')+(_0x34942c===-0x2f+0x5a3+-0x573?'':'s')+('\x20need\x20atte'+'ntion.*');await _0x44ef12[_0x38af67(0x33b)+_0x38af67(0x16f)](_0x38af67(0x59e)+'ions\x20Statu'+'s*\x0a\x0a'+_0x67b008['join']('\x0a')+'\x0a\x0a'+_0x2d6ad7+'\x0a\x0a'+(_0x38af67(0x27a)+'sn\x27t\x20let\x20a'+_0x26c89c(0x5e7)+_0x26c89c(0xe8)+'missions\x20o'+_0x26c89c(0x4ab)+_0x38af67(0x637)+_0x38af67(0x322)+'tch,\x20the\x20w'+_0x38af67(0x1dd)+'fies._\x0a\x0a')+(_0x38af67(0x57b)+'e\x20guided\x20w'+_0x38af67(0x5de))+(_0x26c89c(0x208)+_0x38af67(0x65b)+_0x26c89c(0x5f2)+_0x26c89c(0x409)+_0x26c89c(0x495)+_0x38af67(0x10c)+_0x26c89c(0x217)+'s,\x20verifie'+_0x26c89c(0x13f))+(_0x26c89c(0x279)+_0x26c89c(0x1c8)+_0x38af67(0x50c)+(process['env']['WEB_PORT']||-0x84d*0x2+-0x20ad+0x1c1*0x23)+('\x20→\x20Setting'+'s')),{'parse_mode':'Markdown'});}catch(_0x192ddb){await _0x44ef12[_0x26c89c(0x33b)+_0x26c89c(0x16f)](_0x38af67(0x59e)+'ions\x20Statu'+_0x38af67(0x489)+_0x38af67(0x1f7)+'wizard\x20mod'+_0x26c89c(0x14e)+'`alvin-bot'+_0x38af67(0x56d)+_0x26c89c(0x2f1)+'\x20in\x20a\x20term'+'inal._',{'parse_mode':'Markdown'});}break;}case _0x26c89c(0x4ac):{await _0x44ef12[_0x38af67(0x33b)+_0x26c89c(0x16f)](_0x38af67(0x15f)+'hboard*\x0a\x0a'+(_0x38af67(0x354)+'://localho'+_0x26c89c(0x4af)+(process[_0x38af67(0x600)][_0x26c89c(0x43f)]||0x15*0x95+0x145*0xd+-0x1*0x109e)+_0x38af67(0x625))+(_0x26c89c(0x467)+_0x38af67(0x1ba)+_0x26c89c(0x131))+(_0x26c89c(0x1b8)+_0x26c89c(0x1a8)+_0x38af67(0x259))+(_0x26c89c(0x397)+'\x20platforms'+'\x0a')+(_0x26c89c(0x3b3)+_0x38af67(0x468)+'\x0a')+(_0x26c89c(0xf6)+'emory\x0a')+(_0x38af67(0x36c)+_0x26c89c(0x3ed))+(_0x38af67(0x2db)+_0x26c89c(0x209)),{'parse_mode':_0x26c89c(0x515)});break;}}await _0x44ef12[_0x26c89c(0x250)+_0x38af67(0x202)]();});function _0x17e512(_0xb1dd99){return{'interruptQuery':()=>interruptQuery(_0xb1dd99),'killDetachedAgents':()=>killSessionDetachedAgents(_0xb1dd99),'clearPendingForSession':_0x125e4a=>cancelPendingForSession(_0x125e4a)};}_0x24722c[_0xa4a5c3(0x487)]('cancel',async _0xbd50e7=>{const _0x362bcc=_0x311a27,_0x262555=_0x311a27,_0x21a2a6=_0xbd50e7[_0x362bcc(0x376)]['id'],_0x3305b2=buildSessionKey(_0x262555(0x223),_0xbd50e7[_0x262555(0x5e3)]['id'],_0x21a2a6),_0x40b2a2=getSession(_0x3305b2),_0x48c717=_0x40b2a2[_0x262555(0x2a2)];_0x40b2a2[_0x362bcc(0x1ca)+'ng']?(requestStop(_0x40b2a2,_0x362bcc(0x518),_0x17e512(_0x40b2a2)),await _0xbd50e7['reply'](t(_0x262555(0x58a)+_0x362bcc(0x27d)+'g',_0x48c717)),await _0xbd50e7[_0x262555(0x191)](t('bot.cancel'+_0x362bcc(0x2c7),_0x48c717))[_0x362bcc(0x53e)](()=>{})):await _0xbd50e7['reply'](t(_0x262555(0x58a)+_0x362bcc(0x602),_0x48c717));}),_0x24722c[_0xa4a5c3(0x487)](_0xa4a5c3(0x58d),async _0x1d01ac=>{const _0xff10f7=_0x311a27,_0x3860ef=_0x311a27,_0x57f38d=_0x1d01ac[_0xff10f7(0x376)]['id'],_0x4f9208=buildSessionKey('telegram',_0x1d01ac['chat']['id'],_0x57f38d),_0x320960=getSession(_0x4f9208),_0x157061=_0x320960[_0xff10f7(0x2a2)];_0x320960['isProcessi'+'ng']?(requestStop(_0x320960,'hard',_0x17e512(_0x320960)),await _0x1d01ac[_0xff10f7(0x191)](t(_0x3860ef(0x58a)+'.stoppedAl'+'l',_0x157061))):await _0x1d01ac[_0x3860ef(0x191)](t(_0xff10f7(0x58a)+'.noRunning',_0x157061));}),_0x24722c['callbackQu'+'ery'](/^stop:(.+)$/,async _0x1472d2=>{const _0x3d9523=_0x311a27,_0x17ee57=_0x311a27,_0x106513=_0x1472d2['match'][0x1928+0x71b*0x5+-0x3cae],_0x480f95=getSession(_0x106513),_0xc5913d=_0x480f95['language'],_0x47ed37=_0x480f95['isProcessi'+'ng'];_0x47ed37&&requestStop(_0x480f95,_0x3d9523(0x518),_0x17e512(_0x480f95));const _0xae9630=_0x47ed37?_0x17ee57(0x58a)+'.stoppedTo'+'ast':_0x17ee57(0x58a)+_0x3d9523(0x486)+'ne';try{await _0x1472d2[_0x17ee57(0x250)+_0x17ee57(0x202)]({'text':t(_0xae9630,_0xc5913d)});}catch{}try{await _0x1472d2['editMessag'+_0x17ee57(0x2b6)+'up']({});}catch{}_0x47ed37&&await _0x1472d2[_0x17ee57(0x191)](t(_0x17ee57(0x58a)+_0x17ee57(0x2c7),_0xc5913d))[_0x17ee57(0x53e)](()=>{});}),_0x24722c[_0x311a27(0x487)](_0x311a27(0x529),async _0x5295f0=>{const _0x540b04=_0x311a27,_0x222cdb=_0x311a27,_0x30e4f0=getSession(_0x5295f0[_0x540b04(0x376)]['id'])[_0x222cdb(0x2a2)];await _0x5295f0[_0x222cdb(0x191)](t(_0x540b04(0x374)+'t.triggere'+'d',_0x30e4f0)),markExpectedRestart(),setTimeout(()=>process[_0x222cdb(0x39e)](0x6f8+-0x1259+0xb61),-0xeee+0xe*-0x65+-0xef*-0x18);}),_0x24722c[_0x311a27(0x487)](_0x311a27(0x5f9),async _0x22cd58=>{const _0x389647=_0xa4a5c3,_0x234c5c=_0xa4a5c3,_0x58f367=getSession(_0x22cd58['from']['id'])[_0x389647(0x2a2)];await _0x22cd58[_0x234c5c(0x191)](t(_0x389647(0x303)+_0x234c5c(0x232),_0x58f367));try{const _0x5c73cc=await runUpdate();if(_0x5c73cc['ok']){await _0x22cd58['reply']('✅\x20'+_0x5c73cc['message']);const _0x5b4c3b=_0x5c73cc[_0x234c5c(0x431)][_0x234c5c(0x163)](/v(\d+\.\d+\.\d+)/);if(_0x5b4c3b){const _0x284f5e=getReleaseHighlights(_0x5b4c3b[0x1c31+0x715+0x2345*-0x1]);_0x284f5e&&await _0x22cd58[_0x389647(0x191)](_0x389647(0x128)+_0x389647(0x525)+_0x5b4c3b[0x1584+0x91a+0x1cd*-0x11]+_0x234c5c(0x642)+_0x284f5e,{'parse_mode':_0x234c5c(0x515)});}_0x5c73cc[_0x234c5c(0x3e2)+'start']&&(await _0x22cd58[_0x234c5c(0x191)](t(_0x389647(0x303)+_0x234c5c(0x46e)+'g',_0x58f367)),markExpectedRestart(),setTimeout(()=>process[_0x389647(0x39e)](-0x8fc+-0xfe6+0x18e2),-0x162a*0x1+-0x7*-0x323+0x229));}else await _0x22cd58['reply'](t(_0x389647(0x303)+_0x389647(0x3dc),_0x58f367)+'\x0a`'+_0x5c73cc['message']+'`',{'parse_mode':_0x389647(0x515)});}catch(_0x499c18){const _0x293e45=_0x499c18 instanceof Error?_0x499c18[_0x389647(0x431)]:String(_0x499c18);await _0x22cd58['reply'](t(_0x389647(0x303)+'.error',_0x58f367)+'\x20'+_0x293e45);}}),_0x24722c[_0xa4a5c3(0x487)](_0x311a27(0x1a1),async _0x7c7d7b=>{const _0x622680=_0xa4a5c3,_0x5e0008=_0xa4a5c3,_0x31d1fb=getSession(_0x7c7d7b['from']['id'])[_0x622680(0x2a2)],_0x466968=(_0x7c7d7b[_0x5e0008(0x163)]||'')['trim']()[_0x5e0008(0x4a8)+'e']();if(_0x466968==='on')setAutoUpdate(!![]),await _0x7c7d7b[_0x622680(0x191)](t(_0x622680(0x336)+'date.enabl'+'ed',_0x31d1fb),{'parse_mode':'Markdown'});else{if(_0x466968==='off')setAutoUpdate(![]),await _0x7c7d7b[_0x622680(0x191)](t(_0x5e0008(0x336)+_0x5e0008(0xff)+_0x5e0008(0x550),_0x31d1fb),{'parse_mode':_0x5e0008(0x515)});else{const _0x79c7a1=getAutoUpdate();await _0x7c7d7b[_0x622680(0x191)](t('bot.autoup'+_0x622680(0x546)+'sLabel',_0x31d1fb)+'\x20*'+(_0x79c7a1?'ON':_0x622680(0x137))+'*\x0a\x0a'+t(_0x622680(0x336)+'date.comma'+'ndsLabel',_0x31d1fb)+(_0x622680(0x23b)+_0x5e0008(0x1df)+_0x5e0008(0x1a1)+_0x5e0008(0xcf)),{'parse_mode':_0x5e0008(0x515)});}}}),_0x24722c[_0x311a27(0x487)](_0xa4a5c3(0x2a8),async _0x432f31=>{const _0xc49ae3=_0xa4a5c3,_0x391c25=_0xa4a5c3,_0x29485b=(_0x432f31[_0xc49ae3(0x163)]||'')['trim']()[_0xc49ae3(0x4a8)+'e']();if(_0x29485b==='run'||_0x29485b===_0x391c25(0x383)){await _0x432f31[_0x391c25(0x191)](_0xc49ae3(0x34e)+'disk\x20clean'+_0xc49ae3(0x117));const _0x450f3d=await runCleanup(),_0x4c74d3=_0x450f3d[_0xc49ae3(0x327)+_0x391c25(0x24d)],_0x28ce32=_0x4c74d3<(0x1570+0xc9d+0x9d*-0x31)*(-0x901+-0x59*-0x6+0xd7*0xd)?(_0x4c74d3/(-0x3*0x38b+-0x22d5+-0x18bb*-0x2))[_0xc49ae3(0x3e1)](-0x1a05*-0x1+-0x260e+0xc0a)+_0xc49ae3(0x51b):_0x4c74d3<(0x194+0x1*0x10d4+-0xe68*0x1)*(-0x1df9+0xd7f+0x147a)*(-0x7cf+0x57f*-0x7+0x3248)?(_0x4c74d3/(-0x129*0x4+0x2*-0xedd+-0x1*-0x265e)/(-0x17eb+-0x68+0x1c53*0x1))['toFixed'](0x1994+-0x3*0xcb3+0xc86)+_0xc49ae3(0x302):(_0x4c74d3/(-0x51b+-0xfd+0xa18)/(-0x3d*-0x3f+0x18a4+-0x23a7)/(-0x4*0x472+0xc7*0xd+0xbad*0x1))[_0xc49ae3(0x3e1)](-0x1*0x2125+0x19ee*-0x1+0x3b15)+_0xc49ae3(0x310),_0x35c5ca=_0x450f3d[_0x391c25(0x636)][_0xc49ae3(0x1b9)]>0xd23+0x18c2+-0x25e5?'\x0a⚠️\x20'+_0x450f3d[_0x391c25(0x636)][_0xc49ae3(0x1b9)]+_0x391c25(0x2a4):'';await _0x432f31[_0xc49ae3(0x191)](_0x391c25(0x3d1)+'done\x0a•\x20Fil'+_0xc49ae3(0x532)+':\x20'+_0x450f3d[_0x391c25(0x29e)+'ed']+(_0xc49ae3(0x50e)+_0x391c25(0x2af))+_0x450f3d[_0xc49ae3(0x109)+'d']+(_0x391c25(0x5ab)+_0x391c25(0x2bd))+_0x28ce32+_0x35c5ca);}else{const _0x2aac59=getCleanupPolicy();await _0x432f31[_0xc49ae3(0x191)](_0x391c25(0xec)+_0x391c25(0x414)+(_0x391c25(0x7f)+_0xc49ae3(0x42c)+_0x2aac59[_0x391c25(0x2dd)+'Mb']+_0xc49ae3(0x5d7))+(_0x391c25(0x120)+_0xc49ae3(0x410)+_0x2aac59[_0xc49ae3(0x4d8)+'sMaxAgeDay'+'s']+_0xc49ae3(0x58b))+(_0x391c25(0x97)+_0xc49ae3(0x61e)+'>'+_0x2aac59['subagentsM'+_0xc49ae3(0x432)]+_0x391c25(0x58b))+(_0x391c25(0x5b3)+_0x391c25(0x141)+_0x2aac59['tmpMaxAgeD'+_0xc49ae3(0x7d)]+_0x391c25(0x58b))+('•\x20WhatsApp'+_0x391c25(0x500)+_0x2aac59[_0x391c25(0x655)+_0xc49ae3(0x21f)]+_0xc49ae3(0x5b4))+(_0x391c25(0xe4)+_0x391c25(0x35b)+'spaces,\x20cr'+'on\x20jobs\x20ar'+_0x391c25(0x466)+_0x391c25(0x112))+(_0x391c25(0x40e)+'via\x20env:\x20`'+_0x391c25(0x2cd)+'G_MAX_MB`,'+_0xc49ae3(0x561)+_0x391c25(0x61a)+_0x391c25(0xb7)+'CLEANUP_SU'+_0xc49ae3(0x4e4)+_0xc49ae3(0x461)+'NUP_TMP_DA'+_0xc49ae3(0x461)+_0x391c25(0x305)+_0x391c25(0x64c))+(_0x391c25(0x2b8)+'ly:\x20`/clea'+_0x391c25(0x178)),{'parse_mode':'Markdown'});}}),_0x24722c['command']([_0xa4a5c3(0x23f),'subagents'],async _0x125af3=>{const _0x3e8c6b=_0xa4a5c3,_0x419ee5=_0xa4a5c3,_0x3fea57=getSession(_0x125af3[_0x3e8c6b(0x376)]['id'])[_0x419ee5(0x2a2)],{listSubAgents:_0x270906,listActiveSubAgents:_0x4f35f3,cancelSubAgent:_0x5cde35,getSubAgentResult:_0x36afb4,getMaxParallelAgents:_0x43f29a,getConfiguredMaxParallel:_0x2ee31a,setMaxParallelAgents:_0x26447,findSubAgentByName:_0x3bad71,getVisibility:_0x34d403,setVisibility:_0x463754,getQueueCap:_0x230861,setQueueCap:_0x922526,getDefaultTimeoutMs:_0x17b27b,setDefaultTimeoutMs:_0x45fdcd}=await import(_0x3e8c6b(0x451)+_0x3e8c6b(0x93)+'s.js'),_0x4b7bf8=(_0x125af3[_0x3e8c6b(0x163)]||'')['trim'](),_0x446d2c=_0x4b7bf8['split'](/\s+/)[_0x419ee5(0x4b3)](Boolean),_0x4887f4=_0x446d2c[-0xfa*-0x24+-0xbdd*0x1+-0x174b]?.[_0x3e8c6b(0x4a8)+'e']()||'',_0x5d981b=_0x3ca312=>_0x3ca312['slice'](-0x335+0x1dc0+-0x1a8b,-0x2420+-0xf*0x8d+0x1*0x2c6b),_0x447f76=_0x371488=>{const _0x545e09=_0x3e8c6b,_0x164f79=_0x419ee5,_0x18d291='\x20\x20'[_0x545e09(0x64f)](Math[_0x545e09(0x462)](0x25a4*0x1+-0x9*0x24d+0x3*-0x5a5,_0x371488[_0x164f79(0x4c3)])),_0x551a62=Math[_0x164f79(0x207)]((Date[_0x164f79(0x383)]()-_0x371488[_0x164f79(0xae)])/(-0x25f6+0x1*-0xe5e+0x7a*0x76)),_0x585f14=_0x551a62<-0x2bb*-0xe+-0xaad*0x3+-0x5f7?_0x551a62+'s':_0x551a62<-0x1*-0x694+0x2*0x251+0x92*0x5?Math[_0x164f79(0x207)](_0x551a62/(0x5b9+0x1*0x2cf+-0x2*0x426))+'m':Math['floor'](_0x551a62/(0x1178+0x241b*-0x1+0x20b3))+'h',_0x1e53d4=_0x371488['source']===_0x545e09(0x148)?'⏰':_0x371488[_0x545e09(0x36f)]===_0x164f79(0x1e5)?'🔗':'👤',_0x3d5097=_0x371488['depth']>-0x1eb4+-0x1*-0x107f+0xe35?'\x20d'+_0x371488[_0x164f79(0x4c3)]:'',_0x5996bd=_0x371488['status']===_0x545e09(0x197)&&_0x371488['queuePosit'+'ion']?'\x20#'+_0x371488[_0x545e09(0x372)+'ion']:'';return''+_0x18d291+_0x1e53d4+'\x20`'+_0x5d981b(_0x371488['id'])+'`\x20'+_0x371488['name']+'\x20('+_0x371488['status']+_0x5996bd+',\x20'+_0x585f14+_0x3d5097+')';};if(_0x4887f4==='max'){const _0x52946e=parseInt(_0x446d2c[0x1e*0xbf+0x17*-0x4f+-0xf48]||'',-0x1*0x2566+0xc*0x12f+0x173c);if(isNaN(_0x52946e)){await _0x125af3[_0x3e8c6b(0x191)](t(_0x419ee5(0x2e6)+_0x419ee5(0x644),_0x3fea57),{'parse_mode':_0x419ee5(0x515)});return;}const _0x4f800b=_0x26447(_0x52946e);await _0x125af3[_0x419ee5(0x191)](t(_0x419ee5(0x2e6)+_0x3e8c6b(0x3dd),_0x3fea57,{'n':_0x52946e,'eff':_0x4f800b}),{'parse_mode':_0x419ee5(0x515)});return;}if(_0x4887f4===_0x3e8c6b(0x17b)){const {getSubAgentStats:_0x146539}=await import(_0x3e8c6b(0x451)+'s/subagent'+_0x3e8c6b(0x608)),_0xc37786=_0x146539(),_0x13fe73=_0x57d908=>_0x57d908<0x1804+0x102d*0x2+-0x3476?''+_0x57d908:(_0x57d908/(0x26e6+0x5d5*-0x2+-0x1754))[_0x3e8c6b(0x3e1)](0xce2+-0x1ce2+0x1001)+'k',_0x422d7e=_0x48a273=>{const _0x3012b5=Math['floor'](_0x48a273/(-0x25ff+0x260f+-0xf6*-0x4));if(_0x3012b5<-0xb*-0x1d5+0x163+-0x9*0x25e)return _0x3012b5+'s';const _0x4307e6=Math['floor'](_0x3012b5/(0x641*0x5+-0x1aad+0x12*-0x3e));return _0x4307e6+'m';},_0x5749f5=['📊\x20*Sub-Age'+'nt\x20Stats*\x20'+_0x3e8c6b(0x4fb)+_0xc37786[_0x419ee5(0x59b)+'s']+'h','',_0x419ee5(0x280)+_0xc37786[_0x419ee5(0x42d)][_0x419ee5(0x5f4)]+'\x20runs\x20·\x20'+_0x13fe73(_0xc37786[_0x419ee5(0x42d)][_0x3e8c6b(0x391)+'s'])+_0x419ee5(0x2bb)+_0x13fe73(_0xc37786[_0x3e8c6b(0x42d)][_0x419ee5(0x3ce)+'ns'])+_0x419ee5(0xf8)+_0x422d7e(_0xc37786['total'][_0x3e8c6b(0x2e1)+_0x3e8c6b(0x34d)]),'',_0x3e8c6b(0x568)+':*',_0x3e8c6b(0x1d3)+_0x3e8c6b(0x364)+_0xc37786['bySource'][_0x419ee5(0x16c)][_0x419ee5(0x5f4)]+_0x3e8c6b(0x1d0)+_0x13fe73(_0xc37786[_0x3e8c6b(0x347)][_0x419ee5(0x16c)][_0x3e8c6b(0x391)+'s'])+_0x3e8c6b(0x2bb)+_0x13fe73(_0xc37786[_0x419ee5(0x347)]['user'][_0x3e8c6b(0x3ce)+'ns'])+_0x3e8c6b(0x377),_0x419ee5(0x1bb)+_0x419ee5(0x364)+_0xc37786[_0x3e8c6b(0x347)][_0x3e8c6b(0x148)][_0x419ee5(0x5f4)]+'\x20runs\x20·\x20'+_0x13fe73(_0xc37786[_0x419ee5(0x347)][_0x419ee5(0x148)][_0x3e8c6b(0x391)+'s'])+_0x419ee5(0x2bb)+_0x13fe73(_0xc37786[_0x419ee5(0x347)][_0x419ee5(0x148)]['outputToke'+'ns'])+'\x20out','\x20\x20🔗\x20implic'+_0x3e8c6b(0x564)+_0xc37786[_0x419ee5(0x347)]['implicit']['runs']+_0x419ee5(0x1d0)+_0x13fe73(_0xc37786[_0x3e8c6b(0x347)][_0x3e8c6b(0x1e5)][_0x3e8c6b(0x391)+'s'])+_0x419ee5(0x2bb)+_0x13fe73(_0xc37786[_0x3e8c6b(0x347)][_0x419ee5(0x1e5)]['outputToke'+'ns'])+_0x419ee5(0x377),'',_0x3e8c6b(0x1f4)+':*',_0x419ee5(0x27e)+'ted:\x20'+_0xc37786['byStatus'][_0x3e8c6b(0x3fd)],'\x20\x20⚠️\x20cancel'+_0x419ee5(0x2bf)+_0xc37786[_0x3e8c6b(0x154)]['cancelled'],_0x3e8c6b(0x1fe)+_0x419ee5(0x2f4)+_0xc37786['byStatus']['timeout'],_0x419ee5(0x430)+_0x3e8c6b(0x39d)+_0xc37786['byStatus'][_0x3e8c6b(0x653)]];await _0x125af3[_0x419ee5(0x191)](_0x5749f5[_0x419ee5(0x2fa)]('\x0a'),{'parse_mode':_0x3e8c6b(0x515)});return;}if(_0x4887f4===_0x3e8c6b(0x640)){const _0x34a4a5=_0x446d2c[0x2*0x155+0x15b3+0x4*-0x617],_0x1118c8=_0x442143=>{const _0x2b03a4=_0x3e8c6b,_0x2d2d6e=_0x419ee5;if(_0x442143<=-0xfa*0x19+-0x26fc+-0x3*-0x1522)return _0x2b03a4(0x4a7)+_0x2d2d6e(0x3fc);if(_0x442143<0x20*-0xef+-0x1514+0x36dc)return _0x442143+'ms';const _0x432c4e=_0x442143/(0x18e1+0x1*0x2c+-0x1*0x1525);if(_0x432c4e<0x6f1*0x4+0x175b*-0x1+-0x42d*0x1)return _0x432c4e+'s';const _0x495f83=_0x432c4e/(0x2204+0x17db+-0x39a3);if(_0x495f83<-0x151*-0x1c+-0x307*-0x2+-0x2aae)return _0x495f83['toFixed'](_0x495f83<0x1308+0xf0b+-0x2209?-0x172b+0x1*0x222a+0xafe*-0x1:0x1*-0x11ba+0x5df+0xbdb)+'min';return(_0x495f83/(0x18e4+0x14a5+0x2d4d*-0x1))[_0x2d2d6e(0x3e1)](0x9d*0x1b+-0x1fb7+0x1*0xf29)+'h';};if(!_0x34a4a5){const _0x4d0bf9=_0x17b27b();await _0x125af3[_0x3e8c6b(0x191)](_0x3e8c6b(0x401)+_0x3e8c6b(0x2ab)+_0x3e8c6b(0x571)+_0x1118c8(_0x4d0bf9)+'*\x0a\x0a'+(_0x3e8c6b(0x348)+_0x419ee5(0x82)+_0x419ee5(0x3c8)+_0x3e8c6b(0x26b)+_0x419ee5(0x5c7)+_0x3e8c6b(0x22e)+'\x0a')+(_0x419ee5(0x3e9)+'limited`,\x20'+_0x419ee5(0x3b2)+'`0`\x20=\x20kein'+_0x419ee5(0x45d))+(_0x419ee5(0x5b2)+_0x3e8c6b(0x2b3)+_0x419ee5(0x91)+'-query\x20Cro'+_0x3e8c6b(0x621)+_0x419ee5(0x373)+'Wert.'),{'parse_mode':'Markdown'});return;}const _0x384109=_0x34a4a5[_0x3e8c6b(0x4a8)+'e']();let _0x2fd38f;if([_0x419ee5(0x587),'unlimited','infinite','-1','0'][_0x419ee5(0x262)](_0x384109))_0x2fd38f=-(0x2d5*-0x8+-0xc16*0x1+0x22bf);else{const _0x2abeb1=Number(_0x34a4a5);if(!Number['isFinite'](_0x2abeb1)||_0x2abeb1<-0x49*-0x87+0x1edc+0x43*-0x109){await _0x125af3[_0x3e8c6b(0x191)]('❌\x20Ungültig'+'er\x20Wert\x20`'+_0x34a4a5+('`.\x20Nutze\x20S'+_0x419ee5(0x15b)+_0x3e8c6b(0x100)+_0x3e8c6b(0x597)+'`.'),{'parse_mode':_0x3e8c6b(0x515)});return;}_0x2fd38f=Math[_0x419ee5(0x207)](_0x2abeb1*(-0x2*0xd13+-0x629+0x2437));}const _0xf7acec=_0x45fdcd(_0x2fd38f);await _0x125af3[_0x419ee5(0x191)]('✅\x20Default\x20'+'sub-agent\x20'+_0x419ee5(0x571)+_0x1118c8(_0xf7acec)+'*',{'parse_mode':'Markdown'});return;}if(_0x4887f4===_0x419ee5(0x2a3)){const _0x4dac6a=parseInt(_0x446d2c[0xe37+-0x14cd+-0x1*-0x697]||'',-0x20bc+-0x74f*-0x4+0x38a);if(isNaN(_0x4dac6a)){const _0x6fb9ed=_0x230861();await _0x125af3['reply'](_0x3e8c6b(0x5d3)+'\x20*'+_0x6fb9ed+_0x3e8c6b(0x38c)+(_0x6fb9ed===0x18*0xea+0x12d1+-0x1*0x28c1?_0x419ee5(0x4d0):_0x419ee5(0x417))+(')\x0aUsage:\x20`'+_0x419ee5(0x2f3)+_0x419ee5(0x659)+'`\x20(0\x20disab'+'les\x20the\x20qu'+_0x3e8c6b(0x509)+_0x3e8c6b(0x43d)),{'parse_mode':_0x419ee5(0x515)});return;}const _0x47acc7=_0x922526(_0x4dac6a);await _0x125af3['reply'](_0x419ee5(0x3f6)+'p\x20set\x20to\x20*'+_0x47acc7+'*\x20'+(_0x47acc7===0xc83+0x2f*0x7d+-0x2376?_0x3e8c6b(0xd3)+_0x3e8c6b(0x7b)+_0x419ee5(0x54a)+'jects\x20imme'+'diately)':''),{'parse_mode':'Markdown'});return;}if(_0x4887f4===_0x3e8c6b(0x355)){const _0x39b097=_0x446d2c[-0x1cf8+0x1015*0x2+-0x331*0x1];if(!_0x39b097){const _0xaabfa5=_0x34d403();await _0x125af3[_0x3e8c6b(0x191)](t('bot.subage'+'nts.visibi'+_0x3e8c6b(0x56c),_0x3fea57)+'\x20*'+_0xaabfa5+_0x419ee5(0x642)+t(_0x3e8c6b(0x2e6)+_0x419ee5(0x644),_0x3fea57),{'parse_mode':_0x419ee5(0x515)});return;}try{_0x463754(_0x39b097),await _0x125af3[_0x3e8c6b(0x191)](t('bot.subage'+_0x3e8c6b(0x382)+_0x3e8c6b(0x22a),_0x3fea57,{'mode':_0x39b097}),{'parse_mode':'Markdown'});}catch{await _0x125af3['reply'](t(_0x419ee5(0x2e6)+_0x419ee5(0x382)+_0x419ee5(0x63a)+'d',_0x3fea57,{'mode':_0x39b097}),{'parse_mode':_0x3e8c6b(0x515)});}return;}if(_0x4887f4===_0x419ee5(0x12c)){const _0x414842=await _0x4f35f3();if(_0x414842[_0x419ee5(0x1b9)]===0x1*0x940+-0x25*-0x73+0x1*-0x19df){await _0x125af3[_0x419ee5(0x191)](t('bot.subage'+_0x419ee5(0x298)+_0x3e8c6b(0x29b),_0x3fea57));return;}const _0x500021=_0x414842[_0x3e8c6b(0x2fe)](_0x447f76)['join']('\x0a');await _0x125af3[_0x3e8c6b(0x191)](t(_0x419ee5(0x2e6)+'nts.active'+_0x419ee5(0x1a7),_0x3fea57)+'\x0a'+_0x500021,{'parse_mode':_0x419ee5(0x515)});return;}if(_0x4887f4==='cancel'){const _0x54942f=_0x446d2c[0x1fe8+0x1d12+0xb*-0x58b]||'';if(!_0x54942f){await _0x125af3[_0x3e8c6b(0x191)](t('bot.subage'+_0x3e8c6b(0x644),_0x3fea57),{'parse_mode':_0x3e8c6b(0x515)});return;}const _0x46caa3=_0x3bad71(_0x54942f,{'ambiguousAsList':!![]});if(_0x46caa3&&_0x419ee5(0x4f7)in _0x46caa3){const _0x79629c=_0x46caa3[_0x3e8c6b(0xee)][_0x3e8c6b(0x2fe)](_0x364b34=>'•\x20'+_0x364b34[_0x3e8c6b(0x4eb)])[_0x419ee5(0x2fa)]('\x0a');await _0x125af3['reply'](_0x419ee5(0x182)+'\x20—\x20welchen'+_0x419ee5(0x541)+'?\x0a'+_0x79629c+(_0x419ee5(0x18f)+_0x419ee5(0x591)+_0x419ee5(0x1bc)+_0x419ee5(0x180))+_0x46caa3[_0x419ee5(0xee)][-0x1999+-0x79*0x4b+0x3d0c*0x1]['name']+'`).',{'parse_mode':'Markdown'});return;}let _0x306bc7=null,_0x5b3327=_0x54942f;if(_0x46caa3&&!(_0x419ee5(0x4f7)in _0x46caa3))_0x306bc7=_0x46caa3['id'],_0x5b3327=_0x46caa3['name'];else{const _0x1f51ef=_0x270906(),_0x4c898c=_0x1f51ef['find'](_0x2e83af=>_0x2e83af['id'][_0x3e8c6b(0x319)](_0x54942f));_0x4c898c&&(_0x306bc7=_0x4c898c['id'],_0x5b3327=_0x4c898c['name']);}if(!_0x306bc7||!_0x5cde35(_0x306bc7)){await _0x125af3[_0x419ee5(0x191)](t(_0x419ee5(0x2e6)+_0x3e8c6b(0x2a9)+'nd',_0x3fea57,{'id':_0x54942f}));return;}await _0x125af3[_0x3e8c6b(0x191)](t(_0x419ee5(0x2e6)+_0x419ee5(0x345)+'led',_0x3fea57,{'id':_0x5b3327}));return;}if(_0x4887f4==='result'){const _0x306176=_0x446d2c[-0x16b7+-0xc73+0x232b]||'';if(!_0x306176){await _0x125af3[_0x419ee5(0x191)](t(_0x3e8c6b(0x2e6)+'nts.usage',_0x3fea57),{'parse_mode':_0x419ee5(0x515)});return;}const _0x27623c=_0x3bad71(_0x306176,{'ambiguousAsList':!![]});if(_0x27623c&&_0x419ee5(0x4f7)in _0x27623c){const _0x3a39e4=_0x27623c[_0x3e8c6b(0xee)]['map'](_0x1a5e80=>'•\x20'+_0x1a5e80[_0x3e8c6b(0x4eb)])[_0x3e8c6b(0x2fa)]('\x0a');await _0x125af3['reply'](_0x3e8c6b(0x182)+'\x20—\x20welchen'+_0x419ee5(0x541)+'?\x0a'+_0x3a39e4,{'parse_mode':_0x3e8c6b(0x515)});return;}let _0x337ca1=null;if(_0x27623c&&!(_0x3e8c6b(0x4f7)in _0x27623c))_0x337ca1={'id':_0x27623c['id'],'name':_0x27623c[_0x419ee5(0x4eb)]};else{const _0x184edb=_0x270906(),_0x39d09a=_0x184edb[_0x419ee5(0x299)](_0x1d20fc=>_0x1d20fc['id']['startsWith'](_0x306176));if(_0x39d09a)_0x337ca1={'id':_0x39d09a['id'],'name':_0x39d09a[_0x3e8c6b(0x4eb)]};}if(!_0x337ca1){await _0x125af3[_0x3e8c6b(0x191)](t(_0x419ee5(0x2e6)+_0x3e8c6b(0x2a9)+'nd',_0x3fea57,{'id':_0x306176}));return;}const _0x16ae81=_0x36afb4(_0x337ca1['id']);if(!_0x16ae81){await _0x125af3[_0x3e8c6b(0x191)](t(_0x3e8c6b(0x2e6)+_0x419ee5(0x2a9)+'nd',_0x3fea57,{'id':_0x306176}));return;}const _0x2405e6=Math[_0x419ee5(0x207)](_0x16ae81['duration']/(0x21ce+0x1*0x1795+0x357b*-0x1)),_0x3eee79=t(_0x3e8c6b(0x2e6)+'nts.result'+_0x419ee5(0x1a7),_0x3fea57,{'name':_0x16ae81[_0x3e8c6b(0x4eb)],'status':_0x16ae81[_0x3e8c6b(0x79)]}),_0x4b8ede=t('bot.subage'+_0x3e8c6b(0x2ea)+_0x3e8c6b(0x164),_0x3fea57,{'sec':_0x2405e6,'in':_0x16ae81[_0x3e8c6b(0x369)][_0x3e8c6b(0x245)],'out':_0x16ae81[_0x419ee5(0x369)][_0x3e8c6b(0x181)]}),_0x1c0545=_0x16ae81[_0x3e8c6b(0x181)][_0x419ee5(0x1b9)]>0xb*0x2db+0xe*-0xb3+-0x7f3?_0x16ae81[_0x3e8c6b(0x181)][_0x3e8c6b(0x4c7)](0x1*-0x132f+0xa4+0x128b,0xb*0x1b7+0x10*-0x1f7+0x1*0x1a3f)+(_0x419ee5(0x4ce)+_0x3e8c6b(0x5bb)):_0x16ae81['output'];await _0x125af3[_0x3e8c6b(0x191)](_0x3eee79+'\x0a'+_0x4b8ede+'\x0a\x0a'+(_0x1c0545||_0x16ae81['error']||_0x3e8c6b(0x11a)+')'),{'parse_mode':_0x419ee5(0x515)})[_0x419ee5(0x53e)](()=>_0x125af3[_0x419ee5(0x191)](_0x3eee79+'\x0a'+_0x4b8ede+'\x0a\x0a'+(_0x1c0545||_0x16ae81[_0x3e8c6b(0x653)]||_0x3e8c6b(0x11a)+')')));return;}const _0x538aec=_0x2ee31a(),_0x33f176=_0x43f29a(),_0x2afe90=_0x538aec===-0x1*-0x1bb6+0xfb9+0x2b6f*-0x1?t(_0x3e8c6b(0x2e6)+'nts.maxLab'+'el',_0x3fea57)+_0x419ee5(0x20e)+t(_0x419ee5(0x2e6)+'nts.autoSu'+'ffix',_0x3fea57,{'n':_0x33f176}):t(_0x419ee5(0x2e6)+_0x419ee5(0x8c)+'el',_0x3fea57)+'\x20'+_0x538aec,_0x246b80=t(_0x419ee5(0x2e6)+_0x3e8c6b(0x382)+'lityLabel',_0x3fea57)+'\x20*'+_0x34d403()+'*',_0x3d28a2=_0x17b27b(),_0x4168e3=_0x3d28a2<=-0x222+0x9ac+0x1*-0x78a?'⏱\x20Timeout:'+'\x20*∞\x20(unlim'+_0x419ee5(0x40c):'⏱\x20Timeout:'+'\x20*'+Math[_0x3e8c6b(0x65d)](_0x3d28a2/(-0x1*0x1741+-0x2*-0x8e7+0x5*0x1df))+'s*',_0x4f0b0e=await _0x4f35f3();let _0x59fdb4='';_0x4f0b0e[_0x3e8c6b(0x1b9)]===-0x387+-0x119*0x4+0x7eb?_0x59fdb4='\x0a'+t(_0x3e8c6b(0x2e6)+_0x419ee5(0x298)+_0x3e8c6b(0x29b),_0x3fea57):_0x59fdb4='\x0a'+t(_0x419ee5(0x2e6)+'nts.active'+_0x419ee5(0x1a7),_0x3fea57)+'\x0a'+_0x4f0b0e['map'](_0x447f76)['join']('\x0a');const _0x34b912=t(_0x419ee5(0x2e6)+_0x3e8c6b(0x650),_0x3fea57),_0x4d9a8='\x0a\x0a'+t(_0x419ee5(0x2e6)+_0x419ee5(0x644),_0x3fea57),_0x32dc46=_0x34b912+'\x0a'+_0x2afe90+'\x0a'+_0x246b80+'\x0a'+_0x4168e3+_0x59fdb4+_0x4d9a8;await _0x125af3['reply'](_0x32dc46,{'parse_mode':'Markdown'})[_0x3e8c6b(0x53e)](()=>_0x125af3[_0x419ee5(0x191)](_0x32dc46));});}